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

     1  define
     2  a-c:{(#3,RANGEKEYUNSET,@5) (#2,RANGEKEYSET,@5,apples) (#1,RANGEKEYSET,@3,bananas)}
     3  c-d:{(#4,RANGEKEYSET,@3,bananas)}
     4  d-e:{(#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@1,pineapple)}
     5  ----
     6  
     7  # Iterating with logical defragmentation should combine [a,c) and [c,d)
     8  # fragments.
     9  
    10  iter
    11  first
    12  next
    13  next
    14  last
    15  prev
    16  prev
    17  ----
    18  first     a-d:{(#1,RANGEKEYSET,@3,bananas)}
    19  next      d-e:{(#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@1,pineapple)}
    20  next      .
    21  last      d-e:{(#4,RANGEKEYSET,@3,bananas) (#4,RANGEKEYSET,@1,pineapple)}
    22  prev      a-d:{(#4,RANGEKEYSET,@3,bananas)}
    23  prev      .
    24  
    25  # Test defragmenting in both directions at seek keys.
    26  
    27  define
    28  a-f:{(#3,RANGEKEYUNSET,@5) (#2,RANGEKEYSET,@5,apples) (#1,RANGEKEYSET,@3,bananas)}
    29  f-h:{(#3,RANGEKEYSET,@3,bananas)}
    30  h-p:{(#3,RANGEKEYSET,@3,bananas)}
    31  p-t:{(#3,RANGEKEYSET,@3,bananas)}
    32  ----
    33  
    34  iter
    35  seekge b
    36  prev
    37  seekge b
    38  next
    39  seeklt d
    40  next
    41  seeklt d
    42  prev
    43  ----
    44  seekge b  a-t:{(#1,RANGEKEYSET,@3,bananas)}
    45  prev      .
    46  seekge b  a-t:{(#1,RANGEKEYSET,@3,bananas)}
    47  next      .
    48  seeklt d  a-t:{(#3,RANGEKEYSET,@3,bananas)}
    49  next      .
    50  seeklt d  a-t:{(#3,RANGEKEYSET,@3,bananas)}
    51  prev      .
    52  
    53  iter
    54  seeklt d
    55  next
    56  prev
    57  ----
    58  seeklt d  a-t:{(#3,RANGEKEYSET,@3,bananas)}
    59  next      .
    60  prev      a-t:{(#3,RANGEKEYSET,@3,bananas)}
    61  
    62  # Test next-ing and prev-ing around seek keys.
    63  
    64  define
    65  a-f:{(#3,RANGEKEYUNSET,@5) (#2,RANGEKEYSET,@5,apples) (#1,RANGEKEYSET,@3,bananas)}
    66  f-h:{(#3,RANGEKEYSET,@3,bananas)}
    67  h-p:{(#3,RANGEKEYSET,@3,bananas)}
    68  p-t:{(#3,RANGEKEYSET,@3,bananas)}
    69  t-z:{(#4,RANGEKEYSET,@2,oranges)}
    70  ----
    71  
    72  iter
    73  seekge r
    74  prev
    75  next
    76  next
    77  ----
    78  seekge r  a-t:{(#1,RANGEKEYSET,@3,bananas)}
    79  prev      .
    80  next      a-t:{(#1,RANGEKEYSET,@3,bananas)}
    81  next      t-z:{(#4,RANGEKEYSET,@2,oranges)}