HDFS-9430 Remove waitForLoadingFSImage since checkNNStartup has ensured image loaded and namenode started. (Brahma Reddy Battula via mingma)
This commit is contained in:
parent
e84d6ca2df
commit
3fa33b5c2c
|
@ -2439,6 +2439,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-9484. NNThroughputBenchmark$BlockReportStats should not send empty
|
HDFS-9484. NNThroughputBenchmark$BlockReportStats should not send empty
|
||||||
block reports. (Mingliang Liu via shv)
|
block reports. (Mingliang Liu via shv)
|
||||||
|
|
||||||
|
HDFS-9430. Remove waitForLoadingFSImage since checkNNStartup has ensured
|
||||||
|
image loaded and namenode started. (Brahma Reddy Battula via mingma)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -563,25 +563,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
imageLoaded = flag;
|
imageLoaded = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Block until the object is imageLoaded to be used.
|
|
||||||
*/
|
|
||||||
void waitForLoadingFSImage() {
|
|
||||||
if (!imageLoaded) {
|
|
||||||
writeLock();
|
|
||||||
try {
|
|
||||||
while (!imageLoaded) {
|
|
||||||
try {
|
|
||||||
cond.await(5000, TimeUnit.MILLISECONDS);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
writeUnlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all loaded data
|
* Clear all loaded data
|
||||||
*/
|
*/
|
||||||
|
@ -1802,7 +1783,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
void concat(String target, String [] srcs, boolean logRetryCache)
|
void concat(String target, String [] srcs, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
waitForLoadingFSImage();
|
|
||||||
HdfsFileStatus stat = null;
|
HdfsFileStatus stat = null;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
writeLock();
|
writeLock();
|
||||||
|
@ -1899,7 +1879,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
if (!FileSystem.areSymlinksEnabled()) {
|
if (!FileSystem.areSymlinksEnabled()) {
|
||||||
throw new UnsupportedOperationException("Symlinks not supported");
|
throw new UnsupportedOperationException("Symlinks not supported");
|
||||||
}
|
}
|
||||||
waitForLoadingFSImage();
|
|
||||||
HdfsFileStatus auditStat = null;
|
HdfsFileStatus auditStat = null;
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
@ -1933,7 +1912,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
boolean setReplication(final String src, final short replication)
|
boolean setReplication(final String src, final short replication)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
waitForLoadingFSImage();
|
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
@ -1961,7 +1939,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
void setStoragePolicy(String src, String policyName) throws IOException {
|
void setStoragePolicy(String src, String policyName) throws IOException {
|
||||||
HdfsFileStatus auditStat;
|
HdfsFileStatus auditStat;
|
||||||
waitForLoadingFSImage();
|
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
@ -1988,7 +1965,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
BlockStoragePolicy getStoragePolicy(String src) throws IOException {
|
BlockStoragePolicy getStoragePolicy(String src) throws IOException {
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
waitForLoadingFSImage();
|
|
||||||
readLock();
|
readLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
|
@ -2003,7 +1979,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
BlockStoragePolicy[] getStoragePolicies() throws IOException {
|
BlockStoragePolicy[] getStoragePolicies() throws IOException {
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
waitForLoadingFSImage();
|
|
||||||
readLock();
|
readLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
|
@ -2132,7 +2107,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
}
|
}
|
||||||
|
|
||||||
FSPermissionChecker pc = getPermissionChecker();
|
FSPermissionChecker pc = getPermissionChecker();
|
||||||
waitForLoadingFSImage();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the file is in an encryption zone, we optimistically create an
|
* If the file is in an encryption zone, we optimistically create an
|
||||||
|
@ -2414,7 +2388,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
NameNode.stateChangeLog.debug("BLOCK* getAdditionalBlock: {} inodeId {}" +
|
NameNode.stateChangeLog.debug("BLOCK* getAdditionalBlock: {} inodeId {}" +
|
||||||
" for {}", src, fileId, clientName);
|
" for {}", src, fileId, clientName);
|
||||||
|
|
||||||
waitForLoadingFSImage();
|
|
||||||
LocatedBlock[] onRetryBlock = new LocatedBlock[1];
|
LocatedBlock[] onRetryBlock = new LocatedBlock[1];
|
||||||
FSDirWriteFileOp.ValidateAddBlockResult r;
|
FSDirWriteFileOp.ValidateAddBlockResult r;
|
||||||
FSPermissionChecker pc = getPermissionChecker();
|
FSPermissionChecker pc = getPermissionChecker();
|
||||||
|
@ -2525,7 +2498,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
throws IOException {
|
throws IOException {
|
||||||
NameNode.stateChangeLog.debug(
|
NameNode.stateChangeLog.debug(
|
||||||
"BLOCK* NameSystem.abandonBlock: {} of file {}", b, src);
|
"BLOCK* NameSystem.abandonBlock: {} of file {}", b, src);
|
||||||
waitForLoadingFSImage();
|
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
FSPermissionChecker pc = getPermissionChecker();
|
FSPermissionChecker pc = getPermissionChecker();
|
||||||
writeLock();
|
writeLock();
|
||||||
|
@ -2593,7 +2565,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
waitForLoadingFSImage();
|
|
||||||
FSPermissionChecker pc = getPermissionChecker();
|
FSPermissionChecker pc = getPermissionChecker();
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
@ -2651,7 +2622,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
@Deprecated
|
@Deprecated
|
||||||
boolean renameTo(String src, String dst, boolean logRetryCache)
|
boolean renameTo(String src, String dst, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
waitForLoadingFSImage();
|
|
||||||
FSDirRenameOp.RenameOldResult ret = null;
|
FSDirRenameOp.RenameOldResult ret = null;
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
@ -2676,7 +2646,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
void renameTo(final String src, final String dst,
|
void renameTo(final String src, final String dst,
|
||||||
boolean logRetryCache, Options.Rename... options)
|
boolean logRetryCache, Options.Rename... options)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
waitForLoadingFSImage();
|
|
||||||
Map.Entry<BlocksMapUpdateInfo, HdfsFileStatus> res = null;
|
Map.Entry<BlocksMapUpdateInfo, HdfsFileStatus> res = null;
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
@ -2712,7 +2681,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
boolean delete(String src, boolean recursive, boolean logRetryCache)
|
boolean delete(String src, boolean recursive, boolean logRetryCache)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
waitForLoadingFSImage();
|
|
||||||
BlocksMapUpdateInfo toRemovedBlocks = null;
|
BlocksMapUpdateInfo toRemovedBlocks = null;
|
||||||
writeLock();
|
writeLock();
|
||||||
boolean ret = false;
|
boolean ret = false;
|
||||||
|
@ -2940,7 +2908,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
||||||
|
|
||||||
FSPermissionChecker pc = getPermissionChecker();
|
FSPermissionChecker pc = getPermissionChecker();
|
||||||
waitForLoadingFSImage();
|
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -3193,7 +3160,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
// since we just remove the uc feature from pendingFile
|
// since we just remove the uc feature from pendingFile
|
||||||
pendingFile.toCompleteFile(now());
|
pendingFile.toCompleteFile(now());
|
||||||
|
|
||||||
waitForLoadingFSImage();
|
|
||||||
// close file and persist block allocations for this file
|
// close file and persist block allocations for this file
|
||||||
closeFile(src, pendingFile);
|
closeFile(src, pendingFile);
|
||||||
|
|
||||||
|
@ -3256,7 +3222,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
+ ")");
|
+ ")");
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
final String src;
|
final String src;
|
||||||
waitForLoadingFSImage();
|
|
||||||
writeLock();
|
writeLock();
|
||||||
boolean copyTruncate = false;
|
boolean copyTruncate = false;
|
||||||
BlockInfo truncatedBlock = null;
|
BlockInfo truncatedBlock = null;
|
||||||
|
@ -3602,7 +3567,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
private void closeFile(String path, INodeFile file) {
|
private void closeFile(String path, INodeFile file) {
|
||||||
assert hasWriteLock();
|
assert hasWriteLock();
|
||||||
waitForLoadingFSImage();
|
|
||||||
// file is closed
|
// file is closed
|
||||||
getEditLog().logCloseFile(path, file);
|
getEditLog().logCloseFile(path, file);
|
||||||
NameNode.stateChangeLog.debug("closeFile: {} with {} blocks is persisted" +
|
NameNode.stateChangeLog.debug("closeFile: {} with {} blocks is persisted" +
|
||||||
|
@ -4748,7 +4712,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
+ ", newNodes=" + Arrays.asList(newNodes)
|
+ ", newNodes=" + Arrays.asList(newNodes)
|
||||||
+ ", client=" + clientName
|
+ ", client=" + clientName
|
||||||
+ ")");
|
+ ")");
|
||||||
waitForLoadingFSImage();
|
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.WRITE);
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
@ -6591,7 +6554,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
*/
|
*/
|
||||||
ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException {
|
ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException {
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
waitForLoadingFSImage();
|
|
||||||
readLock();
|
readLock();
|
||||||
try {
|
try {
|
||||||
checkOperation(OperationCategory.READ);
|
checkOperation(OperationCategory.READ);
|
||||||
|
|
Loading…
Reference in New Issue