Weaken assertion in PublicationTransportHandler (#44014)
These assertions do not hold true when a master fails during publication and quickly becomes master again, publishing a new cluster state in a higher term which races against the previous cluster state publication to self (which does not matter anyway). Relates #43994 Closes #44012
This commit is contained in:
parent
5aeb736801
commit
88783927d1
|
@ -191,19 +191,19 @@ public class PublicationTransportHandler {
|
||||||
if (destination.equals(nodes.getLocalNode())) {
|
if (destination.equals(nodes.getLocalNode())) {
|
||||||
// if publishing to self, use original request instead (see currentPublishRequestToSelf for explanation)
|
// if publishing to self, use original request instead (see currentPublishRequestToSelf for explanation)
|
||||||
final PublishRequest previousRequest = currentPublishRequestToSelf.getAndSet(publishRequest);
|
final PublishRequest previousRequest = currentPublishRequestToSelf.getAndSet(publishRequest);
|
||||||
assert previousRequest == null;
|
// we might override an in-flight publication to self in case where we failed as master and became master again,
|
||||||
|
// and the new publication started before the previous one completed (which fails anyhow because of higher current term)
|
||||||
|
assert previousRequest == null || previousRequest.getAcceptedState().term() < publishRequest.getAcceptedState().term();
|
||||||
responseActionListener = new ActionListener<PublishWithJoinResponse>() {
|
responseActionListener = new ActionListener<PublishWithJoinResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(PublishWithJoinResponse publishWithJoinResponse) {
|
public void onResponse(PublishWithJoinResponse publishWithJoinResponse) {
|
||||||
final PublishRequest previousRequest = currentPublishRequestToSelf.getAndSet(null);
|
currentPublishRequestToSelf.compareAndSet(publishRequest, null); // only clean-up our mess
|
||||||
assert previousRequest == publishRequest;
|
|
||||||
originalListener.onResponse(publishWithJoinResponse);
|
originalListener.onResponse(publishWithJoinResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Exception e) {
|
public void onFailure(Exception e) {
|
||||||
final PublishRequest previousRequest = currentPublishRequestToSelf.getAndSet(null);
|
currentPublishRequestToSelf.compareAndSet(publishRequest, null); // only clean-up our mess
|
||||||
assert previousRequest == publishRequest;
|
|
||||||
originalListener.onFailure(e);
|
originalListener.onFailure(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue