github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/testdata/compaction_picker_L0 (about)

     1  # 1 L0 file.
     2  define
     3  L0
     4     000100:i.SET.101-j.SET.102
     5  ----
     6  0.0:
     7    000100:[i#101,SET-j#102,SET]
     8  
     9  pick-auto l0_compaction_threshold=1
    10  ----
    11  L0 -> L6
    12  L0: 000100
    13  
    14  pick-auto l0_compaction_file_threshold=1
    15  ----
    16  L0 -> L6
    17  L0: 000100
    18  
    19  pick-auto l0_compaction_threshold=4 l0_compaction_file_threshold=2
    20  ----
    21  nil
    22  
    23  # 1 L0 file, 1 Lbase file.
    24  
    25  define
    26  L0
    27     000100:i.SET.101-j.SET.102
    28  L6
    29     000200:f.SET.51-l.SET.52
    30  ----
    31  0.0:
    32    000100:[i#101,SET-j#102,SET]
    33  6:
    34    000200:[f#51,SET-l#52,SET]
    35  
    36  pick-auto l0_compaction_threshold=1
    37  ----
    38  L0 -> L6
    39  L0: 000100
    40  L6: 000200
    41  
    42  pick-auto l0_compaction_threshold=2
    43  ----
    44  L0 -> L6
    45  L0: 000100
    46  L6: 000200
    47  
    48  pick-auto l0_compaction_threshold=3
    49  ----
    50  nil
    51  
    52  # 2 L0 files, no overlaps.
    53  
    54  define
    55  L0
    56     000100:i.SET.101-j.SET.102
    57     000110:k.SET.111-l.SET.112
    58  L6
    59     000200:f.SET.51-l.SET.52
    60  ----
    61  0.0:
    62    000100:[i#101,SET-j#102,SET]
    63    000110:[k#111,SET-l#112,SET]
    64  6:
    65    000200:[f#51,SET-l#52,SET]
    66  
    67  pick-auto l0_compaction_threshold=1
    68  ----
    69  L0 -> L6
    70  L0: 000100,000110
    71  L6: 000200
    72  
    73  pick-auto l0_compaction_threshold=2
    74  ----
    75  L0 -> L6
    76  L0: 000100,000110
    77  L6: 000200
    78  
    79  pick-auto l0_compaction_threshold=3 l0_compaction_file_threshold=512
    80  ----
    81  nil
    82  
    83  pick-auto l0_compaction_threshold=3 l0_compaction_file_threshold=3
    84  ----
    85  nil
    86  
    87  pick-auto l0_compaction_threshold=3 l0_compaction_file_threshold=2
    88  ----
    89  L0 -> L6
    90  L0: 000100,000110
    91  L6: 000200
    92  
    93  # 2 L0 files, with ikey overlap.
    94  
    95  define
    96  L0
    97     000100:i.SET.101-p.SET.102
    98     000110:j.SET.111-q.SET.112
    99  L6
   100     000200:f.SET.51-s.SET.52
   101  ----
   102  0.1:
   103    000110:[j#111,SET-q#112,SET]
   104  0.0:
   105    000100:[i#101,SET-p#102,SET]
   106  6:
   107    000200:[f#51,SET-s#52,SET]
   108  
   109  pick-auto l0_compaction_threshold=2
   110  ----
   111  L0 -> L6
   112  L0: 000100,000110
   113  L6: 000200
   114  
   115  define
   116  L0
   117     000100:i.SET.101-p.SET.102
   118     000110:j.SET.111-q.SET.112
   119  L6
   120     000200:f.SET.51-s.SET.52
   121  ----
   122  0.1:
   123    000110:[j#111,SET-q#112,SET]
   124  0.0:
   125    000100:[i#101,SET-p#102,SET]
   126  6:
   127    000200:[f#51,SET-s#52,SET]
   128  
   129  pick-auto l0_compaction_threshold=2
   130  ----
   131  L0 -> L6
   132  L0: 000100,000110
   133  L6: 000200
   134  
   135  # 2 L0 files, with ukey overlap.
   136  
   137  define
   138  L0
   139     000100:i.SET.101-i.SET.102
   140     000110:i.SET.111-i.SET.112
   141  L6
   142     000200:f.SET.51-l.SET.52
   143  ----
   144  0.1:
   145    000110:[i#111,SET-i#112,SET]
   146  0.0:
   147    000100:[i#101,SET-i#102,SET]
   148  6:
   149    000200:[f#51,SET-l#52,SET]
   150  
   151  pick-auto l0_compaction_threshold=2
   152  ----
   153  L0 -> L6
   154  L0: 000100,000110
   155  L6: 000200
   156  
   157  # 3 L0 files (1 overlap).
   158  
   159  define
   160  L0
   161     000100:i.SET.101-p.SET.102
   162     000110:j.SET.111-q.SET.112
   163     000120:r.SET.113-s.SET.114
   164  L6
   165     000200:f.SET.51-s.SET.52
   166  ----
   167  0.1:
   168    000110:[j#111,SET-q#112,SET]
   169  0.0:
   170    000100:[i#101,SET-p#102,SET]
   171    000120:[r#113,SET-s#114,SET]
   172  6:
   173    000200:[f#51,SET-s#52,SET]
   174  
   175  pick-auto l0_compaction_threshold=2
   176  ----
   177  L0 -> L6
   178  L0: 000100,000110,000120
   179  L6: 000200
   180  
   181  pick-auto l0_compaction_threshold=3
   182  ----
   183  L0 -> L6
   184  L0: 000100,000110,000120
   185  L6: 000200
   186  
   187  pick-auto l0_compaction_threshold=4
   188  ----
   189  L0 -> L6
   190  L0: 000100,000110,000120
   191  L6: 000200
   192  
   193  pick-auto l0_compaction_threshold=6 l0_compaction_file_threshold=512
   194  ----
   195  nil
   196  
   197  # 3 L0 files (1 overlap, 1 intra-L0 compacting). Should avoid the compacting
   198  # file.
   199  
   200  define
   201  L0
   202     000100:i.SET.101-p.SET.102
   203     000110:j.SET.111-q.SET.112
   204     000120:r.SET.113-s.SET.114
   205  L6
   206     000200:f.SET.51-s.SET.52
   207  compactions
   208    L0 000120 -> L0
   209  ----
   210  0.1:
   211    000110:[j#111,SET-q#112,SET]
   212  0.0:
   213    000100:[i#101,SET-p#102,SET]
   214    000120:[r#113,SET-s#114,SET]
   215  6:
   216    000200:[f#51,SET-s#52,SET]
   217  compactions
   218    L0 000120 -> L0
   219  
   220  pick-auto l0_compaction_threshold=2
   221  ----
   222  L0 -> L6
   223  L0: 000100,000110
   224  L6: 000200
   225  
   226  # 3 L0 files (1 overlap), Lbase compacting.
   227  # Should choose an intra-L0 compaction. Note that intra-L0 compactions
   228  # don't follow l0_compaction_threshold, but rather a minIntraL0Count constant
   229  # in compaction_picker.go
   230  
   231  define
   232  L0
   233     000100:i.SET.101-p.SET.102
   234     000110:j.SET.111-q.SET.112
   235     000120:r.SET.113-s.SET.114
   236     000130:i.SET.110-p.SET.110
   237     000140:i.SET.120-p.SET.120
   238  L6
   239     000200:f.SET.51-s.SET.52
   240  compactions
   241    L6 000200 -> L6
   242  ----
   243  0.3:
   244    000140:[i#120,SET-p#120,SET]
   245  0.2:
   246    000130:[i#110,SET-p#110,SET]
   247  0.1:
   248    000110:[j#111,SET-q#112,SET]
   249  0.0:
   250    000100:[i#101,SET-p#102,SET]
   251    000120:[r#113,SET-s#114,SET]
   252  6:
   253    000200:[f#51,SET-s#52,SET]
   254  compactions
   255    L6 000200 -> L6
   256  
   257  pick-auto
   258  ----
   259  L0 -> L0
   260  L0: 000100,000110,000130,000140
   261  
   262  max-output-file-size
   263  ----
   264  2097152
   265  
   266  max-overlap-bytes
   267  ----
   268  20971520
   269  
   270  # 1 L0 file. Should not choose any compaction, as an intra-L0 compaction
   271  # with one input is unhelpful.
   272  
   273  define
   274  L0
   275     000100:i.SET.101-p.SET.102
   276  L6
   277     000200:f.SET.51-s.SET.52
   278  compactions
   279    L6 000200 -> L6
   280  ----
   281  0.0:
   282    000100:[i#101,SET-p#102,SET]
   283  6:
   284    000200:[f#51,SET-s#52,SET]
   285  compactions
   286    L6 000200 -> L6
   287  
   288  pick-auto l0_compaction_threshold=1
   289  ----
   290  nil
   291  
   292  # Test an in-progress L0->Lbase compaction with another L0 file that does not
   293  # overlap any of the compacting files in L0 or Lbase, but does overlap the
   294  # compaction's range. No new compaction should be picked because the
   295  # in-progress compaction's output tables could overlap the non-compacting
   296  # file.
   297  
   298  define
   299  L0
   300    000010:a.SET.11-b.SET.12
   301    000013:k.SET.23-n.SET.24
   302    000011:x.SET.13-z.SET.25
   303  L1
   304    000101:a.SET.1-f.SET.2
   305    000102:w.SET.3-z.SET.4
   306  compactions
   307    L0 000010 000011 -> L1 000101 000102
   308  ----
   309  0.0:
   310    000010:[a#11,SET-b#12,SET]
   311    000013:[k#23,SET-n#24,SET]
   312    000011:[x#13,SET-z#25,SET]
   313  1:
   314    000101:[a#1,SET-f#2,SET]
   315    000102:[w#3,SET-z#4,SET]
   316  compactions
   317    L0 000010 000011 -> L1 000101 000102
   318  
   319  pick-auto l0_compaction_threshold=2
   320  ----
   321  nil
   322  
   323  define
   324  L0
   325    001621:b.MERGE.1261-b.MERGE.1261
   326    001603:d.DEL.1248-d.DEL.1248
   327    001609:e.DEL.1253-e.DEL.1253
   328  L6
   329    001615:a.RANGEDEL.1254-c.RANGEDEL.72057594037927935
   330    001619:c.SET.0-c.SET.0
   331  ----
   332  0.0:
   333    001621:[b#1261,MERGE-b#1261,MERGE]
   334    001603:[d#1248,DEL-d#1248,DEL]
   335    001609:[e#1253,DEL-e#1253,DEL]
   336  6:
   337    001615:[a#1254,RANGEDEL-c#inf,RANGEDEL]
   338    001619:[c#0,SET-c#0,SET]
   339  
   340  pick-auto
   341  ----
   342  L0 -> L6
   343  L0: 001621
   344  L6: 001615
   345  
   346  define
   347  L0
   348    001445:b.RANGEDEL.528-e.RANGEDEL.72057594037927935
   349    001448:g.RANGEDEL.529-h.RANGEDEL.72057594037927935
   350  L6
   351    001428:a.MERGE.486-c.RANGEDEL.72057594037927935
   352    001424:c.MERGE.479-d.RANGEDEL.72057594037927935
   353    001442:f.MERGE.0-i.SET.0
   354  ----
   355  0.0:
   356    001445:[b#528,RANGEDEL-e#inf,RANGEDEL]
   357    001448:[g#529,RANGEDEL-h#inf,RANGEDEL]
   358  6:
   359    001428:[a#486,MERGE-c#inf,RANGEDEL]
   360    001424:[c#479,MERGE-d#inf,RANGEDEL]
   361    001442:[f#0,MERGE-i#0,SET]
   362  
   363  pick-auto
   364  ----
   365  L0 -> L6
   366  L0: 001445
   367  L6: 001424,001428
   368  
   369  define
   370  L0
   371    000002:b.SET.12-b.SET.12
   372    000003:c.SET.13-c.SET.13
   373  L6
   374    000603:c.SET.03-c.SET.03
   375  ----
   376  0.0:
   377    000002:[b#12,SET-b#12,SET]
   378    000003:[c#13,SET-c#13,SET]
   379  6:
   380    000603:[c#3,SET-c#3,SET]
   381  
   382  pick-auto
   383  ----
   384  L0 -> L6
   385  L0: 000002
   386  
   387  define
   388  L0
   389    000053:e.SET.24-e.SET.24
   390    000055:x.SET.25-x.SET.25
   391    000051:e.DEL.23-e.DEL.23
   392    000049:t.SET.22-t.SET.22
   393    000046:x.MERGE.21-x.MERGE.21
   394  L6
   395    000045:f.SET.0-x.SET.0
   396  ----
   397  0.1:
   398    000051:[e#23,DEL-e#23,DEL]
   399    000046:[x#21,MERGE-x#21,MERGE]
   400  0.0:
   401    000053:[e#24,SET-e#24,SET]
   402    000049:[t#22,SET-t#22,SET]
   403    000055:[x#25,SET-x#25,SET]
   404  6:
   405    000045:[f#0,SET-x#0,SET]
   406  
   407  pick-auto
   408  ----
   409  L0 -> L6
   410  L0: 000051,000053
   411  
   412  # At low priority, find and compact marked-for-compaction files.
   413  
   414  define
   415  L0
   416    000049:t.SET.22-t.SET.22
   417  L6
   418    000045:f.SET.0-x.SET.0
   419  ----
   420  0.0:
   421    000049:[t#22,SET-t#22,SET]
   422  6:
   423    000045:[f#0,SET-x#0,SET]
   424  
   425  mark-for-compaction file=000049
   426  ----
   427  marked L0.000049
   428  
   429  pick-auto l0_compaction_threshold=1000
   430  ----
   431  L0 -> L0
   432  L0: 000049