Skip to content

Commit

Permalink
perf: add the 'COSN_FILESTATUS_LIST_RECURSIVE_ENABLED' property to im…
Browse files Browse the repository at this point in the history
…prove the performance of the list op.
  • Loading branch information
yuyang733 committed Jul 10, 2023
1 parent 917a331 commit cdb8220
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 3 additions & 1 deletion src/main/java/org/apache/hadoop/fs/CosNFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cdb8220

Please sign in to comment.