github.com/cockroachdb/pebble@v1.1.2/testdata/iter_histories/internal_next (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  internal-next
    15  internal-next
    16  next
    17  next-prefix
    18  internal-next
    19  internal-next
    20  next
    21  internal-next
    22  next
    23  internal-next
    24  ----
    25  a@100: (a@100, .)
    26  b@100: (b@100, .)
    27  .
    28  .
    29  b@10: (b@10, .)
    30  c@100: (c@100, .)
    31  .
    32  .
    33  c@10: (c@10, .)
    34  .
    35  c@1: (c@1, .)
    36  .
    37  
    38  combined-iter
    39  first
    40  next-prefix
    41  can-deterministically-single-delete
    42  can-deterministically-single-delete
    43  next
    44  next-prefix
    45  can-deterministically-single-delete
    46  next
    47  can-deterministically-single-delete
    48  next
    49  can-deterministically-single-delete
    50  ----
    51  a@100: (a@100, .)
    52  b@100: (b@100, .)
    53  true
    54  err: pebble: CanDeterministicallySingleDelete called twice
    55  b@10: (b@10, .)
    56  c@100: (c@100, .)
    57  true
    58  c@10: (c@10, .)
    59  true
    60  c@1: (c@1, .)
    61  true
    62  
    63  # The start boundaries of range keys are interleaved and can cause the internal
    64  # iterator to be advanced ahead to look for a point at the same user key. This
    65  # is one of the few situations in which InternalNext may find the iterator is
    66  # already positioned at iterPosNext. Test this scenario.
    67  
    68  batch commit
    69  range-key-set a b @1 foo
    70  range-key-set bb c @2 bar
    71  ----
    72  committed 2 keys
    73  
    74  combined-iter
    75  first
    76  internal-next
    77  next
    78  internal-next
    79  seek-ge b@10
    80  internal-next
    81  next
    82  internal-next
    83  internal-next
    84  next
    85  ----
    86  a: (., [a-b) @1=foo UPDATED)
    87  .
    88  a@100: (a@100, [a-b) @1=foo)
    89  .
    90  b@10: (b@10, . UPDATED)
    91  .
    92  b@1: (b@1, .)
    93  .
    94  .
    95  bb: (., [bb-c) @2=bar UPDATED)
    96  
    97  combined-iter
    98  first
    99  can-deterministically-single-delete
   100  next
   101  can-deterministically-single-delete
   102  seek-ge b@10
   103  can-deterministically-single-delete
   104  next
   105  can-deterministically-single-delete
   106  next
   107  ----
   108  a: (., [a-b) @1=foo UPDATED)
   109  true
   110  a@100: (a@100, [a-b) @1=foo)
   111  true
   112  b@10: (b@10, . UPDATED)
   113  true
   114  b@1: (b@1, .)
   115  true
   116  bb: (., [bb-c) @2=bar UPDATED)
   117  
   118  
   119  reset
   120  ----
   121  
   122  batch commit
   123  set a a
   124  set b b
   125  range-key-set b c @1 foo
   126  set d d
   127  ----
   128  committed 4 keys
   129  
   130  combined-iter
   131  first
   132  internal-next
   133  next
   134  internal-next
   135  next
   136  prev
   137  internal-next
   138  ----
   139  a: (a, .)
   140  .
   141  b: (b, [b-c) @1=foo UPDATED)
   142  .
   143  d: (d, . UPDATED)
   144  b: (b, [b-c) @1=foo UPDATED)
   145  err: switching from reverse to forward via internalNext is prohibited
   146  
   147  combined-iter
   148  first
   149  can-deterministically-single-delete
   150  next
   151  can-deterministically-single-delete
   152  next
   153  prev
   154  can-deterministically-single-delete
   155  ----
   156  a: (a, .)
   157  true
   158  b: (b, [b-c) @1=foo UPDATED)
   159  true
   160  d: (d, . UPDATED)
   161  b: (b, [b-c) @1=foo UPDATED)
   162  err: switching from reverse to forward via internalNext is prohibited
   163  
   164  # Perform a test where we produce two internal versions (both SETs) for each
   165  # user key. Note that this test disables automatic compactions, so the presence
   166  # of the internal keys will be deterministic.
   167  
   168  reset
   169  ----
   170  
   171  populate keylen=1 timestamps=(1, 10, 100)
   172  ----
   173  wrote 78 keys
   174  
   175  flush
   176  ----
   177  
   178  populate keylen=1 timestamps=(1, 10, 100)
   179  ----
   180  wrote 78 keys
   181  
   182  combined-iter
   183  first
   184  next-prefix
   185  internal-next
   186  internal-next
   187  next
   188  next-prefix
   189  internal-next
   190  internal-next
   191  next
   192  internal-next
   193  next
   194  internal-next
   195  ----
   196  a@100: (a@100, .)
   197  b@100: (b@100, .)
   198  SET
   199  .
   200  b@10: (b@10, .)
   201  c@100: (c@100, .)
   202  SET
   203  .
   204  c@10: (c@10, .)
   205  SET
   206  c@1: (c@1, .)
   207  SET
   208  
   209  combined-iter
   210  seek-ge z
   211  internal-next
   212  next
   213  next
   214  internal-next
   215  internal-next
   216  next
   217  internal-next
   218  ----
   219  z@100: (z@100, .)
   220  SET
   221  z@10: (z@10, .)
   222  z@1: (z@1, .)
   223  SET
   224  .
   225  .
   226  .
   227  
   228  combined-iter
   229  first
   230  next-prefix
   231  can-deterministically-single-delete
   232  next
   233  next-prefix
   234  can-deterministically-single-delete
   235  next
   236  can-deterministically-single-delete
   237  next
   238  can-deterministically-single-delete
   239  ----
   240  a@100: (a@100, .)
   241  b@100: (b@100, .)
   242  false
   243  b@10: (b@10, .)
   244  c@100: (c@100, .)
   245  false
   246  c@10: (c@10, .)
   247  false
   248  c@1: (c@1, .)
   249  false
   250  
   251  # Test that a CanDeterministicallySingleDelete is true if the old SETs are all
   252  # deleted by a range delete.
   253  
   254  batch commit
   255  del-range a zzz
   256  ----
   257  committed 1 keys
   258  
   259  populate keylen=1 timestamps=(1, 10, 100)
   260  ----
   261  wrote 78 keys
   262  
   263  combined-iter
   264  first
   265  next-prefix
   266  can-deterministically-single-delete
   267  next
   268  next-prefix
   269  can-deterministically-single-delete
   270  next
   271  can-deterministically-single-delete
   272  next
   273  can-deterministically-single-delete
   274  ----
   275  a@100: (a@100, .)
   276  b@100: (b@100, .)
   277  true
   278  b@10: (b@10, .)
   279  c@100: (c@100, .)
   280  true
   281  c@10: (c@10, .)
   282  true
   283  c@1: (c@1, .)
   284  true
   285  
   286  # Set fmv=FormatDeleteSizedAndObsolete.
   287  
   288  reset format-major-version=15
   289  ----
   290  
   291  # Test that a SET > SINGLEDEL > SET sequence yields
   292  # CanDeterministicallySingleDelete() = true. This is okay because if the SET
   293  # consumes the SINGLEDEL, it becomes a SETWITHDEL. If a SINGLEDEL consumes a
   294  # SETWITHDEL, it becomes a DEL.
   295  
   296  batch commit
   297  set a a
   298  singledel a
   299  set a a
   300  ----
   301  committed 3 keys
   302  
   303  combined-iter
   304  first
   305  internal-next
   306  internal-next
   307  first
   308  can-deterministically-single-delete
   309  ----
   310  a: (a, .)
   311  SINGLEDEL
   312  SET
   313  a: (a, .)
   314  true
   315  
   316  # Deleting with a DEL[SIZED] should then allow deterministic single delete
   317  # again.
   318  
   319  batch commit
   320  del a
   321  set a a
   322  ----
   323  committed 2 keys
   324  
   325  combined-iter
   326  first
   327  internal-next
   328  internal-next
   329  internal-next
   330  internal-next
   331  internal-next
   332  first
   333  can-deterministically-single-delete
   334  ----
   335  a: (a, .)
   336  DEL
   337  SET
   338  SINGLEDEL
   339  SET
   340  .
   341  a: (a, .)
   342  true
   343  
   344  # The above case tested DEL. Explicitly test DELSIZED by setting the key again,
   345  # then writing a DELSIZED, then another key.
   346  
   347  batch commit
   348  del-sized a 1
   349  set a a
   350  ----
   351  committed 2 keys
   352  
   353  combined-iter
   354  first
   355  internal-next
   356  internal-next
   357  internal-next
   358  internal-next
   359  internal-next
   360  internal-next
   361  internal-next
   362  first
   363  can-deterministically-single-delete
   364  ----
   365  a: (a, .)
   366  DELSIZED
   367  SET
   368  DEL
   369  SET
   370  SINGLEDEL
   371  SET
   372  .
   373  a: (a, .)
   374  true