Skip to content

Commit

Permalink
Fix java fmt checkstyle
Browse files Browse the repository at this point in the history
Signed-off-by: Tai Le Manh <[email protected]>
  • Loading branch information
tlm365 committed Aug 22, 2024
1 parent 50d9235 commit 5587d00
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ public static long getEarliestRecreatableCommit(Engine engine, Path logPath)
throws TableNotFoundException {
try (CloseableIterator<FileStatus> files =
listFrom(engine, logPath, 0)
.filter(fs -> {
final Path path = new Path(fs.getPath());
return FileNames.isCommitFile(path)
|| FileNames.isCheckpointFile(path);
})) {
.filter(
fs -> {
final Path path = new Path(fs.getPath());
return FileNames.isCommitFile(path) || FileNames.isCheckpointFile(path);
})) {
if (!files.hasNext()) {
// listFrom already throws an error if the directory is truly empty, thus this must
// be because no files are checkpoint or delta files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ public static Optional<CheckpointInstance> findLastCompleteCheckpointBefore(
}

private static boolean validCheckpointFile(FileStatus fileStatus) {
return FileNames.isCheckpointFile(new Path(fileStatus.getPath()))
&& fileStatus.getSize() > 0;
return FileNames.isCheckpointFile(new Path(fileStatus.getPath())) && fileStatus.getSize() > 0;
}

/** The path to the file that holds metadata about the most recent checkpoint. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ public void checkpoint(Engine engine, long version) throws TableNotFoundExceptio
Checkpointer checkpointer = new Checkpointer(logPath);
checkpointer.writeLastCheckpointFile(engine, checkpointMetaData);

logger.info("{}: Last checkpoint metadata file is written for version: {}",
tablePath, version);
logger.info("{}: Last checkpoint metadata file is written for version: {}", tablePath, version);

logger.info("{}: Finished checkpoint for version: {}", tablePath, version);
}
Expand Down Expand Up @@ -250,8 +249,7 @@ private CloseableIterator<FileStatus> listFrom(Engine engine, long startVersion)
throws IOException {
logger.debug("{}: startVersion: {}", tablePath, startVersion);
return wrapEngineExceptionThrowsIO(
() -> engine.getFileSystemClient()
.listFrom(FileNames.listingPrefix(logPath, startVersion)),
() -> engine.getFileSystemClient().listFrom(FileNames.listingPrefix(logPath, startVersion)),
"Listing from %s",
FileNames.listingPrefix(logPath, startVersion));
}
Expand All @@ -272,8 +270,7 @@ private boolean isDeltaCommitOrCheckpointFile(Path filePath) {
* Returns an iterator containing a list of files found in the _delta_log directory starting with
* the startVersion. Returns None if no files are found or the directory is missing.
*/
private Optional<CloseableIterator<FileStatus>> listFromOrNone(
Engine engine, long startVersion) {
private Optional<CloseableIterator<FileStatus>> listFromOrNone(Engine engine, long startVersion) {
// LIST the directory, starting from the provided lower bound (treat missing dir as empty).
// NOTE: "empty/missing" is _NOT_ equivalent to "contains no useful commit files."
try {
Expand Down Expand Up @@ -327,11 +324,10 @@ protected final Optional<List<FileStatus>> listDeltaAndCheckpointFiles(
Optional<Long> versionToLoad,
Optional<TableCommitCoordinatorClientHandler> tableCommitHandlerOpt) {
versionToLoad.ifPresent(
v -> checkArgument(
v >= startVersion,
format("versionToLoad=%s provided is less than startVersion=%s", v, startVersion)
)
);
v ->
checkArgument(
v >= startVersion,
format("versionToLoad=%s provided is less than startVersion=%s", v, startVersion)));
logger.debug(
"startVersion: {}, versionToLoad: {}, coordinated commits enabled: {}",
startVersion,
Expand Down Expand Up @@ -391,8 +387,7 @@ protected final Optional<List<FileStatus>> listDeltaAndCheckpointFiles(
if (FileNames.isCommitFile(filePath)) {
maxDeltaVersionSeen.set(
Math.max(
maxDeltaVersionSeen.get(),
FileNames.deltaVersion(fileStatus.getPath())));
maxDeltaVersionSeen.get(), FileNames.deltaVersion(fileStatus.getPath())));
}
output.add(fileStatus);
}
Expand Down Expand Up @@ -428,7 +423,7 @@ private List<Commit> getUnbackfilledCommits(
.map(
commitCoordinatorClientHandler -> {
logger.info(
"Getting un-backfilled commits from commit coordinator for " + "table: {}",
"Getting un-backfilled commits from commit coordinator for table: {}",
tablePath);
return commitCoordinatorClientHandler
.getCommits(startVersion, versionToLoad.orElse(null))
Expand Down Expand Up @@ -665,8 +660,7 @@ protected Optional<LogSegment> getLogSegmentAtOrBeforeVersion(

Tuple2<List<FileStatus>, List<FileStatus>> checkpointsAndDeltas =
ListUtils.partition(
newFiles,
fileStatus -> FileNames.isCheckpointFile(new Path(fileStatus.getPath())));
newFiles, fileStatus -> FileNames.isCheckpointFile(new Path(fileStatus.getPath())));
final List<FileStatus> checkpoints = checkpointsAndDeltas._1;
final List<FileStatus> deltas = checkpointsAndDeltas._2;

Expand Down Expand Up @@ -759,8 +753,7 @@ protected Optional<LogSegment> getLogSegmentAtOrBeforeVersion(
.collect(Collectors.toCollection(LinkedList::new));

logDebug(
() ->
format("deltaVersions: %s", Arrays.toString(deltaVersionsAfterCheckpoint.toArray())));
() -> format("deltaVersions: %s", Arrays.toString(deltaVersionsAfterCheckpoint.toArray())));

final long newVersion =
deltaVersionsAfterCheckpoint.isEmpty()
Expand Down

0 comments on commit 5587d00

Please sign in to comment.