git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1647829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2014-12-24 18:50:31 +00:00
parent 007a6a1610
commit ed0f198480
2 changed files with 16 additions and 9 deletions

View File

@ -129,15 +129,17 @@ public class RequestParams implements MapSerializable{
log.info("request params refreshed to version {}",requestParams.getZnodeVersion());
}
} catch (KeeperException e) {
//todo handle properly
log.error("",e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} catch (InterruptedException e) {
//todo handle properly
log.error("",e);
Thread.currentThread().interrupt();
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
} else if(requestParams == null) {
Object[] o = getMapAndVersion(loader, RequestParams.RESOURCE);
requestParams = new RequestParams((Map) o[0],(Integer)o[1]);
}
return requestParams;
}
@ -152,16 +154,17 @@ public class RequestParams implements MapSerializable{
return new Object[]{Collections.EMPTY_MAP, -1};
}
try {
int version = 0; //will be always 0 for file based resourceloader
if (in instanceof ZkSolrResourceLoader.ZkByteArrayInputStream) {
version = ((ZkSolrResourceLoader.ZkByteArrayInputStream) in).getStat().getVersion();
log.info( "conf resource {} loaded . version : {} ", name,version);
}
try {
Map m = (Map) ObjectBuilder.getVal(new JSONParser(new InputStreamReader(in, StandardCharsets.UTF_8)));
return new Object[]{m,version};
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error reading conf resource "+name,e);
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error parsing conf resource "+name,e);
}
}

View File

@ -113,9 +113,10 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa
log.info("config update listener called for core {}", coreName);
SolrZkClient zkClient = cc.getZkController().getZkClient();
int solrConfigversion,overlayVersion, managedSchemaVersion=0;
SolrConfig cfg = null;
try (SolrCore core = cc.getCore(coreName)) {
if (core.isClosed()) return;
core.getSolrConfig().refreshRequestParams();
cfg = core.getSolrConfig();
solrConfigversion = core.getSolrConfig().getOverlay().getZnodeVersion();
overlayVersion = core.getSolrConfig().getZnodeVersion();
if(managedSchmaResourcePath != null){
@ -123,6 +124,9 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa
}
}
if(cfg != null){
cfg.refreshRequestParams();
}
if (checkStale(zkClient, overlayPath, solrConfigversion) ||
checkStale(zkClient, solrConfigPath, overlayVersion) ||