HDFS-16244.Add the necessary write lock in Checkpointer#doCheckpoint(). (#3497)
This commit is contained in:
parent
8c271caa81
commit
ff24fe6197
@ -244,9 +244,14 @@ void doCheckpoint() throws IOException {
|
|||||||
|
|
||||||
if(needReloadImage) {
|
if(needReloadImage) {
|
||||||
LOG.info("Loading image with txid " + sig.mostRecentCheckpointTxId);
|
LOG.info("Loading image with txid " + sig.mostRecentCheckpointTxId);
|
||||||
|
backupNode.namesystem.writeLock();
|
||||||
|
try {
|
||||||
File file = bnStorage.findImageFile(NameNodeFile.IMAGE,
|
File file = bnStorage.findImageFile(NameNodeFile.IMAGE,
|
||||||
sig.mostRecentCheckpointTxId);
|
sig.mostRecentCheckpointTxId);
|
||||||
bnImage.reloadFromImageFile(file, backupNode.getNamesystem());
|
bnImage.reloadFromImageFile(file, backupNode.getNamesystem());
|
||||||
|
} finally {
|
||||||
|
backupNode.namesystem.writeUnlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rollForwardByApplyingLogs(manifest, bnImage, backupNode.getNamesystem());
|
rollForwardByApplyingLogs(manifest, bnImage, backupNode.getNamesystem());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user