Skip to content

Commit

Permalink
metamorphic: sync on derived dbs in ingestOp
Browse files Browse the repository at this point in the history
Ingesting a batch closes it. As a result we should also be syncing
on the db where a batch came from, even if it's not the db that the
batch was ingested into. This prevents cases where we close the db
before we ingest a batch that came off of it, and deletes on the
batch would then panic because the underlying db (where we do an
isFMV() call) would be nil by then.

Fixes #3055.
  • Loading branch information
itsbilal committed Nov 13, 2023
1 parent dcfb84c commit c0b4bd4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion metamorphic/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,17 @@ func (o *ingestOp) receiver() objID { return o.dbID }
func (o *ingestOp) syncObjs() objIDSlice {
// Ingest should not be concurrent with mutating the batches that will be
// ingested as sstables.
return o.batchIDs
objs := make([]objID, 0, len(o.batchIDs)+1)
objs = append(objs, o.batchIDs...)
addedDBs := make(map[objID]struct{})
for i := range o.derivedDBIDs {
_, ok := addedDBs[o.derivedDBIDs[i]]
if !ok && o.derivedDBIDs[i] != o.dbID {
objs = append(objs, o.derivedDBIDs[i])
addedDBs[o.derivedDBIDs[i]] = struct{}{}
}
}
return objs
}

func closeIters(
Expand Down

0 comments on commit c0b4bd4

Please sign in to comment.