Skip to content

Commit

Permalink
Code reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
bhattmanish98 committed Mar 3, 2025
1 parent 152f9c2 commit 7c71345
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.DIRECTORIES_CREATED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.DIRECTORIES_DELETED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.ERROR_IGNORED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_COPIED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_CREATED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_DELETED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.GET_RESPONSES;
Expand Down Expand Up @@ -135,8 +134,7 @@ public class AbfsCountersImpl implements AbfsCounters {
SERVER_UNAVAILABLE,
RENAME_RECOVERY,
METADATA_INCOMPLETE_RENAME_FAILURES,
RENAME_PATH_ATTEMPTS,
FILES_COPIED
RENAME_PATH_ATTEMPTS
};

private static final AbfsStatistic[] DURATION_TRACKER_LIST = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ public enum AbfsStatistic {
"Number of times rename operation failed due to metadata being "
+ "incomplete"),
RENAME_PATH_ATTEMPTS("rename_path_attempts",
"Number of times we attempt to rename a path internally"),
FILES_COPIED("files_copied",
"Total number of files copied from the object store.");
"Number of times we attempt to rename a path internally");

private String statName;
private String statDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,8 @@ public Void call() throws Exception {
delete(fs.getPath(), fs.isDirectory());
if (fs.isDirectory()) {
statIncrement(DIRECTORIES_DELETED);
} else {
statIncrement(FILES_DELETED);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ public void createNonRecursivePreCheck(Path parentPath,
}
getPathStatus(parentPath.toUri().getPath(), false,
tracingContext, null);
incrementAbfsGetPathStatus();
} catch (AbfsRestOperationException ex) {
if (ex.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) {
throw new FileNotFoundException("Cannot create file "
Expand Down Expand Up @@ -508,7 +507,6 @@ protected AbfsRestOperation createMarkerAtPath(final String path,
final String eTag,
final ContextEncryptionAdapter contextEncryptionAdapter,
final TracingContext tracingContext) throws AzureBlobFileSystemException {
incrementAbfsCreateFile();
return createPathRestOp(path, false, false, false, eTag,
contextEncryptionAdapter, tracingContext);
}
Expand Down Expand Up @@ -1745,7 +1743,6 @@ public void takeGetPathStatusAtomicRenameKeyAction(final Path path,
pendingJsonFileStatus = getPathStatus(
pendingJsonPath.toUri().getPath(), tracingContext,
null, false);
incrementAbfsGetPathStatus();
if (checkIsDir(pendingJsonFileStatus.getResult())) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
import org.apache.hadoop.util.concurrent.HadoopExecutors;

import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_GET_FILE_STATUS;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_COPIED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_CREATED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.FILES_DELETED;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.RENAME_PATH_ATTEMPTS;
import static org.apache.hadoop.fs.azurebfs.AzureBlobFileSystemStore.extractEtagHeader;
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.APN_VERSION;
Expand Down Expand Up @@ -702,34 +698,6 @@ protected void incrementAbfsRenamePath() {
abfsCounters.incrementCounter(RENAME_PATH_ATTEMPTS, 1);
}

/**
* Increments AbfsCounters for get path status by 1.
*/
protected void incrementAbfsGetPathStatus() {
abfsCounters.incrementCounter(CALL_GET_FILE_STATUS, 1);
}

/**
* Increments AbfsCounters for Delete File by 1.
*/
protected void incrementAbfsDeleteFile() {
abfsCounters.incrementCounter(FILES_DELETED, 1);
}

/**
* Increments AbfsCounters for Create File by 1.
*/
protected void incrementAbfsCreateFile() {
abfsCounters.incrementCounter(FILES_CREATED, 1);
}

/**
* Increments AbfsCounters for Copy Files by 1.
*/
protected void incrementAbfsCopyFile() {
abfsCounters.incrementCounter(FILES_COPIED, 1);
}

/**
* Check if the rename request failure is post a retry and if earlier rename
* request might have succeeded at back-end.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
import org.apache.hadoop.util.StringUtils;

import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.hadoop.fs.azurebfs.AbfsStatistic.CALL_GET_FILE_STATUS;
import static org.apache.hadoop.fs.azurebfs.AzureBlobFileSystemStore.extractEtagHeader;
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.ACQUIRE_LEASE_ACTION;
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.APPEND_ACTION;
Expand Down Expand Up @@ -462,8 +461,6 @@ public void createNonRecursivePreCheck(Path parentPath,
+ " because parent folder does not exist.");
}
throw ex;
} finally {
getAbfsCounters().incrementCounter(CALL_GET_FILE_STATUS, 1);
}
}

Expand Down Expand Up @@ -1228,8 +1225,6 @@ public AbfsRestOperation deletePath(final String path,
} else {
return idempotencyOp;
}
} finally {
incrementAbfsDeleteFile();
}

return op;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ int getMaxConsumptionParallelism() {
private boolean deleteInternal(final Path path)
throws AzureBlobFileSystemException {
getAbfsClient().deleteBlobPath(path, null, tracingContext);
getAbfsClient().incrementAbfsDeleteFile();
deleteCount.incrementAndGet();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ int getMaxConsumptionParallelism() {
* @throws AzureBlobFileSystemException if server call fails
*/
public boolean execute() throws AzureBlobFileSystemException {
getAbfsClient().incrementAbfsRenamePath();
PathInformation pathInformation = getPathInformation(src, tracingContext);
boolean result = false;
if (preCheck(src, dst, pathInformation)) {
Expand Down Expand Up @@ -167,6 +166,7 @@ public boolean execute() throws AzureBlobFileSystemException {
result = renameInternal(src, dst);
}
} finally {
getAbfsClient().incrementAbfsRenamePath();
if (srcAbfsLease != null) {
// If the operation is successful, cancel the timer and no need to release
// the lease as rename on the blob-path has taken place.
Expand Down Expand Up @@ -417,9 +417,7 @@ private boolean renameInternal(final Path path,
boolean operated = false;
try {
copyPath(path, destinationPathForBlobPartOfRenameSrcDir, leaseId);
getAbfsClient().incrementAbfsCopyFile();
getAbfsClient().deleteBlobPath(path, leaseId, tracingContext);
getAbfsClient().incrementAbfsDeleteFile();
operated = true;
} finally {
if (abfsLease != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ public int preRename() throws AzureBlobFileSystemException {
}
}
throw e;
} finally {
abfsClient.incrementAbfsCreateFile();
}
}

Expand Down Expand Up @@ -312,8 +310,6 @@ private void deleteRenamePendingJson() throws AzureBlobFileSystemException {
return;
}
throw e;
} finally {
abfsClient.incrementAbfsDeleteFile();
}
}

Expand Down

0 comments on commit 7c71345

Please # to comment.