Fix AccordCommandsPurger universal durability check

This commit is contained in:
Ariel Weisberg 2023-12-04 16:21:07 -05:00 committed by David Capwell
parent 021b06639e
commit 1f4675a902
3 changed files with 10 additions and 8 deletions

@ -1 +1 @@
Subproject commit 3ca9e55024192e9b7c38ad5330229830343b74f2
Subproject commit 9f21a24660fe49881e0131813f9eff850e25b3dc

View File

@ -31,7 +31,7 @@ import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Ordering;
import accord.local.Commands;
import accord.local.Cleanup;
import accord.local.DurableBefore;
import accord.local.RedundantBefore;
import accord.local.SaveStatus;
@ -90,8 +90,8 @@ import org.apache.cassandra.service.paxos.uncommitted.PaxosRows;
import org.apache.cassandra.utils.Pair;
import org.apache.cassandra.utils.TimeUUID;
import static accord.local.Commands.Cleanup.TRUNCATE_WITH_OUTCOME;
import static accord.local.Status.Durability.Universal;
import static accord.local.Cleanup.TRUNCATE_WITH_OUTCOME;
import static accord.local.Cleanup.shouldCleanup;
import static com.google.common.base.Preconditions.checkState;
import static java.util.concurrent.TimeUnit.MICROSECONDS;
import static org.apache.cassandra.config.Config.PaxosStatePurging.legacy;
@ -803,7 +803,7 @@ public class CompactionIterator extends CompactionInfo.Holder implements Unfilte
// When commands end up being sliced by compaction we need this to discard tombstones and slices
// without enough information to run the rest of the cleanup logic
if (durableBefore.min(txnId) == Universal)
if (Cleanup.isSafeToCleanup(durableBefore, txnId))
return null;
Cell durabilityCell = row.getCell(CommandsColumns.durability);
@ -821,9 +821,10 @@ public class CompactionIterator extends CompactionInfo.Holder implements Unfilte
if (executeAt == null || durability == null || saveStatus == null || route == null)
return row;
Commands.Cleanup cleanup = Commands.shouldCleanup(txnId, saveStatus.status,
durability, executeAt, route,
redundantBefore, durableBefore);
Cleanup cleanup = shouldCleanup(txnId, saveStatus.status,
durability, executeAt, route,
redundantBefore, durableBefore,
false);
switch (cleanup)
{
default: throw new AssertionError(String.format("Unexpected cleanup task: %s", cleanup));

View File

@ -364,6 +364,7 @@ public class AccordKeyspace
// If durability is not universal we don't want to delete older versions of the row that might have recorded
// a higher durability value. maybeDropTruncatedCommandColumns will take care of dropping things even if we don't drop via tombstones.
// durability should be the only column that could have an older value that is insufficient for propagating forward
// TODO (now): with UniversalOrInvalidated should this change?
boolean doDeletion = durability == Durability.Universal;
// We may not have what we need to generate a deletion and include the outcome in the truncated row