Cyrill commented on code in PR #7531:
URL: https://github.com/apache/ignite-3/pull/7531#discussion_r2768177030
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -1048,34 +1056,50 @@ private void sendReplicaUnavailableErrorResponse(
String senderConsistentId,
long correlationId,
ReplicationGroupId groupId,
- @Nullable HybridTimestamp requestTimestamp
+ @Nullable HybridTimestamp requestTimestamp,
+ boolean replicaIsAbsent
) {
- if (requestTimestamp != null) {
- clusterNetSvc.messagingService().respond(
- senderConsistentId,
- REPLICA_MESSAGES_FACTORY
- .errorTimestampAwareReplicaResponse()
- .throwable(
- new ReplicaUnavailableException(
- groupId,
-
clusterNetSvc.topologyService().localMember())
- )
-
.timestamp(clockService.updateClock(requestTimestamp))
- .build(),
- correlationId);
+ CompletableFuture<Boolean> replicaInAssignmentsFuture;
+
+ if (replicaIsAbsent && (groupId instanceof ZonePartitionId)) {
+ replicaInAssignmentsFuture =
stableAssignmentsSupplier.apply((ZonePartitionId) groupId)
+ .thenApply(assignments ->
assignments.contains(localNodeConsistentId));
} else {
- clusterNetSvc.messagingService().respond(
- senderConsistentId,
- REPLICA_MESSAGES_FACTORY
- .errorReplicaResponse()
- .throwable(
- new ReplicaUnavailableException(
- groupId,
-
clusterNetSvc.topologyService().localMember())
- )
- .build(),
- correlationId);
+ replicaInAssignmentsFuture = trueCompletedFuture();
}
+
+ replicaInAssignmentsFuture.thenAccept(isInAssignments -> {
Review Comment:
Are we sure replicaInAssignmentsFuture will never complete exceptionally?
How bad it will be if it does?
--
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]