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

     1  build
     2  a.SET.1:A
     3  b.SET.2:B
     4  c.SET.3:C
     5  d.SET.4:D
     6  ----
     7  
     8  iter
     9  first
    10  next
    11  next
    12  next
    13  next
    14  ----
    15  <a:1>:A
    16  <b:2>:B
    17  <c:3>:C
    18  <d:4>:D
    19  .
    20  
    21  iter
    22  seek-ge a
    23  next
    24  next
    25  next
    26  next
    27  ----
    28  <a:1>:A
    29  <b:2>:B
    30  <c:3>:C
    31  <d:4>:D
    32  .
    33  
    34  iter
    35  seek-ge b
    36  next
    37  next
    38  next
    39  ----
    40  <b:2>:B
    41  <c:3>:C
    42  <d:4>:D
    43  .
    44  
    45  iter
    46  seek-ge c
    47  next
    48  next
    49  ----
    50  <c:3>:C
    51  <d:4>:D
    52  .
    53  
    54  iter
    55  seek-ge d
    56  next
    57  ----
    58  <d:4>:D
    59  .
    60  
    61  iter
    62  seek-ge e
    63  ----
    64  .
    65  
    66  iter
    67  seek-ge d
    68  seek-ge z
    69  ----
    70  <d:4>:D
    71  .
    72  
    73  iter
    74  seek-ge b
    75  seek-ge c
    76  seek-ge d
    77  seek-ge e
    78  ----
    79  <b:2>:B
    80  <c:3>:C
    81  <d:4>:D
    82  .
    83  
    84  iter
    85  last
    86  prev
    87  prev
    88  prev
    89  prev
    90  ----
    91  <d:4>:D
    92  <c:3>:C
    93  <b:2>:B
    94  <a:1>:A
    95  .
    96  
    97  iter
    98  seek-lt e
    99  prev
   100  prev
   101  prev
   102  prev
   103  ----
   104  <d:4>:D
   105  <c:3>:C
   106  <b:2>:B
   107  <a:1>:A
   108  .
   109  
   110  iter
   111  seek-lt d
   112  prev
   113  prev
   114  prev
   115  ----
   116  <c:3>:C
   117  <b:2>:B
   118  <a:1>:A
   119  .
   120  
   121  iter
   122  seek-lt c
   123  prev
   124  prev
   125  ----
   126  <b:2>:B
   127  <a:1>:A
   128  .
   129  
   130  iter
   131  seek-lt b
   132  prev
   133  ----
   134  <a:1>:A
   135  .
   136  
   137  iter
   138  seek-lt a
   139  ----
   140  .
   141  
   142  iter
   143  seek-lt d
   144  seek-lt c
   145  seek-lt b
   146  seek-lt a
   147  ----
   148  <c:3>:C
   149  <b:2>:B
   150  <a:1>:A
   151  .
   152  
   153  iter globalSeqNum=1
   154  first
   155  next
   156  next
   157  next
   158  next
   159  ----
   160  <a:1>:A
   161  <b:1>:B
   162  <c:1>:C
   163  <d:1>:D
   164  .
   165  
   166  iter globalSeqNum=10
   167  first
   168  next
   169  next
   170  next
   171  next
   172  ----
   173  <a:10>:A
   174  <b:10>:B
   175  <c:10>:C
   176  <d:10>:D
   177  .
   178  
   179  iter globalSeqNum=0
   180  seek-lt x
   181  ----
   182  <d:4>:D
   183  
   184  get
   185  b
   186  a
   187  f
   188  d
   189  c
   190  ----
   191  B
   192  A
   193  <err: pebble: not found>
   194  D
   195  C
   196  
   197  # Verify that clearing the bounds on an iterator also clears
   198  # previously set block{Lower,Upper}.
   199  
   200  iter
   201  seek-ge c
   202  seek-lt b
   203  set-bounds lower=b upper=c
   204  seek-ge c
   205  seek-lt b
   206  set-bounds lower= upper=
   207  seek-ge c
   208  seek-lt b
   209  ----
   210  <c:3>:C
   211  <a:1>:A
   212  .
   213  .
   214  .
   215  .
   216  <c:3>:C
   217  <a:1>:A
   218  
   219  # Verify that seeking past the end of the sstable leaves the iterator
   220  # in a state where prev returns the last key in the table.
   221  
   222  iter
   223  seek-lt d
   224  seek-ge f
   225  prev
   226  ----
   227  <c:3>:C
   228  .
   229  <d:4>:D
   230  
   231  # Verify that seeking before the beginning of the sstable leaves the
   232  # iterator in a state where next returns the first key in the table.
   233  
   234  iter
   235  seek-ge b
   236  seek-lt a
   237  next
   238  ----
   239  <b:2>:B
   240  .
   241  <a:1>:A
   242  
   243  
   244  # Verify the optimization to use next when doing SeekGE.
   245  
   246  iter
   247  seek-ge a false
   248  seek-ge a true
   249  seek-ge b true
   250  seek-ge c true
   251  seek-ge d true
   252  seek-ge e true
   253  ----
   254  <a:1>:A
   255  <a:1>:A
   256  <b:2>:B
   257  <c:3>:C
   258  <d:4>:D
   259  .
   260  
   261  # Verify the optimization to use next when doing SeekPrefixGE.
   262  
   263  iter
   264  seek-prefix-ge a false
   265  seek-prefix-ge a true
   266  seek-prefix-ge b true
   267  seek-prefix-ge c true
   268  seek-prefix-ge d true
   269  seek-prefix-ge e true
   270  ----
   271  <a:1>:A
   272  <a:1>:A
   273  <b:2>:B
   274  <c:3>:C
   275  <d:4>:D
   276  .
   277  
   278  # Verify that iteration from before the beginning or after the end of
   279  # the sstable does not "wrap around". A bug previously allowed this to
   280  # happen by letting the data block iterator and index iterator get out
   281  # of sync.
   282  
   283  build
   284  a.SET.1:a
   285  ----
   286  
   287  iter
   288  first
   289  prev
   290  next
   291  next
   292  next
   293  ----
   294  <a:1>:a
   295  .
   296  <a:1>:a
   297  .
   298  .
   299  
   300  iter
   301  last
   302  next
   303  prev
   304  prev
   305  prev
   306  ----
   307  <a:1>:a
   308  .
   309  <a:1>:a
   310  .
   311  .
   312  
   313  # Build a sufficiently large SST to enable two-level indexes.
   314  
   315  build
   316  a.SET.1:A
   317  aae.SET.1:E
   318  aaf.SET.1:F
   319  aag.SET.1:G
   320  aah.SET.1:H
   321  aai.SET.1:I
   322  aaj.SET.1:J
   323  aak.SET.1:K
   324  aal.SET.1:L
   325  aam.SET.1:M
   326  aan.SET.1:N
   327  aao.SET.1:O
   328  aap.SET.1:P
   329  aaq.SET.1:Q
   330  aar.SET.1:R
   331  aas.SET.1:S
   332  aat.SET.1:T
   333  aau.SET.1:U
   334  aav.SET.1:V
   335  aaw.SET.1:W
   336  aax.SET.1:X
   337  aay.SET.1:Y
   338  aaz.SET.1:Z
   339  b.SET.2:B
   340  bbe.SET.2:E
   341  bbf.SET.2:F
   342  bbg.SET.2:G
   343  bbh.SET.2:H
   344  bbi.SET.2:I
   345  bbj.SET.2:J
   346  bbk.SET.2:K
   347  bbl.SET.2:L
   348  bbm.SET.2:M
   349  bbn.SET.2:N
   350  bbo.SET.2:O
   351  bbp.SET.2:P
   352  bbq.SET.2:Q
   353  bbr.SET.2:R
   354  bbs.SET.2:S
   355  bbt.SET.2:T
   356  bbu.SET.2:U
   357  bbv.SET.2:V
   358  bbw.SET.2:W
   359  bbx.SET.2:X
   360  bby.SET.2:Y
   361  bbz.SET.2:Z
   362  c.SET.3:C
   363  cc.RANGEDEL.3:ccc
   364  cce.SET.3:E
   365  ccf.SET.3:F
   366  ccg.SET.3:G
   367  cch.SET.3:H
   368  cci.SET.3:I
   369  ccj.SET.3:J
   370  cck.SET.3:K
   371  ccl.SET.3:L
   372  ccm.SET.3:M
   373  ccn.SET.3:N
   374  cco.SET.3:O
   375  ccp.SET.3:P
   376  ccq.SET.3:Q
   377  ccr.SET.3:R
   378  ccs.SET.3:S
   379  cct.SET.3:T
   380  ccu.SET.3:U
   381  ccv.SET.3:V
   382  ccw.SET.3:W
   383  ccx.SET.3:X
   384  ccy.SET.3:Y
   385  ccz.SET.3:Z
   386  d.SET.4:D
   387  dd.RANGEDEL.4:ddd
   388  dde.SET.4:E
   389  ddf.SET.4:F
   390  ddg.SET.4:G
   391  ddh.SET.4:H
   392  ddi.SET.4:I
   393  ddj.SET.4:J
   394  ddk.SET.4:K
   395  ddl.SET.4:L
   396  ddm.SET.4:M
   397  ddn.SET.4:N
   398  ddo.SET.4:O
   399  ddp.SET.4:P
   400  ddq.SET.4:Q
   401  ddr.SET.4:R
   402  dds.SET.4:S
   403  ddt.SET.4:T
   404  ddu.SET.4:U
   405  ddv.SET.4:V
   406  ddw.SET.4:W
   407  ddx.SET.4:X
   408  ddy.SET.4:Y
   409  ddz.SET.4:Z
   410  ----
   411  
   412  iter
   413  first
   414  prev
   415  next
   416  next
   417  next
   418  next
   419  next
   420  ----
   421  <a:1>:A
   422  .
   423  <a:1>:A
   424  <aae:1>:E
   425  <aaf:1>:F
   426  <aag:1>:G
   427  <aah:1>:H
   428  
   429  iter
   430  last
   431  next
   432  prev
   433  prev
   434  prev
   435  ----
   436  <ddz:4>:Z
   437  .
   438  <ddz:4>:Z
   439  <ddy:4>:Y
   440  <ddx:4>:X
   441  
   442  iter
   443  first
   444  prev
   445  next
   446  next
   447  seek-ge x
   448  prev
   449  prev
   450  ----
   451  <a:1>:A
   452  .
   453  <a:1>:A
   454  <aae:1>:E
   455  .
   456  <ddz:4>:Z
   457  <ddy:4>:Y
   458  
   459  iter
   460  first
   461  prev
   462  next
   463  next
   464  seek-prefix-ge x
   465  prev
   466  prev
   467  ----
   468  <a:1>:A
   469  .
   470  <a:1>:A
   471  <aae:1>:E
   472  .
   473  .
   474  .
   475  
   476  iter
   477  last
   478  next
   479  prev
   480  prev
   481  seek-lt a
   482  next
   483  next
   484  ----
   485  <ddz:4>:Z
   486  .
   487  <ddz:4>:Z
   488  <ddy:4>:Y
   489  .
   490  <a:1>:A
   491  <aae:1>:E
   492  
   493  # Test that SeekPrefixGE does not position the iterator far outside the iterator bounds.
   494  # Doing so would break the subsequent SeekGE that is utilizing the next instead of seek
   495  # optimization.
   496  iter
   497  set-bounds lower=a upper=aae
   498  seek-ge a
   499  seek-prefix-ge aad
   500  set-bounds lower=aae upper=b
   501  seek-ge aae
   502  next
   503  ----
   504  .
   505  <a:1>:A
   506  .
   507  .
   508  <aae:1>:E
   509  <aaf:1>:F
   510  
   511  # Test that using Next does not mislead a twoLevelIterator into believing that the
   512  # iterator has been positioned based on the latest iterator bounds. The Next call
   513  # immediately after SetBounds has a non-deterministic result, hence we use
   514  # next-ignore-result.
   515  iter
   516  set-bounds lower=bbq upper=d
   517  seek-ge bbq
   518  set-bounds lower=b upper=bbf
   519  next-ignore-result
   520  set-bounds lower=bbf upper=c
   521  seek-ge bbf
   522  next
   523  ----
   524  .
   525  <bbq:2>:Q
   526  .
   527  .
   528  .
   529  <bbf:2>:F
   530  <bbg:2>:G
   531  
   532  build
   533  a@10.SET.10:a10
   534  a@5.SET.5:a5
   535  b@20.SET.20:b20
   536  b@17.SET.17:b17
   537  c@30.SET.30:c30
   538  d@40.SET.40:d40
   539  ----
   540  
   541  iter
   542  first
   543  next
   544  next
   545  next
   546  next
   547  next
   548  next
   549  ----
   550  <a@10:10>:a10
   551  <a@5:5>:a5
   552  <b@20:20>:b20
   553  <b@17:17>:b17
   554  <c@30:30>:c30
   555  <d@40:40>:d40
   556  .
   557  
   558  iter
   559  seek-ge a@5
   560  prev
   561  seek-lt b
   562  next
   563  next
   564  seek-lt c
   565  prev
   566  seek-ge b@18
   567  prev
   568  next
   569  ----
   570  <a@5:5>:a5
   571  <a@10:10>:a10
   572  <a@5:5>:a5
   573  <b@20:20>:b20
   574  <b@17:17>:b17
   575  <b@17:17>:b17
   576  <b@20:20>:b20
   577  <b@17:17>:b17
   578  <b@20:20>:b20
   579  <b@17:17>:b17
   580  
   581  iter
   582  seek-ge a@10
   583  next-prefix
   584  next-prefix
   585  next-prefix
   586  next-prefix
   587  ----
   588  <a@10:10>:a10
   589  <b@20:20>:b20
   590  <c@30:30>:c30
   591  <d@40:40>:d40
   592  .
   593  
   594  build
   595  a@10.SET.10:a10
   596  a@5.SET.5:a5
   597  a@3.DEL.3:
   598  aa@30.SET.10:aa30
   599  abcd@50.SET.10:abcd50
   600  abcd@49.SET.9:abcd49
   601  abcd@48.SET.8:abcd48
   602  abcd@47.SET.7:abcd47
   603  b@20.SET.20:b20
   604  b@17.SET.17:b17
   605  b@15.SET.15:b15
   606  c.SET.20:c
   607  c@90.SET.18:c90
   608  d@70.SET.16:d70
   609  ----
   610  
   611  iter
   612  seek-ge a@10
   613  next-prefix
   614  next-prefix
   615  next-prefix
   616  next-prefix
   617  next-prefix
   618  next-prefix
   619  ----
   620  <a@10:10>:a10
   621  <aa@30:10>:aa30
   622  <abcd@50:10>:abcd50
   623  <b@20:20>:b20
   624  <c:20>:c
   625  <d@70:16>:d70
   626  .
   627  
   628  
   629  build
   630  a@49.SET.49:a49
   631  a@48.SET.48:a48
   632  a@47.SET.47:a47
   633  a@46.SET.46:a46
   634  a@45.SET.45:a45
   635  a@44.SET.44:a44
   636  a@43.SET.43:a43
   637  a@42.SET.42:a42
   638  a@41.SET.41:a41
   639  a@40.SET.40:a40
   640  a@39.SET.39:a39
   641  a@38.SET.38:a38
   642  a@37.SET.37:a37
   643  a@36.SET.36:a36
   644  a@35.SET.35:a35
   645  a@34.SET.34:a34
   646  a@33.SET.33:a33
   647  a@32.SET.32:a32
   648  a@31.SET.31:a31
   649  a@30.SET.30:a30
   650  a@29.SET.29:a29
   651  a@28.SET.28:a28
   652  a@27.SET.27:a27
   653  a@26.SET.26:a26
   654  a@25.SET.25:a25
   655  a@24.SET.24:a24
   656  a@23.SET.23:a23
   657  a@22.SET.22:a22
   658  a@21.SET.21:a21
   659  a@20.SET.20:a20
   660  a@19.SET.19:a19
   661  a@18.SET.18:a18
   662  a@17.SET.17:a17
   663  a@16.SET.16:a16
   664  a@15.SET.15:a15
   665  a@14.SET.14:a14
   666  a@13.SET.13:a13
   667  a@12.SET.12:a12
   668  a@11.SET.11:a11
   669  a@10.SET.10:a10
   670  b@20.SET.20:b20
   671  ----
   672  
   673  iter
   674  seek-ge a@49
   675  next-prefix
   676  next-prefix
   677  seek-ge a@47
   678  next-prefix
   679  next-prefix
   680  seek-ge a@36
   681  next-prefix
   682  next-prefix
   683  seek-ge a@33
   684  next-prefix
   685  next-prefix
   686  seek-ge a@30
   687  next-prefix
   688  next-prefix
   689  seek-ge a@26
   690  next-prefix
   691  next-prefix
   692  seek-ge a@20
   693  next-prefix
   694  next-prefix
   695  seek-ge aa@10
   696  next-prefix
   697  ----
   698  <a@49:49>:a49
   699  <b@20:20>:b20
   700  .
   701  <a@47:47>:a47
   702  <b@20:20>:b20
   703  .
   704  <a@36:36>:a36
   705  <b@20:20>:b20
   706  .
   707  <a@33:33>:a33
   708  <b@20:20>:b20
   709  .
   710  <a@30:30>:a30
   711  <b@20:20>:b20
   712  .
   713  <a@26:26>:a26
   714  <b@20:20>:b20
   715  .
   716  <a@20:20>:a20
   717  <b@20:20>:b20
   718  .
   719  <b@20:20>:b20
   720  .