diff --git a/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java b/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java index 942698a0..196662d1 100644 --- a/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java +++ b/src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java @@ -205,4 +205,7 @@ public class CosNConfigKeys extends CommonConfigurationKeys { public static final String COSN_FILESTATUS_LIST_OP_ENABLED = "fs.cosn.filestatus.list.op.enabled"; public static final boolean DEFAULT_FILESTATUS_LIST_OP_ENABLED = true; + + public static final String COSN_FILESTATUS_LIST_RECURSIVE_ENABLED = "fs.cosn.filestatus.list.recursive.enabled"; + public static final boolean DEFAULT_FILESTATUS_LIST_RECURSIVE_ENABLED = false; } diff --git a/src/main/java/org/apache/hadoop/fs/CosNFileSystem.java b/src/main/java/org/apache/hadoop/fs/CosNFileSystem.java index 5f280bbc..508c2409 100644 --- a/src/main/java/org/apache/hadoop/fs/CosNFileSystem.java +++ b/src/main/java/org/apache/hadoop/fs/CosNFileSystem.java @@ -611,7 +611,9 @@ public FileStatus innerGetFileStatus(Path f, boolean checkFile) throws IOExcepti LOG.debug("List the cos key [{}] to judge whether it is a directory or not. max keys [{}]", key, maxKeys); CosNResultInfo listObjectsResultInfo = new CosNResultInfo(); - CosNPartialListing listing = this.nativeStore.list(key, maxKeys, listObjectsResultInfo); + CosNPartialListing listing = this.nativeStore.list(key, maxKeys, null, + this.getConf().getBoolean(CosNConfigKeys.COSN_FILESTATUS_LIST_RECURSIVE_ENABLED, CosNConfigKeys.DEFAULT_FILESTATUS_LIST_RECURSIVE_ENABLED), + listObjectsResultInfo); if (listing.getFiles().length > 0 || listing.getCommonPrefixes().length > 0) { LOG.debug("List the cos key [{}] to find that it is a directory.", key); return newDirectory(absolutePath);