Petr Fedchenkov created HIVE-30212:
--------------------------------------

             Summary: HMS ZooKeeper registration ignores the configured quorum 
when started through main
                 Key: HIVE-30212
                 URL: https://issues.apache.org/jira/browse/HIVE-30212
             Project: Hive
          Issue Type: Bug
          Components: Standalone Metastore
    Affects Versions: 4.2.1, 4.2.0, 4.1.0
            Reporter: Petr Fedchenkov


With metastore.service.discovery.mode=zookeeper, metastore.thrift.uris holds 
the ZooKeeper quorum (HIVE-20794). HiveMetaStore.main clears that key so 
in-process calls use the embedded metastore (hive.metastore.uris since 
HIVE-20905, metastore.thrift.uris too since HIVE-29078 in 4.1.0), and only 
afterwards startMetaStore builds the ZooKeeperHiveHelper from the configuration 
(MetastoreConf.getZKConfig). The helper gets an empty quorum, which becomes 
":2181":

{noformat}
ZooKeeperHiveHelper: Creating curator client with connectString: :2181 ...
java.net.ConnectException: Connection refused
HiveMetaStore: Error adding this metastore instance to ZooKeeper:
{noformat}

A metastore started through main (hive --service metastore, start-metastore) 
exits unless a ZooKeeper server happens to listen on localhost:2181. In that 
case a chroot in the quorum is silently dropped. The existing ZooKeeper tests 
call startMetaStore directly and do not go through main, so they do not catch 
this.

Reproduced with the official apache/hive:standalone-metastore-4.2.1 image on 
Kubernetes. apache/hive:4.0.1 registers with metastore.thrift.uris but fails 
the same way with hive.metastore.uris.

Reproduce locally: run ZooKeeper on localhost:2182 and start HMS with 
metastore.service.discovery.mode=zookeeper and 
metastore.thrift.uris=localhost:2182.

Fix: build the registration helper in main before the URIs are cleared and pass 
it to startMetaStore. An empty quorum in zookeeper mode should fail fast 
instead of connecting to localhost.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to