Skip to content

CASSANDRA-21212 Deleted Retired Command Stores#4668

Open
alanwang67 wants to merge 9 commits intoapache:trunkfrom
alanwang67:alanwang599/CASSANDRA-21212/trunk
Open

CASSANDRA-21212 Deleted Retired Command Stores#4668
alanwang67 wants to merge 9 commits intoapache:trunkfrom
alanwang67:alanwang599/CASSANDRA-21212/trunk

Conversation

@alanwang67
Copy link
Contributor

Adds a test for apache/cassandra-accord#269.

{
try
{
if (epoch >= waitingForEpoch && AccordService.instance().topology().active().get(waitingForEpoch).retired().containsAll(waitingForRange))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would make waitingForRange non-final, and subtract from it the ranges we witness that supersede the epoch we're waiting on, so we don't need to continually consult global state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think I originally decided to go this way because there is a potential race condition between us calculating the exact ranges that need to be retired and the registering of the listener. But now that I think about it there is still a race condition in the way it's currently being done, except that if another range is retired afterwards then it is fine since we consult the global state.

Not sure if this is the canonical way to do things with listener timing, but just added an additional update to get any changes to the ranges that were retired that were done in between us calculating it and the registering of the listener.

waitForEpochAndRangeRetirement wait = new waitForEpochAndRangeRetirement(condition, regainingEpochRange.epoch(), regainingEpochRange.range());
AccordService.instance().topology().addListener(wait);
condition.awaitThrowUncheckedOnInterrupt();
AccordService.instance().topology().removeListener(wait);
Copy link
Contributor

Choose a reason for hiding this comment

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

this should happen in a finally block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean just the removeListener? Since if we put the whole code block in a finally then we don't wait for the ranges to be retired prior to TCM committing the start move.

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