github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/testdata/iter_histories/next_prefix (about)

     1  reset
     2  ----
     3  
     4  # For all prefixes a-z, write 3 keys at timestamps @1, @10, @100.
     5  # This populates a total of 26 * 3 = 78 keys.
     6  
     7  populate keylen=1 timestamps=(1, 10, 100)
     8  ----
     9  wrote 78 keys
    10  
    11  combined-iter
    12  first
    13  next-prefix
    14  next-prefix
    15  next-prefix
    16  next-prefix
    17  next-prefix
    18  next-prefix
    19  next-prefix
    20  next-prefix
    21  next-prefix
    22  next-prefix
    23  next-prefix
    24  next-prefix
    25  next-prefix
    26  next-prefix
    27  next-prefix
    28  ----
    29  a@100: (a@100, .)
    30  b@100: (b@100, .)
    31  c@100: (c@100, .)
    32  d@100: (d@100, .)
    33  e@100: (e@100, .)
    34  f@100: (f@100, .)
    35  g@100: (g@100, .)
    36  h@100: (h@100, .)
    37  i@100: (i@100, .)
    38  j@100: (j@100, .)
    39  k@100: (k@100, .)
    40  l@100: (l@100, .)
    41  m@100: (m@100, .)
    42  n@100: (n@100, .)
    43  o@100: (o@100, .)
    44  p@100: (p@100, .)
    45  
    46  combined-iter
    47  seek-ge n@30
    48  next-prefix
    49  next
    50  next
    51  next-prefix
    52  ----
    53  n@10: (n@10, .)
    54  o@100: (o@100, .)
    55  o@10: (o@10, .)
    56  o@1: (o@1, .)
    57  p@100: (p@100, .)
    58  
    59  combined-iter
    60  seek-prefix-ge p@210
    61  next-prefix
    62  ----
    63  p@100: (p@100, .)
    64  .
    65  
    66  combined-iter
    67  seek-ge p@210
    68  next-prefix
    69  seek-ge p@210
    70  next
    71  next-prefix
    72  seek-ge p@210
    73  next
    74  next
    75  next-prefix
    76  ----
    77  p@100: (p@100, .)
    78  q@100: (q@100, .)
    79  p@100: (p@100, .)
    80  p@10: (p@10, .)
    81  q@100: (q@100, .)
    82  p@100: (p@100, .)
    83  p@10: (p@10, .)
    84  p@1: (p@1, .)
    85  q@100: (q@100, .)
    86  
    87  reset target-file-size=1
    88  ----
    89  
    90  populate keylen=1 timestamps=(1, 10, 100)
    91  ----
    92  wrote 78 keys
    93  
    94  flush
    95  ----
    96  
    97  combined-iter
    98  first
    99  next-prefix
   100  next-prefix
   101  next-prefix
   102  next-prefix
   103  next-prefix
   104  next-prefix
   105  next-prefix
   106  next-prefix
   107  next-prefix
   108  next-prefix
   109  next-prefix
   110  next-prefix
   111  next-prefix
   112  next-prefix
   113  next-prefix
   114  ----
   115  a@100: (a@100, .)
   116  b@100: (b@100, .)
   117  c@100: (c@100, .)
   118  d@100: (d@100, .)
   119  e@100: (e@100, .)
   120  f@100: (f@100, .)
   121  g@100: (g@100, .)
   122  h@100: (h@100, .)
   123  i@100: (i@100, .)
   124  j@100: (j@100, .)
   125  k@100: (k@100, .)
   126  l@100: (l@100, .)
   127  m@100: (m@100, .)
   128  n@100: (n@100, .)
   129  o@100: (o@100, .)
   130  p@100: (p@100, .)
   131  
   132  combined-iter
   133  seek-ge n@30
   134  next-prefix
   135  next
   136  next
   137  next-prefix
   138  ----
   139  n@10: (n@10, .)
   140  o@100: (o@100, .)
   141  o@10: (o@10, .)
   142  o@1: (o@1, .)
   143  p@100: (p@100, .)
   144  
   145  combined-iter
   146  seek-prefix-ge p@210
   147  next-prefix
   148  ----
   149  p@100: (p@100, .)
   150  .
   151  
   152  combined-iter
   153  seek-ge p@210
   154  next-prefix
   155  seek-ge p@210
   156  next
   157  next-prefix
   158  seek-ge p@210
   159  next
   160  next
   161  next-prefix
   162  ----
   163  p@100: (p@100, .)
   164  q@100: (q@100, .)
   165  p@100: (p@100, .)
   166  p@10: (p@10, .)
   167  q@100: (q@100, .)
   168  p@100: (p@100, .)
   169  p@10: (p@10, .)
   170  p@1: (p@1, .)
   171  q@100: (q@100, .)
   172  
   173  batch commit
   174  range-key-set p r @1 foo
   175  ----
   176  committed 1 keys
   177  
   178  combined-iter
   179  seek-ge p@210
   180  next-prefix
   181  ----
   182  p@210: (., [p-r) @1=foo UPDATED)
   183  q@100: (q@100, [p-r) @1=foo)
   184  
   185  combined-iter
   186  seek-ge p@210
   187  next-prefix
   188  seek-ge p@210
   189  next
   190  next-prefix
   191  seek-ge p@210
   192  next
   193  next
   194  next-prefix
   195  ----
   196  p@210: (., [p-r) @1=foo UPDATED)
   197  q@100: (q@100, [p-r) @1=foo)
   198  p@210: (., [p-r) @1=foo)
   199  p@100: (p@100, [p-r) @1=foo)
   200  q@100: (q@100, [p-r) @1=foo)
   201  p@210: (., [p-r) @1=foo)
   202  p@100: (p@100, [p-r) @1=foo)
   203  p@10: (p@10, [p-r) @1=foo)
   204  q@100: (q@100, [p-r) @1=foo)
   205  
   206  # Test an iterator that is positioned on a range key start of a prefix, and the
   207  # next key is a point key with that same prefix. The interleaving iterator must
   208  # correctly handle this case and advance the point key iterator.
   209  combined-iter
   210  seek-ge p
   211  next-prefix
   212  ----
   213  p: (., [p-r) @1=foo UPDATED)
   214  q@100: (q@100, [p-r) @1=foo)
   215  
   216  # Test switching directions via NextPrefix.
   217  combined-iter
   218  seek-ge p@100
   219  prev
   220  next-prefix
   221  ----
   222  p@100: (p@100, [p-r) @1=foo UPDATED)
   223  p: (., [p-r) @1=foo)
   224  q@100: (q@100, [p-r) @1=foo)
   225  
   226  # Test switching directions via NextPrefix when the internal iterator is
   227  # exhausted (in the reverse direction), but the Iterator is not.
   228  #  eg, i.pos = iterPosPrev and i.iterKey == nil.
   229  combined-iter
   230  seek-ge a@10
   231  prev
   232  next-prefix
   233  ----
   234  a@10: (a@10, .)
   235  a@100: (a@100, .)
   236  b@100: (b@100, .)
   237  
   238  reset
   239  ----
   240  
   241  populate keylen=1 timestamps=(1, 10, 100)
   242  ----
   243  wrote 78 keys
   244  
   245  flush
   246  ----
   247  
   248  lsm
   249  ----
   250  0.0:
   251    000005:[a@100#12,SET-z@1#85,SET]
   252  
   253  # Test for https://github.com/cockroachdb/pebble/issues/2260. Triggered the
   254  # bug. The second call to first would return c@100 instead of the correct key,
   255  # b@1.
   256  combined-iter upper=b@1
   257  first
   258  next-prefix
   259  next-prefix
   260  set-bounds lower=b@1 upper=d
   261  first
   262  next
   263  first
   264  ----
   265  a@100: (a@100, .)
   266  err=NextPrefix not permitted with upper bound b@1
   267  err=NextPrefix not permitted with upper bound b@1
   268  .
   269  b@1: (b@1, .)
   270  c@100: (c@100, .)
   271  b@1: (b@1, .)
   272  
   273  # Did not trigger https://github.com/cockroachdb/pebble/issues/2260 since
   274  # Iterator.NextPrefix first does a Next. So the second call to NextPrefix
   275  # returned after the Next, since the upper bound was reached, which left the
   276  # Iterator positioned at b@1.
   277  combined-iter upper=b@10
   278  first
   279  next-prefix
   280  next-prefix
   281  set-bounds lower=b@1 upper=d
   282  first
   283  next
   284  first
   285  ----
   286  a@100: (a@100, .)
   287  err=NextPrefix not permitted with upper bound b@10
   288  err=NextPrefix not permitted with upper bound b@10
   289  .
   290  b@1: (b@1, .)
   291  c@100: (c@100, .)
   292  b@1: (b@1, .)