Skip to content

Commit bad5972

Browse files
authored
[CCR] Fix request serialization bug (#34917)
and some parameters that were not set in tests.
1 parent 9c27b40 commit bad5972

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

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
@@ -137,9 +137,6 @@ public void testAutoFollowParameterAreDelegated() throws Exception {
137137
if (randomBoolean()) {
138138
request.setMaxReadRequestOperationCount(randomIntBetween(0, Integer.MAX_VALUE));
139139
}
140-
if (randomBoolean()) {
141-
request.setMaxWriteBufferSize(new ByteSizeValue(randomNonNegativeLong()));
142-
}
143140
if (randomBoolean()) {
144141
request.setMaxReadRequestSize(new ByteSizeValue(randomNonNegativeLong(), ByteSizeUnit.BYTES));
145142
}
@@ -155,6 +152,9 @@ public void testAutoFollowParameterAreDelegated() throws Exception {
155152
if (randomBoolean()) {
156153
request.setMaxWriteBufferSize(new ByteSizeValue(randomNonNegativeLong(), ByteSizeUnit.BYTES));
157154
}
155+
if (randomBoolean()) {
156+
request.setMaxWriteRequestSize(new ByteSizeValue(randomNonNegativeLong()));
157+
}
158158
assertTrue(followerClient().execute(PutAutoFollowPatternAction.INSTANCE, request).actionGet().isAcknowledged());
159159

160160
createLeaderIndex("logs-201901", leaderIndexSettings);

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ protected PutAutoFollowPatternAction.Request createTestInstance() {
5353
if (randomBoolean()) {
5454
request.setMaxRetryDelay(TimeValue.timeValueMillis(500));
5555
}
56+
if (randomBoolean()) {
57+
request.setMaxWriteRequestOperationCount(randomIntBetween(0, Integer.MAX_VALUE));
58+
}
59+
if (randomBoolean()) {
60+
request.setMaxWriteBufferSize(new ByteSizeValue(randomNonNegativeLong()));
61+
}
62+
if (randomBoolean()) {
63+
request.setMaxWriteRequestSize(new ByteSizeValue(randomNonNegativeLong()));
64+
}
5665
if (randomBoolean()) {
5766
request.setMaxReadRequestOperationCount(randomIntBetween(0, Integer.MAX_VALUE));
5867
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ static ResumeFollowAction.Request createTestRequest() {
5959
if (randomBoolean()) {
6060
request.setMaxWriteBufferCount(randomIntBetween(1, Integer.MAX_VALUE));
6161
}
62+
if (randomBoolean()) {
63+
request.setMaxWriteRequestOperationCount(randomIntBetween(1, Integer.MAX_VALUE));
64+
}
65+
if (randomBoolean()) {
66+
request.setMaxWriteRequestSize(new ByteSizeValue(randomNonNegativeLong()));
67+
}
6268
if (randomBoolean()) {
6369
request.setMaxWriteBufferSize(new ByteSizeValue(randomNonNegativeLong(), ByteSizeUnit.BYTES));
6470
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ public void readFrom(final StreamInput in) throws IOException {
266266
maxReadRequestOperationCount = in.readOptionalVInt();
267267
maxOutstandingReadRequests = in.readOptionalVInt();
268268
maxReadRequestSize = in.readOptionalWriteable(ByteSizeValue::new);
269+
maxWriteRequestOperationCount = in.readOptionalVInt();
270+
maxWriteRequestSize = in.readOptionalWriteable(ByteSizeValue::new);
269271
maxOutstandingWriteRequests = in.readOptionalVInt();
270272
maxWriteBufferCount = in.readOptionalVInt();
271273
maxWriteBufferSize = in.readOptionalWriteable(ByteSizeValue::new);
@@ -280,6 +282,8 @@ public void writeTo(final StreamOutput out) throws IOException {
280282
out.writeOptionalVInt(maxReadRequestOperationCount);
281283
out.writeOptionalVInt(maxOutstandingReadRequests);
282284
out.writeOptionalWriteable(maxReadRequestSize);
285+
out.writeOptionalVInt(maxWriteRequestOperationCount);
286+
out.writeOptionalWriteable(maxWriteRequestSize);
283287
out.writeOptionalVInt(maxOutstandingWriteRequests);
284288
out.writeOptionalVInt(maxWriteBufferCount);
285289
out.writeOptionalWriteable(maxWriteBufferSize);

0 commit comments

Comments
 (0)