github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/sstable/testdata/reader_bpf/Pebblev3/iter (about)

     1  # Test case for bug https://github.com/cockroachdb/pebble/issues/2036 Build
     2  # sstable with two-level index, with two data blocks in each lower-level index
     3  # block.
     4  build block-size=1 index-block-size=40 print-layout=true
     5  c@10.SET.10:cAT10
     6  d@7.SET.9:dAT7
     7  e@15.SET.8:eAT15
     8  f@7.SET.5:fAT7
     9  ----
    10  index entries:
    11   d@7: size 53
    12     c@10: size 29
    13     d@7: size 27
    14   g: size 51
    15     e@15: size 29
    16     g: size 27
    17  
    18  iter
    19  first
    20  next
    21  next
    22  next
    23  ----
    24  <c@10:10>
    25  <d@7:9>
    26  <e@15:8>
    27  <f@7:5>
    28  
    29  
    30  # The block property filter matches data block 2 and 4.
    31  iter block-property-filter=(7,8)
    32  first
    33  next
    34  ----
    35  <d@7:9>
    36  <f@7:5>
    37  
    38  # Use the same block property filter, but use seeks to find these entries.
    39  # With the bug the second seek-ge below would step to the second lower-level
    40  # index block and only see the entry in the data block 4.
    41  iter block-property-filter=(7,8)
    42  set-bounds lower=a upper=c
    43  seek-ge a
    44  seek-ge b true
    45  set-bounds lower=c upper=g
    46  seek-ge c
    47  next
    48  next
    49  ----
    50  .
    51  .
    52  .
    53  .
    54  <d@7:9>
    55  <f@7:5>
    56  .
    57  
    58  # Regression test for #2816
    59  #
    60  # This unit test tests a scenario where the two-level index iterator's position
    61  # could diverge from the currently loaded index block. When taking advantage of
    62  # the monotonic bounds optimization at the two-level index level, the iterator
    63  # would mistakenly seek within the wrong index block.
    64  #
    65  # This allowed the final `seek-ge wc` and `next` to both return wz@8.
    66  
    67  build  block-size=1 index-block-size=1 print-layout=true
    68  eu@2.SET.2:eu
    69  wb@2.SET.2:wb
    70  wz@8.SET.8:wzAT8
    71  ye@1.SET.1:yeAT1
    72  ----
    73  index entries:
    74   f: size 26
    75     f: size 26
    76   wc: size 27
    77     wc: size 26
    78   x: size 26
    79     x: size 29
    80   z: size 26
    81     z: size 29
    82  
    83  iter block-property-filter=(8,9)
    84  set-bounds lower=v upper=v
    85  seek-ge wz@8
    86  internal-iter-state
    87  seek-ge wb@2
    88  internal-iter-state
    89  set-bounds lower=v upper=z
    90  internal-iter-state
    91  seek-ge wc
    92  internal-iter-state
    93  next
    94  ----
    95  .
    96  .
    97  | *sstable.twoLevelIterator:
    98  |  topLevelIndex.Key() = "x#72057594037927935,17"
    99  |  topLevelIndex.InPlaceValue() = (Offset: 193, Length: 26, Props: 00020801)
   100  |  topLevelIndex.isDataInvalidated()=false
   101  |  index.Key() = "x#72057594037927935,17"
   102  |  index.InPlaceValue() = (Offset: 62, Length: 29, Props: 00020801)
   103  |  index.isDataInvalidated()=false
   104  |  data.isDataInvalidated()=false
   105  |  hideObsoletePoints = false
   106  |  dataBH = (Offset: 62, Length: 29)
   107  |  (boundsCmp,positionedUsingLatestBounds) = (0,true)
   108  |  exhaustedBounds = 1
   109  .
   110  | *sstable.twoLevelIterator:
   111  |  topLevelIndex.Key() = "wc#72057594037927935,17"
   112  |  topLevelIndex.InPlaceValue() = (Offset: 161, Length: 27, Props: 00020201)
   113  |  topLevelIndex.isDataInvalidated()=false
   114  |  index iter invalid
   115  |  index.isDataInvalidated()=true
   116  |  data.isDataInvalidated()=true
   117  |  hideObsoletePoints = false
   118  |  dataBH = (Offset: 62, Length: 29)
   119  |  (boundsCmp,positionedUsingLatestBounds) = (0,true)
   120  |  exhaustedBounds = 1
   121  .
   122  | *sstable.twoLevelIterator:
   123  |  topLevelIndex.Key() = "wc#72057594037927935,17"
   124  |  topLevelIndex.InPlaceValue() = (Offset: 161, Length: 27, Props: 00020201)
   125  |  topLevelIndex.isDataInvalidated()=false
   126  |  index iter invalid
   127  |  index.isDataInvalidated()=true
   128  |  data.isDataInvalidated()=true
   129  |  hideObsoletePoints = false
   130  |  dataBH = (Offset: 62, Length: 29)
   131  |  (boundsCmp,positionedUsingLatestBounds) = (1,false)
   132  |  exhaustedBounds = 1
   133  <wz@8:8>
   134  | *sstable.twoLevelIterator:
   135  |  topLevelIndex.Key() = "x#72057594037927935,17"
   136  |  topLevelIndex.InPlaceValue() = (Offset: 193, Length: 26, Props: 00020801)
   137  |  topLevelIndex.isDataInvalidated()=false
   138  |  index.Key() = "x#72057594037927935,17"
   139  |  index.InPlaceValue() = (Offset: 62, Length: 29, Props: 00020801)
   140  |  index.isDataInvalidated()=false
   141  |  data.isDataInvalidated()=false
   142  |  hideObsoletePoints = false
   143  |  dataBH = (Offset: 62, Length: 29)
   144  |  (boundsCmp,positionedUsingLatestBounds) = (0,false)
   145  |  exhaustedBounds = 0
   146  .