github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/testdata/external_iterator (about) 1 build 1 2 set b b 3 set c c 4 ---- 5 6 build 2 7 del-range c z 8 ---- 9 10 # Test that a delete range in a more recent file shadows keys in an 11 # earlier file. 12 13 iter files=(1) 14 first 15 next 16 next 17 ---- 18 b: (b, .) 19 c: (c, .) 20 . 21 22 iter files=(1) 23 seek-ge bb 24 next 25 ---- 26 c: (c, .) 27 . 28 29 iter files=(2, 1) fwd-only 30 first 31 next 32 ---- 33 b: (b, .) 34 . 35 36 build 3 37 set a a 38 set f f 39 ---- 40 41 # Test including an even more recent file with point keys overlapping 42 # the rangedel. Since the point keys are assigned a higher sequence 43 # number, they should NOT be shadowed by the rangedel. 44 45 iter files=(3, 2, 1) fwd-only 46 first 47 next 48 next 49 next 50 ---- 51 a: (a, .) 52 b: (b, .) 53 f: (f, .) 54 . 55 56 # Test including range keys, and merging the range key state across 57 # files. Range keys should be interleaved. 58 59 build 4 60 range-key-set a c @2 foo 61 range-key-set c e @3 bar 62 ---- 63 64 build 5 65 range-key-del b d 66 ---- 67 68 iter files=(5, 4, 3, 2, 1) fwd-only 69 first 70 next 71 next 72 next 73 next 74 ---- 75 a: (a, [a-b) @2=foo UPDATED) 76 b: (b, . UPDATED) 77 d: (., [d-e) @3=bar UPDATED) 78 f: (f, . UPDATED) 79 . 80 81 # Test including range keys with empty spans and a merge in between. At no point 82 # should an empty span be returned. 83 84 build 6 85 merge bb ac 86 ---- 87 88 iter files=(6, 5, 4, 3, 2, 1) 89 seek-lt c 90 prev 91 next 92 next 93 ---- 94 bb: (ac, .) 95 b: (b, .) 96 bb: (ac, .) 97 d: (., [d-e) @3=bar UPDATED) 98 99 iter files=(6, 5, 4, 3, 2, 1) 100 seek-ge b 101 next 102 prev 103 prev 104 next 105 next 106 next 107 ---- 108 b: (b, .) 109 bb: (ac, .) 110 b: (b, .) 111 a: (a, [a-b) @2=foo UPDATED) 112 b: (b, . UPDATED) 113 bb: (ac, .) 114 d: (., [d-e) @3=bar UPDATED) 115 116 # Test range keys that overlap each other with identical state. These 117 # should be defragmented and exposed as a single range key. 118 119 reset 120 ---- 121 122 build ag 123 range-key-set a g @5 foo 124 ---- 125 126 build ek 127 range-key-set e k @5 foo 128 ---- 129 130 iter files=(ag, ek) fwd-only 131 first 132 next 133 ---- 134 a: (., [a-k) @5=foo UPDATED) 135 . 136 137 # Test range-key masking by creating points, some with suffixes above 138 # the range key's suffix, some with suffixes below the range key's 139 # suffix. 140 141 build points 142 set a@4 v 143 set c@2 v 144 set d@9 v 145 set e@5 v 146 set k@3 v 147 set p@4 v 148 ---- 149 150 iter files=(points, ag, ek) mask-suffix=@7 fwd-only 151 first 152 next 153 next 154 next 155 next 156 next 157 ---- 158 a: (., [a-k) @5=foo UPDATED) 159 d@9: (v, [a-k) @5=foo) 160 e@5: (v, [a-k) @5=foo) 161 k@3: (v, . UPDATED) 162 p@4: (v, .) 163 . 164 165 # Test that 'stacked' range keys (eg, multiple defined over the same keyspan at 166 # varying suffixes) work as expected. 167 168 build stacked 169 range-key-set a k @4 bar 170 range-key-set a k @1 bax 171 ---- 172 173 iter files=(points, ag, ek, stacked) fwd-only 174 first 175 next 176 ---- 177 a: (., [a-k) @5=foo, @4=bar, @1=bax UPDATED) 178 a@4: (v, [a-k) @5=foo, @4=bar, @1=bax) 179 180 # Test mutating the external iterator's options through SetOptions. 181 182 iter files=(points, ag, ek) fwd-only 183 set-options key-types=point 184 first 185 next 186 set-options lower=e upper=p 187 first 188 next 189 ---- 190 . 191 a@4:v 192 c@2:v 193 . 194 e@5:v 195 k@3:v