Commit cbec1ce
manifest: move L0-specific fields from TableMetadata into l0Sublevels
TableMetadata contained four L0-specific fields (SubLevel, L0Index,
minIntervalIndex, maxIntervalIndex) that were only meaningful for L0
files, only valid for the most recent Version's l0Sublevels, and written
exclusively by l0Sublevels code. Storing them on the shared TableMetadata
struct was fragile because any code could accidentally read stale values
from a non-current Version.
This change introduces an l0FileState struct and stores per-file state in
l0Sublevels via a fileState slice (indexed by file position) and a
fileStateMap (TableNum -> index). The L0Index concept is now implicit as
the index into fileState.
L0CompactionFiles.FilesIncluded is changed from bitSet (indexed by
L0Index) to map[base.TableNum]struct{}, eliminating the need for
L0Index to be accessible outside l0Sublevels.
An L0Organizer.SubLevelOf method is added for external callers (e.g.
generateSublevelInfo in compaction_picker.go) that need to look up a
file's sublevel.
Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>1 parent 56dd893 commit cbec1ce
8 files changed
Lines changed: 241 additions & 168 deletions
File tree
- internal
- compact/testdata
- manifest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
| 152 | + | |
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
| |||
442 | 445 | | |
443 | 446 | | |
444 | 447 | | |
445 | | - | |
| 448 | + | |
446 | 449 | | |
447 | 450 | | |
448 | 451 | | |
| |||
546 | 549 | | |
547 | 550 | | |
548 | 551 | | |
549 | | - | |
| 552 | + | |
550 | 553 | | |
551 | 554 | | |
552 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1078 | 1083 | | |
1079 | 1084 | | |
1080 | 1085 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2368 | 2368 | | |
2369 | 2369 | | |
2370 | 2370 | | |
2371 | | - | |
2372 | 2371 | | |
2373 | 2372 | | |
2374 | 2373 | | |
| |||
2390 | 2389 | | |
2391 | 2390 | | |
2392 | 2391 | | |
2393 | | - | |
| 2392 | + | |
2394 | 2393 | | |
2395 | 2394 | | |
2396 | 2395 | | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
2397 | 2400 | | |
2398 | 2401 | | |
2399 | 2402 | | |
| |||
2423 | 2426 | | |
2424 | 2427 | | |
2425 | 2428 | | |
2426 | | - | |
2427 | 2429 | | |
2428 | 2430 | | |
2429 | 2431 | | |
| |||
2437 | 2439 | | |
2438 | 2440 | | |
2439 | 2441 | | |
2440 | | - | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
2441 | 2457 | | |
2442 | 2458 | | |
2443 | 2459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
158 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
159 | 159 | | |
160 | | - | |
161 | | - | |
| 160 | + | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
0 commit comments