Skip to content

Commit

Permalink
release 2023-10-16; abfs tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
steveloughran committed Oct 16, 2023
1 parent 922c34d commit 06a1234
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/main/java/org/apache/hadoop/fs/store/abfs/SafePrefetch.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import static org.apache.hadoop.fs.store.StoreExitCodes.E_ERROR;
import static org.apache.hadoop.fs.store.StoreExitCodes.E_USAGE;
import static org.apache.hadoop.fs.store.diag.AbfsDiagnosticsInfo.FS_AZURE_ENABLE_READAHEAD;
import static org.apache.hadoop.fs.store.diag.AbfsDiagnosticsInfo.FS_AZURE_ENABLE_READAHEAD_V2;
import static org.apache.hadoop.fs.store.diag.AbfsDiagnosticsInfo.FS_AZURE_READAHEADQUEUE_DEPTH;

/**
Expand All @@ -62,7 +63,7 @@ public SafePrefetch() {
@Override
public int run(String[] args) throws Exception {
List<String> argList = parseArgs(args);
if (argList.size() < 1) {
if (argList.isEmpty()) {
errorln(USAGE);
return E_USAGE;
}
Expand All @@ -84,6 +85,13 @@ public int run(String[] args) throws Exception {

println("Using filesystem %s", fs.getUri());
Path abfsPath = path.makeQualified(fs.getUri(), fs.getWorkingDirectory());
final Configuration fsConf = fs.getConf();

final boolean readAheadEnabled = fsConf.getBoolean(FS_AZURE_ENABLE_READAHEAD, true);
final boolean readAheadV2Enabled = fsConf.getBoolean(FS_AZURE_ENABLE_READAHEAD_V2, true);
println("%s=%s", FS_AZURE_ENABLE_READAHEAD, readAheadEnabled);
println("%s=%s", FS_AZURE_ENABLE_READAHEAD_V2, readAheadV2Enabled);

final PathCapabilityChecker checker = new PathCapabilityChecker(fs);
if (!checker.methodAvailable()) {
println("Hadoop version is too old for the feature to surface (no PathCapabilities)");
Expand All @@ -101,7 +109,6 @@ public int run(String[] args) throws Exception {
return 0;
}
println("Store is vulnerable to inconsistent prefetching. This MUST be disabled\n");
final Configuration fsConf = fs.getConf();
List<EnvEntry> entries = new ArrayList<>();
entries.add(new EnvEntry(FS_AZURE_READAHEADQUEUE_DEPTH, "", "0"));

Expand All @@ -115,7 +122,7 @@ public int run(String[] args) throws Exception {
// look for the readahead
ConfigurationKeys.class.getField(FS_AZURE_ENABLE_READAHEAD);

if (!fsConf.getBoolean(FS_AZURE_ENABLE_READAHEAD, true)) {
if (!readAheadEnabled) {
println("Readahead is disabled in %s", FS_AZURE_ENABLE_READAHEAD);
return 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import static org.apache.hadoop.fs.store.diag.CapabilityKeys.ETAGS_PRESERVED_IN_RENAME;
import static org.apache.hadoop.fs.store.diag.CapabilityKeys.FS_ACLS;
import static org.apache.hadoop.fs.store.diag.CapabilityKeys.FS_APPEND;
import static org.apache.hadoop.fs.store.diag.CapabilityKeys.FS_AZURE_CAPABILITY_READAHEAD_SAFE;
import static org.apache.hadoop.fs.store.diag.CapabilityKeys.FS_PERMISSIONS;
import static org.apache.hadoop.fs.store.diag.CapabilityKeys.FS_XATTRS;
import static org.apache.hadoop.fs.store.diag.OptionSets.HADOOP_TMP_DIR;
Expand All @@ -62,6 +63,7 @@ public class AbfsDiagnosticsInfo extends StoreDiagnosticsInfo {
AbfsDiagnosticsInfo.class);

public static final String FS_AZURE_ENABLE_READAHEAD = "fs.azure.enable.readahead";
public static final String FS_AZURE_ENABLE_READAHEAD_V2 = "fs.azure.enable.readahead.v2";

public static final String FS_AZURE_READAHEADQUEUE_DEPTH = "fs.azure.readaheadqueue.depth";

Expand Down Expand Up @@ -155,6 +157,7 @@ public class AbfsDiagnosticsInfo extends StoreDiagnosticsInfo {
{"fs.azure.enable.flush", false, false},
{"fs.azure.enable.mkdir.overwrite", false, false},
{FS_AZURE_ENABLE_READAHEAD, false, false},
{FS_AZURE_ENABLE_READAHEAD_V2, false, false},
{"fs.azure.identity.transformer.class", false, false},
{"fs.azure.identity.transformer.domain.name", false, false},
{"fs.azure.identity.transformer.enable.short.name", false, false},
Expand Down Expand Up @@ -249,11 +252,12 @@ public class AbfsDiagnosticsInfo extends StoreDiagnosticsInfo {
* support.
*/
public static final String[] optionalCapabilities = {
FS_PERMISSIONS,
FS_ACLS,
FS_APPEND,
ETAGS_AVAILABLE,
ETAGS_PRESERVED_IN_RENAME,
FS_ACLS,
FS_APPEND,
FS_AZURE_CAPABILITY_READAHEAD_SAFE,
FS_PERMISSIONS,
FS_XATTRS
};

Expand Down Expand Up @@ -447,7 +451,7 @@ public void preflightFilesystemChecks(final Printout printout,
printCanonicalHostname(printout, host);
} catch (UnknownHostException e) {
printout.warn("The hostname of the filesystem %s is unknown.", getFsURI());
printout.warn( "This means the account %s does not exist", host);
printout.warn("This means the account %s does not exist", host);
throw e;
}
}
Expand Down

0 comments on commit 06a1234

Please sign in to comment.