Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,8 @@ private void openRemotePitAndExecute(

/**
* Closes the RestClient on the generic thread pool (to avoid closing from the client's own thread), then runs the given action.
* Package-private for unit tests.
*/
void closeRestClientAndRun(RestClient restClient, Runnable onCompletion) {
private void closeRestClientAndRun(RestClient restClient, Runnable onCompletion) {
threadPool.generic().submit(() -> {
try {
restClient.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodeUtils;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.mapper.IdFieldMapper;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.BulkByScrollTask;
import org.elasticsearch.index.reindex.ReindexAction;
import org.elasticsearch.index.reindex.ReindexRequest;
import org.elasticsearch.search.builder.PointInTimeBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.slice.SliceBuilder;
import org.elasticsearch.tasks.TaskManager;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
Expand All @@ -43,7 +38,6 @@
import static org.elasticsearch.search.RandomSearchRequestGenerator.randomSearchRequest;
import static org.elasticsearch.search.RandomSearchRequestGenerator.randomSearchSourceBuilder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.sameInstance;

Expand Down Expand Up @@ -90,30 +84,6 @@ public void testSliceIntoSubRequests() {
}
}

/**
* Sliced sub-requests must keep the parent search's {@link PointInTimeBuilder} (id and keep-alive)
* so all slices search against the same PIT while applying distinct {@link SliceBuilder} settings.
*/
public void testSliceIntoSubRequestsPreservesPointInTimeBuilderOnEachSlice() {
BytesReference pitId = new BytesArray(randomAlphaOfLengthBetween(8, 24));
TimeValue keepAlive = TimeValue.timeValueMinutes(randomIntBetween(1, 30));
int times = randomIntBetween(2, 8);
SearchRequest request = new SearchRequest();
request.source(new SearchSourceBuilder().pointInTimeBuilder(new PointInTimeBuilder(pitId).setKeepAlive(keepAlive)));
SearchRequest[] slices = sliceIntoSubRequests(request, IdFieldMapper.NAME, times);
assertThat(slices.length, equalTo(times));
for (int i = 0; i < times; i++) {
PointInTimeBuilder pit = slices[i].source().pointInTimeBuilder();
assertNotNull(pit);
assertThat(pit.getEncodedId(), equalTo(pitId));
assertThat(pit.getKeepAlive(), equalTo(keepAlive));
SliceBuilder slice = slices[i].source().slice();
assertThat(slice.getField(), equalTo(IdFieldMapper.NAME));
assertThat(slice.getId(), equalTo(i));
assertThat(slice.getMax(), equalTo(times));
}
}

/**
* When the task is a worker, executeSlicedAction invokes the worker action with the given remote version.
*/
Expand Down
Loading
Loading