giggsoff opened a new pull request, #6909: URL: https://github.com/apache/hive/pull/6909
### What changes were proposed in this pull request? `HiveMetaStore.main` builds the ZooKeeper registration helper from `metastore.thrift.uris` before clearing the URIs and passes it to a new package-private `startMetaStore` overload. The public overloads are unchanged. An empty quorum in zookeeper mode now fails fast with `metastore.thrift.uris must be set to the ZooKeeper quorum when metastore.service.discovery.mode is zookeeper`. ### Why are the changes needed? With `metastore.service.discovery.mode=zookeeper`, `metastore.thrift.uris` holds the quorum (HIVE-20794). `main` clears it so in-process calls stay embedded (HIVE-20905, extended to `metastore.thrift.uris` by HIVE-29078 in 4.1.0), and only then `startMetaStore` builds the helper from the configuration, which turns the empty quorum into `:2181`: ``` ZooKeeperHiveHelper: Creating curator client with connectString: :2181 ... HiveMetaStore: Error adding this metastore instance to ZooKeeper: ``` HMS started through `main` exits unless a ZooKeeper happens to listen on `localhost:2181`, and even then a chroot in the quorum (e.g. `/hive`) is lost. Existing ZooKeeper tests call `startMetaStore` directly, so they never hit this. ### Does this PR introduce _any_ user-facing change? HMS registers in the configured quorum, chroot included. In zookeeper mode with an empty `metastore.thrift.uris` it now refuses to start with the message above instead of trying `localhost:2181`. Clients are unaffected. ### How was this patch tested? - New `TestRemoteHiveMetaStoreZKMain`: starts HMS as `main` does (URIs cleared, chroot quorum on a curator `TestingServer`), checks registration and deregistration, and checks that an empty quorum is rejected. It fails against the old registration code. `TestRemoteHiveMetaStoreZK` passes. - Manually: ZooKeeper on `localhost:2182`, `HiveMetaStore -p 19083` with `metastore.thrift.uris=localhost:2182`. Before: `connectString: :2181`, exit 1. After: `connectString: localhost:2182`, `added to the zookeeper`. - On a Kerberized ZooKeeper with three HMS instances started by `main` and external engines discovering HMS through ZooKeeper: registration under the chroot, immediate removal on graceful shutdown. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
