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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotsManager.java:
##########
@@ -141,8 +201,48 @@ private CompletableFuture<Void> respond(
             NetworkAddress sender,
             Long correlationId
     ) {
-        //TODO https://issues.apache.org/jira/browse/IGNITE-17262
+        //TODO https://issues.apache.org/jira/browse/IGNITE-17935
         // Handle offline sender and stopped manager.
         return messagingService.respond(sender, response, correlationId);
     }
+
+    @Override
+    public PartitionSnapshots partitionSnapshots(PartitionKey partitionKey) {
+        return getPartitionSnapshots(partitionKey);
+    }
+
+    private static class PartitionSnapshotsImpl implements PartitionSnapshots {
+        private final List<OutgoingSnapshot> snapshots = new ArrayList<>();
+
+        private final ReadWriteLock lock = new ReentrantReadWriteLock();
+        private final ReusableLockLockup readLockLockup = new 
ReusableLockLockup(lock.readLock());
+
+        private void addUnderLock(OutgoingSnapshot snapshot) {
+            lock.writeLock().lock();
+
+            try {
+                snapshots.add(snapshot);
+            } finally {
+                lock.writeLock().unlock();
+            }
+        }
+
+        private void removeUnderLock(OutgoingSnapshot snapshot) {
+            try {

Review Comment:
   Ouch, good catch. Added a test, fixed the bug.



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