SOLR-6476

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1628747 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2014-10-01 15:58:15 +00:00
parent 041ea20853
commit c48f927d10
1 changed files with 4 additions and 5 deletions

View File

@ -39,6 +39,7 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit;
import static java.util.Collections.EMPTY_LIST; import static java.util.Collections.EMPTY_LIST;
import static java.util.Collections.EMPTY_MAP; import static java.util.Collections.EMPTY_MAP;
@ -156,15 +157,13 @@ public class SchemaManager {
String collection = cd.getCollectionName(); String collection = cd.getCollectionName();
if (collection != null) { if (collection != null) {
ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) managedIndexSchema.getResourceLoader(); ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) managedIndexSchema.getResourceLoader();
long timeLeftSecs1 = timeout - ((System.nanoTime() - startTime) /1000000); long timeLeftSecs = timeout - TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
int secsLeft = (int) (timeLeftSecs1 > 0 ? timeLeftSecs1 : -1); if(timeLeftSecs<=0) throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Not enough time left to update replicas. However the schema is updated already");
if(secsLeft<=0) throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Not enough time left to update replicas. However the schema is updated already");
long timeLeftSecs = timeout - ((System.nanoTime() - startTime) /1000000);
ManagedIndexSchema.waitForSchemaZkVersionAgreement(collection, ManagedIndexSchema.waitForSchemaZkVersionAgreement(collection,
cd.getCloudDescriptor().getCoreNodeName(), cd.getCloudDescriptor().getCoreNodeName(),
(managedIndexSchema).getSchemaZkVersion(), (managedIndexSchema).getSchemaZkVersion(),
zkLoader.getZkController(), zkLoader.getZkController(),
(int) (timeLeftSecs > 0 ? timeLeftSecs : -1)); (int) timeLeftSecs);
} }
} }