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:24:08 UTC
[lucene-solr] 17/17: Reverting all recent changes from Ishan
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 558f8ae1509b0c2929e32ba40353680306f7f2eb
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Thu Feb 11 00:41:20 2021 +0530
Reverting all recent changes from Ishan
---
.../src/java/org/apache/solr/cloud/Overseer.java | 22 +++-------------------
.../cloud/api/collections/CreateCollectionCmd.java | 8 +++-----
.../apache/solr/common/cloud/PerReplicaStates.java | 19 +------------------
3 files changed, 7 insertions(+), 42 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
index 9ec72a0..c08430a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
@@ -105,7 +105,7 @@ public class Overseer implements SolrCloseable {
enum LeaderStatus {DONT_KNOW, NO, YES}
- public class ClusterStateUpdater implements Runnable, Closeable {
+ private class ClusterStateUpdater implements Runnable, Closeable {
private final ZkStateReader reader;
private final SolrZkClient zkClient;
@@ -152,8 +152,6 @@ public class Overseer implements SolrCloseable {
return workQueue.getZkStats();
}
- Set<String> refreshCollections = Collections.synchronizedSet(new HashSet<String>());
-
@Override
public void run() {
MDCLoggingContext.setNode(zkController.getNodeName() );
@@ -171,7 +169,6 @@ public class Overseer implements SolrCloseable {
ZkStateWriter zkStateWriter = null;
ClusterState clusterState = null;
boolean refreshClusterState = true; // let's refresh in the first iteration
-
// we write updates in batch, but if an exception is thrown when writing new clusterstate,
// we do not sure which message is bad message, therefore we will re-process node one by one
int fallbackQueueSize = Integer.MAX_VALUE;
@@ -187,17 +184,9 @@ public class Overseer implements SolrCloseable {
}
//TODO consider removing 'refreshClusterState' and simply check if clusterState is null
- if (refreshClusterState || refreshCollections.size() != 0) {
+ if (refreshClusterState) {
try {
- if (refreshClusterState) {
- reader.forciblyRefreshAllClusterStateSlow();
- } else {
- Set<String> collectionsToRefresh = new HashSet<>(refreshCollections);
- for (String c: collectionsToRefresh) {
- reader.forceUpdateCollection(c);
- refreshCollections.remove(c);
- }
- }
+ reader.forciblyRefreshAllClusterStateSlow();
clusterState = reader.getClusterState();
zkStateWriter = new ZkStateWriter(reader, stats);
refreshClusterState = false;
@@ -316,11 +305,6 @@ public class Overseer implements SolrCloseable {
}
}
- // nocommit: javadocs
- public void refreshClusterState(String collection) {
- refreshCollections.add(collection);
- }
-
// Return true whenever the exception thrown by ZkStateWriter is correspond
// to a invalid state or 'bad' message (in this case, we should remove that message from queue)
private boolean isBadMessage(Exception e) {
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
index 9f44df8..b832825 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
@@ -18,6 +18,7 @@
package org.apache.solr.cloud.api.collections;
+import javax.print.Doc;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.nio.charset.StandardCharsets;
@@ -80,6 +81,7 @@ import org.apache.zookeeper.KeeperException.NoNodeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static java.util.Collections.singletonMap;
import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE;
import static org.apache.solr.common.cloud.ZkStateReader.NRT_REPLICAS;
import static org.apache.solr.common.cloud.ZkStateReader.PULL_REPLICAS;
@@ -335,11 +337,7 @@ public class CreateCollectionCmd implements OverseerCollectionMessageHandler.Cmd
throw new SolrException(ErrorCode.BAD_REQUEST, "Underlying core creation failed while creating collection: " + collectionName);
} else {
log.debug("Finished create command on all shards for collection: {}", collectionName);
- if (isPrs) {
- // Since we created this collection without some of the sub-operations going through the overseer queues,
- // we need to make sure that the cluster state in the overseer can see this collection upon refreshing itself
- ((Overseer.ClusterStateUpdater) ocmh.overseer.getUpdaterThread().getThread()).refreshClusterState(collectionName);
- }
+
// Emit a warning about production use of data driven functionality
boolean defaultConfigSetUsed = message.getStr(COLL_CONF) == null ||
message.getStr(COLL_CONF).equals(DEFAULT_CONFIGSET_NAME);
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
index 71c8c89..af4bb43 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/PerReplicaStates.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;
import org.apache.solr.cluster.api.SimpleMap;
@@ -68,8 +67,6 @@ public class PerReplicaStates implements ReflectMapWriter {
@JsonProperty
public final SimpleMap<State> states;
- private volatile AtomicBoolean allActive = null;
-
/**
* Construct with data read from ZK
* @param path path from where this is loaded
@@ -95,21 +92,7 @@ public class PerReplicaStates implements ReflectMapWriter {
}
- /**
- * Check and return if all replicas are ACTIVE
- */
- public boolean allActive() {
- if (this.allActive != null) return allActive.get();
- boolean[] result = new boolean[]{true};
- states.forEachEntry((r, s) -> {
- if (s.state != Replica.State.ACTIVE) result[0] = false;
- });
- this.allActive.set(result[0]);
- return this.allActive.get();
- }
-
- /**
- * Get the changed replicas
+ /**Get the changed replicas
*/
public static Set<String> findModifiedReplicas(PerReplicaStates old, PerReplicaStates fresh) {
Set<String> result = new HashSet<>();