use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageMetaInfoStore in project ignite by apache.
the class ToStringDumpProcessor method processDump.
/**
* @param snapshot Process lock stack snapshot.
*/
private void processDump(PageLockStackSnapshot snapshot, ThreadPageLockState threadState) {
int headIdx = snapshot.headIdx;
PageMetaInfoStore pageIdLocksStack = snapshot.pageIdLocksStack;
long nextOpPageId = snapshot.nextOpPageId;
Map<Long, LockState> holdedLocks = new LinkedHashMap<>();
SB stackStr = new SB();
if (nextOpPageId != 0)
stackStr.a("\t-> " + operationToString(snapshot.nextOp) + " structureId=" + structureIdMapFunc.apply(snapshot.nextOpStructureId) + " " + pageIdToString(nextOpPageId) + U.nl());
for (int itemIdx = headIdx - 1; itemIdx >= 0; itemIdx--) {
long pageId = pageIdLocksStack.getPageId(itemIdx);
if (pageId == 0 && itemIdx == 0)
break;
int op;
if (pageId == 0) {
stackStr.a("\t -\n");
continue;
} else {
op = pageIdLocksStack.getOperation(itemIdx) & LOCK_OP_MASK;
int structureId = pageIdLocksStack.getStructureId(itemIdx);
stackStr.a("\t" + operationToString(op) + " structureId=" + structureIdMapFunc.apply(structureId) + " " + pageIdToString(pageId) + U.nl());
}
if (op == READ_LOCK || op == WRITE_LOCK || op == BEFORE_READ_LOCK) {
LockState state = holdedLocks.get(pageId);
if (state == null)
holdedLocks.put(pageId, state = new LockState());
if (op == READ_LOCK)
state.readlock++;
if (op == WRITE_LOCK)
state.writelock++;
}
}
if (threadState != null) {
if (holdedLocks.isEmpty())
return;
appendThreadInfo(sb, threadState);
}
sb.append(lockedPagesInfo(holdedLocks)).append(U.nl());
sb.append("Locked pages stack: ").append(snapshot.name).append(" time=(").append(snapshot.time).append(", ").append(DATE_FMT.format(Instant.ofEpochMilli(snapshot.time))).append(")").append(U.nl());
sb.append(stackStr).append(U.nl());
}
Aggregations