未验证 提交 b1ac40b4 编写于 作者: Z Zhijia Cao 提交者: GitHub

fix wal npe when memTable has flushed. (#10899)

上级 155c181a
......@@ -451,7 +451,9 @@ public class WALNode implements IWALNode {
return false;
}
IMemTable oldestMemTable = oldestMemTableInfo.getMemTable();
if (oldestMemTable == null) {
return false;
}
// get memTable's virtual database processor
File oldestTsFile =
FSFactoryProducer.getFSFactory().getFile(oldestMemTableInfo.getTsFilePath());
......@@ -477,8 +479,6 @@ public class WALNode implements IWALNode {
WRITING_METRICS.recordMemTableRamWhenCauseFlush(identifier, oldestMemTableTVListsRamCost);
} else {
snapshotMemTable(dataRegion, oldestTsFile, oldestMemTableInfo);
WRITING_METRICS.recordMemTableRamWhenCauseSnapshot(
identifier, oldestMemTableTVListsRamCost);
}
return true;
}
......@@ -527,8 +527,8 @@ public class WALNode implements IWALNode {
"CheckpointManager$DeleteOutdatedFileTask.snapshotOrFlushOldestMemTable");
try {
// make sure snapshot is made before memTable flush operation
synchronized (memTable) {
if (memTable.getFlushStatus() != FlushStatus.WORKING) {
synchronized (memTableInfo) {
if (memTable == null || memTable.getFlushStatus() != FlushStatus.WORKING) {
return;
}
......@@ -555,6 +555,7 @@ public class WALNode implements IWALNode {
// it's low-risk to block writes awhile because this memTable accumulates slowly
if (flushListener.waitForResult() == Status.FAILURE) {
logger.error("Fail to snapshot memTable of {}", tsFile, flushListener.getCause());
return;
}
logger.info(
"WAL node-{} snapshots memTable-{} to wal files because Effective information ratio {} is below wal min effective info ratio {}, memTable size is {}.",
......@@ -563,6 +564,8 @@ public class WALNode implements IWALNode {
effectiveInfoRatio,
config.getWalMinEffectiveInfoRatio(),
memTable.getTVListsRamCost());
WRITING_METRICS.recordMemTableRamWhenCauseSnapshot(
identifier, memTable.getTVListsRamCost());
}
} finally {
dataRegion.writeUnlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册