github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/internal/manifest/testdata/l0_sublevels (about)

     1  
     2  define
     3  L0
     4    000009:a.SET.10-b.SET.10
     5    000007:c.SET.6-d.SET.8
     6    000003:e.SET.5-j.SET.7
     7  ----
     8  file count: 3, sublevels: 1, intervals: 6
     9  flush split keys(3): [b, d, j]
    10  0.0: file count: 3, bytes: 768, width (mean, max): 1.0, 1, interval range: [0, 4]
    11  	000009:[a#10,1-b#10,1]
    12  	000007:[c#6,1-d#8,1]
    13  	000003:[e#5,1-j#7,1]
    14  compacting file count: 0, base compacting intervals: none
    15  L0.0:  a---b c---d e---------------j
    16         aa bb cc dd ee ff gg hh ii jj
    17  
    18  in-use-key-ranges
    19  a-z
    20  a-c
    21  aa-cc
    22  f-g
    23  e-j
    24  ----
    25  a-b, c-d, e-j
    26  a-b, c-d
    27  a-b, c-d
    28  e-j
    29  e-j
    30  
    31  define
    32  L0
    33    000009:a.SET.10-b.SET.10
    34    000007:b.SET.6-j.SET.8
    35    000003:e.SET.5-j.SET.7
    36  ----
    37  file count: 3, sublevels: 3, intervals: 5
    38  flush split keys(2): [b, j]
    39  0.2: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
    40  	000009:[a#10,1-b#10,1]
    41  0.1: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [1, 3]
    42  	000007:[b#6,1-j#8,1]
    43  0.0: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [3, 3]
    44  	000003:[e#5,1-j#7,1]
    45  compacting file count: 0, base compacting intervals: none
    46  L0.2:  a---b
    47  L0.1:     b------------------------j
    48  L0.0:              e---------------j
    49         aa bb cc dd ee ff gg hh ii jj
    50  
    51  in-use-key-ranges
    52  a-z
    53  a-b
    54  a-aa
    55  b-bb
    56  b-j
    57  j-j
    58  ----
    59  a-j
    60  a-j
    61  a-b
    62  b-j
    63  b-j
    64  e-j
    65  
    66  define no_initialize
    67  L0.2
    68    000009:a.SET.10-b.SET.10
    69  L0.1
    70    000003:e.SET.5-j.SET.7
    71  L0.0
    72    000007:b.SET.6-j.SET.8
    73  ----
    74  file count: 3, sublevels: 3, intervals: 0
    75  flush split keys(0): []
    76  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
    77  	000009:[a#10,1-b#10,1]
    78  0.1: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
    79  	000003:[e#5,1-j#7,1]
    80  0.0: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
    81  	000007:[b#6,1-j#8,1]
    82  compacting file count: 0, base compacting intervals: none
    83  L0.2:  a---b
    84  L0.1:              e---------------j
    85  L0.0:     b------------------------j
    86         aa bb cc dd ee ff gg hh ii jj
    87  
    88  l0-check-ordering
    89  ----
    90  OK
    91  
    92  define no_initialize
    93  L0.1
    94    000009:a.SET.10-b.SET.10
    95  L0.0
    96    000007:b.SET.6-j.SET.8
    97    000003:e.SET.5-j.SET.7
    98  ----
    99  file count: 3, sublevels: 2, intervals: 0
   100  flush split keys(0): []
   101  0.1: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   102  	000009:[a#10,1-b#10,1]
   103  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 0]
   104  	000007:[b#6,1-j#8,1]
   105  	000003:[e#5,1-j#7,1]
   106  compacting file count: 0, base compacting intervals: none
   107  L0.1:  a---b
   108  L0.0:     b------------------------j e---j
   109         aa bb cc dd ee ff gg hh ii jj
   110  
   111  l0-check-ordering
   112  ----
   113  L0.0 files 000007 and 000003 have overlapping ranges: [b#6,SET-j#8,SET] vs [e#5,SET-j#7,SET]
   114  
   115  define
   116  L0
   117    000001:a.SET.2-b.SET.3
   118    000002:c.SET.3-d.SET.5
   119    000003:e.SET.5-f.SET.7
   120    000005:f.SET.6-h.SET.9
   121    000006:f.SET.4-g.SET.5
   122    000009:f.SET.10-i.SET.10
   123    000010:f.SET.11-g.SET.11
   124  L6
   125    000007:a.SET.0-f.SET.0
   126    000008:g.SET.0-s.SET.0
   127  ----
   128  file count: 7, sublevels: 5, intervals: 10
   129  flush split keys(3): [d, f, g]
   130  0.4: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [5, 6]
   131  	000010:[f#11,1-g#11,1]
   132  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [5, 8]
   133  	000009:[f#10,1-i#10,1]
   134  0.2: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [5, 7]
   135  	000005:[f#6,1-h#9,1]
   136  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [4, 5]
   137  	000003:[e#5,1-f#7,1]
   138  0.0: file count: 3, bytes: 768, width (mean, max): 1.3, 2, interval range: [0, 6]
   139  	000001:[a#2,1-b#3,1]
   140  	000002:[c#3,1-d#5,1]
   141  	000006:[f#4,1-g#5,1]
   142  compacting file count: 0, base compacting intervals: none
   143  L0.4:                 f---g
   144  L0.3:                 f---------i
   145  L0.2:                 f------h
   146  L0.1:              e---f
   147  L0.0:  a---b c---d    f---g
   148  L6:    a---------------f g------------------------------------s
   149         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   150  
   151  max-depth-after-ongoing-compactions
   152  ----
   153  5
   154  
   155  pick-base-compaction min_depth=3
   156  ----
   157  compaction picked with stack depth reduction 5
   158  000006,000003,000005,000009,000010,000001,000002
   159  seed interval: f-f
   160  L0.4:                 f+++g
   161  L0.3:                 f+++++++++i
   162  L0.2:                 f++++++h
   163  L0.1:              e+++f
   164  L0.0:  a+++b c+++d    f+++g
   165  L6:    a---------------f g------------------------------------s
   166         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   167  
   168  # SSTables 000001 and 000002 are optional additions to the above compaction, as they
   169  # overlap with base files that overlap with L0 files in the seed interval.
   170  # Marking 0002 as compacting should be enough to exclude both from the
   171  # chosen compaction.
   172  
   173  in-use-key-ranges
   174  a-z
   175  ----
   176  a-b, c-d, e-i
   177  
   178  define
   179  L0
   180    000001:a.SET.2-b.SET.3
   181    000002:c.SET.3-d.SET.5 intra_l0_compacting
   182    000003:e.SET.5-f.SET.7
   183    000005:f.SET.6-h.SET.9
   184    000006:f.SET.4-g.SET.5
   185    000009:f.SET.10-i.SET.10
   186    000010:f.SET.11-g.SET.11
   187  L6
   188    000007:a.SET.0-f.SET.0
   189    000008:g.SET.0-s.SET.0
   190  ----
   191  file count: 7, sublevels: 5, intervals: 10
   192  flush split keys(3): [d, f, g]
   193  0.4: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [5, 6]
   194  	000010:[f#11,1-g#11,1]
   195  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [5, 8]
   196  	000009:[f#10,1-i#10,1]
   197  0.2: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [5, 7]
   198  	000005:[f#6,1-h#9,1]
   199  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [4, 5]
   200  	000003:[e#5,1-f#7,1]
   201  0.0: file count: 3, bytes: 768, width (mean, max): 1.3, 2, interval range: [0, 6]
   202  	000001:[a#2,1-b#3,1]
   203  	000002:[c#3,1-d#5,1]
   204  	000006:[f#4,1-g#5,1]
   205  compacting file count: 1, base compacting intervals: none
   206  L0.4:                 f---g
   207  L0.3:                 f---------i
   208  L0.2:                 f------h
   209  L0.1:              e---f
   210  L0.0:  a---b c^^^d    f---g
   211  L6:    a---------------f g------------------------------------s
   212         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   213  
   214  
   215  pick-base-compaction min_depth=3
   216  ----
   217  compaction picked with stack depth reduction 5
   218  000006,000003,000005,000009,000010
   219  seed interval: f-f
   220  L0.4:                 f+++g
   221  L0.3:                 f+++++++++i
   222  L0.2:                 f++++++h
   223  L0.1:              e+++f
   224  L0.0:  a---b c^^^d    f+++g
   225  L6:    a---------------f g------------------------------------s
   226         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   227  
   228  # Mark the above compaction as started.
   229  
   230  update-state-for-compaction files=(000006,000003,000005,000009,000010)
   231  ----
   232  OK
   233  
   234  describe
   235  ----
   236  file count: 7, sublevels: 5, intervals: 10
   237  flush split keys(3): [d, f, g]
   238  0.4: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [5, 6]
   239  	000010:[f#11,1-g#11,1]
   240  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [5, 8]
   241  	000009:[f#10,1-i#10,1]
   242  0.2: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [5, 7]
   243  	000005:[f#6,1-h#9,1]
   244  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [4, 5]
   245  	000003:[e#5,1-f#7,1]
   246  0.0: file count: 3, bytes: 768, width (mean, max): 1.3, 2, interval range: [0, 6]
   247  	000001:[a#2,1-b#3,1]
   248  	000002:[c#3,1-d#5,1]
   249  	000006:[f#4,1-g#5,1]
   250  compacting file count: 6, base compacting intervals: [4, 9]
   251  L0.4:                 fvvvg
   252  L0.3:                 fvvvvvvvvvi
   253  L0.2:                 fvvvvvvh
   254  L0.1:              evvvf
   255  L0.0:  a---b c^^^d    fvvvg
   256  L6:    a---------------f g------------------------------------s
   257         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   258  
   259  pick-base-compaction min_depth=3
   260  ----
   261  no compaction picked
   262  
   263  # Extend one of the SSTables (000009) to the right, and place an SSTable "under"
   264  # the extension (000011). This adds it to the compaction.
   265  
   266  define
   267  L0
   268    000005:f.SET.6-h.SET.9
   269    000006:f.SET.4-g.SET.5
   270    000009:f.SET.10-p.SET.10
   271    000010:f.SET.11-g.SET.11
   272    000011:n.SET.8-p.SET.10
   273  L6
   274    000007:a.SET.0-f.SET.0
   275    000008:g.SET.0-s.SET.0
   276  ----
   277  file count: 5, sublevels: 4, intervals: 5
   278  flush split keys(2): [g, p]
   279  0.3: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   280  	000010:[f#11,1-g#11,1]
   281  0.2: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   282  	000009:[f#10,1-p#10,1]
   283  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   284  	000005:[f#6,1-h#9,1]
   285  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   286  	000006:[f#4,1-g#5,1]
   287  	000011:[n#8,1-p#10,1]
   288  compacting file count: 0, base compacting intervals: none
   289  L0.3:                 f---g
   290  L0.2:                 f------------------------------p
   291  L0.1:                 f------h
   292  L0.0:                 f---g                   n------p
   293  L6:    a---------------f g------------------------------------s
   294         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   295  
   296  in-use-key-ranges
   297  a-z
   298  ----
   299  f-p
   300  
   301  pick-base-compaction min_depth=3
   302  ----
   303  compaction picked with stack depth reduction 4
   304  000006,000005,000009,000011,000010
   305  seed interval: f-g
   306  L0.3:                 f+++g
   307  L0.2:                 f++++++++++++++++++++++++++++++p
   308  L0.1:                 f++++++h
   309  L0.0:                 f+++g                   n++++++p
   310  L6:    a---------------f g------------------------------------s
   311         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   312  
   313  # Set SSTable 000011 which is under/older SSTable 000009 to IsBaseCompacting = true.
   314  # This should prevent SSTable 000009 from participating in a base compaction.
   315  
   316  define
   317  L0
   318    000005:f.SET.6-h.SET.9
   319    000006:f.SET.4-g.SET.5
   320    000009:f.SET.10-p.SET.10
   321    000010:f.SET.11-g.SET.11
   322    000011:n.SET.8-p.SET.9 base_compacting
   323  L6
   324    000007:a.SET.0-f.SET.0
   325    000008:g.SET.0-s.SET.0
   326  ----
   327  file count: 5, sublevels: 4, intervals: 5
   328  flush split keys(2): [g, p]
   329  0.3: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   330  	000010:[f#11,1-g#11,1]
   331  0.2: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   332  	000009:[f#10,1-p#10,1]
   333  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   334  	000005:[f#6,1-h#9,1]
   335  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   336  	000006:[f#4,1-g#5,1]
   337  	000011:[n#8,1-p#9,1]
   338  compacting file count: 1, base compacting intervals: [3, 4]
   339  L0.3:                 f---g
   340  L0.2:                 f------------------------------p
   341  L0.1:                 f------h
   342  L0.0:                 f---g                   nvvvvvvp
   343  L6:    a---------------f g------------------------------------s
   344         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   345  
   346  pick-base-compaction min_depth=3
   347  ----
   348  no compaction picked
   349  
   350  pick-intra-l0-compaction min_depth=3
   351  ----
   352  compaction picked with stack depth reduction 4
   353  000010,000009,000005,000006
   354  seed interval: f-g
   355  L0.3:                 f+++g
   356  L0.2:                 f++++++++++++++++++++++++++++++p
   357  L0.1:                 f++++++h
   358  L0.0:                 f+++g                   nvvvvvvp
   359  L6:    a---------------f g------------------------------------s
   360         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   361  
   362  # Raise 000009 to a higher level, so that there's still a stack depth of 3 below
   363  # it. This should make f-g a candidate for base compaction again.
   364  
   365  define
   366  L0
   367    000005:f.SET.6-h.SET.9
   368    000006:f.SET.4-g.SET.5
   369    000009:f.SET.12-p.SET.12
   370    000010:f.SET.11-g.SET.11
   371    000011:n.SET.8-p.SET.10 base_compacting
   372  L6
   373    000007:a.SET.0-f.SET.0
   374    000008:g.SET.0-s.SET.0
   375  ----
   376  file count: 5, sublevels: 4, intervals: 5
   377  flush split keys(2): [g, p]
   378  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   379  	000009:[f#12,1-p#12,1]
   380  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   381  	000010:[f#11,1-g#11,1]
   382  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   383  	000005:[f#6,1-h#9,1]
   384  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   385  	000006:[f#4,1-g#5,1]
   386  	000011:[n#8,1-p#10,1]
   387  compacting file count: 1, base compacting intervals: [3, 4]
   388  L0.3:                 f------------------------------p
   389  L0.2:                 f---g
   390  L0.1:                 f------h
   391  L0.0:                 f---g                   nvvvvvvp
   392  L6:    a---------------f g------------------------------------s
   393         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   394  
   395  pick-base-compaction min_depth=3
   396  ----
   397  compaction picked with stack depth reduction 3
   398  000006,000005,000010
   399  seed interval: f-g
   400  L0.3:                 f------------------------------p
   401  L0.2:                 f+++g
   402  L0.1:                 f++++++h
   403  L0.0:                 f+++g                   nvvvvvvp
   404  L6:    a---------------f g------------------------------------s
   405         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   406  
   407  pick-intra-l0-compaction min_depth=3
   408  ----
   409  compaction picked with stack depth reduction 4
   410  000009,000010,000005,000006
   411  seed interval: f-g
   412  L0.3:                 f++++++++++++++++++++++++++++++p
   413  L0.2:                 f+++g
   414  L0.1:                 f++++++h
   415  L0.0:                 f+++g                   nvvvvvvp
   416  L6:    a---------------f g------------------------------------s
   417         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   418  
   419  max-depth-after-ongoing-compactions
   420  ----
   421  4
   422  
   423  # Assume the above base compaction is chosen. This should reduce max depth after
   424  # ongoing compactions.
   425  
   426  define
   427  L0
   428    000005:f.SET.6-h.SET.9 base_compacting
   429    000006:f.SET.4-g.SET.5 base_compacting
   430    000009:f.SET.12-p.SET.12
   431    000010:f.SET.11-g.SET.11 base_compacting
   432    000011:n.SET.8-p.SET.10 base_compacting
   433  L6
   434    000007:a.SET.0-f.SET.0
   435    000008:g.SET.0-s.SET.0
   436  ----
   437  file count: 5, sublevels: 4, intervals: 5
   438  flush split keys(2): [g, p]
   439  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   440  	000009:[f#12,1-p#12,1]
   441  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   442  	000010:[f#11,1-g#11,1]
   443  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   444  	000005:[f#6,1-h#9,1]
   445  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   446  	000006:[f#4,1-g#5,1]
   447  	000011:[n#8,1-p#10,1]
   448  compacting file count: 4, base compacting intervals: [0, 1], [3, 4]
   449  L0.3:                 f------------------------------p
   450  L0.2:                 fvvvg
   451  L0.1:                 fvvvvvvh
   452  L0.0:                 fvvvg                   nvvvvvvp
   453  L6:    a---------------f g------------------------------------s
   454         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   455  
   456  pick-base-compaction min_depth=3
   457  ----
   458  no compaction picked
   459  
   460  pick-intra-l0-compaction min_depth=3
   461  ----
   462  no compaction picked
   463  
   464  max-depth-after-ongoing-compactions
   465  ----
   466  1
   467  
   468  # Ensure that when 000011 is not base compacting, it's chosen for compactions
   469  # along with 000009.
   470  
   471  define
   472  L0
   473    000005:f.SET.6-h.SET.9
   474    000006:f.SET.4-g.SET.5
   475    000009:f.SET.12-p.SET.12
   476    000010:f.SET.11-g.SET.11
   477    000011:n.SET.8-p.SET.10
   478  L6
   479    000007:a.SET.0-f.SET.0
   480    000008:g.SET.0-s.SET.0
   481  ----
   482  file count: 5, sublevels: 4, intervals: 5
   483  flush split keys(2): [g, p]
   484  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   485  	000009:[f#12,1-p#12,1]
   486  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   487  	000010:[f#11,1-g#11,1]
   488  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   489  	000005:[f#6,1-h#9,1]
   490  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   491  	000006:[f#4,1-g#5,1]
   492  	000011:[n#8,1-p#10,1]
   493  compacting file count: 0, base compacting intervals: none
   494  L0.3:                 f------------------------------p
   495  L0.2:                 f---g
   496  L0.1:                 f------h
   497  L0.0:                 f---g                   n------p
   498  L6:    a---------------f g------------------------------------s
   499         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   500  
   501  pick-base-compaction min_depth=3
   502  ----
   503  compaction picked with stack depth reduction 4
   504  000006,000005,000010,000009,000011
   505  seed interval: f-g
   506  L0.3:                 f++++++++++++++++++++++++++++++p
   507  L0.2:                 f+++g
   508  L0.1:                 f++++++h
   509  L0.0:                 f+++g                   n++++++p
   510  L6:    a---------------f g------------------------------------s
   511         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   512  
   513  pick-intra-l0-compaction min_depth=3
   514  ----
   515  compaction picked with stack depth reduction 4
   516  000009,000010,000005,000006,000011
   517  seed interval: f-g
   518  L0.3:                 f++++++++++++++++++++++++++++++p
   519  L0.2:                 f+++g
   520  L0.1:                 f++++++h
   521  L0.0:                 f+++g                   n++++++p
   522  L6:    a---------------f g------------------------------------s
   523         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   524  
   525  # Don't pick a base compaction if the overlapping Lbase files are marked as
   526  # compacting.
   527  
   528  define
   529  L0
   530    000005:f.SET.6-h.SET.9
   531    000006:f.SET.4-g.SET.5
   532    000009:f.SET.12-p.SET.12
   533    000010:f.SET.11-g.SET.11
   534    000011:n.SET.8-p.SET.10
   535  L6
   536    000007:a.SET.0-f.SET.0
   537    000008:g.SET.0-s.SET.0 compacting
   538  ----
   539  file count: 5, sublevels: 4, intervals: 5
   540  flush split keys(2): [g, p]
   541  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   542  	000009:[f#12,1-p#12,1]
   543  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   544  	000010:[f#11,1-g#11,1]
   545  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   546  	000005:[f#6,1-h#9,1]
   547  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   548  	000006:[f#4,1-g#5,1]
   549  	000011:[n#8,1-p#10,1]
   550  compacting file count: 0, base compacting intervals: none
   551  L0.3:                 f------------------------------p
   552  L0.2:                 f---g
   553  L0.1:                 f------h
   554  L0.0:                 f---g                   n------p
   555  L6:    a---------------f g====================================s
   556         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   557  
   558  pick-base-compaction min_depth=3
   559  ----
   560  no compaction picked
   561  
   562  # Greatly increase the size of SSTable 000009, past 100 << 20. This should make
   563  # it no longer a candidate for base compaction.
   564  
   565  define
   566  L0
   567    000005:f.SET.6-h.SET.9
   568    000006:f.SET.4-g.SET.5
   569    000009:f.SET.12-p.SET.12 size=104859600
   570    000010:f.SET.11-g.SET.11
   571    000011:n.SET.8-p.SET.10
   572  L6
   573    000007:a.SET.0-f.SET.0
   574    000008:g.SET.0-s.SET.0
   575  ----
   576  file count: 5, sublevels: 4, intervals: 5
   577  flush split keys(4): [g, h, n, p]
   578  0.3: file count: 1, bytes: 104859600, width (mean, max): 4.0, 4, interval range: [0, 3]
   579  	000009:[f#12,1-p#12,1]
   580  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   581  	000010:[f#11,1-g#11,1]
   582  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   583  	000005:[f#6,1-h#9,1]
   584  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   585  	000006:[f#4,1-g#5,1]
   586  	000011:[n#8,1-p#10,1]
   587  compacting file count: 0, base compacting intervals: none
   588  L0.3:                 f------------------------------p
   589  L0.2:                 f---g
   590  L0.1:                 f------h
   591  L0.0:                 f---g                   n------p
   592  L6:    a---------------f g------------------------------------s
   593         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   594  
   595  pick-base-compaction min_depth=3
   596  ----
   597  compaction picked with stack depth reduction 3
   598  000006,000005,000010,000011
   599  seed interval: f-g
   600  L0.3:                 f------------------------------p
   601  L0.2:                 f+++g
   602  L0.1:                 f++++++h
   603  L0.0:                 f+++g                   n++++++p
   604  L6:    a---------------f g------------------------------------s
   605         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   606  
   607  pick-intra-l0-compaction min_depth=3
   608  ----
   609  compaction picked with stack depth reduction 4
   610  000009,000010,000005,000006,000011
   611  seed interval: f-g
   612  L0.3:                 f++++++++++++++++++++++++++++++p
   613  L0.2:                 f+++g
   614  L0.1:                 f++++++h
   615  L0.0:                 f+++g                   n++++++p
   616  L6:    a---------------f g------------------------------------s
   617         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   618  
   619  # However, when the size increase is applied to a lower sublevel that is
   620  # necessary to include to meet the minimum stack depth reduction, we overlook
   621  # the size difference and choose the file for compaction anyway.
   622  
   623  define
   624  L0
   625    000005:f.SET.6-h.SET.9
   626    000006:f.SET.4-g.SET.5
   627    000009:f.SET.12-p.SET.12
   628    000010:f.SET.11-g.SET.11 size=104859600
   629    000011:n.SET.8-p.SET.10
   630  L6
   631    000007:a.SET.0-f.SET.0
   632    000008:g.SET.0-s.SET.0
   633  ----
   634  file count: 5, sublevels: 4, intervals: 5
   635  flush split keys(2): [g, p]
   636  0.3: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [0, 3]
   637  	000009:[f#12,1-p#12,1]
   638  0.2: file count: 1, bytes: 104859600, width (mean, max): 1.0, 1, interval range: [0, 0]
   639  	000010:[f#11,1-g#11,1]
   640  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [0, 1]
   641  	000005:[f#6,1-h#9,1]
   642  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 3]
   643  	000006:[f#4,1-g#5,1]
   644  	000011:[n#8,1-p#10,1]
   645  compacting file count: 0, base compacting intervals: none
   646  L0.3:                 f------------------------------p
   647  L0.2:                 f---g
   648  L0.1:                 f------h
   649  L0.0:                 f---g                   n------p
   650  L6:    a---------------f g------------------------------------s
   651         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   652  
   653  pick-base-compaction min_depth=3
   654  ----
   655  compaction picked with stack depth reduction 4
   656  000006,000005,000010,000009,000011
   657  seed interval: f-g
   658  L0.3:                 f++++++++++++++++++++++++++++++p
   659  L0.2:                 f+++g
   660  L0.1:                 f++++++h
   661  L0.0:                 f+++g                   n++++++p
   662  L6:    a---------------f g------------------------------------s
   663         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   664  
   665  pick-intra-l0-compaction min_depth=3
   666  ----
   667  compaction picked with stack depth reduction 4
   668  000009,000010,000005,000006,000011
   669  seed interval: f-g
   670  L0.3:                 f++++++++++++++++++++++++++++++p
   671  L0.2:                 f+++g
   672  L0.1:                 f++++++h
   673  L0.0:                 f+++g                   n++++++p
   674  L6:    a---------------f g------------------------------------s
   675         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   676  
   677  read-amp
   678  ----
   679  4
   680  
   681  # In L0.0, SST 000007 is marked as base compacting. There are two SSTs to the left
   682  # of it in the sublevel, and one to its right. The ones to its left should be
   683  # chosen by extendCandidateToRectangle.
   684  
   685  define
   686  L0
   687    000004:h.SET.2-j.SET.4
   688    000005:f.SET.6-h.SET.9
   689    000006:f.SET.4-g.SET.5
   690    000007:k.SET.2-l.SET.4 base_compacting
   691    000009:f.SET.12-p.SET.12
   692    000010:f.SET.11-g.SET.11
   693    000011:n.SET.8-p.SET.10
   694  L6
   695    000012:a.SET.0-f.SET.0
   696    000008:g.SET.0-s.SET.0
   697  ----
   698  file count: 7, sublevels: 4, intervals: 9
   699  flush split keys(4): [g, h, l, p]
   700  0.3: file count: 1, bytes: 256, width (mean, max): 8.0, 8, interval range: [0, 7]
   701  	000009:[f#12,1-p#12,1]
   702  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   703  	000010:[f#11,1-g#11,1]
   704  0.1: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [0, 2]
   705  	000005:[f#6,1-h#9,1]
   706  0.0: file count: 4, bytes: 1024, width (mean, max): 1.2, 2, interval range: [0, 7]
   707  	000006:[f#4,1-g#5,1]
   708  	000004:[h#2,1-j#4,1]
   709  	000007:[k#2,1-l#4,1]
   710  	000011:[n#8,1-p#10,1]
   711  compacting file count: 1, base compacting intervals: [5, 5]
   712  L0.3:                 f------------------------------p
   713  L0.2:                 f---g
   714  L0.1:                 f------h
   715  L0.0:                 f---g h------j kvvvl    n------p
   716  L6:    a---------------f g------------------------------------s
   717         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   718  
   719  pick-intra-l0-compaction min_depth=3
   720  ----
   721  compaction picked with stack depth reduction 4
   722  000009,000010,000005,000006,000004
   723  seed interval: f-g
   724  L0.3:                 f++++++++++++++++++++++++++++++p
   725  L0.2:                 f+++g
   726  L0.1:                 f++++++h
   727  L0.0:                 f+++g h++++++j kvvvl    n------p
   728  L6:    a---------------f g------------------------------------s
   729         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   730  
   731  pick-base-compaction min_depth=3
   732  ----
   733  compaction picked with stack depth reduction 3
   734  000006,000005,000004,000010
   735  seed interval: f-g
   736  L0.3:                 f------------------------------p
   737  L0.2:                 f+++g
   738  L0.1:                 f++++++h
   739  L0.0:                 f+++g h++++++j kvvvl    n------p
   740  L6:    a---------------f g------------------------------------s
   741         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   742  
   743  
   744  # Now shift the base_compacting marker one SST to the left. But since file 6
   745  # was already chosen as part of the seed compaction construction, we still
   746  # prefer to choose it over files 7 and 11.
   747  
   748  define
   749  L0
   750    000004:h.SET.2-j.SET.4 base_compacting
   751    000005:f.SET.6-h.SET.9
   752    000006:f.SET.4-g.SET.5
   753    000007:k.SET.2-l.SET.4
   754    000009:f.SET.12-p.SET.12
   755    000010:f.SET.11-g.SET.11
   756    000011:n.SET.8-p.SET.10
   757  L6
   758    000012:a.SET.0-f.SET.0
   759    000008:g.SET.0-s.SET.0
   760  ----
   761  file count: 7, sublevels: 4, intervals: 9
   762  flush split keys(4): [g, h, l, p]
   763  0.3: file count: 1, bytes: 256, width (mean, max): 8.0, 8, interval range: [0, 7]
   764  	000009:[f#12,1-p#12,1]
   765  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   766  	000010:[f#11,1-g#11,1]
   767  0.1: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [0, 2]
   768  	000005:[f#6,1-h#9,1]
   769  0.0: file count: 4, bytes: 1024, width (mean, max): 1.2, 2, interval range: [0, 7]
   770  	000006:[f#4,1-g#5,1]
   771  	000004:[h#2,1-j#4,1]
   772  	000007:[k#2,1-l#4,1]
   773  	000011:[n#8,1-p#10,1]
   774  compacting file count: 1, base compacting intervals: [2, 3]
   775  L0.3:                 f------------------------------p
   776  L0.2:                 f---g
   777  L0.1:                 f------h
   778  L0.0:                 f---g hvvvvvvj k---l    n------p
   779  L6:    a---------------f g------------------------------------s
   780         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   781  
   782  pick-intra-l0-compaction min_depth=3
   783  ----
   784  compaction picked with stack depth reduction 4
   785  000009,000010,000005,000006
   786  seed interval: f-g
   787  L0.3:                 f++++++++++++++++++++++++++++++p
   788  L0.2:                 f+++g
   789  L0.1:                 f++++++h
   790  L0.0:                 f+++g hvvvvvvj k---l    n------p
   791  L6:    a---------------f g------------------------------------s
   792         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   793  
   794  # Without any base_compacting markers, all SSTs in the bottom sublevel should
   795  # be chosen for an intra-L0 compaction.
   796  
   797  define
   798  L0
   799    000004:h.SET.2-j.SET.4
   800    000005:f.SET.6-h.SET.9
   801    000006:f.SET.4-g.SET.5
   802    000007:k.SET.2-l.SET.4
   803    000009:f.SET.12-p.SET.12
   804    000010:f.SET.11-g.SET.11
   805    000011:n.SET.8-p.SET.10
   806  L6
   807    000012:a.SET.0-f.SET.0
   808    000008:g.SET.0-s.SET.0
   809  ----
   810  file count: 7, sublevels: 4, intervals: 9
   811  flush split keys(4): [g, h, l, p]
   812  0.3: file count: 1, bytes: 256, width (mean, max): 8.0, 8, interval range: [0, 7]
   813  	000009:[f#12,1-p#12,1]
   814  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
   815  	000010:[f#11,1-g#11,1]
   816  0.1: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [0, 2]
   817  	000005:[f#6,1-h#9,1]
   818  0.0: file count: 4, bytes: 1024, width (mean, max): 1.2, 2, interval range: [0, 7]
   819  	000006:[f#4,1-g#5,1]
   820  	000004:[h#2,1-j#4,1]
   821  	000007:[k#2,1-l#4,1]
   822  	000011:[n#8,1-p#10,1]
   823  compacting file count: 0, base compacting intervals: none
   824  L0.3:                 f------------------------------p
   825  L0.2:                 f---g
   826  L0.1:                 f------h
   827  L0.0:                 f---g h------j k---l    n------p
   828  L6:    a---------------f g------------------------------------s
   829         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   830  
   831  pick-intra-l0-compaction min_depth=3
   832  ----
   833  compaction picked with stack depth reduction 4
   834  000009,000010,000005,000006,000004,000007,000011
   835  seed interval: f-g
   836  L0.3:                 f++++++++++++++++++++++++++++++p
   837  L0.2:                 f+++g
   838  L0.1:                 f++++++h
   839  L0.0:                 f+++g h++++++j k+++l    n++++++p
   840  L6:    a---------------f g------------------------------------s
   841         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   842  
   843  define flush_split_max_bytes=32
   844  L0
   845    000001:a.SET.2-e.SET.5 size=64
   846    000002:c.SET.6-g.SET.8 size=16
   847    000003:f.SET.9-j.SET.11 size=16
   848  L6
   849    000007:a.SET.0-f.SET.0
   850    000008:g.SET.0-s.SET.0
   851  ----
   852  file count: 3, sublevels: 3, intervals: 6
   853  flush split keys(0): []
   854  0.2: file count: 1, bytes: 16, width (mean, max): 2.0, 2, interval range: [3, 4]
   855  	000003:[f#9,1-j#11,1]
   856  0.1: file count: 1, bytes: 16, width (mean, max): 3.0, 3, interval range: [1, 3]
   857  	000002:[c#6,1-g#8,1]
   858  0.0: file count: 1, bytes: 64, width (mean, max): 2.0, 2, interval range: [0, 1]
   859  	000001:[a#2,1-e#5,1]
   860  compacting file count: 0, base compacting intervals: none
   861  L0.2:                 f------------j
   862  L0.1:        c------------g
   863  L0.0:  a------------e
   864  L6:    a---------------f g------------------------------------s
   865         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   866  
   867  # Check that read amplification is the sublevel height of the tallest key
   868  # interval, not the overall count of sublevels.
   869  
   870  read-amp
   871  ----
   872  2
   873  
   874  in-use-key-ranges
   875  a-z
   876  ----
   877  a-j
   878  
   879  # The comparison of a cumulative count of interpolated bytes and
   880  # flushSplitMaxBytes is a <, so even though the cumulative count equals 32 after
   881  # a-c, we do not emit a flush split key until the end of the next interval, c-e.
   882  
   883  flush-split-keys
   884  ----
   885  flush user split keys: none
   886  
   887  # Reduce flush_split_max_bytes by 1, and there should also be a split key at c.
   888  
   889  define flush_split_max_bytes=31
   890  L0
   891    000001:a.SET.2-e.SET.5 size=64
   892    000002:c.SET.6-g.SET.8 size=16
   893    000003:f.SET.9-j.SET.11 size=16
   894  L6
   895    000007:a.SET.0-f.SET.0
   896    000008:g.SET.0-s.SET.0
   897  ----
   898  file count: 3, sublevels: 3, intervals: 6
   899  flush split keys(1): [j]
   900  0.2: file count: 1, bytes: 16, width (mean, max): 2.0, 2, interval range: [3, 4]
   901  	000003:[f#9,1-j#11,1]
   902  0.1: file count: 1, bytes: 16, width (mean, max): 3.0, 3, interval range: [1, 3]
   903  	000002:[c#6,1-g#8,1]
   904  0.0: file count: 1, bytes: 64, width (mean, max): 2.0, 2, interval range: [0, 1]
   905  	000001:[a#2,1-e#5,1]
   906  compacting file count: 0, base compacting intervals: none
   907  L0.2:                 f------------j
   908  L0.1:        c------------g
   909  L0.0:  a------------e
   910  L6:    a---------------f g------------------------------------s
   911         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   912  
   913  flush-split-keys
   914  ----
   915  flush user split keys: j
   916  
   917  max-depth-after-ongoing-compactions
   918  ----
   919  2
   920  
   921  define flush_split_max_bytes=64
   922  L0
   923    000001:a.SET.2-d.SET.5 size=64
   924    000002:e.SET.6-g.SET.8 size=64
   925    000003:h.SET.9-j.SET.11 size=16
   926  L6
   927    000007:a.SET.0-f.SET.0
   928    000008:g.SET.0-s.SET.0
   929  ----
   930  file count: 3, sublevels: 1, intervals: 6
   931  flush split keys(1): [g]
   932  0.0: file count: 3, bytes: 144, width (mean, max): 1.0, 1, interval range: [0, 4]
   933  	000001:[a#2,1-d#5,1]
   934  	000002:[e#6,1-g#8,1]
   935  	000003:[h#9,1-j#11,1]
   936  compacting file count: 0, base compacting intervals: none
   937  L0.0:  a---------d e------g h------j
   938  L6:    a---------------f g------------------------------------s
   939         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   940  
   941  flush-split-keys
   942  ----
   943  flush user split keys: g
   944  
   945  # The calculation for flush split bytes multiplies the specified max bytes
   946  # parameter with the number of sublevels. In the case below, that should mean
   947  # a flush split key would not be emitted at d despite the estimated bytes tally
   948  # exceeding 64 bytes. Instead, it would be emitted when 64 * 2 = 128 bytes have
   949  # been exceeded.
   950  
   951  define flush_split_max_bytes=64
   952  L0
   953    000001:a.SET.2-d.SET.5 size=64
   954    000004:d.SET.12-e.SET.12 size=64
   955    000002:e.SET.6-g.SET.8 size=64
   956    000003:h.SET.9-j.SET.11 size=16
   957  L6
   958    000007:a.SET.0-f.SET.0
   959    000008:g.SET.0-s.SET.0
   960  ----
   961  file count: 4, sublevels: 2, intervals: 8
   962  flush split keys(1): [e]
   963  0.1: file count: 1, bytes: 64, width (mean, max): 3.0, 3, interval range: [1, 3]
   964  	000004:[d#12,1-e#12,1]
   965  0.0: file count: 3, bytes: 144, width (mean, max): 1.7, 2, interval range: [0, 6]
   966  	000001:[a#2,1-d#5,1]
   967  	000002:[e#6,1-g#8,1]
   968  	000003:[h#9,1-j#11,1]
   969  compacting file count: 0, base compacting intervals: none
   970  L0.1:           d---e
   971  L0.0:  a---------d e------g h------j
   972  L6:    a---------------f g------------------------------------s
   973         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
   974  
   975  in-use-key-ranges
   976  b-b
   977  dd-e
   978  dd-i
   979  dd-h
   980  dd-j
   981  dd-s
   982  ----
   983  a-d
   984  d-g
   985  d-g, h-j
   986  d-g, h-j
   987  d-g, h-j
   988  d-g, h-j
   989  
   990  flush-split-keys
   991  ----
   992  flush user split keys: e
   993  
   994  # Ensure that the compaction picker doesn't error out when all seed files are
   995  # compacting.
   996  
   997  define
   998  L0
   999    000004:h.SET.2-j.SET.4    base_compacting
  1000    000005:f.SET.6-h.SET.9
  1001    000006:f.SET.4-g.SET.5    base_compacting
  1002    000007:k.SET.2-l.SET.4    base_compacting
  1003    000009:f.SET.12-p.SET.12  intra_l0_compacting
  1004    000010:f.SET.11-g.SET.11
  1005    000011:n.SET.8-p.SET.10   base_compacting
  1006  L6
  1007    000012:a.SET.0-f.SET.0
  1008    000008:g.SET.0-s.SET.0
  1009  ----
  1010  file count: 7, sublevels: 4, intervals: 9
  1011  flush split keys(4): [g, h, l, p]
  1012  0.3: file count: 1, bytes: 256, width (mean, max): 8.0, 8, interval range: [0, 7]
  1013  	000009:[f#12,1-p#12,1]
  1014  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
  1015  	000010:[f#11,1-g#11,1]
  1016  0.1: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [0, 2]
  1017  	000005:[f#6,1-h#9,1]
  1018  0.0: file count: 4, bytes: 1024, width (mean, max): 1.2, 2, interval range: [0, 7]
  1019  	000006:[f#4,1-g#5,1]
  1020  	000004:[h#2,1-j#4,1]
  1021  	000007:[k#2,1-l#4,1]
  1022  	000011:[n#8,1-p#10,1]
  1023  compacting file count: 5, base compacting intervals: [0, 0], [2, 3], [5, 5], [7, 8]
  1024  L0.3:                 f^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^p
  1025  L0.2:                 f---g
  1026  L0.1:                 f------h
  1027  L0.0:                 fvvvg hvvvvvvj kvvvl    nvvvvvvp
  1028  L6:    a---------------f g------------------------------------s
  1029         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
  1030  
  1031  pick-base-compaction min_depth=2
  1032  ----
  1033  no compaction picked
  1034  
  1035  pick-intra-l0-compaction min_depth=2
  1036  ----
  1037  no compaction picked
  1038  
  1039  # Ensure that base files with largest key set to the rangedel sentinel key are
  1040  # treated as not containing the largest user key. If L0 files containing that
  1041  # user key get added to that compaction, it could trigger a
  1042  # "files have overlapping ranges" error in Lbase as one of the outputs of the
  1043  # compaction would overlap with an Lbase file not in the compaction.
  1044  # Compare the output of the next two calls to PickBaseCompaction below; as the
  1045  # base file's end key is changed to the range deletion sentinel, L0 files
  1046  # overlapping with it are no longer chosen for compaction.
  1047  
  1048  define
  1049  L0
  1050    000004:h.SET.2-j.SET.4
  1051    000005:f.SET.6-h.SET.9
  1052    000006:f.SET.4-g.SET.5
  1053    000007:k.SET.2-l.SET.4
  1054    000009:n.SET.12-o.SET.12
  1055    000010:f.SET.11-g.SET.11
  1056    000011:n.SET.8-o.SET.10
  1057  L6
  1058    000001:a.SET.0-o.SET.0
  1059    000008:p.SET.0-s.SET.0
  1060  ----
  1061  file count: 7, sublevels: 3, intervals: 9
  1062  flush split keys(4): [g, h, l, o]
  1063  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
  1064  	000010:[f#11,1-g#11,1]
  1065  0.1: file count: 2, bytes: 512, width (mean, max): 2.0, 3, interval range: [0, 7]
  1066  	000005:[f#6,1-h#9,1]
  1067  	000009:[n#12,1-o#12,1]
  1068  0.0: file count: 4, bytes: 1024, width (mean, max): 1.2, 2, interval range: [0, 7]
  1069  	000006:[f#4,1-g#5,1]
  1070  	000004:[h#2,1-j#4,1]
  1071  	000007:[k#2,1-l#4,1]
  1072  	000011:[n#8,1-o#10,1]
  1073  compacting file count: 0, base compacting intervals: none
  1074  L0.2:                 f---g
  1075  L0.1:                 f------h                n---o
  1076  L0.0:                 f---g h------j k---l    n---o
  1077  L6:    a------------------------------------------o p---------s
  1078         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
  1079  
  1080  pick-base-compaction min_depth=2
  1081  ----
  1082  compaction picked with stack depth reduction 3
  1083  000006,000005,000004,000010,000007,000011,000009
  1084  seed interval: f-g
  1085  L0.2:                 f+++g
  1086  L0.1:                 f++++++h                n+++o
  1087  L0.0:                 f+++g h++++++j k+++l    n+++o
  1088  L6:    a------------------------------------------o p---------s
  1089         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
  1090  
  1091  define
  1092  L0
  1093    000004:h.SET.2-j.SET.4
  1094    000005:f.SET.6-h.SET.9
  1095    000006:f.SET.4-g.SET.5
  1096    000007:k.SET.2-l.SET.4
  1097    000009:n.SET.12-o.SET.12
  1098    000010:f.SET.11-g.SET.11
  1099    000011:n.SET.8-o.SET.10
  1100  L6
  1101    000001:a.SET.0-o.RANGEDEL.72057594037927935
  1102    000008:p.SET.0-s.SET.0
  1103  ----
  1104  file count: 7, sublevels: 3, intervals: 9
  1105  flush split keys(4): [g, h, l, o]
  1106  0.2: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
  1107  	000010:[f#11,1-g#11,1]
  1108  0.1: file count: 2, bytes: 512, width (mean, max): 2.0, 3, interval range: [0, 7]
  1109  	000005:[f#6,1-h#9,1]
  1110  	000009:[n#12,1-o#12,1]
  1111  0.0: file count: 4, bytes: 1024, width (mean, max): 1.2, 2, interval range: [0, 7]
  1112  	000006:[f#4,1-g#5,1]
  1113  	000004:[h#2,1-j#4,1]
  1114  	000007:[k#2,1-l#4,1]
  1115  	000011:[n#8,1-o#10,1]
  1116  compacting file count: 0, base compacting intervals: none
  1117  L0.2:                 f---g
  1118  L0.1:                 f------h                n---o
  1119  L0.0:                 f---g h------j k---l    n---o
  1120  L6:    a------------------------------------------o p---------s
  1121         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
  1122  
  1123  pick-base-compaction min_depth=2
  1124  ----
  1125  compaction picked with stack depth reduction 3
  1126  000006,000005,000004,000010,000007,000011,000009
  1127  seed interval: f-g
  1128  L0.2:                 f+++g
  1129  L0.1:                 f++++++h                n+++o
  1130  L0.0:                 f+++g h++++++j k+++l    n+++o
  1131  L6:    a------------------------------------------o p---------s
  1132         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
  1133  
  1134  in-use-key-ranges
  1135  a-z
  1136  n-o
  1137  ----
  1138  f-j, k-l, n-o
  1139  n-o
  1140  
  1141  # Ensure that two L0 sstables where one ends at a rangedel sentinel key and
  1142  # the other starts at the same user key occupy the same sublevel.
  1143  
  1144  define
  1145  L0
  1146    000004:a.SET.2-d.RANGEDEL.72057594037927935
  1147    000005:d.SET.3-g.SET.5
  1148  L6
  1149    000001:a.SET.0-o.SET.0
  1150    000008:p.SET.0-s.SET.0
  1151  ----
  1152  file count: 2, sublevels: 1, intervals: 3
  1153  flush split keys(2): [d, g]
  1154  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 1]
  1155  	000004:[a#2,1-d#72057594037927935,15]
  1156  	000005:[d#3,1-g#5,1]
  1157  compacting file count: 0, base compacting intervals: none
  1158  L0.0:  a--------d---------g
  1159  L6:    a------------------------------------------o p---------s
  1160         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss
  1161  
  1162  in-use-key-ranges
  1163  a-z
  1164  a-g
  1165  b-c
  1166  ----
  1167  a-g
  1168  a-g
  1169  a-d
  1170  
  1171  define
  1172  L0
  1173    000004:a.SET.2-d.RANGEDEL.72057594037927935
  1174    000005:d.SET.3-g.SET.5
  1175    000006:f.SET.6-i.SET.6
  1176    000007:h.SET.7-m.SET.7
  1177    000009:q.SET.7-r.SET.7
  1178    000010:g.SET.10-i.SET.10
  1179  ----
  1180  file count: 6, sublevels: 4, intervals: 10
  1181  flush split keys(4): [f, g, i, r]
  1182  0.3: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [3, 5]
  1183  	000010:[g#10,1-i#10,1]
  1184  0.2: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [5, 6]
  1185  	000007:[h#7,1-m#7,1]
  1186  0.1: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [2, 5]
  1187  	000006:[f#6,1-i#6,1]
  1188  0.0: file count: 3, bytes: 768, width (mean, max): 1.7, 3, interval range: [0, 8]
  1189  	000004:[a#2,1-d#72057594037927935,15]
  1190  	000005:[d#3,1-g#5,1]
  1191  	000009:[q#7,1-r#7,1]
  1192  compacting file count: 0, base compacting intervals: none
  1193  L0.3:                    g------i
  1194  L0.2:                       h---------------m
  1195  L0.1:                 f---------i
  1196  L0.0:  a--------d---------g                            q---r
  1197         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr
  1198  
  1199  in-use-key-ranges
  1200  f-m
  1201  f-n
  1202  f-l
  1203  ff-m
  1204  ff-n
  1205  ff-l
  1206  ----
  1207  f-m
  1208  f-m
  1209  f-m
  1210  f-m
  1211  f-m
  1212  f-m
  1213  
  1214  in-use-key-ranges
  1215  n-o
  1216  m-q
  1217  l-qq
  1218  ----
  1219  .
  1220  i-m, q-r
  1221  i-m, q-r
  1222  
  1223  in-use-key-ranges
  1224  a-z
  1225  g-l
  1226  ----
  1227  a-m, q-r
  1228  g-m
  1229  
  1230  in-use-key-ranges
  1231  a-ff
  1232  a-gg
  1233  a-i
  1234  d-d
  1235  ----
  1236  a-g
  1237  a-i
  1238  a-m
  1239  d-g
  1240  
  1241  # Same example as above, except we incrementally add the sublevels. The output
  1242  # of in-use-key-ranges must be the same.
  1243  
  1244  define
  1245  L0
  1246    000004:a.SET.2-d.RANGEDEL.72057594037927935
  1247  ----
  1248  file count: 1, sublevels: 1, intervals: 2
  1249  flush split keys(1): [d]
  1250  0.0: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
  1251  	000004:[a#2,1-d#72057594037927935,15]
  1252  compacting file count: 0, base compacting intervals: none
  1253  L0.0:  a---------d
  1254         aa bb cc dd
  1255  
  1256  add-l0-files
  1257    000005:d.SET.3-g.SET.5
  1258  ----
  1259  file count: 2, sublevels: 1, intervals: 3
  1260  flush split keys(2): [d, g]
  1261  0.0: file count: 2, bytes: 512, width (mean, max): 1.0, 1, interval range: [0, 1]
  1262  	000004:[a#2,1-d#72057594037927935,15]
  1263  	000005:[d#3,1-g#5,1]
  1264  compacting file count: 0, base compacting intervals: none
  1265  L0.0:  a--------d---------g
  1266         aa bb cc dd ee ff gg
  1267  
  1268  add-l0-files
  1269    000006:f.SET.6-i.SET.6
  1270  ----
  1271  file count: 3, sublevels: 2, intervals: 5
  1272  flush split keys(2): [d, g]
  1273  0.1: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [2, 3]
  1274  	000006:[f#6,1-i#6,1]
  1275  0.0: file count: 2, bytes: 512, width (mean, max): 1.5, 2, interval range: [0, 2]
  1276  	000004:[a#2,1-d#72057594037927935,15]
  1277  	000005:[d#3,1-g#5,1]
  1278  compacting file count: 0, base compacting intervals: none
  1279  L0.1:                 f---------i
  1280  L0.0:  a--------d---------g
  1281         aa bb cc dd ee ff gg hh ii
  1282  
  1283  add-l0-files
  1284    000007:h.SET.7-m.SET.7
  1285    000009:q.SET.8-r.SET.8
  1286  ----
  1287  file count: 5, sublevels: 3, intervals: 9
  1288  flush split keys(4): [d, g, i, r]
  1289  0.2: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [4, 5]
  1290  	000007:[h#7,1-m#7,1]
  1291  0.1: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [2, 4]
  1292  	000006:[f#6,1-i#6,1]
  1293  0.0: file count: 3, bytes: 768, width (mean, max): 1.3, 2, interval range: [0, 7]
  1294  	000004:[a#2,1-d#72057594037927935,15]
  1295  	000005:[d#3,1-g#5,1]
  1296  	000009:[q#8,1-r#8,1]
  1297  compacting file count: 0, base compacting intervals: none
  1298  L0.2:                       h---------------m
  1299  L0.1:                 f---------i
  1300  L0.0:  a--------d---------g                            q---r
  1301         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr
  1302  
  1303  # The output below should exactly match the output of the second last define.
  1304  
  1305  add-l0-files
  1306    000010:g.SET.10-i.SET.10
  1307  ----
  1308  file count: 6, sublevels: 4, intervals: 10
  1309  flush split keys(4): [f, g, i, r]
  1310  0.3: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [3, 5]
  1311  	000010:[g#10,1-i#10,1]
  1312  0.2: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [5, 6]
  1313  	000007:[h#7,1-m#7,1]
  1314  0.1: file count: 1, bytes: 256, width (mean, max): 4.0, 4, interval range: [2, 5]
  1315  	000006:[f#6,1-i#6,1]
  1316  0.0: file count: 3, bytes: 768, width (mean, max): 1.7, 3, interval range: [0, 8]
  1317  	000004:[a#2,1-d#72057594037927935,15]
  1318  	000005:[d#3,1-g#5,1]
  1319  	000009:[q#8,1-r#8,1]
  1320  compacting file count: 0, base compacting intervals: none
  1321  L0.3:                    g------i
  1322  L0.2:                       h---------------m
  1323  L0.1:                 f---------i
  1324  L0.0:  a--------d---------g                            q---r
  1325         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr
  1326  
  1327  in-use-key-ranges
  1328  f-m
  1329  f-n
  1330  f-l
  1331  ff-m
  1332  ff-n
  1333  ff-l
  1334  ----
  1335  f-m
  1336  f-m
  1337  f-m
  1338  f-m
  1339  f-m
  1340  f-m
  1341  
  1342  in-use-key-ranges
  1343  n-o
  1344  m-q
  1345  l-qq
  1346  ----
  1347  .
  1348  i-m, q-r
  1349  i-m, q-r
  1350  
  1351  in-use-key-ranges
  1352  a-z
  1353  g-l
  1354  ----
  1355  a-m, q-r
  1356  g-m
  1357  
  1358  in-use-key-ranges
  1359  a-ff
  1360  a-gg
  1361  a-i
  1362  d-d
  1363  ----
  1364  a-g
  1365  a-i
  1366  a-m
  1367  d-g
  1368  
  1369  pick-base-compaction min_depth=3
  1370  ----
  1371  compaction picked with stack depth reduction 3
  1372  000005,000006,000010,000007,000004,000009
  1373  seed interval: g-g
  1374  L0.3:                    g++++++i
  1375  L0.2:                       h+++++++++++++++m
  1376  L0.1:                 f+++++++++i
  1377  L0.0:  a++++++++d+++++++++g                            q+++r
  1378         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr
  1379  
  1380  # Adding two overlapping L0 files is supported too, as long as they're disjoint
  1381  # in sequence number ranges.
  1382  
  1383  add-l0-files
  1384    000011:b.SET.13-e.SET.15
  1385    000012:c.SET.16-e.SET.17
  1386  ----
  1387  file count: 8, sublevels: 4, intervals: 13
  1388  flush split keys(5): [d, e, g, i, r]
  1389  0.3: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [6, 8]
  1390  	000010:[g#10,1-i#10,1]
  1391  0.2: file count: 2, bytes: 512, width (mean, max): 2.0, 2, interval range: [2, 9]
  1392  	000012:[c#16,1-e#17,1]
  1393  	000007:[h#7,1-m#7,1]
  1394  0.1: file count: 2, bytes: 512, width (mean, max): 3.5, 4, interval range: [1, 8]
  1395  	000011:[b#13,1-e#15,1]
  1396  	000006:[f#6,1-i#6,1]
  1397  0.0: file count: 3, bytes: 768, width (mean, max): 2.7, 4, interval range: [0, 11]
  1398  	000004:[a#2,1-d#72057594037927935,15]
  1399  	000005:[d#3,1-g#5,1]
  1400  	000009:[q#8,1-r#8,1]
  1401  compacting file count: 0, base compacting intervals: none
  1402  L0.3:                    g------i
  1403  L0.2:        c------e       h---------------m
  1404  L0.1:     b---------e f---------i
  1405  L0.0:  a--------d---------g                            q---r
  1406         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr
  1407  
  1408  # Multiple sublevels can also be added in one add-l0-files.
  1409  
  1410  add-l0-files
  1411    000013:h.SET.18-i.SET.19
  1412    000014:g.SET.20-i.SET.21
  1413  ----
  1414  file count: 10, sublevels: 6, intervals: 13
  1415  flush split keys(4): [d, g, h, i]
  1416  0.5: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [6, 8]
  1417  	000014:[g#20,1-i#21,1]
  1418  0.4: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [8, 8]
  1419  	000013:[h#18,1-i#19,1]
  1420  0.3: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [6, 8]
  1421  	000010:[g#10,1-i#10,1]
  1422  0.2: file count: 2, bytes: 512, width (mean, max): 2.0, 2, interval range: [2, 9]
  1423  	000012:[c#16,1-e#17,1]
  1424  	000007:[h#7,1-m#7,1]
  1425  0.1: file count: 2, bytes: 512, width (mean, max): 3.5, 4, interval range: [1, 8]
  1426  	000011:[b#13,1-e#15,1]
  1427  	000006:[f#6,1-i#6,1]
  1428  0.0: file count: 3, bytes: 768, width (mean, max): 2.7, 4, interval range: [0, 11]
  1429  	000004:[a#2,1-d#72057594037927935,15]
  1430  	000005:[d#3,1-g#5,1]
  1431  	000009:[q#8,1-r#8,1]
  1432  compacting file count: 0, base compacting intervals: none
  1433  L0.5:                    g------i
  1434  L0.4:                       h---i
  1435  L0.3:                    g------i
  1436  L0.2:        c------e       h---------------m
  1437  L0.1:     b---------e f---------i
  1438  L0.0:  a--------d---------g                            q---r
  1439         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr
  1440  
  1441  # Adding an old L0 file returns an error.
  1442  
  1443  add-l0-files
  1444    000015:h.SET.17-i.SET.17
  1445  ----
  1446  pebble: L0 sublevel generation optimization cannot be used
  1447  
  1448  # The following test cases cover the examples provided in the documentation.
  1449  # NOTE: following initialization, some of the files fall down into lower levels
  1450  # where there is space.
  1451  
  1452  # Example 1. No in-progress L0 -> LBase compaction.
  1453  
  1454  define
  1455  L0.3
  1456    000011:a.SET.18-d.SET.19
  1457    000012:g.SET.20-j.SET.21
  1458  L0.2
  1459    000009:f.SET.14-j.SET.15
  1460    000010:r.SET.16-t.SET.17
  1461  L0.1
  1462    000007:b.SET.10-d.SET.11
  1463    000008:e.SET.12-j.SET.13
  1464  L0.0
  1465    000003:a.SET.2-d.SET.3
  1466    000004:f.SET.4-j.SET.5
  1467    000005:l.SET.6-o.SET.7
  1468    000006:p.SET.8-x.SET.9
  1469  L6
  1470    000001:a.SET.0-i.SET.0
  1471    000002:m.SET.0-w.SET.0
  1472  ----
  1473  file count: 10, sublevels: 4, intervals: 13
  1474  flush split keys(5): [d, g, j, r, t]
  1475  0.3: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [5, 5]
  1476  	000012:[g#20,1-j#21,1]
  1477  0.2: file count: 2, bytes: 512, width (mean, max): 2.0, 2, interval range: [0, 5]
  1478  	000011:[a#18,1-d#19,1]
  1479  	000009:[f#14,1-j#15,1]
  1480  0.1: file count: 3, bytes: 768, width (mean, max): 1.7, 3, interval range: [1, 10]
  1481  	000007:[b#10,1-d#11,1]
  1482  	000008:[e#12,1-j#13,1]
  1483  	000010:[r#16,1-t#17,1]
  1484  0.0: file count: 4, bytes: 1024, width (mean, max): 2.0, 3, interval range: [0, 11]
  1485  	000003:[a#2,1-d#3,1]
  1486  	000004:[f#4,1-j#5,1]
  1487  	000005:[l#6,1-o#7,1]
  1488  	000006:[p#8,1-x#9,1]
  1489  compacting file count: 0, base compacting intervals: none
  1490  L0.3:                    g---------j
  1491  L0.2:  a---------d    f------------j
  1492  L0.1:     b------d e---------------j                      r------t
  1493  L0.0:  a---------d    f------------j    l---------o p------------------------x
  1494  L6:    a------------------------i          m------------------------------w
  1495         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1496  
  1497  pick-base-compaction min_depth=3
  1498  ----
  1499  compaction picked with stack depth reduction 4
  1500  000004,000008,000009,000012,000003,000007,000011
  1501  seed interval: g-j
  1502  L0.3:                    g+++++++++j
  1503  L0.2:  a+++++++++d    f++++++++++++j
  1504  L0.1:     b++++++d e+++++++++++++++j                      r------t
  1505  L0.0:  a+++++++++d    f++++++++++++j    l---------o p------------------------x
  1506  L6:    a------------------------i          m------------------------------w
  1507         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1508  
  1509  # Example 2. Left half of the keyspace compacting. Select the "next best"
  1510  # compaction.
  1511  
  1512  define
  1513  L0.3
  1514    000011:a.SET.18-d.SET.19 base_compacting
  1515    000012:g.SET.20-j.SET.21 base_compacting
  1516  L0.2
  1517    000009:f.SET.14-j.SET.15 base_compacting
  1518    000010:r.SET.16-t.SET.17
  1519  L0.1
  1520    000007:b.SET.10-d.SET.11 base_compacting
  1521    000008:e.SET.12-j.SET.13 base_compacting
  1522  L0.0
  1523    000003:a.SET.2-d.SET.3 base_compacting
  1524    000004:f.SET.4-j.SET.5 base_compacting
  1525    000005:l.SET.6-o.SET.7
  1526    000006:p.SET.8-x.SET.9
  1527  L6
  1528    000001:a.SET.0-i.SET.0
  1529    000002:m.SET.0-w.SET.0
  1530  ----
  1531  file count: 10, sublevels: 4, intervals: 13
  1532  flush split keys(5): [d, g, j, r, t]
  1533  0.3: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [5, 5]
  1534  	000012:[g#20,1-j#21,1]
  1535  0.2: file count: 2, bytes: 512, width (mean, max): 2.0, 2, interval range: [0, 5]
  1536  	000011:[a#18,1-d#19,1]
  1537  	000009:[f#14,1-j#15,1]
  1538  0.1: file count: 3, bytes: 768, width (mean, max): 1.7, 3, interval range: [1, 10]
  1539  	000007:[b#10,1-d#11,1]
  1540  	000008:[e#12,1-j#13,1]
  1541  	000010:[r#16,1-t#17,1]
  1542  0.0: file count: 4, bytes: 1024, width (mean, max): 2.0, 3, interval range: [0, 11]
  1543  	000003:[a#2,1-d#3,1]
  1544  	000004:[f#4,1-j#5,1]
  1545  	000005:[l#6,1-o#7,1]
  1546  	000006:[p#8,1-x#9,1]
  1547  compacting file count: 7, base compacting intervals: [0, 6]
  1548  L0.3:                    gvvvvvvvvvj
  1549  L0.2:  avvvvvvvvvd    fvvvvvvvvvvvvj
  1550  L0.1:     bvvvvvvd evvvvvvvvvvvvvvvj                      r------t
  1551  L0.0:  avvvvvvvvvd    fvvvvvvvvvvvvj    l---------o p------------------------x
  1552  L6:    a------------------------i          m------------------------------w
  1553         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1554  
  1555  pick-base-compaction min_depth=3
  1556  ----
  1557  no compaction picked
  1558  
  1559  pick-base-compaction min_depth=2
  1560  ----
  1561  compaction picked with stack depth reduction 2
  1562  000006,000010,000005
  1563  seed interval: r-t
  1564  L0.3:                    gvvvvvvvvvj
  1565  L0.2:  avvvvvvvvvd    fvvvvvvvvvvvvj
  1566  L0.1:     bvvvvvvd evvvvvvvvvvvvvvvj                      r++++++t
  1567  L0.0:  avvvvvvvvvd    fvvvvvvvvvvvvj    l+++++++++o p++++++++++++++++++++++++x
  1568  L6:    a------------------------i          m------------------------------w
  1569         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1570  
  1571  # Example 3. The same as Example 2, except there is now an additional file in
  1572  # LBase that overlaps with the [l,o] file in L0.0.
  1573  
  1574  define
  1575  L0.3
  1576    000011:a.SET.18-d.SET.19 base_compacting
  1577    000012:g.SET.20-j.SET.21 base_compacting
  1578  L0.2
  1579    000009:f.SET.14-j.SET.15 base_compacting
  1580    000010:r.SET.16-t.SET.17
  1581  L0.1
  1582    000007:b.SET.10-d.SET.11 base_compacting
  1583    000008:e.SET.12-j.SET.13 base_compacting
  1584  L0.0
  1585    000003:a.SET.2-d.SET.3 base_compacting
  1586    000004:f.SET.4-j.SET.5 base_compacting
  1587    000005:l.SET.6-o.SET.7
  1588    000006:p.SET.8-x.SET.9
  1589  L6
  1590    000001:a.SET.0-i.SET.0
  1591    000013:j.SET.0-l.SET.0
  1592    000002:m.SET.0-w.SET.0
  1593  ----
  1594  file count: 10, sublevels: 4, intervals: 13
  1595  flush split keys(5): [d, g, j, r, t]
  1596  0.3: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [5, 5]
  1597  	000012:[g#20,1-j#21,1]
  1598  0.2: file count: 2, bytes: 512, width (mean, max): 2.0, 2, interval range: [0, 5]
  1599  	000011:[a#18,1-d#19,1]
  1600  	000009:[f#14,1-j#15,1]
  1601  0.1: file count: 3, bytes: 768, width (mean, max): 1.7, 3, interval range: [1, 10]
  1602  	000007:[b#10,1-d#11,1]
  1603  	000008:[e#12,1-j#13,1]
  1604  	000010:[r#16,1-t#17,1]
  1605  0.0: file count: 4, bytes: 1024, width (mean, max): 2.0, 3, interval range: [0, 11]
  1606  	000003:[a#2,1-d#3,1]
  1607  	000004:[f#4,1-j#5,1]
  1608  	000005:[l#6,1-o#7,1]
  1609  	000006:[p#8,1-x#9,1]
  1610  compacting file count: 7, base compacting intervals: [0, 6]
  1611  L0.3:                    gvvvvvvvvvj
  1612  L0.2:  avvvvvvvvvd    fvvvvvvvvvvvvj
  1613  L0.1:     bvvvvvvd evvvvvvvvvvvvvvvj                      r------t
  1614  L0.0:  avvvvvvvvvd    fvvvvvvvvvvvvj    l---------o p------------------------x
  1615  L6:    a------------------------i j------l m------------------------------w
  1616         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1617  
  1618  pick-base-compaction min_depth=2
  1619  ----
  1620  compaction picked with stack depth reduction 2
  1621  000006,000010
  1622  seed interval: r-t
  1623  L0.3:                    gvvvvvvvvvj
  1624  L0.2:  avvvvvvvvvd    fvvvvvvvvvvvvj
  1625  L0.1:     bvvvvvvd evvvvvvvvvvvvvvvj                      r++++++t
  1626  L0.0:  avvvvvvvvvd    fvvvvvvvvvvvvj    l---------o p++++++++++++++++++++++++x
  1627  L6:    a------------------------i j------l m------------------------------w
  1628         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1629  
  1630  # Example 4. Intra-L0 compactions.
  1631  
  1632  define
  1633  L0.3
  1634    000011:a.SET.18-d.SET.19
  1635    000012:g.SET.20-j.SET.21 base_compacting
  1636  L0.2
  1637    000009:f.SET.14-j.SET.15 base_compacting
  1638    000010:r.SET.16-t.SET.17 base_compacting
  1639  L0.1
  1640    000007:b.SET.10-d.SET.11
  1641    000008:e.SET.12-j.SET.13 base_compacting
  1642  L0.0
  1643    000003:a.SET.2-d.SET.3
  1644    000004:f.SET.4-j.SET.5 base_compacting
  1645    000005:l.SET.6-o.SET.7
  1646    000006:p.SET.8-x.SET.9 base_compacting
  1647  L6
  1648    000001:a.SET.0-i.SET.0
  1649    000002:m.SET.0-w.SET.0
  1650  ----
  1651  file count: 10, sublevels: 4, intervals: 13
  1652  flush split keys(5): [d, g, j, r, t]
  1653  0.3: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [5, 5]
  1654  	000012:[g#20,1-j#21,1]
  1655  0.2: file count: 2, bytes: 512, width (mean, max): 2.0, 2, interval range: [0, 5]
  1656  	000011:[a#18,1-d#19,1]
  1657  	000009:[f#14,1-j#15,1]
  1658  0.1: file count: 3, bytes: 768, width (mean, max): 1.7, 3, interval range: [1, 10]
  1659  	000007:[b#10,1-d#11,1]
  1660  	000008:[e#12,1-j#13,1]
  1661  	000010:[r#16,1-t#17,1]
  1662  0.0: file count: 4, bytes: 1024, width (mean, max): 2.0, 3, interval range: [0, 11]
  1663  	000003:[a#2,1-d#3,1]
  1664  	000004:[f#4,1-j#5,1]
  1665  	000005:[l#6,1-o#7,1]
  1666  	000006:[p#8,1-x#9,1]
  1667  compacting file count: 6, base compacting intervals: [3, 6], [9, 12]
  1668  L0.3:                    gvvvvvvvvvj
  1669  L0.2:  a---------d    fvvvvvvvvvvvvj
  1670  L0.1:     b------d evvvvvvvvvvvvvvvj                      rvvvvvvt
  1671  L0.0:  a---------d    fvvvvvvvvvvvvj    l---------o pvvvvvvvvvvvvvvvvvvvvvvvvx
  1672  L6:    a------------------------i          m------------------------------w
  1673         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1674  
  1675  pick-intra-l0-compaction min_depth=2
  1676  ----
  1677  compaction picked with stack depth reduction 3
  1678  000011,000007,000003
  1679  seed interval: b-d
  1680  L0.3:                    gvvvvvvvvvj
  1681  L0.2:  a+++++++++d    fvvvvvvvvvvvvj
  1682  L0.1:     b++++++d evvvvvvvvvvvvvvvj                      rvvvvvvt
  1683  L0.0:  a+++++++++d    fvvvvvvvvvvvvj    l---------o pvvvvvvvvvvvvvvvvvvvvvvvvx
  1684  L6:    a------------------------i          m------------------------------w
  1685         aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx
  1686  
  1687  # Regression test for cockroachdb/cockroach#101896. We must return
  1688  # errInvalidL0SublevelOpt in any case where a new L0 file is being AddL0File'd
  1689  # with a largest sequence number below an existing file in the same interval.
  1690  
  1691  define
  1692  L0
  1693    000004:a.SET.2-e.SET.3
  1694    000006:a.SET.7-b.SET.8
  1695    000007:d.SET.12-f.SET.12
  1696  ----
  1697  file count: 3, sublevels: 2, intervals: 5
  1698  flush split keys(2): [b, e]
  1699  0.1: file count: 2, bytes: 512, width (mean, max): 1.5, 2, interval range: [0, 3]
  1700  	000006:[a#7,1-b#8,1]
  1701  	000007:[d#12,1-f#12,1]
  1702  0.0: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [0, 2]
  1703  	000004:[a#2,1-e#3,1]
  1704  compacting file count: 0, base compacting intervals: none
  1705  L0.1:  a---b    d------f
  1706  L0.0:  a------------e
  1707         aa bb cc dd ee ff
  1708  
  1709  # Note that 000006 will bump the sublevel for the incoming file to 2. We
  1710  # should still realize that it's slotting below 000007 and return an error.
  1711  
  1712  add-l0-files
  1713    000015:a.SET.9-g.SET.10
  1714  ----
  1715  pebble: L0 sublevel generation optimization cannot be used
  1716  
  1717  # Fully-regenerated L0 sublevels allow us to pick an intra-L0 compaction that
  1718  # does not violate sublevel ordering.
  1719  
  1720  define
  1721  L0
  1722    000004:a.SET.2-e.SET.3
  1723    000006:a.SET.7-b.SET.8
  1724    000007:d.SET.12-f.SET.12
  1725    000015:a.SET.9-g.SET.10
  1726  ----
  1727  file count: 4, sublevels: 4, intervals: 6
  1728  flush split keys(2): [b, e]
  1729  0.3: file count: 1, bytes: 256, width (mean, max): 2.0, 2, interval range: [2, 3]
  1730  	000007:[d#12,1-f#12,1]
  1731  0.2: file count: 1, bytes: 256, width (mean, max): 5.0, 5, interval range: [0, 4]
  1732  	000015:[a#9,1-g#10,1]
  1733  0.1: file count: 1, bytes: 256, width (mean, max): 1.0, 1, interval range: [0, 0]
  1734  	000006:[a#7,1-b#8,1]
  1735  0.0: file count: 1, bytes: 256, width (mean, max): 3.0, 3, interval range: [0, 2]
  1736  	000004:[a#2,1-e#3,1]
  1737  compacting file count: 0, base compacting intervals: none
  1738  L0.3:           d------f
  1739  L0.2:  a------------------g
  1740  L0.1:  a---b
  1741  L0.0:  a------------e
  1742         aa bb cc dd ee ff gg
  1743  
  1744  # Exclude the d-f file through earliest_unflushed_seqnum.
  1745  
  1746  pick-intra-l0-compaction min_depth=2 earliest_unflushed_seqnum=11
  1747  ----
  1748  compaction picked with stack depth reduction 3
  1749  000015,000006,000004
  1750  seed interval: a-b
  1751  L0.3:           d------f
  1752  L0.2:  a++++++++++++++++++g
  1753  L0.1:  a+++b
  1754  L0.0:  a++++++++++++e
  1755         aa bb cc dd ee ff gg
  1756  
  1757  pick-intra-l0-compaction min_depth=2
  1758  ----
  1759  compaction picked with stack depth reduction 3
  1760  000015,000007,000006,000004
  1761  seed interval: a-b
  1762  L0.3:           d++++++f
  1763  L0.2:  a++++++++++++++++++g
  1764  L0.1:  a+++b
  1765  L0.0:  a++++++++++++e
  1766         aa bb cc dd ee ff gg