wangxianghu opened a new pull request, #4352:
URL: https://github.com/apache/amoro/pull/4352
## Why are the changes needed?
When HA is enabled with ha.type=database, AmsUtil.getAMSThriftAddress
still takes the ZooKeeper branch because it only checks ha.enabled. This makes
it build a zookeeper://... address from ha.zookeeper-address, which is not
configured in database-HA deployments. The bad URI is injected into the
optimizer as ams.optimizer.uri, so the optimizer cannot reach AMS and fails to
register.
The fix narrows the ZooKeeper branch to ha.enabled && ha.type == zk. For
database HA (and non-HA), it now returns the direct
thrift://<expose-host>:<port> address, which is the same host/port the AMS node
registers under its lease, so the optimizer registers correctly.
## Brief change log
- AmsUtil.getAMSThriftAddress: only return the ZooKeeper address when
ha.enabled is true and ha.type is zk; otherwise fall back to the direct thrift
host:port address. This fixes optimizer registration under database-based HA.
## How was this patch tested?
- [x] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- Added TestAmsUtil#getAMSThriftAddress covering: HA disabled, ZK-HA
(returns zookeeper://...), and database-HA (falls back to thrift://...).
- [ ] Add screenshots for manual tests if appropriate
- [x] Run test locally before making a pull request
## Documentation
- Does this pull request introduce a new feature? (no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs /
not documented)
--
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]