github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/testdata/singledel_manual_compaction_set_with_del (about) 1 # This is not actually a manual compaction test, and simply uses manual 2 # compaction to demonstrate single delete semantics when used with 3 # set-with-delete. 4 5 # Define a sequence of SET=>SET=>DEL=>SET=>SINGLEDEL. 6 define target-file-sizes=(1, 1, 1, 1, 1) 7 L1 8 a.SINGLEDEL.10: 9 L2 10 a.SET.9:v3 11 L3 12 a.DEL.8: 13 L4 14 a.SET.7:v2 15 L5 16 a.SET.6:v1 17 ---- 18 1: 19 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 20 2: 21 000005:[a#9,SET-a#9,SET] 22 3: 23 000006:[a#8,DEL-a#8,DEL] 24 4: 25 000007:[a#7,SET-a#7,SET] 26 5: 27 000008:[a#6,SET-a#6,SET] 28 29 # No data. 30 iter 31 first 32 ---- 33 . 34 35 # Compact away the DEL. 36 compact a-b L2 37 ---- 38 1: 39 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 40 3: 41 000009:[a#9,SETWITHDEL-a#9,SETWITHDEL] 42 4: 43 000007:[a#7,SET-a#7,SET] 44 5: 45 000008:[a#6,SET-a#6,SET] 46 47 # No data. 48 iter 49 first 50 ---- 51 . 52 53 # Do two compactions to compact away the SINGLEDEL and 1 SET. 54 compact a-b L1 55 ---- 56 2: 57 000010:[a#10,SINGLEDEL-a#10,SINGLEDEL] 58 3: 59 000009:[a#9,SETWITHDEL-a#9,SETWITHDEL] 60 4: 61 000007:[a#7,SET-a#7,SET] 62 5: 63 000008:[a#6,SET-a#6,SET] 64 65 compact a-b L2 66 ---- 67 3: 68 000011:[a#10,DEL-a#10,DEL] 69 4: 70 000007:[a#7,SET-a#7,SET] 71 5: 72 000008:[a#6,SET-a#6,SET] 73 74 # Deleted data is not resurrected. 75 iter 76 first 77 ---- 78 . 79 80 # Define a sequence of SET=>SINGLEDEL=>SET=>SINGLEDEL. 81 define target-file-sizes=(1, 1, 1, 1, 1) 82 L1 83 a.SINGLEDEL.10: 84 L2 85 a.SET.9:v3 86 L3 87 a.SINGLEDEL.8: 88 L4 89 a.SET.7:v2 90 ---- 91 1: 92 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 93 2: 94 000005:[a#9,SET-a#9,SET] 95 3: 96 000006:[a#8,SINGLEDEL-a#8,SINGLEDEL] 97 4: 98 000007:[a#7,SET-a#7,SET] 99 100 # No data. 101 iter 102 first 103 ---- 104 . 105 106 # Compact away the older SINGLEDEL. 107 compact a-b L2 108 ---- 109 1: 110 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 111 3: 112 000008:[a#9,SETWITHDEL-a#9,SETWITHDEL] 113 4: 114 000007:[a#7,SET-a#7,SET] 115 116 # No data. 117 iter 118 first 119 ---- 120 . 121 122 # Do two compactions to compact away the newer SINGLEDEL and 1 SET. 123 compact a-b L1 124 ---- 125 2: 126 000009:[a#10,SINGLEDEL-a#10,SINGLEDEL] 127 3: 128 000008:[a#9,SETWITHDEL-a#9,SETWITHDEL] 129 4: 130 000007:[a#7,SET-a#7,SET] 131 132 compact a-b L2 133 ---- 134 3: 135 000010:[a#10,DEL-a#10,DEL] 136 4: 137 000007:[a#7,SET-a#7,SET] 138 139 # Deleted data is not resurrected. 140 iter 141 first 142 ---- 143 . 144 145 # Define a sequence of SET=>DEL=>SET=>SINGLEDEL, such that the DEL and 146 # SINGLEDEL meet in a compaction. 147 define snapshots=(9) 148 L1 149 a.SINGLEDEL.10: 150 L2 151 a.SET.9:v3 152 L3 153 a.DEL.8: 154 L4 155 a.SET.7:v2 156 ---- 157 1: 158 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 159 2: 160 000005:[a#9,SET-a#9,SET] 161 3: 162 000006:[a#8,DEL-a#8,DEL] 163 4: 164 000007:[a#7,SET-a#7,SET] 165 166 # No data. 167 iter 168 first 169 ---- 170 . 171 172 # Compact L2 and L3. The snapshot prevents the DEL=>SET from being collapsed. 173 compact a-b L2 174 ---- 175 1: 176 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 177 3: 178 000008:[a#9,SET-a#8,DEL] 179 4: 180 000007:[a#7,SET-a#7,SET] 181 182 # No data. 183 iter 184 first 185 ---- 186 . 187 188 close-snapshots 189 ---- 190 191 compact a-b L1 192 ---- 193 2: 194 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 195 3: 196 000008:[a#9,SET-a#8,DEL] 197 4: 198 000007:[a#7,SET-a#7,SET] 199 200 # The DEL survives. 201 compact a-b L2 202 ---- 203 3: 204 000009:[a#8,DEL-a#8,DEL] 205 4: 206 000007:[a#7,SET-a#7,SET] 207 208 # No data 209 iter 210 first 211 ---- 212 . 213 214 # Define a sequence of SET=>SINGLEDEL=>SET=>SINGLEDEL, such that the two 215 # SINGLEDELs meet in a compaction. 216 define snapshots=(9) 217 L1 218 a.SINGLEDEL.10: 219 L2 220 a.SET.9:v3 221 L3 222 a.SINGLEDEL.8: 223 L4 224 a.SET.7:v2 225 ---- 226 1: 227 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 228 2: 229 000005:[a#9,SET-a#9,SET] 230 3: 231 000006:[a#8,SINGLEDEL-a#8,SINGLEDEL] 232 4: 233 000007:[a#7,SET-a#7,SET] 234 235 # No data. 236 iter 237 first 238 ---- 239 . 240 241 # Compact L2 and L3. The snapshot prevents the SINGLEDEL=>SET from being collapsed. 242 compact a-b L2 243 ---- 244 1: 245 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 246 3: 247 000008:[a#9,SET-a#8,SINGLEDEL] 248 4: 249 000007:[a#7,SET-a#7,SET] 250 251 # No data. 252 iter 253 first 254 ---- 255 . 256 257 close-snapshots 258 ---- 259 260 compact a-b L1 261 ---- 262 2: 263 000004:[a#10,SINGLEDEL-a#10,SINGLEDEL] 264 3: 265 000008:[a#9,SET-a#8,SINGLEDEL] 266 4: 267 000007:[a#7,SET-a#7,SET] 268 269 # The SINGLEDEL survives. 270 compact a-b L2 271 ---- 272 3: 273 000009:[a#8,SINGLEDEL-a#8,SINGLEDEL] 274 4: 275 000007:[a#7,SET-a#7,SET] 276 277 # No data 278 iter 279 first 280 ---- 281 .