github.com/cockroachdb/pebble@v1.1.2/testdata/iterator_seek_opt (about) 1 2 define auto-compactions=off 3 L0 4 a.SET.4:4 5 L1 6 a.SET.3:3 7 L2 8 d.SET.2:2 9 L3 10 b.SET.1:1 11 c.SET.1:1 12 d.SET.1:1 13 e.SET.1:1 14 ---- 15 0.0: 16 000004:[a#4,SET-a#4,SET] 17 1: 18 000005:[a#3,SET-a#3,SET] 19 2: 20 000006:[d#2,SET-d#2,SET] 21 3: 22 000007:[b#1,SET-e#1,SET] 23 24 # Simple case: three successive seeks, at increasing keys. Should use 25 # trySeekUsingNext. 26 27 iter 28 seek-ge a 29 ---- 30 a: (4, .) 31 stats: seeked 1 times (1 internal); stepped 0 times (0 internal) 32 SeekGEs with trySeekUsingNext: 0 33 SeekPrefixGEs with trySeekUsingNext: 0 34 35 iter 36 seek-ge b 37 ---- 38 b: (1, .) 39 stats: seeked 2 times (2 internal); stepped 0 times (0 internal) 40 SeekGEs with trySeekUsingNext: 2 41 SeekPrefixGEs with trySeekUsingNext: 0 42 43 iter 44 seek-ge c 45 ---- 46 c: (1, .) 47 stats: seeked 3 times (3 internal); stepped 0 times (0 internal) 48 SeekGEs with trySeekUsingNext: 4 49 SeekPrefixGEs with trySeekUsingNext: 0 50 51 # Seek at a lower key. Should not call with trySeekUsingNext = true. 52 53 iter 54 seek-ge bb 55 ---- 56 c: (1, .) 57 stats: seeked 4 times (4 internal); stepped 0 times (0 internal) 58 SeekGEs with trySeekUsingNext: 4 59 SeekPrefixGEs with trySeekUsingNext: 0 60 61 # Seek at a greater key than last seek, but lands on the same key. Should 62 # not call internalIterator at all. 63 64 iter 65 seek-ge bbb 66 ---- 67 c: (1, .) 68 stats: seeked 5 times (4 internal); stepped 0 times (0 internal) 69 SeekGEs with trySeekUsingNext: 4 70 SeekPrefixGEs with trySeekUsingNext: 0 71 72 # A step followed by a seek should not call with trySeekUsingNext = true. 73 74 iter 75 next 76 seek-ge e 77 ---- 78 d: (2, .) 79 e: (1, .) 80 stats: seeked 6 times (5 internal); stepped 1 times (1 internal) 81 SeekGEs with trySeekUsingNext: 4 82 SeekPrefixGEs with trySeekUsingNext: 0 83 84 iter 85 prev 86 seek-ge b 87 ---- 88 d: (2, .) 89 b: (1, .) 90 stats: seeked 7 times (6 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 91 SeekGEs with trySeekUsingNext: 4 92 SeekPrefixGEs with trySeekUsingNext: 0 93 94 # SeekPrefixGE simple case. 95 96 iter 97 seek-prefix-ge a 98 ---- 99 a: (4, .) 100 stats: seeked 8 times (7 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 101 SeekGEs with trySeekUsingNext: 4 102 SeekPrefixGEs with trySeekUsingNext: 0 103 104 iter 105 seek-prefix-ge b 106 ---- 107 b: (1, .) 108 stats: seeked 9 times (8 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 109 SeekGEs with trySeekUsingNext: 4 110 SeekPrefixGEs with trySeekUsingNext: 2 111 112 iter 113 seek-prefix-ge c 114 ---- 115 c: (1, .) 116 stats: seeked 10 times (9 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 117 SeekGEs with trySeekUsingNext: 4 118 SeekPrefixGEs with trySeekUsingNext: 4 119 120 # Seek at a lower key. Should not call with trySeekUsingNext = true. 121 122 iter 123 seek-prefix-ge bb 124 ---- 125 . 126 stats: seeked 11 times (10 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 127 SeekGEs with trySeekUsingNext: 4 128 SeekPrefixGEs with trySeekUsingNext: 4 129 130 # Shifting bounds followed by SeekGEs. The one immediately after a bounds change 131 # does not use trySeekUsingNext, but successive ones do (while still respecting 132 # bounds). 133 134 iter 135 set-bounds lower=a upper=aa 136 seek-ge a 137 ---- 138 . 139 a: (4, .) 140 stats: seeked 12 times (11 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 141 SeekGEs with trySeekUsingNext: 4 142 SeekPrefixGEs with trySeekUsingNext: 4 143 144 iter 145 set-bounds lower=a upper=c 146 seek-ge b 147 ---- 148 . 149 b: (1, .) 150 stats: seeked 13 times (12 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 151 SeekGEs with trySeekUsingNext: 4 152 SeekPrefixGEs with trySeekUsingNext: 4 153 154 iter 155 seek-ge bb 156 ---- 157 . 158 stats: seeked 14 times (13 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 159 SeekGEs with trySeekUsingNext: 5 160 SeekPrefixGEs with trySeekUsingNext: 4 161 162 iter 163 set-bounds lower=a upper=d 164 seek-ge bbb 165 ---- 166 . 167 c: (1, .) 168 stats: seeked 15 times (14 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 169 SeekGEs with trySeekUsingNext: 5 170 SeekPrefixGEs with trySeekUsingNext: 4 171 172 iter 173 seek-ge cc 174 ---- 175 . 176 stats: seeked 16 times (15 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 177 SeekGEs with trySeekUsingNext: 6 178 SeekPrefixGEs with trySeekUsingNext: 4 179 180 # Shifting bounds, with non-overlapping and monotonic bounds. A set-bounds sits 181 # between every two seeks. We don't call trySeekUsingNext=true when the bounds 182 # are set to unequal bounds, but the results are still correct and within 183 # bounds. We do call trySeekUsingNext=true when the set bounds are identical. 184 185 iter 186 set-bounds lower=a upper=c 187 seek-ge b 188 ---- 189 . 190 b: (1, .) 191 stats: seeked 17 times (16 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 192 SeekGEs with trySeekUsingNext: 6 193 SeekPrefixGEs with trySeekUsingNext: 4 194 195 iter 196 set-bounds lower=c upper=e 197 seek-ge c 198 ---- 199 . 200 c: (1, .) 201 stats: seeked 18 times (17 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 202 SeekGEs with trySeekUsingNext: 6 203 SeekPrefixGEs with trySeekUsingNext: 4 204 205 # NB: Equal bounds. 206 207 iter 208 set-bounds lower=c upper=e 209 seek-ge d 210 ---- 211 . 212 d: (2, .) 213 stats: seeked 19 times (18 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 214 SeekGEs with trySeekUsingNext: 8 215 SeekPrefixGEs with trySeekUsingNext: 4 216 217 iter 218 set-bounds lower=a upper=c 219 seek-prefix-ge b 220 ---- 221 . 222 b: (1, .) 223 stats: seeked 20 times (19 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 224 SeekGEs with trySeekUsingNext: 8 225 SeekPrefixGEs with trySeekUsingNext: 4 226 227 iter 228 set-bounds lower=c upper=e 229 seek-prefix-ge c 230 ---- 231 . 232 c: (1, .) 233 stats: seeked 21 times (20 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 234 SeekGEs with trySeekUsingNext: 8 235 SeekPrefixGEs with trySeekUsingNext: 4 236 237 # NB: Equal bounds. 238 239 iter 240 set-bounds lower=c upper=e 241 seek-prefix-ge d 242 ---- 243 . 244 d: (2, .) 245 stats: seeked 22 times (21 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 246 SeekGEs with trySeekUsingNext: 8 247 SeekPrefixGEs with trySeekUsingNext: 6 248 249 # Shifting bounds, with non-overlapping and monotonic bounds, but using 250 # SetOptions. A set-options sits between every two seeks. We don't call 251 # trySeekUsingNext=true when the bounds are set to unequal bounds, but the 252 # results are still correct and within bounds. We do call trySeekUsingNext=true 253 # when the set bounds are identical. 254 255 iter 256 set-options lower=a upper=c 257 seek-ge b 258 ---- 259 . 260 b: (1, .) 261 stats: seeked 23 times (22 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 262 SeekGEs with trySeekUsingNext: 8 263 SeekPrefixGEs with trySeekUsingNext: 6 264 265 iter 266 set-options lower=c upper=e 267 seek-ge c 268 ---- 269 . 270 c: (1, .) 271 stats: seeked 24 times (23 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 272 SeekGEs with trySeekUsingNext: 8 273 SeekPrefixGEs with trySeekUsingNext: 6 274 275 # NB: Equal bounds. 276 277 iter 278 set-options lower=c upper=e 279 seek-ge d 280 ---- 281 . 282 d: (2, .) 283 stats: seeked 25 times (24 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 284 SeekGEs with trySeekUsingNext: 10 285 SeekPrefixGEs with trySeekUsingNext: 6 286 287 iter 288 set-options lower=a upper=c 289 seek-prefix-ge b 290 ---- 291 . 292 b: (1, .) 293 stats: seeked 26 times (25 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 294 SeekGEs with trySeekUsingNext: 10 295 SeekPrefixGEs with trySeekUsingNext: 6 296 297 iter 298 set-options lower=c upper=e 299 seek-prefix-ge c 300 ---- 301 . 302 c: (1, .) 303 stats: seeked 27 times (26 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 304 SeekGEs with trySeekUsingNext: 10 305 SeekPrefixGEs with trySeekUsingNext: 6 306 307 # NB: Equal bounds. 308 309 iter 310 set-options lower=c upper=e 311 seek-prefix-ge d 312 ---- 313 . 314 d: (2, .) 315 stats: seeked 28 times (27 internal); stepped 2 times (1 fwd/1 rev, internal: 1 fwd/3 rev) 316 SeekGEs with trySeekUsingNext: 10 317 SeekPrefixGEs with trySeekUsingNext: 8