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


##########
modules/metastorage/src/test/java/org/apache/ignite/internal/metastorage/server/WatchProcessorTest.java:
##########
@@ -288,6 +289,48 @@ void nodeStoppingExceptionDoesNotTriggerFailureManager() {
         verify(failureManager, never()).process(any());
     }
 
+    @Test
+    void 
eventNotificationUpdatesMetastoreSafeTimeAfterNotifyingWatchListeners() {
+        CompletableFuture<Void> listenerFuture = new CompletableFuture<>();
+        WatchListener listener = mock(WatchListener.class);
+        when(listener.onUpdate(any())).thenReturn(listenerFuture);
+
+        watchProcessor.addWatch(new Watch(0, listener, key -> 
Arrays.equals(key, "foo".getBytes(UTF_8))));
+
+        var entry1 = new EntryImpl("foo".getBytes(UTF_8), null, 1, TIMESTAMP);
+        HybridTimestamp ts = new HybridTimestamp(1, 2);
+
+        watchProcessor.notifyWatches(1, List.of(entry1), ts);
+
+        verify(watchEventHandlingCallback, 
timeout(100).times(0)).onSafeTimeAdvanced(any());
+
+        listenerFuture.complete(null);
+
+        verify(watchEventHandlingCallback, 
timeout(SECONDS.toMillis(10))).onSafeTimeAdvanced(ts);
+    }
+
+    @Test
+    void 
metastoreSafeTimeGetsAdvancedAfterPreviousNotificationChainMembesAreFinished() {
+        CompletableFuture<Void> listenerFuture = new CompletableFuture<>();
+        WatchListener listener = mock(WatchListener.class);
+        when(listener.onUpdate(any())).thenReturn(listenerFuture);
+
+        watchProcessor.addWatch(new Watch(0, listener, key -> 
Arrays.equals(key, "foo".getBytes(UTF_8))));
+
+        var entry1 = new EntryImpl("foo".getBytes(UTF_8), null, 1, TIMESTAMP);
+        HybridTimestamp entryTs = new HybridTimestamp(1, 2);

Review Comment:
   In this particular case, I prefer to leave the explicit type as there are 
two declarations, both variables are timestamps; we can use `var` for first of 
them, but not for the second, so it will look weird. In the current form it's 
very visible that they have the same type which seems a good thing.



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

Reply via email to