|
@@ -2904,6 +2904,33 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
logAuditEvent(true, "getfileinfo", src);
|
|
|
return stat;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns true if the file is closed
|
|
|
+ */
|
|
|
+ boolean isFileClosed(String src)
|
|
|
+ throws AccessControlException, UnresolvedLinkException,
|
|
|
+ StandbyException, IOException {
|
|
|
+ FSPermissionChecker pc = getPermissionChecker();
|
|
|
+ checkOperation(OperationCategory.READ);
|
|
|
+ readLock();
|
|
|
+ try {
|
|
|
+ checkOperation(OperationCategory.READ);
|
|
|
+ if (isPermissionEnabled) {
|
|
|
+ checkTraverse(pc, src);
|
|
|
+ }
|
|
|
+ return !INodeFile.valueOf(dir.getINode(src), src).isUnderConstruction();
|
|
|
+ } catch (AccessControlException e) {
|
|
|
+ if (isAuditEnabled() && isExternalInvocation()) {
|
|
|
+ logAuditEvent(false, UserGroupInformation.getCurrentUser(),
|
|
|
+ getRemoteIp(),
|
|
|
+ "isFileClosed", src, null, null);
|
|
|
+ }
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ readUnlock();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Create all the necessary directories
|