Skip to content

Commit ea7ec38

Browse files
committed
post update messages to the local node
1 parent 06292d1 commit ea7ec38

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

core/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,23 @@ public SnapshotShardsService(Settings settings, ClusterService clusterService, S
135135
clusterService.addListener(this);
136136
}
137137

138+
// The constructor of UpdateSnapshotStatusAction will register itself to the TransportService.
139+
this.updateSnapshotStatusHandler = new UpdateSnapshotStatusAction(settings, UPDATE_SNAPSHOT_STATUS_ACTION_NAME,
140+
transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver);
141+
138142
if (DiscoveryNode.isMasterNode(settings)) {
139143
// This needs to run only on nodes that can become masters
140144
transportService.registerRequestHandler(UPDATE_SNAPSHOT_STATUS_ACTION_NAME_V6, UpdateSnapshotStatusRequestV6::new, ThreadPool.Names.SAME, new UpdateSnapshotStateRequestHandlerV6());
141-
// The constructor of UpdateSnapshotStatusAction will register itself to the TransportService.
142-
this.updateSnapshotStatusHandler = new UpdateSnapshotStatusAction(settings, UPDATE_SNAPSHOT_STATUS_ACTION_NAME,
143-
transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver);
144145
}
145146

146147
}
147148

148149
@Override
149150
protected void doStart() {
151+
assert this.updateSnapshotStatusHandler != null;
152+
assert transportService.getRequestHandler(UPDATE_SNAPSHOT_STATUS_ACTION_NAME) != null;
150153
if (DiscoveryNode.isMasterNode(settings)) {
151-
assert this.updateSnapshotStatusHandler != null;
152154
assert transportService.getRequestHandler(UPDATE_SNAPSHOT_STATUS_ACTION_NAME_V6) != null;
153-
assert transportService.getRequestHandler(UPDATE_SNAPSHOT_STATUS_ACTION_NAME) != null;
154155
}
155156
}
156157

@@ -530,7 +531,7 @@ public void updateIndexShardSnapshotStatus(Snapshot snapshot, ShardId shardId, S
530531
try {
531532
if (master.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
532533
UpdateIndexShardSnapshotStatusRequest request = new UpdateIndexShardSnapshotStatusRequest(snapshot, shardId, status);
533-
transportService.sendRequest(master, UPDATE_SNAPSHOT_STATUS_ACTION_NAME, request, EmptyTransportResponseHandler.INSTANCE_SAME);
534+
transportService.sendRequest(transportService.getLocalNode(), UPDATE_SNAPSHOT_STATUS_ACTION_NAME, request, EmptyTransportResponseHandler.INSTANCE_SAME);
534535
} else {
535536
UpdateSnapshotStatusRequestV6 requestV6 = new UpdateSnapshotStatusRequestV6(snapshot, shardId, status);
536537
transportService.sendRequest(master, UPDATE_SNAPSHOT_STATUS_ACTION_NAME_V6, requestV6, EmptyTransportResponseHandler.INSTANCE_SAME);

0 commit comments

Comments
 (0)