Skip to content

Commit 30cc3b5

Browse files
committed
Handle BwC in TransportGetBasicStatusAction
We need to register a request handler for TransportGetBasicStatusAction and make it possible for requests to be read from transport layer in order to support old versions sending GetBasicStatusRequest to us.
1 parent 605e9c7 commit 30cc3b5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/license/GetBasicStatusRequest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@
77
package org.elasticsearch.license;
88

99
import org.elasticsearch.action.support.local.LocalClusterStateRequest;
10+
import org.elasticsearch.common.io.stream.StreamInput;
1011
import org.elasticsearch.core.TimeValue;
12+
import org.elasticsearch.core.UpdateForV10;
13+
14+
import java.io.IOException;
1115

1216
public class GetBasicStatusRequest extends LocalClusterStateRequest {
1317

1418
public GetBasicStatusRequest(TimeValue masterNodeTimeout) {
1519
super(masterNodeTimeout);
1620
}
21+
22+
/**
23+
* Prior to 9.3 TransportGetBasicStatusAction was a TransportMasterNodeReadAction so for BwC we need to be
24+
* able to read this from the transport layer until we no longer need to support calling this action remotely.
25+
*/
26+
@UpdateForV10(owner = UpdateForV10.Owner.DISTRIBUTED_COORDINATION)
27+
public GetBasicStatusRequest(StreamInput in) throws IOException {
28+
super(in);
29+
}
1730
}

x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportGetBasicStatusAction.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,39 @@
99
import org.elasticsearch.action.ActionListener;
1010
import org.elasticsearch.action.ActionType;
1111
import org.elasticsearch.action.support.ActionFilters;
12+
import org.elasticsearch.action.support.ChannelActionListener;
1213
import org.elasticsearch.action.support.local.TransportLocalClusterStateAction;
1314
import org.elasticsearch.cluster.ClusterState;
1415
import org.elasticsearch.cluster.block.ClusterBlockException;
1516
import org.elasticsearch.cluster.block.ClusterBlockLevel;
1617
import org.elasticsearch.cluster.service.ClusterService;
1718
import org.elasticsearch.common.util.concurrent.EsExecutors;
19+
import org.elasticsearch.core.UpdateForV10;
1820
import org.elasticsearch.injection.guice.Inject;
1921
import org.elasticsearch.tasks.Task;
2022
import org.elasticsearch.transport.TransportService;
2123

2224
public class TransportGetBasicStatusAction extends TransportLocalClusterStateAction<GetBasicStatusRequest, GetBasicStatusResponse> {
2325
public static final ActionType<GetBasicStatusResponse> TYPE = new ActionType<>("cluster:admin/xpack/license/basic_status");
2426

27+
/**
28+
* Prior to 9.3 this was a TransportMasterNodeReadAction so for BwC it must be registered with the TransportService until
29+
* we no longer need to support calling this action remotely.
30+
*/
31+
@UpdateForV10(owner = UpdateForV10.Owner.DISTRIBUTED_COORDINATION)
32+
@SuppressWarnings("this-escape")
2533
@Inject
2634
public TransportGetBasicStatusAction(TransportService transportService, ClusterService clusterService, ActionFilters actionFilters) {
2735
super(TYPE.name(), actionFilters, transportService.getTaskManager(), clusterService, EsExecutors.DIRECT_EXECUTOR_SERVICE);
36+
37+
transportService.registerRequestHandler(
38+
actionName,
39+
executor,
40+
false,
41+
true,
42+
GetBasicStatusRequest::new,
43+
(request, channel, task) -> executeDirect(task, request, new ChannelActionListener<>(channel))
44+
);
2845
}
2946

3047
@Override

0 commit comments

Comments
 (0)