github.com/cockroachdb/pebble@v1.1.2/testdata/ingest_shared_lower (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    000008:[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    000008:[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 000008
   115    added:         L6 000009:[a#0,1-d#0,1]
   116    added:         L6 000010:[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  switch 1
   233  ----
   234  ok
   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    000010:[a@3#15,SET-c@9#17,SET]
   340  0.0:
   341    000008:[b#14,RANGEDEL-d#inf,RANGEDEL]
   342  6:
   343    000006:[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    000007:[b#14,RANGEDEL-d#inf,RANGEDEL]
   421  6:
   422    000006:[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    000009:[a@3#15,SET-c@9#17,SET]
   437  5:
   438    000007:[b#14,RANGEDEL-d#inf,RANGEDEL]
   439  6:
   440    000006:[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    000006:[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    000009:[a#10,RANGEKEYSET-aaa#inf,RANGEKEYSET]
   543    000008:[b#13,SET-c#13,SET]
   544    000010:[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    000007:[bb#14,RANGEDEL-g#inf,RANGEDEL]
   591  6:
   592    000006:[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    000006:[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    000008:[bb#12,RANGEDEL-f#inf,RANGEDEL]
   625  6:
   626    000009:[b@5#11,SET-e#11,SET]
   627    000006:[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  # Same as above, but with a truncated range key instead of a truncated range del.
   639  
   640  reset
   641  ----
   642  
   643  switch 1
   644  ----
   645  ok
   646  
   647  batch
   648  set a@3 o
   649  set b@5 foo
   650  set c@6 bar
   651  set e baz
   652  ----
   653  
   654  flush
   655  ----
   656  
   657  compact a-z
   658  ----
   659  ok
   660  
   661  build s3
   662  range-key-set bb g @8 foo
   663  ----
   664  
   665  ingest s3
   666  ----
   667  
   668  lsm
   669  ----
   670  5:
   671    000007:[bb#14,RANGEKEYSET-g#inf,RANGEKEYSET]
   672  6:
   673    000006:[a@3#10,SET-e#13,SET]
   674  
   675  switch 2
   676  ----
   677  ok
   678  
   679  batch
   680  set ff notcovered
   681  ----
   682  
   683  flush
   684  ----
   685  
   686  compact a-z
   687  ----
   688  ok
   689  
   690  lsm
   691  ----
   692  6:
   693    000006:[ff#10,SET-ff#10,SET]
   694  
   695  # This replication should truncate the range key in pebble instance 1
   696  # at f, leaving ff uncovered.
   697  
   698  replicate 1 2 b f
   699  ----
   700  replicated 2 shared SSTs
   701  
   702  lsm
   703  ----
   704  5:
   705    000008:[bb#12,RANGEKEYSET-f#inf,RANGEKEYSET]
   706  6:
   707    000009:[b@5#11,SET-e#11,SET]
   708    000006:[ff#10,SET-ff#10,SET]
   709  
   710  iter
   711  seek-ge b
   712  next
   713  next
   714  next
   715  next
   716  next
   717  ----
   718  b@5: (foo, .)
   719  bb: (., [bb-f) @8=foo UPDATED)
   720  c@6: (bar, [bb-f) @8=foo)
   721  e: (baz, [bb-f) @8=foo)
   722  ff: (notcovered, . UPDATED)
   723  .
   724  
   725  
   726  iter mask-filter mask-suffix=@9
   727  seek-ge b
   728  next
   729  next
   730  next
   731  next
   732  ----
   733  b@5: (foo, .)
   734  bb: (., [bb-f) @8=foo UPDATED)
   735  e: (baz, [bb-f) @8=foo)
   736  ff: (notcovered, . UPDATED)
   737  .
   738  
   739  # Tests for Eventually file-only snapshots.
   740  
   741  reset
   742  ----
   743  
   744  switch 1
   745  ----
   746  ok
   747  
   748  batch
   749  set a foo
   750  set b bar
   751  set c baz
   752  ----
   753  
   754  flush
   755  ----
   756  
   757  compact a-z
   758  ----
   759  ok
   760  
   761  switch 2
   762  ----
   763  ok
   764  
   765  batch
   766  set b foobar
   767  ----
   768  
   769  file-only-snapshot s1
   770   aa bb
   771   e f
   772  ----
   773  ok
   774  
   775  lsm
   776  ----
   777  
   778  iter snapshot=s1
   779  first
   780  next
   781  next
   782  ----
   783  b: (foobar, .)
   784  .
   785  .
   786  
   787  # The below call should do a flush.
   788  
   789  wait-for-file-only-snapshot s1
   790  ----
   791  ok
   792  
   793  lsm
   794  ----
   795  0.0:
   796    000005:[b#10,SET-b#10,SET]
   797  
   798  iter snapshot=s1
   799  first
   800  next
   801  next
   802  ----
   803  b: (foobar, .)
   804  .
   805  .
   806  
   807  replicate 1 2 a d
   808  ----
   809  replicated 1 shared SSTs
   810  
   811  iter snapshot=s1
   812  first
   813  next
   814  next
   815  ----
   816  b: (foobar, .)
   817  .
   818  .
   819  
   820  iter
   821  first
   822  next
   823  next
   824  next
   825  ----
   826  a: (foo, .)
   827  b: (bar, .)
   828  c: (baz, .)
   829  .
   830  
   831  switch 1
   832  ----
   833  ok
   834  
   835  batch
   836  del c
   837  ----
   838  
   839  # The below excise and wait should succeed as the flush will end up transitioning
   840  # the file-only snapshot.
   841  
   842  lsm
   843  ----
   844  6:
   845    000006:[a#10,SET-c#12,SET]
   846  
   847  file-only-snapshot s2
   848   a cc
   849  ----
   850  ok
   851  
   852  iter snapshot=s2
   853  first
   854  next
   855  next
   856  next
   857  next
   858  ----
   859  a: (foo, .)
   860  b: (bar, .)
   861  .
   862  .
   863  .
   864  
   865  flush
   866  ----
   867  
   868  compact a-z
   869  ----
   870  ok
   871  
   872  replicate 2 1 a d
   873  ----
   874  replicated 1 shared SSTs
   875  
   876  wait-for-file-only-snapshot s2
   877  ----
   878  ok
   879  
   880  iter snapshot=s2
   881  first
   882  next
   883  next
   884  next
   885  ----
   886  a: (foo, .)
   887  b: (bar, .)
   888  .
   889  .
   890  
   891  iter snapshot=s2
   892  first
   893  clone
   894  first
   895  next
   896  next
   897  next
   898  ----
   899  a: (foo, .)
   900  .
   901  a: (foo, .)
   902  b: (bar, .)
   903  .
   904  .
   905  
   906  iter
   907  first
   908  next
   909  next
   910  next
   911  next
   912  ----
   913  a: (foo, .)
   914  b: (bar, .)
   915  c: (baz, .)
   916  .
   917  .
   918  
   919  batch
   920  set d foo
   921  set e bar
   922  ----
   923  
   924  flush
   925  ----
   926  
   927  compact a-z
   928  ----
   929  ok
   930  
   931  switch 2
   932  ----
   933  ok
   934  
   935  flush
   936  ----
   937  
   938  batch
   939  set f foobar
   940  ----
   941  
   942  # The below file-only snapshot is the more challenging case of a partial overlap
   943  # between an excise and a file-only snapshot. In this case the EFOS transition
   944  # blocks on the memtable but the excise proceeds through, causing the EFOS'
   945  # WaitForFileOnlySnapshot() call to error out. Opening iterators also returns
   946  # the same errors.
   947  
   948  file-only-snapshot s3
   949   c g
   950  ----
   951  ok
   952  
   953  iter snapshot=s3
   954  first
   955  next
   956  next
   957  next
   958  next
   959  ----
   960  a: (foo, .)
   961  b: (bar, .)
   962  c: (baz, .)
   963  f: (foobar, .)
   964  .
   965  
   966  iter snapshot=s3
   967  first
   968  next
   969  clone
   970  first
   971  next
   972  next
   973  next
   974  ----
   975  a: (foo, .)
   976  b: (bar, .)
   977  .
   978  a: (foo, .)
   979  b: (bar, .)
   980  c: (baz, .)
   981  f: (foobar, .)
   982  
   983  
   984  replicate 1 2 b e
   985  ----
   986  replicated 2 shared SSTs
   987  
   988  wait-for-file-only-snapshot s3
   989  ----
   990  pebble: snapshot excised before conversion to file-only snapshot
   991  
   992  iter snapshot=s3
   993  first
   994  next
   995  next
   996  next
   997  next
   998  ----
   999  pebble: snapshot excised before conversion to file-only snapshot
  1000  
  1001  iter snapshot=s3
  1002  first
  1003  next
  1004  clone
  1005  first
  1006  next
  1007  next
  1008  next
  1009  ----
  1010  pebble: snapshot excised before conversion to file-only snapshot
  1011  
  1012  iter
  1013  first
  1014  next
  1015  next
  1016  next
  1017  next
  1018  ----
  1019  a: (foo, .)
  1020  b: (bar, .)
  1021  c: (baz, .)
  1022  d: (foo, .)
  1023  f: (foobar, .)
  1024  
  1025  # The below example tests for a file-only snapshot that overlaps completely
  1026  # with an excise right after it. The wait succeeds and snapshot consistency is
  1027  # maintained.
  1028  
  1029  reset
  1030  ----
  1031  
  1032  switch 1
  1033  ----
  1034  ok
  1035  
  1036  batch
  1037  set a foo
  1038  set b bar
  1039  set c baz
  1040  ----
  1041  
  1042  flush
  1043  ----
  1044  
  1045  compact a-z
  1046  ----
  1047  ok
  1048  
  1049  switch 2
  1050  ----
  1051  ok
  1052  
  1053  batch
  1054  set d foobar
  1055  ----
  1056  
  1057  file-only-snapshot s4
  1058   b e
  1059  ----
  1060  ok
  1061  
  1062  iter snapshot=s4
  1063  first
  1064  next
  1065  next
  1066  ----
  1067  d: (foobar, .)
  1068  .
  1069  .
  1070  
  1071  replicate 1 2 b e
  1072  ----
  1073  replicated 1 shared SSTs
  1074  
  1075  wait-for-file-only-snapshot s4
  1076  ----
  1077  ok
  1078  
  1079  iter snapshot=s4
  1080  first
  1081  next
  1082  next
  1083  ----
  1084  d: (foobar, .)
  1085  .
  1086  .
  1087  
  1088  compact a-z
  1089  ----
  1090  ok
  1091  
  1092  iter snapshot=s4
  1093  first
  1094  next
  1095  next
  1096  ----
  1097  d: (foobar, .)
  1098  .
  1099  .
  1100  
  1101  iter
  1102  first
  1103  next
  1104  next
  1105  ----
  1106  b: (bar, .)
  1107  c: (baz, .)
  1108  .