Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ARCTIC-910]Ignore committing error to HMS when committing Hive format table transaction #2482

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@
import org.apache.iceberg.io.LocationProvider;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Map;

public class HiveOperationTransaction implements Transaction {

private static final Logger LOG = LoggerFactory.getLogger(HiveOperationTransaction.class);

private final UnkeyedHiveTable unkeyedHiveTable;
private final Transaction wrapped;
private final HMSClientPool client;
Expand Down Expand Up @@ -152,7 +156,11 @@ public ExpireSnapshots expireSnapshots() {
@Override
public void commitTransaction() {
wrapped.commitTransaction();
transactionalClient.commit();
try {
transactionalClient.commit();
} catch (Exception e) {
LOG.warn("Commit operation to HMS failed.", e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ public void testOverwriteCommitHMSFailed() throws TException {
OverwriteFiles overwriteFiles = baseStore.newOverwrite();
dataFiles.forEach(overwriteFiles::addFile);

Transaction tx = baseStore.newTransaction();
OverwriteFiles overwriteFiles1 = tx.newOverwrite();
dataFiles.forEach(overwriteFiles1::addFile);
overwriteFiles1.commit();

// rename the hive table,
Table hiveTable =
TEST_HMS
Expand All @@ -249,6 +254,8 @@ public void testOverwriteCommitHMSFailed() throws TException {

// commit should success even though hive table is not existed.
overwriteFiles.commit();
// transaction commit should success even though hive table is not existed.
tx.commitTransaction();

hiveTable.setTableName(getArcticTable().id().getTableName());
TEST_HMS
Expand Down