HADOOP-17142. Fix outdated properties of JournalNode when performing rollback. Contributed by Deegue.

This commit is contained in:
Yizhong Zhang 2020-11-11 01:11:31 +08:00 committed by GitHub
parent 2522bf2f9b
commit 82de07c794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -236,6 +236,10 @@ void format(NamespaceInfo nsInfo, boolean force) throws IOException {
void analyzeStorage() throws IOException { void analyzeStorage() throws IOException {
this.state = sd.analyzeStorage(StartupOption.REGULAR, this); this.state = sd.analyzeStorage(StartupOption.REGULAR, this);
refreshStorage();
}
void refreshStorage() throws IOException {
if (state == StorageState.NORMAL) { if (state == StorageState.NORMAL) {
readProperties(sd); readProperties(sd);
} }

View File

@ -1178,6 +1178,8 @@ public synchronized void doRollback() throws IOException {
// directory will be renamed. It will be reopened lazily on next access. // directory will be renamed. It will be reopened lazily on next access.
IOUtils.cleanupWithLogger(LOG, committedTxnId); IOUtils.cleanupWithLogger(LOG, committedTxnId);
storage.getJournalManager().doRollback(); storage.getJournalManager().doRollback();
// HADOOP-17142: refresh properties after rollback performed.
storage.refreshStorage();
} }
synchronized void discardSegments(long startTxId) throws IOException { synchronized void discardSegments(long startTxId) throws IOException {