rpuch commented on code in PR #2773:
URL: https://github.com/apache/ignite-3/pull/2773#discussion_r1378430910


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionReplicatorNodeRecovery.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.distributed;
+
+import static java.util.concurrent.CompletableFuture.allOf;
+import static java.util.concurrent.CompletableFuture.completedFuture;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import org.apache.ignite.internal.affinity.Assignment;
+import org.apache.ignite.internal.lang.IgniteInternalException;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.raft.Peer;
+import org.apache.ignite.internal.raft.PeersAndLearners;
+import org.apache.ignite.internal.replicator.TablePartitionId;
+import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.storage.RowId;
+import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.TableImpl;
+import org.apache.ignite.internal.table.distributed.message.HasDataRequest;
+import org.apache.ignite.internal.table.distributed.message.HasDataResponse;
+import org.apache.ignite.internal.utils.RebalanceUtil;
+import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.network.MessagingService;
+
+/**
+ * Code specific to recovering a partition replicator group node. This 
includes a case when we lost metadata
+ * that is required for the replication protocol (for instance, for RAFT it's 
about group metadata).
+ */
+class PartitionReplicatorNodeRecovery {
+    private static final long QUERY_DATA_NODES_COUNT_TIMEOUT = 
TimeUnit.SECONDS.toMillis(3);
+
+    private static final TableMessagesFactory TABLE_MESSAGES_FACTORY = new 
TableMessagesFactory();
+
+    private final MetaStorageManager metaStorageManager;
+
+    private final MessagingService messagingService;
+
+    /** Resolver that resolves a node consistent ID to cluster node. */
+    private final Function<String, ClusterNode> clusterNodeResolver;
+
+    private final IntFunction<TableImpl> tableSupplier;
+
+    PartitionReplicatorNodeRecovery(
+            MetaStorageManager metaStorageManager,
+            MessagingService messagingService,
+            Function<String, ClusterNode> clusterNodeResolver,
+            IntFunction<TableImpl> tableSupplier) {
+        this.metaStorageManager = metaStorageManager;
+        this.messagingService = messagingService;
+        this.clusterNodeResolver = clusterNodeResolver;
+        this.tableSupplier = tableSupplier;
+    }
+
+    /**
+     * Starts the component.
+     */
+    void start() {
+        addMessageHandler();
+    }
+
+    private void addMessageHandler() {
+        messagingService.addMessageHandler(TableMessageGroup.class, (message, 
sender, correlationId) -> {
+            if (message instanceof HasDataRequest) {
+                // This message queries if a node has any data for a specific 
partition of a table
+                assert correlationId != null;
+
+                HasDataRequest msg = (HasDataRequest) message;
+
+                int tableId = msg.tableId();
+                int partitionId = msg.partitionId();
+
+                boolean contains = false;

Review Comment:
   Renamed it to `storageHasData`, to avoid negating its meaning



-- 
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]

Reply via email to