github.com/cockroachdb/pebble@v1.1.2/testdata/compaction_picker_scores (about) 1 # Ensure that a range deletion in a higher level results in a compensated level 2 # size and a higher level score as a result. 3 4 define lbase-max-bytes=65536 enable-table-stats=false 5 L5 6 a.RANGEDEL.2:f 7 L6 8 a.SET.1:<rand-bytes=65536> 9 b.SET.1:<rand-bytes=65536> 10 c.SET.1:<rand-bytes=65536> 11 d.SET.1:<rand-bytes=65536> 12 e.SET.1:<rand-bytes=65536> 13 ---- 14 5: 15 000004:[a#2,RANGEDEL-f#inf,RANGEDEL] 16 6: 17 000005:[a#1,SET-e#1,SET] 18 19 scores 20 ---- 21 L Size Score 22 L0 0B 0.0 23 L1 0B 0.0 24 L2 0B 0.0 25 L3 0B 0.0 26 L4 0B 0.0 27 L5 729B 0.0 28 L6 321KB - 29 30 enable-table-stats 31 ---- 32 33 wait-pending-table-stats 34 000004 35 ---- 36 num-entries: 1 37 num-deletions: 1 38 num-range-key-sets: 0 39 point-deletions-bytes-estimate: 0 40 range-deletions-bytes-estimate: 328519 41 42 scores 43 ---- 44 L Size Score 45 L0 0B 0.0 46 L1 0B 0.0 47 L2 0B 0.0 48 L3 0B 0.0 49 L4 0B 0.0 50 L5 729B 4.5 51 L6 321KB - 52 53 # Ensure that point deletions in a higher level result in a compensated level 54 # size and higher level scores as a result. 55 56 define lbase-max-bytes=65536 enable-table-stats=false 57 L5 58 a.DEL.2: 59 b.DEL.2: 60 c.DEL.2: 61 d.DEL.2: 62 e.DEL.2: 63 L6 64 a.SET.1:<rand-bytes=65536> 65 b.SET.1:<rand-bytes=65536> 66 c.SET.1:<rand-bytes=65536> 67 d.SET.1:<rand-bytes=65536> 68 e.SET.1:<rand-bytes=65536> 69 ---- 70 5: 71 000004:[a#2,DEL-e#2,DEL] 72 6: 73 000005:[a#1,SET-e#1,SET] 74 75 scores 76 ---- 77 L Size Score 78 L0 0B 0.0 79 L1 0B 0.0 80 L2 0B 0.0 81 L3 0B 0.0 82 L4 0B 0.0 83 L5 715B 0.0 84 L6 321KB - 85 86 enable-table-stats 87 ---- 88 89 wait-pending-table-stats 90 000004 91 ---- 92 num-entries: 5 93 num-deletions: 5 94 num-range-key-sets: 0 95 point-deletions-bytes-estimate: 164581 96 range-deletions-bytes-estimate: 0 97 98 scores 99 ---- 100 L Size Score 101 L0 0B 0.0 102 L1 0B 0.0 103 L2 0B 0.0 104 L3 0B 0.0 105 L4 0B 0.0 106 L5 715B 2.3 107 L6 321KB - 108 109 # Run a similar test as above, but this time the table containing the DELs is 110 # ingested after the database is initialized. When the ingested sstable's stats 111 # are loaded and automatic compactions are re-enabled, it should trigger an 112 # automatic compaction of the ingested sstable on account of the high 113 # point-deletions-bytes-estimate value. 114 # 115 # This a regression test for an issue where the table stats collector wouldn't 116 # attempt to schedule a compaction if a file only had compensation due to point 117 # deletions and not range deletions. 118 119 define lbase-max-bytes=65536 enable-table-stats=true auto-compactions=off 120 L6 121 a.SET.1:<rand-bytes=65536> 122 b.SET.1:<rand-bytes=65536> 123 c.SET.1:<rand-bytes=65536> 124 d.SET.1:<rand-bytes=65536> 125 e.SET.1:<rand-bytes=65536> 126 ---- 127 6: 128 000004:[a#1,SET-e#1,SET] 129 130 ingest ext1 131 del a: 132 del b: 133 del c: 134 del d: 135 del e: 136 ---- 137 5: 138 000005:[a:#10,DEL-e:#10,DEL] 139 6: 140 000004:[a#1,SET-e#1,SET] 141 142 wait-pending-table-stats 143 000005 144 ---- 145 num-entries: 5 146 num-deletions: 5 147 num-range-key-sets: 0 148 point-deletions-bytes-estimate: 164616 149 range-deletions-bytes-estimate: 0 150 151 maybe-compact 152 ---- 153 1 compactions in progress: 154 5: 000005:a:#10,0-e:#10,0 155 6: 000004:a#1,1-e#1,1 156 157 scores 158 ---- 159 L Size Score 160 L0 0B 0.0 161 L1 0B 0.0 162 L2 0B 0.0 163 L3 0B 0.0 164 L4 0B 0.0 165 L5 0B 0.0 166 L6 321KB - 167 168 lsm 169 ---- 170 6: 171 000006:[a#0,SET-e#0,SET] 172 173 # Test the adjustment of level sizes to accommodate in-progress compactions. A 174 # compaction may be "inProgress" if it's already been applied, but is still 175 # deleting obsolete files. These compactions' effects have already been applied 176 # to the LSM, so size adjustment should ignore them and not doubly adjust sizes. 177 178 define lbase-max-bytes=65536 enable-table-stats=false auto-compactions=on pause-cleaning 179 L5 180 aa.SET.2:<rand-bytes=131072> 181 bb.SET.2:<rand-bytes=131072> 182 cc.SET.2:<rand-bytes=131072> 183 dd.SET.2:<rand-bytes=131072> 184 L5 185 e.SET.2:<rand-bytes=131072> 186 L6 187 a.SET.1:<rand-bytes=65536> 188 b.SET.1:<rand-bytes=65536> 189 c.SET.1:<rand-bytes=65536> 190 d.SET.1:<rand-bytes=65536> 191 L6 192 e.SET.1:<rand-bytes=131072> 193 ---- 194 5: 195 000004:[aa#2,SET-dd#2,SET] 196 000005:[e#2,SET-e#2,SET] 197 6: 198 000006:[a#1,SET-d#1,SET] 199 000007:[e#1,SET-e#1,SET] 200 201 scores 202 ---- 203 L Size Score 204 L0 0B 0.0 205 L1 0B 0.0 206 L2 0B 0.0 207 L3 0B 0.0 208 L4 0B 0.0 209 L5 641KB 6.3 210 L6 385KB - 211 212 lsm verbose 213 ---- 214 5: 215 000004:[aa#2,SET-dd#2,SET] seqnums:[2-2] points:[aa#2,SET-dd#2,SET] 216 000005:[e#2,SET-e#2,SET] seqnums:[2-2] points:[e#2,SET-e#2,SET] 217 6: 218 000006:[a#1,SET-d#1,SET] seqnums:[1-1] points:[a#1,SET-d#1,SET] 219 000007:[e#1,SET-e#1,SET] seqnums:[1-1] points:[e#1,SET-e#1,SET] 220 221 # Attempting to schedule a compaction should begin a L5->L6 compaction. 222 223 maybe-compact 224 ---- 225 1 compactions in progress: 226 5: 000004:aa#2,1-dd#2,1 227 6: 000006:a#1,1-d#1,1 228 229 # The scores and sizes should be stable between when the version edit has been 230 # applied but the compaction has not completed, and when the compaction is 231 # finally complete. 232 233 scores wait-for-compaction=version-edit 234 ---- 235 L Size Score 236 L0 0B 0.0 237 L1 0B 0.0 238 L2 0B 0.0 239 L3 0B 0.0 240 L4 0B 0.0 241 L5 129KB 0.5 242 L6 898KB - 243 244 lsm 245 ---- 246 5: 247 000005:[e#2,SET-e#2,SET] 248 6: 249 000008:[a#0,SET-dd#0,SET] 250 000007:[e#1,SET-e#1,SET] 251 252 resume-cleaning 253 ---- 254 255 scores wait-for-compaction=completion 256 ---- 257 L Size Score 258 L0 0B 0.0 259 L1 0B 0.0 260 L2 0B 0.0 261 L3 0B 0.0 262 L4 0B 0.0 263 L5 129KB 0.5 264 L6 898KB -