Skip to content

Commit a6f56d5

Browse files
committed
Fix CCR API specification (#34963)
This commit fixes two issues with the CCR API specification: - remove the CCR stats endpoint, it is not currently implemented - fix the documentation links
1 parent 1d47d60 commit a6f56d5

File tree

19 files changed

+83
-53
lines changed

19 files changed

+83
-53
lines changed

docs/reference/ccr/apis/ccr-apis.asciidoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
You can use the following APIs to perform {ccr} operations.
77

8+
[float]
9+
[[ccr-api-top-level]]
10+
=== Top-Level
11+
12+
* <<ccr-get-stats,Get {ccr} stats>>
13+
814
[float]
915
[[ccr-api-follow]]
1016
=== Follow
@@ -23,6 +29,9 @@ You can use the following APIs to perform {ccr} operations.
2329
* <<ccr-delete-auto-follow-pattern,Delete auto-follow pattern>>
2430
* <<ccr-get-auto-follow-pattern,Get auto-follow patterns>>
2531

32+
// top-level
33+
include::get-ccr-stats.asciidoc[]
34+
2635
// follow
2736
include::follow/put-follow.asciidoc[]
2837
include::follow/post-pause-follow.asciidoc[]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[role="xpack"]
2+
[testenv="platinum"]
3+
[[ccr-get-stats]]
4+
=== Get Cross-Cluster Replication Stats API
5+
++++
6+
<titleabbrev>Get Follower Stats</titleabbrev>
7+
++++
8+
9+
Get {ccr} stats.
10+
11+
==== Description
12+
13+
This API gets {ccr} stats.
14+
15+
==== Request
16+
17+
[source,js]
18+
--------------------------------------------------
19+
GET /_ccr/stats
20+
--------------------------------------------------
21+
// CONSOLE

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
import org.elasticsearch.xpack.ccr.action.TransportUnfollowAction;
4545
import org.elasticsearch.xpack.ccr.rest.RestGetAutoFollowPatternAction;
4646
import org.elasticsearch.xpack.ccr.action.TransportStatsAction;
47-
import org.elasticsearch.xpack.ccr.rest.RestAutoFollowStatsAction;
47+
import org.elasticsearch.xpack.ccr.rest.RestCcrStatsAction;
4848
import org.elasticsearch.xpack.ccr.rest.RestUnfollowAction;
49-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
49+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
5050
import org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction;
5151
import org.elasticsearch.xpack.core.ccr.action.GetAutoFollowPatternAction;
5252
import org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction;
@@ -170,7 +170,7 @@ public List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(ClusterServic
170170
new ActionHandler<>(ShardChangesAction.INSTANCE, ShardChangesAction.TransportAction.class),
171171
// stats action
172172
new ActionHandler<>(FollowStatsAction.INSTANCE, TransportFollowStatsAction.class),
173-
new ActionHandler<>(StatsAction.INSTANCE, TransportStatsAction.class),
173+
new ActionHandler<>(CcrStatsAction.INSTANCE, TransportStatsAction.class),
174174
// follow actions
175175
new ActionHandler<>(PutFollowAction.INSTANCE, TransportPutFollowAction.class),
176176
new ActionHandler<>(ResumeFollowAction.INSTANCE, TransportResumeFollowAction.class),
@@ -193,7 +193,7 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
193193
return Arrays.asList(
194194
// stats API
195195
new RestFollowStatsAction(settings, restController),
196-
new RestAutoFollowStatsAction(settings, restController),
196+
new RestCcrStatsAction(settings, restController),
197197
// follow APIs
198198
new RestPutFollowAction(settings, restController),
199199
new RestResumeFollowAction(settings, restController),

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportStatsAction.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
import org.elasticsearch.xpack.ccr.CcrLicenseChecker;
2727
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
2828
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
29-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
29+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
3030

3131
import java.util.Objects;
3232

33-
public class TransportStatsAction extends TransportMasterNodeAction<StatsAction.Request, StatsAction.Response> {
33+
public class TransportStatsAction extends TransportMasterNodeAction<CcrStatsAction.Request, CcrStatsAction.Response> {
3434

3535
private final Client client;
3636
private final CcrLicenseChecker ccrLicenseChecker;
@@ -50,13 +50,13 @@ public TransportStatsAction(
5050
) {
5151
super(
5252
settings,
53-
StatsAction.NAME,
53+
CcrStatsAction.NAME,
5454
transportService,
5555
clusterService,
5656
threadPool,
5757
actionFilters,
5858
indexNameExpressionResolver,
59-
StatsAction.Request::new
59+
CcrStatsAction.Request::new
6060
);
6161
this.client = client;
6262
this.ccrLicenseChecker = Objects.requireNonNull(ccrLicenseChecker);
@@ -69,12 +69,12 @@ protected String executor() {
6969
}
7070

7171
@Override
72-
protected StatsAction.Response newResponse() {
73-
return new StatsAction.Response();
72+
protected CcrStatsAction.Response newResponse() {
73+
return new CcrStatsAction.Response();
7474
}
7575

7676
@Override
77-
protected void doExecute(Task task, StatsAction.Request request, ActionListener<StatsAction.Response> listener) {
77+
protected void doExecute(Task task, CcrStatsAction.Request request, ActionListener<CcrStatsAction.Response> listener) {
7878
if (ccrLicenseChecker.isCcrAllowed() == false) {
7979
listener.onFailure(LicenseUtils.newComplianceException("ccr"));
8080
return;
@@ -84,20 +84,20 @@ protected void doExecute(Task task, StatsAction.Request request, ActionListener<
8484

8585
@Override
8686
protected void masterOperation(
87-
StatsAction.Request request,
87+
CcrStatsAction.Request request,
8888
ClusterState state,
89-
ActionListener<StatsAction.Response> listener
89+
ActionListener<CcrStatsAction.Response> listener
9090
) throws Exception {
9191
CheckedConsumer<FollowStatsAction.StatsResponses, Exception> handler = statsResponse -> {
9292
AutoFollowStats stats = autoFollowCoordinator.getStats();
93-
listener.onResponse(new StatsAction.Response(stats, statsResponse));
93+
listener.onResponse(new CcrStatsAction.Response(stats, statsResponse));
9494
};
9595
FollowStatsAction.StatsRequest statsRequest = new FollowStatsAction.StatsRequest();
9696
client.execute(FollowStatsAction.INSTANCE, statsRequest, ActionListener.wrap(handler, listener::onFailure));
9797
}
9898

9999
@Override
100-
protected ClusterBlockException checkBlock(StatsAction.Request request, ClusterState state) {
100+
protected ClusterBlockException checkBlock(CcrStatsAction.Request request, ClusterState state) {
101101
return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ);
102102
}
103103
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
import org.elasticsearch.rest.RestController;
1313
import org.elasticsearch.rest.RestRequest;
1414
import org.elasticsearch.rest.action.RestToXContentListener;
15-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
15+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
1616

1717
import java.io.IOException;
1818

19-
public class RestAutoFollowStatsAction extends BaseRestHandler {
19+
public class RestCcrStatsAction extends BaseRestHandler {
2020

21-
public RestAutoFollowStatsAction(final Settings settings, final RestController controller) {
21+
public RestCcrStatsAction(final Settings settings, final RestController controller) {
2222
super(settings);
2323
controller.registerHandler(RestRequest.Method.GET, "/_ccr/stats", this);
2424
}
@@ -30,8 +30,8 @@ public String getName() {
3030

3131
@Override
3232
protected RestChannelConsumer prepareRequest(final RestRequest restRequest, final NodeClient client) throws IOException {
33-
final StatsAction.Request request = new StatsAction.Request();
34-
return channel -> client.execute(StatsAction.INSTANCE, request, new RestToXContentListener<>(channel));
33+
final CcrStatsAction.Request request = new CcrStatsAction.Request();
34+
return channel -> client.execute(CcrStatsAction.INSTANCE, request, new RestToXContentListener<>(channel));
3535
}
3636

3737
}

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.elasticsearch.xpack.CcrIntegTestCase;
2020
import org.elasticsearch.xpack.ccr.action.ShardFollowTask;
2121
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
22-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
22+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
2323
import org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction;
2424
import org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction;
2525

@@ -260,8 +260,8 @@ private void deleteAutoFollowPatternSetting() {
260260
}
261261

262262
private AutoFollowStats getAutoFollowStats() {
263-
StatsAction.Request request = new StatsAction.Request();
264-
return followerClient().execute(StatsAction.INSTANCE, request).actionGet().getAutoFollowStats();
263+
CcrStatsAction.Request request = new CcrStatsAction.Request();
264+
return followerClient().execute(CcrStatsAction.INSTANCE, request).actionGet().getAutoFollowStats();
265265
}
266266

267267
private void createLeaderIndex(String index, Settings settings) {

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowStatsResponseTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@
88
import org.elasticsearch.test.AbstractStreamableTestCase;
99
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
1010
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
11-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
11+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
1212

1313
import static org.elasticsearch.xpack.ccr.action.AutoFollowStatsTests.randomReadExceptions;
1414
import static org.elasticsearch.xpack.ccr.action.StatsResponsesTests.createStatsResponse;
1515

16-
public class AutoFollowStatsResponseTests extends AbstractStreamableTestCase<StatsAction.Response> {
16+
public class AutoFollowStatsResponseTests extends AbstractStreamableTestCase<CcrStatsAction.Response> {
1717

1818
@Override
19-
protected StatsAction.Response createBlankInstance() {
20-
return new StatsAction.Response();
19+
protected CcrStatsAction.Response createBlankInstance() {
20+
return new CcrStatsAction.Response();
2121
}
2222

2323
@Override
24-
protected StatsAction.Response createTestInstance() {
24+
protected CcrStatsAction.Response createTestInstance() {
2525
AutoFollowStats autoFollowStats = new AutoFollowStats(
2626
randomNonNegativeLong(),
2727
randomNonNegativeLong(),
2828
randomNonNegativeLong(),
2929
randomReadExceptions()
3030
);
3131
FollowStatsAction.StatsResponses statsResponse = createStatsResponse();
32-
return new StatsAction.Response(autoFollowStats, statsResponse);
32+
return new CcrStatsAction.Response(autoFollowStats, statsResponse);
3333
}
3434
}

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/StatsCollectorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
1717
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
1818
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
19-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
19+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
2020
import org.elasticsearch.xpack.core.ccr.client.CcrClient;
2121
import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
2222
import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringDoc;
@@ -139,8 +139,8 @@ public void testDoCollect() throws Exception {
139139
when(statsResponse.getStatsResponses()).thenReturn(statuses);
140140

141141
@SuppressWarnings("unchecked")
142-
final ActionFuture<StatsAction.Response> future = (ActionFuture<StatsAction.Response>) mock(ActionFuture.class);
143-
final StatsAction.Response response = new StatsAction.Response(autoFollowStats, statsResponse);
142+
final ActionFuture<CcrStatsAction.Response> future = (ActionFuture<CcrStatsAction.Response>) mock(ActionFuture.class);
143+
final CcrStatsAction.Response response = new CcrStatsAction.Response(autoFollowStats, statsResponse);
144144

145145
when(client.stats(any())).thenReturn(future);
146146
when(future.actionGet(timeout)).thenReturn(response);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/StatsAction.java renamed to x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/CcrStatsAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
import java.io.IOException;
2222
import java.util.Objects;
2323

24-
public class StatsAction extends Action<StatsAction.Request, StatsAction.Response, StatsAction.RequestBuilder> {
24+
public class CcrStatsAction extends Action<CcrStatsAction.Request, CcrStatsAction.Response, CcrStatsAction.RequestBuilder> {
2525

2626
public static final String NAME = "cluster:monitor/ccr/stats";
27-
public static final StatsAction INSTANCE = new StatsAction();
27+
public static final CcrStatsAction INSTANCE = new CcrStatsAction();
2828

29-
private StatsAction() {
29+
private CcrStatsAction() {
3030
super(NAME);
3131
}
3232

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/client/CcrClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.elasticsearch.action.support.PlainActionFuture;
1212
import org.elasticsearch.action.support.master.AcknowledgedResponse;
1313
import org.elasticsearch.client.ElasticsearchClient;
14-
import org.elasticsearch.xpack.core.ccr.action.StatsAction;
14+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
1515
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
1616
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
1717
import org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction;
@@ -65,13 +65,13 @@ public ActionFuture<FollowStatsAction.StatsResponses> followStats(final FollowSt
6565
return listener;
6666
}
6767

68-
public void stats(final StatsAction.Request request,
69-
final ActionListener<StatsAction.Response> listener) {
70-
client.execute(StatsAction.INSTANCE, request, listener);
68+
public void stats(final CcrStatsAction.Request request,
69+
final ActionListener<CcrStatsAction.Response> listener) {
70+
client.execute(CcrStatsAction.INSTANCE, request, listener);
7171
}
7272

73-
public ActionFuture<StatsAction.Response> stats(final StatsAction.Request request) {
74-
final PlainActionFuture<StatsAction.Response> listener = PlainActionFuture.newFuture();
73+
public ActionFuture<CcrStatsAction.Response> stats(final CcrStatsAction.Request request) {
74+
final PlainActionFuture<CcrStatsAction.Response> listener = PlainActionFuture.newFuture();
7575
stats(request, listener);
7676
return listener;
7777
}

0 commit comments

Comments
 (0)