-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-21065: Fix ConcurrentModificationException in performGarbageCollection with only_purge_repaired_tombstones #4571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
… by copying transaction.originals()
michaelsembwever
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just nits for readability (and redundant docker approach)
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/GarbageCollectRepairedSSTablesTest.java
Outdated
Show resolved
Hide resolved
src/java/org/apache/cassandra/db/compaction/CompactionManager.java
Outdated
Show resolved
Hide resolved
Co-authored-by: mck <mck@apache.org>
Remove redundant comments in the garbage collection test.
@michaelsembwever thank you for the review! All requested changes have been implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above, and against the test methods there's repeated mention of the ConcurrentModificationException.
but that's not the only value of these test methods. and four of these methods don't even break without the patch, so have nothing to do with the ConcurrentModificationException bug– the test methods still add value, but their value-add can be documented more accurately.
test/unit/org/apache/cassandra/db/compaction/CompactionGarbageCollectOnlyPurgeRepairedTest.java
Outdated
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/CompactionGarbageCollectOnlyPurgeRepairedTest.java
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/CompactionGarbageCollectOnlyPurgeRepairedTest.java
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/CompactionGarbageCollectOnlyPurgeRepairedTest.java
Show resolved
Hide resolved
test/unit/org/apache/cassandra/db/compaction/CompactionGarbageCollectOnlyPurgeRepairedTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious) do you know how to reproduce this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@michaelsembwever , I've made a few changes to the PR that should be clearer now. 🤞 Essentially, I was testing that my change didn't break other more basic cases on the more often beaten path. If you want, we can definitely remove them, but I figure they would be good test cases to have for future changes in either case. Regarding the remaining three comments, I ran the same test file with and without the fix within CompactionManager.java. On the previous release, we ended up having issues only on those tests that were looking for leaks. When I applied the fix, those tests passed. testLeakDetectionWithAwaitility and testNoLeakDetectionWithAwaitility are less testing Cassandra and more testing the method of the fix to ensure that the fix was ideal. These are probably less valuable to include in the codebase, but I included them so we had them for the review at the very least. Do let me know if you want me to remove any specific test cases, since I am aware of test-bloat, but figured to include them so we had them during the review process. |
Fix ConcurrentModificationException in performGarbageCollection with only_purge_repaired_tombstones
When running
nodetool garbagecollecton a table with mixed repaired/unrepaired SSTables andonly_purge_repaired_tombstones=true, a ConcurrentModificationException was thrown because the code iterated directly overtransaction.originals()while callingtransaction.cancel()inside the loop, modifying the underlying collection.The fix copies the collection before iterating:
new ArrayList<>(transaction.originals())Tests run via: