tests: set request info on SyncStrategy for better logging

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1543205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-11-18 22:33:25 +00:00
parent 2115c05de9
commit d6e1114002
1 changed files with 22 additions and 10 deletions

View File

@ -43,6 +43,10 @@ import org.apache.solr.handler.component.HttpShardHandlerFactory;
import org.apache.solr.handler.component.ShardHandler;
import org.apache.solr.handler.component.ShardRequest;
import org.apache.solr.handler.component.ShardResponse;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrRequestInfo;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.update.PeerSync;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.slf4j.Logger;
@ -86,17 +90,25 @@ public class SyncStrategy {
if (SKIP_AUTO_RECOVERY) {
return true;
}
if (isClosed) {
log.warn("Closed, skipping sync up.");
return false;
boolean success;
SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
SolrQueryResponse rsp = new SolrQueryResponse();
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));
try {
if (isClosed) {
log.warn("Closed, skipping sync up.");
return false;
}
log.info("Sync replicas to " + ZkCoreNodeProps.getCoreUrl(leaderProps));
if (core.getUpdateHandler().getUpdateLog() == null) {
log.error("No UpdateLog found - cannot sync");
return false;
}
success = syncReplicas(zkController, core, leaderProps);
} finally {
SolrRequestInfo.clearRequestInfo();
}
log.info("Sync replicas to " + ZkCoreNodeProps.getCoreUrl(leaderProps));
if (core.getUpdateHandler().getUpdateLog() == null) {
log.error("No UpdateLog found - cannot sync");
return false;
}
boolean success = syncReplicas(zkController, core, leaderProps);
return success;
}