|
@@ -51,6 +51,7 @@ import org.elasticsearch.index.mapper.DateFieldMapper;
|
|
|
import org.elasticsearch.index.shard.IndexLongFieldRange;
|
|
|
import org.elasticsearch.indices.IndicesService;
|
|
|
import org.elasticsearch.repositories.RepositoryData;
|
|
|
+import org.elasticsearch.repositories.fs.FsRepository;
|
|
|
import org.elasticsearch.rest.RestStatus;
|
|
|
import org.elasticsearch.search.SearchResponseUtils;
|
|
|
import org.elasticsearch.snapshots.SnapshotId;
|
|
@@ -89,6 +90,7 @@ import static org.elasticsearch.repositories.blobstore.BlobStoreRepository.READO
|
|
|
import static org.elasticsearch.snapshots.SearchableSnapshotsSettings.SEARCHABLE_SNAPSHOT_STORE_TYPE;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
|
|
+import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
|
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_RECOVERY_STATE_FACTORY_KEY;
|
|
|
import static org.hamcrest.Matchers.allOf;
|
|
|
import static org.hamcrest.Matchers.containsString;
|
|
@@ -1274,6 +1276,37 @@ public class SearchableSnapshotsIntegTests extends BaseSearchableSnapshotsIntegT
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void testRefreshFullyMountedIndex() throws Exception {
|
|
|
+ internalCluster().ensureAtLeastNumDataNodes(2);
|
|
|
+
|
|
|
+ final var index = "index";
|
|
|
+ createIndex(index, 1, 0);
|
|
|
+ populateIndex(index, 1_000);
|
|
|
+
|
|
|
+ final var repository = "repository";
|
|
|
+ createRepository(repository, FsRepository.TYPE, Settings.builder().put("location", randomRepoPath()));
|
|
|
+
|
|
|
+ final var snapshot = "repository";
|
|
|
+ createFullSnapshot(repository, snapshot);
|
|
|
+
|
|
|
+ assertAcked(indicesAdmin().prepareDelete(index));
|
|
|
+
|
|
|
+ final var fullIndex = "full-" + index;
|
|
|
+ mountSnapshot(
|
|
|
+ repository,
|
|
|
+ snapshot,
|
|
|
+ index,
|
|
|
+ fullIndex,
|
|
|
+ Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomInt(1)).build(),
|
|
|
+ MountSearchableSnapshotRequest.Storage.FULL_COPY
|
|
|
+ );
|
|
|
+ ensureGreen(fullIndex);
|
|
|
+
|
|
|
+ // before the fix this would have failed
|
|
|
+ var refreshResult = indicesAdmin().prepareRefresh(fullIndex).execute().actionGet();
|
|
|
+ assertNoFailures(refreshResult);
|
|
|
+ }
|
|
|
+
|
|
|
private TaskInfo getTaskForActionFromMaster(String action) {
|
|
|
ListTasksResponse response = client().execute(
|
|
|
TransportListTasksAction.TYPE,
|