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.ShardHandler;
import org.apache.solr.handler.component.ShardRequest; import org.apache.solr.handler.component.ShardRequest;
import org.apache.solr.handler.component.ShardResponse; 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.update.PeerSync;
import org.apache.solr.util.DefaultSolrThreadFactory; import org.apache.solr.util.DefaultSolrThreadFactory;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -86,6 +90,11 @@ public class SyncStrategy {
if (SKIP_AUTO_RECOVERY) { if (SKIP_AUTO_RECOVERY) {
return true; return true;
} }
boolean success;
SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
SolrQueryResponse rsp = new SolrQueryResponse();
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));
try {
if (isClosed) { if (isClosed) {
log.warn("Closed, skipping sync up."); log.warn("Closed, skipping sync up.");
return false; return false;
@ -96,7 +105,10 @@ public class SyncStrategy {
log.error("No UpdateLog found - cannot sync"); log.error("No UpdateLog found - cannot sync");
return false; return false;
} }
boolean success = syncReplicas(zkController, core, leaderProps); success = syncReplicas(zkController, core, leaderProps);
} finally {
SolrRequestInfo.clearRequestInfo();
}
return success; return success;
} }