If we run into a background merge between creating the snapshot and closing the index then with compound files we could be in a situation where we get zero file reuse on restore. Force merging before the snapshot gives us a single segment that won't change down the line so the restore always sees file reuse from the close index. Closes #63476
This commit is contained in:
parent
bd07e44c9a
commit
96407268a0
|
@ -43,7 +43,6 @@ import org.elasticsearch.cluster.SnapshotsInProgress;
|
|||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.metadata.Metadata;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.CheckedFunction;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
|
@ -565,11 +564,8 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest
|
|||
|
||||
public void testRestoreIndexWithShardsMissingInLocalGateway() throws Exception {
|
||||
logger.info("--> start 2 nodes");
|
||||
Settings nodeSettings = Settings.builder()
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
|
||||
.build();
|
||||
|
||||
internalCluster().startNodes(2, nodeSettings);
|
||||
internalCluster().startNodes(2);
|
||||
cluster().wipeIndices("_all");
|
||||
|
||||
createRepository("test-repo", "fs");
|
||||
|
@ -581,6 +577,10 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest
|
|||
|
||||
indexRandomDocs("test-idx", 100);
|
||||
|
||||
logger.info("--> force merging down to a single segment to get a deterministic set of files");
|
||||
assertEquals(client().admin().indices().prepareForceMerge("test-idx").setMaxNumSegments(1).setFlush(true).get().getFailedShards(),
|
||||
0);
|
||||
|
||||
createSnapshot("test-repo", "test-snap-1", Collections.singletonList("test-idx"));
|
||||
|
||||
logger.info("--> close the index");
|
||||
|
|
Loading…
Reference in New Issue