-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed CCR stats api serialization issues and (#33983)
always use `IndicesOptions.strictExpand()` for indices options. The follow index may be closed and we still want to get stats from shard follow task and the whether the provided index name matches with follow index name is checked when locating the task itself in the ccr stats transport action.
- Loading branch information
Showing
5 changed files
with
141 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsRequestTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ccr.action; | ||
|
||
import org.elasticsearch.test.AbstractStreamableTestCase; | ||
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; | ||
|
||
public class StatsRequestTests extends AbstractStreamableTestCase<CcrStatsAction.StatsRequest> { | ||
|
||
@Override | ||
protected CcrStatsAction.StatsRequest createBlankInstance() { | ||
return new CcrStatsAction.StatsRequest(); | ||
} | ||
|
||
@Override | ||
protected CcrStatsAction.StatsRequest createTestInstance() { | ||
CcrStatsAction.StatsRequest statsRequest = new CcrStatsAction.StatsRequest(); | ||
if (randomBoolean()) { | ||
statsRequest.setIndices(generateRandomStringArray(8, 4, false)); | ||
} | ||
return statsRequest; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsResponsesTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ccr.action; | ||
|
||
import org.elasticsearch.test.AbstractStreamableTestCase; | ||
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus; | ||
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class StatsResponsesTests extends AbstractStreamableTestCase<CcrStatsAction.StatsResponses> { | ||
|
||
@Override | ||
protected CcrStatsAction.StatsResponses createBlankInstance() { | ||
return new CcrStatsAction.StatsResponses(); | ||
} | ||
|
||
@Override | ||
protected CcrStatsAction.StatsResponses createTestInstance() { | ||
int numResponses = randomIntBetween(0, 8); | ||
List<CcrStatsAction.StatsResponse> responses = new ArrayList<>(numResponses); | ||
for (int i = 0; i < numResponses; i++) { | ||
ShardFollowNodeTaskStatus status = new ShardFollowNodeTaskStatus( | ||
randomAlphaOfLength(4), | ||
randomAlphaOfLength(4), | ||
randomInt(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomIntBetween(0, Integer.MAX_VALUE), | ||
randomIntBetween(0, Integer.MAX_VALUE), | ||
randomIntBetween(0, Integer.MAX_VALUE), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
randomNonNegativeLong(), | ||
Collections.emptyNavigableMap(), | ||
randomLong()); | ||
responses.add(new CcrStatsAction.StatsResponse(status)); | ||
} | ||
return new CcrStatsAction.StatsResponses(Collections.emptyList(), Collections.emptyList(), responses); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters