HDFS-7753. Fix Multithreaded correctness Warnings in BackupImage. Contributed by Rakesh R and Konstantin Shvachko.
This commit is contained in:
parent
7c6b6547ee
commit
a4ceea60f5
@ -904,6 +904,9 @@ Release 2.7.0 - UNRELEASED
|
|||||||
HDFS-7769. TestHDFSCLI should not create files in hdfs project root dir.
|
HDFS-7769. TestHDFSCLI should not create files in hdfs project root dir.
|
||||||
(szetszwo)
|
(szetszwo)
|
||||||
|
|
||||||
|
HDFS-7753. Fix Multithreaded correctness Warnings in BackupImage.
|
||||||
|
(Rakesh R and shv)
|
||||||
|
|
||||||
Release 2.6.1 - UNRELEASED
|
Release 2.6.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -93,8 +93,15 @@ static enum BNState {
|
|||||||
bnState = BNState.DROP_UNTIL_NEXT_ROLL;
|
bnState = BNState.DROP_UNTIL_NEXT_ROLL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNamesystem(FSNamesystem fsn) {
|
synchronized FSNamesystem getNamesystem() {
|
||||||
this.namesystem = fsn;
|
return namesystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized void setNamesystem(FSNamesystem fsn) {
|
||||||
|
// Avoids overriding this.namesystem object
|
||||||
|
if (namesystem == null) {
|
||||||
|
this.namesystem = fsn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,7 +202,7 @@ private synchronized void applyEdits(long firstTxId, int numTxns, byte[] data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FSEditLogLoader logLoader =
|
FSEditLogLoader logLoader =
|
||||||
new FSEditLogLoader(namesystem, lastAppliedTxId);
|
new FSEditLogLoader(getNamesystem(), lastAppliedTxId);
|
||||||
int logVersion = storage.getLayoutVersion();
|
int logVersion = storage.getLayoutVersion();
|
||||||
backupInputStream.setBytes(data, logVersion);
|
backupInputStream.setBytes(data, logVersion);
|
||||||
|
|
||||||
@ -209,7 +216,7 @@ private synchronized void applyEdits(long firstTxId, int numTxns, byte[] data)
|
|||||||
}
|
}
|
||||||
lastAppliedTxId = logLoader.getLastAppliedTxId();
|
lastAppliedTxId = logLoader.getLastAppliedTxId();
|
||||||
|
|
||||||
FSImage.updateCountForQuota(namesystem.dir.rootDir); // inefficient!
|
FSImage.updateCountForQuota(getNamesystem().dir.getRoot()); // inefficient!
|
||||||
} finally {
|
} finally {
|
||||||
backupInputStream.clear();
|
backupInputStream.clear();
|
||||||
}
|
}
|
||||||
@ -258,7 +265,7 @@ private boolean tryConvergeJournalSpool() throws IOException {
|
|||||||
editStreams.add(s);
|
editStreams.add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadEdits(editStreams, namesystem);
|
loadEdits(editStreams, getNamesystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
// now, need to load the in-progress file
|
// now, need to load the in-progress file
|
||||||
@ -293,7 +300,7 @@ private boolean tryConvergeJournalSpool() throws IOException {
|
|||||||
+ " txns from in-progress stream " + stream);
|
+ " txns from in-progress stream " + stream);
|
||||||
|
|
||||||
FSEditLogLoader loader =
|
FSEditLogLoader loader =
|
||||||
new FSEditLogLoader(namesystem, lastAppliedTxId);
|
new FSEditLogLoader(getNamesystem(), lastAppliedTxId);
|
||||||
loader.loadFSEdits(stream, lastAppliedTxId + 1);
|
loader.loadFSEdits(stream, lastAppliedTxId + 1);
|
||||||
lastAppliedTxId = loader.getLastAppliedTxId();
|
lastAppliedTxId = loader.getLastAppliedTxId();
|
||||||
assert lastAppliedTxId == getEditLog().getLastWrittenTxId();
|
assert lastAppliedTxId == getEditLog().getLastWrittenTxId();
|
||||||
|
Loading…
Reference in New Issue
Block a user