-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-1269] Make whether the failure of connect hive affects hudi ingest process configurable #2443
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
Changes from 3 commits
0d98db7
227c817
86faca0
56f3f68
672445f
8aa5ce7
7baf5de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,56 +57,72 @@ public class HiveSyncTool extends AbstractSyncTool { | |
| public static final String SUFFIX_READ_OPTIMIZED_TABLE = "_ro"; | ||
|
|
||
| private final HiveSyncConfig cfg; | ||
| private final HoodieHiveClient hoodieHiveClient; | ||
| private final String snapshotTableName; | ||
| private final Option<String> roTableTableName; | ||
| private HoodieHiveClient hoodieHiveClient = null; | ||
| private String snapshotTableName = null; | ||
| private Option<String> roTableTableName = null; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it’s better to keep the original name
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. guess it's a typo. Probably we can fix it while you are at it. |
||
|
|
||
| public HiveSyncTool(HiveSyncConfig cfg, HiveConf configuration, FileSystem fs) { | ||
| super(configuration.getAllProperties(), fs); | ||
| this.hoodieHiveClient = new HoodieHiveClient(cfg, configuration, fs); | ||
|
|
||
| try { | ||
| this.hoodieHiveClient = new HoodieHiveClient(cfg, configuration, fs); | ||
|
nsivabalan marked this conversation as resolved.
|
||
| } catch (RuntimeException e) { | ||
| if (cfg.ignoreConnectException) { | ||
| LOG.error("Got runtime exception when hive syncing", e); | ||
|
nsivabalan marked this conversation as resolved.
Outdated
|
||
| } else { | ||
| throw new HoodieHiveSyncException("Got runtime exception when hive syncing", e); | ||
| } | ||
| } | ||
|
|
||
| this.cfg = cfg; | ||
| // Set partitionFields to empty, when the NonPartitionedExtractor is used | ||
| if (NonPartitionedExtractor.class.getName().equals(cfg.partitionValueExtractorClass)) { | ||
| LOG.warn("Set partitionFields to empty, since the NonPartitionedExtractor is used"); | ||
| cfg.partitionFields = new ArrayList<>(); | ||
| } | ||
| switch (hoodieHiveClient.getTableType()) { | ||
| case COPY_ON_WRITE: | ||
| this.snapshotTableName = cfg.tableName; | ||
| this.roTableTableName = Option.empty(); | ||
| break; | ||
| case MERGE_ON_READ: | ||
| this.snapshotTableName = cfg.tableName + SUFFIX_SNAPSHOT_TABLE; | ||
| this.roTableTableName = cfg.skipROSuffix ? Option.of(cfg.tableName) : | ||
| Option.of(cfg.tableName + SUFFIX_READ_OPTIMIZED_TABLE); | ||
| break; | ||
| default: | ||
| LOG.error("Unknown table type " + hoodieHiveClient.getTableType()); | ||
| throw new InvalidTableException(hoodieHiveClient.getBasePath()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void syncHoodieTable() { | ||
| try { | ||
| if (hoodieHiveClient != null) { | ||
| switch (hoodieHiveClient.getTableType()) { | ||
| case COPY_ON_WRITE: | ||
| syncHoodieTable(snapshotTableName, false); | ||
| this.snapshotTableName = cfg.tableName; | ||
| this.roTableTableName = Option.empty(); | ||
| break; | ||
| case MERGE_ON_READ: | ||
| // sync a RO table for MOR | ||
| syncHoodieTable(roTableTableName.get(), false); | ||
| // sync a RT table for MOR | ||
| syncHoodieTable(snapshotTableName, true); | ||
| this.snapshotTableName = cfg.tableName + SUFFIX_SNAPSHOT_TABLE; | ||
| this.roTableTableName = cfg.skipROSuffix ? Option.of(cfg.tableName) : | ||
| Option.of(cfg.tableName + SUFFIX_READ_OPTIMIZED_TABLE); | ||
| break; | ||
| default: | ||
| LOG.error("Unknown table type " + hoodieHiveClient.getTableType()); | ||
| throw new InvalidTableException(hoodieHiveClient.getBasePath()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void syncHoodieTable() { | ||
| try { | ||
| if (hoodieHiveClient != null) { | ||
| switch (hoodieHiveClient.getTableType()) { | ||
| case COPY_ON_WRITE: | ||
| syncHoodieTable(snapshotTableName, false); | ||
| break; | ||
| case MERGE_ON_READ: | ||
| // sync a RO table for MOR | ||
| syncHoodieTable(roTableTableName.get(), false); | ||
| // sync a RT table for MOR | ||
| syncHoodieTable(snapshotTableName, true); | ||
| break; | ||
| default: | ||
| LOG.error("Unknown table type " + hoodieHiveClient.getTableType()); | ||
| throw new InvalidTableException(hoodieHiveClient.getBasePath()); | ||
| } | ||
| } | ||
| } catch (RuntimeException re) { | ||
| LOG.error("Got runtime exception when hive syncing", re); | ||
| } finally { | ||
| hoodieHiveClient.close(); | ||
| if (hoodieHiveClient != null) { | ||
| hoodieHiveClient.close(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extend a larger range from
connect exceptiontosync exception?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanghua : are you suggesting, we can make this config cover exceptions in syncHoodieTable() as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, do you have any concerns? In our scenario, we met all hudi spark jobs failed when the hive server is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope. was just clarifying :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liujinhui1994 : do you have any concerns to make this cover all exception w/ hive sync? I don't see you have addressed this feedback.