jeeteshm commented on a change in pull request #1611: HADOOP-16612 Track Azure
Blob File System client-perceived latency
URL: https://github.com/apache/hadoop/pull/1611#discussion_r342348025
##########
File path:
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
##########
@@ -288,159 +303,196 @@ public void setFilesystemProperties(final
Hashtable<String, String> properties)
client.getFileSystem(),
properties);
- final String commaSeparatedProperties;
- try {
- commaSeparatedProperties =
convertXmsPropertiesToCommaSeparatedString(properties);
- } catch (CharacterCodingException ex) {
- throw new InvalidAbfsRestOperationException(ex);
- }
+ try (AbfsPerfInfo perfInfo = startTracking("setFilesystemProperties",
+ "setFilesystemProperties")) {
+ final String commaSeparatedProperties;
+ try {
+ commaSeparatedProperties =
convertXmsPropertiesToCommaSeparatedString(properties);
+ } catch (CharacterCodingException ex) {
+ throw new InvalidAbfsRestOperationException(ex);
+ }
- client.setFilesystemProperties(commaSeparatedProperties);
+ final AbfsRestOperation op =
client.setFilesystemProperties(commaSeparatedProperties);
+ perfInfo.registerResult(op.getResult()).registerSuccess(true);
+ }
}
public Hashtable<String, String> getPathStatus(final Path path) throws
AzureBlobFileSystemException {
- LOG.debug("getPathStatus for filesystem: {} path: {}",
- client.getFileSystem(),
- path);
+ try (AbfsPerfInfo perfInfo = startTracking("getPathStatus",
"getPathStatus")){
+ LOG.debug("getPathStatus for filesystem: {} path: {}",
+ client.getFileSystem(),
+ path);
+
+ final Hashtable<String, String> parsedXmsProperties;
+ final AbfsRestOperation op =
client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path));
+ perfInfo.registerResult(op.getResult());
- final Hashtable<String, String> parsedXmsProperties;
- final AbfsRestOperation op =
client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path));
+ final String xMsProperties =
op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES);
- final String xMsProperties =
op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES);
+ parsedXmsProperties = parseCommaSeparatedXmsProperties(xMsProperties);
- parsedXmsProperties = parseCommaSeparatedXmsProperties(xMsProperties);
+ perfInfo.registerSuccess(true);
- return parsedXmsProperties;
+ return parsedXmsProperties;
+ }
}
public void setPathProperties(final Path path, final Hashtable<String,
String> properties) throws AzureBlobFileSystemException {
- LOG.debug("setFilesystemProperties for filesystem: {} path: {} with
properties: {}",
- client.getFileSystem(),
- path,
- properties);
+ try (AbfsPerfInfo perfInfo = startTracking("setPathProperties",
"setPathProperties")){
+ LOG.debug("setFilesystemProperties for filesystem: {} path: {} with
properties: {}",
+ client.getFileSystem(),
+ path,
+ properties);
- final String commaSeparatedProperties;
- try {
- commaSeparatedProperties =
convertXmsPropertiesToCommaSeparatedString(properties);
- } catch (CharacterCodingException ex) {
- throw new InvalidAbfsRestOperationException(ex);
+ final String commaSeparatedProperties;
+ try {
+ commaSeparatedProperties =
convertXmsPropertiesToCommaSeparatedString(properties);
+ } catch (CharacterCodingException ex) {
+ throw new InvalidAbfsRestOperationException(ex);
+ }
+ final AbfsRestOperation op =
client.setPathProperties(AbfsHttpConstants.FORWARD_SLASH +
getRelativePath(path), commaSeparatedProperties);
+ perfInfo.registerResult(op.getResult()).registerSuccess(true);
}
- client.setPathProperties(AbfsHttpConstants.FORWARD_SLASH +
getRelativePath(path), commaSeparatedProperties);
}
public void createFilesystem() throws AzureBlobFileSystemException {
- LOG.debug("createFilesystem for filesystem: {}",
- client.getFileSystem());
+ try (AbfsPerfInfo perfInfo = startTracking("createFilesystem",
"createFilesystem")){
+ LOG.debug("createFilesystem for filesystem: {}",
+ client.getFileSystem());
- client.createFilesystem();
+ final AbfsRestOperation op = client.createFilesystem();
+ perfInfo.registerResult(op.getResult()).registerSuccess(true);
+ }
}
public void deleteFilesystem() throws AzureBlobFileSystemException {
- LOG.debug("deleteFilesystem for filesystem: {}",
- client.getFileSystem());
+ try (AbfsPerfInfo perfInfo = startTracking("deleteFilesystem",
"deleteFilesystem")) {
+ LOG.debug("deleteFilesystem for filesystem: {}",
+ client.getFileSystem());
- client.deleteFilesystem();
+ final AbfsRestOperation op = client.deleteFilesystem();
+ perfInfo.registerResult(op.getResult()).registerSuccess(true);
+ }
}
public OutputStream createFile(final Path path, final boolean overwrite,
final FsPermission permission,
final FsPermission umask) throws
AzureBlobFileSystemException {
- boolean isNamespaceEnabled = getIsNamespaceEnabled();
- LOG.debug("createFile filesystem: {} path: {} overwrite: {} permission: {}
umask: {} isNamespaceEnabled: {}",
- client.getFileSystem(),
- path,
- overwrite,
- permission.toString(),
- umask.toString(),
- isNamespaceEnabled);
-
- client.createPath(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path),
true, overwrite,
- isNamespaceEnabled ? getOctalNotation(permission) : null,
- isNamespaceEnabled ? getOctalNotation(umask) : null);
-
- return new AbfsOutputStream(
- client,
- AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path),
- 0,
- abfsConfiguration.getWriteBufferSize(),
- abfsConfiguration.isFlushEnabled(),
- abfsConfiguration.isOutputStreamFlushDisabled());
+ try (AbfsPerfInfo perfInfo = startTracking("createFile", "createPath")) {
+ boolean isNamespaceEnabled = getIsNamespaceEnabled();
+ LOG.debug("createFile filesystem: {} path: {} overwrite: {} permission:
{} umask: {} isNamespaceEnabled: {}",
+ client.getFileSystem(),
+ path,
+ overwrite,
+ permission.toString(),
Review comment:
@goiri This code is not added by me -- there is just a change in indentation
here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]