Skip to content

Commit e026041

Browse files
Da Zhousteveloughran
authored andcommitted
HADOOP-16169. ABFS: Bug fix for getPathProperties.
Author: Da Zhou <[email protected]>
1 parent de15a66 commit e026041

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ public void setFilesystemProperties(final Hashtable<String, String> properties)
284284
client.setFilesystemProperties(commaSeparatedProperties);
285285
}
286286

287-
public Hashtable<String, String> getPathProperties(final Path path) throws AzureBlobFileSystemException {
288-
LOG.debug("getPathProperties for filesystem: {} path: {}",
287+
public Hashtable<String, String> getPathStatus(final Path path) throws AzureBlobFileSystemException {
288+
LOG.debug("getPathStatus for filesystem: {} path: {}",
289289
client.getFileSystem(),
290290
path);
291291

292292
final Hashtable<String, String> parsedXmsProperties;
293-
final AbfsRestOperation op = client.getPathProperties(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), isNamespaceEnabled);
293+
final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path));
294294

295295
final String xMsProperties = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES);
296296

@@ -372,7 +372,7 @@ public AbfsInputStream openFileForRead(final Path path, final FileSystem.Statist
372372
client.getFileSystem(),
373373
path);
374374

375-
final AbfsRestOperation op = client.getPathProperties(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), isNamespaceEnabled);
375+
final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path));
376376

377377
final String resourceType = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_RESOURCE_TYPE);
378378
final long contentLength = Long.parseLong(op.getResult().getResponseHeader(HttpHeaderConfigurations.CONTENT_LENGTH));
@@ -400,7 +400,7 @@ public OutputStream openFileForWrite(final Path path, final boolean overwrite) t
400400
path,
401401
overwrite);
402402

403-
final AbfsRestOperation op = client.getPathProperties(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), isNamespaceEnabled);
403+
final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path));
404404

405405
final String resourceType = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_RESOURCE_TYPE);
406406
final Long contentLength = Long.valueOf(op.getResult().getResponseHeader(HttpHeaderConfigurations.CONTENT_LENGTH));
@@ -476,7 +476,7 @@ public FileStatus getFileStatus(final Path path) throws IOException {
476476
? client.getAclStatus(AbfsHttpConstants.FORWARD_SLASH + AbfsHttpConstants.ROOT_PATH)
477477
: client.getFilesystemProperties();
478478
} else {
479-
op = client.getPathProperties(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path), isNamespaceEnabled);
479+
op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path));
480480
}
481481

482482
final long blockSize = abfsConfiguration.getAzureBlockSize();

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,15 @@ public AbfsRestOperation setPathProperties(final String path, final String prope
348348
return op;
349349
}
350350

351-
public AbfsRestOperation getPathProperties(final String path, boolean isNameSpaceEnabled) throws AzureBlobFileSystemException {
351+
public AbfsRestOperation getPathStatus(final String path) throws AzureBlobFileSystemException {
352352
final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders();
353353

354354
final AbfsUriQueryBuilder abfsUriQueryBuilder = createDefaultUriQueryBuilder();
355355
abfsUriQueryBuilder.addQuery(HttpQueryParams.QUERY_PARAM_UPN, String.valueOf(abfsConfiguration.isUpnUsed()));
356356

357357
final URL url = createRequestUrl(path, abfsUriQueryBuilder.toString());
358358
final AbfsRestOperation op = new AbfsRestOperation(
359-
isNameSpaceEnabled ? AbfsRestOperationType.GetPathProperties : AbfsRestOperationType.GetPathStatus,
359+
AbfsRestOperationType.GetPathStatus,
360360
this,
361361
HTTP_METHOD_HEAD,
362362
url,

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestFileSystemProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void testBase64PathProperties() throws Exception {
7878
touch(TEST_PATH);
7979
fs.getAbfsStore().setPathProperties(TEST_PATH, properties);
8080
Hashtable<String, String> fetchedProperties =
81-
fs.getAbfsStore().getPathProperties(TEST_PATH);
81+
fs.getAbfsStore().getPathStatus(TEST_PATH);
8282

8383
assertEquals(properties, fetchedProperties);
8484
}
@@ -101,7 +101,7 @@ public void testBase64InvalidPathProperties() throws Exception {
101101
properties.put("key", "{ value: valueTest兩 }");
102102
touch(TEST_PATH);
103103
fs.getAbfsStore().setPathProperties(TEST_PATH, properties);
104-
Hashtable<String, String> fetchedProperties = fs.getAbfsStore().getPathProperties(TEST_PATH);
104+
Hashtable<String, String> fetchedProperties = fs.getAbfsStore().getPathStatus(TEST_PATH);
105105

106106
assertEquals(properties, fetchedProperties);
107107
}

0 commit comments

Comments
 (0)