-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase concurrent request of opening point-in-time #96782
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a9e778c
Increase the throttle of opening point-in-time
dnhatn 640d334
Update docs/changelog/96782.yaml
dnhatn 636b617
Merge remote-tracking branch 'elastic/main' into point-in-time
dnhatn 7fd3057
Merge remote-tracking branch 'dnhatn/point-in-time' into point-in-time
dnhatn 4f7c7f8
Merge remote-tracking branch 'elastic/main' into point-in-time
dnhatn ae86f51
Add params
dnhatn e7928d5
Fix version
dnhatn 825fc84
Merge branch 'main' into point-in-time
dnhatn a252899
Share the default with search request
dnhatn fa08bf6
Merge remote-tracking branch 'elastic/main' into point-in-time
dnhatn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 96782 | ||
summary: Increase concurrent request of opening point-in-time | ||
area: Search | ||
type: bug | ||
issues: [] |
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
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
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
111 changes: 111 additions & 0 deletions
111
server/src/test/java/org/elasticsearch/action/search/OpenPointInTimeRequestTests.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,111 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.action.search; | ||
|
||
import org.elasticsearch.TransportVersion; | ||
import org.elasticsearch.common.io.stream.BytesStreamOutput; | ||
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; | ||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.Writeable; | ||
import org.elasticsearch.core.TimeValue; | ||
import org.elasticsearch.test.AbstractWireSerializingTestCase; | ||
import org.elasticsearch.test.TransportVersionUtils; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class OpenPointInTimeRequestTests extends AbstractWireSerializingTestCase<OpenPointInTimeRequest> { | ||
@Override | ||
protected Writeable.Reader<OpenPointInTimeRequest> instanceReader() { | ||
return OpenPointInTimeRequest::new; | ||
} | ||
|
||
@Override | ||
protected OpenPointInTimeRequest createTestInstance() { | ||
OpenPointInTimeRequest request = new OpenPointInTimeRequest("index-1", "index-2"); | ||
request.keepAlive(TimeValue.timeValueSeconds(randomIntBetween(1, 1000))); | ||
if (randomBoolean()) { | ||
request.maxConcurrentShardRequests(randomIntBetween(1, 10)); | ||
} else { | ||
assertThat(request.maxConcurrentShardRequests(), equalTo(5)); | ||
} | ||
if (randomBoolean()) { | ||
request.preference(randomAlphaOfLength(10)); | ||
} | ||
if (randomBoolean()) { | ||
request.routing(randomAlphaOfLength(10)); | ||
} | ||
return request; | ||
} | ||
|
||
@Override | ||
protected OpenPointInTimeRequest mutateInstance(OpenPointInTimeRequest in) throws IOException { | ||
return switch (between(0, 4)) { | ||
case 0 -> { | ||
OpenPointInTimeRequest request = new OpenPointInTimeRequest("new-index"); | ||
request.maxConcurrentShardRequests(in.maxConcurrentShardRequests()); | ||
request.keepAlive(in.keepAlive()); | ||
request.preference(in.preference()); | ||
request.routing(in.routing()); | ||
yield request; | ||
} | ||
case 1 -> { | ||
OpenPointInTimeRequest request = new OpenPointInTimeRequest(in.indices()); | ||
request.maxConcurrentShardRequests(in.maxConcurrentShardRequests() + between(1, 10)); | ||
request.keepAlive(in.keepAlive()); | ||
request.preference(in.preference()); | ||
request.routing(in.routing()); | ||
yield request; | ||
} | ||
case 2 -> { | ||
OpenPointInTimeRequest request = new OpenPointInTimeRequest(in.indices()); | ||
request.maxConcurrentShardRequests(in.maxConcurrentShardRequests()); | ||
request.keepAlive(TimeValue.timeValueSeconds(between(2000, 5000))); | ||
request.preference(in.preference()); | ||
request.routing(in.routing()); | ||
yield request; | ||
} | ||
case 3 -> { | ||
OpenPointInTimeRequest request = new OpenPointInTimeRequest(in.indices()); | ||
request.maxConcurrentShardRequests(in.maxConcurrentShardRequests()); | ||
request.keepAlive(in.keepAlive()); | ||
request.preference(randomAlphaOfLength(5)); | ||
request.routing(in.routing()); | ||
yield request; | ||
} | ||
case 4 -> { | ||
OpenPointInTimeRequest request = new OpenPointInTimeRequest(in.indices()); | ||
request.maxConcurrentShardRequests(in.maxConcurrentShardRequests()); | ||
request.keepAlive(in.keepAlive()); | ||
request.preference(in.preference()); | ||
request.routing(randomAlphaOfLength(5)); | ||
yield request; | ||
} | ||
default -> throw new AssertionError("Unknown option"); | ||
}; | ||
} | ||
|
||
public void testUseDefaultConcurrentForOldVersion() throws Exception { | ||
TransportVersion previousVersion = TransportVersionUtils.getPreviousVersion(TransportVersion.V_8_500_017); | ||
try (BytesStreamOutput output = new BytesStreamOutput()) { | ||
TransportVersion version = TransportVersionUtils.randomVersionBetween(random(), TransportVersion.V_8_0_0, previousVersion); | ||
output.setTransportVersion(version); | ||
OpenPointInTimeRequest original = createTestInstance(); | ||
original.writeTo(output); | ||
try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), new NamedWriteableRegistry(List.of()))) { | ||
in.setTransportVersion(version); | ||
OpenPointInTimeRequest copy = new OpenPointInTimeRequest(in); | ||
assertThat(copy.maxConcurrentShardRequests(), equalTo(5)); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shall we link to the default constant for the same parameter in search, given the two have the same default value for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I pushed a252899.