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()); log.info("request params refreshed to version {}",requestParams.getZnodeVersion());
} }
} catch (KeeperException e) { } catch (KeeperException e) {
//todo handle properly throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
log.error("",e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
//todo handle properly Thread.currentThread().interrupt();
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
log.error("",e);
} }
} else if(requestParams == null) {
Object[] o = getMapAndVersion(loader, RequestParams.RESOURCE);
requestParams = new RequestParams((Map) o[0],(Integer)o[1]);
} }
return requestParams; return requestParams;
} }
@ -152,16 +154,17 @@ public class RequestParams implements MapSerializable{
return new Object[]{Collections.EMPTY_MAP, -1}; return new Object[]{Collections.EMPTY_MAP, -1};
} }
try {
int version = 0; //will be always 0 for file based resourceloader int version = 0; //will be always 0 for file based resourceloader
if (in instanceof ZkSolrResourceLoader.ZkByteArrayInputStream) { if (in instanceof ZkSolrResourceLoader.ZkByteArrayInputStream) {
version = ((ZkSolrResourceLoader.ZkByteArrayInputStream) in).getStat().getVersion(); version = ((ZkSolrResourceLoader.ZkByteArrayInputStream) in).getStat().getVersion();
log.info( "conf resource {} loaded . version : {} ", name,version); log.info( "conf resource {} loaded . version : {} ", name,version);
} }
try {
Map m = (Map) ObjectBuilder.getVal(new JSONParser(new InputStreamReader(in, StandardCharsets.UTF_8))); Map m = (Map) ObjectBuilder.getVal(new JSONParser(new InputStreamReader(in, StandardCharsets.UTF_8)));
return new Object[]{m,version}; return new Object[]{m,version};
} catch (Exception e) { } catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error reading conf resource "+name,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); log.info("config update listener called for core {}", coreName);
SolrZkClient zkClient = cc.getZkController().getZkClient(); SolrZkClient zkClient = cc.getZkController().getZkClient();
int solrConfigversion,overlayVersion, managedSchemaVersion=0; int solrConfigversion,overlayVersion, managedSchemaVersion=0;
SolrConfig cfg = null;
try (SolrCore core = cc.getCore(coreName)) { try (SolrCore core = cc.getCore(coreName)) {
if (core.isClosed()) return; if (core.isClosed()) return;
core.getSolrConfig().refreshRequestParams(); cfg = core.getSolrConfig();
solrConfigversion = core.getSolrConfig().getOverlay().getZnodeVersion(); solrConfigversion = core.getSolrConfig().getOverlay().getZnodeVersion();
overlayVersion = core.getSolrConfig().getZnodeVersion(); overlayVersion = core.getSolrConfig().getZnodeVersion();
if(managedSchmaResourcePath != null){ if(managedSchmaResourcePath != null){
@ -123,6 +124,9 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa
} }
} }
if(cfg != null){
cfg.refreshRequestParams();
}
if (checkStale(zkClient, overlayPath, solrConfigversion) || if (checkStale(zkClient, overlayPath, solrConfigversion) ||
checkStale(zkClient, solrConfigPath, overlayVersion) || checkStale(zkClient, solrConfigPath, overlayVersion) ||