Fixed incorrect handling of page during replacement - Fixes
@@ -1106,13 +1106,11 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
(fullId, pageBuf, tag) -> {
memMetrics.onPageWritten();
- // First of all, write page to disk.
- storeMgr.write(fullId.groupId(), fullId.pageId(), pageBuf, tag);
-
- pageBuf.rewind();
+ // We can write only page from disk into snapshot.
+ snapshotMgr.beforePageWrite(fullId);
- // Only after write we can write page into snapshot.
- snapshotMgr.flushDirtyPageHandler(fullId, pageBuf, tag);
+ // Write page to disk.
+ storeMgr.write(fullId.groupId(), fullId.pageId(), pageBuf, tag);
AtomicInteger cntr = evictedPagesCntr;
@@ -4115,8 +4113,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
private List<FullPageId> writePages(Collection<FullPageId> writePageIds) throws IgniteCheckedException {
ByteBuffer tmpWriteBuf = threadBuf.get();
- long writeAddr = GridUnsafe.bufferAddress(tmpWriteBuf);
-
List<FullPageId> pagesToRetry = new ArrayList<>();
for (FullPageId fullId : writePageIds) {
@@ -4171,19 +4167,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
tracker.onDataPageWritten();
}
- if (!skipCrc) {
- PageIO.setCrc(writeAddr, FastCrc.calcCrc(tmpWriteBuf, pageSize()));
-
- tmpWriteBuf.rewind();
- }
-
- int curWrittenPages = writtenPagesCntr.incrementAndGet();
-
- snapshotMgr.onPageWrite(fullId, tmpWriteBuf, curWrittenPages, totalPagesToWrite);
-
- tmpWriteBuf.rewind();
-
- PageStore store = storeMgr.writeInternal(grpId, fullId.pageId(), tmpWriteBuf, tag, false);
+ PageStore store = storeMgr.writeInternal(grpId, fullId.pageId(), tmpWriteBuf, tag, true);
updStores.computeIfAbsent(store, k -> new LongAdder()).increment();
}
