github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/testdata/level_checker (about) 1 # Format for define command: 2 # Levels are ordered from higher to lower, and each new level starts with an L 3 # Each level is defined using an even number of lines where every pair of lines represents 4 # a file. The files within a level are ordered from smaller to larger keys. 5 # Each file is defined using: the first line specifies the smallest and largest internal 6 # keys and the second line the point key-value pairs in the sstable in order. The rangedel 7 # key-value pairs should also be in increasing order relative to the other rangedel pairs. 8 # The largest file key can take the form of <userkey>.RANGEDEL.72057594037927935, which 9 # represents the range deletion sentinel. 10 # 11 # Many of the correct case definitions are borrowed from merging_iter since it defines 12 # some tricky configurations. 13 14 # The untruncated range tombstone at the higher level does not overlap with the lower level once 15 # we consider the file boundaries, which is why its lower sequence number is ok. 16 define 17 L 18 a.SET.30 e.RANGEDEL.72057594037927935 19 a.SET.30:30 c.SET.27:27 a.RANGEDEL.8:f 20 L 21 e.SET.10 g.SET.20 22 e.SET.10:10 g.SET.20:20 e.RANGEDEL.8:f 23 ---- 24 Level 1 25 file 0: [a#30,1-e#72057594037927935,15] 26 Level 2 27 file 0: [e#10,1-g#20,1] 28 29 check 30 ---- 31 32 # The untruncated range tombstone at the higher level does not overlap with the g point at the 33 # lower level once we consider the file boundaries, which is why its lower sequence number is ok. 34 define 35 L 36 a.SET.15 f.SET.16 37 a.SET.15:15 c.SET.13:13 f.SET.16:16 a.RANGEDEL.12:h 38 L 39 e.SET.10 g.SET.15 40 e.SET.10:10 g.SET.15:15 41 ---- 42 Level 1 43 file 0: [a#15,1-f#16,1] 44 Level 2 45 file 0: [e#10,1-g#15,1] 46 47 check 48 ---- 49 50 # The untruncated range tombstones in both levels do not overlap once we consider the file 51 # boundaries (which are non-overlapping). 52 define 53 L 54 c.SET.30 f.RANGEDEL.0 55 c.SET.30:30 d.SET.27:27 a.RANGEDEL.8:f 56 L 57 a.SET.10 c.RANGEDEL.72057594037927935 58 a.SET.10:10 b.SET.12:12 a.RANGEDEL.8:f 59 ---- 60 Level 1 61 file 0: [c#30,1-f#0,15] 62 Level 2 63 file 0: [a#10,1-c#72057594037927935,15] 64 65 check 66 ---- 67 68 # The range tombstone in the higher level does not overlap with the b point in the lower level, 69 # which has a higher sequence number, when we consider the file boundaries. 70 define 71 L 72 c.SET.15 g.SET.16 73 c.SET.15:15 f.SET.13:13 g.SET.16:16 a.RANGEDEL.12:h 74 L 75 b.SET.14 d.SET.10 76 b.SET.14:14 d.SET.10:10 77 ---- 78 Level 1 79 file 0: [c#15,1-g#16,1] 80 Level 2 81 file 0: [b#14,1-d#10,1] 82 83 check 84 ---- 85 86 # The two files do not overlap despite the seeming overlap of the range tombstones. 87 define 88 L 89 a.SET.30 e.RANGEDEL.72057594037927935 90 a.SET.30:30 c.SET.27:27 a.RANGEDEL.8:g 91 L 92 e.SET.10 g.SET.20 93 e.SET.10:10 g.SET.20:20 e.RANGEDEL.8:g 94 ---- 95 Level 1 96 file 0: [a#30,1-e#72057594037927935,15] 97 Level 2 98 file 0: [e#10,1-g#20,1] 99 100 check 101 ---- 102 103 define 104 L 105 a.SET.30 e.RANGEDEL.72057594037927935 106 a.SET.30:30 c.SET.27:27 a.RANGEDEL.8:g 107 L 108 a.SET.10 g.SET.20 109 a.SET.10:10 c.SET.28:28 g.SET.20:20 110 ---- 111 Level 1 112 file 0: [a#30,1-e#72057594037927935,15] 113 Level 2 114 file 0: [a#10,1-g#20,1] 115 116 check 117 ---- 118 found InternalKey c#27,SET in L1: fileNum=000010 and InternalKey c#28,SET in L2: fileNum=000011 119 120 # The sentinel key for the RANGEDEL should not violate g having a higher seq num at a 121 # lower level. 122 define 123 L 124 a.SET.30 g.RANGEDEL.72057594037927935 125 a.SET.30:30 c.SET.27:27 a.RANGEDEL.8:g 126 L 127 g.SET.10 j.SET.20 128 g.SET.10:10 j.SET.20:20 129 ---- 130 Level 1 131 file 0: [a#30,1-g#72057594037927935,15] 132 Level 2 133 file 0: [g#10,1-j#20,1] 134 135 check 136 ---- 137 138 define 139 L 140 a.SET.30 g.SET.8 141 a.SET.30:30 c.SET.27:27 a.RANGEDEL.8:g g.SET.8:8 142 L 143 g.SET.10 j.SET.20 144 g.SET.10:10 j.SET.20:20 145 ---- 146 Level 1 147 file 0: [a#30,1-g#8,1] 148 Level 2 149 file 0: [g#10,1-j#20,1] 150 151 check 152 ---- 153 found InternalKey g#8,SET in L1: fileNum=000014 and InternalKey g#10,SET in L2: fileNum=000015 154 155 define 156 L 157 a.SET.30 g.SET.30 158 a.SET.30:30 c.SET.8:8 g.SET.30:30 159 L 160 a.SET.10 j.SET.20 161 a.SET.10:10 j.SET.20:20 b.RANGEDEL.10:g 162 ---- 163 Level 1 164 file 0: [a#30,1-g#30,1] 165 Level 2 166 file 0: [a#10,1-j#20,1] 167 168 check 169 ---- 170 tombstone b-g:{(#10,RANGEDEL)} in L2: fileNum=000017 deletes key c#8,SET in L1: fileNum=000016 171 172 define 173 L 174 a.RANGEDEL.8 c.RANGEDEL.72057594037927935 175 a.RANGEDEL.8:c 176 L 177 a.RANGEDEL.6 d.RANGEDEL.72057594037927935 178 a.RANGEDEL.6:d b.RANGEDEL.10:c 179 ---- 180 Level 1 181 file 0: [a#8,15-c#72057594037927935,15] 182 Level 2 183 file 0: [a#6,15-d#72057594037927935,15] 184 185 check 186 ---- 187 encountered tombstone b-c:{(#8,RANGEDEL)} in L1: fileNum=000018 that has a lower seqnum than the same tombstone in L2: fileNum=000019 188 189 # Check incorrect ordering of point keys in an sstable. 190 define disable-key-order-checks 191 L 192 a.SET.3 e.SET.4 193 e.SET.4:e a.SET.3:a 194 L 195 d.SET.1 f.SET.2 196 d.SET.1:d f.SET.2:f 197 ---- 198 Level 1 199 file 0: [a#3,1-e#4,1] 200 Level 2 201 file 0: [d#1,1-f#2,1] 202 203 check 204 ---- 205 out of order keys e#4,SET >= a#3,SET in L1: fileNum=000020 206 207 # Check successive sstables on a level are ordered. 208 define disable-key-order-checks 209 L 210 a.SET.1 b.SET.2 211 a.SET.1:a b.SET.2:b 212 b.SET.3 c.SET.4 213 b.SET.3:b c.SET.4:c 214 ---- 215 Level 1 216 file 0: [a#1,1-b#2,1] 217 file 1: [b#3,1-c#4,1] 218 219 check 220 ---- 221 out of order keys b#2,SET >= b#3,SET in L1: fileNum=000023 222 223 # Check range delete keys are fragmented and ordered in an sstable having 224 # rangeDelV2 formatted range delete blocks. 225 226 # Case 1: Fragmented but not ordered. 227 define write-unfragmented disable-key-order-checks 228 L 229 a.RANGEDEL.1 g.RANGEDEL.72057594037927935 230 d.RANGEDEL.2:e d.RANGEDEL.1:e f.RANGEDEL.3:g a.RANGEDEL.4:b 231 ---- 232 Level 1 233 file 0: [a#1,15-g#72057594037927935,15] 234 235 check 236 ---- 237 unordered or unfragmented range delete tombstones f-g:{(#3,RANGEDEL)}, a-b:{(#4,RANGEDEL)} in L1: fileNum=000024 238 239 # Case 2: Ordered but not fragmented. 240 define write-unfragmented disable-key-order-checks 241 L 242 a.RANGEDEL.1 d.RANGEDEL.72057594037927935 243 a.RANGEDEL.1:d b.RANGEDEL.2:c 244 ---- 245 Level 1 246 file 0: [a#1,15-d#72057594037927935,15] 247 248 check 249 ---- 250 unordered or unfragmented range delete tombstones a-d:{(#1,RANGEDEL)}, b-c:{(#2,RANGEDEL)} in L1: fileNum=000025 251 252 # Case 3: Verify check is done before truncation. 253 define write-unfragmented disable-key-order-checks 254 L 255 a.RANGEDEL.1 b.RANGEDEL.72057594037927935 256 a.RANGEDEL.1:z d.RANGEDEL.2:e 257 ---- 258 Level 1 259 file 0: [a#1,15-b#72057594037927935,15] 260 261 check 262 ---- 263 unordered or unfragmented range delete tombstones a-z:{(#1,RANGEDEL)}, d-e:{(#2,RANGEDEL)} in L1: fileNum=000026 264 265 # Merge record processing. 266 267 # Case 1: Latest versions of a key are MERGE records and processing one of 268 # them fails. 269 define 270 L 271 a.MERGE.10 a.MERGE.9 272 a.MERGE.10:10 a.MERGE.9:fail-merge 273 ---- 274 Level 1 275 file 0: [a#10,2-a#9,2] 276 277 check merger=fail-merger 278 ---- 279 merge processing error on key a#9,MERGE in L1: fileNum=000027: merge failed 280 281 # Case 2: Last checked key is a MERGE record. 282 define 283 L 284 a.MERGE.10 a.MERGE.9 285 a.MERGE.10:10 a.MERGE.9:fail-finish 286 ---- 287 Level 1 288 file 0: [a#10,2-a#9,2] 289 290 check merger=fail-merger 291 ---- 292 merge processing error on key a#9,MERGE in L1: fileNum=000028: finish failed 293 294 # Case 3: MERGE records succeeded by newer versions of a key are also 295 # processed. 296 define 297 L 298 a.MERGE.10 a.SINGLEDEL.3 299 a.MERGE.10:10 a.MERGE.9:9 a.SET.8:8 a.MERGE.7:7 a.MERGE.6:6 a.DEL.5: a.MERGE.4:fail-finish a.SINGLEDEL.3: 300 ---- 301 Level 1 302 file 0: [a#10,2-a#3,7] 303 304 check merger=fail-merger 305 ---- 306 merge processing error on key a#3,SINGLEDEL in L1: fileNum=000029: finish failed 307 308 # Case 4: Finish processing on key change. 309 define 310 L 311 a.MERGE.10 b.SET.11 312 a.MERGE.10:10 a.MERGE.9:fail-finish b.SET.11:11 313 ---- 314 Level 1 315 file 0: [a#10,2-b#11,1] 316 317 check merger=fail-merger 318 ---- 319 merge processing error on key b#11,SET in L1: fileNum=000030: finish failed 320 321 # Case 5: SET finishes MERGE record processing. 322 define 323 L 324 a.MERGE.10 a.SET.9 325 a.MERGE.10:10 a.SET.9:fail-finish 326 ---- 327 Level 1 328 file 0: [a#10,2-a#9,1] 329 330 check merger=fail-merger 331 ---- 332 merge processing error on key a#9,SET in L1: fileNum=000031: finish failed 333 334 # Case 6: DEL finishes MERGE record processing. 335 define 336 L 337 a.MERGE.10 a.DEL.9 338 a.MERGE.10:fail-finish a.DEL.9: 339 ---- 340 Level 1 341 file 0: [a#10,2-a#9,0] 342 343 check merger=fail-merger 344 ---- 345 merge processing error on key a#9,DEL in L1: fileNum=000032: finish failed 346 347 # Case 7: SINGLEDEL finishes MERGE record processing. 348 define 349 L 350 a.MERGE.10 a.SINGLEDEL.9 351 a.MERGE.10:fail-finish a.SINGLEDEL.9: 352 ---- 353 Level 1 354 file 0: [a#10,2-a#9,7] 355 356 check merger=fail-merger 357 ---- 358 merge processing error on key a#9,SINGLEDEL in L1: fileNum=000033: finish failed