Skip to content

Conversation

@joaquincasares
Copy link
Contributor

Fix ConcurrentModificationException in performGarbageCollection with only_purge_repaired_tombstones

When running nodetool garbagecollect on a table with mixed repaired/unrepaired SSTables and only_purge_repaired_tombstones=true, a ConcurrentModificationException was thrown because the code iterated directly over transaction.originals() while calling transaction.cancel() inside the loop, modifying the underlying collection.

The fix copies the collection before iterating: new ArrayList<>(transaction.originals())

Tests run via:

TEST_NAME_REGEX=GarbageCollectRepairedSSTablesTest docker compose up --build

Copy link
Member

@michaelsembwever michaelsembwever left a 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)

@joaquincasares
Copy link
Contributor Author

lgtm, just nits for readability (and redundant docker approach)

@michaelsembwever thank you for the review! All requested changes have been implemented.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the first sentence above is more than enough.

but if you want to keep the second part and stacktrace snippet, at least do

Suggested change
* Before CASSANDRA-21065 this would fail with:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the method actually testing then ?

Better to be direct about what the test method's value actually is. (Rather than describe what it is not.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace System.err with LOGGER.error

(all 11 occurrences in this file)

Comment on lines 351 to 354
Copy link
Member

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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants