github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/testdata/compaction_iter_delete_sized (about)

     1  define
     2  a.SET.1:b
     3  ----
     4  
     5  iter
     6  first
     7  next
     8  ----
     9  a#1,1:b
    10  .
    11  
    12  define
    13  a.SET.2:c
    14  a.SET.1:b
    15  ----
    16  
    17  iter
    18  first
    19  next
    20  ----
    21  a#2,1:c
    22  .
    23  
    24  iter snapshots=0
    25  first
    26  next
    27  ----
    28  a#2,1:c
    29  .
    30  
    31  iter snapshots=1
    32  first
    33  next
    34  ----
    35  a#2,1:c
    36  .
    37  
    38  iter snapshots=2
    39  first
    40  next
    41  next
    42  ----
    43  a#2,1:c
    44  a#1,1:b
    45  .
    46  
    47  define
    48  a.DEL.2:
    49  a.SET.1:b
    50  ----
    51  
    52  iter
    53  first
    54  next
    55  ----
    56  a#2,0:
    57  .
    58  
    59  iter elide-tombstones=true
    60  first
    61  ----
    62  .
    63  
    64  iter elide-tombstones=true snapshots=2
    65  first
    66  next
    67  next
    68  ----
    69  a#2,0:
    70  a#1,1:b
    71  .
    72  
    73  iter elide-tombstones=true snapshots=1
    74  first
    75  next
    76  ----
    77  a#2,0:
    78  .
    79  
    80  define
    81  a.DEL.2:
    82  a.SET.1:b
    83  b.SET.3:c
    84  ----
    85  
    86  iter
    87  first
    88  next
    89  next
    90  ----
    91  a#2,0:
    92  b#3,1:c
    93  .
    94  
    95  iter snapshots=1
    96  first
    97  next
    98  next
    99  ----
   100  a#2,0:
   101  b#3,1:c
   102  .
   103  
   104  iter snapshots=2
   105  first
   106  next
   107  next
   108  next
   109  ----
   110  a#2,0:
   111  a#1,1:b
   112  b#3,1:c
   113  .
   114  
   115  define
   116  a.SET.1:a
   117  b.SET.2:b
   118  c.SET.3:c
   119  ----
   120  
   121  iter
   122  first
   123  next
   124  next
   125  next
   126  ----
   127  a#1,1:a
   128  b#2,1:b
   129  c#3,1:c
   130  .
   131  
   132  define
   133  a.MERGE.3:d
   134  a.MERGE.2:c
   135  a.SET.1:b
   136  b.MERGE.2:b
   137  b.MERGE.1:a
   138  ----
   139  
   140  iter
   141  first
   142  next
   143  next
   144  ----
   145  a#3,1:bcd[base]
   146  b#2,2:ab
   147  .
   148  
   149  iter snapshots=3 print-snapshot-pinned print-force-obsolete
   150  first
   151  next
   152  next
   153  next
   154  ----
   155  a#3,2:d (not pinned) (not force obsolete)
   156  a#2,1:bc[base] (pinned) (not force obsolete)
   157  b#2,2:ab (not pinned) (not force obsolete)
   158  .
   159  
   160  define
   161  a.SET.9:b
   162  a.DEL.8:
   163  a.SET.7:d
   164  a.DEL.6:
   165  a.SET.5:f
   166  ----
   167  
   168  iter
   169  first
   170  next
   171  ----
   172  a#9,18:b
   173  .
   174  
   175  iter snapshots=6
   176  first
   177  next
   178  next
   179  ----
   180  a#9,18:b
   181  a#5,1:f
   182  .
   183  
   184  iter snapshots=7
   185  first
   186  next
   187  next
   188  ----
   189  a#9,18:b
   190  a#6,0:
   191  .
   192  
   193  iter snapshots=8
   194  first
   195  next
   196  next
   197  ----
   198  a#9,18:b
   199  a#7,18:d
   200  .
   201  
   202  iter snapshots=9
   203  first
   204  next
   205  next
   206  ----
   207  a#9,1:b
   208  a#8,0:
   209  .
   210  
   211  iter snapshots=10
   212  first
   213  next
   214  ----
   215  a#9,18:b
   216  .
   217  
   218  iter snapshots=(5,6,7,8,9)
   219  first
   220  next
   221  next
   222  next
   223  next
   224  next
   225  ----
   226  a#9,1:b
   227  a#8,0:
   228  a#7,1:d
   229  a#6,0:
   230  a#5,1:f
   231  .
   232  
   233  define
   234  a.INVALID.2:b
   235  a.SET.1:c
   236  ----
   237  
   238  iter
   239  first
   240  ----
   241  err=invalid internal key kind: INVALID
   242  
   243  define
   244  a.SET.2:b
   245  a.INVALID.1:c
   246  ----
   247  
   248  iter
   249  first
   250  next
   251  ----
   252  a#2,18:b
   253  err=invalid internal key kind: INVALID
   254  
   255  define
   256  a.MERGE.2:b
   257  a.INVALID.1:c
   258  ----
   259  
   260  iter
   261  first
   262  next
   263  ----
   264  a#2,2:b
   265  err=invalid internal key kind: INVALID
   266  
   267  define
   268  a.INVALID.2:c
   269  a.RANGEDEL.1:d
   270  ----
   271  
   272  iter
   273  first
   274  tombstones
   275  ----
   276  err=invalid internal key kind: INVALID
   277  .
   278  
   279  define
   280  a.MERGE.2:b
   281  a.MERGE.1:c
   282  a.MERGE.0:d
   283  ----
   284  
   285  iter snapshots=(1,2) print-snapshot-pinned print-force-obsolete
   286  first
   287  next
   288  next
   289  next
   290  ----
   291  a#2,2:b (not pinned) (not force obsolete)
   292  a#1,2:c (pinned) (not force obsolete)
   293  a#0,2:d (pinned) (not force obsolete)
   294  .
   295  
   296  define
   297  a.SET.2:b
   298  a.RANGEDEL.1:c
   299  b.RANGEDEL.4:d
   300  b.SET.2:e
   301  c.SET.3:f
   302  ----
   303  
   304  iter
   305  first
   306  next
   307  next
   308  next
   309  tombstones
   310  ----
   311  a#2,18:b
   312  a#1,15:c
   313  b#4,15:d
   314  .
   315  a-b#1
   316  b-c#4
   317  c-d#4
   318  .
   319  
   320  iter snapshots=2
   321  first
   322  next
   323  next
   324  next
   325  tombstones
   326  ----
   327  a#2,1:b
   328  a#1,15:c
   329  b#4,15:d
   330  .
   331  a-b#1
   332  b-c#4
   333  b-c#1
   334  c-d#4
   335  .
   336  
   337  iter snapshots=3 print-snapshot-pinned print-force-obsolete
   338  first
   339  next
   340  next
   341  next
   342  next
   343  tombstones
   344  ----
   345  a#2,18:b (not pinned) (not force obsolete)
   346  a#1,15:c (not pinned) (not force obsolete)
   347  b#4,15:d (not pinned) (not force obsolete)
   348  b#2,1:e (pinned) (force obsolete)
   349  .
   350  a-b#1
   351  b-c#4
   352  b-c#1
   353  c-d#4
   354  .
   355  
   356  iter snapshots=4 print-snapshot-pinned print-force-obsolete
   357  first
   358  next
   359  next
   360  next
   361  next
   362  next
   363  tombstones
   364  ----
   365  a#2,18:b (not pinned) (not force obsolete)
   366  a#1,15:c (not pinned) (not force obsolete)
   367  b#4,15:d (not pinned) (not force obsolete)
   368  b#2,1:e (pinned) (force obsolete)
   369  c#3,1:f (pinned) (force obsolete)
   370  .
   371  a-b#1
   372  b-c#4
   373  b-c#1
   374  c-d#4
   375  .
   376  
   377  define
   378  a.RANGEDEL.3:e
   379  b.SET.4:b
   380  c.SET.3:c
   381  d.SET.2:d
   382  e.SET.1:e
   383  ----
   384  
   385  iter
   386  first
   387  next
   388  next
   389  next
   390  next
   391  tombstones
   392  ----
   393  a#3,15:e
   394  b#4,1:b
   395  c#3,1:c
   396  e#1,1:e
   397  .
   398  a-e#3
   399  .
   400  
   401  define
   402  a.RANGEDEL.3:e
   403  b.MERGE.4:b
   404  c.MERGE.3:c
   405  d.MERGE.2:d
   406  e.MERGE.1:e
   407  ----
   408  
   409  iter
   410  first
   411  next
   412  next
   413  next
   414  next
   415  tombstones
   416  ----
   417  a#3,15:e
   418  b#4,2:b
   419  c#3,2:c
   420  e#1,2:e
   421  .
   422  a-e#3
   423  .
   424  
   425  define
   426  a.RANGEDEL.3:c
   427  b.MERGE.5:e
   428  b.MERGE.4:d
   429  b.MERGE.2:c
   430  b.MERGE.1:b
   431  d.MERGE.5:c
   432  d.MERGE.4:b
   433  d.RANGEDEL.3:f
   434  d.MERGE.2:e
   435  d.MERGE.1:d
   436  ----
   437  
   438  iter
   439  first
   440  next
   441  next
   442  next
   443  next
   444  tombstones
   445  ----
   446  a#3,15:c
   447  b#5,2:de
   448  d#5,2:bc
   449  d#3,15:f
   450  .
   451  a-c#3
   452  d-f#3
   453  .
   454  
   455  define
   456  a.RANGEDEL.3:d
   457  b.RANGEDEL.2:e
   458  c.RANGEDEL.1:f
   459  ----
   460  
   461  iter
   462  first
   463  next
   464  next
   465  next
   466  tombstones
   467  ----
   468  a#3,15:d
   469  b#2,15:e
   470  c#1,15:f
   471  .
   472  a-b#3
   473  b-c#3
   474  c-d#3
   475  d-e#2
   476  e-f#1
   477  .
   478  
   479  iter snapshots=2
   480  first
   481  next
   482  next
   483  next
   484  tombstones
   485  ----
   486  a#3,15:d
   487  b#2,15:e
   488  c#1,15:f
   489  .
   490  a-b#3
   491  b-c#3
   492  c-d#3
   493  c-d#1
   494  d-e#2
   495  d-e#1
   496  e-f#1
   497  .
   498  
   499  iter snapshots=3
   500  first
   501  next
   502  next
   503  next
   504  tombstones
   505  ----
   506  a#3,15:d
   507  b#2,15:e
   508  c#1,15:f
   509  .
   510  a-b#3
   511  b-c#3
   512  b-c#2
   513  c-d#3
   514  c-d#2
   515  d-e#2
   516  e-f#1
   517  .
   518  
   519  iter snapshots=(2,3)
   520  first
   521  next
   522  next
   523  next
   524  tombstones
   525  ----
   526  a#3,15:d
   527  b#2,15:e
   528  c#1,15:f
   529  .
   530  a-b#3
   531  b-c#3
   532  b-c#2
   533  c-d#3
   534  c-d#2
   535  c-d#1
   536  d-e#2
   537  d-e#1
   538  e-f#1
   539  .
   540  
   541  define
   542  a.RANGEDEL.10:k
   543  f.SET.9:f
   544  f.SET.8:f
   545  ----
   546  
   547  iter snapshots=(9,10) print-snapshot-pinned print-force-obsolete
   548  first
   549  next
   550  tombstones f
   551  next
   552  tombstones
   553  ----
   554  a#10,15:k (not pinned) (not force obsolete)
   555  f#9,1:f (pinned) (force obsolete)
   556  a-f#10
   557  .
   558  f#8,1:f (pinned) (force obsolete)
   559  f-k#10
   560  .
   561  
   562  define
   563  f.RANGEDEL.10:k
   564  f.SET.9:f
   565  f.SET.8:f
   566  ----
   567  
   568  iter snapshots=(9,10)
   569  first
   570  next
   571  tombstones f
   572  next
   573  tombstones
   574  ----
   575  f#10,15:k
   576  f#9,1:f
   577  .
   578  f#8,1:f
   579  f-k#10
   580  .
   581  
   582  define
   583  a.SET.1:a
   584  b.RANGEDEL.2:d
   585  c.RANGEDEL.3:e
   586  d.SET.4:d
   587  ----
   588  
   589  iter
   590  first
   591  next
   592  next
   593  next
   594  tombstones c
   595  tombstones
   596  ----
   597  a#1,1:a
   598  b#2,15:d
   599  c#3,15:e
   600  d#4,1:d
   601  b-c#2
   602  .
   603  c-d#3
   604  d-e#3
   605  .
   606  
   607  iter snapshots=3
   608  first
   609  next
   610  next
   611  next
   612  tombstones c
   613  tombstones
   614  ----
   615  a#1,1:a
   616  b#2,15:d
   617  c#3,15:e
   618  d#4,1:d
   619  b-c#2
   620  .
   621  c-d#3
   622  c-d#2
   623  d-e#3
   624  .
   625  
   626  define
   627  a.SET.1:a
   628  b.RANGEDEL.2:d
   629  c.SET.4:d
   630  ----
   631  
   632  iter
   633  first
   634  next
   635  next
   636  tombstones c
   637  tombstones
   638  ----
   639  a#1,1:a
   640  b#2,15:d
   641  c#4,1:d
   642  b-c#2
   643  .
   644  c-d#2
   645  .
   646  
   647  define
   648  a.RANGEDEL.2:d
   649  a.SET.2:a
   650  b.SET.2:b
   651  c.SET.2:c
   652  ----
   653  
   654  iter
   655  first
   656  next
   657  next
   658  next
   659  next
   660  ----
   661  a#2,15:d
   662  a#2,1:a
   663  b#2,1:b
   664  c#2,1:c
   665  .
   666  
   667  define
   668  a.SINGLEDEL.1:
   669  ----
   670  
   671  iter
   672  first
   673  next
   674  ----
   675  a#1,7:
   676  .
   677  
   678  iter elide-tombstones=true
   679  first
   680  ----
   681  .
   682  ineffectual-single-deletes: a
   683  
   684  define
   685  a.SINGLEDEL.2:
   686  a.SINGLEDEL.1:
   687  ----
   688  
   689  iter
   690  first
   691  next
   692  ----
   693  a#2,7:
   694  .
   695  ineffectual-single-deletes: a
   696  
   697  define
   698  a.SINGLEDEL.3:
   699  a.SINGLEDEL.2:
   700  a.SET.1:a
   701  ----
   702  
   703  iter
   704  first
   705  ----
   706  .
   707  ineffectual-single-deletes: a
   708  
   709  define
   710  a.SET.3:a
   711  b.SINGLEDEL.2:
   712  b.DEL.1:
   713  ----
   714  
   715  iter
   716  first
   717  next
   718  next
   719  ----
   720  a#3,1:a
   721  b#2,0:
   722  .
   723  ineffectual-single-deletes: b
   724  
   725  define
   726  a.SINGLEDEL.2:
   727  a.DEL.1:
   728  ----
   729  
   730  iter
   731  first
   732  next
   733  ----
   734  a#2,0:
   735  .
   736  ineffectual-single-deletes: a
   737  
   738  iter elide-tombstones=true
   739  first
   740  ----
   741  .
   742  ineffectual-single-deletes: a
   743  
   744  define
   745  a.SINGLEDEL.2:
   746  a.MERGE.1:
   747  ----
   748  
   749  iter
   750  first
   751  ----
   752  .
   753  
   754  iter elide-tombstones=true
   755  first
   756  ----
   757  .
   758  
   759  define
   760  a.SINGLEDEL.2:
   761  a.SET.1:b
   762  ----
   763  
   764  iter
   765  first
   766  ----
   767  .
   768  
   769  # SET that meets a SINGLEDEL is transformed into a SETWITHDEL.
   770  
   771  define
   772  a.SET.2:b
   773  a.SINGLEDEL.1:
   774  ----
   775  
   776  iter
   777  first
   778  next
   779  ----
   780  a#2,18:b
   781  .
   782  
   783  # We don't notice the ineffectual single delete since the SET causes all
   784  # SingleDelete error checking to be skipped.
   785  iter elide-tombstones=true
   786  first
   787  next
   788  ----
   789  a#2,18:b
   790  .
   791  
   792  define
   793  a.MERGE.6:b
   794  a.SINGLEDEL.5:
   795  a.SET.4:a
   796  ----
   797  
   798  iter
   799  first
   800  next
   801  ----
   802  a#6,18:b[base]
   803  .
   804  
   805  # Non-deterministic use of SINGLEDEL where there are two older SETs that have
   806  # not been deleted or single deleted. It is permitted to shadow both, since
   807  # MERGE turns into a SETWITHDELETE when it meets the SINGLEDEL.
   808  define
   809  a.MERGE.6:b
   810  a.SINGLEDEL.5:
   811  a.SET.4:a
   812  a.SET.3:a
   813  ----
   814  
   815  iter
   816  first
   817  next
   818  ----
   819  a#6,18:b[base]
   820  .
   821  
   822  define
   823  a.SINGLEDEL.2:
   824  a.SET.1:b
   825  b.SET.3:c
   826  ----
   827  
   828  iter
   829  first
   830  next
   831  ----
   832  b#3,1:c
   833  .
   834  
   835  define
   836  a.SINGLEDEL.3:
   837  a.SET.2:b
   838  a.SET.1:a
   839  ----
   840  
   841  iter
   842  first
   843  next
   844  ----
   845  a#1,1:a
   846  .
   847  invariant-violation-single-deletes: a
   848  
   849  define
   850  a.SINGLEDEL.3:
   851  a.MERGE.2:b
   852  a.MERGE.1:a
   853  ----
   854  
   855  # SINGLEDEL consumes the first MERGE.
   856  iter
   857  first
   858  next
   859  ----
   860  a#1,2:a
   861  .
   862  invariant-violation-single-deletes: a
   863  
   864  define
   865  a.SINGLEDEL.4:
   866  a.SET.3:val
   867  a.SINGLEDEL.2:
   868  a.SET.1:val
   869  ----
   870  
   871  iter
   872  first
   873  ----
   874  .
   875  
   876  iter snapshots=2
   877  first
   878  next
   879  next
   880  ----
   881  a#2,7:
   882  a#1,1:val
   883  .
   884  
   885  define
   886  a.SINGLEDEL.4:
   887  a.SET.3:val
   888  a.DEL.2:
   889  a.SET.1:val
   890  ----
   891  
   892  iter
   893  first
   894  next
   895  ----
   896  a#2,0:
   897  .
   898  
   899  iter snapshots=2
   900  first
   901  next
   902  next
   903  ----
   904  a#2,0:
   905  a#1,1:val
   906  .
   907  
   908  iter snapshots=3
   909  first
   910  next
   911  ----
   912  a#2,0:
   913  .
   914  
   915  iter snapshots=(2,3)
   916  first
   917  next
   918  next
   919  ----
   920  a#2,0:
   921  a#1,1:val
   922  .
   923  
   924  define
   925  a.SINGLEDEL.4:
   926  a.SET.3:c
   927  a.MERGE.2:b
   928  a.SET.1:a
   929  ----
   930  
   931  iter
   932  first
   933  next
   934  ----
   935  a#2,1:ab[base]
   936  .
   937  invariant-violation-single-deletes: a
   938  
   939  iter snapshots=2
   940  first
   941  next
   942  next
   943  ----
   944  a#2,2:b
   945  a#1,1:a
   946  .
   947  invariant-violation-single-deletes: a
   948  
   949  iter snapshots=3
   950  first
   951  next
   952  ----
   953  a#2,1:ab[base]
   954  .
   955  invariant-violation-single-deletes: a
   956  
   957  iter snapshots=(2,3,4)
   958  first
   959  next
   960  next
   961  next
   962  next
   963  ----
   964  a#4,7:
   965  a#3,1:c
   966  a#2,2:b
   967  a#1,1:a
   968  .
   969  
   970  define
   971  a.SINGLEDEL.3:
   972  a.RANGEDEL.2:c
   973  a.SET.1:val
   974  ----
   975  
   976  iter
   977  first
   978  next
   979  next
   980  tombstones
   981  ----
   982  a#3,7:
   983  a#2,15:c
   984  .
   985  a-c#2
   986  .
   987  
   988  define
   989  a.RANGEDEL.3:d
   990  a.DEL.2:
   991  a.SET.1:a
   992  d.DEL.2:
   993  ----
   994  
   995  iter
   996  first
   997  next
   998  next
   999  tombstones
  1000  ----
  1001  a#3,15:d
  1002  d#2,0:
  1003  .
  1004  a-d#3
  1005  .
  1006  
  1007  iter snapshots=3
  1008  first
  1009  next
  1010  next
  1011  next
  1012  ----
  1013  a#3,15:d
  1014  a#2,0:
  1015  d#2,0:
  1016  .
  1017  
  1018  iter snapshots=2
  1019  first
  1020  next
  1021  next
  1022  next
  1023  ----
  1024  a#3,15:d
  1025  a#1,1:a
  1026  d#2,0:
  1027  .
  1028  
  1029  iter snapshots=1
  1030  first
  1031  next
  1032  next
  1033  ----
  1034  a#3,15:d
  1035  d#2,0:
  1036  .
  1037  
  1038  define
  1039  a.MERGE.2:a
  1040  b.RANGEDEL.1:c
  1041  ----
  1042  
  1043  iter
  1044  first
  1045  tombstones a
  1046  next
  1047  next
  1048  tombstones
  1049  ----
  1050  a#2,2:a
  1051  .
  1052  b#1,15:c
  1053  .
  1054  b-c#1
  1055  .
  1056  
  1057  define
  1058  a.MERGE.2:v2
  1059  a.RANGEDEL.1:b
  1060  a.MERGE.1:v1
  1061  ----
  1062  
  1063  iter allow-zero-seqnum=true
  1064  first
  1065  next
  1066  next
  1067  next
  1068  tombstones
  1069  ----
  1070  a#2,2:v2
  1071  a#1,15:b
  1072  a#0,2:v1
  1073  .
  1074  a-b#1
  1075  .
  1076  
  1077  # Verify that we transform merge+del -> set.
  1078  
  1079  define
  1080  a.MERGE.5:5
  1081  a.DEL.3:
  1082  a.MERGE.1:1
  1083  ----
  1084  
  1085  iter
  1086  first
  1087  next
  1088  ----
  1089  a#5,18:5[base]
  1090  .
  1091  
  1092  iter allow-zero-seqnum=true
  1093  first
  1094  next
  1095  ----
  1096  a#0,18:5[base]
  1097  .
  1098  
  1099  iter elide-tombstones=true
  1100  first
  1101  next
  1102  ----
  1103  a#5,18:5[base]
  1104  .
  1105  
  1106  iter snapshots=2
  1107  first
  1108  next
  1109  next
  1110  ----
  1111  a#5,18:5[base]
  1112  a#1,2:1
  1113  .
  1114  
  1115  iter snapshots=2 elide-tombstones=true
  1116  first
  1117  next
  1118  next
  1119  ----
  1120  a#5,18:5[base]
  1121  a#1,2:1
  1122  .
  1123  
  1124  # Verify that merge+rangedel -> merge.
  1125  
  1126  define
  1127  a.RANGEDEL.3:c
  1128  b.MERGE.5:5
  1129  b.SET.2:2
  1130  b.MERGE.1:1
  1131  ----
  1132  
  1133  iter
  1134  first
  1135  next
  1136  next
  1137  ----
  1138  a#3,15:c
  1139  b#5,2:5
  1140  .
  1141  
  1142  iter allow-zero-seqnum=true
  1143  first
  1144  next
  1145  next
  1146  ----
  1147  a#3,15:c
  1148  b#0,2:5
  1149  .
  1150  
  1151  iter snapshots=2
  1152  first
  1153  next
  1154  next
  1155  ----
  1156  a#3,15:c
  1157  b#5,2:5
  1158  b#1,2:1
  1159  
  1160  define
  1161  a.RANGEDEL.3:c
  1162  b.MERGE.5:5
  1163  b.MERGE.2:2
  1164  b.MERGE.1:1
  1165  ----
  1166  
  1167  iter
  1168  first
  1169  next
  1170  next
  1171  ----
  1172  a#3,15:c
  1173  b#5,2:5
  1174  .
  1175  
  1176  iter snapshots=2
  1177  first
  1178  next
  1179  next
  1180  ----
  1181  a#3,15:c
  1182  b#5,2:5
  1183  b#1,2:1
  1184  
  1185  # SET that meets a DEL is transformed into a SETWITHDEL.
  1186  
  1187  define
  1188  a.SET.2:b
  1189  a.DEL.1:
  1190  ----
  1191  
  1192  iter
  1193  first
  1194  next
  1195  ----
  1196  a#2,18:b
  1197  .
  1198  
  1199  iter snapshots=2
  1200  first
  1201  next
  1202  next
  1203  ----
  1204  a#2,1:b
  1205  a#1,0:
  1206  .
  1207  
  1208  define
  1209  a.SET.3:c
  1210  a.DEL.2:
  1211  a.SET.1:b
  1212  ----
  1213  
  1214  iter
  1215  first
  1216  next
  1217  ----
  1218  a#3,18:c
  1219  .
  1220  
  1221  iter snapshots=2
  1222  first
  1223  next
  1224  next
  1225  ----
  1226  a#3,18:c
  1227  a#1,1:b
  1228  .
  1229  
  1230  define
  1231  a.SET.3:c
  1232  a.SET.2:b
  1233  a.DEL.1:
  1234  ----
  1235  
  1236  iter
  1237  first
  1238  next
  1239  ----
  1240  a#3,18:c
  1241  .
  1242  
  1243  iter snapshots=3
  1244  first
  1245  next
  1246  next
  1247  ----
  1248  a#3,1:c
  1249  a#2,18:b
  1250  .
  1251  
  1252  iter snapshots=2
  1253  first
  1254  next
  1255  next
  1256  ----
  1257  a#3,1:c
  1258  a#1,0:
  1259  .
  1260  
  1261  define
  1262  a.DEL.3:
  1263  a.SET.2:b
  1264  a.DEL.1:
  1265  ----
  1266  
  1267  iter
  1268  first
  1269  next
  1270  ----
  1271  a#3,0:
  1272  .
  1273  
  1274  iter snapshots=3
  1275  first
  1276  next
  1277  next
  1278  ----
  1279  a#3,0:
  1280  a#2,18:b
  1281  .
  1282  
  1283  iter snapshots=2
  1284  first
  1285  next
  1286  next
  1287  ----
  1288  a#3,0:
  1289  a#1,0:
  1290  .
  1291  
  1292  # SETWITHDEL-eligible entries at or under a RANGEDEL at the same user key should
  1293  # be skipped.
  1294  define
  1295  a.SET.3:c
  1296  a.RANGEDEL.2:z
  1297  a.SET.2:b
  1298  a.DEL.1:
  1299  ----
  1300  
  1301  iter allow-zero-seqnum=true
  1302  first
  1303  next
  1304  next
  1305  ----
  1306  a#0,18:c
  1307  a#2,15:z
  1308  .
  1309  
  1310  iter allow-zero-seqnum=true snapshots=3
  1311  first
  1312  next
  1313  next
  1314  next
  1315  ----
  1316  a#3,1:c
  1317  a#2,15:z
  1318  a#0,1:b
  1319  .
  1320  
  1321  iter allow-zero-seqnum=true snapshots=2
  1322  first
  1323  next
  1324  next
  1325  next
  1326  ----
  1327  a#3,18:c
  1328  a#2,15:z
  1329  a#1,0:
  1330  .
  1331  
  1332  define
  1333  a.SET.4:c
  1334  a.RANGEDEL.3:z
  1335  a.SET.2:b
  1336  a.DEL.1:
  1337  ----
  1338  
  1339  iter
  1340  first
  1341  next
  1342  next
  1343  ----
  1344  a#4,18:c
  1345  a#3,15:z
  1346  .
  1347  
  1348  # Invalid keys are emitted under SETWITHDEL.
  1349  
  1350  define
  1351  a.SET.2:b
  1352  a.INVALID.1:
  1353  ----
  1354  
  1355  iter
  1356  first
  1357  next
  1358  ----
  1359  a#2,18:b
  1360  err=invalid internal key kind: INVALID
  1361  
  1362  define
  1363  a.SET.3:c
  1364  a.INVALID.2:
  1365  a.SET.1:b
  1366  ----
  1367  
  1368  iter
  1369  first
  1370  next
  1371  ----
  1372  a#3,18:c
  1373  err=invalid internal key kind: INVALID
  1374  
  1375  # SINGLEDEL that meets a SETWITHDEL is transformed into a DEL.
  1376  
  1377  define
  1378  a.SINGLEDEL.3:
  1379  a.SETWITHDEL.2:d
  1380  b.SET.1:c
  1381  ----
  1382  
  1383  iter
  1384  first
  1385  next
  1386  next
  1387  ----
  1388  a#3,0:
  1389  b#1,1:c
  1390  .
  1391  
  1392  iter snapshots=2
  1393  first
  1394  next
  1395  next
  1396  ----
  1397  a#3,0:
  1398  b#1,1:c
  1399  .
  1400  
  1401  iter snapshots=3
  1402  first
  1403  next
  1404  next
  1405  next
  1406  ----
  1407  a#3,7:
  1408  a#2,18:d
  1409  b#1,1:c
  1410  .
  1411  
  1412  define
  1413  a.SETWITHDEL.3:3
  1414  a.SET.2:d
  1415  b.SET.1:c
  1416  ----
  1417  
  1418  iter print-missized-dels
  1419  first
  1420  next
  1421  next
  1422  ----
  1423  a#3,18:3
  1424  b#1,1:c
  1425  .
  1426  missized-dels=0
  1427  
  1428  iter snapshots=3
  1429  first
  1430  next
  1431  next
  1432  next
  1433  ----
  1434  a#3,18:3
  1435  a#2,1:d
  1436  b#1,1:c
  1437  .
  1438  
  1439  # Test a DELSIZED whose encoded value matches the size of a deleted key. The
  1440  # DELSIZED's value should be removed, reflecting that the tombstone already
  1441  # dropped the key that it was expected to drop.
  1442  
  1443  define
  1444  a.SET.9:foo
  1445  b.DELSIZED.8:varint(11)
  1446  b.SET.5:helloworld
  1447  c.SET.2:bar
  1448  ----
  1449  
  1450  iter print-missized-dels
  1451  first
  1452  next
  1453  next
  1454  ----
  1455  a#9,1:foo
  1456  b#8,23:
  1457  c#2,1:bar
  1458  missized-dels=0
  1459  
  1460  # Test two DELSIZEDs meeting. The lower-sequenced number value should carry
  1461  # forward, at the higher sequence number. The first DELSIZED should be consider
  1462  # missized: It never found the key it was supposed to delete.
  1463  
  1464  define
  1465  a.SET.9:foo
  1466  b.DELSIZED.9:varint(20)
  1467  b.DELSIZED.8:varint(10)
  1468  c.SET.2:bar
  1469  ----
  1470  
  1471  iter print-missized-dels
  1472  first
  1473  next
  1474  next
  1475  ----
  1476  a#9,1:foo
  1477  b#9,23:varint(10)
  1478  c#2,1:bar
  1479  missized-dels=1
  1480  
  1481  # Test a DELSIZED whose encoded value is larger than the size of the deleted
  1482  # key. The DELSIZED should be replaced by an ordinary DEL with the same sequence
  1483  # number.
  1484  
  1485  define
  1486  a.SET.2:foo
  1487  b.DELSIZED.8:varint(25)
  1488  b.SET.3:hello
  1489  c.SET.9:bar
  1490  ----
  1491  
  1492  iter print-missized-dels
  1493  first
  1494  next
  1495  next
  1496  ----
  1497  a#2,1:foo
  1498  b#8,0:
  1499  c#9,1:bar
  1500  missized-dels=1
  1501  
  1502  # Test two DELSIZED at the same user key, but with correctly sized deleted keys.
  1503  
  1504  define
  1505  a.DELSIZED.9:varint(4)
  1506  a.SET.8:foo
  1507  a.DELSIZED.8:varint(6)
  1508  a.SET.5:hello
  1509  ----
  1510  
  1511  iter print-missized-dels
  1512  first
  1513  next
  1514  ----
  1515  a#9,23:
  1516  .
  1517  missized-dels=0
  1518  
  1519  # Test the above scenario, except the second DELSIZED is missized. It should
  1520  # still count as missized.
  1521  
  1522  define
  1523  a.DELSIZED.9:varint(4)
  1524  a.SET.8:foo
  1525  a.DELSIZED.8:varint(1)
  1526  a.SET.5:hello
  1527  ----
  1528  
  1529  iter print-missized-dels
  1530  first
  1531  next
  1532  ----
  1533  a#9,0:
  1534  .
  1535  missized-dels=1
  1536  
  1537  # Test the above scenario, except the second tombstone is a DEL. It should
  1538  # NOT count as missized.
  1539  
  1540  define
  1541  a.DELSIZED.9:varint(4)
  1542  a.SET.8:foo
  1543  a.DEL.8:
  1544  a.SET.5:hello
  1545  ----
  1546  
  1547  iter print-missized-dels
  1548  first
  1549  next
  1550  ----
  1551  a#9,0:
  1552  .
  1553  missized-dels=0
  1554  
  1555  # Test various DELSIZEDs beneath live keys. SETS should be converted to
  1556  # SETWITHDELs when they meet a DELSIZED.
  1557  
  1558  define
  1559  a.SET.7:foo
  1560  a.DELSIZED.5:varint(5)
  1561  b.SET.4:bar
  1562  b.DELSIZED.2:varint(4)
  1563  b.SET.1:bax
  1564  c.SET.9:coconut
  1565  c.DEL.8:del
  1566  c.DELSIZED.5:varint(2)
  1567  d.SET.8:dragonfruit
  1568  ----
  1569  
  1570  iter print-missized-dels
  1571  first
  1572  next
  1573  next
  1574  next
  1575  next
  1576  ----
  1577  a#7,18:foo
  1578  b#4,18:bar
  1579  c#9,18:coconut
  1580  d#8,1:dragonfruit
  1581  .
  1582  missized-dels=0
  1583  
  1584  # Test a DELSIZED meeting a MERGE. This counts as a missized DEL—The user can't
  1585  # know the value of the most recent MERGE since it's dependent on LSM state.
  1586  
  1587  define
  1588  a.DELSIZED.9:varint(4)
  1589  a.MERGE.8:fo
  1590  a.MERGE.7:o
  1591  ----
  1592  
  1593  iter print-missized-dels
  1594  first
  1595  next
  1596  ----
  1597  a#9,0:
  1598  .
  1599  missized-dels=1
  1600  
  1601  # Test a DELSIZED that shadows a SINGLEDEL'd key.
  1602  
  1603  define
  1604  a.DELSIZED.4:varint(4)
  1605  b.SINGLEDEL.3:
  1606  b.SET.1:val
  1607  ----
  1608  
  1609  iter
  1610  first
  1611  next
  1612  tombstones
  1613  ----
  1614  a#4,23:varint(4)
  1615  .
  1616  .
  1617  
  1618  # Repeat the above but with elision of tombstones.
  1619  
  1620  iter elide-tombstones=t
  1621  first
  1622  tombstones
  1623  ----
  1624  .
  1625  .
  1626  
  1627  # Test DELSIZED shadowing SINGLEDEL.
  1628  
  1629  define
  1630  a.DELSIZED.4:varint(4)
  1631  a.SET.2:foo
  1632  b.SINGLEDEL.3:
  1633  b.SET.1:val
  1634  ----
  1635  
  1636  iter
  1637  first
  1638  next
  1639  tombstones
  1640  ----
  1641  a#4,23:
  1642  .
  1643  .
  1644  
  1645  # Repeat the above but with elision of tombstones.
  1646  
  1647  iter elide-tombstones=t
  1648  first
  1649  tombstones
  1650  ----
  1651  .
  1652  .
  1653  
  1654  # Test a very subtle sequence where a elision of tombstones is active, and a
  1655  # unskippable RANGEDEL sits between a DELSIZED and the key it was intended to
  1656  # delete. The unskippable RANGEDEL breaks the skipping of keys within the
  1657  # snapshot stripe, but it's ultimately okay because we preserve skip=true across
  1658  # the RANGEDEL return.
  1659  
  1660  define
  1661  a.DELSIZED.5:varint(4)
  1662  a.RANGEDEL.4:d
  1663  a.SET.3:foo
  1664  ----
  1665  
  1666  iter elide-tombstones=t
  1667  first
  1668  next
  1669  tombstones
  1670  ----
  1671  a#4,15:d
  1672  .
  1673  .
  1674  
  1675  # Try the same test as above, but with allowing sequence number zeroing as well.
  1676  
  1677  iter elide-tombstones=t allow-zero-seqnum=t
  1678  first
  1679  next
  1680  tombstones
  1681  ----
  1682  a#4,15:d
  1683  .
  1684  .
  1685  
  1686  # Perform a variant of the above test but with a DEL key.
  1687  
  1688  define
  1689  a.DEL.5:
  1690  a.RANGEDEL.4:d
  1691  a.SET.3:foo
  1692  ----
  1693  
  1694  iter elide-tombstones=t
  1695  first
  1696  next
  1697  tombstones
  1698  ----
  1699  a#4,15:d
  1700  .
  1701  .
  1702  
  1703  # Perform a variant of the above test but with a SINGLEDEL key.
  1704  
  1705  define
  1706  a.SINGLEDEL.5:
  1707  a.RANGEDEL.4:d
  1708  a.SET.3:foo
  1709  ----
  1710  
  1711  iter elide-tombstones=t
  1712  first
  1713  next
  1714  tombstones
  1715  ----
  1716  a#4,15:d
  1717  .
  1718  .
  1719  
  1720  # Perform a few variants of the above but with a range del with a seqnum equal to
  1721  # keys. NB: When seqnums are equal, the order of keys with various kinds is:
  1722  #
  1723  # DeleteSized < RangeKey{Delete,Unset,Set} < SetWithDelete < RangeDelete < SingleDelete < Set < Delete
  1724  #
  1725  # NB: Range keys are interleaved always at the maximal sequence number, so the
  1726  # compaction iterator should always observe them first.
  1727  
  1728  define
  1729  a.SINGLEDEL.6:
  1730  a.SETWITHDEL.5:foo
  1731  a.RANGEDEL.5:z
  1732  ----
  1733  
  1734  define-range-keys
  1735  a-z:{(#5,RANGEKEYDEL)}
  1736  ----
  1737  
  1738  # In the following case, the SINGLEDEL meets a SETWITHDEL, promoting the
  1739  # SINGLEDEL into a DEL.
  1740  
  1741  iter
  1742  first
  1743  next
  1744  next
  1745  next
  1746  tombstones
  1747  ----
  1748  a#72057594037927935,19:
  1749  a#6,0:
  1750  a#5,15:z
  1751  .
  1752  a-z#5
  1753  .
  1754  
  1755  # In this case, SINGLEDEL is elided (despite its transformation into a DEL) due
  1756  # to elide-tombstones=t.
  1757  
  1758  iter elide-tombstones=t
  1759  first
  1760  next
  1761  next
  1762  tombstones
  1763  ----
  1764  a#72057594037927935,19:
  1765  a#5,15:z
  1766  .
  1767  .
  1768  
  1769  define
  1770  a.SINGLEDEL.6:
  1771  a.RANGEDEL.5:d
  1772  a.SET.5:foo
  1773  ----
  1774  
  1775  # NB: In this case, the RANGEDEL acts as an unintentional snapshot stripe
  1776  # change. This is a code artifact, and we will be able to remove this behavior
  1777  # when range deletes are interleaved at the maximal sequence number by an
  1778  # interleaving iterator (like range keys are).
  1779  
  1780  iter
  1781  first
  1782  next
  1783  next
  1784  next
  1785  tombstones
  1786  ----
  1787  a#6,7:
  1788  a#5,15:d
  1789  a#5,1:foo
  1790  .
  1791  a-d#5
  1792  .
  1793  
  1794  iter elide-tombstones=t allow-zero-seqnum=t
  1795  first
  1796  next
  1797  tombstones
  1798  ----
  1799  a#5,15:d
  1800  .
  1801  .
  1802  
  1803  define
  1804  a.SINGLEDEL.6:
  1805  a.SET.5:foo
  1806  a.RANGEDEL.4:d
  1807  a.SET.4:bar
  1808  ----
  1809  
  1810  # The SINGLEDEL invariant checking can't see past the RANGEDEL and see that
  1811  # the a.SET.4 violates the invariant. This is a code artifact that will be
  1812  # improved when range deletes are interleaved at the maximal sequence number.
  1813  iter
  1814  first
  1815  next
  1816  next
  1817  ----
  1818  a#4,15:d
  1819  a#4,1:bar
  1820  .
  1821  
  1822  define
  1823  a.SINGLEDEL.6:
  1824  a.SETWITHDEL.5:foo
  1825  a.RANGEDEL.5:d
  1826  ----
  1827  
  1828  # When the SINGLEDEL and SETWITHDEL meet, the SINGLEDEL is promoted into a DEL.
  1829  
  1830  iter
  1831  first
  1832  next
  1833  tombstones
  1834  ----
  1835  a#6,0:
  1836  a#5,15:d
  1837  a-d#5
  1838  .
  1839  
  1840  iter elide-tombstones=t
  1841  first
  1842  next
  1843  tombstones
  1844  ----
  1845  a#5,15:d
  1846  .
  1847  .
  1848  
  1849  define
  1850  a.DELSIZED.6:varint(3)
  1851  a.RANGEDEL.5:d
  1852  a.SET.5:foo
  1853  ----
  1854  
  1855  iter
  1856  first
  1857  next
  1858  tombstones
  1859  ----
  1860  a#6,23:varint(3)
  1861  a#5,15:d
  1862  a-d#5
  1863  .
  1864  
  1865  iter elide-tombstones=t
  1866  first
  1867  next
  1868  tombstones
  1869  ----
  1870  a#5,15:d
  1871  .
  1872  .
  1873  
  1874  # Test a DELSIZED with a value that fails to decode.
  1875  
  1876  define
  1877  a.DELSIZED.5:notavarint
  1878  a.SET.4:foo
  1879  ----
  1880  
  1881  iter
  1882  first
  1883  ----
  1884  err=DELSIZED holds invalid value: 6e6f7461766172696e74
  1885  
  1886  # Test a value-less DELSIZED.
  1887  
  1888  define
  1889  a.DELSIZED.5:
  1890  a.SET.4:foo
  1891  a.SET.3:bar
  1892  ----
  1893  
  1894  iter print-missized-dels
  1895  first
  1896  next
  1897  ----
  1898  a#5,0:
  1899  .
  1900  missized-dels=0
  1901  
  1902  # Regression test for #3087.
  1903  #
  1904  # When a DELSIZED and a SINGLEDEL meet in a compaction, a DEL key should be
  1905  # emitted.
  1906  
  1907  define
  1908  a.DELSIZED.5:
  1909  a.SINGLEDEL.3:
  1910  a.SET.2:foo
  1911  a.SET.1:bar
  1912  ----
  1913  
  1914  iter
  1915  first
  1916  next
  1917  ----
  1918  a#5,0:
  1919  .
  1920  
  1921  # When a MERGE and a DEL[SIZED] meet in a compaction, a SETWITHDEL key (NOT a
  1922  # SET) should be emitted. Otherwise, a sequence such as SINGLEDDEL, MERGE, DEL,
  1923  # SET could result in the SET re-appearing.
  1924  
  1925  define
  1926  a.MERGE.5:foo
  1927  a.DEL.3:
  1928  ----
  1929  
  1930  iter
  1931  first
  1932  next
  1933  ----
  1934  a#5,18:foo[base]
  1935  .
  1936  
  1937  define
  1938  a.SINGLEDEL.4:
  1939  a.MERGE.3:a3
  1940  a.SET.2:a2
  1941  b.SINGLEDEL.6:
  1942  b.SET.5:b5
  1943  b.SETWITHDEL.4:b4
  1944  ----
  1945  
  1946  iter
  1947  first
  1948  next
  1949  next
  1950  ----
  1951  a#2,1:a2
  1952  b#4,18:b4
  1953  .
  1954  invariant-violation-single-deletes: a,b