Skip to content

Commit 0a551a2

Browse files
committed
jason feedback
1 parent e79c8f3 commit 0a551a2

9 files changed

+30
-49
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected AutoFollowMetadata createTestInstance() {
4444
randomAlphaOfLength(4),
4545
leaderPatterns,
4646
randomAlphaOfLength(4),
47-
randomIntBetween(0, Integer.MAX_VALUE),
47+
true, randomIntBetween(0, Integer.MAX_VALUE),
4848
randomIntBetween(0, Integer.MAX_VALUE),
4949
randomIntBetween(0, Integer.MAX_VALUE),
5050
randomIntBetween(0, Integer.MAX_VALUE),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void testUsageStats() throws Exception {
9797
Map<String, AutoFollowMetadata.AutoFollowPattern> patterns = new HashMap<>(numAutoFollowPatterns);
9898
for (int i = 0; i < numAutoFollowPatterns; i++) {
9999
AutoFollowMetadata.AutoFollowPattern pattern = new AutoFollowMetadata.AutoFollowPattern("remote_cluser",
100-
Collections.singletonList("logs" + i + "*"), null, null, null, null, null, null, null, null, null, null, null);
100+
Collections.singletonList("logs" + i + "*"), null, true, null, null, null, null, null, null, null, null, null, null);
101101
patterns.put("pattern" + i, pattern);
102102
}
103103
metaData.putCustom(AutoFollowMetadata.TYPE, new AutoFollowMetadata(patterns, Collections.emptyMap(), Collections.emptyMap()));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void testAutoFollowCoordinatorLogsSkippingAutoFollowCoordinationWithNonCo
165165
@Override
166166
public ClusterState execute(ClusterState currentState) throws Exception {
167167
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("test_alias", Collections.singletonList("logs-*"),
168-
null, null, null, null, null, null, null, null, null, null, null);
168+
null, true, null, null, null, null, null, null, null, null, null, null);
169169
AutoFollowMetadata autoFollowMetadata = new AutoFollowMetadata(
170170
Collections.singletonMap("test_alias", autoFollowPattern),
171171
Collections.emptyMap(),

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void testAutoFollower() {
8686
ClusterState remoteState = createRemoteClusterState("logs-20190101", true);
8787

8888
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
89-
null, null, null, null, null, null, null, null, null, null, null);
89+
null, true, null, null, null, null, null, null, null, null, null, null);
9090
Map<String, AutoFollowPattern> patterns = new HashMap<>();
9191
patterns.put("remote", autoFollowPattern);
9292
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -155,7 +155,7 @@ public void testAutoFollowerClusterStateApiFailure() {
155155
when(client.getRemoteClusterClient(anyString())).thenReturn(client);
156156

157157
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
158-
null, null, null, null, null, null, null, null, null, null, null);
158+
null, true, null, null, null, null, null, null, null, null, null, null);
159159
Map<String, AutoFollowPattern> patterns = new HashMap<>();
160160
patterns.put("remote", autoFollowPattern);
161161
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -207,7 +207,7 @@ public void testAutoFollowerUpdateClusterStateFailure() {
207207
ClusterState remoteState = createRemoteClusterState("logs-20190101", true);
208208

209209
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
210-
null, null, null, null, null, null, null, null, null, null, null);
210+
null, true, null, null, null, null, null, null, null, null, null, null);
211211
Map<String, AutoFollowPattern> patterns = new HashMap<>();
212212
patterns.put("remote", autoFollowPattern);
213213
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -483,7 +483,7 @@ public void testAutoFollowerCreateAndFollowApiCallFailure() {
483483
ClusterState remoteState = createRemoteClusterState("logs-20190101", true);
484484

485485
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
486-
null, null, null, null, null, null, null, null, null, null, null);
486+
null, true, null, null, null, null, null, null, null, null, null, null);
487487
Map<String, AutoFollowPattern> patterns = new HashMap<>();
488488
patterns.put("remote", autoFollowPattern);
489489
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -608,7 +608,7 @@ public void testGetLeaderIndicesToFollow() {
608608

609609
public void testGetLeaderIndicesToFollow_shardsNotStarted() {
610610
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("*"),
611-
null, null, null, null, null, null, null, null, null, null, null);
611+
null, true, null, null, null, null, null, null, null, null, null, null);
612612

613613
// 1 shard started and another not started:
614614
ClusterState remoteState = createRemoteClusterState("index1", true);
@@ -755,15 +755,15 @@ public void testCleanFollowedLeaderIndicesNoEntry() {
755755
}
756756

757757
public void testGetFollowerIndexName() {
758-
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("metrics-*"), null, null,
758+
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("metrics-*"), null, true, null,
759759
null, null, null, null, null, null, null, null, null);
760760
assertThat(AutoFollower.getFollowerIndexName(autoFollowPattern, "metrics-0"), equalTo("metrics-0"));
761761

762-
autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("metrics-*"), "eu-metrics-0", null, null,
762+
autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("metrics-*"), "eu-metrics-0", true, null, null,
763763
null, null, null, null, null, null, null, null);
764764
assertThat(AutoFollower.getFollowerIndexName(autoFollowPattern, "metrics-0"), equalTo("eu-metrics-0"));
765765

766-
autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("metrics-*"), "eu-{{leader_index}}", null,
766+
autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("metrics-*"), "eu-{{leader_index}}", true, null,
767767
null, null, null, null, null, null, null, null, null);
768768
assertThat(AutoFollower.getFollowerIndexName(autoFollowPattern, "metrics-0"), equalTo("eu-metrics-0"));
769769
}
@@ -846,11 +846,11 @@ public void testUpdateAutoFollowers() {
846846
Runnable::run);
847847
// Add 3 patterns:
848848
Map<String, AutoFollowPattern> patterns = new HashMap<>();
849-
patterns.put("pattern1", new AutoFollowPattern("remote1", Collections.singletonList("logs-*"), null, null, null,
849+
patterns.put("pattern1", new AutoFollowPattern("remote1", Collections.singletonList("logs-*"), null, true, null, null,
850850
null, null, null, null, null, null, null, null));
851-
patterns.put("pattern2", new AutoFollowPattern("remote2", Collections.singletonList("logs-*"), null, null, null,
851+
patterns.put("pattern2", new AutoFollowPattern("remote2", Collections.singletonList("logs-*"), null, true, null, null,
852852
null, null, null, null, null, null, null, null));
853-
patterns.put("pattern3", new AutoFollowPattern("remote2", Collections.singletonList("metrics-*"), null, null, null,
853+
patterns.put("pattern3", new AutoFollowPattern("remote2", Collections.singletonList("metrics-*"), null, true, null, null,
854854
null, null, null, null, null, null, null, null));
855855
ClusterState clusterState = ClusterState.builder(new ClusterName("remote"))
856856
.metaData(MetaData.builder().putCustom(AutoFollowMetadata.TYPE,
@@ -876,7 +876,7 @@ public void testUpdateAutoFollowers() {
876876
assertThat(autoFollowCoordinator.getStats().getAutoFollowedClusters().get("remote2"), notNullValue());
877877
assertThat(removedAutoFollower1.removed, is(true));
878878
// Add pattern 4:
879-
patterns.put("pattern4", new AutoFollowPattern("remote1", Collections.singletonList("metrics-*"), null, null, null,
879+
patterns.put("pattern4", new AutoFollowPattern("remote1", Collections.singletonList("metrics-*"), null, true, null, null,
880880
null, null, null, null, null, null, null, null));
881881
clusterState = ClusterState.builder(new ClusterName("remote"))
882882
.metaData(MetaData.builder().putCustom(AutoFollowMetadata.TYPE,
@@ -1029,7 +1029,7 @@ public void testWaitForMetadataVersion() {
10291029
when(client.getRemoteClusterClient(anyString())).thenReturn(client);
10301030

10311031
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
1032-
null, null, null, null, null, null, null, null, null, null, null);
1032+
null, true, null, null, null, null, null, null, null, null, null, null);
10331033
Map<String, AutoFollowPattern> patterns = new HashMap<>();
10341034
patterns.put("remote", autoFollowPattern);
10351035
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -1092,7 +1092,7 @@ public void testWaitForTimeOut() {
10921092
when(client.getRemoteClusterClient(anyString())).thenReturn(client);
10931093

10941094
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
1095-
null, null, null, null, null, null, null, null, null, null, null);
1095+
null, true, null, null, null, null, null, null, null, null, null, null);
10961096
Map<String, AutoFollowPattern> patterns = new HashMap<>();
10971097
patterns.put("remote", autoFollowPattern);
10981098
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -1150,7 +1150,7 @@ public void testAutoFollowerSoftDeletesDisabled() {
11501150
ClusterState remoteState = createRemoteClusterState("logs-20190101", false);
11511151

11521152
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
1153-
null, null, null, null, null, null, null, null, null, null, null);
1153+
null, true, null, null, null, null, null, null, null, null, null, null);
11541154
Map<String, AutoFollowPattern> patterns = new HashMap<>();
11551155
patterns.put("remote", autoFollowPattern);
11561156
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -1216,7 +1216,7 @@ public void testAutoFollowerFollowerIndexAlreadyExists() {
12161216
ClusterState remoteState = createRemoteClusterState("logs-20190101", true);
12171217

12181218
AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"),
1219-
null, null, null, null, null, null, null, null, null, null, null);
1219+
null, true, null, null, null, null, null, null, null, null, null, null);
12201220
Map<String, AutoFollowPattern> patterns = new HashMap<>();
12211221
patterns.put("remote", autoFollowPattern);
12221222
Map<String, List<String>> followedLeaderIndexUUIDS = new HashMap<>();
@@ -1302,7 +1302,7 @@ public void testRepeatedFailures() throws InterruptedException {
13021302
"remote",
13031303
List.of("*"),
13041304
"{}",
1305-
0,
1305+
true, 0,
13061306
0,
13071307
0,
13081308
0,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected GetAutoFollowPatternAction.Response createTestInstance() {
3333
"remote",
3434
Collections.singletonList(randomAlphaOfLength(4)),
3535
randomAlphaOfLength(4),
36-
randomIntBetween(0, Integer.MAX_VALUE),
36+
true, randomIntBetween(0, Integer.MAX_VALUE),
3737
randomIntBetween(0, Integer.MAX_VALUE),
3838
randomIntBetween(0, Integer.MAX_VALUE),
3939
randomIntBetween(0, Integer.MAX_VALUE),

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public void testInnerDelete() {
3232
{
3333
List<String> existingPatterns = new ArrayList<>();
3434
existingPatterns.add("transactions-*");
35-
existingAutoFollowPatterns.put("name1",
36-
new AutoFollowPattern("eu_cluster", existingPatterns, null, null, null, null, null, null, null, null, null, null, null));
35+
existingAutoFollowPatterns.put("name1", new AutoFollowPattern("eu_cluster", existingPatterns, null, true, null, null, null,
36+
null, null, null, null, null, null, null));
3737

3838
List<String> existingUUIDS = new ArrayList<>();
3939
existingUUIDS.add("_val");
@@ -43,8 +43,8 @@ public void testInnerDelete() {
4343
{
4444
List<String> existingPatterns = new ArrayList<>();
4545
existingPatterns.add("logs-*");
46-
existingAutoFollowPatterns.put("name2",
47-
new AutoFollowPattern("asia_cluster", existingPatterns, null, null, null, null, null, null, null, null, null, null, null));
46+
existingAutoFollowPatterns.put("name2", new AutoFollowPattern("asia_cluster", existingPatterns, null, true, null, null, null,
47+
null, null, null, null, null, null, null));
4848

4949
List<String> existingUUIDS = new ArrayList<>();
5050
existingUUIDS.add("_val");
@@ -76,8 +76,8 @@ public void testInnerDeleteDoesNotExist() {
7676
{
7777
List<String> existingPatterns = new ArrayList<>();
7878
existingPatterns.add("transactions-*");
79-
existingAutoFollowPatterns.put("name1",
80-
new AutoFollowPattern("eu_cluster", existingPatterns, null, null, null, null, null, null, null, null, null, null, null));
79+
existingAutoFollowPatterns.put("name1", new AutoFollowPattern("eu_cluster", existingPatterns, null, true, null, null, null,
80+
null, null, null, null, null, null, null));
8181
existingHeaders.put("key", Collections.singletonMap("key", "val"));
8282
}
8383
ClusterState clusterState = ClusterState.builder(new ClusterName("us_cluster"))

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public class TransportGetAutoFollowPatternActionTests extends ESTestCase {
2424
public void testGetAutoFollowPattern() {
2525
Map<String, AutoFollowPattern> patterns = new HashMap<>();
2626
patterns.put("name1", new AutoFollowPattern(
27-
"test_alias1", Collections.singletonList("index-*"), null, null, null, null, null, null, null, null, null, null, null));
27+
"test_alias1", Collections.singletonList("index-*"), null, true, null, null, null, null, null, null, null, null, null, null));
2828
patterns.put("name2", new AutoFollowPattern(
29-
"test_alias1", Collections.singletonList("index-*"), null, null, null, null, null, null, null, null, null, null, null));
29+
"test_alias1", Collections.singletonList("index-*"), null, true, null, null, null, null, null, null, null, null, null, null));
3030
MetaData metaData = MetaData.builder()
3131
.putCustom(AutoFollowMetadata.TYPE, new AutoFollowMetadata(patterns, Collections.emptyMap(), Collections.emptyMap()))
3232
.build();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void testInnerPut_existingLeaderIndicesAndAutoFollowMetadata() {
103103
List<String> existingPatterns = new ArrayList<>();
104104
existingPatterns.add("transactions-*");
105105
existingAutoFollowPatterns.put("name1",
106-
new AutoFollowPattern("eu_cluster", existingPatterns, null, null, null, null, null, null, null, null, null, null, null));
106+
new AutoFollowPattern("eu_cluster", existingPatterns, null, true, null, null, null, null, null, null, null, null, null, null));
107107
Map<String, List<String>> existingAlreadyFollowedIndexUUIDS = new HashMap<>();
108108
List<String> existingUUIDS = new ArrayList<>();
109109
existingUUIDS.add("_val");

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -223,25 +223,6 @@ public AutoFollowPattern(String remoteCluster,
223223
this.active = active;
224224
}
225225

226-
// for testing purpose
227-
public AutoFollowPattern(String remoteCluster,
228-
List<String> leaderIndexPatterns,
229-
String followIndexPattern,
230-
Integer maxReadRequestOperationCount,
231-
Integer maxWriteRequestOperationCount,
232-
Integer maxOutstandingReadRequests,
233-
Integer maxOutstandingWriteRequests,
234-
ByteSizeValue maxReadRequestSize,
235-
ByteSizeValue maxWriteRequestSize,
236-
Integer maxWriteBufferCount,
237-
ByteSizeValue maxWriteBufferSize,
238-
TimeValue maxRetryDelay,
239-
TimeValue pollTimeout) {
240-
this(remoteCluster, leaderIndexPatterns, followIndexPattern, true,
241-
maxReadRequestOperationCount, maxWriteRequestOperationCount, maxOutstandingReadRequests, maxOutstandingWriteRequests,
242-
maxReadRequestSize, maxWriteRequestSize, maxWriteBufferCount, maxWriteBufferSize, maxRetryDelay, pollTimeout);
243-
}
244-
245226
public static AutoFollowPattern readFrom(StreamInput in) throws IOException {
246227
return new AutoFollowPattern(in.readString(), in.readStringList(), in.readOptionalString(), in);
247228
}

0 commit comments

Comments
 (0)