Skip to content

Commit 2fa0183

Browse files
committed
db: check FormatExciseBoundsRecord against the current format version
Only populate the ve.ExciseBoundsRecord if the version is eligible
1 parent 7a51062 commit 2fa0183

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

compaction.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,11 +1588,12 @@ func (d *DB) runIngestFlush(c *tableCompaction) (*manifest.VersionEdit, error) {
15881588
}
15891589
if ingestFlushable.exciseSpan.Valid() {
15901590
exciseBounds := ingestFlushable.exciseSpan.UserKeyBounds()
1591-
ve.ExciseBoundsRecord = append(ve.ExciseBoundsRecord, manifest.ExciseOpEntry{
1592-
Bounds: exciseBounds,
1593-
SeqNum: ingestFlushable.exciseSeqNum,
1594-
})
1595-
1591+
if d.FormatMajorVersion() >= FormatExciseBoundsRecord {
1592+
ve.ExciseBoundsRecord = append(ve.ExciseBoundsRecord, manifest.ExciseOpEntry{
1593+
Bounds: exciseBounds,
1594+
SeqNum: ingestFlushable.exciseSeqNum,
1595+
})
1596+
}
15961597
// Iterate through all levels and find files that intersect with exciseSpan.
15971598
for layer, ls := range version.AllLevelsAndSublevels() {
15981599
for m := range ls.Overlaps(d.cmp, ingestFlushable.exciseSpan.UserKeyBounds()).All() {

ingest.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,10 +2108,12 @@ func (d *DB) ingestApply(
21082108
updateLevelMetricsOnExcise(m, layer.Level(), newFiles)
21092109
}
21102110
}
2111-
ve.ExciseBoundsRecord = append(ve.ExciseBoundsRecord, manifest.ExciseOpEntry{
2112-
Bounds: exciseBounds,
2113-
SeqNum: exciseSeqNum,
2114-
})
2111+
if d.FormatMajorVersion() >= FormatExciseBoundsRecord {
2112+
ve.ExciseBoundsRecord = append(ve.ExciseBoundsRecord, manifest.ExciseOpEntry{
2113+
Bounds: exciseBounds,
2114+
SeqNum: exciseSeqNum,
2115+
})
2116+
}
21152117
}
21162118
if len(filesToSplit) > 0 {
21172119
// For the same reasons as the above call to excise, we hold the db mutex

0 commit comments

Comments
 (0)