ptupitsyn commented on code in PR #2825:
URL: https://github.com/apache/ignite-3/pull/2825#discussion_r1401689604


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java:
##########
@@ -690,21 +689,23 @@ private void processOperation(ChannelHandlerContext ctx, 
ClientMessageUnpacker i
     }
 
     private void writeFlags(ClientMessagePacker out, ChannelHandlerContext 
ctx) {
-        boolean assignmentChanged = 
partitionAssignmentChanged.compareAndSet(true, false);
-
-        if (assignmentChanged && LOG.isInfoEnabled()) {
-            LOG.info("Partition assignment changed, notifying client 
[connectionId=" + connectionId + ", remoteAddress="
+        // Notify the client about primary replica change that happened for 
ANY table since the last request.
+        // We can't assume that the client only uses uses a particular table 
(e.g. the one present in the replica tracker), because
+        // the client can be connected to multiple nodes.
+        long localUpdateCount = primaryReplicaUpdateCount.get();
+        long updateCount = primaryReplicaTracker.updateCount();
+        boolean primaryReplicasChanged = localUpdateCount < updateCount
+                && primaryReplicaUpdateCount.compareAndSet(localUpdateCount, 
updateCount);
+
+        if (primaryReplicasChanged && LOG.isInfoEnabled()) {
+            LOG.info("Partition primary replica changed, notifying client 
[connectionId=" + connectionId + ", remoteAddress="
                     + ctx.channel().remoteAddress() + ']');
         }
 
-        var flags = ResponseFlags.getFlags(assignmentChanged);
+        var flags = ResponseFlags.getFlags(primaryReplicasChanged);

Review Comment:
   Done - now we send `maxStartTime` timestamp to the client and back:
   * Client can avoid stale updates from a lagging node
   * Server will wait for a given timestamp if it lags behind



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