Fix stuff after cherry-picking

This commit is contained in:
Tanguy Leroux 2020-04-06 18:05:54 +02:00
parent f108eb118a
commit 6f50c92d69
20 changed files with 85 additions and 62 deletions

View file

@ -43,7 +43,7 @@ public class ESIndexInputTestCase extends ESTestCase {
@BeforeClass
public static void createExecutor() {
final String name = "TEST-" + getTestClass().getSimpleName() + "#randomReadAndSlice";
executor = EsExecutors.newFixed(name, 10, 0, EsExecutors.daemonThreadFactory(name), new ThreadContext(Settings.EMPTY), false);
executor = EsExecutors.newFixed(name, 10, 0, EsExecutors.daemonThreadFactory(name), new ThreadContext(Settings.EMPTY));
}
@AfterClass

View file

@ -50,7 +50,7 @@ public class CleanupSnapshotStep extends AsyncRetryDuringSnapshotActionStep {
return;
}
DeleteSnapshotRequest deleteSnapshotRequest = new DeleteSnapshotRequest(repositoryName, snapshotName);
getClient().admin().cluster().deleteSnapshot(deleteSnapshotRequest, new ActionListener<>() {
getClient().admin().cluster().deleteSnapshot(deleteSnapshotRequest, new ActionListener<AcknowledgedResponse>() {
@Override
public void onResponse(AcknowledgedResponse acknowledgedResponse) {

View file

@ -50,7 +50,7 @@ public class DeleteAction implements LifecycleAction {
}
public DeleteAction(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_8_0)) {
this.deleteSearchableSnapshot = in.readBoolean();
} else {
this.deleteSearchableSnapshot = true;
@ -59,7 +59,7 @@ public class DeleteAction implements LifecycleAction {
@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_8_0)) {
out.writeBoolean(deleteSearchableSnapshot);
}
}

View file

@ -194,7 +194,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
isAutoRetryableError = null;
failedStepRetryCount = null;
}
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_8_0)) {
repositoryName = in.readOptionalString();
snapshotName = in.readOptionalString();
} else {
@ -240,7 +240,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
out.writeOptionalBoolean(isAutoRetryableError);
out.writeOptionalVInt(failedStepRetryCount);
}
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_8_0)) {
out.writeOptionalString(repositoryName);
out.writeOptionalString(snapshotName);
}

View file

@ -33,12 +33,12 @@ public class MountSearchableSnapshotRequest extends MasterNodeRequest<MountSearc
public static final ConstructingObjectParser<MountSearchableSnapshotRequest, RestRequest> PARSER = new ConstructingObjectParser<>(
"mount_searchable_snapshot", true,
(a, request) -> new MountSearchableSnapshotRequest(
Objects.requireNonNullElse((String)a[1], (String)a[0]),
(String) ((a[1] != null) ? a[1] : Objects.requireNonNull(a[0])),
request.param("repository"),
request.param("snapshot"),
(String)a[0],
Objects.requireNonNullElse((Settings)a[2], Settings.EMPTY),
Objects.requireNonNullElse((String[])a[3], Strings.EMPTY_ARRAY),
(String) a[0],
(Settings) ((a[2] != null) ? a[2] : Settings.EMPTY),
(String[]) ((a[3] != null) ? a[3] : Strings.EMPTY_ARRAY),
request.paramAsBoolean("wait_for_completion", false)));
private static final ParseField INDEX_FIELD = new ParseField("index");

View file

@ -88,7 +88,7 @@ public class CleanupSnapshotStepTests extends AbstractStepTestCase<CleanupSnapsh
IndexMetadata.Builder indexMetadataBuilder =
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))
.numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5));
Map<String, String> ilmCustom = Map.of("snapshot_repository", "repository_name");
Map<String, String> ilmCustom = org.elasticsearch.common.collect.Map.of("snapshot_repository", "repository_name");
indexMetadataBuilder.putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom);
IndexMetadata indexMetaData = indexMetadataBuilder.build();
@ -116,7 +116,7 @@ public class CleanupSnapshotStepTests extends AbstractStepTestCase<CleanupSnapsh
String indexName = randomAlphaOfLength(10);
String policyName = "test-ilm-policy";
String snapshotName = indexName + "-" + policyName;
Map<String, String> ilmCustom = Map.of("snapshot_name", snapshotName);
Map<String, String> ilmCustom = org.elasticsearch.common.collect.Map.of("snapshot_name", snapshotName);
IndexMetadata.Builder indexMetadataBuilder =
IndexMetadata.builder(indexName).settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, policyName))

View file

@ -21,9 +21,9 @@ import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotA
import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.Collections.emptyList;
import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
@ -179,7 +179,7 @@ public class MountSnapshotStepTests extends AbstractStepTestCase<MountSnapshotSt
ClusterState.builder(emptyClusterState()).metadata(Metadata.builder().put(indexMetaData, true).build()).build();
{
RestoreSnapshotResponse responseWithOKStatus = new RestoreSnapshotResponse(new RestoreInfo("test", List.of(), 1, 1));
RestoreSnapshotResponse responseWithOKStatus = new RestoreSnapshotResponse(new RestoreInfo("test", emptyList(), 1, 1));
try (NoOpClient clientPropagatingOKResponse = getClientTriggeringResponse(responseWithOKStatus)) {
MountSnapshotStep step = new MountSnapshotStep(randomStepKey(), randomStepKey(), clientPropagatingOKResponse,
RESTORED_INDEX_PREFIX);

View file

@ -1593,7 +1593,7 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
// create policy with cold and delete phases
Map<String, LifecycleAction> coldActions =
Map.of(SearchableSnapshotAction.NAME, new SearchableSnapshotAction(snapshotRepo));
singletonMap(SearchableSnapshotAction.NAME, new SearchableSnapshotAction(snapshotRepo));
Map<String, Phase> phases = new HashMap<>();
phases.put("cold", new Phase("cold", TimeValue.ZERO, coldActions));
phases.put("delete", new Phase("delete", TimeValue.timeValueMillis(10000), singletonMap(DeleteAction.NAME,
@ -1649,7 +1649,7 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
// create policy with cold and delete phases
Map<String, LifecycleAction> coldActions =
Map.of(SearchableSnapshotAction.NAME, new SearchableSnapshotAction(snapshotRepo));
singletonMap(SearchableSnapshotAction.NAME, new SearchableSnapshotAction(snapshotRepo));
Map<String, Phase> phases = new HashMap<>();
phases.put("cold", new Phase("cold", TimeValue.ZERO, coldActions));
phases.put("delete", new Phase("delete", TimeValue.timeValueMillis(10000), singletonMap(DeleteAction.NAME,

View file

@ -174,7 +174,7 @@ public class SearchableSnapshotDirectory extends BaseDirectory {
private List<BlobStoreIndexShardSnapshot.FileInfo> files() {
if (loaded == false) {
return List.of();
return Collections.emptyList();
}
final List<BlobStoreIndexShardSnapshot.FileInfo> files = snapshot().indexFiles();
assert files != null;

View file

@ -66,6 +66,12 @@ import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static java.util.Collections.unmodifiableList;
import static org.elasticsearch.index.IndexModule.INDEX_STORE_TYPE_SETTING;
/**
@ -118,7 +124,7 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
// The file extensions that are excluded from the cache
public static final Setting<List<String>> SNAPSHOT_CACHE_EXCLUDED_FILE_TYPES_SETTING = Setting.listSetting(
"index.store.snapshot.cache.excluded_file_types",
Collections.emptyList(),
emptyList(),
Function.identity(),
Setting.Property.IndexScope,
Setting.Property.NodeScope
@ -151,19 +157,21 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
@Override
public List<Setting<?>> getSettings() {
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
return List.of(
SNAPSHOT_REPOSITORY_SETTING,
SNAPSHOT_SNAPSHOT_NAME_SETTING,
SNAPSHOT_SNAPSHOT_ID_SETTING,
SNAPSHOT_INDEX_ID_SETTING,
SNAPSHOT_CACHE_ENABLED_SETTING,
SNAPSHOT_CACHE_EXCLUDED_FILE_TYPES_SETTING,
SNAPSHOT_UNCACHED_CHUNK_SIZE_SETTING,
CacheService.SNAPSHOT_CACHE_SIZE_SETTING,
CacheService.SNAPSHOT_CACHE_RANGE_SIZE_SETTING
return unmodifiableList(
asList(
SNAPSHOT_REPOSITORY_SETTING,
SNAPSHOT_SNAPSHOT_NAME_SETTING,
SNAPSHOT_SNAPSHOT_ID_SETTING,
SNAPSHOT_INDEX_ID_SETTING,
SNAPSHOT_CACHE_ENABLED_SETTING,
SNAPSHOT_CACHE_EXCLUDED_FILE_TYPES_SETTING,
SNAPSHOT_UNCACHED_CHUNK_SIZE_SETTING,
CacheService.SNAPSHOT_CACHE_SIZE_SETTING,
CacheService.SNAPSHOT_CACHE_RANGE_SIZE_SETTING
)
);
} else {
return List.of();
return emptyList();
}
}
@ -183,9 +191,9 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
final CacheService cacheService = new CacheService(settings);
this.cacheService.set(cacheService);
return List.of(cacheService);
return singletonList(cacheService);
} else {
return List.of();
return emptyList();
}
}
@ -205,7 +213,7 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
@Override
public Map<String, DirectoryFactory> getDirectoryFactories() {
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
return Map.of(SNAPSHOT_DIRECTORY_FACTORY_KEY, (indexSettings, shardPath) -> {
return singletonMap(SNAPSHOT_DIRECTORY_FACTORY_KEY, (indexSettings, shardPath) -> {
final RepositoriesService repositories = repositoriesService.get();
assert repositories != null;
final CacheService cache = cacheService.get();
@ -213,7 +221,7 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
return SearchableSnapshotDirectory.create(repositories, cache, indexSettings, shardPath, System::nanoTime);
});
} else {
return Map.of();
return emptyMap();
}
}
@ -230,13 +238,13 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
return List.of(
return org.elasticsearch.common.collect.List.of(
new ActionHandler<>(SearchableSnapshotsStatsAction.INSTANCE, TransportSearchableSnapshotsStatsAction.class),
new ActionHandler<>(ClearSearchableSnapshotsCacheAction.INSTANCE, TransportClearSearchableSnapshotsCacheAction.class),
new ActionHandler<>(MountSearchableSnapshotAction.INSTANCE, TransportMountSearchableSnapshotAction.class)
);
} else {
return List.of();
return emptyList();
}
}
@ -250,13 +258,15 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
Supplier<DiscoveryNodes> nodesInCluster
) {
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
return List.of(
new RestSearchableSnapshotsStatsAction(),
new RestClearSearchableSnapshotsCacheAction(),
new RestMountSearchableSnapshotAction()
return unmodifiableList(
asList(
new RestSearchableSnapshotsStatsAction(),
new RestClearSearchableSnapshotsCacheAction(),
new RestMountSearchableSnapshotAction()
)
);
} else {
return List.of();
return emptyList();
}
}

View file

@ -30,7 +30,6 @@ import org.elasticsearch.repositories.RepositoriesService;
import org.elasticsearch.repositories.Repository;
import org.elasticsearch.repositories.RepositoryData;
import org.elasticsearch.snapshots.SnapshotId;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.searchablesnapshots.MountSearchableSnapshotAction;
@ -121,7 +120,6 @@ public class TransportMountSearchableSnapshotAction extends TransportMasterNodeA
@Override
protected void masterOperation(
Task task,
final MountSearchableSnapshotRequest request,
final ClusterState state,
final ActionListener<RestoreSnapshotResponse> listener
@ -148,7 +146,7 @@ public class TransportMountSearchableSnapshotAction extends TransportMasterNodeA
.stream()
.filter(s -> snapName.equals(s.getName()))
.findFirst();
if (matchingSnapshotId.isEmpty()) {
if (matchingSnapshotId.isPresent() == false) {
throw new ElasticsearchException("snapshot [" + snapName + "] not found in repository [" + repoName + "]");
}
final SnapshotId snapshotId = matchingSnapshotId.get();

View file

@ -16,13 +16,18 @@ import org.elasticsearch.xpack.searchablesnapshots.action.ClearSearchableSnapsho
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
public class RestClearSearchableSnapshotsCacheAction extends BaseRestHandler {
@Override
public List<Route> routes() {
return List.of(
new Route(RestRequest.Method.POST, "/_searchable_snapshots/cache/clear"),
new Route(RestRequest.Method.POST, "/{index}/_searchable_snapshots/cache/clear")
return unmodifiableList(
asList(
new Route(RestRequest.Method.POST, "/_searchable_snapshots/cache/clear"),
new Route(RestRequest.Method.POST, "/{index}/_searchable_snapshots/cache/clear")
)
);
}

View file

@ -15,13 +15,18 @@ import org.elasticsearch.xpack.searchablesnapshots.action.SearchableSnapshotsSta
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
public class RestSearchableSnapshotsStatsAction extends BaseRestHandler {
@Override
public List<Route> routes() {
return List.of(
new Route(RestRequest.Method.GET, "/_searchable_snapshots/stats"),
new Route(RestRequest.Method.GET, "/{index}/_searchable_snapshots/stats")
return unmodifiableList(
asList(
new Route(RestRequest.Method.GET, "/_searchable_snapshots/stats"),
new Route(RestRequest.Method.GET, "/{index}/_searchable_snapshots/stats")
)
);
}

View file

@ -26,6 +26,7 @@ import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.LongSupplier;
@ -566,7 +567,7 @@ public class SearchableSnapshotDirectoryStatsTests extends ESIndexInputTestCase
final String blobName = randomUnicodeOfLength(10);
final BlobContainer blobContainer = singleBlobContainer(blobName, fileContent);
final StoreFileMetadata metadata = new StoreFileMetadata(fileName, fileContent.length, "_checksum", Version.CURRENT.luceneVersion);
final List<FileInfo> files = List.of(new FileInfo(blobName, metadata, new ByteSizeValue(fileContent.length)));
final List<FileInfo> files = Collections.singletonList(new FileInfo(blobName, metadata, new ByteSizeValue(fileContent.length)));
final BlobStoreIndexShardSnapshot snapshot = new BlobStoreIndexShardSnapshot(snapshotId.getName(), 0L, files, 0L, 0L, 0, 0L);
try (

View file

@ -90,6 +90,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyMap;
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING;
import static org.hamcrest.Matchers.allOf;
@ -153,7 +154,7 @@ public class SearchableSnapshotDirectoryTests extends ESTestCase {
CheckHits.checkEqual(query, snapshotSearcher.search(query, 10).scoreDocs, searcher.search(query, 10).scoreDocs);
}
{
Query query = new TermInSetQuery("text", List.of(new BytesRef("quick"), new BytesRef("lazy")));
Query query = new TermInSetQuery("text", asList(new BytesRef("quick"), new BytesRef("lazy")));
assertThat(snapshotSearcher.count(query), equalTo(searcher.count(query)));
CheckHits.checkEqual(query, snapshotSearcher.search(query, 10).scoreDocs, searcher.search(query, 10).scoreDocs);
}
@ -328,7 +329,7 @@ public class SearchableSnapshotDirectoryTests extends ESTestCase {
final IndexWriterConfig indexWriterConfig = newIndexWriterConfig();
try (IndexWriter writer = new IndexWriter(directory, indexWriterConfig)) {
final int nbDocs = scaledRandomIntBetween(0, 1_000);
final List<String> words = List.of("the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog");
final List<String> words = asList("the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog");
for (int i = 0; i < nbDocs; i++) {
final Document doc = new Document();
doc.add(new StringField("id", "" + i, Field.Store.YES));
@ -460,7 +461,7 @@ public class SearchableSnapshotDirectoryTests extends ESTestCase {
private void testIndexInputs(final CheckedBiConsumer<IndexInput, IndexInput, Exception> consumer) throws Exception {
testDirectories((directory, snapshotDirectory) -> {
for (String fileName : randomSubsetOf(Arrays.asList(snapshotDirectory.listAll()))) {
for (String fileName : randomSubsetOf(asList(snapshotDirectory.listAll()))) {
final IOContext context = newIOContext(random());
try (IndexInput indexInput = directory.openInput(fileName, context)) {
final List<Closeable> closeables = new ArrayList<>();

View file

@ -27,10 +27,10 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.LongAdder;
import static java.util.Collections.singletonList;
import static org.elasticsearch.index.store.cache.TestUtils.createCacheService;
import static org.elasticsearch.index.store.cache.TestUtils.singleBlobContainer;
import static org.elasticsearch.index.store.cache.TestUtils.singleSplitBlobContainer;
@ -61,7 +61,7 @@ public class CachedBlobContainerIndexInputTests extends ESIndexInputTestCase {
final BlobStoreIndexShardSnapshot snapshot = new BlobStoreIndexShardSnapshot(
snapshotId.getName(),
0L,
List.of(new BlobStoreIndexShardSnapshot.FileInfo(blobName, metaData, new ByteSizeValue(partSize))),
singletonList(new BlobStoreIndexShardSnapshot.FileInfo(blobName, metaData, new ByteSizeValue(partSize))),
0L,
0L,
0,
@ -136,7 +136,7 @@ public class CachedBlobContainerIndexInputTests extends ESIndexInputTestCase {
final BlobStoreIndexShardSnapshot snapshot = new BlobStoreIndexShardSnapshot(
snapshotId.getName(),
0L,
List.of(new BlobStoreIndexShardSnapshot.FileInfo(blobName, metadata, new ByteSizeValue(input.length + 1))),
singletonList(new BlobStoreIndexShardSnapshot.FileInfo(blobName, metadata, new ByteSizeValue(input.length + 1))),
0L,
0L,
0,

View file

@ -195,7 +195,7 @@ public class SparseFileTrackerTests extends ESTestCase {
final AtomicBoolean listenerCalled = new AtomicBoolean();
listenerCalledConsumer.accept(listenerCalled);
final List<SparseFileTracker.Gap> gaps = sparseFileTracker.waitForRange(start, end, new ActionListener<>() {
final List<SparseFileTracker.Gap> gaps = sparseFileTracker.waitForRange(start, end, new ActionListener<Void>() {
@Override
public void onResponse(Void aVoid) {
for (long i = start; i < end; i++) {

View file

@ -25,6 +25,7 @@ import java.util.Random;
import static com.carrotsearch.randomizedtesting.generators.RandomNumbers.randomIntBetween;
import static com.carrotsearch.randomizedtesting.generators.RandomPicks.randomFrom;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
@ -34,7 +35,7 @@ public final class TestUtils {
public static CacheService createCacheService(final Random random) {
final ByteSizeValue cacheSize = new ByteSizeValue(
randomIntBetween(random, 1, 100),
randomFrom(random, List.of(ByteSizeUnit.BYTES, ByteSizeUnit.KB, ByteSizeUnit.MB, ByteSizeUnit.GB))
randomFrom(random, asList(ByteSizeUnit.BYTES, ByteSizeUnit.KB, ByteSizeUnit.MB, ByteSizeUnit.GB))
);
return new CacheService(cacheSize, randomCacheRangeSize(random));
}
@ -42,7 +43,7 @@ public final class TestUtils {
public static ByteSizeValue randomCacheRangeSize(final Random random) {
return new ByteSizeValue(
randomIntBetween(random, 1, 100),
randomFrom(random, List.of(ByteSizeUnit.BYTES, ByteSizeUnit.KB, ByteSizeUnit.MB))
randomFrom(random, asList(ByteSizeUnit.BYTES, ByteSizeUnit.KB, ByteSizeUnit.MB))
);
}

View file

@ -34,7 +34,9 @@ import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService;
import java.util.Collection;
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
public abstract class BaseSearchableSnapshotsIntegTestCase extends ESIntegTestCase {
@Override
@ -44,7 +46,7 @@ public abstract class BaseSearchableSnapshotsIntegTestCase extends ESIntegTestCa
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return List.of(SearchableSnapshots.class, LocalStateCompositeXPackPlugin.class);
return unmodifiableList(asList(SearchableSnapshots.class, LocalStateCompositeXPackPlugin.class));
}
@Override

View file

@ -69,7 +69,7 @@ public class SearchableSnapshotsIntegTests extends BaseSearchableSnapshotsIntegT
createIndex(indexName);
final List<IndexRequestBuilder> indexRequestBuilders = new ArrayList<>();
for (int i = between(10, 10_000); i >= 0; i--) {
indexRequestBuilders.add(client().prepareIndex(indexName).setSource("foo", randomBoolean() ? "bar" : "baz"));
indexRequestBuilders.add(client().prepareIndex(indexName, "_doc").setSource("foo", randomBoolean() ? "bar" : "baz"));
}
// TODO NORELEASE no dummy docs since that includes deletes, yet we always copy the .liv file in peer recovery
indexRandom(true, false, indexRequestBuilders);