Skip to content

Commit

Permalink
metamorphic: track bounds of rangekey operations in key manager
Browse files Browse the repository at this point in the history
This change updates the key manager to track changes to
writer bounds caused by range key operations. These could affect
the success/failure of ingestions, which is something the key
manager determines.

Fixes cockroachdb#3226.
  • Loading branch information
itsbilal committed Jan 17, 2024
1 parent baba990 commit 3b7293f
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion metamorphic/key_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,30 @@ func (k *keyManager) update(o op) {
opType: OpWriterSingleDelete,
metaTimestamp: k.nextMetaTimestamp(),
})

case *rangeKeyDeleteOp:
// Range key operations on their own don't determine singledel eligibility,
// however range key operations could be part of a batch which contains
// other operations that do affect it. If those batches were to get
// ingested, we'd need to know what the bounds of sstables generated out
// of those batches are, as that determines whether that ingestion
// will succeed or not.
k.expandBounds(s.writerID, bounds{
smallest: s.start,
largest: s.end,
largestExcl: true,
})
case *rangeKeySetOp:
k.expandBounds(s.writerID, bounds{
smallest: s.start,
largest: s.end,
largestExcl: true,
})
case *rangeKeyUnsetOp:
k.expandBounds(s.writerID, bounds{
smallest: s.start,
largest: s.end,
largestExcl: true,
})
case *ingestOp:
// Some ingestion operations may attempt to ingest overlapping sstables
// which is prohibited. We know at generation time whether these
Expand Down

0 comments on commit 3b7293f

Please sign in to comment.