Add test rethrottle test case for delete-by-query
and remove some type parameters that we don't need that were getting in the way.
This commit is contained in:
parent
f67e5807ca
commit
f82ab787a5
|
@ -21,7 +21,6 @@ package org.elasticsearch.index.reindex;
|
|||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.ActionRequestBuilder;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.WriteConsistencyLevel;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
@ -30,13 +29,12 @@ import org.elasticsearch.index.query.QueryBuilder;
|
|||
|
||||
public abstract class AbstractBulkByScrollRequestBuilder<
|
||||
Request extends AbstractBulkByScrollRequest<Request>,
|
||||
Response extends ActionResponse,
|
||||
Self extends AbstractBulkByScrollRequestBuilder<Request, Response, Self>>
|
||||
extends ActionRequestBuilder<Request, Response, Self> {
|
||||
Self extends AbstractBulkByScrollRequestBuilder<Request, Self>>
|
||||
extends ActionRequestBuilder<Request, BulkIndexByScrollResponse, Self> {
|
||||
private final SearchRequestBuilder source;
|
||||
|
||||
protected AbstractBulkByScrollRequestBuilder(ElasticsearchClient client,
|
||||
Action<Request, Response, Self> action, SearchRequestBuilder source, Request request) {
|
||||
Action<Request, BulkIndexByScrollResponse, Self> action, SearchRequestBuilder source, Request request) {
|
||||
super(client, action, request);
|
||||
this.source = source;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.script.Script;
|
|||
public abstract class AbstractBulkIndexByScrollRequestBuilder<
|
||||
Request extends AbstractBulkIndexByScrollRequest<Request>,
|
||||
Self extends AbstractBulkIndexByScrollRequestBuilder<Request, Self>>
|
||||
extends AbstractBulkByScrollRequestBuilder<Request, BulkIndexByScrollResponse, Self> {
|
||||
extends AbstractBulkByScrollRequestBuilder<Request, Self> {
|
||||
|
||||
protected AbstractBulkIndexByScrollRequestBuilder(ElasticsearchClient client,
|
||||
Action<Request, BulkIndexByScrollResponse, Self> action, SearchRequestBuilder search, Request request) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
|
|||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
public class DeleteByQueryRequestBuilder extends
|
||||
AbstractBulkByScrollRequestBuilder<DeleteByQueryRequest, BulkIndexByScrollResponse, DeleteByQueryRequestBuilder> {
|
||||
AbstractBulkByScrollRequestBuilder<DeleteByQueryRequest, DeleteByQueryRequestBuilder> {
|
||||
|
||||
public DeleteByQueryRequestBuilder(ElasticsearchClient client,
|
||||
Action<DeleteByQueryRequest, BulkIndexByScrollResponse, DeleteByQueryRequestBuilder> action) {
|
||||
|
|
|
@ -70,6 +70,7 @@ public class RethrottleRequest extends BaseTasksRequest<RethrottleRequest> {
|
|||
switch (action) {
|
||||
case ReindexAction.NAME:
|
||||
case UpdateByQueryAction.NAME:
|
||||
case DeleteByQueryAction.NAME:
|
||||
continue;
|
||||
default:
|
||||
validationException = addValidationError(
|
||||
|
|
|
@ -80,10 +80,7 @@ public class CancelTests extends ReindexTestCase {
|
|||
/**
|
||||
* Executes the cancellation test
|
||||
*/
|
||||
private void testCancel(String action,
|
||||
AbstractBulkByScrollRequestBuilder<?, ? extends BulkIndexByScrollResponse, ?> builder,
|
||||
CancelAssertion assertion) throws Exception {
|
||||
|
||||
private void testCancel(String action, AbstractBulkByScrollRequestBuilder<?, ?> builder, CancelAssertion assertion) throws Exception {
|
||||
createIndex(INDEX);
|
||||
|
||||
// Total number of documents created for this test (~10 per primary shard)
|
||||
|
|
|
@ -43,7 +43,11 @@ public class RethrottleTests extends ReindexTestCase {
|
|||
testCase(updateByQuery().source("test"), UpdateByQueryAction.NAME);
|
||||
}
|
||||
|
||||
private void testCase(AbstractBulkIndexByScrollRequestBuilder<?, ?> request, String actionName)
|
||||
public void testDeleteByQuery() throws Exception {
|
||||
testCase(deleteByQuery().source("test"), DeleteByQueryAction.NAME);
|
||||
}
|
||||
|
||||
private void testCase(AbstractBulkByScrollRequestBuilder<?, ?> request, String actionName)
|
||||
throws Exception {
|
||||
// Use a single shard so the reindex has to happen in multiple batches
|
||||
client().admin().indices().prepareCreate("test").setSettings("index.number_of_shards", 1).get();
|
||||
|
|
|
@ -107,8 +107,8 @@ public class RetryTests extends ESSingleNodeTestCase {
|
|||
matcher().deleted(DOC_COUNT));
|
||||
}
|
||||
|
||||
private void testCase(String action, AbstractBulkByScrollRequestBuilder<?, BulkIndexByScrollResponse, ?> request,
|
||||
BulkIndexByScrollResponseMatcher matcher) throws Exception {
|
||||
private void testCase(String action, AbstractBulkByScrollRequestBuilder<?, ?> request, BulkIndexByScrollResponseMatcher matcher)
|
||||
throws Exception {
|
||||
logger.info("Blocking search");
|
||||
CyclicBarrier initialSearchBlock = blockExecutor(ThreadPool.Names.SEARCH);
|
||||
|
||||
|
|
Loading…
Reference in New Issue