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 014f2d789dd [MINOR] Archive operation only releases lock when holds it
(#11160)
014f2d789dd is described below
commit 014f2d789dd728e6c2a9d6862d16ff9cbf5a7ca0
Author: Ytimetravel <[email protected]>
AuthorDate: Wed May 29 18:48:30 2024 +0800
[MINOR] Archive operation only releases lock when holds it (#11160)
Co-authored-by: yushiyao <[email protected]>
---
.../org/apache/hudi/client/timeline/HoodieTimelineArchiver.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
index a50eddf8bb7..2f5ecb2816d 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
@@ -36,6 +36,7 @@ import org.apache.hudi.common.util.Option;
import org.apache.hudi.common.util.collection.Pair;
import org.apache.hudi.config.HoodieWriteConfig;
import org.apache.hudi.exception.HoodieException;
+import org.apache.hudi.exception.HoodieLockException;
import org.apache.hudi.metadata.HoodieTableMetadata;
import org.apache.hudi.metrics.HoodieMetrics;
import org.apache.hudi.table.HoodieTable;
@@ -102,6 +103,12 @@ public class HoodieTimelineArchiver<T extends
HoodieAvroPayload, I, K, O> {
// there is no owner or instant time per se for archival.
txnManager.beginTransaction(Option.empty(), Option.empty());
}
+ } catch (HoodieLockException e) {
+ LOG.error("Fail to begin transaction", e);
+ return 0;
+ }
+
+ try {
// Sort again because the cleaning and rollback instants could break the
sequence.
List<ActiveAction> instantsToArchive =
getInstantsToArchive().sorted().collect(Collectors.toList());
if (!instantsToArchive.isEmpty()) {