Cyrill commented on code in PR #7531:
URL: https://github.com/apache/ignite-3/pull/7531#discussion_r2768104880
##########
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 -> {
+ ReplicaUnavailableException e;
+
+ if (replicaIsAbsent && !isInAssignments) {
+ e = new ReplicaUnavailableException(
+ REPLICA_ABSENT_ERR,
+ format("Replica is absent on this node and not in
assignments, the request should be retried on another node "
+ + "[groupId={}, nodeName={}]",
groupId, localNodeConsistentId
+ )
+ );
+ } else {
+ e = new ReplicaUnavailableException(groupId,
clusterNetSvc.topologyService().localMember());
+ }
+
+ NetworkMessage msg;
+
+ if (requestTimestamp != null) {
+ msg = REPLICA_MESSAGES_FACTORY
+ .errorTimestampAwareReplicaResponse()
+ .throwable(e)
+ .timestamp(clockService.updateClock(requestTimestamp))
+ .build();
+ } else {
+ msg = REPLICA_MESSAGES_FACTORY
+ .errorReplicaResponse()
+ .throwable(e)
+ .build();
+ }
+
+ System.out.println("qqq 2 " +
System.identityHashCode(clusterNetSvc.messagingService()));
Review Comment:
debug logs
--
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]