ibessonov commented on code in PR #2594:
URL: https://github.com/apache/ignite-3/pull/2594#discussion_r1328317160
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointWorkflow.java:
##########
@@ -343,14 +365,35 @@ private DataRegionsDirtyPages beginCheckpoint(
Collection<? extends DataRegion<PersistentPageMemory>> dataRegions,
CompletableFuture<?> allowToReplace
) {
+ Map<DataRegion<?>, Set<FullPageId>> dirtyPartitionsMap =
this.dirtyPartitionsMap;
+
+ this.dirtyPartitionsMap = new ConcurrentHashMap<>();
+
Collection<DataRegionDirtyPages<Collection<FullPageId>>>
dataRegionsDirtyPages = new ArrayList<>(dataRegions.size());
+ // First, we iterate all regions that have dirty pages.
for (DataRegion<PersistentPageMemory> dataRegion : dataRegions) {
Collection<FullPageId> dirtyPages =
dataRegion.pageMemory().beginCheckpoint(allowToReplace);
+ Set<FullPageId> dirtyMetaPageIds =
dirtyPartitionsMap.remove(dataRegion);
+
+ if (dirtyMetaPageIds != null) {
+ // Merge these two collections. There should be no
intersections.
+ dirtyPages = CollectionUtils.concat(dirtyMetaPageIds,
dirtyPages);
Review Comment:
Please take the context into account. In this case we must do it to avoid
excessive allocations. `dirtyPages` is itself a concatenation.
Maybe streams would fit better, but the idea is the same
--
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]