From 461c20049f9881d8d52c6664de64a3b2b5edf909 Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Sun, 16 Nov 2014 23:41:32 +0100 Subject: [PATCH] Test: CorruptedFileTest.testCorruptionOnNetworkLayer used node settings when creating an index Test used `indices.recovery.concurrent_streams` when creating an index but this is a node setting. Moved it to the node settings and added similar settings to speed up concurrent recoveries. Also fixed a misleading log message in ShardRecoveryHandler when logging a remove corruption --- .../indices/recovery/ShardRecoveryHandler.java | 7 ++++--- .../elasticsearch/index/store/CorruptedFileTest.java | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/elasticsearch/indices/recovery/ShardRecoveryHandler.java b/src/main/java/org/elasticsearch/indices/recovery/ShardRecoveryHandler.java index 34773fb52e6..acc6ef917a2 100644 --- a/src/main/java/org/elasticsearch/indices/recovery/ShardRecoveryHandler.java +++ b/src/main/java/org/elasticsearch/indices/recovery/ShardRecoveryHandler.java @@ -263,11 +263,12 @@ public final class ShardRecoveryHandler implements Engine.RecoveryHandler { corruptedEngine.get().addSuppressed(e); } } else { // corruption has happened on the way to replica - RemoteTransportException exception = new RemoteTransportException("File corruption occured on recovery but checksums are ok", null); + RemoteTransportException exception = new RemoteTransportException("File corruption occurred on recovery but checksums are ok", null); exception.addSuppressed(e); exceptions.add(0, exception); // last exception first - logger.warn("{} File corruption on recovery {} local checksum OK", - corruptIndexException, shard.shardId(), md); + logger.warn("{} Remote file corruption on node {}, recovering {}. local checksum OK", + corruptIndexException, shard.shardId(), request.targetNode(), md); + } } else { exceptions.add(0, e); // last exceptions first diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index dc59574eecb..a10c93820af 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -45,6 +45,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.*; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; +import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.inject.Inject; @@ -65,6 +66,7 @@ import org.elasticsearch.index.translog.TranslogService; import org.elasticsearch.indices.IndicesLifecycle; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.recovery.RecoveryFileChunkRequest; +import org.elasticsearch.indices.recovery.RecoverySettings; import org.elasticsearch.indices.recovery.RecoveryTarget; import org.elasticsearch.monitor.fs.FsStats; import org.elasticsearch.snapshots.SnapshotState; @@ -94,7 +96,12 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { // we really need local GW here since this also checks for corruption etc. // and we need to make sure primaries are not just trashed if we don't have replicas .put(super.nodeSettings(nodeOrdinal)).put("gateway.type", "local") - .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()).build(); + .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()) + // speed up recoveries + .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_STREAMS, 10) + .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_SMALL_FILE_STREAMS, 10) + .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES, 5) + .build(); } /** @@ -322,7 +329,6 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { // This does corrupt files on the replica, so we can't check: .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) .put("index.routing.allocation.include._name", primariesNode.getNode().name()) - .put("indices.recovery.concurrent_streams", 10) .put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE) )); ensureGreen();