You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2021/04/05 21:23:55 UTC
[lucene-solr] 04/17: NOCOMMIT: logging
This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch prs-perf-test
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 32046f01c01b21bf4dfbd1e033109a8ff0b6f3d2
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Fri Feb 5 16:03:33 2021 +0530
NOCOMMIT: logging
---
.../solr/cloud/overseer/ClusterStateMutator.java | 30 ++++++++++++++++++++++
.../apache/solr/cloud/overseer/ZkStateWriter.java | 25 ++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ClusterStateMutator.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ClusterStateMutator.java
index 906f935..4ab653e 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ClusterStateMutator.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ClusterStateMutator.java
@@ -55,24 +55,35 @@ public class ClusterStateMutator {
@SuppressWarnings({"unchecked"})
public ZkWriteCommand createCollection(ClusterState clusterState, ZkNodeProps message) {
String cName = message.getStr(NAME);
+
+ if ("coll192".equals(cName)) log.info("here 1");
+
log.debug("building a new cName: {}", cName);
if (clusterState.hasCollection(cName)) {
log.warn("Collection {} already exists. exit", cName);
return ZkStateWriter.NO_OP;
}
+ if ("coll192".equals(cName)) log.info("here 2");
+
Map<String, Object> routerSpec = DocRouter.getRouterSpec(message);
String routerName = routerSpec.get(NAME) == null ? DocRouter.DEFAULT_NAME : (String) routerSpec.get(NAME);
DocRouter router = DocRouter.getDocRouter(routerName);
+ if ("coll192".equals(cName)) log.info("here 3");
+
Object messageShardsObj = message.get("shards");
Map<String, Slice> slices;
if (messageShardsObj instanceof Map) { // we are being explicitly told the slice data (e.g. coll restore)
slices = Slice.loadAllFromMap(cName, (Map<String, Object>)messageShardsObj);
+ if ("coll192".equals(cName)) log.info("here 4");
+
} else {
List<String> shardNames = new ArrayList<>();
+ if ("coll192".equals(cName)) log.info("here 5");
+
if (router instanceof ImplicitDocRouter) {
getShardNames(shardNames, message.getStr("shards", DocRouter.DEFAULT_NAME));
} else {
@@ -81,6 +92,9 @@ public class ClusterStateMutator {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "numShards is a required parameter for 'compositeId' router");
getShardNames(numShards, shardNames);
}
+
+ if ("coll192".equals(cName)) log.info("here 6");
+
List<DocRouter.Range> ranges = router.partitionRange(shardNames.size(), router.fullRange());//maybe null
slices = new LinkedHashMap<>();
@@ -91,8 +105,16 @@ public class ClusterStateMutator {
sliceProps.put(Slice.RANGE, ranges == null ? null : ranges.get(i));
slices.put(sliceName, new Slice(sliceName, null, sliceProps,cName));
+ if ("coll192".equals(cName)) log.info("here 6.5");
+
}
+
+ if ("coll192".equals(cName)) log.info("here 7");
+
}
+
+ if ("coll192".equals(cName)) log.info("here 8");
+
Map<String, Object> collectionProps = new HashMap<>();
@@ -105,17 +127,25 @@ public class ClusterStateMutator {
}
collectionProps.put(DocCollection.DOC_ROUTER, routerSpec);
+ if ("coll192".equals(cName)) log.info("here 9");
+
if (message.getStr("fromApi") == null) {
collectionProps.put("autoCreated", "true");
}
+ if ("coll192".equals(cName)) log.info("here 10");
+
//TODO default to 2; but need to debug why BasicDistributedZk2Test fails early on
String znode = message.getInt(DocCollection.STATE_FORMAT, 1) == 1 ? null
: ZkStateReader.getCollectionPath(cName);
+ if ("coll192".equals(cName)) log.info("here 11");
+
DocCollection newCollection = new DocCollection(cName,
slices, collectionProps, router, -1, znode);
+ if ("coll192".equals(cName)) log.info("here 12");
+
return new ZkWriteCommand(cName, newCollection);
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
index e69dcbf..0a48754 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
@@ -221,8 +221,10 @@ public class ZkStateWriter {
}
if ((updates == this.updates)
&& !hasPendingUpdates()) {
+ log.info("WPU 1");
return clusterState;
}
+
Timer.Context timerContext = stats.time("update_state");
boolean success = false;
try {
@@ -232,18 +234,32 @@ public class ZkStateWriter {
String path = ZkStateReader.getCollectionPath(name);
ZkWriteCommand cmd = entry.getValue();
DocCollection c = cmd.collection;
+
+ if (c.getName().equals("coll192")) log.info("WPU 2");
if (cmd.ops != null && cmd.ops.isPreOp()) {
cmd.ops.persist(path, reader.getZkClient());
clusterState = clusterState.copyWith(name,
cmd.collection.copyWith(PerReplicaStates.fetch(cmd.collection.getZNode(), reader.getZkClient(), null)));
}
+
+ if (c.getName().equals("coll192")) log.info("WPU 3");
+
if (!cmd.persistCollState) continue;
+
+ if (c.getName().equals("coll192")) log.info("WPU 4");
+
if (c == null) {
// let's clean up the state.json of this collection only, the rest should be clean by delete collection cmd
log.debug("going to delete state.json {}", path);
reader.getZkClient().clean(path);
+
+ if (c.getName().equals("coll192")) log.info("WPU 5");
+
} else if (c.getStateFormat() > 1) {
+
+ if (c.getName().equals("coll192")) log.info("WPU 6");
+
byte[] data = Utils.toJSON(singletonMap(c.getName(), c));
if (reader.getZkClient().exists(path, true)) {
if (log.isDebugEnabled()) {
@@ -258,9 +274,15 @@ public class ZkStateWriter {
DocCollection newCollection = new DocCollection(name, c.getSlicesMap(), c.getProperties(), c.getRouter(), 0, path);
clusterState = clusterState.copyWith(name, newCollection);
}
+
+ if (c.getName().equals("coll192")) log.info("WPU 7");
+
} else if (c.getStateFormat() == 1) {
isClusterStateModified = true;
}
+
+ if (c.getName().equals("coll192")) log.info("WPU 8");
+
if (cmd.ops != null && !cmd.ops.isPreOp()) {
cmd.ops.persist(path, reader.getZkClient());
DocCollection currentCollState = clusterState.getCollection(cmd.name);
@@ -269,6 +291,9 @@ public class ZkStateWriter {
currentCollState.copyWith(PerReplicaStates.fetch(currentCollState.getZNode(), reader.getZkClient(), null)));
}
}
+
+ if (c.getName().equals("coll192")) log.info("WPU 9");
+
}
updates.clear();