mirror of https://github.com/apache/lucene.git
SOLR-12289: Add more MDC logging information to collection admin requests
This commit is contained in:
parent
67c13bbe2e
commit
84925ba9ab
|
@ -274,6 +274,8 @@ Other Changes
|
|||
|
||||
* SOLR-10036: Upgrade jackson from 2.5.4 to 2.9.5 (Shashank Pedamallu, Shawn Heisey, Varun Thacker)
|
||||
|
||||
* SOLR-12289: Add more MDC logging information to collection admin requests (Varun Thacker)
|
||||
|
||||
================== 7.3.1 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -35,11 +35,11 @@ import com.google.common.collect.ImmutableMap;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.solr.client.solrj.SolrResponse;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.cloud.DistribStateManager;
|
||||
import org.apache.solr.client.solrj.cloud.DistributedQueue;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.AlreadyExistsException;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.BadVersionException;
|
||||
import org.apache.solr.client.solrj.cloud.DistribStateManager;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient.RemoteSolrException;
|
||||
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
|
||||
|
@ -83,6 +83,7 @@ import org.apache.solr.handler.component.ShardHandler;
|
|||
import org.apache.solr.handler.component.ShardHandlerFactory;
|
||||
import org.apache.solr.handler.component.ShardRequest;
|
||||
import org.apache.solr.handler.component.ShardResponse;
|
||||
import org.apache.solr.logging.MDCLoggingContext;
|
||||
import org.apache.solr.util.DefaultSolrThreadFactory;
|
||||
import org.apache.solr.util.RTimer;
|
||||
import org.apache.solr.util.TimeOut;
|
||||
|
@ -103,6 +104,7 @@ import static org.apache.solr.common.cloud.ZkStateReader.PROPERTY_VALUE_PROP;
|
|||
import static org.apache.solr.common.cloud.ZkStateReader.REJOIN_AT_HEAD_PROP;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.REPLICA_PROP;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SHARD_ID_PROP;
|
||||
import static org.apache.solr.common.params.CollectionAdminParams.COLLECTION;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.*;
|
||||
import static org.apache.solr.common.params.CommonAdminParams.ASYNC;
|
||||
import static org.apache.solr.common.params.CommonParams.NAME;
|
||||
|
@ -242,6 +244,9 @@ public class OverseerCollectionMessageHandler implements OverseerMessageHandler,
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public SolrResponse processMessage(ZkNodeProps message, String operation) {
|
||||
MDCLoggingContext.setCollection(message.getStr(COLLECTION));
|
||||
MDCLoggingContext.setShard(message.getStr(SHARD_ID_PROP));
|
||||
MDCLoggingContext.setReplica(message.getStr(REPLICA_PROP));
|
||||
log.debug("OverseerCollectionMessageHandler.processMessage : {} , {}", operation, message);
|
||||
|
||||
NamedList results = new NamedList();
|
||||
|
|
|
@ -84,6 +84,7 @@ import org.apache.solr.core.backup.repository.BackupRepository;
|
|||
import org.apache.solr.core.snapshots.CollectionSnapshotMetaData;
|
||||
import org.apache.solr.core.snapshots.SolrSnapshotManager;
|
||||
import org.apache.solr.handler.RequestHandlerBase;
|
||||
import org.apache.solr.logging.MDCLoggingContext;
|
||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
|
@ -132,6 +133,7 @@ import static org.apache.solr.common.cloud.ZkStateReader.REPLICA_PROP;
|
|||
import static org.apache.solr.common.cloud.ZkStateReader.REPLICA_TYPE;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SHARD_ID_PROP;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.TLOG_REPLICAS;
|
||||
import static org.apache.solr.common.params.CollectionAdminParams.COLLECTION;
|
||||
import static org.apache.solr.common.params.CollectionAdminParams.COUNT_PROP;
|
||||
import static org.apache.solr.common.params.CollectionAdminParams.PROPERTY_NAME;
|
||||
import static org.apache.solr.common.params.CollectionAdminParams.PROPERTY_VALUE;
|
||||
|
@ -226,7 +228,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
|
|||
}
|
||||
CollectionOperation operation = CollectionOperation.get(action);
|
||||
log.info("Invoked Collection Action :{} with params {} and sendToOCPQueue={}", action.toLower(), req.getParamString(), operation.sendToOCPQueue);
|
||||
|
||||
MDCLoggingContext.setCollection(req.getParams().get(COLLECTION));
|
||||
invokeAction(req, rsp, cores, action, operation);
|
||||
} else {
|
||||
throw new SolrException(ErrorCode.BAD_REQUEST, "action is a required param");
|
||||
|
|
|
@ -45,7 +45,7 @@ public class MDCLoggingContext {
|
|||
}
|
||||
});
|
||||
|
||||
private static void setCollection(String collection) {
|
||||
public static void setCollection(String collection) {
|
||||
if (collection != null) {
|
||||
MDC.put(COLLECTION_PROP, "c:" + collection);
|
||||
} else {
|
||||
|
@ -53,7 +53,7 @@ public class MDCLoggingContext {
|
|||
}
|
||||
}
|
||||
|
||||
private static void setShard(String shard) {
|
||||
public static void setShard(String shard) {
|
||||
if (shard != null) {
|
||||
MDC.put(SHARD_ID_PROP, "s:" + shard);
|
||||
} else {
|
||||
|
@ -61,7 +61,7 @@ public class MDCLoggingContext {
|
|||
}
|
||||
}
|
||||
|
||||
private static void setReplica(String replica) {
|
||||
public static void setReplica(String replica) {
|
||||
if (replica != null) {
|
||||
MDC.put(REPLICA_PROP, "r:" + replica);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue