ibessonov commented on code in PR #5670:
URL: https://github.com/apache/ignite-3/pull/5670#discussion_r2054593809


##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/AbstractKeyValueStorage.java:
##########
@@ -411,49 +346,41 @@ private List<Entry> doGetAll(List<byte[]> keys, long 
revUpperBound) {
 
     @Override
     public void advanceSafeTime(KeyValueUpdateContext context) {
-        rwLock.writeLock().lock();
+        setIndexAndTerm(context.index, context.term);
 
-        try {
-            setIndexAndTerm(context.index, context.term);
-
-            if (areWatchesStarted()) {
-                watchProcessor.advanceSafeTime(() -> {}, context.timestamp);
-            }
-        } finally {
-            rwLock.writeLock().unlock();
+        if (areWatchesStarted()) {
+            watchProcessor.advanceSafeTime(() -> {}, context.timestamp);
         }
     }
 
     @Override
     public Revisions revisions() {
-        rwLock.readLock().lock();
-
-        try {
-            return createCurrentRevisions();
-        } finally {
-            rwLock.readLock().unlock();
-        }
+        return createCurrentRevisions();
     }
 
     private Revisions createCurrentRevisions() {
         return new Revisions(rev, compactionRevision);
     }
 
     protected void notifyWatchProcessor(NotifyWatchProcessorEvent event) {
-        if (areWatchesStarted()) {
-            event.notify(watchProcessor);
-        } else {
-            boolean added = 
notifyWatchProcessorEventsBeforeStartingWatches.add(event);
+        synchronized (watchProcessorMutex) {
+            if (areWatchesStarted()) {
+                event.notify(watchProcessor);
+            } else {
+                boolean added = 
notifyWatchProcessorEventsBeforeStartingWatches.add(event);
 
-            assert added : event;
+                assert added : event;
+            }
         }
     }
 
-    protected void drainNotifyWatchProcessorEventsBeforeStartingWatches() {
-        assert !areWatchesStarted();
+    protected synchronized void 
drainNotifyWatchProcessorEventsBeforeStartingWatches() {

Review Comment:
   Mistake



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