Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecoveryID should not be a per JVM but per Node #6207

Merged
merged 1 commit into from May 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -69,6 +69,7 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;

import static com.google.common.collect.Maps.newHashMap;
import static org.elasticsearch.ExceptionsHelper.detailedMessage;
Expand Down Expand Up @@ -108,6 +109,7 @@ static class FailedShard {
private final FailedEngineHandler failedEngineHandler = new FailedEngineHandler();

private final boolean sendRefreshMapping;
private final AtomicLong recoveryIdGenerator = new AtomicLong();

@Inject
public IndicesClusterStateService(Settings settings, IndicesService indicesService, ClusterService clusterService,
Expand Down Expand Up @@ -711,7 +713,7 @@ private void applyInitializingShard(final RoutingTable routingTable, final Disco

RecoveryState.Type type = shardRouting.primary() ? RecoveryState.Type.RELOCATION : RecoveryState.Type.REPLICA;
final StartRecoveryRequest request = new StartRecoveryRequest(indexShard.shardId(), sourceNode, nodes.localNode(),
false, indexShard.store().list(), type);
false, indexShard.store().list(), type, recoveryIdGenerator.incrementAndGet());
recoveryTarget.startRecovery(request, indexShard, new PeerRecoveryListener(request, shardRouting, indexService, indexMetaData));

} catch (Throwable e) {
Expand Down
Expand Up @@ -36,8 +36,6 @@
*/
public class StartRecoveryRequest extends TransportRequest {

private static final AtomicLong recoveryIdGenerator = new AtomicLong();

private long recoveryId;

private ShardId shardId;
Expand Down Expand Up @@ -65,8 +63,8 @@ public class StartRecoveryRequest extends TransportRequest {
* @param existingFiles
*/
public StartRecoveryRequest(ShardId shardId, DiscoveryNode sourceNode, DiscoveryNode targetNode, boolean markAsRelocated, Map<String,
StoreFileMetaData> existingFiles, RecoveryState.Type recoveryType) {
this.recoveryId = recoveryIdGenerator.incrementAndGet();
StoreFileMetaData> existingFiles, RecoveryState.Type recoveryType, long recoveryId) {
this.recoveryId = recoveryId;
this.shardId = shardId;
this.sourceNode = sourceNode;
this.targetNode = targetNode;
Expand Down