Skip to content

Commit

Permalink
Remove version constant
Browse files Browse the repository at this point in the history
Signed-off-by: Liyun Xiu <[email protected]>
  • Loading branch information
chishui committed Apr 30, 2024
1 parent 68cabe1 commit 3cc7f41
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public class BulkRequest extends ActionRequest implements CompositeIndicesReques
private static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(BulkRequest.class);

private static final int REQUEST_OVERHEAD = 50;
private static final Version MINIMAL_VERSION_SUPPORT_BATCH = Version.V_2_14_0;
/**
* Requests that are part of this request. It is only possible to add things that are both {@link ActionRequest}s and
* {@link WriteRequest}s to this but java doesn't support syntax to declare that everything in the array has both types so we declare
Expand Down Expand Up @@ -109,7 +108,7 @@ public BulkRequest(StreamInput in) throws IOException {
requests.addAll(in.readList(i -> DocWriteRequest.readDocumentRequest(null, i)));
refreshPolicy = RefreshPolicy.readFrom(in);
timeout = in.readTimeValue();
if (in.getVersion().onOrAfter(MINIMAL_VERSION_SUPPORT_BATCH)) {
if (in.getVersion().onOrAfter(Version.V_2_14_0)) {
batchSize = in.readInt();

Check warning on line 112 in server/src/main/java/org/opensearch/action/bulk/BulkRequest.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/action/bulk/BulkRequest.java#L112

Added line #L112 was not covered by tests
}
}
Expand Down Expand Up @@ -358,7 +357,7 @@ public final BulkRequest timeout(TimeValue timeout) {
*/
public BulkRequest batchSize(int size) {
if (size < 1) {
throw new IllegalArgumentException("batch_size must be larger than 0");
throw new IllegalArgumentException("batch_size must be greater than 0");

Check warning on line 360 in server/src/main/java/org/opensearch/action/bulk/BulkRequest.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/action/bulk/BulkRequest.java#L360

Added line #L360 was not covered by tests
}
this.batchSize = size;
return this;
Expand Down

0 comments on commit 3cc7f41

Please sign in to comment.