aweisberg commented on code in PR #4508:
URL: https://github.com/apache/cassandra/pull/4508#discussion_r2628528590
##########
src/java/org/apache/cassandra/db/AbstractMutationVerbHandler.java:
##########
@@ -193,6 +196,49 @@ else if
(message.epoch().isBefore(metadata.schema.lastModified()))
return metadata;
}
+ /**
+ * Confirm that the presence/absence of a mutation id matches our
expectations for the given keyspace/table/token. If
+ * it doesn't, then we're not on the same epoch as the coordinator, or
there's a bug.
+ */
+ private ClusterMetadata checkReplicationMigration(ClusterMetadata
metadata, Message<T> message, InetAddressAndPort respondTo)
+ {
+ IMutation mutation = message.payload;
+ MutationRouting expected = mutation.id().isNone() ?
MutationRouting.UNTRACKED : MutationRouting.TRACKED;
+ if (expected == MigrationRouter.getMutationRouting(metadata, mutation))
+ return metadata;
+
+ if (message.epoch().isAfter(metadata.epoch))
+ {
+ // coordinator is ahead, fetch log and recheck
+ metadata =
ClusterMetadataService.instance().fetchLogFromPeerOrCMS(metadata, respondTo,
message.epoch());
+ if (expected != MigrationRouter.getMutationRouting(metadata,
mutation))
+ throw new IllegalStateException(String.format("Inconsistent
mutation routing after fetching log for epoch = %s. Keyspace: %s key: %s ",
Review Comment:
This isn't an illegal state it could still be the coordinator is behind
because fetchLogFromPeerOrCMS returns a metadata with a later epoch
--
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]