github.com/cockroachdb/pebble@v1.1.2/testdata/iter_histories/clone (about)

     1  # Test iterator bounds provided via IterOptions.
     2  
     3  reset
     4  ----
     5  
     6  batch commit
     7  set a a
     8  set b b
     9  set c c
    10  set d d
    11  set f f
    12  range-key-set a   ap  @6 foo
    13  range-key-set ap  c   @5 bar
    14  range-key-set cat zoo @3 bax
    15  ----
    16  committed 8 keys
    17  
    18  # Ensure bounds provided at initialization are respected, and propagated to
    19  # cloned iterators.
    20  
    21  combined-iter lower=b upper=e
    22  first
    23  next
    24  next
    25  next
    26  next
    27  clone
    28  first
    29  next
    30  next
    31  next
    32  next
    33  ----
    34  b: (b, [b-c) @5=bar UPDATED)
    35  c: (c, . UPDATED)
    36  cat: (., [cat-e) @3=bax UPDATED)
    37  d: (d, [cat-e) @3=bax)
    38  .
    39  .
    40  b: (b, [b-c) @5=bar UPDATED)
    41  c: (c, . UPDATED)
    42  cat: (., [cat-e) @3=bax UPDATED)
    43  d: (d, [cat-e) @3=bax)
    44  .
    45  
    46  # Ensure bounds provided during clone are propagated to cloned iterators.
    47  
    48  combined-iter lower=b upper=e
    49  first
    50  next
    51  next
    52  next
    53  next
    54  clone lower=a upper=cat key-types=both
    55  first
    56  next
    57  next
    58  next
    59  clone lower=a upper=cat key-types=point
    60  first
    61  next
    62  next
    63  next
    64  ----
    65  b: (b, [b-c) @5=bar UPDATED)
    66  c: (c, . UPDATED)
    67  cat: (., [cat-e) @3=bax UPDATED)
    68  d: (d, [cat-e) @3=bax)
    69  .
    70  .
    71  a: (a, [a-ap) @6=foo UPDATED)
    72  ap: (., [ap-c) @5=bar UPDATED)
    73  b: (b, [ap-c) @5=bar)
    74  c: (c, . UPDATED)
    75  .
    76  a: (a, .)
    77  b: (b, .)
    78  c: (c, .)
    79  .
    80  
    81  # Test cloning an iterator that reads through an indexed batch.
    82  
    83  batch name=batchfoo
    84  del b
    85  set c c2
    86  range-key-unset b c @5
    87  ----
    88  wrote 3 keys to batch "batchfoo"
    89  
    90  combined-iter reader=batchfoo name=itera
    91  seek-ge b
    92  seek-ge c
    93  ----
    94  c: (c2, .)
    95  c: (c2, .)
    96  
    97  combined-iter
    98  seek-ge b
    99  seek-ge c
   100  ----
   101  b: (b, [ap-c) @5=bar UPDATED)
   102  c: (c, . UPDATED)
   103  
   104  clone from=itera to=iterb refresh-batch=false
   105  ----
   106  
   107  iter iter=iterb
   108  seek-ge b
   109  seek-ge c
   110  ----
   111  c: (c2, .)
   112  c: (c2, .)
   113  
   114  mutate batch=batchfoo
   115  set c c3
   116  range-key-set b c @9 final
   117  ----
   118  
   119  iter iter=itera
   120  seek-ge b
   121  seek-ge c
   122  ----
   123  c: (c2, .)
   124  c: (c2, .)
   125  
   126  iter iter=iterb
   127  seek-ge b
   128  seek-ge c
   129  ----
   130  c: (c2, .)
   131  c: (c2, .)
   132  
   133  clone from=iterb to=iterc refresh-batch=false
   134  ----
   135  
   136  iter iter=iterc
   137  seek-ge b
   138  seek-ge c
   139  ----
   140  c: (c2, .)
   141  c: (c2, .)
   142  
   143  clone from=iterb to=iterd refresh-batch=true
   144  ----
   145  
   146  iter iter=iterd
   147  seek-ge b
   148  seek-ge c
   149  ----
   150  b: (., [b-c) @9=final UPDATED)
   151  c: (c3, . UPDATED)