FIx node hangs if an exception is throw from PageMemoryImpl.beforeReleaseWrite() - Fixes
@@ -1532,6 +1532,7 @@ public class PageMemoryImpl implements PageMemoryEx {
) {
boolean wasDirty = isDirty(page);
+ try {
//if page is for restore, we shouldn't mark it as changed
if (!restore && markDirty && !wasDirty && changeTracker != null)
changeTracker.apply(page, fullId, this);
@@ -1544,7 +1545,12 @@ public class PageMemoryImpl implements PageMemoryEx {
setDirty(fullId, page, markDirty, false);
beforeReleaseWrite(fullId, page + PAGE_OVERHEAD, pageWalRec);
-
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ // Always release the lock.
+ finally {
long pageId = PageIO.getPageId(page + PAGE_OVERHEAD);
assert pageId != 0 : U.hexLong(PageHeader.readPageId(page));
@@ -1558,11 +1564,13 @@ public class PageMemoryImpl implements PageMemoryEx {
writeThrottle.onMarkDirty(isInCheckpoint(fullId));
}
catch (AssertionError ex) {
- U.error(log, "Failed to unlock page [fullPageId=" + fullId + ", binPage=" + U.toHexString(page, systemPageSize()) + ']');
+ U.error(log, "Failed to unlock page [fullPageId=" + fullId +
+ ", binPage=" + U.toHexString(page, systemPageSize()) + ']');
throw ex;
}
}
+ }
/**
* @param absPtr Absolute pointer to the page.
@@ -1673,17 +1681,13 @@ public class PageMemoryImpl implements PageMemoryEx {
/**
*
*/
- void beforeReleaseWrite(FullPageId pageId, long ptr, boolean pageWalRec) {
- if (walMgr != null && (pageWalRec || walMgr.isAlwaysWriteFullPages()) && !walMgr.disabled(pageId.groupId())) {
- try {
+ void beforeReleaseWrite(FullPageId pageId, long ptr, boolean pageWalRec) throws IgniteCheckedException {
+ boolean walIsNotDisable = walMgr != null && !walMgr.disabled(pageId.groupId());
+ boolean pageRecOrAlwaysWriteFullPage = walMgr != null && (pageWalRec || walMgr.isAlwaysWriteFullPages());
+
+ if (pageRecOrAlwaysWriteFullPage && walIsNotDisable)
walMgr.log(new PageSnapshot(pageId, ptr, pageSize(), realPageSize(pageId.groupId())));
}
- catch (IgniteCheckedException e) {
- // TODO ignite-db.
- throw new IgniteException(e);
- }
- }
- }
/**
* @param grpId Cache group ID.
