Broker/Coordinator nodes start only after inventory is initialized#4770
Broker/Coordinator nodes start only after inventory is initialized#4770niketh wants to merge 3 commits intoapache:masterfrom
Conversation
ce03121 to
16f3955
Compare
16f3955 to
6eb80a5
Compare
|
@niketh I don't think this will fix the problem, how will your clients know not to send requests before broker lifecycle has finished starting ? |
|
@himanshug Tested in production and it works as expected.
Jetty will not start until the full view is loaded |
| } | ||
|
|
||
| // Block start() till PathChildrenCache is fully loaded | ||
| while (!containerCacheListener.doneInitializing) { |
There was a problem hiding this comment.
can we use a CountDownLatch.await(1 minute) here instead? that way not too many logs will be printed and also it wouldn't wait any more than necessary ?
7d660d0 to
928b473
Compare
|
|
||
| private volatile PathChildrenCache childrenCache; | ||
|
|
||
| private final CountDownLatch latch = new CountDownLatch(1); |
There was a problem hiding this comment.
can we call this initializationDoneLatch or something like that ? also , I think doneInitializing boolean variable can be removed and latch.await(1 ms) can be used to do the boolean check wherever necessary.
|
Same idea as #6742. |
Broker queries return wrong results just after startup because the inventory is not fully initialized and BrokerServerView is incomplete. The solution is to block
CuratorInventoryManager start()method till inventory is fully available.