ivanzlenko commented on code in PR #7067:
URL: https://github.com/apache/ignite-3/pull/7067#discussion_r2567325906
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/compaction/Compactor.java:
##########
@@ -388,13 +389,37 @@ void mergeDeltaFileToMainFile(
// Copy pages deltaFilePageStore -> filePageStore.
ByteBuffer buffer = getThreadLocalBuffer(pageSize);
+ DeltaFilePageStoreIo[] newerDeltaFiles =
filePageStore.getCompletedDeltaFiles()
+ .stream()
+ .filter(file -> file.fileIndex() >
deltaFilePageStore.fileIndex())
+ .toArray(DeltaFilePageStoreIo[]::new);
+
+ int[] pointers = new int[newerDeltaFiles.length];
+
+ boolean shouldFsync = false;
for (long pageIndex : deltaFilePageStore.pageIndexes()) {
updateHeartbeat();
if (shouldStopCompaction(filePageStore)) {
return;
}
+ boolean shouldSkip = false;
+ for (int i = 0; i < pointers.length && !shouldSkip; i++) {
+ int[] newerPageIndexes = newerDeltaFiles[i].pageIndexes();
+
+ while (pointers[i] < newerPageIndexes.length - 1 &&
newerPageIndexes[pointers[i]] < pageIndex) {
+ pointers[i]++;
+ }
+
+ shouldSkip = pointers[i] < newerPageIndexes.length &&
newerPageIndexes[pointers[i]] == pageIndex;
Review Comment:
Could we end up in situation where newerPageIndexes[pointers[i]] > pageIndex
?
--
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]