assign variables

This commit is contained in:
Britta Weber 2015-05-17 14:43:27 +02:00
parent 018ad0bd76
commit 5ac07481eb
1 changed files with 6 additions and 5 deletions

View File

@ -331,17 +331,18 @@ public class GatewayAllocator extends AbstractComponent {
if (primaryNodeStore != null && primaryNodeStore.allocated()) { if (primaryNodeStore != null && primaryNodeStore.allocated()) {
long sizeMatched = 0; long sizeMatched = 0;
String primarySyncId = primaryNodeStore.syncId();
String replicaSyncId = storeFilesMetaData.syncId();
// see if we have a sync id we can make use of // see if we have a sync id we can make use of
if (storeFilesMetaData.syncId() != null && storeFilesMetaData.syncId().equals(primaryNodeStore.syncId())) { if (replicaSyncId != null && replicaSyncId.equals(primarySyncId)) {
logger.trace("{}: node [{}] has same sync id {} as primary", shard, discoNode.name(), storeFilesMetaData.syncId()); logger.trace("{}: node [{}] has same sync id {} as primary", shard, discoNode.name(), replicaSyncId);
lastNodeMatched = node; lastNodeMatched = node;
lastSizeMatched = Long.MAX_VALUE; lastSizeMatched = Long.MAX_VALUE;
lastDiscoNodeMatched = discoNode; lastDiscoNodeMatched = discoNode;
} else { } else {
for (StoreFileMetaData storeFileMetaData : storeFilesMetaData) { for (StoreFileMetaData storeFileMetaData : storeFilesMetaData) {
logger.trace("{}: node [{}] has file {}", String metaDataFileName = storeFileMetaData.name();
shard, discoNode.name(), storeFileMetaData.name()); if (primaryNodeStore.fileExists(metaDataFileName) && primaryNodeStore.file(metaDataFileName).isSame(storeFileMetaData)) {
if (primaryNodeStore.fileExists(storeFileMetaData.name()) && primaryNodeStore.file(storeFileMetaData.name()).isSame(storeFileMetaData)) {
sizeMatched += storeFileMetaData.length(); sizeMatched += storeFileMetaData.length();
} }
} }