github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/sstable/testdata/writer_value_blocks (about) 1 # Size of value index is 3 bytes plus 5 + 5 = 10 bytes of trailer of the value 2 # block and value index block. So size 18 - 13 = 5 size of the value in the 3 # value block. 4 build 5 a@2.SET.1:a2 6 b@5.SET.7:b5 7 b@4.DEL.3: 8 b@3.SET.2:bat3 9 b@2.SET.1:vbat2 10 ---- 11 value-blocks: num-values 1, num-blocks: 1, size: 18 12 13 scan-raw 14 ---- 15 a@2#1,1:in-place a2, same-pre false 16 b@5#7,1:in-place b5, same-pre false 17 b@4#3,0: 18 b@3#2,1:in-place bat3, same-pre false 19 b@2#1,1:value-handle len 5 block 0 offset 0, att 5, same-pre true 20 21 scan 22 ---- 23 a@2#1,1:a2 24 b@5#7,1:b5 25 b@4#3,0: 26 b@3#2,1:bat3 27 b@2#1,1:vbat2 28 29 scan-cloned-lazy-values 30 ---- 31 0(in-place: len 2): a2 32 1(in-place: len 2): b5 33 2(in-place: len 0): 34 3(in-place: len 4): bat3 35 4(lazy: len 5, attr: 5): vbat2 36 37 # Size of value index is 3 bytes plus 5 + 5 = 10 bytes of trailer of the value 38 # block and value index block. So size 33 - 13 = 20 is the total size of the 39 # values in the value block. 40 build 41 blue@10.SET.20:blue10 42 blue@8.SET.18:blue8 43 blue@8.SET.16:blue8s 44 blue@6.DEL.14: 45 blue@4.SET.12:blue4 46 blue@3.SET.10:blue3 47 red@9.SET.18:red9 48 red@7.SET.8:red7 49 ---- 50 value-blocks: num-values 4, num-blocks: 1, size: 33 51 52 scan-raw 53 ---- 54 blue@10#20,1:in-place blue10, same-pre false 55 blue@8#18,1:value-handle len 5 block 0 offset 0, att 5, same-pre true 56 blue@8#16,1:value-handle len 6 block 0 offset 5, att 6, same-pre true 57 blue@6#14,0: 58 blue@4#12,1:in-place blue4, same-pre false 59 blue@3#10,1:value-handle len 5 block 0 offset 11, att 5, same-pre true 60 red@9#18,1:in-place red9, same-pre false 61 red@7#8,1:value-handle len 4 block 0 offset 16, att 4, same-pre true 62 63 scan 64 ---- 65 blue@10#20,1:blue10 66 blue@8#18,1:blue8 67 blue@8#16,1:blue8s 68 blue@6#14,0: 69 blue@4#12,1:blue4 70 blue@3#10,1:blue3 71 red@9#18,1:red9 72 red@7#8,1:red7 73 74 scan-cloned-lazy-values 75 ---- 76 0(in-place: len 6): blue10 77 1(lazy: len 5, attr: 5): blue8 78 2(lazy: len 6, attr: 6): blue8s 79 3(in-place: len 0): 80 4(in-place: len 5): blue4 81 5(lazy: len 5, attr: 5): blue3 82 6(in-place: len 4): red9 83 7(lazy: len 4, attr: 4): red7 84 85 # Multiple value blocks. Trailers of 5+5+5 for the two value blocks and the 86 # value index block, totals to 15. The values are 5+6+15=26. The value index 87 # block has to encode two tuples, each of 4 bytes (blockNumByteLength=1, 88 # blockOffsetByteLength=2, blockLengthByteLength=1), so 2*4=8. The total is 89 # 15+26+8=49 bytes, which corresponds to "size: 49" below. 90 build block-size=8 91 blue@10.SET.20:blue10 92 blue@8.SET.18:blue8 93 blue@8.SET.16:blue8s 94 blue@6.SET.16:blue6isverylong 95 ---- 96 value-blocks: num-values 3, num-blocks: 2, size: 49 97 98 scan-raw 99 ---- 100 blue@10#20,1:in-place blue10, same-pre false 101 blue@8#18,1:value-handle len 5 block 0 offset 0, att 5, same-pre true 102 blue@8#16,1:value-handle len 6 block 0 offset 5, att 6, same-pre true 103 blue@6#16,1:value-handle len 15 block 1 offset 0, att 7, same-pre true 104 105 scan 106 ---- 107 blue@10#20,1:blue10 108 blue@8#18,1:blue8 109 blue@8#16,1:blue8s 110 blue@6#16,1:blue6isverylong 111 112 scan-cloned-lazy-values 113 ---- 114 0(in-place: len 6): blue10 115 1(lazy: len 5, attr: 5): blue8 116 2(lazy: len 6, attr: 6): blue8s 117 3(lazy: len 15, attr: 7): blue6isverylong 118 119 layout 120 ---- 121 0 data (33) 122 0 record (25 = 3 [0] + 15 + 7) [restart] 123 blue@10#20,1:blue10 124 25 [restart 0] 125 33 [trailer compression=none checksum=0x5fb0d551] 126 38 data (29) 127 38 record (21 = 3 [0] + 14 + 4) [restart] 128 blue@8#18,1:value handle {valueLen:5 blockNum:0 offsetInBlock:0} 129 59 [restart 38] 130 67 [trailer compression=none checksum=0x628e4a10] 131 72 data (29) 132 72 record (21 = 3 [0] + 14 + 4) [restart] 133 blue@8#16,1:value handle {valueLen:6 blockNum:0 offsetInBlock:5} 134 93 [restart 72] 135 101 [trailer compression=none checksum=0x4e65b9b6] 136 106 data (29) 137 106 record (21 = 3 [0] + 14 + 4) [restart] 138 blue@6#16,1:value handle {valueLen:15 blockNum:1 offsetInBlock:0} 139 127 [restart 106] 140 135 [trailer compression=none checksum=0x9f60e629] 141 140 index (28) 142 140 block:0/33 [restart] 143 160 [restart 140] 144 168 [trailer compression=none checksum=0x32b37f08] 145 173 index (27) 146 173 block:38/29 [restart] 147 192 [restart 173] 148 200 [trailer compression=none checksum=0x21d27815] 149 205 index (30) 150 205 block:72/29 [restart] 151 227 [restart 205] 152 235 [trailer compression=none checksum=0xba0b26fe] 153 240 index (22) 154 240 block:106/29 [restart] 155 254 [restart 240] 156 262 [trailer compression=none checksum=0x802be702] 157 267 top-index (85) 158 267 block:140/28 [restart] 159 288 block:173/27 [restart] 160 308 block:205/30 [restart] 161 331 block:240/22 [restart] 162 346 [restart 267] 163 350 [restart 288] 164 354 [restart 308] 165 358 [restart 331] 166 352 [trailer compression=snappy checksum=0x8bd0d63a] 167 357 value-block (11) 168 373 value-block (15) 169 393 value-index (8) 170 406 properties (676) 171 406 obsolete-key (16) [restart] 172 422 pebble.num.value-blocks (27) 173 449 pebble.num.values.in.value-blocks (21) 174 470 pebble.value-blocks.size (21) 175 491 rocksdb.block.based.table.index.type (43) 176 534 rocksdb.block.based.table.prefix.filtering (20) 177 554 rocksdb.block.based.table.whole.key.filtering (23) 178 577 rocksdb.comparator (37) 179 614 rocksdb.compression (16) 180 630 rocksdb.compression_options (106) 181 736 rocksdb.data.size (14) 182 750 rocksdb.deleted.keys (15) 183 765 rocksdb.external_sst_file.global_seqno (41) 184 806 rocksdb.external_sst_file.version (14) 185 820 rocksdb.filter.size (15) 186 835 rocksdb.index.partitions (20) 187 855 rocksdb.index.size (9) 188 864 rocksdb.merge.operands (18) 189 882 rocksdb.merge.operator (24) 190 906 rocksdb.num.data.blocks (19) 191 925 rocksdb.num.entries (11) 192 936 rocksdb.num.range-deletions (19) 193 955 rocksdb.prefix.extractor.name (31) 194 986 rocksdb.property.collectors (34) 195 1020 rocksdb.raw.key.size (16) 196 1036 rocksdb.raw.value.size (14) 197 1050 rocksdb.top-level.index.size (24) 198 1074 [restart 406] 199 1082 [trailer compression=none checksum=0xbf6fe705] 200 1087 meta-index (64) 201 1087 pebble.value_index block:393/8 value-blocks-index-lengths: 1(num), 2(offset), 1(length) [restart] 202 1114 rocksdb.properties block:406/676 [restart] 203 1139 [restart 1087] 204 1143 [restart 1114] 205 1151 [trailer compression=none checksum=0x5a8a2a98] 206 1156 footer (53) 207 1156 checksum type: crc32c 208 1157 meta: offset=1087, length=64 209 1160 index: offset=267, length=85 210 1163 [padding] 211 1197 version: 4 212 1201 magic number: 0xf09faab3f09faab3 213 1209 EOF 214 215 # Require that [c,e) must be in-place. 216 build in-place-bound=(c,e) 217 blue@10.SET.20:blue10 218 blue@8.SET.18:blue8 219 c@10.SET.16:c10 220 c@8.SET.14:c8 221 e@20.SET.25:eat20 222 e@18.SET.23:eat18 223 ---- 224 value-blocks: num-values 2, num-blocks: 1, size: 23 225 226 scan-raw 227 ---- 228 blue@10#20,1:in-place blue10, same-pre false 229 blue@8#18,1:value-handle len 5 block 0 offset 0, att 5, same-pre true 230 c@10#16,1:in-place c10, same-pre false 231 c@8#14,1:in-place c8, same-pre false 232 e@20#25,1:in-place eat20, same-pre false 233 e@18#23,1:value-handle len 5 block 0 offset 5, att 5, same-pre true 234 235 scan 236 ---- 237 blue@10#20,1:blue10 238 blue@8#18,1:blue8 239 c@10#16,1:c10 240 c@8#14,1:c8 241 e@20#25,1:eat20 242 e@18#23,1:eat18 243 244 scan-cloned-lazy-values 245 ---- 246 0(in-place: len 6): blue10 247 1(lazy: len 5, attr: 5): blue8 248 2(in-place: len 3): c10 249 3(in-place: len 2): c8 250 4(in-place: len 5): eat20 251 5(lazy: len 5, attr: 5): eat18 252 253 # Try write empty values to value blocks. 254 build 255 b@5.SET.7:b5 256 b@3.SET.2: 257 c@6.DEL.7: 258 c@5.DEL.6: 259 ---- 260 value-blocks: num-values 0, num-blocks: 0, size: 0 261 262 scan-raw 263 ---- 264 b@5#7,1:in-place b5, same-pre false 265 b@3#2,1:in-place , same-pre true 266 c@6#7,0: 267 c@5#6,0: 268 269 scan 270 ---- 271 b@5#7,1:b5 272 b@3#2,1: 273 c@6#7,0: 274 c@5#6,0: 275 276 layout 277 ---- 278 0 data (66) 279 0 record (17 = 3 [0] + 11 + 3) [restart] 280 b@5#7,1:b5 281 17 record (14 = 3 [1] + 10 + 1) 282 b@3#2,1: 283 31 record (14 = 3 [0] + 11 + 0) 284 c@6#7,0: 285 45 record (13 = 3 [1] + 10 + 0) 286 c@5#6,0: 287 58 [restart 0] 288 66 [trailer compression=none checksum=0x4e91250f] 289 71 index (22) 290 71 block:0/66 [restart] 291 85 [restart 71] 292 93 [trailer compression=none checksum=0xf80f5bcf] 293 98 properties (606) 294 98 obsolete-key (16) [restart] 295 114 pebble.raw.point-tombstone.key.size (39) 296 153 rocksdb.block.based.table.index.type (43) 297 196 rocksdb.block.based.table.prefix.filtering (20) 298 216 rocksdb.block.based.table.whole.key.filtering (23) 299 239 rocksdb.comparator (37) 300 276 rocksdb.compression (16) 301 292 rocksdb.compression_options (106) 302 398 rocksdb.data.size (13) 303 411 rocksdb.deleted.keys (15) 304 426 rocksdb.external_sst_file.global_seqno (41) 305 467 rocksdb.external_sst_file.version (14) 306 481 rocksdb.filter.size (15) 307 496 rocksdb.index.size (14) 308 510 rocksdb.merge.operands (18) 309 528 rocksdb.merge.operator (24) 310 552 rocksdb.num.data.blocks (19) 311 571 rocksdb.num.entries (11) 312 582 rocksdb.num.range-deletions (19) 313 601 rocksdb.prefix.extractor.name (31) 314 632 rocksdb.property.collectors (34) 315 666 rocksdb.raw.key.size (16) 316 682 rocksdb.raw.value.size (14) 317 696 [restart 98] 318 704 [trailer compression=none checksum=0xb3084f65] 319 709 meta-index (32) 320 709 rocksdb.properties block:98/606 [restart] 321 733 [restart 709] 322 741 [trailer compression=none checksum=0x907a9f2c] 323 746 footer (53) 324 746 checksum type: crc32c 325 747 meta: offset=709, length=32 326 750 index: offset=71, length=22 327 752 [padding] 328 787 version: 4 329 791 magic number: 0xf09faab3f09faab3 330 799 EOF