github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/testdata/iter_histories/range_key_masking (about) 1 reset 2 ---- 3 4 batch commit 5 range-key-set a d @8 boop 6 set a@2 a@2 7 set a@3 a@3 8 set a@9 a@9 9 set a@10 a@10 10 set b b 11 ---- 12 committed 6 keys 13 14 combined-iter 15 seek-prefix-ge a 16 next 17 next 18 next 19 next 20 next 21 ---- 22 a: (., [a-"a\x00") @8=boop UPDATED) 23 a@10: (a@10, [a-"a\x00") @8=boop) 24 a@9: (a@9, [a-"a\x00") @8=boop) 25 a@3: (a@3, [a-"a\x00") @8=boop) 26 a@2: (a@2, [a-"a\x00") @8=boop) 27 . 28 29 # Perform the above iteration with range-key masking enabled at a suffix equal 30 # to the range key's. The [a,d)@8 range key should serve as a masking, obscuring 31 # the points a@3 and a@2. 32 33 combined-iter mask-suffix=@8 34 seek-prefix-ge a 35 next 36 next 37 next 38 ---- 39 a: (., [a-"a\x00") @8=boop UPDATED) 40 a@10: (a@10, [a-"a\x00") @8=boop) 41 a@9: (a@9, [a-"a\x00") @8=boop) 42 . 43 44 # Perform the same thing but with a mask suffix below the range key's. All the 45 # points should be visible again. 46 # 47 # Then use SetOptions to raise the mask. The masked points should disappear. 48 49 combined-iter mask-suffix=@7 50 seek-prefix-ge a 51 next 52 next 53 next 54 next 55 next 56 set-options key-types=both mask-suffix=@8 57 seek-prefix-ge a 58 next 59 next 60 next 61 ---- 62 a: (., [a-"a\x00") @8=boop UPDATED) 63 a@10: (a@10, [a-"a\x00") @8=boop) 64 a@9: (a@9, [a-"a\x00") @8=boop) 65 a@3: (a@3, [a-"a\x00") @8=boop) 66 a@2: (a@2, [a-"a\x00") @8=boop) 67 . 68 . 69 a: (., [a-"a\x00") @8=boop UPDATED) 70 a@10: (a@10, [a-"a\x00") @8=boop) 71 a@9: (a@9, [a-"a\x00") @8=boop) 72 . 73 74 # Test that switching out of prefix iteration correctly expands the bounds 75 # beyond the scope of the previous prefix. 76 77 combined-iter 78 seek-prefix-ge a 79 next 80 seek-ge a@3 81 ---- 82 a: (., [a-"a\x00") @8=boop UPDATED) 83 a@10: (a@10, [a-"a\x00") @8=boop) 84 a@3: (a@3, [a-d) @8=boop UPDATED) 85 86 # Test a range key masking case where the range key is not immediately 87 # masking point keys, but masks point keys once positioned beneath it. 88 89 reset 90 ---- 91 92 batch commit 93 range-key-set d e @5 boop 94 set a@1 a1 95 set b@3 b3 96 set d@3 d3 97 ---- 98 committed 4 keys 99 100 combined-iter mask-suffix=@9 101 first 102 next 103 next 104 next 105 ---- 106 a@1: (a1, .) 107 b@3: (b3, .) 108 d: (., [d-e) @5=boop UPDATED) 109 . 110 111 # Test a broad range key that masks all the point keys. 112 113 reset block-size=20 114 ---- 115 116 batch commit 117 range-key-set a z @5 boop 118 set a@1 foo 119 set b@3 foo 120 set c@3 foo 121 set d@1 foo 122 set e@3 foo 123 set f@3 foo 124 set g@2 foo 125 set h@2 foo 126 set i@2 foo 127 set j@2 foo 128 set k@0 foo 129 set l@2 foo 130 set m@1 foo 131 set n@3 foo 132 set o@4 foo 133 set p@2 foo 134 set q@2 foo 135 set r@1 foo 136 set s@2 foo 137 set t@3 foo 138 set u@2 foo 139 set v@0 foo 140 set w@0 foo 141 set x@2 foo 142 set y@4 foo 143 ---- 144 committed 26 keys 145 146 flush 147 ---- 148 149 combined-iter mask-suffix=@9 150 first 151 next 152 stats 153 ---- 154 a: (., [a-z) @5=boop UPDATED) 155 . 156 stats: (interface (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), (internal (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), 157 (internal-stats: (block-bytes: (total 1.1KB, cached 0B, read-time 0s)), (points: (count 25, key-bytes 75B, value-bytes 75B, tombstoned 0))), 158 (range-key-stats: (count 1), (contained points: (count 25, skipped 25))) 159 160 # Repeat the above test, but with an iterator that uses a block-property filter 161 # mask. The internal stats should reflect fewer bytes read and fewer points 162 # visited by the internal iterators. 163 164 combined-iter mask-suffix=@9 mask-filter 165 first 166 next 167 stats 168 ---- 169 a: (., [a-z) @5=boop UPDATED) 170 . 171 stats: (interface (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), (internal (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), 172 (internal-stats: (block-bytes: (total 514B, cached 514B, read-time 0s)), (points: (count 2, key-bytes 6B, value-bytes 6B, tombstoned 0))), 173 (range-key-stats: (count 1), (contained points: (count 2, skipped 2))) 174 175 # Perform a similar comparison in reverse. 176 177 combined-iter mask-suffix=@9 178 last 179 prev 180 stats 181 ---- 182 a: (., [a-z) @5=boop UPDATED) 183 . 184 stats: (interface (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), (internal (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), 185 (internal-stats: (block-bytes: (total 1.1KB, cached 1.1KB, read-time 0s)), (points: (count 25, key-bytes 75B, value-bytes 75B, tombstoned 0))), 186 (range-key-stats: (count 1), (contained points: (count 25, skipped 25))) 187 188 combined-iter mask-suffix=@9 mask-filter 189 last 190 prev 191 stats 192 ---- 193 a: (., [a-z) @5=boop UPDATED) 194 . 195 stats: (interface (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), (internal (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), 196 (internal-stats: (block-bytes: (total 514B, cached 514B, read-time 0s)), (points: (count 2, key-bytes 6B, value-bytes 6B, tombstoned 0))), 197 (range-key-stats: (count 1), (contained points: (count 2, skipped 2))) 198 199 # Perform similar comparisons with seeks. 200 201 combined-iter mask-suffix=@9 202 seek-ge m 203 next 204 stats 205 ---- 206 m: (., [a-z) @5=boop UPDATED) 207 . 208 stats: (interface (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), (internal (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), 209 (internal-stats: (block-bytes: (total 789B, cached 789B, read-time 0s)), (points: (count 13, key-bytes 39B, value-bytes 39B, tombstoned 0))), 210 (range-key-stats: (count 1), (contained points: (count 13, skipped 13))) 211 212 combined-iter mask-suffix=@9 mask-filter 213 seek-ge m 214 next 215 stats 216 ---- 217 m: (., [a-z) @5=boop UPDATED) 218 . 219 stats: (interface (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), (internal (dir, seek, step): (fwd, 1, 1), (rev, 0, 0)), 220 (internal-stats: (block-bytes: (total 514B, cached 514B, read-time 0s)), (points: (count 2, key-bytes 6B, value-bytes 6B, tombstoned 0))), 221 (range-key-stats: (count 1), (contained points: (count 2, skipped 2))) 222 223 combined-iter mask-suffix=@9 224 seek-lt m 225 prev 226 stats 227 ---- 228 a: (., [a-z) @5=boop UPDATED) 229 . 230 stats: (interface (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), (internal (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), 231 (internal-stats: (block-bytes: (total 789B, cached 789B, read-time 0s)), (points: (count 12, key-bytes 36B, value-bytes 36B, tombstoned 0))), 232 (range-key-stats: (count 1), (contained points: (count 12, skipped 12))) 233 234 combined-iter mask-suffix=@9 mask-filter 235 seek-lt m 236 prev 237 stats 238 ---- 239 a: (., [a-z) @5=boop UPDATED) 240 . 241 stats: (interface (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), (internal (dir, seek, step): (fwd, 0, 0), (rev, 1, 1)), 242 (internal-stats: (block-bytes: (total 539B, cached 539B, read-time 0s)), (points: (count 2, key-bytes 6B, value-bytes 6B, tombstoned 0))), 243 (range-key-stats: (count 1), (contained points: (count 2, skipped 2)))