github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/internal/keyspan/testdata/merging_iter (about)

     1  # Test a single level.
     2  
     3  define
     4  a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)}
     5  c-d:{(#4,RANGEKEYSET,@3,coconut)}
     6  e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
     7  h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)}
     8  l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
     9  q-z:{(#14,RANGEKEYSET,@9,mangos)}
    10  ----
    11  1 levels
    12  
    13  iter
    14  first
    15  next
    16  next
    17  next
    18  next
    19  next
    20  next
    21  ----
    22  a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)}
    23  c-d:{(#4,RANGEKEYSET,@3,coconut)}
    24  e-f:{(#20,RANGEKEYSET,@5,pineapple) (#20,RANGEKEYSET,@3,guava)}
    25  h-j:{(#22,RANGEKEYDEL) (#21,RANGEKEYSET,@5,peaches) (#21,RANGEKEYSET,@3,starfruit)}
    26  l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
    27  q-z:{(#14,RANGEKEYSET,@9,mangos)}
    28  <nil>
    29  
    30  # Test snapshot filtering.
    31  
    32  iter snapshot=12
    33  first
    34  next
    35  next
    36  next
    37  next
    38  next
    39  next
    40  ----
    41  a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)}
    42  c-d:{(#4,RANGEKEYSET,@3,coconut)}
    43  e-f:{}
    44  h-j:{}
    45  l-m:{(#2,RANGEKEYUNSET,@9) (#2,RANGEKEYUNSET,@5)}
    46  q-z:{}
    47  <nil>
    48  
    49  # Test error handling on seeks.
    50  
    51  iter probes=(0,ErrInjected,(Log "#  inner."))
    52  first
    53  last
    54  seek-ge boo
    55  seek-lt lemon
    56  ----
    57  #  inner.First() = nil <err="injected error">
    58  <nil> err=<injected error>
    59  #  inner.Last() = nil <err="injected error">
    60  <nil> err=<injected error>
    61  #  inner.SeekLT("boo") = nil <err="injected error">
    62  <nil> err=<injected error>
    63  #  inner.SeekGE("lemon") = nil <err="injected error">
    64  <nil> err=<injected error>
    65  
    66  # Test error handling on steps.
    67  
    68  iter probes=(0,(If (Or OpNext OpPrev) ErrInjected noop),(Log "#  inner."))
    69  first
    70  next
    71  last
    72  prev
    73  ----
    74  #  inner.First() = a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)}
    75  a-c:{(#10,RANGEKEYSET,@5,apples) (#10,RANGEKEYDEL) (#8,RANGEKEYUNSET,@1) (#4,RANGEKEYSET,@3,bananas)}
    76  #  inner.Next() = nil <err="injected error">
    77  <nil> err=<injected error>
    78  #  inner.Last() = q-z:{(#14,RANGEKEYSET,@9,mangos)}
    79  q-z:{(#14,RANGEKEYSET,@9,mangos)}
    80  #  inner.Prev() = nil <err="injected error">
    81  <nil> err=<injected error>
    82  
    83  define
    84  b-d:{#10,RANGEKEYSET,@1,apples}
    85  e-h:{#8,RANGEKEYDEL}
    86  --
    87  a-c:{#3,RANGEKEYUNSET,@1}
    88  h-k:{#5,RANGEKEYDEL}
    89  ----
    90  2 levels
    91  
    92  iter
    93  first
    94  next
    95  next
    96  next
    97  next
    98  next
    99  ----
   100  a-b:{(#3,RANGEKEYUNSET,@1)}
   101  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   102  c-d:{(#10,RANGEKEYSET,@1,apples)}
   103  e-h:{(#8,RANGEKEYDEL)}
   104  h-k:{(#5,RANGEKEYDEL)}
   105  <nil>
   106  
   107  iter
   108  last
   109  prev
   110  prev
   111  prev
   112  prev
   113  prev
   114  ----
   115  h-k:{(#5,RANGEKEYDEL)}
   116  e-h:{(#8,RANGEKEYDEL)}
   117  c-d:{(#10,RANGEKEYSET,@1,apples)}
   118  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   119  a-b:{(#3,RANGEKEYUNSET,@1)}
   120  <nil>
   121  
   122  # Test changing directions at each iterator position, reverse to forward.
   123  iter
   124  last
   125  next
   126  last
   127  prev
   128  next
   129  ----
   130  h-k:{(#5,RANGEKEYDEL)}
   131  <nil>
   132  h-k:{(#5,RANGEKEYDEL)}
   133  e-h:{(#8,RANGEKEYDEL)}
   134  h-k:{(#5,RANGEKEYDEL)}
   135  
   136  iter
   137  last
   138  prev
   139  prev
   140  next
   141  ----
   142  h-k:{(#5,RANGEKEYDEL)}
   143  e-h:{(#8,RANGEKEYDEL)}
   144  c-d:{(#10,RANGEKEYSET,@1,apples)}
   145  e-h:{(#8,RANGEKEYDEL)}
   146  
   147  iter
   148  last
   149  prev
   150  prev
   151  prev
   152  next
   153  ----
   154  h-k:{(#5,RANGEKEYDEL)}
   155  e-h:{(#8,RANGEKEYDEL)}
   156  c-d:{(#10,RANGEKEYSET,@1,apples)}
   157  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   158  c-d:{(#10,RANGEKEYSET,@1,apples)}
   159  
   160  iter
   161  last
   162  prev
   163  prev
   164  prev
   165  prev
   166  next
   167  ----
   168  h-k:{(#5,RANGEKEYDEL)}
   169  e-h:{(#8,RANGEKEYDEL)}
   170  c-d:{(#10,RANGEKEYSET,@1,apples)}
   171  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   172  a-b:{(#3,RANGEKEYUNSET,@1)}
   173  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   174  
   175  iter
   176  last
   177  prev
   178  prev
   179  prev
   180  prev
   181  prev
   182  next
   183  ----
   184  h-k:{(#5,RANGEKEYDEL)}
   185  e-h:{(#8,RANGEKEYDEL)}
   186  c-d:{(#10,RANGEKEYSET,@1,apples)}
   187  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   188  a-b:{(#3,RANGEKEYUNSET,@1)}
   189  <nil>
   190  a-b:{(#3,RANGEKEYUNSET,@1)}
   191  
   192  # Test changing directions at each iterator position, forward to reverse.
   193  
   194  iter
   195  first
   196  prev
   197  first
   198  next
   199  prev
   200  ----
   201  a-b:{(#3,RANGEKEYUNSET,@1)}
   202  <nil>
   203  a-b:{(#3,RANGEKEYUNSET,@1)}
   204  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   205  a-b:{(#3,RANGEKEYUNSET,@1)}
   206  
   207  iter
   208  first
   209  next
   210  next
   211  prev
   212  ----
   213  a-b:{(#3,RANGEKEYUNSET,@1)}
   214  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   215  c-d:{(#10,RANGEKEYSET,@1,apples)}
   216  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   217  
   218  iter
   219  first
   220  next
   221  next
   222  next
   223  prev
   224  ----
   225  a-b:{(#3,RANGEKEYUNSET,@1)}
   226  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   227  c-d:{(#10,RANGEKEYSET,@1,apples)}
   228  e-h:{(#8,RANGEKEYDEL)}
   229  c-d:{(#10,RANGEKEYSET,@1,apples)}
   230  
   231  iter
   232  first
   233  next
   234  next
   235  next
   236  next
   237  next
   238  prev
   239  ----
   240  a-b:{(#3,RANGEKEYUNSET,@1)}
   241  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   242  c-d:{(#10,RANGEKEYSET,@1,apples)}
   243  e-h:{(#8,RANGEKEYDEL)}
   244  h-k:{(#5,RANGEKEYDEL)}
   245  <nil>
   246  h-k:{(#5,RANGEKEYDEL)}
   247  
   248  iter
   249  first
   250  next
   251  next
   252  next
   253  next
   254  prev
   255  ----
   256  a-b:{(#3,RANGEKEYUNSET,@1)}
   257  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   258  c-d:{(#10,RANGEKEYSET,@1,apples)}
   259  e-h:{(#8,RANGEKEYDEL)}
   260  h-k:{(#5,RANGEKEYDEL)}
   261  e-h:{(#8,RANGEKEYDEL)}
   262  
   263  # Test SeekGE. Note that MergingIter's SeekGE implements the FragmentIterator's
   264  # SeekGE semantics. It returns the first fragment that covers a key ≥ the search
   265  # key.
   266  
   267  iter
   268  seek-ge cc
   269  ----
   270  c-d:{(#10,RANGEKEYSET,@1,apples)}
   271  
   272  iter
   273  seek-ge 1
   274  seek-ge a
   275  seek-ge b
   276  seek-ge bb
   277  ----
   278  a-b:{(#3,RANGEKEYUNSET,@1)}
   279  a-b:{(#3,RANGEKEYUNSET,@1)}
   280  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   281  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   282  
   283  iter
   284  seek-ge c
   285  seek-ge cc
   286  seek-ge e
   287  seek-ge f
   288  ----
   289  c-d:{(#10,RANGEKEYSET,@1,apples)}
   290  c-d:{(#10,RANGEKEYSET,@1,apples)}
   291  e-h:{(#8,RANGEKEYDEL)}
   292  e-h:{(#8,RANGEKEYDEL)}
   293  
   294  iter
   295  seek-ge h
   296  seek-ge i
   297  seek-ge k
   298  seek-ge l
   299  ----
   300  h-k:{(#5,RANGEKEYDEL)}
   301  h-k:{(#5,RANGEKEYDEL)}
   302  <nil>
   303  <nil>
   304  
   305  # Test SeekLT. Note that MergingIter's SeekLT implements the FragmentIterator's
   306  # SeekLT semantics. It returns the first fragment with a Start key < the search
   307  # key, NOT the first fragment that covers a key < the search key.
   308  #
   309  # NB: seek-lt bb finds b-c#3.RANGEKEYUNSET (the last fragment with the bounds
   310  # [b,c), unlike the above seek-ge b which finds the first).
   311  
   312  iter
   313  seek-lt b
   314  ----
   315  a-b:{(#3,RANGEKEYUNSET,@1)}
   316  
   317  iter
   318  seek-lt 1
   319  seek-lt a
   320  seek-lt aa
   321  seek-lt b
   322  seek-lt bb
   323  seek-lt c
   324  ----
   325  <nil>
   326  <nil>
   327  a-b:{(#3,RANGEKEYUNSET,@1)}
   328  a-b:{(#3,RANGEKEYUNSET,@1)}
   329  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   330  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   331  
   332  iter
   333  seek-lt cc
   334  seek-lt d
   335  seek-lt dd
   336  seek-lt e
   337  seek-lt ee
   338  seek-lt h
   339  seek-lt hh
   340  seek-lt k
   341  seek-lt z
   342  ----
   343  c-d:{(#10,RANGEKEYSET,@1,apples)}
   344  c-d:{(#10,RANGEKEYSET,@1,apples)}
   345  c-d:{(#10,RANGEKEYSET,@1,apples)}
   346  c-d:{(#10,RANGEKEYSET,@1,apples)}
   347  e-h:{(#8,RANGEKEYDEL)}
   348  e-h:{(#8,RANGEKEYDEL)}
   349  h-k:{(#5,RANGEKEYDEL)}
   350  h-k:{(#5,RANGEKEYDEL)}
   351  h-k:{(#5,RANGEKEYDEL)}
   352  
   353  # Test error handling with multiple levels. Inject errors in all operations on
   354  # the first iterator, and none of the second iterator.
   355  
   356  iter probes=(0,ErrInjected,(Log "#  a.")) probes=(1,(Log "#  b."))
   357  seek-ge a
   358  seek-ge b
   359  seek-ge c
   360  seek-ge d
   361  seek-ge e
   362  seek-ge f
   363  seek-ge g
   364  seek-ge h
   365  seek-ge i
   366  seek-ge j
   367  seek-ge k
   368  seek-ge z
   369  ----
   370  #  a.SeekLT("a") = nil <err="injected error">
   371  #  b.SeekLT("a") = nil
   372  <nil> err=<injected error>
   373  #  a.SeekLT("b") = nil <err="injected error">
   374  #  b.SeekLT("b") = a-c:{(#3,RANGEKEYUNSET,@1)}
   375  <nil> err=<injected error>
   376  #  a.SeekLT("c") = nil <err="injected error">
   377  #  b.SeekLT("c") = a-c:{(#3,RANGEKEYUNSET,@1)}
   378  <nil> err=<injected error>
   379  #  a.SeekLT("d") = nil <err="injected error">
   380  #  b.SeekLT("d") = a-c:{(#3,RANGEKEYUNSET,@1)}
   381  <nil> err=<injected error>
   382  #  a.SeekLT("e") = nil <err="injected error">
   383  #  b.SeekLT("e") = a-c:{(#3,RANGEKEYUNSET,@1)}
   384  <nil> err=<injected error>
   385  #  a.SeekLT("f") = nil <err="injected error">
   386  #  b.SeekLT("f") = a-c:{(#3,RANGEKEYUNSET,@1)}
   387  <nil> err=<injected error>
   388  #  a.SeekLT("g") = nil <err="injected error">
   389  #  b.SeekLT("g") = a-c:{(#3,RANGEKEYUNSET,@1)}
   390  <nil> err=<injected error>
   391  #  a.SeekLT("h") = nil <err="injected error">
   392  #  b.SeekLT("h") = a-c:{(#3,RANGEKEYUNSET,@1)}
   393  <nil> err=<injected error>
   394  #  a.SeekLT("i") = nil <err="injected error">
   395  #  b.SeekLT("i") = h-k:{(#5,RANGEKEYDEL)}
   396  <nil> err=<injected error>
   397  #  a.SeekLT("j") = nil <err="injected error">
   398  #  b.SeekLT("j") = h-k:{(#5,RANGEKEYDEL)}
   399  <nil> err=<injected error>
   400  #  a.SeekLT("k") = nil <err="injected error">
   401  #  b.SeekLT("k") = h-k:{(#5,RANGEKEYDEL)}
   402  <nil> err=<injected error>
   403  #  a.SeekLT("z") = nil <err="injected error">
   404  #  b.SeekLT("z") = h-k:{(#5,RANGEKEYDEL)}
   405  <nil> err=<injected error>
   406  
   407  # Test the same as above, but with errors injected on the second iterator.
   408  
   409  iter probes=(0,(Log "#  a.")) probes=(1,ErrInjected,(Log "#  b."))
   410  seek-ge a
   411  seek-ge b
   412  seek-ge c
   413  seek-ge d
   414  seek-ge e
   415  seek-ge f
   416  seek-ge g
   417  seek-ge h
   418  seek-ge i
   419  seek-ge j
   420  seek-ge k
   421  seek-ge z
   422  ----
   423  #  a.SeekLT("a") = nil
   424  #  b.SeekLT("a") = nil <err="injected error">
   425  <nil> err=<injected error>
   426  #  a.SeekLT("b") = nil
   427  #  b.SeekLT("b") = nil <err="injected error">
   428  <nil> err=<injected error>
   429  #  a.SeekLT("c") = b-d:{(#10,RANGEKEYSET,@1,apples)}
   430  #  b.SeekLT("c") = nil <err="injected error">
   431  <nil> err=<injected error>
   432  #  a.SeekLT("d") = b-d:{(#10,RANGEKEYSET,@1,apples)}
   433  #  b.SeekLT("d") = nil <err="injected error">
   434  <nil> err=<injected error>
   435  #  a.SeekLT("e") = b-d:{(#10,RANGEKEYSET,@1,apples)}
   436  #  b.SeekLT("e") = nil <err="injected error">
   437  <nil> err=<injected error>
   438  #  a.SeekLT("f") = e-h:{(#8,RANGEKEYDEL)}
   439  #  b.SeekLT("f") = nil <err="injected error">
   440  <nil> err=<injected error>
   441  #  a.SeekLT("g") = e-h:{(#8,RANGEKEYDEL)}
   442  #  b.SeekLT("g") = nil <err="injected error">
   443  <nil> err=<injected error>
   444  #  a.SeekLT("h") = e-h:{(#8,RANGEKEYDEL)}
   445  #  b.SeekLT("h") = nil <err="injected error">
   446  <nil> err=<injected error>
   447  #  a.SeekLT("i") = e-h:{(#8,RANGEKEYDEL)}
   448  #  b.SeekLT("i") = nil <err="injected error">
   449  <nil> err=<injected error>
   450  #  a.SeekLT("j") = e-h:{(#8,RANGEKEYDEL)}
   451  #  b.SeekLT("j") = nil <err="injected error">
   452  <nil> err=<injected error>
   453  #  a.SeekLT("k") = e-h:{(#8,RANGEKEYDEL)}
   454  #  b.SeekLT("k") = nil <err="injected error">
   455  <nil> err=<injected error>
   456  #  a.SeekLT("z") = e-h:{(#8,RANGEKEYDEL)}
   457  #  b.SeekLT("z") = nil <err="injected error">
   458  <nil> err=<injected error>
   459  
   460  # Test SeekLTs with errors injected on the first iterator.
   461  
   462  iter probes=(0,ErrInjected,(Log "#  a.")) probes=(1,(Log "#  b."))
   463  seek-lt a
   464  seek-lt b
   465  seek-lt c
   466  seek-lt d
   467  seek-lt e
   468  seek-lt f
   469  seek-lt g
   470  seek-lt h
   471  seek-lt i
   472  seek-lt j
   473  seek-lt k
   474  seek-lt z
   475  ----
   476  #  a.SeekGE("a") = nil <err="injected error">
   477  #  b.SeekGE("a") = a-c:{(#3,RANGEKEYUNSET,@1)}
   478  <nil> err=<injected error>
   479  #  a.SeekGE("b") = nil <err="injected error">
   480  #  b.SeekGE("b") = a-c:{(#3,RANGEKEYUNSET,@1)}
   481  <nil> err=<injected error>
   482  #  a.SeekGE("c") = nil <err="injected error">
   483  #  b.SeekGE("c") = h-k:{(#5,RANGEKEYDEL)}
   484  <nil> err=<injected error>
   485  #  a.SeekGE("d") = nil <err="injected error">
   486  #  b.SeekGE("d") = h-k:{(#5,RANGEKEYDEL)}
   487  <nil> err=<injected error>
   488  #  a.SeekGE("e") = nil <err="injected error">
   489  #  b.SeekGE("e") = h-k:{(#5,RANGEKEYDEL)}
   490  <nil> err=<injected error>
   491  #  a.SeekGE("f") = nil <err="injected error">
   492  #  b.SeekGE("f") = h-k:{(#5,RANGEKEYDEL)}
   493  <nil> err=<injected error>
   494  #  a.SeekGE("g") = nil <err="injected error">
   495  #  b.SeekGE("g") = h-k:{(#5,RANGEKEYDEL)}
   496  <nil> err=<injected error>
   497  #  a.SeekGE("h") = nil <err="injected error">
   498  #  b.SeekGE("h") = h-k:{(#5,RANGEKEYDEL)}
   499  <nil> err=<injected error>
   500  #  a.SeekGE("i") = nil <err="injected error">
   501  #  b.SeekGE("i") = h-k:{(#5,RANGEKEYDEL)}
   502  <nil> err=<injected error>
   503  #  a.SeekGE("j") = nil <err="injected error">
   504  #  b.SeekGE("j") = h-k:{(#5,RANGEKEYDEL)}
   505  <nil> err=<injected error>
   506  #  a.SeekGE("k") = nil <err="injected error">
   507  #  b.SeekGE("k") = nil
   508  <nil> err=<injected error>
   509  #  a.SeekGE("z") = nil <err="injected error">
   510  #  b.SeekGE("z") = nil
   511  <nil> err=<injected error>
   512  
   513  # Test SeekLTs with errors injected on the second iterator.
   514  
   515  iter probes=(0,(Log "#  a.")) probes=(1,ErrInjected,(Log "#  b."))
   516  seek-lt a
   517  seek-lt b
   518  seek-lt c
   519  seek-lt d
   520  seek-lt e
   521  seek-lt f
   522  seek-lt g
   523  seek-lt h
   524  seek-lt i
   525  seek-lt j
   526  seek-lt k
   527  seek-lt z
   528  ----
   529  #  a.SeekGE("a") = b-d:{(#10,RANGEKEYSET,@1,apples)}
   530  #  b.SeekGE("a") = nil <err="injected error">
   531  <nil> err=<injected error>
   532  #  a.SeekGE("b") = b-d:{(#10,RANGEKEYSET,@1,apples)}
   533  #  b.SeekGE("b") = nil <err="injected error">
   534  <nil> err=<injected error>
   535  #  a.SeekGE("c") = b-d:{(#10,RANGEKEYSET,@1,apples)}
   536  #  b.SeekGE("c") = nil <err="injected error">
   537  <nil> err=<injected error>
   538  #  a.SeekGE("d") = e-h:{(#8,RANGEKEYDEL)}
   539  #  b.SeekGE("d") = nil <err="injected error">
   540  <nil> err=<injected error>
   541  #  a.SeekGE("e") = e-h:{(#8,RANGEKEYDEL)}
   542  #  b.SeekGE("e") = nil <err="injected error">
   543  <nil> err=<injected error>
   544  #  a.SeekGE("f") = e-h:{(#8,RANGEKEYDEL)}
   545  #  b.SeekGE("f") = nil <err="injected error">
   546  <nil> err=<injected error>
   547  #  a.SeekGE("g") = e-h:{(#8,RANGEKEYDEL)}
   548  #  b.SeekGE("g") = nil <err="injected error">
   549  <nil> err=<injected error>
   550  #  a.SeekGE("h") = nil
   551  #  b.SeekGE("h") = nil <err="injected error">
   552  <nil> err=<injected error>
   553  #  a.SeekGE("i") = nil
   554  #  b.SeekGE("i") = nil <err="injected error">
   555  <nil> err=<injected error>
   556  #  a.SeekGE("j") = nil
   557  #  b.SeekGE("j") = nil <err="injected error">
   558  <nil> err=<injected error>
   559  #  a.SeekGE("k") = nil
   560  #  b.SeekGE("k") = nil <err="injected error">
   561  <nil> err=<injected error>
   562  #  a.SeekGE("z") = nil
   563  #  b.SeekGE("z") = nil <err="injected error">
   564  <nil> err=<injected error>
   565  
   566  # Test error handling during Next.
   567  
   568  iter probes=(0,(If OpNext ErrInjected noop),(Log "#  a.")) probes=(1,(Log "#  b."))
   569  first
   570  next
   571  next
   572  next
   573  ----
   574  #  a.First() = b-d:{(#10,RANGEKEYSET,@1,apples)}
   575  #  b.First() = a-c:{(#3,RANGEKEYUNSET,@1)}
   576  a-b:{(#3,RANGEKEYUNSET,@1)}
   577  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   578  #  b.Next() = h-k:{(#5,RANGEKEYDEL)}
   579  c-d:{(#10,RANGEKEYSET,@1,apples)}
   580  #  a.Next() = nil <err="injected error">
   581  <nil> err=<injected error>
   582  
   583  iter probes=(0,(Log "#  a.")) probes=(1,(If OpNext ErrInjected noop),(Log "#  b."))
   584  first
   585  next
   586  next
   587  ----
   588  #  a.First() = b-d:{(#10,RANGEKEYSET,@1,apples)}
   589  #  b.First() = a-c:{(#3,RANGEKEYUNSET,@1)}
   590  a-b:{(#3,RANGEKEYUNSET,@1)}
   591  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   592  #  b.Next() = nil <err="injected error">
   593  <nil> err=<injected error>
   594  
   595  # Test error handling during Prev.
   596  
   597  iter probes=(0,(If OpPrev ErrInjected noop),(Log "#  a.")) probes=(1,(Log "#  b."))
   598  last
   599  prev
   600  prev
   601  ----
   602  #  a.Last() = e-h:{(#8,RANGEKEYDEL)}
   603  #  b.Last() = h-k:{(#5,RANGEKEYDEL)}
   604  h-k:{(#5,RANGEKEYDEL)}
   605  #  b.Prev() = a-c:{(#3,RANGEKEYUNSET,@1)}
   606  e-h:{(#8,RANGEKEYDEL)}
   607  #  a.Prev() = nil <err="injected error">
   608  <nil> err=<injected error>
   609  
   610  iter probes=(0,(Log "#  a.")) probes=(1,(If OpPrev ErrInjected noop),(Log "#  b."))
   611  last
   612  prev
   613  ----
   614  #  a.Last() = e-h:{(#8,RANGEKEYDEL)}
   615  #  b.Last() = h-k:{(#5,RANGEKEYDEL)}
   616  h-k:{(#5,RANGEKEYDEL)}
   617  #  b.Prev() = nil <err="injected error">
   618  <nil> err=<injected error>
   619  
   620  define
   621  a-f:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   622  k-s:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   623  ----
   624  1 levels
   625  
   626  iter
   627  first
   628  prev
   629  next
   630  ----
   631  a-f:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   632  <nil>
   633  a-f:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   634  
   635  iter
   636  last
   637  next
   638  prev
   639  ----
   640  k-s:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   641  <nil>
   642  k-s:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   643  
   644  define
   645  w-x:{(#5,RANGEKEYDEL) (#3,RANGEKEYDEL)}
   646  x-z:{(#5,RANGEKEYDEL)}
   647  --
   648  w-y:{(#4,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   649  ----
   650  2 levels
   651  
   652  iter
   653  last
   654  next
   655  prev
   656  first
   657  prev
   658  next
   659  ----
   660  y-z:{(#5,RANGEKEYDEL)}
   661  <nil>
   662  y-z:{(#5,RANGEKEYDEL)}
   663  w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   664  <nil>
   665  w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   666  
   667  iter
   668  seek-ge x
   669  prev
   670  seek-ge xray
   671  prev
   672  ----
   673  x-y:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   674  w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   675  x-y:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   676  w-x:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL) (#3,RANGEKEYDEL) (#1,RANGEKEYDEL)}
   677  
   678  define
   679  il-qb:{(#10,RANGEKEYDEL)}
   680  sn-wn:{(#10,RANGEKEYDEL)}
   681  --
   682  qt-kh:{(#9,RANGEKEYDEL) (#8,RANGEKEYDEL) (#7,RANGEKEYDEL)}
   683  ky-sv:{(#8,RANGEKEYDEL) (#7,RANGEKEYDEL)}
   684  --
   685  as-fz:{(#5,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   686  hh-ir:{(#4,RANGEKEYDEL)}
   687  rf-yx:{(#4,RANGEKEYDEL)}
   688  ----
   689  3 levels
   690  
   691  iter
   692  seek-ge qp
   693  next
   694  next
   695  next
   696  next
   697  next
   698  seek-ge yz
   699  prev
   700  ----
   701  qb-rf:{(#8,RANGEKEYDEL) (#7,RANGEKEYDEL)}
   702  rf-sn:{(#8,RANGEKEYDEL) (#7,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   703  sn-sv:{(#10,RANGEKEYDEL) (#8,RANGEKEYDEL) (#7,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   704  sv-wn:{(#10,RANGEKEYDEL) (#4,RANGEKEYDEL)}
   705  wn-yx:{(#4,RANGEKEYDEL)}
   706  <nil>
   707  <nil>
   708  wn-yx:{(#4,RANGEKEYDEL)}
   709  
   710  # Test that empty spans from child iterators are preserved
   711  define
   712  b-d:{#10,RANGEKEYSET,@1,apples}
   713  e-f:{}
   714  g-h:{#8,RANGEKEYDEL}
   715  --
   716  a-c:{#3,RANGEKEYUNSET,@1}
   717  h-k:{#5,RANGEKEYDEL}
   718  k-m:{}
   719  ----
   720  2 levels
   721  
   722  iter
   723  first
   724  next
   725  next
   726  next
   727  next
   728  next
   729  next
   730  next
   731  ----
   732  a-b:{(#3,RANGEKEYUNSET,@1)}
   733  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   734  c-d:{(#10,RANGEKEYSET,@1,apples)}
   735  e-f:{}
   736  g-h:{(#8,RANGEKEYDEL)}
   737  h-k:{(#5,RANGEKEYDEL)}
   738  k-m:{}
   739  <nil>
   740  
   741  iter
   742  last
   743  prev
   744  prev
   745  prev
   746  prev
   747  prev
   748  prev
   749  prev
   750  ----
   751  k-m:{}
   752  h-k:{(#5,RANGEKEYDEL)}
   753  g-h:{(#8,RANGEKEYDEL)}
   754  e-f:{}
   755  c-d:{(#10,RANGEKEYSET,@1,apples)}
   756  b-c:{(#10,RANGEKEYSET,@1,apples) (#3,RANGEKEYUNSET,@1)}
   757  a-b:{(#3,RANGEKEYUNSET,@1)}
   758  <nil>