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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java:
##########
@@ -1470,4 +1478,62 @@ private RuntimeException 
wrapReplicationException(Throwable e) {
 
         return e0;
     }
+
+    @Override
+    public @Nullable PendingComparableValuesTracker<HybridTimestamp> 
getPartitionSafeTimeTracker(int partitionId) {
+        return safeTimeTrackerByPartitionId.get(partitionId);
+    }
+
+    @Override
+    public @Nullable PendingComparableValuesTracker<Long> 
getPartitionStorageIndexTracker(int partitionId) {
+        return storageIndexTrackerByPartitionId.get(partitionId);
+    }
+
+    /**
+     * Updates the partition safe time tracker, if there was a previous one, 
closes it.
+     *
+     * @param partitionId Partition ID.
+     * @param newSafeTimeTracker New partition safe time tracker.
+     */
+    public void updatePartitionSafeTimeTracker(int partitionId, 
PendingComparableValuesTracker<HybridTimestamp> newSafeTimeTracker) {
+        PendingComparableValuesTracker<HybridTimestamp> 
previousSafeTimeTracker;
+
+        synchronized (updatePartitionMapsMux) {
+            Int2ObjectMap<PendingComparableValuesTracker<HybridTimestamp>> 
newSafeTimeTrackerMap = new Int2ObjectOpenHashMap<>(partitions);
+
+            newSafeTimeTrackerMap.putAll(safeTimeTrackerByPartitionId);
+
+            previousSafeTimeTracker = newSafeTimeTrackerMap.put(partitionId, 
newSafeTimeTracker);
+
+            safeTimeTrackerByPartitionId = newSafeTimeTrackerMap;
+        }
+
+        if (previousSafeTimeTracker != null) {
+            previousSafeTimeTracker.close();

Review Comment:
   Create 
`org.apache.ignite.internal.table.distributed.storage.InternalTableImplTest#testUpdatePartitionTrackers`



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