Skip to content

Commit

Permalink
[enhance](multi-catalog) support multi name service when config hive …
Browse files Browse the repository at this point in the history
…catalog #21825

when create catalog with multi-servicename like below:
REATE CATALOG hive_prod_t1 PROPERTIES (
'type'='hms',
'hive.metastore.uris' = 'thrift://10.198.xxx:9011,thrift://11.11.xxx:9001,thrift://10.198.xxx:9011',
'hadoop.username' = 'user',
'dfs.nameservices'='ns1007,ns1017',
'dfs.ha.namenodes.ns1007'='nn1,nn2',
'dfs.namenode.rpc-address.ns1007.nn1'='10.198.xxxx:8120',
'dfs.namenode.rpc-address.ns1007.nn2'='10.198.xxx:8120',
'dfs.client.failover.proxy.provider.ns1007'='org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider',
'dfs.ha.namenodes.ns1017'='nn1,nn2',
'dfs.namenode.rpc-address.ns1017.nn1'='10.198.xxxx:8120',
'dfs.namenode.rpc-address.ns1017.nn2'='10.198.xxxx:8120',
'dfs.client.failover.proxy.provider.ns1017'='org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
);

the result will be: ERROR 1105 (HY000): errCode = 2, detailMessage = Missing dfs.ha.namenodes.ns1007,ns1017 property
  • Loading branch information
GoGoWen authored and xiaokang committed Aug 11, 2023
1 parent 8ab6032 commit 441b7f1
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,29 @@ public void checkProperties() throws DdlException {
if (Strings.isNullOrEmpty(dfsNameservices)) {
return;
}
String namenodes = catalogProperty.getOrDefault("dfs.ha.namenodes." + dfsNameservices, "");
if (Strings.isNullOrEmpty(namenodes)) {
throw new DdlException("Missing dfs.ha.namenodes." + dfsNameservices + " property");
}
String[] names = namenodes.split(",");
for (String name : names) {
String address = catalogProperty.getOrDefault("dfs.namenode.rpc-address." + dfsNameservices + "." + name,

String[] nameservices = dfsNameservices.split(",");
for (String dfsservice : nameservices) {
String namenodes = catalogProperty.getOrDefault("dfs.ha.namenodes." + dfsservice, "");
if (Strings.isNullOrEmpty(namenodes)) {
throw new DdlException("Missing dfs.ha.namenodes." + dfsservice + " property");
}
String[] names = namenodes.split(",");
for (String name : names) {
String address = catalogProperty.getOrDefault("dfs.namenode.rpc-address." + dfsservice + "." + name,
"");
if (Strings.isNullOrEmpty(address)) {
throw new DdlException(
"Missing dfs.namenode.rpc-address." + dfsservice + "." + name + " property");
}
}
String failoverProvider = catalogProperty.getOrDefault("dfs.client.failover.proxy.provider." + dfsservice,
"");
if (Strings.isNullOrEmpty(address)) {
if (Strings.isNullOrEmpty(failoverProvider)) {
throw new DdlException(
"Missing dfs.namenode.rpc-address." + dfsNameservices + "." + name + " property");
"Missing dfs.client.failover.proxy.provider." + dfsservice + " property");
}
}
String failoverProvider = catalogProperty.getOrDefault("dfs.client.failover.proxy.provider." + dfsNameservices,
"");
if (Strings.isNullOrEmpty(failoverProvider)) {
throw new DdlException(
"Missing dfs.client.failover.proxy.provider." + dfsNameservices + " property");
}
}

public String getHiveMetastoreUris() {
Expand Down

0 comments on commit 441b7f1

Please sign in to comment.