github.com/cockroachdb/pebble@v1.1.2/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: seeked 1 times (1 internal); stepped 1 times (1 internal); blocks: 0B cached, 1.1KB not cached (read time: 0s); points: 25 (75B keys, 75B values), range keys: 1, contained points: 25 (25 skipped) 157 158 # Repeat the above test, but with an iterator that uses a block-property filter 159 # mask. The internal stats should reflect fewer bytes read and fewer points 160 # visited by the internal iterators. 161 162 combined-iter mask-suffix=@9 mask-filter 163 first 164 next 165 stats 166 ---- 167 a: (., [a-z) @5=boop UPDATED) 168 . 169 stats: seeked 1 times (1 internal); stepped 1 times (1 internal); blocks: 514B cached; points: 2 (6B keys, 6B values), range keys: 1, contained points: 2 (2 skipped) 170 171 # Perform a similar comparison in reverse. 172 173 combined-iter mask-suffix=@9 174 last 175 prev 176 stats 177 ---- 178 a: (., [a-z) @5=boop UPDATED) 179 . 180 stats: seeked 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); stepped 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); blocks: 1.1KB cached; points: 25 (75B keys, 75B values), range keys: 1, contained points: 25 (25 skipped) 181 182 combined-iter mask-suffix=@9 mask-filter 183 last 184 prev 185 stats 186 ---- 187 a: (., [a-z) @5=boop UPDATED) 188 . 189 stats: seeked 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); stepped 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); blocks: 514B cached; points: 2 (6B keys, 6B values), range keys: 1, contained points: 2 (2 skipped) 190 191 # Perform similar comparisons with seeks. 192 193 combined-iter mask-suffix=@9 194 seek-ge m 195 next 196 stats 197 ---- 198 m: (., [a-z) @5=boop UPDATED) 199 . 200 stats: seeked 1 times (1 internal); stepped 1 times (1 internal); blocks: 789B cached; points: 13 (39B keys, 39B values), range keys: 1, contained points: 13 (13 skipped) 201 202 combined-iter mask-suffix=@9 mask-filter 203 seek-ge m 204 next 205 stats 206 ---- 207 m: (., [a-z) @5=boop UPDATED) 208 . 209 stats: seeked 1 times (1 internal); stepped 1 times (1 internal); blocks: 514B cached; points: 2 (6B keys, 6B values), range keys: 1, contained points: 2 (2 skipped) 210 211 combined-iter mask-suffix=@9 212 seek-lt m 213 prev 214 stats 215 ---- 216 a: (., [a-z) @5=boop UPDATED) 217 . 218 stats: seeked 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); stepped 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); blocks: 789B cached; points: 12 (36B keys, 36B values), range keys: 1, contained points: 12 (12 skipped) 219 220 combined-iter mask-suffix=@9 mask-filter 221 seek-lt m 222 prev 223 stats 224 ---- 225 a: (., [a-z) @5=boop UPDATED) 226 . 227 stats: seeked 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); stepped 1 times (0 fwd/1 rev, internal: 0 fwd/1 rev); blocks: 539B cached; points: 2 (6B keys, 6B values), range keys: 1, contained points: 2 (2 skipped)