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

     1  
     2  switch 1
     3  ----
     4  ok
     5  
     6  build ext0
     7  set a 1
     8  set l 2
     9  ----
    10  
    11  ingest ext0
    12  ----
    13  
    14  lsm
    15  ----
    16  6:
    17    000004:[a#10,SET-l#10,SET]
    18  
    19  
    20  batch
    21  set d foo
    22  set f bar
    23  ----
    24  
    25  flush
    26  ----
    27  
    28  compact a-z
    29  ----
    30  ok
    31  
    32  lsm
    33  ----
    34  6:
    35    000007:[a#0,SET-l#0,SET]
    36  
    37  switch 2
    38  ----
    39  ok
    40  
    41  iter
    42  first
    43  ----
    44  .
    45  
    46  replicate 1 2 d g
    47  ----
    48  replicated 1 shared SSTs
    49  
    50  lsm
    51  ----
    52  6:
    53    000005:[d#10,SET-f#10,SET]
    54  
    55  iter
    56  first
    57  next
    58  next
    59  ----
    60  d: (foo, .)
    61  f: (bar, .)
    62  .
    63  
    64  batch
    65  set e bar
    66  set f bar2
    67  set g bar3
    68  ----
    69  
    70  iter
    71  first
    72  next
    73  next
    74  next
    75  ----
    76  d: (foo, .)
    77  e: (bar, .)
    78  f: (bar2, .)
    79  g: (bar3, .)
    80  
    81  compact a-z
    82  ----
    83  ok
    84  
    85  iter
    86  first
    87  next
    88  next
    89  next
    90  ----
    91  d: (foo, .)
    92  e: (bar, .)
    93  f: (bar2, .)
    94  g: (bar3, .)
    95  
    96  # Write a new key at f, but don't compact it down.
    97  
    98  batch
    99  set f bar3
   100  ----
   101  
   102  switch 1
   103  ----
   104  ok
   105  
   106  lsm
   107  ----
   108  6:
   109    000007:[a#0,SET-l#0,SET]
   110  
   111  excise e gg
   112  ----
   113  would excise 1 files, use ingest-and-excise to excise.
   114    deleted:       L6 000007
   115    added:         L6 000008:[a#0,1-d#0,1]
   116    added:         L6 000009:[l#0,1-l#0,1]
   117  
   118  replicate 2 1 e gg
   119  ----
   120  replicated 1 shared SSTs
   121  
   122  iter
   123  first
   124  next
   125  next
   126  next
   127  next
   128  ----
   129  a: (1, .)
   130  d: (foo, .)
   131  e: (bar, .)
   132  f: (bar3, .)
   133  g: (bar3, .)
   134  
   135  # Range key masking test. Write some masked keys, then replicate before
   136  # compacting, then compact, then replicate back.
   137  
   138  batch
   139  set h@3 foobar
   140  set i@5 baz
   141  range-key-set g j @4 value
   142  ----
   143  
   144  iter
   145  first
   146  next
   147  next
   148  next
   149  next
   150  next
   151  next
   152  next
   153  ----
   154  a: (1, .)
   155  d: (foo, .)
   156  e: (bar, .)
   157  f: (bar3, .)
   158  g: (bar3, [g-j) @4=value UPDATED)
   159  h@3: (foobar, [g-j) @4=value)
   160  i@5: (baz, [g-j) @4=value)
   161  l: (2, . UPDATED)
   162  
   163  iter mask-filter mask-suffix=@6
   164  first
   165  next
   166  next
   167  next
   168  next
   169  next
   170  next
   171  ----
   172  a: (1, .)
   173  d: (foo, .)
   174  e: (bar, .)
   175  f: (bar3, .)
   176  g: (bar3, [g-j) @4=value UPDATED)
   177  i@5: (baz, [g-j) @4=value)
   178  l: (2, . UPDATED)
   179  
   180  switch 2
   181  ----
   182  ok
   183  
   184  replicate 1 2 a z
   185  ----
   186  replicated 3 shared SSTs
   187  
   188  iter
   189  first
   190  next
   191  next
   192  next
   193  next
   194  next
   195  next
   196  next
   197  ----
   198  a: (1, .)
   199  d: (foo, .)
   200  e: (bar, .)
   201  f: (bar3, .)
   202  g: (bar3, [g-j) @4=value UPDATED)
   203  h@3: (foobar, [g-j) @4=value)
   204  i@5: (baz, [g-j) @4=value)
   205  l: (2, . UPDATED)
   206  
   207  iter mask-filter mask-suffix=@6
   208  first
   209  next
   210  next
   211  next
   212  next
   213  next
   214  next
   215  ----
   216  a: (1, .)
   217  d: (foo, .)
   218  e: (bar, .)
   219  f: (bar3, .)
   220  g: (bar3, [g-j) @4=value UPDATED)
   221  i@5: (baz, [g-j) @4=value)
   222  l: (2, . UPDATED)
   223  
   224  compact a-z
   225  ----
   226  ok
   227  
   228  replicate 2 1 a z
   229  ----
   230  replicated 3 shared SSTs
   231  
   232  restart
   233  ----
   234  ok, note that the active db has been set to 1 (use 'switch' to change)
   235  
   236  iter
   237  first
   238  next
   239  next
   240  next
   241  next
   242  next
   243  next
   244  next
   245  next
   246  ----
   247  a: (1, .)
   248  d: (foo, .)
   249  e: (bar, .)
   250  f: (bar3, .)
   251  g: (bar3, [g-j) @4=value UPDATED)
   252  h@3: (foobar, [g-j) @4=value)
   253  i@5: (baz, [g-j) @4=value)
   254  l: (2, . UPDATED)
   255  .
   256  
   257  iter mask-filter mask-suffix=@6
   258  first
   259  next
   260  next
   261  next
   262  next
   263  next
   264  next
   265  next
   266  ----
   267  a: (1, .)
   268  d: (foo, .)
   269  e: (bar, .)
   270  f: (bar3, .)
   271  g: (bar3, [g-j) @4=value UPDATED)
   272  i@5: (baz, [g-j) @4=value)
   273  l: (2, . UPDATED)
   274  .
   275  
   276  # Reverse iteration test with masking.
   277  
   278  iter mask-filter mask-suffix=@6
   279  last
   280  prev
   281  prev
   282  prev
   283  prev
   284  prev
   285  prev
   286  prev
   287  ----
   288  l: (2, .)
   289  i@5: (baz, [g-j) @4=value UPDATED)
   290  g: (bar3, [g-j) @4=value)
   291  f: (bar3, . UPDATED)
   292  e: (bar, .)
   293  d: (foo, .)
   294  a: (1, .)
   295  .
   296  
   297  # Range del tests.
   298  
   299  reset
   300  ----
   301  
   302  switch 1
   303  ----
   304  ok
   305  
   306  batch
   307  set a@3 o
   308  set b@5 foo
   309  set c@6 bar
   310  set e baz
   311  ----
   312  
   313  flush
   314  ----
   315  
   316  compact a-z
   317  ----
   318  ok
   319  
   320  batch
   321  del-range b d
   322  ----
   323  
   324  flush
   325  ----
   326  
   327  batch
   328  set a@3 abc
   329  set b@7 notdeleted
   330  set c@9 foobar
   331  ----
   332  
   333  flush
   334  ----
   335  
   336  lsm
   337  ----
   338  0.1:
   339    000009:[a@3#15,SET-c@9#17,SET]
   340  0.0:
   341    000007:[b#14,RANGEDEL-d#inf,RANGEDEL]
   342  6:
   343    000005:[a@3#10,SET-e#13,SET]
   344  
   345  iter
   346  first
   347  next
   348  next
   349  next
   350  next
   351  ----
   352  a@3: (abc, .)
   353  b@7: (notdeleted, .)
   354  c@9: (foobar, .)
   355  e: (baz, .)
   356  .
   357  
   358  replicate 1 2 a z
   359  ----
   360  replicated 1 shared SSTs
   361  
   362  switch 2
   363  ----
   364  ok
   365  
   366  lsm
   367  ----
   368  0.0:
   369    000004:[a@3#11,SET-d#inf,RANGEDEL]
   370  6:
   371    000005:[a@3#10,SET-e#10,SET]
   372  
   373  iter
   374  first
   375  next
   376  next
   377  next
   378  next
   379  ----
   380  a@3: (abc, .)
   381  b@7: (notdeleted, .)
   382  c@9: (foobar, .)
   383  e: (baz, .)
   384  .
   385  
   386  # Similar to the above test, except this time we bring the rangedel into
   387  # L5 using an ingestion.
   388  
   389  reset
   390  ----
   391  
   392  switch 1
   393  ----
   394  ok
   395  
   396  batch
   397  set a@3 o
   398  set b@5 foo
   399  set c@6 bar
   400  set e baz
   401  ----
   402  
   403  flush
   404  ----
   405  
   406  compact a-z
   407  ----
   408  ok
   409  
   410  build s1
   411  del-range b d
   412  ----
   413  
   414  ingest s1
   415  ----
   416  
   417  lsm
   418  ----
   419  5:
   420    000006:[b#14,RANGEDEL-d#inf,RANGEDEL]
   421  6:
   422    000005:[a@3#10,SET-e#13,SET]
   423  
   424  batch
   425  set a@3 abc
   426  set b@7 notdeleted
   427  set c@9 foobar
   428  ----
   429  
   430  flush
   431  ----
   432  
   433  lsm
   434  ----
   435  0.0:
   436    000008:[a@3#15,SET-c@9#17,SET]
   437  5:
   438    000006:[b#14,RANGEDEL-d#inf,RANGEDEL]
   439  6:
   440    000005:[a@3#10,SET-e#13,SET]
   441  
   442  iter
   443  first
   444  next
   445  next
   446  next
   447  next
   448  next
   449  ----
   450  a@3: (abc, .)
   451  b@7: (notdeleted, .)
   452  c@9: (foobar, .)
   453  e: (baz, .)
   454  .
   455  .
   456  
   457  replicate 1 2 a z
   458  ----
   459  replicated 2 shared SSTs
   460  
   461  switch 2
   462  ----
   463  ok
   464  
   465  lsm
   466  ----
   467  0.0:
   468    000004:[a@3#12,SET-c@9#12,SET]
   469  5:
   470    000005:[b#11,RANGEDEL-d#inf,RANGEDEL]
   471  6:
   472    000006:[a@3#10,SET-e#10,SET]
   473  
   474  iter
   475  first
   476  next
   477  next
   478  next
   479  next
   480  ----
   481  a@3: (abc, .)
   482  b@7: (notdeleted, .)
   483  c@9: (foobar, .)
   484  e: (baz, .)
   485  .
   486  
   487  # Test for cases where an excise produces a range key on one side and point keys
   488  # on the other.
   489  
   490  reset
   491  ----
   492  
   493  switch 1
   494  ----
   495  ok
   496  
   497  batch
   498  range-key-set a aaa @3 foo
   499  set d foobar
   500  set e barbaz
   501  ----
   502  
   503  flush
   504  ----
   505  
   506  compact a-z
   507  ----
   508  ok
   509  
   510  lsm
   511  ----
   512  6:
   513    000005:[a#10,RANGEKEYSET-e#12,SET]
   514  
   515  switch 2
   516  ----
   517  ok
   518  
   519  batch
   520  set b bcd
   521  set c cde
   522  ----
   523  
   524  flush
   525  ----
   526  
   527  compact a-z
   528  ----
   529  ok
   530  
   531  replicate 2 1 b cc
   532  ----
   533  replicated 1 shared SSTs
   534  
   535  switch 1
   536  ----
   537  ok
   538  
   539  lsm
   540  ----
   541  6:
   542    000008:[a#10,RANGEKEYSET-aaa#inf,RANGEKEYSET]
   543    000007:[b#13,SET-c#13,SET]
   544    000009:[d#11,SET-e#12,SET]
   545  
   546  iter
   547  first
   548  next
   549  next
   550  next
   551  next
   552  ----
   553  a: (., [a-aaa) @3=foo UPDATED)
   554  b: (bcd, . UPDATED)
   555  c: (cde, .)
   556  d: (foobar, .)
   557  e: (barbaz, .)
   558  
   559  reset
   560  ----
   561  
   562  switch 1
   563  ----
   564  ok
   565  
   566  batch
   567  set a@3 o
   568  set b@5 foo
   569  set c@6 bar
   570  set e baz
   571  ----
   572  
   573  flush
   574  ----
   575  
   576  compact a-z
   577  ----
   578  ok
   579  
   580  build s2
   581  del-range bb g
   582  ----
   583  
   584  ingest s2
   585  ----
   586  
   587  lsm
   588  ----
   589  5:
   590    000006:[bb#14,RANGEDEL-g#inf,RANGEDEL]
   591  6:
   592    000005:[a@3#10,SET-e#13,SET]
   593  
   594  switch 2
   595  ----
   596  ok
   597  
   598  batch
   599  set ff notdeleted
   600  ----
   601  
   602  flush
   603  ----
   604  
   605  compact a-z
   606  ----
   607  ok
   608  
   609  lsm
   610  ----
   611  6:
   612    000005:[ff#10,SET-ff#10,SET]
   613  
   614  # This replication should truncate the range deletion in pebble instance 1
   615  # at f, leaving ff undeleted.
   616  
   617  replicate 1 2 b f
   618  ----
   619  replicated 2 shared SSTs
   620  
   621  lsm
   622  ----
   623  5:
   624    000007:[bb#12,RANGEDEL-f#inf,RANGEDEL]
   625  6:
   626    000008:[b@5#11,SET-e#11,SET]
   627    000005:[ff#10,SET-ff#10,SET]
   628  
   629  iter
   630  seek-ge b
   631  next
   632  next
   633  ----
   634  b@5: (foo, .)
   635  ff: (notdeleted, .)
   636  .
   637  
   638  restart
   639  ----
   640  ok, note that the active db has been set to 1 (use 'switch' to change)
   641  
   642  switch 2
   643  ----
   644  ok
   645  
   646  iter
   647  seek-ge b
   648  next
   649  next
   650  ----
   651  b@5: (foo, .)
   652  ff: (notdeleted, .)
   653  .
   654  
   655  # Same as above, but with a truncated range key instead of a truncated range del.
   656  
   657  reset
   658  ----
   659  
   660  switch 1
   661  ----
   662  ok
   663  
   664  batch
   665  set a@3 o
   666  set b@5 foo
   667  set c@6 bar
   668  set e baz
   669  ----
   670  
   671  flush
   672  ----
   673  
   674  compact a-z
   675  ----
   676  ok
   677  
   678  build s3
   679  range-key-set bb g @8 foo
   680  ----
   681  
   682  ingest s3
   683  ----
   684  
   685  lsm
   686  ----
   687  5:
   688    000006:[bb#14,RANGEKEYSET-g#inf,RANGEKEYSET]
   689  6:
   690    000005:[a@3#10,SET-e#13,SET]
   691  
   692  switch 2
   693  ----
   694  ok
   695  
   696  batch
   697  set ff notcovered
   698  ----
   699  
   700  flush
   701  ----
   702  
   703  compact a-z
   704  ----
   705  ok
   706  
   707  lsm
   708  ----
   709  6:
   710    000005:[ff#10,SET-ff#10,SET]
   711  
   712  # This replication should truncate the range key in pebble instance 1
   713  # at f, leaving ff uncovered.
   714  
   715  replicate 1 2 b f
   716  ----
   717  replicated 2 shared SSTs
   718  
   719  lsm
   720  ----
   721  5:
   722    000007:[bb#12,RANGEKEYSET-f#inf,RANGEKEYSET]
   723  6:
   724    000008:[b@5#11,SET-e#11,SET]
   725    000005:[ff#10,SET-ff#10,SET]
   726  
   727  iter
   728  seek-ge b
   729  next
   730  next
   731  next
   732  next
   733  next
   734  ----
   735  b@5: (foo, .)
   736  bb: (., [bb-f) @8=foo UPDATED)
   737  c@6: (bar, [bb-f) @8=foo)
   738  e: (baz, [bb-f) @8=foo)
   739  ff: (notcovered, . UPDATED)
   740  .
   741  
   742  
   743  iter mask-filter mask-suffix=@9
   744  seek-ge b
   745  next
   746  next
   747  next
   748  next
   749  ----
   750  b@5: (foo, .)
   751  bb: (., [bb-f) @8=foo UPDATED)
   752  e: (baz, [bb-f) @8=foo)
   753  ff: (notcovered, . UPDATED)
   754  .
   755  
   756  # Tests for Eventually file-only snapshots.
   757  
   758  reset
   759  ----
   760  
   761  switch 1
   762  ----
   763  ok
   764  
   765  batch
   766  set a foo
   767  set b bar
   768  set c baz
   769  ----
   770  
   771  flush
   772  ----
   773  
   774  compact a-z
   775  ----
   776  ok
   777  
   778  switch 2
   779  ----
   780  ok
   781  
   782  batch
   783  set b foobar
   784  ----
   785  
   786  file-only-snapshot s1
   787   aa bb
   788   e f
   789  ----
   790  ok
   791  
   792  lsm
   793  ----
   794  
   795  iter snapshot=s1
   796  first
   797  next
   798  next
   799  ----
   800  b: (foobar, .)
   801  .
   802  .
   803  
   804  # The below call should do a flush.
   805  
   806  wait-for-file-only-snapshot s1
   807  ----
   808  ok
   809  
   810  lsm
   811  ----
   812  0.0:
   813    000005:[b#10,SET-b#10,SET]
   814  
   815  iter snapshot=s1
   816  first
   817  next
   818  next
   819  ----
   820  b: (foobar, .)
   821  .
   822  .
   823  
   824  replicate 1 2 a d
   825  ----
   826  replicated 1 shared SSTs
   827  
   828  iter snapshot=s1
   829  first
   830  next
   831  next
   832  ----
   833  b: (foobar, .)
   834  .
   835  .
   836  
   837  iter
   838  first
   839  next
   840  next
   841  next
   842  ----
   843  a: (foo, .)
   844  b: (bar, .)
   845  c: (baz, .)
   846  .
   847  
   848  switch 1
   849  ----
   850  ok
   851  
   852  batch
   853  del c
   854  ----
   855  
   856  # The below excise and wait should succeed as the flush will end up transitioning
   857  # the file-only snapshot.
   858  
   859  lsm
   860  ----
   861  6:
   862    000005:[a#10,SET-c#12,SET]
   863  
   864  file-only-snapshot s2
   865   a cc
   866  ----
   867  ok
   868  
   869  iter snapshot=s2
   870  first
   871  next
   872  next
   873  next
   874  next
   875  ----
   876  a: (foo, .)
   877  b: (bar, .)
   878  .
   879  .
   880  .
   881  
   882  flush
   883  ----
   884  
   885  compact a-z
   886  ----
   887  ok
   888  
   889  replicate 2 1 a d
   890  ----
   891  replicated 1 shared SSTs
   892  
   893  wait-for-file-only-snapshot s2
   894  ----
   895  ok
   896  
   897  iter snapshot=s2
   898  first
   899  next
   900  next
   901  next
   902  ----
   903  a: (foo, .)
   904  b: (bar, .)
   905  .
   906  .
   907  
   908  iter snapshot=s2
   909  first
   910  clone
   911  first
   912  next
   913  next
   914  next
   915  ----
   916  a: (foo, .)
   917  .
   918  a: (foo, .)
   919  b: (bar, .)
   920  .
   921  .
   922  
   923  iter
   924  first
   925  next
   926  next
   927  next
   928  next
   929  ----
   930  a: (foo, .)
   931  b: (bar, .)
   932  c: (baz, .)
   933  .
   934  .
   935  
   936  batch
   937  set d foo
   938  set e bar
   939  ----
   940  
   941  flush
   942  ----
   943  
   944  compact a-z
   945  ----
   946  ok
   947  
   948  switch 2
   949  ----
   950  ok
   951  
   952  flush
   953  ----
   954  
   955  batch
   956  set f foobar
   957  ----
   958  
   959  # The below file-only snapshot is the more challenging case of a partial overlap
   960  # between an excise and a file-only snapshot. In this case the EFOS transition
   961  # blocks on the memtable but the excise proceeds through, causing the EFOS'
   962  # WaitForFileOnlySnapshot() call to error out. Opening iterators also returns
   963  # the same errors.
   964  
   965  file-only-snapshot s3
   966   c g
   967  ----
   968  ok
   969  
   970  iter snapshot=s3
   971  first
   972  next
   973  next
   974  next
   975  next
   976  ----
   977  a: (foo, .)
   978  b: (bar, .)
   979  c: (baz, .)
   980  f: (foobar, .)
   981  .
   982  
   983  iter snapshot=s3
   984  first
   985  next
   986  clone
   987  first
   988  next
   989  next
   990  next
   991  ----
   992  a: (foo, .)
   993  b: (bar, .)
   994  .
   995  a: (foo, .)
   996  b: (bar, .)
   997  c: (baz, .)
   998  f: (foobar, .)
   999  
  1000  
  1001  replicate 1 2 b e
  1002  ----
  1003  replicated 2 shared SSTs
  1004  
  1005  wait-for-file-only-snapshot s3
  1006  ----
  1007  pebble: snapshot excised before conversion to file-only snapshot
  1008  
  1009  iter snapshot=s3
  1010  first
  1011  next
  1012  next
  1013  next
  1014  next
  1015  ----
  1016  pebble: snapshot excised before conversion to file-only snapshot
  1017  
  1018  iter snapshot=s3
  1019  first
  1020  next
  1021  clone
  1022  first
  1023  next
  1024  next
  1025  next
  1026  ----
  1027  pebble: snapshot excised before conversion to file-only snapshot
  1028  
  1029  iter
  1030  first
  1031  next
  1032  next
  1033  next
  1034  next
  1035  ----
  1036  a: (foo, .)
  1037  b: (bar, .)
  1038  c: (baz, .)
  1039  d: (foo, .)
  1040  f: (foobar, .)
  1041  
  1042  # The below example tests for a file-only snapshot that overlaps completely
  1043  # with an excise right after it. The wait succeeds and snapshot consistency is
  1044  # maintained.
  1045  
  1046  reset
  1047  ----
  1048  
  1049  switch 1
  1050  ----
  1051  ok
  1052  
  1053  batch
  1054  set a foo
  1055  set b bar
  1056  set c baz
  1057  ----
  1058  
  1059  flush
  1060  ----
  1061  
  1062  compact a-z
  1063  ----
  1064  ok
  1065  
  1066  switch 2
  1067  ----
  1068  ok
  1069  
  1070  batch
  1071  set d foobar
  1072  ----
  1073  
  1074  file-only-snapshot s4
  1075   b e
  1076  ----
  1077  ok
  1078  
  1079  iter snapshot=s4
  1080  first
  1081  next
  1082  next
  1083  ----
  1084  d: (foobar, .)
  1085  .
  1086  .
  1087  
  1088  replicate 1 2 b e
  1089  ----
  1090  replicated 1 shared SSTs
  1091  
  1092  wait-for-file-only-snapshot s4
  1093  ----
  1094  ok
  1095  
  1096  iter snapshot=s4
  1097  first
  1098  next
  1099  next
  1100  ----
  1101  d: (foobar, .)
  1102  .
  1103  .
  1104  
  1105  compact a-z
  1106  ----
  1107  ok
  1108  
  1109  iter snapshot=s4
  1110  first
  1111  next
  1112  next
  1113  ----
  1114  d: (foobar, .)
  1115  .
  1116  .
  1117  
  1118  iter
  1119  first
  1120  next
  1121  next
  1122  ----
  1123  b: (bar, .)
  1124  c: (baz, .)
  1125  .