From 5ac07481eb2c65283d76da08ec7a927ba61b3ee0 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Sun, 17 May 2015 14:43:27 +0200 Subject: [PATCH] assign variables --- .../org/elasticsearch/gateway/GatewayAllocator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java b/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java index edd30b92909..9f326c7032f 100644 --- a/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java +++ b/src/main/java/org/elasticsearch/gateway/GatewayAllocator.java @@ -331,17 +331,18 @@ public class GatewayAllocator extends AbstractComponent { if (primaryNodeStore != null && primaryNodeStore.allocated()) { long sizeMatched = 0; + String primarySyncId = primaryNodeStore.syncId(); + String replicaSyncId = storeFilesMetaData.syncId(); // see if we have a sync id we can make use of - if (storeFilesMetaData.syncId() != null && storeFilesMetaData.syncId().equals(primaryNodeStore.syncId())) { - logger.trace("{}: node [{}] has same sync id {} as primary", shard, discoNode.name(), storeFilesMetaData.syncId()); + if (replicaSyncId != null && replicaSyncId.equals(primarySyncId)) { + logger.trace("{}: node [{}] has same sync id {} as primary", shard, discoNode.name(), replicaSyncId); lastNodeMatched = node; lastSizeMatched = Long.MAX_VALUE; lastDiscoNodeMatched = discoNode; } else { for (StoreFileMetaData storeFileMetaData : storeFilesMetaData) { - logger.trace("{}: node [{}] has file {}", - shard, discoNode.name(), storeFileMetaData.name()); - if (primaryNodeStore.fileExists(storeFileMetaData.name()) && primaryNodeStore.file(storeFileMetaData.name()).isSame(storeFileMetaData)) { + String metaDataFileName = storeFileMetaData.name(); + if (primaryNodeStore.fileExists(metaDataFileName) && primaryNodeStore.file(metaDataFileName).isSame(storeFileMetaData)) { sizeMatched += storeFileMetaData.length(); } }