github.com/cockroachdb/pebble@v1.1.2/testdata/singledel_manual_compaction (about)

     1  # This is not actually a manual compaction test, and simply uses manual
     2  # compaction to demonstrate single delete semantics. Specifically, it
     3  # demonstrates that the behavior can be non-deterministic if not used
     4  # correctly.
     5  
     6  # Define a sequence of SET=>SET=>DEL=>SET=>SINGLEDEL.
     7  define target-file-sizes=(1, 1, 1, 1, 1)
     8  L1
     9    a.SINGLEDEL.10:
    10  L2
    11    a.SET.9:v3
    12  L3
    13    a.DEL.8:
    14  L4
    15    a.SET.7:v2
    16  L5
    17    a.SET.6:v1
    18  ----
    19  1:
    20    000004:[a#10,SINGLEDEL-a#10,SINGLEDEL]
    21  2:
    22    000005:[a#9,SET-a#9,SET]
    23  3:
    24    000006:[a#8,DEL-a#8,DEL]
    25  4:
    26    000007:[a#7,SET-a#7,SET]
    27  5:
    28    000008:[a#6,SET-a#6,SET]
    29  
    30  # No data.
    31  iter
    32  first
    33  ----
    34  .
    35  
    36  # Compact away the DEL.
    37  compact a-b L2
    38  ----
    39  1:
    40    000004:[a#10,SINGLEDEL-a#10,SINGLEDEL]
    41  3:
    42    000009:[a#9,SET-a#9,SET]
    43  4:
    44    000007:[a#7,SET-a#7,SET]
    45  5:
    46    000008:[a#6,SET-a#6,SET]
    47  
    48  # No data.
    49  iter
    50  first
    51  ----
    52  .
    53  
    54  # Do two compactions to compact away the SINGLEDEL and 1 SET.
    55  compact a-b L1
    56  ----
    57  2:
    58    000010:[a#10,SINGLEDEL-a#10,SINGLEDEL]
    59  3:
    60    000009:[a#9,SET-a#9,SET]
    61  4:
    62    000007:[a#7,SET-a#7,SET]
    63  5:
    64    000008:[a#6,SET-a#6,SET]
    65  
    66  compact a-b L2
    67  ----
    68  4:
    69    000007:[a#7,SET-a#7,SET]
    70  5:
    71    000008:[a#6,SET-a#6,SET]
    72  
    73  # Deleted data reappears.
    74  iter
    75  first
    76  ----
    77  a: (v2, .)