Commit 751e1d0
committed
manifest: rework blob file reference counting
Rework the reference counting of in-use blob files to decouple the reference
counts from the TableMetadatas' blob references. With the introduction of blob
file rewrites and replacement, the physical blob file and the logical blob
file's references have distinct lifetimes. A physical blob file that has been
replaced will need to be removed once all Versions that predate the replacement
have been unreferenced.
This commit renames the struct previously known as BlobFileMetadata to
PhysicalBlobFile, describing metadata particular to a physical file backing a
logical blob file. A new BlobFileMetadata struct is introduced that holds a
BlobFileID and a pointer to the PhysicalBlobFile.
This commit additionally adapts the physical blob file referencing to occur
through a separate B-Tree of BlobFileMetadata structs. Similar to
TableMetadata, references to blob files are maintained by copy-on-write B-Tree
nodes which themselves are reference counted. A PhysicalBlobFile's reference
count is incremented when a new B-Tree node references a containing
BlobFileMetadata, and it's decremented when the B-Tree node's reference count
falls to zero. This indirection ensures that a mutation to the set of blob
files only performs log(n) work. Since addition and removal of blob files
within a version is now modeled directly (as opposed to indirectly via
TableMetadata BlobReferences), a blob file may be removed or replaced within
the set before all referencing TableMetadata are removed.
Informs #4802.1 parent 507d3bd commit 751e1d0
File tree
18 files changed
+407
-231
lines changed- internal
- compact
- manifest
- testdata
- compaction
- iter_histories
18 files changed
+407
-231
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
364 | 363 | | |
365 | 364 | | |
366 | 365 | | |
| |||
471 | 470 | | |
472 | 471 | | |
473 | 472 | | |
474 | | - | |
| 473 | + | |
475 | 474 | | |
476 | 475 | | |
477 | 476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2478 | 2478 | | |
2479 | 2479 | | |
2480 | 2480 | | |
2481 | | - | |
| 2481 | + | |
2482 | 2482 | | |
2483 | 2483 | | |
2484 | 2484 | | |
| |||
2488 | 2488 | | |
2489 | 2489 | | |
2490 | 2490 | | |
2491 | | - | |
| 2491 | + | |
2492 | 2492 | | |
2493 | 2493 | | |
2494 | | - | |
| 2494 | + | |
2495 | 2495 | | |
2496 | 2496 | | |
2497 | 2497 | | |
| |||
3105 | 3105 | | |
3106 | 3106 | | |
3107 | 3107 | | |
3108 | | - | |
| 3108 | + | |
3109 | 3109 | | |
3110 | 3110 | | |
3111 | 3111 | | |
| |||
3291 | 3291 | | |
3292 | 3292 | | |
3293 | 3293 | | |
3294 | | - | |
| 3294 | + | |
3295 | 3295 | | |
3296 | 3296 | | |
3297 | 3297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
927 | 927 | | |
928 | 928 | | |
929 | 929 | | |
930 | | - | |
| 930 | + | |
931 | 931 | | |
932 | 932 | | |
933 | 933 | | |
| |||
1640 | 1640 | | |
1641 | 1641 | | |
1642 | 1642 | | |
1643 | | - | |
| 1643 | + | |
| 1644 | + | |
1644 | 1645 | | |
1645 | 1646 | | |
1646 | 1647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
1234 | 1233 | | |
1235 | 1234 | | |
1236 | 1235 | | |
1237 | | - | |
1238 | | - | |
| 1236 | + | |
1239 | 1237 | | |
1240 | | - | |
| 1238 | + | |
1241 | 1239 | | |
1242 | 1240 | | |
1243 | 1241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
0 commit comments