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

     1  reset
     2  ----
     3  
     4  batch commit
     5  range-key-set x z @5 boop
     6  ----
     7  committed 1 keys
     8  
     9  combined-iter
    10  last
    11  next
    12  prev
    13  ----
    14  x: (., [x-z) @5=boop UPDATED)
    15  .
    16  x: (., [x-z) @5=boop UPDATED)
    17  
    18  # Test limited reverse iteration. The seek-lt-limit z y must see the [x-z) range
    19  # key because it covers a key within the range [y, z). The range key start
    20  # boundary isn't until x.
    21  
    22  combined-iter
    23  seek-lt-limit z y
    24  next
    25  prev-limit y
    26  ----
    27  x: valid (., [x-z) @5=boop UPDATED)
    28  .
    29  x: valid (., [x-z) @5=boop UPDATED)
    30  
    31  # Test limited forward iteration. Since range keys are interleaved at the start
    32  # boundaries, the iterator is guaranteed to encounter covering range keys
    33  # without any special casing in the implementation.
    34  
    35  combined-iter
    36  seek-ge-limit w y
    37  prev
    38  next-limit y
    39  ----
    40  x: valid (., [x-z) @5=boop UPDATED)
    41  .
    42  x: valid (., [x-z) @5=boop UPDATED)
    43  
    44  # Test another limited backward iteration case where there exists a deleted
    45  # point key and the underlying internalIterator is Prev'd to a key beyond the
    46  # limit. This should still surface the covering range key.
    47  
    48  batch commit
    49  del yy
    50  ----
    51  committed 1 keys
    52  
    53  combined-iter
    54  seek-lt-limit z y
    55  next
    56  prev-limit y
    57  ----
    58  x: valid (., [x-z) @5=boop UPDATED)
    59  .
    60  x: valid (., [x-z) @5=boop UPDATED)
    61  
    62  # Test a case during limited reverse iteration where a range key covers a
    63  # portion of the keyspace within the limit. The iterator should NOT pause and
    64  # should surface the range key.
    65  
    66  reset
    67  ----
    68  
    69  batch commit
    70  del b
    71  range-key-set a d @1 foo
    72  ----
    73  committed 2 keys
    74  
    75  flush
    76  ----
    77  
    78  combined-iter
    79  seek-ge z
    80  prev-limit c
    81  ----
    82  .
    83  a: valid (., [a-d) @1=foo UPDATED)
    84  
    85  # Test a case during limited reverse iteration where there exists a range key
    86  # but it ends before the limit. The iterator should pause.
    87  
    88  reset
    89  ----
    90  
    91  batch commit
    92  del b
    93  range-key-set a c @1 foo
    94  ----
    95  committed 2 keys
    96  
    97  combined-iter
    98  seek-ge z
    99  prev-limit c
   100  ----
   101  .
   102  . at-limit
   103  
   104  # Test at-limit interactions with RangeKeyChanged().
   105  # Regression test for #1963.
   106  
   107  reset
   108  ----
   109  
   110  # Construct a range key and points such that there are deleted keys that a
   111  # -WithLimit iterator operation may pause at both at the beginning and end of
   112  # the range key's bounds.
   113  #
   114  #                    * b.DEL             * cat.SET         * dog.DEL
   115  #   |-------------------------------------------------------------------) [a,e)@1→foo
   116  #   a                b                c                d                e
   117  
   118  batch commit
   119  del b
   120  set cat cat
   121  del dog
   122  range-key-set a e @1 foo
   123  ----
   124  committed 4 keys
   125  
   126  combined-iter
   127  seek-ge-limit a bat
   128  seek-ge-limit a bat
   129  seek-ge-limit apple bat
   130  seek-ge-limit cow zoo
   131  ----
   132  a: valid (., [a-e) @1=foo UPDATED)
   133  a: valid (., [a-e) @1=foo)
   134  apple: valid (., [a-e) @1=foo)
   135  cow: valid (., [a-e) @1=foo)
   136  
   137  combined-iter
   138  seek-ge a
   139  next-limit bat
   140  next-limit dog
   141  next-limit zoo
   142  ----
   143  a: (., [a-e) @1=foo UPDATED)
   144  . at-limit
   145  cat: valid (cat, [a-e) @1=foo UPDATED)
   146  . exhausted
   147  
   148  combined-iter
   149  seek-lt-limit f e
   150  seek-lt-limit e d
   151  seek-lt-limit e d
   152  seek-lt-limit f e
   153  seek-lt-limit e d
   154  ----
   155  . at-limit
   156  cat: valid (cat, [a-e) @1=foo UPDATED)
   157  cat: valid (cat, [a-e) @1=foo)
   158  . at-limit
   159  cat: valid (cat, [a-e) @1=foo UPDATED)
   160  
   161  # Add a new dz.SET key.
   162  #
   163  #                    * b.DEL             * cat.SET         * dog.DEL  * dz.SET
   164  #   |-------------------------------------------------------------------) [a,e)@1→foo
   165  #   a                b                c                d                e
   166  
   167  batch commit
   168  set dz dz
   169  ----
   170  committed 1 keys
   171  
   172  combined-iter
   173  seek-ge dz
   174  prev-limit e
   175  prev-limit dy
   176  prev-limit c
   177  prev
   178  next
   179  ----
   180  dz: (dz, [a-e) @1=foo UPDATED)
   181  . at-limit
   182  cat: valid (cat, [a-e) @1=foo UPDATED)
   183  a: valid (., [a-e) @1=foo)
   184  .
   185  a: (., [a-e) @1=foo UPDATED)
   186  
   187  # Test enforcing limits even while skipping point keys.
   188  
   189  reset
   190  ----
   191  
   192  batch commit
   193  set b@9 b@9
   194  set c@2 c@2
   195  set d@8 d@8
   196  ----
   197  committed 3 keys
   198  
   199  combined-iter point-key-filter=(6,10)
   200  last
   201  prev-limit c
   202  seek-ge-limit c@9 d
   203  ----
   204  d@8: (d@8, .)
   205  . at-limit
   206  . at-limit