This is an automated email from the ASF dual-hosted git repository.
danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 94b564151a2 [MINOR] LSMTimeline needs to handle case for tables which
has not performed first archived yet (#11271)
94b564151a2 is described below
commit 94b564151a2789e6bd6508c884cc6c6027ca108e
Author: Balaji Varadarajan <[email protected]>
AuthorDate: Thu May 23 02:04:44 2024 -0700
[MINOR] LSMTimeline needs to handle case for tables which has not performed
first archived yet (#11271)
Co-authored-by: Balaji Varadarajan <[email protected]>
---
.../java/org/apache/hudi/common/table/timeline/LSMTimeline.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/LSMTimeline.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/LSMTimeline.java
index c482de08ac3..8bfa9769b36 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/LSMTimeline.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/LSMTimeline.java
@@ -34,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -158,6 +159,7 @@ public class LSMTimeline {
LOG.warn("Error reading version file {}", versionFilePath, e);
}
}
+
return
allSnapshotVersions(metaClient).stream().max(Integer::compareTo).orElse(-1);
}
@@ -165,6 +167,10 @@ public class LSMTimeline {
* Returns all the valid snapshot versions.
*/
public static List<Integer> allSnapshotVersions(HoodieTableMetaClient
metaClient) throws IOException {
+ StoragePath archivedFolderPath = new
StoragePath(metaClient.getArchivePath());
+ if (!metaClient.getStorage().exists(archivedFolderPath)) {
+ return Collections.emptyList();
+ }
return metaClient.getStorage().listDirectEntries(new
StoragePath(metaClient.getArchivePath()),
getManifestFilePathFilter())
.stream()