tkalkirill commented on code in PR #3475:
URL: https://github.com/apache/ignite-3/pull/3475#discussion_r1538622345


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/LowWatermarkImpl.java:
##########
@@ -292,9 +272,87 @@ private void setLowWatermark(@Nullable HybridTimestamp 
newLowWatermark) {
         updateLowWatermarkLock.writeLock().lock();
 
         try {
+            assert newLowWatermark == null || lowWatermark == null || 
newLowWatermark.compareTo(lowWatermark) > 0 :
+                    "Low watermark should only grow: [cur=" + lowWatermark + 
", new=" + newLowWatermark + "]";
+
             lowWatermark = newLowWatermark;
         } finally {
             updateLowWatermarkLock.writeLock().unlock();
         }
     }
+
+    void onReceiveNetworkMessage(NetworkMessage message, ClusterNode sender, 
@Nullable Long correlationId) {
+        inBusyLock(busyLock, () -> {
+            if (!(message instanceof GetLowWatermarkRequest)) {
+                return;
+            }
+
+            assert correlationId != null : sender;
+
+            messagingService.respond(
+                    sender,
+                    
MESSAGES_FACTORY.getLowWatermarkResponse().lowWatermark(hybridTimestampToLong(lowWatermark)).build(),
+                    correlationId
+            );
+        });
+    }
+
+    @Override
+    public void updateLowWatermark(HybridTimestamp newLowWatermark) {
+        inBusyLock(busyLock, () -> {
+            LowWatermarkCandidate newLowWatermarkCandidate = new 
LowWatermarkCandidate(newLowWatermark, new CompletableFuture<>());
+            LowWatermarkCandidate oldLowWatermarkCandidate;
+
+            do {
+                oldLowWatermarkCandidate = lowWatermarkCandidate.get();
+
+                // If another candidate contains a larger low watermark, then 
there is no need to update.

Review Comment:
   fix it



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