HDFS-8384. Allow NN to startup if there are files having a lease but are not under construction. Contributed by Jing Zhao.

This commit is contained in:
Vinod Kumar Vavilapalli 2015-09-08 16:45:38 -07:00
parent a976acc02d
commit 33537078a8
3 changed files with 18 additions and 4 deletions

View File

@ -27,6 +27,9 @@ Release 2.6.1 - UNRELEASED
HDFS-8046. Allow better control of getContentSummary (kihwal) HDFS-8046. Allow better control of getContentSummary (kihwal)
HDFS-8384. Allow NN to startup if there are files having a lease but are not
under construction. (jing9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8480. Fix performance and timeout issues in HDFS-7929 by using HDFS-8480. Fix performance and timeout issues in HDFS-7929 by using

View File

@ -4693,7 +4693,10 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
assert hasWriteLock(); assert hasWriteLock();
FileUnderConstructionFeature uc = pendingFile.getFileUnderConstructionFeature(); FileUnderConstructionFeature uc = pendingFile.getFileUnderConstructionFeature();
Preconditions.checkArgument(uc != null); if (uc == null) {
throw new IOException("Cannot finalize file " + src
+ " because it is not under construction");
}
leaseManager.removeLease(uc.getClientName(), src); leaseManager.removeLease(uc.getClientName(), src);
pendingFile.recordModification(latestSnapshot); pendingFile.recordModification(latestSnapshot);

View File

@ -116,7 +116,11 @@ public class LeaseManager {
final INodeFile cons; final INodeFile cons;
try { try {
cons = this.fsnamesystem.getFSDirectory().getINode(path).asFile(); cons = this.fsnamesystem.getFSDirectory().getINode(path).asFile();
Preconditions.checkState(cons.isUnderConstruction()); if (!cons.isUnderConstruction()) {
LOG.warn("The file " + cons.getFullPathName()
+ " is not under construction but has lease.");
continue;
}
} catch (UnresolvedLinkException e) { } catch (UnresolvedLinkException e) {
throw new AssertionError("Lease files should reside on this FS"); throw new AssertionError("Lease files should reside on this FS");
} }
@ -444,8 +448,12 @@ public class LeaseManager {
// verify that path exists in namespace // verify that path exists in namespace
try { try {
INodeFile node = INodeFile.valueOf(fsnamesystem.dir.getINode(p), p); INodeFile node = INodeFile.valueOf(fsnamesystem.dir.getINode(p), p);
Preconditions.checkState(node.isUnderConstruction()); if (node.isUnderConstruction()) {
inodes.put(p, node); inodes.put(p, node);
} else {
LOG.warn("Ignore the lease of file " + p
+ " for checkpoint since the file is not under construction");
}
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.error(ioe); LOG.error(ioe);
} }