github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/internal/keyspan/testdata/level_iter (about) 1 2 # Simple case. 3 4 define 5 file 6 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 7 file 8 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 9 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 10 ---- 11 12 iter 13 seek-ge a 14 seek-ge b 15 seek-ge c 16 seek-ge d 17 seek-lt a 18 seek-lt b 19 seek-lt c 20 seek-lt d 21 ---- 22 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 23 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 24 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 25 . 26 . 27 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 28 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 29 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 30 31 iter 32 first 33 next 34 next 35 next 36 ---- 37 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 38 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 39 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 40 . 41 42 iter 43 last 44 prev 45 prev 46 prev 47 ---- 48 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 49 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 50 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 51 . 52 53 # Set some bounds 54 55 iter 56 seek-ge a 57 seek-ge b 58 seek-ge c 59 seek-ge d 60 seek-lt a 61 seek-lt b 62 seek-lt c 63 seek-lt d 64 ---- 65 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 66 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 67 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 68 . 69 . 70 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 71 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 72 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 73 74 75 iter 76 seek-lt cc 77 prev 78 prev 79 prev 80 ---- 81 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 82 b-c:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 83 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 84 . 85 86 # Test skipping over empty/point-key-only files in both directions. 87 88 define 89 file 90 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 91 file 92 point:b.SET.1:foo 93 file 94 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 95 d-e:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 96 ---- 97 98 num-files 99 ---- 100 3 101 102 iter 103 first 104 next 105 next 106 next 107 ---- 108 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 109 b-c:{} (file = 000001.sst) 110 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 111 d-e:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 112 113 iter 114 last 115 prev 116 prev 117 prev 118 ---- 119 d-e:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 120 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 121 b-c:{} (file = 000003.sst) 122 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 123 124 # Test straddle keys between files. 125 126 define 127 file 128 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 129 file 130 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 131 file 132 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 133 file 134 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 135 ---- 136 137 iter 138 first 139 next 140 next 141 next 142 next 143 next 144 next 145 next 146 ---- 147 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 148 b-c:{} (file = 000001.sst) 149 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 150 d-e:{} (file = 000002.sst) 151 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 152 f-g:{} (file = 000003.sst) 153 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000004.sst) 154 . 155 156 iter 157 last 158 prev 159 prev 160 prev 161 prev 162 prev 163 prev 164 prev 165 ---- 166 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000004.sst) 167 f-g:{} (file = 000004.sst) 168 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 169 d-e:{} (file = 000003.sst) 170 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 171 b-c:{} (file = 000002.sst) 172 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 173 . 174 175 # The below case seeks into a file straddle, then iterates forward and back to 176 # it, and confirms that changing iterator directions on a straddle does the 177 # right thing. 178 179 iter 180 seek-ge bb 181 next 182 prev 183 next 184 prev 185 prev 186 ---- 187 b-c:{} (file = 000001.sst) 188 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 189 b-c:{} (file = 000002.sst) 190 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 191 b-c:{} (file = 000002.sst) 192 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 193 194 # The same case as above, but with inverted directions. 195 196 iter 197 seek-lt dd 198 prev 199 next 200 prev 201 next 202 next 203 ---- 204 d-e:{} (file = 000001.sst) 205 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 206 d-e:{} (file = 000002.sst) 207 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 208 d-e:{} (file = 000002.sst) 209 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 210 211 iter 212 seek-lt dd 213 prev 214 next 215 prev 216 next 217 next 218 ---- 219 d-e:{} (file = 000003.sst) 220 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 221 d-e:{} (file = 000002.sst) 222 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 223 d-e:{} (file = 000002.sst) 224 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 225 226 # Seeks right at the bound should return nothing. 227 228 iter 229 seek-lt bb 230 ---- 231 b-c:{} (file = 000003.sst) 232 233 iter 234 seek-ge dd 235 ---- 236 d-e:{} (file = 000003.sst) 237 238 iter 239 seek-lt d 240 prev 241 next 242 prev 243 prev 244 prev 245 next 246 next 247 ---- 248 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 249 b-c:{} (file = 000002.sst) 250 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 251 b-c:{} (file = 000002.sst) 252 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 253 . 254 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 255 b-c:{} (file = 000001.sst) 256 257 # A bunch of files with point keys only should not fragment straddles. 258 259 define 260 file 261 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 262 file 263 point:c.SET.1:foo 264 file 265 point:d.SET.1:foo 266 file 267 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 268 file 269 point:g.SET.1:foo 270 file 271 h-i:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 272 ---- 273 274 iter 275 first 276 next 277 next 278 next 279 next 280 next 281 ---- 282 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 283 b-e:{} (file = 000001.sst) 284 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000004.sst) 285 f-h:{} (file = 000004.sst) 286 h-i:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000006.sst) 287 . 288 289 iter 290 last 291 prev 292 prev 293 prev 294 prev 295 prev 296 ---- 297 h-i:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000006.sst) 298 f-h:{} (file = 000006.sst) 299 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000004.sst) 300 b-e:{} (file = 000004.sst) 301 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 302 . 303 304 # Test files with range keys and rangedels 305 306 define 307 file 308 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 309 point:a.SET.1:foo 310 point:b.SET.1:foo 311 file 312 c-e:{(#3,RANGEKEYSET,@3,baz) (#3,RANGEKEYSET,@1,bar)} 313 point:c.RANGEDEL.2:f 314 point:d.SET.1:foo 315 file 316 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 317 i-j:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 318 point:f.RANGEDEL.2:g 319 ---- 320 321 iter rangedel 322 first 323 next 324 next 325 next 326 ---- 327 c-f:{(#2,RANGEDEL)} (file = 000002.sst) 328 f-g:{(#2,RANGEDEL)} (file = 000003.sst) 329 . 330 . 331 332 iter rangedel 333 last 334 prev 335 prev 336 prev 337 ---- 338 f-g:{(#2,RANGEDEL)} (file = 000003.sst) 339 c-f:{(#2,RANGEDEL)} (file = 000002.sst) 340 . 341 . 342 343 iter rangedel 344 seek-ge c 345 next 346 next 347 ---- 348 c-f:{(#2,RANGEDEL)} (file = 000002.sst) 349 f-g:{(#2,RANGEDEL)} (file = 000003.sst) 350 . 351 352 iter rangedel 353 seek-lt ff 354 prev 355 next 356 prev 357 prev 358 ---- 359 f-g:{(#2,RANGEDEL)} (file = 000003.sst) 360 c-f:{(#2,RANGEDEL)} (file = 000002.sst) 361 f-g:{(#2,RANGEDEL)} (file = 000003.sst) 362 c-f:{(#2,RANGEDEL)} (file = 000002.sst) 363 . 364 365 close-iter 366 ---- 367 ok 368 369 # Test that a regular LevelIter ignores rangedels and emits straddle spans. 370 371 iter 372 first 373 next 374 next 375 next 376 next 377 next 378 ---- 379 a-b:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 380 b-c:{} (file = 000001.sst) 381 c-e:{(#3,RANGEKEYSET,@3,baz) (#3,RANGEKEYSET,@1,bar)} (file = 000002.sst) 382 e-g:{} (file = 000002.sst) 383 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 384 i-j:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 385 386 iter 387 seek-ge c 388 next 389 next 390 next 391 next 392 ---- 393 c-e:{(#3,RANGEKEYSET,@3,baz) (#3,RANGEKEYSET,@1,bar)} (file = 000002.sst) 394 e-g:{} (file = 000002.sst) 395 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 396 i-j:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 397 . 398 399 # Test seeking outside of bounds with straddles. 400 401 define 402 file 403 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 404 file 405 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 406 file 407 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} 408 ---- 409 410 iter 411 seek-lt j 412 next 413 prev 414 prev 415 ---- 416 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 417 . 418 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 419 f-g:{} (file = 000003.sst) 420 421 iter 422 seek-lt j 423 prev 424 prev 425 next 426 next 427 ---- 428 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 429 f-g:{} (file = 000003.sst) 430 e-f:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000002.sst) 431 f-g:{} (file = 000002.sst) 432 g-h:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000003.sst) 433 434 iter 435 seek-ge a 436 prev 437 next 438 next 439 ---- 440 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 441 . 442 c-d:{(#2,RANGEKEYSET,@3,foo) (#1,RANGEKEYSET,@1,bar)} (file = 000001.sst) 443 d-e:{} (file = 000001.sst)