Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
There is a possible bug in FSDirectory.addFile causing no leases found for under construction files.
//FSDirectory INodeFile addFile(String path, PermissionStatus permissions, short replication, long preferredBlockSize, String clientName, String clientMachine) throws FileAlreadyExistsException, QuotaExceededException, UnresolvedLinkException, SnapshotAccessControlException, AclException { long modTime = now(); INodeFile newNode = newINodeFile(namesystem.allocateNewInodeId(), permissions, modTime, modTime, replication, preferredBlockSize); newNode.toUnderConstruction(clientName, clientMachine); boolean added = false; writeLock(); try { added = addINode(path, newNode); } finally { writeUnlock(); } ... }
- newNode.toUnderConstruction(clientName, clientMachine) adds FileUnderConstructionFeature to the INode, i.e. the file becomes an under construction file. At this moment, there is no lease for this file yet. The lease will be added later in FSNamesystem.startFileInternal(..).
- It is possible that addINode(path, newNode) adds the inode to the namespace tree but throws QuotaExceededException later on when calling updateModificationTime. (i.e. addINode -> addLastINode -> addChild -> parent.addChild -> updateModificationTime throws QuotaExceededException) Then, the newly added uc file is left in namespace but the corresponding lease won't be added.
Attachments
Issue Links
- duplicates
-
HDFS-6651 Deletion failure can leak inodes permanently
- Closed