mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
cleanup
This commit is contained in:
parent
8349a3ee1e
commit
e3d346d3b7
@ -522,19 +522,7 @@ public class RecoverySourceHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* Perform phase 3 of the recovery process
|
||||
* <p/>
|
||||
* Phase3 again takes a snapshot of the translog, however this time the
|
||||
* snapshot is acquired under a write lock. The translog operations are
|
||||
* sent to the target node where they are replayed.
|
||||
* <p/>
|
||||
* {@code InternalEngine#recover} is responsible for taking the snapshot
|
||||
* of the translog, and after phase 3 completes the snapshots from all
|
||||
* three phases are released.
|
||||
=======
|
||||
* finalizes the recovery process
|
||||
>>>>>>> origin/master
|
||||
*/
|
||||
public void finalizeRecovery() {
|
||||
if (shard.state() == IndexShardState.CLOSED) {
|
||||
|
@ -463,64 +463,6 @@ public class RecoveryFromGatewayTests extends ElasticsearchIntegrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Slow
|
||||
@TestLogging("indices.recovery:TRACE,index.store:TRACE")
|
||||
public void testSyncFlushedRecovery() throws Exception {
|
||||
final Settings settings = settingsBuilder()
|
||||
.put("action.admin.cluster.node.shutdown.delay", "10ms")
|
||||
.put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false)
|
||||
.put("gateway.recover_after_nodes", 4)
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CONCURRENT_RECOVERIES, 4).build();
|
||||
|
||||
internalCluster().startNodesAsync(4, settings).get();
|
||||
// prevent any rebalance actions during the recovery
|
||||
assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder()
|
||||
.put(indexSettings())
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE)));
|
||||
ensureGreen();
|
||||
logger.info("--> indexing docs");
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
client().prepareIndex("test", "type").setSource("field", "value").execute().actionGet();
|
||||
}
|
||||
|
||||
logger.info("--> disabling allocation while the cluster is shut down");
|
||||
|
||||
// Disable allocations while we are closing nodes
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(settingsBuilder()
|
||||
.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, EnableAllocationDecider.Allocation.NONE))
|
||||
.get();
|
||||
|
||||
SyncedFlushService syncedFlushService = internalCluster().getInstance(SyncedFlushService.class);
|
||||
assertTrue(syncedFlushService.attemptSyncedFlush(new ShardId("test", 0)).success());
|
||||
logger.info("--> full cluster restart");
|
||||
internalCluster().fullRestart();
|
||||
|
||||
logger.info("--> waiting for cluster to return to green after first shutdown");
|
||||
ensureGreen();
|
||||
logClusterState();
|
||||
RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries("test").get();
|
||||
for (ShardRecoveryResponse response : recoveryResponse.shardResponses().get("test")) {
|
||||
RecoveryState recoveryState = response.recoveryState();
|
||||
if (!recoveryState.getPrimary()) {
|
||||
logger.info("--> replica shard {} recovered from {} to {}, recovered {}, reuse {}",
|
||||
response.getShardId(), recoveryState.getSourceNode().name(), recoveryState.getTargetNode().name(),
|
||||
recoveryState.getIndex().recoveredBytes(), recoveryState.getIndex().reusedBytes());
|
||||
} else {
|
||||
logger.info("--> replica shard {} recovered from {} to {}, recovered {}, reuse {}",
|
||||
response.getShardId(), recoveryState.getSourceNode().name(), recoveryState.getTargetNode().name(),
|
||||
recoveryState.getIndex().recoveredBytes(), recoveryState.getIndex().reusedBytes());
|
||||
}
|
||||
assertThat("no bytes should be recovered", recoveryState.getIndex().recoveredBytes(), equalTo(0l));
|
||||
assertThat("data should have been reused", recoveryState.getIndex().reusedBytes(), equalTo(recoveryState.getIndex().totalBytes()));
|
||||
assertThat("no files should be recovered", recoveryState.getIndex().recoveredFileCount(), equalTo(0));
|
||||
assertThat("all files should be reused", recoveryState.getIndex().reusedFileCount(), equalTo(recoveryState.getIndex().totalFileCount()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Slow
|
||||
public void testRecoveryDifferentNodeOrderStartup() throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user