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

Add personalized configuration parameters for each metastore. #315

Merged
merged 14 commits into from
May 27, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@

import static com.hotels.bdp.waggledance.api.model.ConnectionType.TUNNELED;

import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;

import com.hotels.bdp.waggledance.context.CommonBeans;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;

import lombok.AllArgsConstructor;
Expand All @@ -45,7 +43,21 @@ public class CloseableThriftHiveMetastoreIfaceClientFactory {
public CloseableThriftHiveMetastoreIface newInstance(AbstractMetaStore metaStore) {
Map<String, String> properties = new HashMap<>();
if (waggleDanceConfiguration.getConfigurationProperties() != null) {
properties.putAll(waggleDanceConfiguration.getConfigurationProperties());
// properties.putAll(waggleDanceConfiguration.getConfigurationProperties());
Map<String, String> serverConfigMap=waggleDanceConfiguration.getConfigurationProperties();
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we move these properties to the AbstractMetastore class and make it part of the waggle-dance-federation.yml and this code can become much simpler like:

properties.putAll(waggleDanceConfiguration.getConfigurationProperties());
//override per metastore
properties.putAll(metastore.getConfigurationProperties());

Set<String> keySet=serverConfigMap.keySet();

for(String key:keySet){
if(!key.startsWith(CommonBeans.WD_HMS + ".")){
properties.put(key,properties.get(key));
}
}
String hmsPrefix = CommonBeans.WD_HMS + "." + metaStore.getName() + ".";
for(String key:keySet){
if(key.startsWith(hmsPrefix)){
properties.put(key.substring(hmsPrefix.length()),properties.get(key));
}
}
}
return newHiveInstance(metaStore, properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

@org.springframework.context.annotation.Configuration
public class CommonBeans {
public static final String WD_HMS = "wd-metastore";

@Bean
public HiveConf hiveConf(WaggleDanceConfiguration waggleDanceConfiguration) {
Expand Down