Avoid throwing NPE when no master found#42419
Avoid throwing NPE when no master found#42419DaveCTurner wants to merge 1 commit intoelastic:masterfrom
Conversation
Today in `SpecificMasterNodesIT` we assert the name of the master and throw a NPE if there is no master. This doesn't work within an `assertBusy()` because the NPE triggers an immediate failure rather than the desired retry. This commit addresses this by first asserting that the master is non-null. Fixes elastic#38331 Relates elastic#38432
|
Pinging @elastic/es-distributed |
ywelsch
left a comment
There was a problem hiding this comment.
I think it's trappy that a cluster state with no master is returned and would like to see that fixed in TransportClusterStateAction.
We use a TransportMasterNodeAction to make this request end up on the master, and do all kind of checks to make sure this node is still master, for it to fail in the final stage due to a race between master service and cluster (applier) service.
In TransportClusterStateAction.masterOperation we should use the cluster state that is passed to masterOperation as the cluster state to return.
In case where we wait for metadataversion, we should also make sure we don't lose the master (otherwise throw NotMasterException which will bubble it back to TransportMasterNodeAction and its retries facilities)...
|
Ok, closing in favour of #42454. |
|
@DaveCTurner Please remember to remove labels when closing unmerged PRs. |
Today in
SpecificMasterNodesITwe assert the name of the master and throw aNPE if there is no master. This doesn't work within an
assertBusy()becausethe NPE triggers an immediate failure rather than the desired retry. This
commit addresses this by first asserting that the master is non-null.
Fixes #38331
Relates #38432, #37802