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

[HUDI-4510] Repair config "hive_sync.metastore.uris" in flink sql hive schema sync is not effective #6257

Merged
merged 1 commit into from
Aug 2, 2022
Merged
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 @@ -84,6 +84,9 @@ public static HiveSyncContext create(Configuration conf, SerializableConfigurati
org.apache.hadoop.conf.Configuration hadoopConf = HadoopConfigurations.getHadoopConf(conf);
HiveConf hiveConf = new HiveConf();
hiveConf.addResource(serConf.get());
if (!FlinkOptions.isDefaultValueDefined(conf, FlinkOptions.HIVE_SYNC_METASTORE_URIS)) {
hadoopConf.set(HiveConf.ConfVars.METASTOREURIS.varname, conf.getString(FlinkOptions.HIVE_SYNC_METASTORE_URIS));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this patch is fixing for, shouldn't the buildSyncConfig already take care of this config option ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildSyncConfig() just put config intoHiveSyncContext.props, but not HiveSyncConfig.hadoopConf. When running to constructor of HMSDDLExecutor, it call syncConfig.getHiveConf() to use the HiveSyncConfig.hadoopConf:
this.client = Hive.get(syncConfig.getHiveConf()).getMSC();
There is no code to put 'hive_sync.metastore.uris' from HiveSyncContext.props to syncConfig.getHiveConf(). Which make an exception when use hive sync by metastore.

I found the code is removed in the pull: https://github.com/apache/hudi/pull/5854 . I think it causes the error.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is not a good place to put the code, so it is removed in the pr-5854. But it is effective after adding the code back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the confirmation, it is a valid fix though ~

hiveConf.addResource(hadoopConf);
return new HiveSyncContext(props, hiveConf);
}
Expand Down