github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/internal/keyspan/testdata/interleaving_iter (about)

     1  define-rangekeys
     2  a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
     3  c-d:{(#4,RANGEKEYSET,@3,coconut)}
     4  e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
     5  h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)}
     6  l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
     7  q-z:{(#14,RANGEKEYSET,@9,mangos)}
     8  ----
     9  OK
    10  
    11  define-pointkeys
    12  artichoke.SET.10
    13  artichoke.SET.8
    14  carrot.SET.13
    15  cauliflower.DEL.9
    16  parsnip.SET.3
    17  tomato.SET.2
    18  zucchini.MERGE.12
    19  ----
    20  OK
    21  
    22  iter
    23  first
    24  next
    25  next
    26  next
    27  next
    28  next
    29  next
    30  next
    31  next
    32  next
    33  next
    34  next
    35  ----
    36  -- SpanChanged(nil)
    37  -- SpanChanged(a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
    38  PointKey: a#72057594037927935,21
    39  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
    40  -
    41  PointKey: artichoke#10,1
    42  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
    43  -
    44  PointKey: artichoke#8,1
    45  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
    46  -
    47  -- SpanChanged(c-d:{(#4,RANGEKEYSET,@3,coconut)})
    48  PointKey: c#72057594037927935,21
    49  Span: c-d:{(#4,RANGEKEYSET,@3,coconut)}
    50  -
    51  PointKey: carrot#13,1
    52  Span: c-d:{(#4,RANGEKEYSET,@3,coconut)}
    53  -
    54  PointKey: cauliflower#9,0
    55  Span: c-d:{(#4,RANGEKEYSET,@3,coconut)}
    56  -
    57  -- SpanChanged(e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)})
    58  PointKey: e#72057594037927935,21
    59  Span: e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
    60  -
    61  -- SpanChanged(h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)})
    62  PointKey: h#72057594037927935,19
    63  Span: h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)}
    64  -
    65  -- SpanChanged(l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)})
    66  PointKey: l#72057594037927935,20
    67  Span: l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
    68  -
    69  -- SpanChanged(nil)
    70  PointKey: parsnip#3,1
    71  Span: <invalid>
    72  -
    73  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
    74  PointKey: q#72057594037927935,21
    75  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
    76  -
    77  PointKey: tomato#2,1
    78  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
    79  -
    80  
    81  # Test set-bounds passes through to the underlying point iterator and truncates
    82  # a range key's end.
    83  
    84  iter
    85  set-bounds b carrot
    86  seek-ge b
    87  next
    88  next
    89  ----
    90  -- SpanChanged(nil)
    91  -- SpanChanged(b-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
    92  PointKey: b#72057594037927935,21
    93  Span: b-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
    94  -
    95  -- SpanChanged(c-carrot:{(#4,RANGEKEYSET,@3,coconut)})
    96  PointKey: c#72057594037927935,21
    97  Span: c-carrot:{(#4,RANGEKEYSET,@3,coconut)}
    98  -
    99  -- SpanChanged(nil)
   100  .
   101  
   102  
   103  # Test set-bounds passes through to the underlying point iterator and truncates
   104  # a range key's start.
   105  
   106  iter
   107  set-bounds b carrot
   108  seek-lt carrot
   109  prev
   110  prev
   111  ----
   112  -- SpanChanged(nil)
   113  -- SpanChanged(c-carrot:{(#4,RANGEKEYSET,@3,coconut)})
   114  PointKey: c#72057594037927935,21
   115  Span: c-carrot:{(#4,RANGEKEYSET,@3,coconut)}
   116  -
   117  -- SpanChanged(b-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
   118  PointKey: b#72057594037927935,21
   119  Span: b-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   120  -
   121  -- SpanChanged(nil)
   122  .
   123  
   124  # Test seek-ge.
   125  # NB: The `seek-ge yyy` case demonstrates truncation to the search key.
   126  
   127  iter
   128  first
   129  seek-ge a
   130  seek-ge p
   131  seek-ge yyy
   132  seek-ge z
   133  ----
   134  -- SpanChanged(nil)
   135  -- SpanChanged(a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
   136  PointKey: a#72057594037927935,21
   137  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   138  -
   139  -- SpanChanged(nil)
   140  -- SpanChanged(a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
   141  PointKey: a#72057594037927935,21
   142  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   143  -
   144  -- SpanChanged(nil)
   145  -- SpanChanged(nil)
   146  PointKey: parsnip#3,1
   147  Span: <invalid>
   148  -
   149  -- SpanChanged(nil)
   150  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   151  PointKey: yyy#72057594037927935,21
   152  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   153  -
   154  -- SpanChanged(nil)
   155  -- SpanChanged(nil)
   156  PointKey: zucchini#12,2
   157  Span: <invalid>
   158  -
   159  
   160  iter
   161  last
   162  prev
   163  prev
   164  prev
   165  prev
   166  next
   167  next
   168  next
   169  next
   170  ----
   171  -- SpanChanged(nil)
   172  -- SpanChanged(nil)
   173  PointKey: zucchini#12,2
   174  Span: <invalid>
   175  -
   176  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   177  PointKey: tomato#2,1
   178  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   179  -
   180  PointKey: q#72057594037927935,21
   181  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   182  -
   183  -- SpanChanged(nil)
   184  PointKey: parsnip#3,1
   185  Span: <invalid>
   186  -
   187  -- SpanChanged(l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)})
   188  PointKey: l#72057594037927935,20
   189  Span: l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
   190  -
   191  -- SpanChanged(nil)
   192  -- SpanChanged(nil)
   193  PointKey: parsnip#3,1
   194  Span: <invalid>
   195  -
   196  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   197  PointKey: q#72057594037927935,21
   198  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   199  -
   200  PointKey: tomato#2,1
   201  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   202  -
   203  -- SpanChanged(nil)
   204  PointKey: zucchini#12,2
   205  Span: <invalid>
   206  -
   207  
   208  iter
   209  seek-ge tomato
   210  next
   211  seek-ge q
   212  seek-ge parsnip
   213  next
   214  ----
   215  -- SpanChanged(nil)
   216  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   217  PointKey: tomato#72057594037927935,21
   218  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   219  -
   220  PointKey: tomato#2,1
   221  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   222  -
   223  -- SpanChanged(nil)
   224  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   225  PointKey: q#72057594037927935,21
   226  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   227  -
   228  -- SpanChanged(nil)
   229  -- SpanChanged(nil)
   230  PointKey: parsnip#3,1
   231  Span: <invalid>
   232  -
   233  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   234  PointKey: q#72057594037927935,21
   235  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   236  -
   237  
   238  iter
   239  seek-lt tomato
   240  prev
   241  seek-lt a
   242  seek-lt tomato
   243  seek-lt tomago
   244  ----
   245  -- SpanChanged(nil)
   246  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   247  PointKey: q#72057594037927935,21
   248  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   249  -
   250  -- SpanChanged(nil)
   251  PointKey: parsnip#3,1
   252  Span: <invalid>
   253  -
   254  -- SpanChanged(nil)
   255  -- SpanChanged(nil)
   256  .
   257  -- SpanChanged(nil)
   258  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   259  PointKey: q#72057594037927935,21
   260  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   261  -
   262  -- SpanChanged(nil)
   263  -- SpanChanged(q-z:{(#14,RANGEKEYSET,@9,mangos)})
   264  PointKey: q#72057594037927935,21
   265  Span: q-z:{(#14,RANGEKEYSET,@9,mangos)}
   266  -
   267  
   268  define-rangekeys
   269  a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   270  c-d:{(#4,RANGEKEYSET,@3,coconut)}
   271  e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
   272  h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)}
   273  l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
   274  q-z:{(#14,RANGEKEYSET,@9,mangos)}
   275  ----
   276  OK
   277  
   278  define-pointkeys
   279  a.SET.10
   280  a.SET.8
   281  b.SET.13
   282  c.DEL.9
   283  d.SET.3
   284  e.SET.2
   285  ----
   286  OK
   287  
   288  iter
   289  seek-ge a
   290  next
   291  next
   292  next
   293  ----
   294  -- SpanChanged(nil)
   295  -- SpanChanged(a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
   296  PointKey: a#72057594037927935,21
   297  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   298  -
   299  PointKey: a#10,1
   300  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   301  -
   302  PointKey: a#8,1
   303  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   304  -
   305  PointKey: b#13,1
   306  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   307  -
   308  
   309  iter
   310  seek-lt a
   311  ----
   312  -- SpanChanged(nil)
   313  -- SpanChanged(nil)
   314  .
   315  
   316  iter
   317  seek-ge ab
   318  next
   319  next
   320  next
   321  next
   322  next
   323  next
   324  next
   325  ----
   326  -- SpanChanged(nil)
   327  -- SpanChanged(a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)})
   328  PointKey: ab#72057594037927935,21
   329  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   330  -
   331  PointKey: b#13,1
   332  Span: a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@2,oranges)}
   333  -
   334  -- SpanChanged(c-d:{(#4,RANGEKEYSET,@3,coconut)})
   335  PointKey: c#72057594037927935,21
   336  Span: c-d:{(#4,RANGEKEYSET,@3,coconut)}
   337  -
   338  PointKey: c#9,0
   339  Span: c-d:{(#4,RANGEKEYSET,@3,coconut)}
   340  -
   341  -- SpanChanged(nil)
   342  PointKey: d#3,1
   343  Span: <invalid>
   344  -
   345  -- SpanChanged(e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)})
   346  PointKey: e#72057594037927935,21
   347  Span: e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
   348  -
   349  PointKey: e#2,1
   350  Span: e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
   351  -
   352  -- SpanChanged(h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)})
   353  PointKey: h#72057594037927935,19
   354  Span: h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)}
   355  -
   356  
   357  define-rangekeys
   358  a-z:{(#5,RANGEKEYSET,@5,apples)}
   359  ----
   360  OK
   361  
   362  define-pointkeys
   363  a.SET.10
   364  a.SET.8
   365  b.SET.13
   366  c.DEL.9
   367  d.SET.3
   368  e.SET.2
   369  ----
   370  OK
   371  
   372  iter
   373  first
   374  next
   375  next
   376  next
   377  next
   378  next
   379  ----
   380  -- SpanChanged(nil)
   381  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   382  PointKey: a#72057594037927935,21
   383  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   384  -
   385  PointKey: a#10,1
   386  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   387  -
   388  PointKey: a#8,1
   389  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   390  -
   391  PointKey: b#13,1
   392  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   393  -
   394  PointKey: c#9,0
   395  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   396  -
   397  PointKey: d#3,1
   398  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   399  -
   400  
   401  # Switch to reverse within a range key.
   402  # NB: The seek-ge b should truncate the range key a-z to b.
   403  
   404  iter
   405  seek-ge b
   406  prev
   407  ----
   408  -- SpanChanged(nil)
   409  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   410  PointKey: b#72057594037927935,21
   411  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   412  -
   413  -- SpanChanged(nil)
   414  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   415  PointKey: a#8,1
   416  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   417  -
   418  
   419  # Switch to reverse after a seek-ge. Reverse iteration should not revisit the
   420  # interleaved range-key start at the seek-ge bound: The range-key start should
   421  # be interleaved at its true start key.
   422  
   423  iter
   424  seek-ge b
   425  next
   426  prev
   427  prev
   428  prev
   429  ----
   430  -- SpanChanged(nil)
   431  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   432  PointKey: b#72057594037927935,21
   433  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   434  -
   435  PointKey: b#13,1
   436  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   437  -
   438  -- SpanChanged(nil)
   439  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   440  PointKey: a#8,1
   441  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   442  -
   443  PointKey: a#10,1
   444  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   445  -
   446  PointKey: a#72057594037927935,21
   447  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   448  -
   449  
   450  # Switch to forward iteration after a seek-lt.
   451  
   452  iter
   453  seek-lt c
   454  next
   455  ----
   456  -- SpanChanged(nil)
   457  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   458  PointKey: b#13,1
   459  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   460  -
   461  -- SpanChanged(nil)
   462  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   463  PointKey: c#9,0
   464  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   465  -
   466  
   467  iter
   468  seek-lt c
   469  prev
   470  next
   471  ----
   472  -- SpanChanged(nil)
   473  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   474  PointKey: b#13,1
   475  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   476  -
   477  PointKey: a#8,1
   478  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   479  -
   480  -- SpanChanged(nil)
   481  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@5,apples)})
   482  PointKey: b#13,1
   483  Span: a-z:{(#5,RANGEKEYSET,@5,apples)}
   484  -
   485  
   486  # Test sparse range keys.
   487  
   488  define-rangekeys
   489  ace-bat:{(#5,RANGEKEYSET,@5,v5)}
   490  x-z:{(#6,RANGEKEYSET,@6,v5)}
   491  ----
   492  OK
   493  
   494  define-pointkeys
   495  a.SET.9
   496  b.SET.13
   497  c.DEL.9
   498  d.SET.18
   499  m.SET.4
   500  o.MERGE.3
   501  r.SET.22
   502  y.SET.3
   503  z.SET.3
   504  ----
   505  OK
   506  
   507  iter
   508  first
   509  next
   510  next
   511  prev
   512  next
   513  next
   514  ----
   515  -- SpanChanged(nil)
   516  -- SpanChanged(nil)
   517  PointKey: a#9,1
   518  Span: <invalid>
   519  -
   520  -- SpanChanged(ace-bat:{(#5,RANGEKEYSET,@5,v5)})
   521  PointKey: ace#72057594037927935,21
   522  Span: ace-bat:{(#5,RANGEKEYSET,@5,v5)}
   523  -
   524  PointKey: b#13,1
   525  Span: ace-bat:{(#5,RANGEKEYSET,@5,v5)}
   526  -
   527  -- SpanChanged(nil)
   528  -- SpanChanged(ace-bat:{(#5,RANGEKEYSET,@5,v5)})
   529  PointKey: ace#72057594037927935,21
   530  Span: ace-bat:{(#5,RANGEKEYSET,@5,v5)}
   531  -
   532  -- SpanChanged(nil)
   533  -- SpanChanged(ace-bat:{(#5,RANGEKEYSET,@5,v5)})
   534  PointKey: b#13,1
   535  Span: ace-bat:{(#5,RANGEKEYSET,@5,v5)}
   536  -
   537  -- SpanChanged(nil)
   538  PointKey: c#9,0
   539  Span: <invalid>
   540  -
   541  
   542  iter
   543  seek-lt ace
   544  seek-lt zoo
   545  ----
   546  -- SpanChanged(nil)
   547  -- SpanChanged(nil)
   548  PointKey: a#9,1
   549  Span: <invalid>
   550  -
   551  -- SpanChanged(nil)
   552  -- SpanChanged(nil)
   553  PointKey: z#3,1
   554  Span: <invalid>
   555  -
   556  
   557  iter
   558  last
   559  prev
   560  next
   561  next
   562  ----
   563  -- SpanChanged(nil)
   564  -- SpanChanged(nil)
   565  PointKey: z#3,1
   566  Span: <invalid>
   567  -
   568  -- SpanChanged(x-z:{(#6,RANGEKEYSET,@6,v5)})
   569  PointKey: y#3,1
   570  Span: x-z:{(#6,RANGEKEYSET,@6,v5)}
   571  -
   572  -- SpanChanged(nil)
   573  -- SpanChanged(nil)
   574  PointKey: z#3,1
   575  Span: <invalid>
   576  -
   577  -- SpanChanged(nil)
   578  .
   579  
   580  iter
   581  seek-lt m
   582  next
   583  seek-ge m
   584  prev
   585  ----
   586  -- SpanChanged(nil)
   587  -- SpanChanged(nil)
   588  PointKey: d#18,1
   589  Span: <invalid>
   590  -
   591  -- SpanChanged(nil)
   592  -- SpanChanged(nil)
   593  PointKey: m#4,1
   594  Span: <invalid>
   595  -
   596  -- SpanChanged(nil)
   597  -- SpanChanged(nil)
   598  PointKey: m#4,1
   599  Span: <invalid>
   600  -
   601  -- SpanChanged(nil)
   602  -- SpanChanged(nil)
   603  PointKey: d#18,1
   604  Span: <invalid>
   605  -
   606  
   607  # First, Last, SeekLT and SeekGE elide spans without Sets.
   608  
   609  define-rangekeys
   610  b-d:{(#5,RANGEKEYDEL)}
   611  f-g:{(#6,RANGEKEYDEL)}
   612  ----
   613  OK
   614  
   615  define-pointkeys
   616  c.SET.8
   617  ----
   618  OK
   619  
   620  iter
   621  first
   622  last
   623  seek-ge a
   624  seek-lt d
   625  ----
   626  -- SpanChanged(nil)
   627  -- SpanChanged(b-d:{(#5,RANGEKEYDEL)})
   628  PointKey: b#72057594037927935,19
   629  Span: b-d:{(#5,RANGEKEYDEL)}
   630  -
   631  -- SpanChanged(nil)
   632  -- SpanChanged(f-g:{(#6,RANGEKEYDEL)})
   633  PointKey: f#72057594037927935,19
   634  Span: f-g:{(#6,RANGEKEYDEL)}
   635  -
   636  -- SpanChanged(nil)
   637  -- SpanChanged(b-d:{(#5,RANGEKEYDEL)})
   638  PointKey: b#72057594037927935,19
   639  Span: b-d:{(#5,RANGEKEYDEL)}
   640  -
   641  -- SpanChanged(nil)
   642  -- SpanChanged(b-d:{(#5,RANGEKEYDEL)})
   643  PointKey: c#8,1
   644  Span: b-d:{(#5,RANGEKEYDEL)}
   645  -
   646  
   647  # Test a scenario where Next is out of point keys, the current range key has
   648  # already been interleaved, and there are no more range keys.
   649  
   650  define-rangekeys
   651  w-y:{(#5,RANGEKEYSET,@1,v1)}
   652  y-z:{(#5,RANGEKEYDEL)}
   653  ----
   654  OK
   655  
   656  define-pointkeys
   657  x.SET.8
   658  ----
   659  OK
   660  
   661  iter
   662  first
   663  next
   664  next
   665  ----
   666  -- SpanChanged(nil)
   667  -- SpanChanged(w-y:{(#5,RANGEKEYSET,@1,v1)})
   668  PointKey: w#72057594037927935,21
   669  Span: w-y:{(#5,RANGEKEYSET,@1,v1)}
   670  -
   671  PointKey: x#8,1
   672  Span: w-y:{(#5,RANGEKEYSET,@1,v1)}
   673  -
   674  -- SpanChanged(y-z:{(#5,RANGEKEYDEL)})
   675  PointKey: y#72057594037927935,19
   676  Span: y-z:{(#5,RANGEKEYDEL)}
   677  -
   678  
   679  # Test a scenario where we change direction on a synthetic range key boundary
   680  # key.
   681  iter
   682  first
   683  prev
   684  ----
   685  -- SpanChanged(nil)
   686  -- SpanChanged(w-y:{(#5,RANGEKEYSET,@1,v1)})
   687  PointKey: w#72057594037927935,21
   688  Span: w-y:{(#5,RANGEKEYSET,@1,v1)}
   689  -
   690  -- SpanChanged(nil)
   691  -- SpanChanged(nil)
   692  .
   693  
   694  define-rangekeys
   695  a-z:{(#5,RANGEKEYSET,@1,v1)}
   696  ----
   697  OK
   698  
   699  define-pointkeys
   700  z.SET.8
   701  ----
   702  OK
   703  
   704  iter
   705  seek-ge c
   706  prev
   707  next
   708  ----
   709  -- SpanChanged(nil)
   710  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@1,v1)})
   711  PointKey: c#72057594037927935,21
   712  Span: a-z:{(#5,RANGEKEYSET,@1,v1)}
   713  -
   714  -- SpanChanged(nil)
   715  -- SpanChanged(a-z:{(#5,RANGEKEYSET,@1,v1)})
   716  PointKey: a#72057594037927935,21
   717  Span: a-z:{(#5,RANGEKEYSET,@1,v1)}
   718  -
   719  -- SpanChanged(nil)
   720  -- SpanChanged(nil)
   721  PointKey: z#8,1
   722  Span: <invalid>
   723  -
   724  
   725  iter
   726  set-bounds . c
   727  first
   728  set-bounds c .
   729  last
   730  prev
   731  prev
   732  ----
   733  -- SpanChanged(nil)
   734  -- SpanChanged(a-c:{(#5,RANGEKEYSET,@1,v1)})
   735  PointKey: a#72057594037927935,21
   736  Span: a-c:{(#5,RANGEKEYSET,@1,v1)}
   737  -
   738  -- SpanChanged(nil)
   739  -- SpanChanged(nil)
   740  PointKey: z#8,1
   741  Span: <invalid>
   742  -
   743  -- SpanChanged(c-z:{(#5,RANGEKEYSET,@1,v1)})
   744  PointKey: c#72057594037927935,21
   745  Span: c-z:{(#5,RANGEKEYSET,@1,v1)}
   746  -
   747  -- SpanChanged(nil)
   748  .
   749  
   750  # Test switching directions after exhausting a range key iterator.
   751  # Switching reverse to forward iteration.
   752  
   753  define-rangekeys
   754  j-l:{(#3,RANGEKEYSET,@1,v0)}
   755  ----
   756  OK
   757  
   758  define-pointkeys
   759  g.SET.1
   760  s.SET.1
   761  v.SET.2
   762  v.SET.1
   763  z.SET.1
   764  ----
   765  OK
   766  
   767  iter
   768  last
   769  prev
   770  prev
   771  prev
   772  prev
   773  prev
   774  next
   775  ----
   776  -- SpanChanged(nil)
   777  -- SpanChanged(nil)
   778  PointKey: z#1,1
   779  Span: <invalid>
   780  -
   781  -- SpanChanged(nil)
   782  PointKey: v#1,1
   783  Span: <invalid>
   784  -
   785  -- SpanChanged(nil)
   786  PointKey: v#2,1
   787  Span: <invalid>
   788  -
   789  -- SpanChanged(nil)
   790  PointKey: s#1,1
   791  Span: <invalid>
   792  -
   793  -- SpanChanged(j-l:{(#3,RANGEKEYSET,@1,v0)})
   794  PointKey: j#72057594037927935,21
   795  Span: j-l:{(#3,RANGEKEYSET,@1,v0)}
   796  -
   797  -- SpanChanged(nil)
   798  PointKey: g#1,1
   799  Span: <invalid>
   800  -
   801  -- SpanChanged(nil)
   802  -- SpanChanged(j-l:{(#3,RANGEKEYSET,@1,v0)})
   803  PointKey: j#72057594037927935,21
   804  Span: j-l:{(#3,RANGEKEYSET,@1,v0)}
   805  -
   806  
   807  # Test switching directions after exhausting a range key iterator.
   808  # Switching forward to reverse iteration.
   809  
   810  define-rangekeys
   811  j-l:{(#3,RANGEKEYSET,@1,v0)}
   812  ----
   813  OK
   814  
   815  define-pointkeys
   816  a.SET.1
   817  k.SET.1
   818  m.SET.1
   819  ----
   820  OK
   821  
   822  iter
   823  first
   824  next
   825  next
   826  next
   827  prev
   828  ----
   829  -- SpanChanged(nil)
   830  -- SpanChanged(nil)
   831  PointKey: a#1,1
   832  Span: <invalid>
   833  -
   834  -- SpanChanged(j-l:{(#3,RANGEKEYSET,@1,v0)})
   835  PointKey: j#72057594037927935,21
   836  Span: j-l:{(#3,RANGEKEYSET,@1,v0)}
   837  -
   838  PointKey: k#1,1
   839  Span: j-l:{(#3,RANGEKEYSET,@1,v0)}
   840  -
   841  -- SpanChanged(nil)
   842  PointKey: m#1,1
   843  Span: <invalid>
   844  -
   845  -- SpanChanged(nil)
   846  -- SpanChanged(j-l:{(#3,RANGEKEYSET,@1,v0)})
   847  PointKey: k#1,1
   848  Span: j-l:{(#3,RANGEKEYSET,@1,v0)}
   849  -
   850  
   851  # Test a seek that moves the lower bound beyond the upper bound.
   852  
   853  define-rangekeys
   854  a-d:{(#10,RANGEKEYSET,@5,apples)}
   855  ----
   856  OK
   857  
   858  define-pointkeys
   859  b.SET.8
   860  ----
   861  OK
   862  
   863  
   864  iter
   865  set-bounds a c
   866  seek-ge c
   867  ----
   868  -- SpanChanged(nil)
   869  -- SpanChanged(nil)
   870  .
   871  
   872  iter
   873  set-bounds a c
   874  seek-lt a
   875  ----
   876  -- SpanChanged(nil)
   877  -- SpanChanged(nil)
   878  .
   879  
   880  # Test a SeekLT that searches a keyspace exclusive with the iterator's bounds.
   881  # Previously, there was a bug that would incorrectly surface the span with the
   882  # iterator's bounds, despite the fact the SeekLT search key is exclusive. See
   883  # the comment in keyspanSeekLT.
   884  
   885  define-rangekeys
   886  b-f:{(#1,RANGEKEYSET,@1,foo)}
   887  ----
   888  OK
   889  
   890  define-pointkeys
   891  f.SET.3
   892  ----
   893  OK
   894  
   895  iter
   896  set-bounds d e
   897  seek-lt d
   898  ----
   899  -- SpanChanged(nil)
   900  -- SpanChanged(nil)
   901  .
   902  
   903  # Test seek-prefix-ge and its truncation of bounds to the prefix's bounds.
   904  
   905  define-rangekeys
   906  b-d:{(#5,RANGEKEYSET,@1,foo)}
   907  f-g:{(#6,RANGEKEYSET,@1,foo)}
   908  ----
   909  OK
   910  
   911  define-pointkeys
   912  c.SET.8
   913  ----
   914  OK
   915  
   916  iter
   917  seek-prefix-ge b
   918  next
   919  seek-prefix-ge c
   920  next
   921  seek-ge c
   922  ----
   923  -- SpanChanged(nil)
   924  -- SpanChanged(b-b\x00:{(#5,RANGEKEYSET,@1,foo)})
   925  PointKey: b#72057594037927935,21
   926  Span: b-b\x00:{(#5,RANGEKEYSET,@1,foo)}
   927  -
   928  PointKey: c#8,1
   929  Span: b-b\x00:{(#5,RANGEKEYSET,@1,foo)}
   930  -
   931  -- SpanChanged(nil)
   932  -- SpanChanged(c-c\x00:{(#5,RANGEKEYSET,@1,foo)})
   933  PointKey: c#72057594037927935,21
   934  Span: c-c\x00:{(#5,RANGEKEYSET,@1,foo)}
   935  -
   936  PointKey: c#8,1
   937  Span: c-c\x00:{(#5,RANGEKEYSET,@1,foo)}
   938  -
   939  -- SpanChanged(nil)
   940  -- SpanChanged(b-d:{(#5,RANGEKEYSET,@1,foo)})
   941  PointKey: c#72057594037927935,21
   942  Span: b-d:{(#5,RANGEKEYSET,@1,foo)}
   943  -
   944  
   945  # Test NextPrefix
   946  
   947  define-rangekeys
   948  b-e:{(#5,RANGEKEYSET,@9,foo)}
   949  f-g:{(#6,RANGEKEYSET,@9,foo)}
   950  ----
   951  OK
   952  
   953  define-pointkeys
   954  a@4.SET.8
   955  c@11.SET.8
   956  c@3.SET.8
   957  c@1.SET.4
   958  d@5.SET.3
   959  e@9.SET.2
   960  ----
   961  OK
   962  
   963  iter
   964  first
   965  next-prefix
   966  next-prefix
   967  next-prefix
   968  next-prefix
   969  next-prefix
   970  next-prefix
   971  next-prefix
   972  ----
   973  -- SpanChanged(nil)
   974  -- SpanChanged(nil)
   975  PointKey: a@4#8,1
   976  Span: <invalid>
   977  -
   978  -- SpanChanged(b-e:{(#5,RANGEKEYSET,@9,foo)})
   979  PointKey: b#72057594037927935,21
   980  Span: b-e:{(#5,RANGEKEYSET,@9,foo)}
   981  -
   982  PointKey: c@11#8,1
   983  Span: b-e:{(#5,RANGEKEYSET,@9,foo)}
   984  -
   985  PointKey: d@5#3,1
   986  Span: b-e:{(#5,RANGEKEYSET,@9,foo)}
   987  -
   988  -- SpanChanged(nil)
   989  PointKey: e@9#2,1
   990  Span: <invalid>
   991  -
   992  -- SpanChanged(f-g:{(#6,RANGEKEYSET,@9,foo)})
   993  PointKey: f#72057594037927935,21
   994  Span: f-g:{(#6,RANGEKEYSET,@9,foo)}
   995  -
   996  -- SpanChanged(nil)
   997  .
   998  .