SammyVimes commented on code in PR #1016:
URL: https://github.com/apache/ignite-3/pull/1016#discussion_r957351193


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -365,6 +380,50 @@ public CompletableFuture<Boolean> notify(@NotNull 
SchemaEventParameters paramete
                 return completedFuture(false);
             }
         });
+
+        addMessageHandler(raftMgr.messagingService());
+    }
+
+    /**
+     * Adds a table manager message handler.
+     *
+     * @param messagingService Messaging service.
+     */
+    private void addMessageHandler(MessagingService messagingService) {
+        var messageHandler = new NetworkMessageHandler() {
+            @Override
+            public void onReceived(NetworkMessage message, NetworkAddress 
senderAddr, @Nullable Long 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;
+
+                    UUID tableId = msg.tableId();
+                    int partitionId = msg.partitionId();
+
+                    boolean contains = false;
+
+                    TableImpl table = tablesByIdVv.latest().get(tableId);
+
+                    if (table != null) {
+                        MvTableStorage storage = 
table.internalTable().storage();
+
+                        MvPartitionStorage mvPartition = 
storage.getMvPartition(partitionId);
+
+                        if (mvPartition != null) {
+                            // If applied index of a storage is greater than 0,
+                            // then there is data
+                            contains = mvPartition.lastAppliedIndex() > 0;

Review Comment:
   It works as intended because we can't wait for recovery as recovery sends 
requests like this :)



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