Skip to content

Commit

Permalink
metamorphic: ingestAndExcise key manager fixes
Browse files Browse the repository at this point in the history
This change makes some fixes to prevent overwriting too much
keyManager history when merging a batch into the db as part of an
ingestAndExciseOp.
  • Loading branch information
itsbilal committed Mar 22, 2024
1 parent 35d8091 commit 83e9444
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion metamorphic/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func multiInstanceConfig() OpConfig {
cfg := DefaultOpConfig()
cfg.ops[OpReplicate] = 5
// Single deletes and merges are disabled in multi-instance mode, as
// replicateOp and ingestAndExciseOp don't support them.
// replicateOp doesn't support them.
cfg.ops[OpWriterSingleDelete] = 0
cfg.ops[OpWriterMerge] = 0

Expand Down
15 changes: 3 additions & 12 deletions metamorphic/key_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,18 +636,9 @@ func (k *keyManager) update(o op) {
//
// Remove all keys from the key manager within the excise span before
// merging the batch into the db.
ts := k.nextMetaTimestamp()
keyRange := pebble.KeyRange{Start: s.exciseStart, End: s.exciseEnd}
for _, key := range k.knownKeysInRange(keyRange) {
meta := k.getOrInit(s.batchID, key)
if meta.objID.tag() == dbTag {
meta.clear()
} else {
meta.history = append(meta.history, keyHistoryItem{
opType: OpWriterDeleteRange, // Mimic a DeleteRange.
metaTimestamp: ts,
})
}
for _, key := range k.InRangeKeysForObj(s.dbID, s.exciseStart, s.exciseEnd) {
m := k.getOrInit(s.dbID, key.key)
m.clear()
}
k.objKeyMeta(s.batchID).CollapseKeys()
k.mergeObjectInto(s.batchID, s.dbID)
Expand Down

0 comments on commit 83e9444

Please sign in to comment.