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

     1  
     2  reset
     3  ----
     4  
     5  batch commit
     6  range-key-set a c @5 boop
     7  range-key-set c e @5 beep
     8  ----
     9  committed 2 keys
    10  
    11  snapshot name=foo
    12  ----
    13  
    14  batch commit
    15  set b d
    16  set e foo
    17  ----
    18  committed 2 keys
    19  
    20  file-only-snapshot efos1
    21    b g
    22  ----
    23  ok
    24  
    25  # EFOS work with scan-internal.
    26  
    27  scan-internal file-only-snapshot=efos1
    28  ----
    29  a-c:{(#0,RANGEKEYSET,@5,boop)}
    30  b#12,1 (d)
    31  c-e:{(#0,RANGEKEYSET,@5,beep)}
    32  e#13,1 (foo)
    33  
    34  flush
    35  ----
    36  
    37  scan-internal
    38  ----
    39  a-c:{(#0,RANGEKEYSET,@5,boop)}
    40  b#12,1 (d)
    41  c-e:{(#0,RANGEKEYSET,@5,beep)}
    42  e#13,1 (foo)
    43  
    44  # Keys deleted by rangedels are elided.
    45  
    46  batch commit
    47  del-range b d
    48  ----
    49  committed 1 keys
    50  
    51  scan-internal
    52  ----
    53  a-c:{(#0,RANGEKEYSET,@5,boop)}
    54  b-d#14,RANGEDEL
    55  c-e:{(#0,RANGEKEYSET,@5,beep)}
    56  e#13,1 (foo)
    57  
    58  flush
    59  ----
    60  
    61  scan-internal
    62  ----
    63  a-c:{(#0,RANGEKEYSET,@5,boop)}
    64  b-d#14,RANGEDEL
    65  c-e:{(#0,RANGEKEYSET,@5,beep)}
    66  e#13,1 (foo)
    67  
    68  # Snapshots work with scan internal.
    69  
    70  scan-internal snapshot=foo
    71  ----
    72  a-c:{(#0,RANGEKEYSET,@5,boop)}
    73  c-e:{(#0,RANGEKEYSET,@5,beep)}
    74  
    75  wait-for-file-only-snapshot efos1
    76  ----
    77  ok
    78  
    79  scan-internal file-only-snapshot=efos1
    80  ----
    81  a-c:{(#0,RANGEKEYSET,@5,boop)}
    82  b#12,1 (d)
    83  c-e:{(#0,RANGEKEYSET,@5,beep)}
    84  e#13,1 (foo)
    85  
    86  # Force keys newer than the snapshot into a lower level, then try skip-shared
    87  # iteration through it. This should return an error as it would expose keys
    88  # newer than the snapshot in the shared sstable.
    89  
    90  compact a-z
    91  ----
    92  6:
    93    000008:[a#10,RANGEKEYSET-e#13,SET]
    94  
    95  lsm
    96  ----
    97  6:
    98    000008:[a#10,RANGEKEYSET-e#13,SET]
    99  
   100  scan-internal lower=a upper=z skip-shared snapshot=foo
   101  ----
   102  file 000008 contains keys newer than snapshot: pebble: cannot use skip-shared iteration due to non-shareable files in lower levels
   103  
   104  # Range keys and range dels are truncated to [lower,upper).
   105  
   106  scan-internal lower=bb upper=dd
   107  ----
   108  bb-c:{(#0,RANGEKEYSET,@5,boop)}
   109  bb-d#14,RANGEDEL
   110  c-dd:{(#0,RANGEKEYSET,@5,beep)}
   111  
   112  scan-internal lower=b upper=cc
   113  ----
   114  b-c:{(#0,RANGEKEYSET,@5,boop)}
   115  b-cc#14,RANGEDEL
   116  c-cc:{(#0,RANGEKEYSET,@5,beep)}
   117  
   118  reset
   119  ----
   120  
   121  # Range key unsets and dels are allowed to delete keys they observe, however
   122  # the unset/del must also be returned to the user.
   123  
   124  batch commit
   125  range-key-set a c @8
   126  range-key-set b e @6
   127  ----
   128  committed 2 keys
   129  
   130  flush
   131  ----
   132  
   133  compact a-z
   134  ----
   135  6:
   136    000005:[a#10,RANGEKEYSET-e#inf,RANGEKEYSET]
   137  
   138  batch commit
   139  range-key-unset b d @6
   140  ----
   141  committed 1 keys
   142  
   143  flush
   144  ----
   145  
   146  batch commit
   147  range-key-del a b
   148  ----
   149  committed 1 keys
   150  
   151  scan-internal
   152  ----
   153  a-b:{(#0,RANGEKEYDEL)}
   154  b-c:{(#0,RANGEKEYSET,@8) (#0,RANGEKEYUNSET,@6)}
   155  c-d:{(#0,RANGEKEYUNSET,@6)}
   156  d-e:{(#0,RANGEKEYSET,@6)}
   157  
   158  flush
   159  ----
   160  
   161  lsm
   162  ----
   163  0.0:
   164    000009:[a#13,RANGEKEYDEL-b#inf,RANGEKEYDEL]
   165    000007:[b#12,RANGEKEYUNSET-d#inf,RANGEKEYUNSET]
   166  6:
   167    000005:[a#10,RANGEKEYSET-e#inf,RANGEKEYSET]
   168  
   169  scan-internal
   170  ----
   171  a-b:{(#0,RANGEKEYDEL)}
   172  b-c:{(#0,RANGEKEYSET,@8) (#0,RANGEKEYUNSET,@6)}
   173  c-d:{(#0,RANGEKEYUNSET,@6)}
   174  d-e:{(#0,RANGEKEYSET,@6)}
   175  
   176  batch ingest
   177  range-key-set e f @3
   178  range-key-unset f g @3
   179  ----
   180  wrote 2 keys to batch ""
   181  
   182  scan-internal
   183  ----
   184  a-b:{(#0,RANGEKEYDEL)}
   185  b-c:{(#0,RANGEKEYSET,@8) (#0,RANGEKEYUNSET,@6)}
   186  c-d:{(#0,RANGEKEYUNSET,@6)}
   187  d-e:{(#0,RANGEKEYSET,@6)}
   188  e-f:{(#0,RANGEKEYSET,@3)}
   189  f-g:{(#0,RANGEKEYUNSET,@3)}
   190  
   191  batch ingest
   192  range-key-unset e f @3
   193  range-key-set f g @3
   194  ----
   195  wrote 2 keys to batch ""
   196  
   197  scan-internal
   198  ----
   199  a-b:{(#0,RANGEKEYDEL)}
   200  b-c:{(#0,RANGEKEYSET,@8) (#0,RANGEKEYUNSET,@6)}
   201  c-d:{(#0,RANGEKEYUNSET,@6)}
   202  d-e:{(#0,RANGEKEYSET,@6)}
   203  e-f:{(#0,RANGEKEYUNSET,@3)}
   204  f-g:{(#0,RANGEKEYSET,@3)}
   205  
   206  # Range key masking is not exercised, with range keys that could mask point
   207  # keys being returned alongside point keys.
   208  
   209  reset
   210  ----
   211  
   212  batch commit
   213  set b@3 bar
   214  ----
   215  committed 1 keys
   216  
   217  batch commit
   218  range-key-set a c @5 boop
   219  range-key-set c e @5 beep
   220  ----
   221  committed 2 keys
   222  
   223  scan-internal
   224  ----
   225  a-c:{(#0,RANGEKEYSET,@5,boop)}
   226  b@3#10,1 (bar)
   227  c-e:{(#0,RANGEKEYSET,@5,beep)}
   228  
   229  # Point keys are collapsed in a way similar to a compaction.
   230  
   231  reset
   232  ----
   233  
   234  batch commit
   235  set b@3 bar
   236  set c foo
   237  ----
   238  committed 2 keys
   239  
   240  scan-internal
   241  ----
   242  b@3#10,1 (bar)
   243  c#11,1 (foo)
   244  
   245  batch commit
   246  set b@3 barfoo
   247  ----
   248  committed 1 keys
   249  
   250  scan-internal
   251  ----
   252  b@3#12,1 (barfoo)
   253  c#11,1 (foo)
   254  
   255  batch commit
   256  set b@3 baz
   257  del c
   258  set d@4 bar
   259  ----
   260  committed 3 keys
   261  
   262  scan-internal
   263  ----
   264  b@3#13,1 (baz)
   265  c#14,0 ()
   266  d@4#15,1 (bar)
   267  
   268  batch commit
   269  set f barbaz
   270  ----
   271  committed 1 keys
   272  
   273  scan-internal
   274  ----
   275  b@3#13,1 (baz)
   276  c#14,0 ()
   277  d@4#15,1 (bar)
   278  f#16,1 (barbaz)
   279  
   280  # Skip-shared iteration mode. Test truncation of range key at scan bounds.
   281  
   282  reset
   283  ----
   284  
   285  batch commit
   286  set b@3 bar
   287  ----
   288  committed 1 keys
   289  
   290  batch commit
   291  range-key-set a c @5 boop
   292  del-range c e
   293  ----
   294  committed 2 keys
   295  
   296  flush
   297  ----
   298  
   299  compact a-z
   300  ----
   301  6:
   302    000005:[a#11,RANGEKEYSET-e#inf,RANGEDEL]
   303  
   304  batch commit
   305  set f@8 baz
   306  ----
   307  committed 1 keys
   308  
   309  lsm
   310  ----
   311  6:
   312    000005:[a#11,RANGEKEYSET-e#inf,RANGEDEL]
   313  
   314  scan-internal
   315  ----
   316  a-c:{(#0,RANGEKEYSET,@5,boop)}
   317  b@3#10,1 (bar)
   318  c-e#12,RANGEDEL
   319  f@8#13,1 (baz)
   320  
   321  scan-internal skip-shared lower=a upper=z
   322  ----
   323  shared file: 000005 [a#11,21-e#72057594037927935,15] [point=b@3#10,1-e#72057594037927935,15] [range=a#11,21-c#72057594037927935,21]
   324  f@8#13,1 (baz)
   325  
   326  scan-internal skip-shared lower=a upper=e
   327  ----
   328  shared file: 000005 [a#11,21-e#72057594037927935,15] [point=b@3#10,1-e#72057594037927935,15] [range=a#11,21-c#72057594037927935,21]
   329  
   330  scan-internal skip-shared lower=a upper=d
   331  ----
   332  shared file: 000005 [a#11,21-d#72057594037927935,15] [point=b@3#10,1-d#72057594037927935,15] [range=a#11,21-c#72057594037927935,21]
   333  
   334  scan-internal skip-shared lower=a upper=c
   335  ----
   336  shared file: 000005 [a#11,21-c#72057594037927935,21] [point=b@3#10,1-b@3#10,1] [range=a#11,21-c#72057594037927935,21]
   337  
   338  scan-internal skip-shared lower=a upper=b
   339  ----
   340  shared file: 000005 [a#11,21-b#72057594037927935,21] [point=#0,0-#0,0] [range=a#11,21-b#72057594037927935,21]
   341  
   342  scan-internal skip-shared lower=b upper=z
   343  ----
   344  shared file: 000005 [b#11,21-e#72057594037927935,15] [point=b@3#10,1-e#72057594037927935,15] [range=b#11,21-c#72057594037927935,21]
   345  f@8#13,1 (baz)
   346  
   347  scan-internal skip-shared lower=b upper=bb
   348  ----
   349  shared file: 000005 [b#11,21-bb#72057594037927935,21] [point=b@3#10,1-b@3#10,1] [range=b#11,21-bb#72057594037927935,21]
   350  
   351  scan-internal skip-shared lower=e upper=ff
   352  ----
   353  f@8#13,1 (baz)
   354  
   355  # Shared files that don't have any keys in [lower, upper) are ignored.
   356  
   357  reset
   358  ----
   359  
   360  batch commit
   361  set a foo
   362  set f bar
   363  del-range b c
   364  range-key-set e ee @5 boop
   365  ----
   366  committed 4 keys
   367  
   368  flush
   369  ----
   370  
   371  compact a-z
   372  ----
   373  6:
   374    000005:[a#10,SET-f#11,SET]
   375  
   376  lsm
   377  ----
   378  6:
   379    000005:[a#10,SET-f#11,SET]
   380  
   381  scan-internal skip-shared lower=c upper=d
   382  ----
   383  
   384  scan-internal skip-shared lower=a upper=d
   385  ----
   386  shared file: 000005 [a#10,1-c#72057594037927935,15] [point=a#10,1-c#72057594037927935,15] [range=#0,0-#0,0]
   387  
   388  scan-internal skip-shared lower=bb upper=d
   389  ----
   390  shared file: 000005 [bb#12,15-c#72057594037927935,15] [point=bb#12,15-c#72057594037927935,15] [range=#0,0-#0,0]
   391  
   392  scan-internal skip-shared lower=c upper=ea
   393  ----
   394  shared file: 000005 [e#13,21-ea#72057594037927935,21] [point=#0,0-#0,0] [range=e#13,21-ea#72057594037927935,21]
   395  
   396  scan-internal skip-shared lower=c upper=z
   397  ----
   398  shared file: 000005 [e#13,21-f#11,1] [point=f#11,1-f#11,1] [range=e#13,21-ee#72057594037927935,21]
   399  
   400  # An upper bound equalling a file's Largest user key should be reason enough to
   401  # truncate that file's bounds.
   402  
   403  scan-internal skip-shared lower=c upper=f
   404  ----
   405  shared file: 000005 [e#13,21-ee#72057594037927935,21] [point=#0,0-#0,0] [range=e#13,21-ee#72057594037927935,21]
   406  
   407  # Construct a file with an exclusive sentinel as the largest key. Verify that
   408  # scan-internal with skip-shared and an upper bound at that exclusive sentinel
   409  # does not truncate that file.
   410  
   411  reset
   412  ----
   413  
   414  batch commit
   415  set a foo
   416  del-range b c
   417  range-key-set e ee @5 boop
   418  ----
   419  committed 3 keys
   420  
   421  flush
   422  ----
   423  
   424  compact a-z
   425  ----
   426  6:
   427    000005:[a#10,SET-ee#inf,RANGEKEYSET]
   428  
   429  scan-internal skip-shared lower=a upper=ee
   430  ----
   431  shared file: 000005 [a#10,1-ee#72057594037927935,21] [point=a#10,1-c#72057594037927935,15] [range=e#12,21-ee#72057594037927935,21]
   432  
   433  scan-internal skip-shared lower=b upper=ee
   434  ----
   435  shared file: 000005 [b#11,15-ee#72057594037927935,21] [point=b#11,15-c#72057594037927935,15] [range=e#12,21-ee#72057594037927935,21]
   436  
   437  # Ensure we don't leave any range key bounds unintentionally set.
   438  
   439  reset
   440  ----
   441  
   442  batch commit
   443  range-key-set a aa @5 boop
   444  set b foo
   445  set c bar
   446  set d baz
   447  ----
   448  committed 4 keys
   449  
   450  flush
   451  ----
   452  
   453  compact a-z
   454  ----
   455  6:
   456    000005:[a#10,RANGEKEYSET-d#13,SET]
   457  
   458  scan-internal skip-shared lower=b upper=e
   459  ----
   460  shared file: 000005 [b#11,1-d#13,1] [point=b#11,1-d#13,1] [range=#0,0-#0,0]
   461  
   462  scan-internal skip-shared lower=a upper=aaa
   463  ----
   464  shared file: 000005 [a#10,21-aa#72057594037927935,21] [point=#0,0-#0,0] [range=a#10,21-aa#72057594037927935,21]