This is an automated email from the ASF dual-hosted git repository.

ifesdjeen pushed a commit to branch ex-sp-pl
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git

commit 97f73d926ba904fa071e2fdfe8e61c6ebeb6dc31
Author: Benedict Elliott Smith <[email protected]>
AuthorDate: Sun Sep 29 11:31:40 2024 +0100

    EXPUNGE_PARTIAL
---
 accord-core/src/main/java/accord/local/Cleanup.java            | 5 ++++-
 accord-core/src/main/java/accord/local/cfk/CommandsForKey.java | 2 +-
 accord-core/src/main/java/accord/local/cfk/Updating.java       | 9 +++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/accord-core/src/main/java/accord/local/Cleanup.java 
b/accord-core/src/main/java/accord/local/Cleanup.java
index 765fddeb..63ef7664 100644
--- a/accord-core/src/main/java/accord/local/Cleanup.java
+++ b/accord-core/src/main/java/accord/local/Cleanup.java
@@ -57,6 +57,8 @@ public enum Cleanup
     INVALIDATE(Invalidated),
     VESTIGIAL(ErasedOrVestigial),
     ERASE(Erased),
+    // erase all fields except any participants and committed executeAt
+    EXPUNGE_PARTIAL(Erased),
     // we can stop storing the record entirely
     EXPUNGE(Erased);
 
@@ -165,7 +167,7 @@ public enum Cleanup
                 case Applying:
                     return TRUNCATE_WITH_OUTCOME;
                 default:
-                    return EXPUNGE;
+                    return EXPUNGE_PARTIAL;
             }
         }
 
@@ -217,6 +219,7 @@ public enum Cleanup
 
             case UniversalOrInvalidated:
             case Universal:
+                // TODO (expected): can we EXPUNGE here?
                 return Cleanup.ERASE;
         }
     }
diff --git a/accord-core/src/main/java/accord/local/cfk/CommandsForKey.java 
b/accord-core/src/main/java/accord/local/cfk/CommandsForKey.java
index 5aad9df6..b1489ac0 100644
--- a/accord-core/src/main/java/accord/local/cfk/CommandsForKey.java
+++ b/accord-core/src/main/java/accord/local/cfk/CommandsForKey.java
@@ -1346,7 +1346,7 @@ public class CommandsForKey extends CommandsForKeyUpdate 
implements CommandsSumm
             TxnInfo txn = byId[i];
             if (txn.status() == INVALID_OR_TRUNCATED_OR_PRUNED) continue;
             if (txn.isCommittedAndExecutes()) ++countCommitted;
-            else if (minUndecidedById == -1 && mayExecute(newBoundsInfo, txn) 
&& isPostBootstrapAndOwned(txn, newBoundsInfo))
+            else if (minUndecidedById == -1 && !txn.isCommittedToExecute() && 
txn.mayExecute())
                 minUndecidedById = i;
         }
         TxnInfo[] committedByExecuteAt = new TxnInfo[countCommitted];
diff --git a/accord-core/src/main/java/accord/local/cfk/Updating.java 
b/accord-core/src/main/java/accord/local/cfk/Updating.java
index 86b40e94..1e8b319a 100644
--- a/accord-core/src/main/java/accord/local/cfk/Updating.java
+++ b/accord-core/src/main/java/accord/local/cfk/Updating.java
@@ -614,7 +614,7 @@ class Updating
                 int maxAppliedWriteByExecuteAt = 
cfk.maxAppliedWriteByExecuteAt;
                 if (pos <= maxAppliedWriteByExecuteAt)
                 {
-                    if (pos < maxAppliedWriteByExecuteAt && !wasPruned && 
cfk.isPostBootstrapAndOwned(newInfo))
+                    if (pos < maxAppliedWriteByExecuteAt && !wasPruned)
                     {
                         for (int i = pos; i <= maxAppliedWriteByExecuteAt; ++i)
                         {
@@ -671,16 +671,13 @@ class Updating
 
     private static int 
maybeAdvanceMaxAppliedAndCheckForLinearizabilityViolations(CommandsForKey cfk, 
int appliedPos, Txn.Kind appliedKind, TxnInfo applied, boolean wasPruned)
     {
-        if (!wasPruned && cfk.isPostBootstrapAndOwned(applied))
+        if (!wasPruned)
         {
             TxnInfo[] committedByExecuteAt = cfk.committedByExecuteAt;
             for (int i = cfk.maxAppliedWriteByExecuteAt + 1; i < appliedPos ; 
++i)
             {
                 if (committedByExecuteAt[i].status() != APPLIED
                     && appliedKind.witnesses(committedByExecuteAt[i])
-                    && cfk.isPostBootstrapAndOwned(committedByExecuteAt[i])
-                    && cfk.boundsInfo.startOwnershipEpoch <= 
applied.executeAt.epoch()
-                    && cfk.boundsInfo.endOwnershipEpoch > 
applied.executeAt.epoch()
                     && reportLinearizabilityViolations())
                         logger.error("Linearizability violation on key {}: {} 
is committed to execute (at {}) before {} that should witness it but has 
already applied (at {})", cfk.key, committedByExecuteAt[i].plainTxnId(), 
committedByExecuteAt[i].plainExecuteAt(), applied.plainTxnId(), 
applied.plainExecuteAt());
             }
@@ -696,7 +693,7 @@ class Updating
             if (pos == infos.length)
                 return -1;
 
-            if (infos[pos].status().compareTo(COMMITTED) < 0 && 
cfk.mayExecute(infos[pos]) && cfk.isPostBootstrapAndOwned(infos[pos]))
+            if (infos[pos].status().compareTo(COMMITTED) < 0 && 
cfk.mayExecute(infos[pos]))
                 return pos;
 
             ++pos;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to