You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "belliottsmith (via GitHub)" <gi...@apache.org> on 2026/06/08 11:21:20 UTC

[PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

belliottsmith opened a new pull request, #278:
URL: https://github.com/apache/cassandra-accord/pull/278

   …, but this is incorrect as Cleanup.EXPUNGE may have dropped the data and the record must receive cleanup EXPUNGE and be reported as ERASED. This can lead to lienarizability violations.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith merged PR #278:
URL: https://github.com/apache/cassandra-accord/pull/278


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

Posted by "alanwang67 (via GitHub)" <gi...@apache.org>.
alanwang67 commented on PR #278:
URL: https://github.com/apache/cassandra-accord/pull/278#issuecomment-4673905665

   +1


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #278:
URL: https://github.com/apache/cassandra-accord/pull/278#discussion_r3418898668


##########
accord-core/src/main/java/accord/impl/DefaultLocalListeners.java:
##########
@@ -307,10 +307,17 @@ RegisteredComplexListeners remove(RegisteredComplexListener remove)
             Invariants.require(listeners[index] == remove);
             listeners[index] = null;
             remove.index = -1;
-            // we don't decrement length even if count==length so as to simplify reentry
-            --count;
-            if (Invariants.isParanoid() && !notifying) checkIntegrity();
-            return count > 0 || notifying ? this : null;
+            if (--count == 0)

Review Comment:
   Looks like `DefaultLocalListeners` would now fail because of this behavior change 
   
   ```
   Caused by: org.opentest4j.AssertionFailedError: expected: <[14, 15]> but was: <[15, 14]>
   	at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
   	at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
   	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
   	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
   	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124)
   	at accord.impl.LocalListenersTest$TestCase.notifyOne(LocalListenersTest.java:187)
   	at accord.impl.LocalListenersTest$TestCase.run(LocalListenersTest.java:126)
   	at accord.impl.LocalListenersTest.lambda$testOne$0(LocalListenersTest.java:80)
   ```
   
   Looks like we need to copy with shift, or are we ok with the order change here?



##########
accord-core/src/main/java/accord/local/RedundantBefore.java:
##########
@@ -1129,8 +1132,14 @@ public Participants<?> expectToOwn(TxnId txnId, @Nullable Timestamp executeAt, P
 
     public boolean isAtLeast(RedundantBefore atLeast)
     {
+        if (!ranges().containsAll(atLeast.ranges()))
+            return false;
+
         return foldl((b, v, al, e) -> {
             return al.foldl(Ranges.of(b.range), (lb, v2, ub) -> {
+                if (!v2 || ub.endEpoch > lb.endEpoch || ub.startEpoch != lb.startEpoch)

Review Comment:
   I might be not fully understanding, but is it enough to check for `!=`, don't we need to check for `ub`  as smaller than?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #278:
URL: https://github.com/apache/cassandra-accord/pull/278#discussion_r3419960420


##########
accord-core/src/main/java/accord/impl/DefaultLocalListeners.java:
##########
@@ -307,10 +307,17 @@ RegisteredComplexListeners remove(RegisteredComplexListener remove)
             Invariants.require(listeners[index] == remove);
             listeners[index] = null;
             remove.index = -1;
-            // we don't decrement length even if count==length so as to simplify reentry
-            --count;
-            if (Invariants.isParanoid() && !notifying) checkIntegrity();
-            return count > 0 || notifying ? this : null;
+            if (--count == 0)

Review Comment:
   The test is actually quite sophisticated, and tests behaviour when listeners modify other listeners. I think having the same level of test sophistication without a predefined visitation order will be hard, so I will restore the guaranteed visitation order.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #278:
URL: https://github.com/apache/cassandra-accord/pull/278#discussion_r3419500121


##########
accord-core/src/main/java/accord/impl/DefaultLocalListeners.java:
##########
@@ -307,10 +307,17 @@ RegisteredComplexListeners remove(RegisteredComplexListener remove)
             Invariants.require(listeners[index] == remove);
             listeners[index] = null;
             remove.index = -1;
-            // we don't decrement length even if count==length so as to simplify reentry
-            --count;
-            if (Invariants.isParanoid() && !notifying) checkIntegrity();
-            return count > 0 || notifying ? this : null;
+            if (--count == 0)

Review Comment:
   Oh, yeah I don't think we guarantee (or rely on any such guarantee) any order of visitation. That was a function of some shenanigans we did to avoid entering the hash map twice (once to notify, once to remove). But, we cannot both not hold the lock while notifying and not enter the hash map twice, and we have to not hold the lock, so there's no point to the extra complexity.



##########
accord-core/src/main/java/accord/impl/DefaultLocalListeners.java:
##########
@@ -307,10 +307,17 @@ RegisteredComplexListeners remove(RegisteredComplexListener remove)
             Invariants.require(listeners[index] == remove);
             listeners[index] = null;
             remove.index = -1;
-            // we don't decrement length even if count==length so as to simplify reentry
-            --count;
-            if (Invariants.isParanoid() && !notifying) checkIntegrity();
-            return count > 0 || notifying ? this : null;
+            if (--count == 0)

Review Comment:
   I'll take a look at the test



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CommandChanges.shouldCleanup short-circuits to NO if there is no data… [cassandra-accord]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #278:
URL: https://github.com/apache/cassandra-accord/pull/278#discussion_r3419489883


##########
accord-core/src/main/java/accord/local/RedundantBefore.java:
##########
@@ -1129,8 +1132,14 @@ public Participants<?> expectToOwn(TxnId txnId, @Nullable Timestamp executeAt, P
 
     public boolean isAtLeast(RedundantBefore atLeast)
     {
+        if (!ranges().containsAll(atLeast.ranges()))
+            return false;
+
         return foldl((b, v, al, e) -> {
             return al.foldl(Ranges.of(b.range), (lb, v2, ub) -> {
+                if (!v2 || ub.endEpoch > lb.endEpoch || ub.startEpoch != lb.startEpoch)

Review Comment:
   end epoch is only ever Long.MAX_VALUE or the actual end epoch. So we could tighten it to `(ub.endEpoch != lb.endEpoch && lb.endEpoch != Long.MAX_VALUE)` if you like



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org