Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ private void handleApplyCommit(ApplyCommitRequest applyCommitRequest) {
}

PublishWithJoinResponse handlePublishRequest(PublishRequest publishRequest) {
// overwrite local node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is needed. As we're using the proper transport layer in our tests, this should be taken care of by PublicationTransportHandler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted, I hadn't realised that the transport layer should have been doing this when deserialising the request. The issue is that DisruptibleMockTransport doesn't de/serialize the requests before passing them on, so I've added that in defcc57.

publishRequest = new PublishRequest(ClusterState.builder(publishRequest.getAcceptedState()).nodes(
DiscoveryNodes.builder(publishRequest.getAcceptedState().nodes()).localNodeId(getLocalNode().getId()).build()).build());

synchronized (mutex) {
final DiscoveryNode sourceNode = publishRequest.getAcceptedState().nodes().getMasterNode();
logger.trace("handlePublishRequest: handling [{}] from [{}]", publishRequest, sourceNode);
Expand Down Expand Up @@ -560,7 +564,9 @@ protected void sendApplyCommit(DiscoveryNode destination, ApplyCommitRequest app
transportService.getThreadPool().schedule(publishTimeout, Names.GENERIC, new Runnable() {
@Override
public void run() {
publication.onTimeout();
synchronized (mutex) {
publication.onTimeout();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -251,7 +252,7 @@ public void close(Mode newMode) {
assert closed == false : "CandidateJoinAccumulator closed";
closed = true;
if (newMode == Mode.LEADER) {
final Map<JoinTaskExecutor.Task, ClusterStateTaskListener> pendingAsTasks = new HashMap<>();
final Map<JoinTaskExecutor.Task, ClusterStateTaskListener> pendingAsTasks = new LinkedHashMap<>();
joinRequestAccumulator.forEach((key, value) -> {
final JoinTaskExecutor.Task task = new JoinTaskExecutor.Task(key, "elect leader");
pendingAsTasks.put(task, new JoinTaskListener(task, value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public void start(Set<DiscoveryNode> faultyNodes) {
}

public void onTimeout() {
if (isCompleted) {
return;
}

assert timedOut == false;
timedOut = true;
if (applyCommitRequest.isPresent() == false) {
Expand Down