maedhroz commented on code in PR #2660:
URL: https://github.com/apache/cassandra/pull/2660#discussion_r1319397887
##########
src/java/org/apache/cassandra/repair/RepairSession.java:
##########
@@ -185,62 +196,70 @@ public Collection<InetAddressAndPort> endpoints()
return state.commonRange.endpoints;
}
- public void trackValidationCompletion(Pair<RepairJobDesc,
InetAddressAndPort> key, ValidationTask task)
+ public synchronized void trackValidationCompletion(Pair<RepairJobDesc,
InetAddressAndPort> key, ValidationTask task)
{
+ if (terminated)
+ {
+ task.abort(new RuntimeException("Session terminated"));
+ return;
+ }
validating.put(key, task);
}
- public void trackSyncCompletion(Pair<RepairJobDesc, SyncNodePair> key,
CompletableRemoteSyncTask task)
+ public synchronized void trackSyncCompletion(Pair<RepairJobDesc,
SyncNodePair> key, CompletableRemoteSyncTask task)
{
+ if (terminated)
+ return;
syncingTasks.put(key, task);
}
/**
* Receive merkle tree response or failed response from {@code endpoint}
for current repair job.
*
* @param desc repair job description
- * @param endpoint endpoint that sent merkle tree
- * @param trees calculated merkle trees, or null if validation failed
+ * @param message containing the merkle trees or an error
*/
- public void validationComplete(RepairJobDesc desc, InetAddressAndPort
endpoint, MerkleTrees trees)
+ public void validationComplete(RepairJobDesc desc,
Message<ValidationResponse> message)
{
+ InetAddressAndPort endpoint = message.from();
+ MerkleTrees trees = message.payload.trees;
ValidationTask task = validating.remove(Pair.create(desc, endpoint));
+ // replies without a callback get dropped, so if in mixed mode this
should be ignored
+ ctx.messaging().send(message.emptyResponse(), message.from());
Review Comment:
What happens if we don't send this response? (...and do we need it for a
local initiator?)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]