kgusakov commented on code in PR #4843: URL: https://github.com/apache/ignite-3/pull/4843#discussion_r1890152393
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java: ########## @@ -569,26 +605,64 @@ private static Collection<CatalogZoneDescriptor> filterZones(Set<String> zoneNam return zoneDescriptors; } + private CompletableFuture<Void> processNewRequest(DisasterRecoveryRequest request) { + return processNewRequest(request, -1); + } + /** * Creates new operation future, associated with the request, and writes it into meta-storage. * * @param request Request. + * @param revision Revision of event, which produce this recovery request. * @return Operation future. */ - private CompletableFuture<Void> processNewRequest(DisasterRecoveryRequest request) { + private CompletableFuture<Void> processNewRequest(DisasterRecoveryRequest request, long revision) { UUID operationId = request.operationId(); CompletableFuture<Void> operationFuture = new CompletableFuture<Void>() .whenComplete((v, throwable) -> ongoingOperationsById.remove(operationId)) .orTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS); + byte[] serializedRequest = VersionedSerialization.toBytes(request, DisasterRecoveryRequestSerializer.INSTANCE); + ongoingOperationsById.put(operationId, operationFuture); - metaStorageManager.put(RECOVERY_TRIGGER_KEY, VersionedSerialization.toBytes(request, DisasterRecoveryRequestSerializer.INSTANCE)); + if (revision != -1) { + putRecoveryTriggerIfRevisionIsNotProcessed( + request.zoneId(), + longToBytesKeepingOrder(revision), + serializedRequest, + operationId + ); + } else { + metaStorageManager.put(RECOVERY_TRIGGER_KEY, serializedRequest); + } return operationFuture; } + private void putRecoveryTriggerIfRevisionIsNotProcessed( Review Comment: As I know we have no rules about javadocs for private methods - the name of this method is clear enough I thought. To cut the time of discussion ping-pong - added, anyway) ########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java: ########## @@ -569,26 +605,64 @@ private static Collection<CatalogZoneDescriptor> filterZones(Set<String> zoneNam return zoneDescriptors; } + private CompletableFuture<Void> processNewRequest(DisasterRecoveryRequest request) { Review Comment: Added -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org