|
@@ -65,6 +65,7 @@ import org.elasticsearch.repositories.IndexId;
|
|
|
import org.elasticsearch.repositories.Repository;
|
|
|
import org.elasticsearch.repositories.RepositoryData;
|
|
|
import org.elasticsearch.repositories.ShardGenerations;
|
|
|
+import org.elasticsearch.repositories.SnapshotShardContext;
|
|
|
import org.elasticsearch.repositories.ShardSnapshotResult;
|
|
|
import org.elasticsearch.repositories.blobstore.BlobStoreTestUtil;
|
|
|
import org.elasticsearch.repositories.blobstore.ESBlobStoreRepositoryIntegTestCase;
|
|
@@ -108,9 +109,9 @@ public class SourceOnlySnapshotShardTests extends IndexShardTestCase {
|
|
|
try (Engine.IndexCommitRef snapshotRef = shard.acquireLastIndexCommit(true)) {
|
|
|
IndexShardSnapshotStatus indexShardSnapshotStatus = IndexShardSnapshotStatus.newInitializing("-1");
|
|
|
final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture();
|
|
|
- runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(shard.store(), shard.mapperService(), snapshotId, indexId,
|
|
|
- snapshotRef.getIndexCommit(), null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
- Collections.emptyMap(), future));
|
|
|
+ runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(new SnapshotShardContext(shard.store(),
|
|
|
+ shard.mapperService(), snapshotId, indexId, snapshotRef, null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
+ Collections.emptyMap(), future)));
|
|
|
IllegalStateException illegalStateException = expectThrows(IllegalStateException.class, future::actionGet);
|
|
|
assertEquals(
|
|
|
"Can't snapshot _source only on an index that has incomplete source ie. has _source disabled or filters the source",
|
|
@@ -135,9 +136,9 @@ public class SourceOnlySnapshotShardTests extends IndexShardTestCase {
|
|
|
IndexShardSnapshotStatus indexShardSnapshotStatus = IndexShardSnapshotStatus.newInitializing(null);
|
|
|
SnapshotId snapshotId = new SnapshotId("test", "test");
|
|
|
final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture();
|
|
|
- runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(shard.store(), shard.mapperService(), snapshotId, indexId,
|
|
|
- snapshotRef.getIndexCommit(), null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
- Collections.emptyMap(), future));
|
|
|
+ runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(new SnapshotShardContext(shard.store(),
|
|
|
+ shard.mapperService(), snapshotId, indexId, snapshotRef, null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
+ Collections.emptyMap(), future)));
|
|
|
shardGeneration = future.actionGet().getGeneration();
|
|
|
IndexShardSnapshotStatus.Copy copy = indexShardSnapshotStatus.asCopy();
|
|
|
assertEquals(copy.getTotalFileCount(), copy.getIncrementalFileCount());
|
|
@@ -152,9 +153,9 @@ public class SourceOnlySnapshotShardTests extends IndexShardTestCase {
|
|
|
|
|
|
IndexShardSnapshotStatus indexShardSnapshotStatus = IndexShardSnapshotStatus.newInitializing(shardGeneration);
|
|
|
final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture();
|
|
|
- runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(shard.store(), shard.mapperService(), snapshotId, indexId,
|
|
|
- snapshotRef.getIndexCommit(), null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
- Collections.emptyMap(), future));
|
|
|
+ runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(new SnapshotShardContext(shard.store(),
|
|
|
+ shard.mapperService(), snapshotId, indexId, snapshotRef, null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
+ Collections.emptyMap(), future)));
|
|
|
shardGeneration = future.actionGet().getGeneration();
|
|
|
IndexShardSnapshotStatus.Copy copy = indexShardSnapshotStatus.asCopy();
|
|
|
// we processed the segments_N file plus _1.si, _1.fnm, _1.fdx, _1.fdt, _1.fdm
|
|
@@ -169,9 +170,9 @@ public class SourceOnlySnapshotShardTests extends IndexShardTestCase {
|
|
|
|
|
|
IndexShardSnapshotStatus indexShardSnapshotStatus = IndexShardSnapshotStatus.newInitializing(shardGeneration);
|
|
|
final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture();
|
|
|
- runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(shard.store(), shard.mapperService(), snapshotId, indexId,
|
|
|
- snapshotRef.getIndexCommit(), null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
- Collections.emptyMap(), future));
|
|
|
+ runAsSnapshot(shard.getThreadPool(), () -> repository.snapshotShard(new SnapshotShardContext(shard.store(),
|
|
|
+ shard.mapperService(), snapshotId, indexId, snapshotRef, null, indexShardSnapshotStatus, Version.CURRENT,
|
|
|
+ Collections.emptyMap(), future)));
|
|
|
future.actionGet();
|
|
|
IndexShardSnapshotStatus.Copy copy = indexShardSnapshotStatus.asCopy();
|
|
|
// we processed the segments_N file plus _1_1.liv
|
|
@@ -218,8 +219,8 @@ public class SourceOnlySnapshotShardTests extends IndexShardTestCase {
|
|
|
IndexShardSnapshotStatus indexShardSnapshotStatus = IndexShardSnapshotStatus.newInitializing(null);
|
|
|
final PlainActionFuture<ShardSnapshotResult> future = PlainActionFuture.newFuture();
|
|
|
runAsSnapshot(shard.getThreadPool(), () -> {
|
|
|
- repository.snapshotShard(shard.store(), shard.mapperService(), snapshotId, indexId, snapshotRef.getIndexCommit(),
|
|
|
- null, indexShardSnapshotStatus, Version.CURRENT, Collections.emptyMap(), future);
|
|
|
+ repository.snapshotShard(new SnapshotShardContext(shard.store(), shard.mapperService(), snapshotId, indexId, snapshotRef,
|
|
|
+ null, indexShardSnapshotStatus, Version.CURRENT, Collections.emptyMap(), future));
|
|
|
future.actionGet();
|
|
|
final PlainActionFuture<RepositoryData> finFuture = PlainActionFuture.newFuture();
|
|
|
final ShardGenerations shardGenerations =
|