Skip to content

Commit

Permalink
Parallel calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeet-db committed Sep 23, 2024
1 parent 538e736 commit 0fd7e20
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public static boolean isCoordinatedCommitsToFSConversion(
Long commitVersion,
UpdatedActions updatedActions) {
boolean oldMetadataHasCoordinatedCommits =
!getCoordinator(updatedActions.getOldMetadata()).isEmpty();
getCoordinatorName(updatedActions.getOldMetadata()).isPresent();
boolean newMetadataHasCoordinatedCommits =
!getCoordinator(updatedActions.getNewMetadata()).isEmpty();
getCoordinatorName(updatedActions.getNewMetadata()).isPresent();
return oldMetadataHasCoordinatedCommits && !newMetadataHasCoordinatedCommits && commitVersion > 0;
}

Expand Down Expand Up @@ -120,10 +120,17 @@ public static Path commitDirPath(Path logPath) {
return new Path(logPath, COMMIT_SUBDIR);
}

public static String getCoordinator(AbstractMetadata metadata) {
/**
* Retrieves the coordinator name from the provided abstract metadata.
* If no coordinator is set, an empty string is returned.
*
* @param metadata The abstract metadata from which to retrieve the coordinator name.
* @return The coordinator name if set, otherwise an empty string.
*/
public static Optional<String> getCoordinatorName(AbstractMetadata metadata) {
String coordinator = metadata
.getConfiguration()
.get(COORDINATED_COMMITS_COORDINATOR_NAME_KEY);
return coordinator != null ? coordinator : "";
return Optional.ofNullable(coordinator);
}
}

0 comments on commit 0fd7e20

Please sign in to comment.