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

     1  
     2  # Test snapshot striping and coalescing.
     3  
     4  transform snapshots=(5,10,15) disable-elision
     5  a-c:{(#9,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
     6  ----
     7  a-c:{(#9,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3)}
     8  
     9  transform snapshots=(5,10,15) disable-elision
    10  a-c:{(#9,RANGEKEYUNSET,@3) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    11  ----
    12  a-c:{(#9,RANGEKEYUNSET,@3) (#4,RANGEKEYSET,@3,foo3)}
    13  
    14  transform snapshots=(5,10,15) disable-elision
    15  a-c:{(#9,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    16  ----
    17  a-c:{(#9,RANGEKEYDEL) (#4,RANGEKEYSET,@3,foo3)}
    18  
    19  transform snapshots=(5,10,15) disable-elision
    20  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    21  ----
    22  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3)}
    23  
    24  transform disable-elision
    25  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    26  ----
    27  a-c:{(#11,RANGEKEYDEL)}
    28  
    29  # Test that elision works on the last snapshot stripe.
    30  
    31  transform snapshots=(5,10,15)
    32  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    33  ----
    34  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3)}
    35  
    36  transform snapshots=(3,10,15)
    37  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYUNSET,@4) (#2,RANGEKEYSET,@3,foo2)}
    38  ----
    39  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#3,RANGEKEYUNSET,@4) (#2,RANGEKEYSET,@3,foo2)}
    40  
    41  transform snapshots=(2,10,15)
    42  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYUNSET,@4) (#2,RANGEKEYSET,@3,foo2)}
    43  ----
    44  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5)}
    45  
    46  # The RANGEKEYDEL deletes all underlying keys and there are no snapshots or
    47  # in-use key ranges at play, so all keys should empty out.
    48  
    49  transform
    50  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    51  ----
    52  a-c:{}
    53  
    54  # Test RANGEKEYDELs are preserved over in-use key ranges in the last snapshot stripe.
    55  # in-use key ranges cover keys that exist in lower levels of the LSM, so dropping
    56  # range keys in that space could cause correctness issues.
    57  
    58  transform in-use-key-ranges=(b-d)
    59  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    60  ----
    61  a-c:{(#11,RANGEKEYDEL)}
    62  
    63  # Test RANGEKEYSETs are preserved in the non-last snapshot stripe.
    64  
    65  transform in-use-key-ranges=(b-d) snapshots=(8)
    66  a-c:{(#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    67  ----
    68  a-c:{(#11,RANGEKEYDEL) (#4,RANGEKEYSET,@3,foo3)}
    69  
    70  transform
    71  a-c:{(#13,RANGEKEYSET,@3,bar1) (#12,RANGEKEYSET,@2,bar2) (#11,RANGEKEYDEL) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    72  ----
    73  a-c:{(#13,RANGEKEYSET,@3,bar1) (#12,RANGEKEYSET,@2,bar2)}
    74  
    75  # Test RANGEKEYUNSETs are preserved over in-use key ranges.
    76  
    77  transform
    78  a-c:{(#11,RANGEKEYUNSET,@3) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    79  ----
    80  a-c:{}
    81  
    82  transform in-use-key-ranges=(b-d)
    83  a-c:{(#11,RANGEKEYUNSET,@3) (#8,RANGEKEYSET,@3,foo5) (#4,RANGEKEYSET,@3,foo3) (#3,RANGEKEYSET,@3,foo2)}
    84  ----
    85  a-c:{(#11,RANGEKEYUNSET,@3)}
    86  
    87  # Test cases where multiple keys have the same sequence number.
    88  
    89  transform
    90  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYUNSET,@4) (#11,RANGEKEYDEL)}
    91  ----
    92  a-c:{(#11,RANGEKEYSET,@3,foo5)}
    93  
    94  transform
    95  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYUNSET,@3) (#11,RANGEKEYDEL)}
    96  ----
    97  a-c:{(#11,RANGEKEYSET,@3,foo5)}
    98  
    99  # Test that UNSETs and DELs are retained over in-use key ranges.
   100  
   101  transform in-use-key-ranges=(b-d)
   102  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYUNSET,@4) (#11,RANGEKEYDEL)}
   103  ----
   104  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYUNSET,@4) (#11,RANGEKEYDEL)}
   105  
   106  # Test that sets shadow unset at the same prefix, even if elision is disabled.
   107  
   108  transform in-use-key-ranges=(b-d)
   109  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYUNSET,@3) (#11,RANGEKEYDEL)}
   110  ----
   111  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYDEL)}
   112  
   113  transform disable-elision
   114  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYUNSET,@3) (#11,RANGEKEYDEL)
   115  ----
   116  a-c:{(#11,RANGEKEYSET,@3,foo5) (#11,RANGEKEYDEL)}