parent
dab1f76e03
commit
7209f9f40b
|
@ -195,7 +195,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis
|
||||||
indexMdBuilder.version(Math.max(snapshotIndexMetaData.version(), currentIndexMetaData.version() + 1));
|
indexMdBuilder.version(Math.max(snapshotIndexMetaData.version(), currentIndexMetaData.version() + 1));
|
||||||
IndexMetaData updatedIndexMetaData = indexMdBuilder.index(renamedIndex).build();
|
IndexMetaData updatedIndexMetaData = indexMdBuilder.index(renamedIndex).build();
|
||||||
rtBuilder.addAsRestore(updatedIndexMetaData, restoreSource);
|
rtBuilder.addAsRestore(updatedIndexMetaData, restoreSource);
|
||||||
blocks.removeIndexBlock(index, INDEX_CLOSED_BLOCK);
|
blocks.removeIndexBlock(renamedIndex, INDEX_CLOSED_BLOCK);
|
||||||
mdBuilder.put(updatedIndexMetaData, true);
|
mdBuilder.put(updatedIndexMetaData, true);
|
||||||
}
|
}
|
||||||
for (int shard = 0; shard < snapshotIndexMetaData.getNumberOfShards(); shard++) {
|
for (int shard = 0; shard < snapshotIndexMetaData.getNumberOfShards(); shard++) {
|
||||||
|
|
|
@ -680,6 +680,19 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
||||||
assertThat(client.prepareCount("test-idx-1-copy").get().getCount(), equalTo(100L));
|
assertThat(client.prepareCount("test-idx-1-copy").get().getCount(), equalTo(100L));
|
||||||
assertThat(client.prepareCount("test-idx-2-copy").get().getCount(), equalTo(100L));
|
assertThat(client.prepareCount("test-idx-2-copy").get().getCount(), equalTo(100L));
|
||||||
|
|
||||||
|
logger.info("--> close just restored indices");
|
||||||
|
client.admin().indices().prepareClose("test-idx-1-copy", "test-idx-2-copy").get();
|
||||||
|
|
||||||
|
logger.info("--> and try to restore these indices again");
|
||||||
|
restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap")
|
||||||
|
.setRenamePattern("(.+)").setRenameReplacement("$1-copy").setWaitForCompletion(true).execute().actionGet();
|
||||||
|
assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
|
||||||
|
|
||||||
|
ensureGreen();
|
||||||
|
assertThat(client.prepareCount("test-idx-1-copy").get().getCount(), equalTo(100L));
|
||||||
|
assertThat(client.prepareCount("test-idx-2-copy").get().getCount(), equalTo(100L));
|
||||||
|
|
||||||
|
|
||||||
logger.info("--> close indices");
|
logger.info("--> close indices");
|
||||||
client.admin().indices().prepareClose("test-idx-1", "test-idx-2-copy").get();
|
client.admin().indices().prepareClose("test-idx-1", "test-idx-2-copy").get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue