github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/testdata/manual_compaction (about)

     1  batch
     2  set a 1
     3  set b 2
     4  ----
     5  
     6  compact a-b
     7  ----
     8  6:
     9    000005:[a#1,SET-b#2,SET]
    10  
    11  batch
    12  set c 3
    13  set d 4
    14  ----
    15  
    16  compact c-d
    17  ----
    18  6:
    19    000005:[a#1,SET-b#2,SET]
    20    000007:[c#3,SET-d#4,SET]
    21  
    22  batch
    23  set b 5
    24  set c 6
    25  ----
    26  
    27  compact a-d
    28  ----
    29  6:
    30    000010:[a#0,SET-d#0,SET]
    31  
    32  # This also tests flushing a memtable that only contains range
    33  # deletions.
    34  
    35  batch
    36  del-range a e
    37  ----
    38  
    39  compact a-d
    40  ----
    41  
    42  # Test that a multi-output-file compaction generates non-overlapping files.
    43  
    44  define target-file-sizes=(100, 1)
    45  L0
    46    b.SET.1:v
    47  L0
    48    a.SET.2:v
    49  ----
    50  0.0:
    51    000005:[a#2,SET-a#2,SET]
    52    000004:[b#1,SET-b#1,SET]
    53  
    54  compact a-b
    55  ----
    56  1:
    57    000006:[a#0,SET-a#0,SET]
    58    000007:[b#0,SET-b#0,SET]
    59  
    60  # A range tombstone extends past the grandparent file boundary used to limit the
    61  # size of future compactions. Verify the range tombstone is split at that file
    62  # boundary.
    63  
    64  define target-file-sizes=(1, 1, 1, 1)
    65  L1
    66    a.SET.3:v
    67  L2
    68    a.RANGEDEL.2:e
    69  L3
    70    a.SET.0:v
    71    b.SET.0:v
    72  L3
    73    c.SET.0:v
    74    d.SET.0:v
    75  ----
    76  1:
    77    000004:[a#3,SET-a#3,SET]
    78  2:
    79    000005:[a#2,RANGEDEL-e#72057594037927935,RANGEDEL]
    80  3:
    81    000006:[a#0,SET-b#0,SET]
    82    000007:[c#0,SET-d#0,SET]
    83  
    84  wait-pending-table-stats
    85  000005
    86  ----
    87  num-entries: 1
    88  num-deletions: 1
    89  num-range-key-sets: 0
    90  point-deletions-bytes-estimate: 0
    91  range-deletions-bytes-estimate: 1552
    92  
    93  compact a-e L1
    94  ----
    95  2:
    96    000008:[a#3,SET-c#72057594037927935,RANGEDEL]
    97    000009:[c#2,RANGEDEL-e#72057594037927935,RANGEDEL]
    98  3:
    99    000006:[a#0,SET-b#0,SET]
   100    000007:[c#0,SET-d#0,SET]
   101  
   102  wait-pending-table-stats
   103  000008
   104  ----
   105  num-entries: 2
   106  num-deletions: 1
   107  num-range-key-sets: 0
   108  point-deletions-bytes-estimate: 0
   109  range-deletions-bytes-estimate: 776
   110  
   111  # Same as above, except range tombstone covers multiple grandparent file boundaries.
   112  
   113  define target-file-sizes=(1, 1, 1, 1)
   114  L1
   115    a.SET.3:v
   116  L2
   117    a.RANGEDEL.2:g
   118  L3
   119    a.SET.0:v
   120    b.SET.0:v
   121  L3
   122    c.SET.0:v
   123    d.SET.0:v
   124  L3
   125    e.SET.0:v
   126    f.SET.1:v
   127  L3
   128    f.SET.0:v
   129    g.SET.0:v
   130  ----
   131  1:
   132    000004:[a#3,SET-a#3,SET]
   133  2:
   134    000005:[a#2,RANGEDEL-g#72057594037927935,RANGEDEL]
   135  3:
   136    000006:[a#0,SET-b#0,SET]
   137    000007:[c#0,SET-d#0,SET]
   138    000008:[e#0,SET-f#1,SET]
   139    000009:[f#0,SET-g#0,SET]
   140  
   141  compact a-e L1
   142  ----
   143  2:
   144    000010:[a#3,SET-c#72057594037927935,RANGEDEL]
   145    000011:[c#2,RANGEDEL-e#72057594037927935,RANGEDEL]
   146    000012:[e#2,RANGEDEL-f#72057594037927935,RANGEDEL]
   147    000013:[f#2,RANGEDEL-g#72057594037927935,RANGEDEL]
   148  3:
   149    000006:[a#0,SET-b#0,SET]
   150    000007:[c#0,SET-d#0,SET]
   151    000008:[e#0,SET-f#1,SET]
   152    000009:[f#0,SET-g#0,SET]
   153  
   154  # A range tombstone covers multiple grandparent file boundaries between point keys,
   155  # rather than after all point keys.
   156  
   157  define target-file-sizes=(1, 1, 1, 1)
   158  L1
   159    a.SET.3:v
   160    h.SET.3:v
   161  L2
   162    a.RANGEDEL.2:g
   163  L3
   164    a.SET.0:v
   165    b.SET.0:v
   166  L3
   167    c.SET.0:v
   168    d.SET.0:v
   169  L3
   170    e.SET.0:v
   171    f.SET.1:v
   172  ----
   173  1:
   174    000004:[a#3,SET-h#3,SET]
   175  2:
   176    000005:[a#2,RANGEDEL-g#72057594037927935,RANGEDEL]
   177  3:
   178    000006:[a#0,SET-b#0,SET]
   179    000007:[c#0,SET-d#0,SET]
   180    000008:[e#0,SET-f#1,SET]
   181  
   182  compact a-e L1
   183  ----
   184  2:
   185    000009:[a#3,SET-c#72057594037927935,RANGEDEL]
   186    000010:[c#2,RANGEDEL-h#3,SET]
   187  3:
   188    000006:[a#0,SET-b#0,SET]
   189    000007:[c#0,SET-d#0,SET]
   190    000008:[e#0,SET-f#1,SET]
   191  
   192  # A range tombstone is the first and only item output by a compaction, and it
   193  # extends past the grandparent file boundary used to limit the size of future
   194  # compactions. Verify the range tombstone is split at that file boundary.
   195  
   196  define target-file-sizes=(1, 1, 1, 1)
   197  L1
   198    a.RANGEDEL.3:e
   199  L2
   200    a.SET.2:v
   201  L3
   202    a.SET.0:v
   203    b.SET.0:v
   204  L3
   205    c.SET.0:v
   206    d.SET.0:v
   207  ----
   208  1:
   209    000004:[a#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   210  2:
   211    000005:[a#2,SET-a#2,SET]
   212  3:
   213    000006:[a#0,SET-b#0,SET]
   214    000007:[c#0,SET-d#0,SET]
   215  
   216  compact a-e L1
   217  ----
   218  2:
   219    000008:[a#3,RANGEDEL-c#72057594037927935,RANGEDEL]
   220    000009:[c#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   221  3:
   222    000006:[a#0,SET-b#0,SET]
   223    000007:[c#0,SET-d#0,SET]
   224  
   225  # An elided range tombstone is the first item encountered by a compaction,
   226  # and the grandparent limit set by it extends to the next item, also a range
   227  # tombstone. The first item should be elided, and the second item should
   228  # reset the grandparent limit.
   229  
   230  define target-file-sizes=(100, 100, 100, 100)
   231  L1
   232    a.RANGEDEL.4:d
   233  L1
   234    grandparent.RANGEDEL.2:z
   235    h.SET.3:v
   236  L2
   237    grandparent.SET.1:v
   238  L3
   239    grandparent.SET.0:v
   240  L3
   241    m.SET.0:v
   242  ----
   243  1:
   244    000004:[a#4,RANGEDEL-d#72057594037927935,RANGEDEL]
   245    000005:[grandparent#2,RANGEDEL-z#72057594037927935,RANGEDEL]
   246  2:
   247    000006:[grandparent#1,SET-grandparent#1,SET]
   248  3:
   249    000007:[grandparent#0,SET-grandparent#0,SET]
   250    000008:[m#0,SET-m#0,SET]
   251  
   252  compact a-h L1
   253  ----
   254  2:
   255    000009:[grandparent#2,RANGEDEL-m#72057594037927935,RANGEDEL]
   256    000010:[m#2,RANGEDEL-z#72057594037927935,RANGEDEL]
   257  3:
   258    000007:[grandparent#0,SET-grandparent#0,SET]
   259    000008:[m#0,SET-m#0,SET]
   260  
   261  # Setup such that grandparent overlap limit is exceeded multiple times at the same user key ("b").
   262  # Ensures the compaction output files are non-overlapping.
   263  
   264  define target-file-sizes=(1, 1, 1, 1)
   265  L1
   266    a.SET.2:v
   267    c.SET.2:v
   268  L2
   269    a.RANGEDEL.3:c
   270  L3
   271    b.SET.2:v
   272  L3
   273    b.SET.1:v
   274  L3
   275    b.SET.0:v
   276  ----
   277  1:
   278    000004:[a#2,SET-c#2,SET]
   279  2:
   280    000005:[a#3,RANGEDEL-c#72057594037927935,RANGEDEL]
   281  3:
   282    000006:[b#2,SET-b#2,SET]
   283    000007:[b#1,SET-b#1,SET]
   284    000008:[b#0,SET-b#0,SET]
   285  
   286  compact a-c L1
   287  ----
   288  2:
   289    000009:[a#3,RANGEDEL-b#72057594037927935,RANGEDEL]
   290    000010:[b#3,RANGEDEL-c#2,SET]
   291  3:
   292    000006:[b#2,SET-b#2,SET]
   293    000007:[b#1,SET-b#1,SET]
   294    000008:[b#0,SET-b#0,SET]
   295  
   296  # Regression test for a bug where compaction would stop process range
   297  # tombstones for an input level upon finding an sstable in the input
   298  # level with no range tombstones. In the scenario below, sstable 6
   299  # does not contain any range tombstones while sstable 7 does. Both are
   300  # compacted together with sstable 5.
   301  
   302  reset
   303  ----
   304  
   305  batch
   306  set a 1
   307  set b 1
   308  set c 1
   309  set d 1
   310  set z 1
   311  ----
   312  
   313  compact a-z
   314  ----
   315  6:
   316    000005:[a#1,SET-z#5,SET]
   317  
   318  build ext1
   319  set a 2
   320  ----
   321  
   322  build ext2
   323  set b 2
   324  del-range c z
   325  ----
   326  
   327  ingest ext1 ext2
   328  ----
   329  0.0:
   330    000006:[a#6,SET-a#6,SET]
   331    000007:[b#7,SET-z#72057594037927935,RANGEDEL]
   332  6:
   333    000005:[a#1,SET-z#5,SET]
   334  
   335  iter
   336  first
   337  next
   338  next
   339  next
   340  ----
   341  a:2
   342  b:2
   343  z:1
   344  .
   345  
   346  compact a-z
   347  ----
   348  6:
   349    000008:[a#0,SET-z#0,SET]
   350  
   351  iter
   352  first
   353  next
   354  next
   355  next
   356  ----
   357  a:2
   358  b:2
   359  z:1
   360  .
   361  
   362  # Regresion test for a bug in sstable smallest boundary generation
   363  # where the smallest key for an sstable was set to a key "larger" than
   364  # the start key of the first range tombstone. This in turn fouled up
   365  # the processing logic of range tombstones used by mergingIter which
   366  # allowed stepping out of an sstable even though it contained a range
   367  # tombstone that covered keys in lower levels.
   368  
   369  define target-file-sizes=(1, 1, 1, 1)
   370  L0
   371    c.SET.4:4
   372  L1
   373    a.SET.3:3
   374  L2
   375    a.RANGEDEL.2:e
   376  L3
   377    b.SET.1:1
   378  ----
   379  0.0:
   380    000004:[c#4,SET-c#4,SET]
   381  1:
   382    000005:[a#3,SET-a#3,SET]
   383  2:
   384    000006:[a#2,RANGEDEL-e#72057594037927935,RANGEDEL]
   385  3:
   386    000007:[b#1,SET-b#1,SET]
   387  
   388  compact a-e L1
   389  ----
   390  0.0:
   391    000004:[c#4,SET-c#4,SET]
   392  2:
   393    000008:[a#3,SET-b#72057594037927935,RANGEDEL]
   394    000009:[b#2,RANGEDEL-e#72057594037927935,RANGEDEL]
   395  3:
   396    000007:[b#1,SET-b#1,SET]
   397  
   398  # We should only see a:3 and c:4 at this point.
   399  
   400  iter
   401  first
   402  next
   403  next
   404  ----
   405  a:3
   406  c:4
   407  .
   408  
   409  # The bug allowed seeing b:1 during reverse iteration.
   410  
   411  iter
   412  last
   413  prev
   414  prev
   415  ----
   416  c:4
   417  a:3
   418  .
   419  
   420  # This is a similar scenario to the one above. In older versions of Pebble this
   421  # case necessitated adjusting the seqnum of the range tombstone to
   422  # prev.LargestKey.SeqNum-1. We no longer allow user keys to be split across
   423  # sstables, and the seqnum adjustment is no longer necessary.
   424  #
   425  # Note the target-file-size of 26 is specially tailored to get the
   426  # desired compaction output.
   427  
   428  define target-file-sizes=(26, 26, 26, 26) snapshots=(1, 2, 3)
   429  L1
   430    a.SET.4:4
   431  L1
   432    b.SET.2:2
   433    b.RANGEDEL.3:e
   434  L3
   435    b.SET.1:1
   436  ----
   437  1:
   438    000004:[a#4,SET-a#4,SET]
   439    000005:[b#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   440  3:
   441    000006:[b#1,SET-b#1,SET]
   442  
   443  compact a-e L1
   444  ----
   445  2:
   446    000007:[a#4,SET-a#4,SET]
   447    000008:[b#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   448  3:
   449    000006:[b#1,SET-b#1,SET]
   450  
   451  iter
   452  first
   453  next
   454  last
   455  prev
   456  ----
   457  a:4
   458  .
   459  a:4
   460  .
   461  
   462  # Similar to the preceding scenario, except the range tombstone has
   463  # the same seqnum as the largest key in the preceding file.
   464  
   465  define target-file-sizes=(26, 26, 26, 26) snapshots=(1, 2, 3)
   466  L1
   467    a.SET.4:4
   468  L1
   469    b.SET.3:3
   470    b.RANGEDEL.3:e
   471  L3
   472    b.SET.1:1
   473  ----
   474  1:
   475    000004:[a#4,SET-a#4,SET]
   476    000005:[b#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   477  3:
   478    000006:[b#1,SET-b#1,SET]
   479  
   480  compact a-e L1
   481  ----
   482  2:
   483    000007:[a#4,SET-a#4,SET]
   484    000008:[b#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   485  3:
   486    000006:[b#1,SET-b#1,SET]
   487  
   488  iter
   489  first
   490  next
   491  next
   492  last
   493  prev
   494  prev
   495  ----
   496  a:4
   497  b:3
   498  .
   499  b:3
   500  a:4
   501  .
   502  
   503  # Similar to the preceding scenario, except the range tombstone has
   504  # a smaller seqnum than the largest key in the preceding file.
   505  
   506  define target-file-sizes=(26, 26, 26, 26) snapshots=(1, 2, 3)
   507  L1
   508    a.SET.4:4
   509  L1
   510    b.SET.4:4
   511    b.RANGEDEL.2:e
   512  L3
   513    b.SET.1:1
   514  ----
   515  1:
   516    000004:[a#4,SET-a#4,SET]
   517    000005:[b#4,SET-e#72057594037927935,RANGEDEL]
   518  3:
   519    000006:[b#1,SET-b#1,SET]
   520  
   521  compact a-e L1
   522  ----
   523  2:
   524    000007:[a#4,SET-a#4,SET]
   525    000008:[b#4,SET-e#72057594037927935,RANGEDEL]
   526  3:
   527    000006:[b#1,SET-b#1,SET]
   528  
   529  iter
   530  first
   531  next
   532  next
   533  last
   534  prev
   535  prev
   536  ----
   537  a:4
   538  b:4
   539  .
   540  b:4
   541  a:4
   542  .
   543  
   544  # Test a scenario where the last point key in an sstable has a seqnum
   545  # of 0.
   546  
   547  define target-file-sizes=(1, 1, 26) snapshots=(2)
   548  L1
   549    a.SET.3:3
   550    b.RANGEDEL.3:e
   551    b.SET.0:0
   552  L3
   553    a.RANGEDEL.2:b
   554  L3
   555    c.SET.0:0
   556    d.SET.0:0
   557  ----
   558  1:
   559    000004:[a#3,SET-e#72057594037927935,RANGEDEL]
   560  3:
   561    000005:[a#2,RANGEDEL-b#72057594037927935,RANGEDEL]
   562    000006:[c#0,SET-d#0,SET]
   563  
   564  iter
   565  last
   566  prev
   567  ----
   568  a:3
   569  .
   570  
   571  compact a-e L1
   572  ----
   573  2:
   574    000007:[a#3,SET-c#72057594037927935,RANGEDEL]
   575    000008:[c#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   576  3:
   577    000005:[a#2,RANGEDEL-b#72057594037927935,RANGEDEL]
   578    000006:[c#0,SET-d#0,SET]
   579  
   580  iter
   581  last
   582  prev
   583  ----
   584  a:3
   585  .
   586  
   587  # Test a scenario where the last point key in an sstable before the
   588  # grandparent limit is reached has a seqnum of 0. We want to cut the
   589  # sstable after the next point key is added, rather than continuing to
   590  # add keys indefinitely (or till the size limit is reached).
   591  
   592  define target-file-sizes=(100, 1, 52) snapshots=(2)
   593  L1
   594    a.SET.3:3
   595    b.RANGEDEL.3:e
   596    b.SET.0:0
   597    c.SET.1:1
   598    d.SET.1:1
   599  L3
   600    c.RANGEDEL.2:d
   601  ----
   602  1:
   603    000004:[a#3,SET-e#72057594037927935,RANGEDEL]
   604  3:
   605    000005:[c#2,RANGEDEL-d#72057594037927935,RANGEDEL]
   606  
   607  compact a-f L1
   608  ----
   609  2:
   610    000006:[a#3,SET-c#72057594037927935,RANGEDEL]
   611    000007:[c#3,RANGEDEL-e#72057594037927935,RANGEDEL]
   612  3:
   613    000005:[c#2,RANGEDEL-d#72057594037927935,RANGEDEL]
   614  
   615  # Test a scenario where we the last point key in an sstable has a
   616  # seqnum of 0, but there is another range tombstone later in the
   617  # compaction. This scenario was previously triggering an assertion due
   618  # to the rangedel.Fragmenter being finished prematurely.
   619  
   620  define target-file-sizes=(1, 1, 1)
   621  L1
   622    a.SET.0:0
   623    c.RANGEDEL.1:d
   624  L3
   625    b.SET.0:0
   626  ----
   627  1:
   628    000004:[a#0,SET-d#72057594037927935,RANGEDEL]
   629  3:
   630    000005:[b#0,SET-b#0,SET]
   631  
   632  compact a-e L1
   633  ----
   634  2:
   635    000006:[a#0,SET-a#0,SET]
   636  3:
   637    000005:[b#0,SET-b#0,SET]
   638  
   639  define target-file-sizes=(1, 1, 1, 1)
   640  L0
   641    b.SET.1:v
   642  L0
   643    a.SET.2:v
   644  ----
   645  0.0:
   646    000005:[a#2,SET-a#2,SET]
   647    000004:[b#1,SET-b#1,SET]
   648  
   649  add-ongoing-compaction startLevel=0 outputLevel=1 start=a end=b
   650  ----
   651  
   652  async-compact a-b L0
   653  ----
   654  manual compaction blocked until ongoing finished
   655  1:
   656    000006:[a#0,SET-a#0,SET]
   657    000007:[b#0,SET-b#0,SET]
   658  
   659  compact a-b L1
   660  ----
   661  2:
   662    000008:[a#0,SET-a#0,SET]
   663    000009:[b#0,SET-b#0,SET]
   664  
   665  add-ongoing-compaction startLevel=0 outputLevel=1 start=a end=b
   666  ----
   667  
   668  async-compact a-b L2
   669  ----
   670  manual compaction blocked until ongoing finished
   671  3:
   672    000010:[a#0,SET-a#0,SET]
   673    000011:[b#0,SET-b#0,SET]
   674  
   675  add-ongoing-compaction startLevel=0 outputLevel=1 start=a end=b
   676  ----
   677  
   678  set-concurrent-compactions num=2
   679  ----
   680  
   681  async-compact a-b L3
   682  ----
   683  manual compaction did not block for ongoing
   684  4:
   685    000012:[a#0,SET-a#0,SET]
   686    000013:[b#0,SET-b#0,SET]
   687  
   688  remove-ongoing-compaction
   689  ----
   690  
   691  add-ongoing-compaction startLevel=4 outputLevel=5 start=a end=b
   692  ----
   693  
   694  async-compact a-b L4
   695  ----
   696  manual compaction blocked until ongoing finished
   697  5:
   698    000014:[a#0,SET-a#0,SET]
   699    000015:[b#0,SET-b#0,SET]
   700  
   701  # Test of a scenario where consecutive elided range tombstones and grandparent
   702  # boundaries could result in an invariant violation in the rangedel fragmenter.
   703  
   704  define target-file-sizes=(1, 1, 1, 1)
   705  L1
   706    a.RANGEDEL.4:b
   707    c.RANGEDEL.4:d
   708    e.RANGEDEL.4:f
   709  L1
   710    g.RANGEDEL.6:h
   711    i.RANGEDEL.4:j
   712  L1
   713    k.RANGEDEL.5:q
   714    m.RANGEDEL.4:q
   715  L2
   716    a.SET.2:foo
   717  L3
   718    a.SET.1:foo
   719    c.SET.1:foo
   720  L3
   721    ff.SET.1:v
   722  L3
   723    k.SET.1:foo
   724  ----
   725  1:
   726    000004:[a#4,RANGEDEL-f#72057594037927935,RANGEDEL]
   727    000005:[g#6,RANGEDEL-j#72057594037927935,RANGEDEL]
   728    000006:[k#5,RANGEDEL-q#72057594037927935,RANGEDEL]
   729  2:
   730    000007:[a#2,SET-a#2,SET]
   731  3:
   732    000008:[a#1,SET-c#1,SET]
   733    000009:[ff#1,SET-ff#1,SET]
   734    000010:[k#1,SET-k#1,SET]
   735  
   736  compact a-q L1
   737  ----
   738  2:
   739    000011:[a#4,RANGEDEL-d#72057594037927935,RANGEDEL]
   740    000012:[k#5,RANGEDEL-m#72057594037927935,RANGEDEL]
   741  3:
   742    000008:[a#1,SET-c#1,SET]
   743    000009:[ff#1,SET-ff#1,SET]
   744    000010:[k#1,SET-k#1,SET]
   745  
   746  # Test a case where a new output file is started, there are no previous output
   747  # files, there are no additional keys (key = nil) and the rangedel fragmenter
   748  # is non-empty.
   749  define target-file-sizes=(1, 1, 1)
   750  L1
   751    a.RANGEDEL.10:b
   752    d.RANGEDEL.9:e
   753    q.RANGEDEL.8:r
   754  L2
   755    g.RANGEDEL.7:h
   756  L3
   757    q.SET.6:6
   758  ----
   759  1:
   760    000004:[a#10,RANGEDEL-r#72057594037927935,RANGEDEL]
   761  2:
   762    000005:[g#7,RANGEDEL-h#72057594037927935,RANGEDEL]
   763  3:
   764    000006:[q#6,SET-q#6,SET]
   765  
   766  compact a-r L1
   767  ----
   768  2:
   769    000007:[q#8,RANGEDEL-r#72057594037927935,RANGEDEL]
   770  3:
   771    000006:[q#6,SET-q#6,SET]
   772  
   773  define target-file-sizes=(100, 100, 100)
   774  L1
   775    a.RANGEDEL.10:b
   776    b.SET.0:foo
   777    d.RANGEDEL.0:e
   778    j.SET.10:foo
   779  L2
   780    f.RANGEDEL.7:g
   781  L3
   782    c.SET.6:6
   783  L3
   784    c.SET.5:5
   785  L3
   786    c.SET.4:4
   787  L4
   788    a.SET.0:0
   789    f.SET.0:0
   790  ----
   791  1:
   792    000004:[a#10,RANGEDEL-j#10,SET]
   793  2:
   794    000005:[f#7,RANGEDEL-g#72057594037927935,RANGEDEL]
   795  3:
   796    000006:[c#6,SET-c#6,SET]
   797    000007:[c#5,SET-c#5,SET]
   798    000008:[c#4,SET-c#4,SET]
   799  4:
   800    000009:[a#0,SET-f#0,SET]
   801  
   802  compact a-r L1
   803  ----
   804  2:
   805    000010:[a#10,RANGEDEL-b#0,SET]
   806    000011:[d#0,RANGEDEL-j#10,SET]
   807  3:
   808    000006:[c#6,SET-c#6,SET]
   809    000007:[c#5,SET-c#5,SET]
   810    000008:[c#4,SET-c#4,SET]
   811  4:
   812    000009:[a#0,SET-f#0,SET]
   813  
   814  # Test a snapshot that separates a range deletion from all the data that it
   815  # deletes. Ensure that we respect the target-file-size and split into multiple
   816  # outputs.
   817  
   818  define target-file-sizes=(1, 1, 1) snapshots=(14)
   819  L1
   820    a.RANGEDEL.15:z
   821    b.SET.11:foo
   822    c.SET.11:foo
   823  L2
   824    c.SET.0:foo
   825    d.SET.0:foo
   826  ----
   827  1:
   828    000004:[a#15,RANGEDEL-z#72057594037927935,RANGEDEL]
   829  2:
   830    000005:[c#0,SET-d#0,SET]
   831  
   832  compact a-z L1
   833  ----
   834  2:
   835    000006:[a#15,RANGEDEL-c#72057594037927935,RANGEDEL]
   836    000007:[c#15,RANGEDEL-d#72057594037927935,RANGEDEL]
   837    000008:[d#15,RANGEDEL-z#72057594037927935,RANGEDEL]
   838  
   839  # Test an interaction between a range deletion that will be elided with
   840  # output splitting. Ensure that the output is still split (previous versions
   841  # of the code did not, because of intricacies around preventing a zero
   842  # sequence number in an output's largest key).
   843  
   844  define target-file-sizes=(1, 1, 1)
   845  L1
   846    a.RANGEDEL.10:z
   847    b.SET.11:foo
   848    c.SET.11:foo
   849  L2
   850    c.SET.0:foo
   851    d.SET.0:foo
   852  ----
   853  1:
   854    000004:[a#10,RANGEDEL-z#72057594037927935,RANGEDEL]
   855  2:
   856    000005:[c#0,SET-d#0,SET]
   857  
   858  compact a-z L1
   859  ----
   860  2:
   861    000006:[b#0,SET-b#0,SET]
   862    000007:[c#0,SET-c#0,SET]
   863  
   864  define target-file-sizes=(1, 1, 1, 1)
   865  L0
   866    a.SET.3:v
   867    b.SET.2:v
   868  L2
   869    a.SET.1:v
   870  L3
   871    a.SET.0:v
   872    b.SET.0:v
   873  L3
   874    c.SET.0:v
   875  ----
   876  0.0:
   877    000004:[a#3,SET-b#2,SET]
   878  2:
   879    000005:[a#1,SET-a#1,SET]
   880  3:
   881    000006:[a#0,SET-b#0,SET]
   882    000007:[c#0,SET-c#0,SET]
   883  
   884  set-concurrent-compactions num=3
   885  ----
   886  
   887  compact a-c parallel hide-file-num
   888  ----
   889  4:
   890    [a#0,SET-a#0,SET]
   891    [b#0,SET-b#0,SET]
   892    [c#0,SET-c#0,SET]
   893  
   894  define target-file-sizes=(1, 1, 1, 1)
   895  L0
   896    a.SET.3:v
   897    b.SET.2:v
   898  L0
   899    a.SET.2:v
   900    c.SET.2:v
   901  L2
   902    a.SET.1:v
   903    b.SET.1:v
   904  L2
   905    c.SET.1:v
   906  L2
   907    d.SET.0:v
   908  L3
   909    a.SET.0:v
   910    b.SET.0:v
   911  L3
   912    c.SET.0:v
   913  ----
   914  0.1:
   915    000004:[a#3,SET-b#2,SET]
   916  0.0:
   917    000005:[a#2,SET-c#2,SET]
   918  2:
   919    000006:[a#1,SET-b#1,SET]
   920    000007:[c#1,SET-c#1,SET]
   921    000008:[d#0,SET-d#0,SET]
   922  3:
   923    000009:[a#0,SET-b#0,SET]
   924    000010:[c#0,SET-c#0,SET]
   925  
   926  set-concurrent-compactions num=2
   927  ----
   928  
   929  compact a-c L0 parallel
   930  ----
   931  1:
   932    000011:[a#3,SET-a#3,SET]
   933    000012:[b#2,SET-b#2,SET]
   934    000013:[c#2,SET-c#2,SET]
   935  2:
   936    000006:[a#1,SET-b#1,SET]
   937    000007:[c#1,SET-c#1,SET]
   938    000008:[d#0,SET-d#0,SET]
   939  3:
   940    000009:[a#0,SET-b#0,SET]
   941    000010:[c#0,SET-c#0,SET]
   942  
   943  add-ongoing-compaction startLevel=3 outputLevel=4 start=a end=d
   944  ----
   945  
   946  # We allow 2 maximum concurrent compactions. The operation below generates
   947  # 2 concurrent compactions (a-b, c) from L1 to L2. With 1 ongoing compaction with
   948  # output level L4, there is no conflict and thus the concurrent compactions should
   949  # be queued up and executed sequentially. We ensure that the compactions finish and
   950  # that the final result of the compactions is correct.
   951  
   952  async-compact a-d L1 parallel
   953  ----
   954  manual compaction did not block for ongoing
   955  2:
   956    000014:[a#3,SET-a#3,SET]
   957    000015:[b#2,SET-b#2,SET]
   958    000016:[c#2,SET-c#2,SET]
   959    000008:[d#0,SET-d#0,SET]
   960  3:
   961    000009:[a#0,SET-b#0,SET]
   962    000010:[c#0,SET-c#0,SET]
   963  
   964  remove-ongoing-compaction
   965  ----
   966  
   967  set-concurrent-compactions num=3
   968  ----
   969  
   970  compact a-d parallel hide-file-num
   971  ----
   972  4:
   973    [a#0,SET-a#0,SET]
   974    [b#0,SET-b#0,SET]
   975    [c#0,SET-c#0,SET]
   976    [d#0,SET-d#0,SET]
   977  
   978  # Create a contrived compaction that forces point key and rangedel iterators
   979  # to stay in sync to emit a correct view of visible and deleted keys. Note that
   980  # Pebble no longer produces range tombstones that go outside a file's bounds,
   981  # but past versions of bitable did, and we should still be able to handle those
   982  # well.
   983  
   984  define target-file-sizes=(1, 1, 1, 1, 1, 1) snapshots=(390)
   985  L3  start=tmgc.MERGE.391 end=tmgc.MERGE.391
   986    tmgc.MERGE.391:foo
   987  	tmgc.RANGEDEL.331:udkatvs
   988  L3 start=tmgc.MERGE.384 end=tmgc.MERGE.384
   989    tmgc.MERGE.384:bar
   990    tmgc.RANGEDEL.383:tvsalezade
   991    tmgc.RANGEDEL.331:tvsalezade
   992  L3 start=tmgc.RANGEDEL.383 end=tvsalezade.RANGEDEL.72057594037927935
   993    tmgc.RANGEDEL.383:tvsalezade
   994    tmgc.SET.375:baz
   995    tmgc.RANGEDEL.356:tvsalezade
   996  ----
   997  3:
   998    000004:[tmgc#391,MERGE-tmgc#391,MERGE]
   999    000005:[tmgc#384,MERGE-tmgc#384,MERGE]
  1000    000006:[tmgc#383,RANGEDEL-tvsalezade#72057594037927935,RANGEDEL]
  1001  
  1002  compact a-z L3
  1003  ----
  1004  4:
  1005    000007:[tmgc#391,MERGE-tmgc#384,MERGE]
  1006  
  1007  # baz should NOT be visible in the value.
  1008  
  1009  iter
  1010  first
  1011  next
  1012  next
  1013  ----
  1014  tmgc:barfoo
  1015  .
  1016  .