Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16116: Remove retryOnConnLoss parameter (#3969)

Pierre Salagnacce5c733968bf
diff --git a/changelog/unreleased/SOLR-16116-remove-retryOnConnLoss.yml b/changelog/unreleased/SOLR-16116-remove-retryOnConnLoss.yml
new file mode 100644
index 00000000000..fe3bb06bd12
--- /dev/null
+++ b/changelog/unreleased/SOLR-16116-remove-retryOnConnLoss.yml
@@ -0,0 +1,8 @@
+title: Remove parameter retryOnConnLoss everywhere from the codebase. This parameter
+ was already fully ignored since the move to Curator.
+type: removed
+authors:
+ - name: Pierre Salagnac
+links:
+ - name: SOLR-16116
+ url: https://issues.apache.org/jira/browse/SOLR-16116
diff --git a/solr/core/src/java/org/apache/solr/api/ZkClusterPluginsSource.java b/solr/core/src/java/org/apache/solr/api/ZkClusterPluginsSource.java
index 6d2972d29ba..3249de3e9b9 100644
--- a/solr/core/src/java/org/apache/solr/api/ZkClusterPluginsSource.java
+++ b/solr/core/src/java/org/apache/solr/api/ZkClusterPluginsSource.java
@@ -71,7 +71,7 @@ public class ZkClusterPluginsSource implements ClusterPluginsSource {
try {
Map<String, Object> clusterPropsJson =
(Map<String, Object>)
- Utils.fromJSON(zkClient.getData(ZkStateReader.CLUSTER_PROPS, null, new Stat(), true));
+ Utils.fromJSON(zkClient.getData(ZkStateReader.CLUSTER_PROPS, null, new Stat()));
return Map.copyOf(
(Map<String, Object>)
clusterPropsJson.computeIfAbsent(
diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java
index 3aacd4b9758..642411808fd 100644
--- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java
@@ -249,7 +249,7 @@ public class AuthTool extends ToolBase {
if (!updateIncludeFileOnly) {
echoIfVerbose("Uploading following security.json: " + securityJson);
try (SolrZkClient zkClient = CLIUtils.getSolrZkClient(cli, zkHost)) {
- zkClient.setData("/security.json", securityJson.getBytes(StandardCharsets.UTF_8), true);
+ zkClient.setData("/security.json", securityJson.getBytes(StandardCharsets.UTF_8));
}
}
@@ -309,8 +309,8 @@ public class AuthTool extends ToolBase {
private void checkSecurityJsonExists(SolrZkClient zkClient)
throws KeeperException, InterruptedException {
- if (zkClient.exists("/security.json", true)) {
- byte[] oldSecurityBytes = zkClient.getData("/security.json", null, null, true);
+ if (zkClient.exists("/security.json")) {
+ byte[] oldSecurityBytes = zkClient.getData("/security.json", null, null);
if (!"{}".equals(new String(oldSecurityBytes, StandardCharsets.UTF_8).trim())) {
CLIO.out(
"Security is already enabled. You can disable it with 'bin/solr auth disable'. Existing security.json: \n"
@@ -332,7 +332,7 @@ public class AuthTool extends ToolBase {
echoIfVerbose("Uploading following security.json: {}");
try (SolrZkClient zkClient = CLIUtils.getSolrZkClient(cli, zkHost)) {
- zkClient.setData("/security.json", "{}".getBytes(StandardCharsets.UTF_8), true);
+ zkClient.setData("/security.json", "{}".getBytes(StandardCharsets.UTF_8));
}
}
}
diff --git a/solr/core/src/java/org/apache/solr/cli/CreateTool.java b/solr/core/src/java/org/apache/solr/cli/CreateTool.java
index d18d2e0c40e..0226471cd13 100644
--- a/solr/core/src/java/org/apache/solr/cli/CreateTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/CreateTool.java
@@ -248,9 +248,7 @@ public class CreateTool extends ToolBase {
boolean configExistsInZk =
confName != null
&& !confName.trim().isEmpty()
- && ZkStateReader.from(cloudSolrClient)
- .getZkClient()
- .exists("/configs/" + confName, true);
+ && ZkStateReader.from(cloudSolrClient).getZkClient().exists("/configs/" + confName);
if (configExistsInZk) {
echo("Re-using existing configuration directory " + confName);
diff --git a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java
index a3d4e513649..dc0a4076e59 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java
@@ -79,7 +79,7 @@ public class ZkMkrootTool extends ToolBase {
echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...");
echo("Creating ZooKeeper path " + znode + " on ZooKeeper at " + zkHost);
- zkClient.makePath(znode, failOnExists, true);
+ zkClient.makePath(znode, failOnExists);
} catch (Exception e) {
log.error("Could not complete mkroot operation for reason: ", e);
throw (e);
diff --git a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java
index 126286d9c2f..64155413e0a 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java
@@ -67,7 +67,7 @@ public class ZkRmTool extends ToolBase {
}
echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...");
try (SolrZkClient zkClient = CLIUtils.getSolrZkClient(cli, zkHost)) {
- if (!recursive && zkClient.getChildren(znode, null, true).size() != 0) {
+ if (!recursive && zkClient.getChildren(znode, null).size() != 0) {
throw new SolrServerException(
"ZooKeeper node " + znode + " has children and recursive has NOT been specified.");
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
index e1fc0e3e456..7b3300379e9 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
@@ -129,10 +129,10 @@ public class CloudUtil {
public static Map<String, byte[]> getTrustedKeys(SolrZkClient zk, String dir) {
Map<String, byte[]> result = new HashMap<>();
try {
- List<String> children = zk.getChildren("/keys/" + dir, null, true);
+ List<String> children = zk.getChildren("/keys/" + dir, null);
for (String key : children) {
if (key.endsWith(".der"))
- result.put(key, zk.getData("/keys/" + dir + "/" + key, null, null, true));
+ result.put(key, zk.getData("/keys/" + dir + "/" + key, null, null));
}
} catch (KeeperException.NoNodeException e) {
log.info("Error fetching key names");
diff --git a/solr/core/src/java/org/apache/solr/cloud/DistributedApiAsyncTracker.java b/solr/core/src/java/org/apache/solr/cloud/DistributedApiAsyncTracker.java
index c41244aace9..242c5d9a198 100644
--- a/solr/core/src/java/org/apache/solr/cloud/DistributedApiAsyncTracker.java
+++ b/solr/core/src/java/org/apache/solr/cloud/DistributedApiAsyncTracker.java
@@ -323,8 +323,8 @@ public class DistributedApiAsyncTracker {
this.rootNodePath = rootNodePath;
try {
- if (!zkClient.exists(rootNodePath, true)) {
- zkClient.makePath(rootNodePath, new byte[0], CreateMode.PERSISTENT, true);
+ if (!zkClient.exists(rootNodePath)) {
+ zkClient.makePath(rootNodePath, new byte[0], CreateMode.PERSISTENT);
}
} catch (KeeperException.NodeExistsException nee) {
// Some other thread (on this or another JVM) beat us to create the node, that's ok, the
@@ -341,27 +341,25 @@ public class DistributedApiAsyncTracker {
zkClient.create(
getPath(asyncId),
State.SUBMITTED.shorthand.getBytes(StandardCharsets.UTF_8),
- CreateMode.EPHEMERAL,
- true);
+ CreateMode.EPHEMERAL);
}
void setTaskRunning(String asyncId) throws KeeperException, InterruptedException {
- zkClient.setData(
- getPath(asyncId), State.RUNNING.shorthand.getBytes(StandardCharsets.UTF_8), true);
+ zkClient.setData(getPath(asyncId), State.RUNNING.shorthand.getBytes(StandardCharsets.UTF_8));
}
void deleteInFlightTask(String asyncId) throws KeeperException, InterruptedException {
- zkClient.delete(getPath(asyncId), -1, true);
+ zkClient.delete(getPath(asyncId), -1);
}
State getInFlightState(String asyncId) throws KeeperException, InterruptedException {
- if (!zkClient.exists(getPath(asyncId), true)) {
+ if (!zkClient.exists(getPath(asyncId))) {
return State.NOT_FOUND;
}
final byte[] bytes;
try {
- bytes = zkClient.getData(getPath(asyncId), null, null, true);
+ bytes = zkClient.getData(getPath(asyncId), null, null);
} catch (KeeperException.NoNodeException nne) {
// Unlikely race, but not impossible...
if (log.isInfoEnabled()) {
diff --git a/solr/core/src/java/org/apache/solr/cloud/DistributedClusterStateUpdater.java b/solr/core/src/java/org/apache/solr/cloud/DistributedClusterStateUpdater.java
index ad838d3e562..f64b71dba04 100644
--- a/solr/core/src/java/org/apache/solr/cloud/DistributedClusterStateUpdater.java
+++ b/solr/core/src/java/org/apache/solr/cloud/DistributedClusterStateUpdater.java
@@ -552,7 +552,7 @@ public class DistributedClusterStateUpdater {
if (updater.isCollectionCreation()) {
// The state.json file does not exist yet (more precisely it is assumed not to exist)
log.debug("going to create collection {}", jsonPath);
- zkStateReader.getZkClient().create(jsonPath, stateJson, CreateMode.PERSISTENT, true);
+ zkStateReader.getZkClient().create(jsonPath, stateJson, CreateMode.PERSISTENT);
} else {
// We're updating an existing state.json
if (log.isDebugEnabled()) {
@@ -561,9 +561,7 @@ public class DistributedClusterStateUpdater {
jsonPath,
collection.getZNodeVersion());
}
- zkStateReader
- .getZkClient()
- .setData(jsonPath, stateJson, collection.getZNodeVersion(), true);
+ zkStateReader.getZkClient().setData(jsonPath, stateJson, collection.getZNodeVersion());
}
}
}
@@ -577,7 +575,7 @@ public class DistributedClusterStateUpdater {
private ClusterState fetchStateForCollection() throws KeeperException, InterruptedException {
String collectionStatePath = DocCollection.getCollectionPath(updater.getCollectionName());
Stat stat = new Stat();
- byte[] data = zkStateReader.getZkClient().getData(collectionStatePath, null, stat, true);
+ byte[] data = zkStateReader.getZkClient().getData(collectionStatePath, null, stat);
// This factory method can detect a missing configName and supply it by reading it from the
// old ZK location.
@@ -890,7 +888,7 @@ public class DistributedClusterStateUpdater {
try {
final List<String> collectionNames =
- zkStateReader.getZkClient().getChildren(COLLECTIONS_ZKNODE, null, true);
+ zkStateReader.getZkClient().getChildren(COLLECTIONS_ZKNODE, null);
// Collections are totally independent of each other. Multiple threads could share the load
// here (need a ZK connection for each though).
diff --git a/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java b/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
index fb2347c3e82..532a782825b 100644
--- a/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
+++ b/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
@@ -68,8 +68,7 @@ public class DistributedMap {
public void put(String trackingId, byte[] data) throws KeeperException, InterruptedException {
assertKeyFormat(trackingId);
- zookeeper.makePath(
- dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, false, true);
+ zookeeper.makePath(dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, false);
}
/**
@@ -81,8 +80,7 @@ public class DistributedMap {
throws KeeperException, InterruptedException {
assertKeyFormat(trackingId);
try {
- zookeeper.makePath(
- dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, true, true);
+ zookeeper.makePath(dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, true);
return true;
} catch (NodeExistsException e) {
return false;
@@ -90,16 +88,16 @@ public class DistributedMap {
}
public byte[] get(String trackingId) throws KeeperException, InterruptedException {
- return zookeeper.getData(dir + "/" + PREFIX + trackingId, null, null, true);
+ return zookeeper.getData(dir + "/" + PREFIX + trackingId, null, null);
}
public boolean contains(String trackingId) throws KeeperException, InterruptedException {
- return zookeeper.exists(dir + "/" + PREFIX + trackingId, true);
+ return zookeeper.exists(dir + "/" + PREFIX + trackingId);
}
public int size() throws KeeperException, InterruptedException {
Stat stat = new Stat();
- zookeeper.getData(dir, null, stat, true);
+ zookeeper.getData(dir, null, stat);
return stat.getNumChildren();
}
@@ -110,7 +108,7 @@ public class DistributedMap {
public boolean remove(String trackingId) throws KeeperException, InterruptedException {
final var path = dir + "/" + PREFIX + trackingId;
try {
- zookeeper.delete(path, -1, true);
+ zookeeper.delete(path, -1);
} catch (KeeperException.NoNodeException e) {
return false;
} catch (KeeperException.NotEmptyException hack) {
@@ -123,15 +121,15 @@ public class DistributedMap {
/** Helper method to clear all child nodes for a parent node. */
public void clear() throws KeeperException, InterruptedException {
- List<String> childNames = zookeeper.getChildren(dir, null, true);
+ List<String> childNames = zookeeper.getChildren(dir, null);
for (String childName : childNames) {
- zookeeper.delete(dir + "/" + childName, -1, true);
+ zookeeper.delete(dir + "/" + childName, -1);
}
}
/** Returns the keys of all the elements in the map */
public Collection<String> keys() throws KeeperException, InterruptedException {
- List<String> childs = zookeeper.getChildren(dir, null, true);
+ List<String> childs = zookeeper.getChildren(dir, null);
final List<String> ids = new ArrayList<>(childs.size());
childs.stream().forEach((child) -> ids.add(child.substring(PREFIX.length())));
return ids;
diff --git a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
index b97681423cd..7ac0b7175b0 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
@@ -55,7 +55,7 @@ public abstract class ElectionContext implements Closeable {
if (leaderSeqPath != null) {
try {
log.debug("Canceling election {}", leaderSeqPath);
- zkClient.delete(leaderSeqPath, -1, true);
+ zkClient.delete(leaderSeqPath, -1);
} catch (NoNodeException e) {
// fine
log.debug("cancelElection did not find election node to remove {}", leaderSeqPath);
diff --git a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
index f058aefe295..b2ed8c27a3a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
@@ -94,7 +94,7 @@ public class LeaderElector {
context.checkIfIamLeaderFired();
// get all other numbers...
final String holdElectionPath = context.electionPath + ELECTION_NODE;
- List<String> seqs = zkClient.getChildren(holdElectionPath, null, true);
+ List<String> seqs = zkClient.getChildren(holdElectionPath, null);
sortSeqs(seqs);
String leaderSeqNodeName =
@@ -114,7 +114,7 @@ public class LeaderElector {
try {
String toDelete = holdElectionPath + "/" + elec;
log.warn("Deleting duplicate registration: {}", toDelete);
- zkClient.delete(toDelete, -1, true);
+ zkClient.delete(toDelete, -1);
} catch (KeeperException.NoNodeException e) {
// ignore
}
@@ -148,8 +148,7 @@ public class LeaderElector {
watcher =
new ElectionWatcher(
context.leaderSeqPath, watchedNode, getSeq(context.leaderSeqPath), context),
- null,
- true);
+ null);
log.debug("Watching path {} to know if I could be the leader", watchedNode);
} catch (KeeperException.SessionExpiredException e) {
throw e;
@@ -240,10 +239,7 @@ public class LeaderElector {
if (nodes.size() < 2) {
leaderSeqPath =
zkClient.create(
- shardsElectZkPath + "/" + id + "-n_",
- null,
- CreateMode.EPHEMERAL_SEQUENTIAL,
- false);
+ shardsElectZkPath + "/" + id + "-n_", null, CreateMode.EPHEMERAL_SEQUENTIAL);
} else {
String firstInLine = nodes.get(1);
log.debug("The current head: {}", firstInLine);
@@ -252,15 +248,12 @@ public class LeaderElector {
throw new IllegalStateException("Could not find regex match in:" + firstInLine);
}
leaderSeqPath = shardsElectZkPath + "/" + id + "-n_" + m.group(1);
- zkClient.create(leaderSeqPath, null, CreateMode.EPHEMERAL, false);
+ zkClient.create(leaderSeqPath, null, CreateMode.EPHEMERAL);
}
} else {
leaderSeqPath =
zkClient.create(
- shardsElectZkPath + "/" + id + "-n_",
- null,
- CreateMode.EPHEMERAL_SEQUENTIAL,
- false);
+ shardsElectZkPath + "/" + id + "-n_", null, CreateMode.EPHEMERAL_SEQUENTIAL);
}
log.debug("Joined leadership election with path: {}", leaderSeqPath);
@@ -268,7 +261,7 @@ public class LeaderElector {
cont = false;
} catch (ConnectionLossException e) {
// we don't know if we made our node or not...
- List<String> entries = zkClient.getChildren(shardsElectZkPath, null, true);
+ List<String> entries = zkClient.getChildren(shardsElectZkPath, null);
boolean foundId = false;
for (String entry : entries) {
@@ -336,7 +329,7 @@ public class LeaderElector {
if (canceled) {
log.debug("This watcher is not active anymore {}", myNode);
try {
- zkClient.delete(myNode, -1, true);
+ zkClient.delete(myNode, -1);
} catch (KeeperException.NoNodeException nne) {
// expected . don't do anything
} catch (Exception e) {
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 f67d358b6ab..f0bb938a220 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
@@ -465,7 +465,7 @@ public class Overseer implements SolrCloseable {
final String path = OVERSEER_ELECT + "/leader";
byte[] data;
try {
- data = zkClient.getData(path, null, stat, true);
+ data = zkClient.getData(path, null, stat);
} catch (IllegalStateException | KeeperException.NoNodeException e) {
return;
} catch (Exception e) {
@@ -480,7 +480,7 @@ public class Overseer implements SolrCloseable {
log.warn(
"I (id={}) am exiting, but I'm still the leader",
overseerCollectionConfigSetProcessor.getId());
- zkClient.delete(path, stat.getVersion(), true);
+ zkClient.delete(path, stat.getVersion());
} catch (KeeperException.BadVersionException e) {
// no problem ignore it some other Overseer has already taken over
} catch (Exception e) {
@@ -602,7 +602,7 @@ public class Overseer implements SolrCloseable {
String propsId = null;
try {
ZkNodeProps props =
- ZkNodeProps.load(zkClient.getData(OVERSEER_ELECT + "/leader", null, null, true));
+ ZkNodeProps.load(zkClient.getData(OVERSEER_ELECT + "/leader", null, null));
propsId = props.getStr(ID);
if (myId.equals(propsId)) {
return LeaderStatus.YES;
@@ -1027,7 +1027,7 @@ public class Overseer implements SolrCloseable {
private void createOverseerNode(final SolrZkClient zkClient) {
try {
- zkClient.create("/overseer", new byte[0], CreateMode.PERSISTENT, true);
+ zkClient.create("/overseer", new byte[0], CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException e) {
// ok
} catch (InterruptedException e) {
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/OverseerElectionContext.java
index 8eb8a6d1386..270d746bc4e 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerElectionContext.java
@@ -62,7 +62,7 @@ final class OverseerElectionContext extends ElectionContext {
final String id = leaderSeqPath.substring(leaderSeqPath.lastIndexOf('/') + 1);
ZkNodeProps myProps = new ZkNodeProps(ID, id);
- zkClient.makePath(leaderPath, Utils.toJSON(myProps), CreateMode.EPHEMERAL, true);
+ zkClient.makePath(leaderPath, Utils.toJSON(myProps), CreateMode.EPHEMERAL);
if (pauseBeforeStartMs > 0) {
try {
Thread.sleep(pauseBeforeStartMs);
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerNodePrioritizer.java b/solr/core/src/java/org/apache/solr/cloud/OverseerNodePrioritizer.java
index 63dca3f1c61..0e1a0acd58e 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerNodePrioritizer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerNodePrioritizer.java
@@ -67,9 +67,8 @@ public class OverseerNodePrioritizer {
public synchronized void prioritizeOverseerNodes(String overseerId) throws Exception {
SolrZkClient zk = zkStateReader.getZkClient();
List<String> overseerDesignates = new ArrayList<>();
- if (zk.exists(ZkStateReader.ROLES, true)) {
- Map<?, ?> m =
- (Map<?, ?>) Utils.fromJSON(zk.getData(ZkStateReader.ROLES, null, new Stat(), true));
+ if (zk.exists(ZkStateReader.ROLES)) {
+ Map<?, ?> m = (Map<?, ?>) Utils.fromJSON(zk.getData(ZkStateReader.ROLES, null, new Stat()));
@SuppressWarnings("unchecked")
List<String> l = (List<String>) m.get("overseer");
if (l != null) {
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
index 150d8e8f0ac..f1fe3c696f9 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
@@ -446,7 +446,7 @@ public class OverseerTaskProcessor implements SolrInfoBean, Runnable, Closeable
public static List<String> getSortedElectionNodes(SolrZkClient zk, String path)
throws KeeperException, InterruptedException {
- List<String> children = zk.getChildren(path, null, true);
+ List<String> children = zk.getChildren(path, null);
LeaderElector.sortSeqs(children);
return children;
}
@@ -461,7 +461,7 @@ public class OverseerTaskProcessor implements SolrInfoBean, Runnable, Closeable
throws KeeperException, InterruptedException {
byte[] data = null;
try {
- data = zkClient.getData(Overseer.OVERSEER_ELECT + "/leader", null, new Stat(), true);
+ data = zkClient.getData(Overseer.OVERSEER_ELECT + "/leader", null, new Stat());
} catch (KeeperException.NoNodeException e) {
return null;
}
@@ -477,9 +477,7 @@ public class OverseerTaskProcessor implements SolrInfoBean, Runnable, Closeable
try {
ZkNodeProps props =
ZkNodeProps.load(
- zkStateReader
- .getZkClient()
- .getData(Overseer.OVERSEER_ELECT + "/leader", null, null, true));
+ zkStateReader.getZkClient().getData(Overseer.OVERSEER_ELECT + "/leader", null, null));
propsId = props.getStr(ID);
if (myId.equals(propsId)) {
return LeaderStatus.YES;
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
index 04da2d16ab1..535c233bf07 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
@@ -77,12 +77,12 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
public boolean containsTaskWithRequestId(String requestIdKey, String requestId)
throws KeeperException, InterruptedException {
- List<String> childNames = zookeeper.getChildren(dir, null, true);
+ List<String> childNames = zookeeper.getChildren(dir, null);
stats.setQueueLength(childNames.size());
for (String childName : childNames) {
if (childName != null && childName.startsWith(PREFIX)) {
try {
- byte[] data = zookeeper.getData(dir + "/" + childName, null, null, true);
+ byte[] data = zookeeper.getData(dir + "/" + childName, null, null);
if (data != null) {
ZkNodeProps message = ZkNodeProps.load(data);
if (message.containsKey(requestIdKey)) {
@@ -124,7 +124,7 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
dir + "/" + RESPONSE_PREFIX + path.substring(path.lastIndexOf('-') + 1);
try {
- zookeeper.setData(responsePath, event.getBytes(), true);
+ zookeeper.setData(responsePath, event.getBytes());
} catch (KeeperException.NoNodeException ignored) {
// we must handle the race case where the node no longer exists
log.info(
@@ -135,7 +135,7 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
// Remove the request node
try {
- zookeeper.delete(path, -1, true);
+ zookeeper.delete(path, -1);
} catch (KeeperException.NoNodeException ignored) {
}
} finally {
@@ -214,10 +214,10 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
throws KeeperException, InterruptedException {
for (; ; ) {
try {
- return zookeeper.create(path, data, mode, true);
+ return zookeeper.create(path, data, mode);
} catch (KeeperException.NoNodeException e) {
try {
- zookeeper.create(dir, new byte[0], CreateMode.PERSISTENT, true);
+ zookeeper.create(dir, new byte[0], CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException ne) {
// someone created it
}
@@ -239,7 +239,7 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
String watchID = createResponseNode();
LatchWatcher watcher = new LatchWatcher();
- Stat stat = zookeeper.exists(watchID, watcher, true);
+ Stat stat = zookeeper.exists(watchID, watcher);
// create the request node
createRequestNode(data, watchID);
@@ -248,11 +248,11 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
pendingResponses.incrementAndGet();
watcher.await(timeout);
}
- byte[] bytes = zookeeper.getData(watchID, null, null, true);
+ byte[] bytes = zookeeper.getData(watchID, null, null);
// create the event before deleting the node, otherwise we can get the deleted
// event from the watcher.
QueueEvent event = new QueueEvent(watchID, bytes, watcher.getWatchedEvent());
- zookeeper.delete(watchID, -1, true);
+ zookeeper.delete(watchID, -1);
return event;
} finally {
time.stop();
@@ -313,9 +313,7 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
try {
QueueEvent queueEvent =
new QueueEvent(
- dir + "/" + headNode,
- zookeeper.getData(dir + "/" + headNode, null, null, true),
- null);
+ dir + "/" + headNode, zookeeper.getData(dir + "/" + headNode, null, null), null);
return queueEvent.getId();
} catch (KeeperException.NoNodeException e) {
// Another client removed the node first, try next
diff --git a/solr/core/src/java/org/apache/solr/cloud/RefreshCollectionMessage.java b/solr/core/src/java/org/apache/solr/cloud/RefreshCollectionMessage.java
index fee0d32bf50..c09a38d418c 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RefreshCollectionMessage.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RefreshCollectionMessage.java
@@ -40,7 +40,7 @@ public class RefreshCollectionMessage implements Overseer.Message {
overseer
.getZkStateReader()
.getZkClient()
- .exists(DocCollection.getCollectionPath(collection), null, true);
+ .exists(DocCollection.getCollectionPath(collection), null);
if (stat == null) {
// collection does not exist
return clusterState.copyWith(collection, null);
diff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
index 116aee57d3f..a8ad90df364 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
@@ -452,7 +452,7 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
if (slices != null) {
int found = 0;
try {
- found = zkClient.getChildren(shardsElectZkPath, null, true).size();
+ found = zkClient.getChildren(shardsElectZkPath, null).size();
} catch (KeeperException e) {
if (e instanceof KeeperException.SessionExpiredException) {
// if the session has expired, then another election will be launched, so
diff --git a/solr/core/src/java/org/apache/solr/cloud/SizeLimitedDistributedMap.java b/solr/core/src/java/org/apache/solr/cloud/SizeLimitedDistributedMap.java
index c4c8923b218..510c0f1c1f5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/SizeLimitedDistributedMap.java
+++ b/solr/core/src/java/org/apache/solr/cloud/SizeLimitedDistributedMap.java
@@ -65,7 +65,7 @@ public class SizeLimitedDistributedMap extends DistributedMap {
private void shrinkIfNeeded() throws KeeperException, InterruptedException {
if (this.size() >= maxSize) {
// Bring down the size
- List<String> children = zookeeper.getChildren(dir, null, true);
+ List<String> children = zookeeper.getChildren(dir, null);
int cleanupSize = maxSize / 10;
@@ -79,7 +79,7 @@ public class SizeLimitedDistributedMap extends DistributedMap {
Map<String, Long> childToModificationZxid = CollectionUtil.newHashMap(children.size());
for (String child : children) {
- Stat stat = zookeeper.exists(dir + "/" + child, null, true);
+ Stat stat = zookeeper.exists(dir + "/" + child, null);
if (stat != null) {
priorityQueue.insertWithOverflow(stat.getMzxid());
childToModificationZxid.put(child, stat.getMzxid());
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java b/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
index 9766c6df42d..12cfbc48617 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkConfigSetService.java
@@ -99,7 +99,7 @@ public class ZkConfigSetService extends ConfigSetService {
String zkPath = CONFIGS_ZKNODE + "/" + configSet + "/" + schemaFile;
Stat stat;
try {
- stat = zkClient.exists(zkPath, null, true);
+ stat = zkClient.exists(zkPath, null);
} catch (KeeperException e) {
log.warn("Unexpected exception when getting modification time of {}", zkPath, e);
return null; // debatable; we'll see an error soon if there's a real problem
@@ -121,7 +121,7 @@ public class ZkConfigSetService extends ConfigSetService {
@Override
public boolean checkConfigExists(String configName) throws IOException {
try {
- return zkClient.exists(CONFIGS_ZKNODE + "/" + configName, true);
+ return zkClient.exists(CONFIGS_ZKNODE + "/" + configName);
} catch (KeeperException | InterruptedException e) {
throw new IOException(
"Error checking whether config exists", SolrZkClient.checkInterrupted(e));
@@ -195,7 +195,7 @@ public class ZkConfigSetService extends ConfigSetService {
mimeType));
} else {
// if overwriteOnExists is true then zkClient#makePath failOnExists is set to false
- zkClient.makePath(filePath, data, CreateMode.PERSISTENT, null, !overwriteOnExists, true);
+ zkClient.makePath(filePath, data, CreateMode.PERSISTENT, null, !overwriteOnExists);
}
} catch (KeeperException.NodeExistsException nodeExistsException) {
throw new SolrException(
@@ -219,8 +219,7 @@ public class ZkConfigSetService extends ConfigSetService {
Utils.toJSON(data),
CreateMode.PERSISTENT,
null,
- false,
- true);
+ false);
} catch (KeeperException | InterruptedException e) {
throw new IOException("Error setting config metadata", SolrZkClient.checkInterrupted(e));
}
@@ -232,7 +231,7 @@ public class ZkConfigSetService extends ConfigSetService {
@SuppressWarnings("unchecked")
Map<String, Object> data =
(Map<String, Object>)
- Utils.fromJSON(zkClient.getData(CONFIGS_ZKNODE + "/" + configName, null, null, true));
+ Utils.fromJSON(zkClient.getData(CONFIGS_ZKNODE + "/" + configName, null, null));
return data;
} catch (KeeperException.NoNodeException e) {
return Collections.emptyMap();
@@ -249,7 +248,7 @@ public class ZkConfigSetService extends ConfigSetService {
@Override
public byte[] downloadFileFromConfig(String configName, String filePath) throws IOException {
try {
- return zkClient.getData(CONFIGS_ZKNODE + "/" + configName + "/" + filePath, null, null, true);
+ return zkClient.getData(CONFIGS_ZKNODE + "/" + configName + "/" + filePath, null, null);
} catch (KeeperException.NoNodeException e) {
return null;
} catch (KeeperException | InterruptedException e) {
@@ -260,7 +259,7 @@ public class ZkConfigSetService extends ConfigSetService {
@Override
public List<String> listConfigs() throws IOException {
try {
- return zkClient.getChildren(CONFIGS_ZKNODE, null, true);
+ return zkClient.getChildren(CONFIGS_ZKNODE, null);
} catch (KeeperException.NoNodeException e) {
return Collections.emptyList();
} catch (KeeperException | InterruptedException e) {
@@ -307,9 +306,9 @@ public class ZkConfigSetService extends ConfigSetService {
private void copyConfigDirFromZk(String fromZkPath, String toZkPath) throws IOException {
try {
- List<String> files = zkClient.getChildren(fromZkPath, null, true);
+ List<String> files = zkClient.getChildren(fromZkPath, null);
for (String file : files) {
- List<String> children = zkClient.getChildren(fromZkPath + "/" + file, null, true);
+ List<String> children = zkClient.getChildren(fromZkPath + "/" + file, null);
if (children.size() == 0) {
copyData(fromZkPath + "/" + file, toZkPath + "/" + file);
} else {
@@ -335,7 +334,7 @@ public class ZkConfigSetService extends ConfigSetService {
toZkFilePath);
} else {
log.debug("Copying zk node {} to {}", fromZkFilePath, toZkFilePath);
- byte[] data = zkClient.getData(fromZkFilePath, null, null, true);
+ byte[] data = zkClient.getData(fromZkFilePath, null, null);
if (!FileTypeMagicUtil.isFileForbiddenInConfigset(data)) {
zkClient.makePath(toZkFilePath, data, true);
} else {
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index f8551e6fb3c..653cccb9a6e 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -565,25 +565,24 @@ public class ZkController implements Closeable {
*/
private void checkNoOldClusterstate(final SolrZkClient zkClient) throws InterruptedException {
try {
- if (zkClient.exists(UNSUPPORTED_SOLR_XML, true)) {
+ if (zkClient.exists(UNSUPPORTED_SOLR_XML)) {
String message =
"solr.xml found in ZooKeeper. Loading solr.xml from ZooKeeper is no longer supported since Solr 10. "
+ "Cannot start Solr. The file can be removed with command bin/solr zk rm /solr.xml -z host:port";
log.error(message);
throw new SolrException(ErrorCode.INVALID_STATE, message);
}
- if (!zkClient.exists(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, true)) {
+ if (!zkClient.exists(ZkStateReader.UNSUPPORTED_CLUSTER_STATE)) {
return;
}
- final byte[] data =
- zkClient.getData(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, null, null, true);
+ final byte[] data = zkClient.getData(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, null, null);
if (Arrays.equals("{}".getBytes(StandardCharsets.UTF_8), data)) {
// Empty json. This log will only occur once.
log.warn(
"{} no longer supported starting with Solr 9. Found empty file on Zookeeper, deleting it.",
ZkStateReader.UNSUPPORTED_CLUSTER_STATE);
- zkClient.delete(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, -1, true);
+ zkClient.delete(ZkStateReader.UNSUPPORTED_CLUSTER_STATE, -1);
} else {
// /clusterstate.json not empty: refuse to start but do not automatically delete. A bit of a
// pain but user shouldn't have older collections at this stage anyway.
@@ -696,8 +695,7 @@ public class ZkController implements Closeable {
+ "/leader_elect/"
+ slice
+ "/election",
- null,
- true)
+ null)
.size();
if (children == 0) {
log.debug(
@@ -1031,7 +1029,7 @@ public class ZkController implements Closeable {
private static void repairSecurityJson(SolrZkClient zkClient)
throws KeeperException, InterruptedException {
- List<ACL> securityConfAcl = zkClient.getACL(ZkStateReader.SOLR_SECURITY_CONF_PATH, null, true);
+ List<ACL> securityConfAcl = zkClient.getACL(ZkStateReader.SOLR_SECURITY_CONF_PATH, null);
ACLProvider aclProvider = zkClient.getZkACLProvider();
boolean tryUpdate = false;
@@ -1089,7 +1087,7 @@ public class ZkController implements Closeable {
overseerElector.joinElection(context, false);
}
- Stat stat = zkClient.exists(ZkStateReader.LIVE_NODES_ZKNODE, null, true);
+ Stat stat = zkClient.exists(ZkStateReader.LIVE_NODES_ZKNODE, null);
if (stat != null && stat.getNumChildren() > 0) {
publishAndWaitForDownStates();
}
@@ -1111,7 +1109,7 @@ public class ZkController implements Closeable {
String nodeName = getNodeName();
String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
- if (!zkClient.exists(nodePath, true)) {
+ if (!zkClient.exists(nodePath)) {
return;
}
@@ -1126,8 +1124,7 @@ public class ZkController implements Closeable {
if (Watcher.Event.EventType.NodeDeleted.equals(event.getType())) {
deletedLatch.countDown();
}
- },
- true);
+ });
if (stat == null) {
// znode suddenly disappeared but that's okay
@@ -1229,10 +1226,10 @@ public class ZkController implements Closeable {
.withTimeout(SolrZkClientTimeout.DEFAULT_ZK_CLIENT_TIMEOUT, TimeUnit.MILLISECONDS)
.withConnTimeOut(SolrZkClientTimeout.DEFAULT_ZK_CONNECT_TIMEOUT, TimeUnit.MILLISECONDS)
.build();
- boolean exists = tmpClient.exists(chrootPath, true);
+ boolean exists = tmpClient.exists(chrootPath);
if (!exists && create) {
log.info("creating chroot {}", chrootPath);
- tmpClient.makePath(chrootPath, false, true);
+ tmpClient.makePath(chrootPath, false);
exists = true;
}
tmpClient.close();
@@ -1282,7 +1279,7 @@ public class ZkController implements Closeable {
String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
log.info("Remove node as live in ZooKeeper:{}", nodePath);
try {
- zkClient.delete(nodePath, -1, true);
+ zkClient.delete(nodePath, -1);
} catch (NoNodeException e) {
}
@@ -1291,8 +1288,7 @@ public class ZkController implements Closeable {
.forEach(
(role, mode) -> {
try {
- zkClient.delete(
- NodeRoles.getZNodeForRoleMode(role, mode) + "/" + nodeName, -1, true);
+ zkClient.delete(NodeRoles.getZNodeForRoleMode(role, mode) + "/" + nodeName, -1);
} catch (KeeperException e) {
} catch (InterruptedException e) {
@@ -1307,7 +1303,7 @@ public class ZkController implements Closeable {
/** Returns true if the path exists */
public boolean pathExists(String path) throws KeeperException, InterruptedException {
- return zkClient.exists(path, true);
+ return zkClient.exists(path);
}
/**
@@ -1694,8 +1690,7 @@ public class ZkController implements Closeable {
while (iterCount-- > 0) {
try {
byte[] data =
- zkClient.getData(
- ZkStateReader.getShardLeadersPath(collection, slice), null, null, true);
+ zkClient.getData(ZkStateReader.getShardLeadersPath(collection, slice), null, null);
ZkCoreNodeProps leaderProps = new ZkCoreNodeProps(ZkNodeProps.load(data));
return leaderProps;
} catch (InterruptedException e) {
@@ -2386,7 +2381,7 @@ public class ZkController implements Closeable {
log.debug("Load collection config from:{}", path);
byte[] data;
try {
- data = zkClient.getData(path, null, null, true);
+ data = zkClient.getData(path, null, null);
} catch (NoNodeException e) {
// if there is no node, we will try and create it
// first try to make in case we are pre-configuring
@@ -2401,7 +2396,7 @@ public class ZkController implements Closeable {
}
// if we fail creating, setdata
// TODO: we should consider using version
- zkClient.setData(path, Utils.toJSON(props), true);
+ zkClient.setData(path, Utils.toJSON(props));
}
return;
}
@@ -2417,7 +2412,7 @@ public class ZkController implements Closeable {
}
// TODO: we should consider using version
- zkClient.setData(path, Utils.toJSON(props), true);
+ zkClient.setData(path, Utils.toJSON(props));
}
public ZkDistributedQueue getOverseerJobQueue() {
@@ -2523,9 +2518,7 @@ public class ZkController implements Closeable {
if (electionNode.startsWith(getNodeName())) {
try {
zkClient.delete(
- Overseer.OVERSEER_ELECT + LeaderElector.ELECTION_NODE + "/" + electionNode,
- -1,
- true);
+ Overseer.OVERSEER_ELECT + LeaderElector.ELECTION_NODE + "/" + electionNode, -1);
} catch (NoNodeException e) {
// no problem
} catch (InterruptedException e) {
@@ -2593,7 +2586,7 @@ public class ZkController implements Closeable {
public void checkOverseerDesignate() {
try {
- byte[] data = zkClient.getData(ZkStateReader.ROLES, null, new Stat(), true);
+ byte[] data = zkClient.getData(ZkStateReader.ROLES, null, new Stat());
if (data == null) return;
Map<?, ?> roles = (Map<?, ?>) Utils.fromJSON(data);
if (roles == null) return;
@@ -2699,7 +2692,7 @@ public class ZkController implements Closeable {
String errMsg = "Failed to persist resource at {0} - old {1}";
try {
try {
- Stat stat = zkClient.setData(resourceLocation, content, znodeVersion, true);
+ Stat stat = zkClient.setData(resourceLocation, content, znodeVersion);
// if the set succeeded, it should have incremented the version by one always
latestVersion = stat.getVersion();
log.info("Persisted config data to node {} ", resourceLocation);
@@ -2707,12 +2700,12 @@ public class ZkController implements Closeable {
} catch (NoNodeException e) {
if (createIfNotExists) {
try {
- zkClient.makePath(resourceLocation, content, CreateMode.PERSISTENT, true);
+ zkClient.makePath(resourceLocation, content, CreateMode.PERSISTENT);
latestVersion = 0; // just created so version must be zero
touchConfDir(zkLoader);
} catch (KeeperException.NodeExistsException nee) {
try {
- Stat stat = zkClient.exists(resourceLocation, null, true);
+ Stat stat = zkClient.exists(resourceLocation, null);
if (log.isDebugEnabled()) {
log.debug(
"failed to set data version in zk is {} and expected version is {} ",
@@ -2735,7 +2728,7 @@ public class ZkController implements Closeable {
} catch (KeeperException.BadVersionException bve) {
try {
- zkClient.exists(resourceLocation, null, true);
+ zkClient.exists(resourceLocation, null);
} catch (Exception e) {
log.error("Exception during ZooKeeper node checking ", e);
}
@@ -2859,7 +2852,7 @@ public class ZkController implements Closeable {
Stat stat = null;
try {
- stat = zkClient.exists(zkDir, null, true);
+ stat = zkClient.exists(zkDir, null);
} catch (KeeperException e) {
// ignore , it is not a big deal
} catch (InterruptedException e) {
@@ -2913,7 +2906,7 @@ public class ZkController implements Closeable {
private void setConfWatcher(String zkDir, Watcher watcher, Stat stat) {
try {
- Stat newStat = zkClient.exists(zkDir, watcher, true);
+ Stat newStat = zkClient.exists(zkDir, watcher);
if (stat != null && newStat.getVersion() > stat.getVersion()) {
// a race condition where we missed an event fired
// so fire the event listeners
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLock.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLock.java
index b9fedc5e076..4b594508d2a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLock.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLock.java
@@ -94,8 +94,7 @@ abstract class ZkDistributedLock implements DistributedLock {
+ DistributedCollectionConfigSetCommandRunner.ZK_PATH_SEPARATOR
+ lockNodePrefix,
null,
- CreateMode.EPHEMERAL_SEQUENTIAL,
- false);
+ CreateMode.EPHEMERAL_SEQUENTIAL);
sequence = getSequenceFromNodename(lockNode);
}
@@ -143,7 +142,7 @@ abstract class ZkDistributedLock implements DistributedLock {
String nodeToWatch = nodeToWatch();
while (nodeToWatch != null) {
final DeletedNodeWatcher watcher = new DeletedNodeWatcher(nodeToWatch);
- if (zkClient.exists(nodeToWatch, watcher, true) != null) {
+ if (zkClient.exists(nodeToWatch, watcher) != null) {
watcher.await();
}
nodeToWatch = nodeToWatch();
@@ -159,7 +158,7 @@ abstract class ZkDistributedLock implements DistributedLock {
@Override
public void release() {
try {
- zkClient.delete(lockNode, -1, true);
+ zkClient.delete(lockNode, -1);
released = true;
} catch (KeeperException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
@@ -190,7 +189,7 @@ abstract class ZkDistributedLock implements DistributedLock {
* {@code null} if the lock is ours.
*/
String nodeToWatch() throws KeeperException, InterruptedException {
- List<String> locks = zkClient.getChildren(lockDir, null, true);
+ List<String> locks = zkClient.getChildren(lockDir, null);
boolean foundSelf = false; // For finding bugs or ZK bad behavior
// We deviate from the ZK recipe here: we do not sort the list of nodes, and we stop waiting on
// the first one we find that blocks us. This is done in O(n), whereas sorting is more
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLockFactory.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLockFactory.java
index 54434c8e6bc..76696dc3942 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLockFactory.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedLockFactory.java
@@ -59,8 +59,8 @@ abstract class ZkDistributedLockFactory {
private void makeLockPath(String lockNodePath) throws KeeperException, InterruptedException {
try {
- if (!zkClient.exists(lockNodePath, true)) {
- zkClient.makePath(lockNodePath, new byte[0], CreateMode.PERSISTENT, true);
+ if (!zkClient.exists(lockNodePath)) {
+ zkClient.makePath(lockNodePath, new byte[0], CreateMode.PERSISTENT);
}
} catch (KeeperException.NodeExistsException nee) {
// Some other thread (on this or another JVM) beat us to create the node, that's ok.
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java
index f3e06f90cb8..ca27ab37bd8 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java
@@ -247,7 +247,7 @@ public class ZkDistributedQueue implements DistributedQueue {
for (CuratorTransactionResult result : results) {
if (result.getError() != 0) {
try {
- zookeeper.delete(result.getForPath(), -1, true);
+ zookeeper.delete(result.getForPath(), -1);
} catch (KeeperException.NoNodeException ignored) {
}
}
@@ -304,7 +304,7 @@ public class ZkDistributedQueue implements DistributedQueue {
if (maxQueueSize > 0) {
if (offerPermits.get() <= 0 || offerPermits.getAndDecrement() <= 0) {
// If a max queue size is set, check it before creating a new queue item.
- Stat stat = zookeeper.exists(dir, null, true);
+ Stat stat = zookeeper.exists(dir, null);
if (stat == null) {
// jump to the code below, which tries to create dir if it doesn't exist
throw new KeeperException.NoNodeException();
@@ -322,12 +322,12 @@ public class ZkDistributedQueue implements DistributedQueue {
// Explicitly set isDirty here so that synchronous same-thread calls behave as expected.
// This will get set again when the watcher actually fires, but that's ok.
- zookeeper.create(dir + "/" + PREFIX, data, CreateMode.PERSISTENT_SEQUENTIAL, true);
+ zookeeper.create(dir + "/" + PREFIX, data, CreateMode.PERSISTENT_SEQUENTIAL);
isDirty = true;
return;
} catch (KeeperException.NoNodeException e) {
try {
- zookeeper.create(dir, new byte[0], CreateMode.PERSISTENT, true);
+ zookeeper.create(dir, new byte[0], CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException ne) {
// someone created it
}
@@ -414,7 +414,7 @@ public class ZkDistributedQueue implements DistributedQueue {
try {
TreeSet<String> orderedChildren = new TreeSet<>();
- List<String> childNames = zookeeper.getChildren(dir, watcher, true);
+ List<String> childNames = zookeeper.getChildren(dir, watcher);
stats.setQueueLength(childNames.size());
for (String childName : childNames) {
// Check format
@@ -426,7 +426,7 @@ public class ZkDistributedQueue implements DistributedQueue {
}
return orderedChildren;
} catch (KeeperException.NoNodeException e) {
- zookeeper.makePath(dir, false, true);
+ zookeeper.makePath(dir, false);
// go back to the loop and try again
}
}
@@ -489,7 +489,7 @@ public class ZkDistributedQueue implements DistributedQueue {
break;
}
try {
- byte[] data = zookeeper.getData(dir + "/" + child, null, null, true);
+ byte[] data = zookeeper.getData(dir + "/" + child, null, null);
result.add(new Pair<>(child, data));
} catch (KeeperException.NoNodeException e) {
// Another client deleted the node first, remove the in-memory and continue.
@@ -516,7 +516,7 @@ public class ZkDistributedQueue implements DistributedQueue {
return null;
}
try {
- return zookeeper.getData(dir + "/" + firstChild, null, null, true);
+ return zookeeper.getData(dir + "/" + firstChild, null, null);
} catch (KeeperException.NoNodeException e) {
// Another client deleted the node first, remove the in-memory and retry.
updateLock.lockInterruptibly();
@@ -539,8 +539,8 @@ public class ZkDistributedQueue implements DistributedQueue {
}
try {
String path = dir + "/" + firstChild;
- byte[] result = zookeeper.getData(path, null, null, true);
- zookeeper.delete(path, -1, true);
+ byte[] result = zookeeper.getData(path, null, null);
+ zookeeper.delete(path, -1);
stats.setQueueLength(knownChildren.size());
return result;
} catch (KeeperException.NoNodeException e) {
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
index e3b23127b18..6ec5b09afd4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
@@ -321,7 +321,7 @@ public class ZkShardTerms implements AutoCloseable {
throws KeeperException.NoNodeException {
byte[] znodeData = Utils.toJSON(newTerms);
try {
- Stat stat = zkClient.setData(znodePath, znodeData, newTerms.getVersion(), true);
+ Stat stat = zkClient.setData(znodePath, znodeData, newTerms.getVersion());
setNewTerms(new ShardTerms(newTerms, stat.getVersion()));
log.info("Successful update of terms at {} to {} for {}", znodePath, newTerms, action);
return true;
@@ -348,7 +348,7 @@ public class ZkShardTerms implements AutoCloseable {
try {
Map<String, Long> initialTerms = new HashMap<>();
- zkClient.makePath(path, Utils.toJSON(initialTerms), CreateMode.PERSISTENT, true);
+ zkClient.makePath(path, Utils.toJSON(initialTerms), CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException e) {
// it's okay if another beats us creating the node
}
@@ -368,7 +368,7 @@ public class ZkShardTerms implements AutoCloseable {
ShardTerms newTerms;
try {
Stat stat = new Stat();
- byte[] data = zkClient.getData(znodePath, null, stat, true);
+ byte[] data = zkClient.getData(znodePath, null, stat);
newTerms = new ShardTerms((Map<String, Long>) Utils.fromJSON(data), stat.getVersion());
} catch (KeeperException | InterruptedException e) {
Throwable cause = SolrZkClient.checkInterrupted(e);
@@ -431,7 +431,7 @@ public class ZkShardTerms implements AutoCloseable {
};
try {
// exists operation is faster than getData operation
- zkClient.exists(znodePath, watcher, true);
+ zkClient.exists(znodePath, watcher);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SolrException(
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java b/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java
index 120ad79dddc..63ce933e339 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkSolrResourceLoader.java
@@ -56,7 +56,7 @@ public class ZkSolrResourceLoader extends SolrResourceLoader {
public Pair<String, Integer> getZkResourceInfo(String resource) {
String file = (".".equals(resource)) ? configSetZkPath : configSetZkPath + "/" + resource;
try {
- Stat stat = zkController.getZkClient().exists(file, null, true);
+ Stat stat = zkController.getZkClient().exists(file, null);
if (stat != null) {
return new Pair<>(file, stat.getVersion());
} else {
@@ -85,7 +85,7 @@ public class ZkSolrResourceLoader extends SolrResourceLoader {
try {
if (zkController.pathExists(file)) {
Stat stat = new Stat();
- byte[] bytes = zkController.getZkClient().getData(file, null, stat, true);
+ byte[] bytes = zkController.getZkClient().getData(file, null, stat);
return new ZkByteArrayInputStream(bytes, file, stat);
} else {
// Path does not exist. We only retry for session expired exceptions.
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 76a18e64d9e..acd82c44203 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
@@ -199,9 +199,7 @@ public class CreateCollectionCmd implements CollApiCmds.CollectionApiCommand {
new ClusterStateMutator(ccc.getSolrCloudManager())
.createCollection(clusterState, message);
byte[] data = Utils.toJSON(Collections.singletonMap(collectionName, command.collection));
- ccc.getZkStateReader()
- .getZkClient()
- .create(collectionPath, data, CreateMode.PERSISTENT, true);
+ ccc.getZkStateReader().getZkClient().create(collectionPath, data, CreateMode.PERSISTENT);
clusterState = clusterState.copyWith(collectionName, command.collection);
newColl = command.collection;
ccc.submitIntraProcessMessage(new RefreshCollectionMessage(collectionName));
@@ -373,7 +371,7 @@ public class CreateCollectionCmd implements CollApiCmds.CollectionApiCommand {
Utils.toJSON(
Collections.singletonMap(
collectionName, clusterState.getCollection(collectionName)));
- zkStateReader.getZkClient().setData(collectionPath, data, true);
+ zkStateReader.getZkClient().setData(collectionPath, data);
}
// Distributed updates don't need to do anything for PRS collections that wrote state.json
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
index 1d8629c4fdc..4298ee3f6d3 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
@@ -107,7 +107,7 @@ public class DeleteCollectionCmd implements CollApiCmds.CollectionApiCommand {
if (zkStateReader.getClusterState().getCollectionOrNull(collection) == null) {
if (zkStateReader
.getZkClient()
- .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection, true)) {
+ .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection)) {
// if the collection is not in the clusterstate, but is listed in zk, do nothing, it will
// just be removed in the finally - we cannot continue, because the below code will error
// if the collection is not in the clusterstate
@@ -207,7 +207,7 @@ public class DeleteCollectionCmd implements CollApiCmds.CollectionApiCommand {
try {
String collectionPath = DocCollection.getCollectionPathRoot(collection);
- if (zkStateReader.getZkClient().exists(collectionPath, true)) {
+ if (zkStateReader.getZkClient().exists(collectionPath)) {
if (removeCounterNode) {
zkStateReader.getZkClient().clean(collectionPath);
} else {
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java
index d8e7a3dea64..fc400ffb26a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java
@@ -75,12 +75,12 @@ public class OverseerRoleCmd implements CollApiCmds.CollectionApiCommand {
}
String roleName = message.getStr("role");
- boolean nodeExists = zkClient.exists(ZkStateReader.ROLES, true);
+ boolean nodeExists = zkClient.exists(ZkStateReader.ROLES);
if (nodeExists) {
@SuppressWarnings("unchecked")
Map<String, List<String>> tmp =
(Map<String, List<String>>)
- Utils.fromJSON(zkClient.getData(ZkStateReader.ROLES, null, new Stat(), true));
+ Utils.fromJSON(zkClient.getData(ZkStateReader.ROLES, null, new Stat()));
roles = tmp;
} else {
roles = CollectionUtil.newLinkedHashMap(1);
@@ -96,9 +96,9 @@ public class OverseerRoleCmd implements CollApiCmds.CollectionApiCommand {
}
if (nodeExists) {
- zkClient.setData(ZkStateReader.ROLES, Utils.toJSON(roles), true);
+ zkClient.setData(ZkStateReader.ROLES, Utils.toJSON(roles));
} else {
- zkClient.create(ZkStateReader.ROLES, Utils.toJSON(roles), CreateMode.PERSISTENT, true);
+ zkClient.create(ZkStateReader.ROLES, Utils.toJSON(roles), CreateMode.PERSISTENT);
}
runPrioritizer();
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerStatusCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerStatusCmd.java
index 741a838b7c4..74b2fd57bf9 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerStatusCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerStatusCmd.java
@@ -171,10 +171,10 @@ public class OverseerStatusCmd implements CollApiCmds.CollectionApiCommand {
String leaderNode = OverseerTaskProcessor.getLeaderNode(zkStateReader.getZkClient());
results.add("leader", leaderNode);
Stat stat = new Stat();
- zkStateReader.getZkClient().getData("/overseer/queue", null, stat, true);
+ zkStateReader.getZkClient().getData("/overseer/queue", null, stat);
results.add("overseer_queue_size", stat.getNumChildren());
stat = new Stat();
- zkStateReader.getZkClient().getData("/overseer/collection-queue-work", null, stat, true);
+ zkStateReader.getZkClient().getData("/overseer/collection-queue-work", null, stat);
results.add("overseer_collection_queue_size", stat.getNumChildren());
NamedList<Object> overseerStats = new NamedList<>();
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
index c799ec98969..bf7f698d346 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
@@ -210,10 +210,7 @@ public class SplitShardCmd implements CollApiCmds.CollectionApiCommand {
Stat leaderZnodeStat =
zkStateReader
.getZkClient()
- .exists(
- ZkStateReader.LIVE_NODES_ZKNODE + "/" + parentShardLeader.getNodeName(),
- null,
- true);
+ .exists(ZkStateReader.LIVE_NODES_ZKNODE + "/" + parentShardLeader.getNodeName(), null);
if (leaderZnodeStat == null) {
// we just got to know the leader but its live node is gone already!
throw new SolrException(
@@ -659,9 +656,7 @@ public class SplitShardCmd implements CollApiCmds.CollectionApiCommand {
zkStateReader
.getZkClient()
.exists(
- ZkStateReader.LIVE_NODES_ZKNODE + "/" + parentShardLeader.getNodeName(),
- null,
- true);
+ ZkStateReader.LIVE_NODES_ZKNODE + "/" + parentShardLeader.getNodeName(), null);
if (leaderZnodeStat == null || ephemeralOwner != leaderZnodeStat.getEphemeralOwner()) {
// put sub-shards in recovery_failed state
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 f6f10689410..9660887b659 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
@@ -292,11 +292,11 @@ public class ZkStateWriter {
// When compressing state.json, we expect at least a 10:1 compression ratio.
data = compressor.compressBytes(data, data.length / 10);
}
- if (reader.getZkClient().exists(path, true)) {
+ if (reader.getZkClient().exists(path)) {
if (log.isDebugEnabled()) {
log.debug("going to update_collection {} version: {}", path, c.getZNodeVersion());
}
- Stat stat = reader.getZkClient().setData(path, data, c.getZNodeVersion(), true);
+ Stat stat = reader.getZkClient().setData(path, data, c.getZNodeVersion());
DocCollection newCollection =
DocCollection.create(
name,
@@ -310,7 +310,7 @@ public class ZkStateWriter {
} else {
log.debug("going to create_collection {}", path);
Stat stat = new Stat();
- reader.getZkClient().create(path, data, CreateMode.PERSISTENT, true, stat);
+ reader.getZkClient().create(path, data, CreateMode.PERSISTENT, stat);
DocCollection newCollection =
DocCollection.create(
name,
diff --git a/solr/core/src/java/org/apache/solr/core/NodeConfig.java b/solr/core/src/java/org/apache/solr/core/NodeConfig.java
index 880c9d42d03..ad69e6d90f4 100644
--- a/solr/core/src/java/org/apache/solr/core/NodeConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/NodeConfig.java
@@ -253,7 +253,7 @@ public class NodeConfig {
.withConnTimeOut(startUpZkTimeOut, TimeUnit.MILLISECONDS)
.withSolrClassLoader(loader)
.build()) {
- zkClient.exists("/configs", true);
+ zkClient.exists("/configs");
} catch (Exception e) {
throw new SolrException(
ErrorCode.SERVER_ERROR, "Error occurred while testing zookeeper connection", e);
diff --git a/solr/core/src/java/org/apache/solr/core/RequestParams.java b/solr/core/src/java/org/apache/solr/core/RequestParams.java
index e480de4bfb5..c5b37d19768 100644
--- a/solr/core/src/java/org/apache/solr/core/RequestParams.java
+++ b/solr/core/src/java/org/apache/solr/core/RequestParams.java
@@ -142,8 +142,7 @@ public class RequestParams implements MapSerializable {
resourceLoader
.getZkController()
.getZkClient()
- .exists(
- resourceLoader.getConfigSetZkPath() + "/" + RequestParams.RESOURCE, null, true);
+ .exists(resourceLoader.getConfigSetZkPath() + "/" + RequestParams.RESOURCE, null);
if (log.isDebugEnabled()) {
log.debug(
"latest version of {}/{} in ZK is : {}",
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 068b82285c0..24c7dc83b0c 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -3563,7 +3563,7 @@ public class SolrCore implements SolrInfoBean, Closeable {
private static boolean checkStale(SolrZkClient zkClient, String zkPath, int currentVersion) {
if (zkPath == null) return false;
try {
- Stat stat = zkClient.exists(zkPath, null, true);
+ Stat stat = zkClient.exists(zkPath, null);
if (stat == null) {
if (currentVersion > -1) return true;
return false;
diff --git a/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java b/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java
index 20f3bc3e26d..403dd589b0f 100644
--- a/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java
+++ b/solr/core/src/java/org/apache/solr/core/backup/BackupManager.java
@@ -299,7 +299,7 @@ public class BackupManager {
repository.openInput(sourceDir, ZkStateReader.COLLECTION_PROPS_ZKNODE, IOContext.DEFAULT)) {
byte[] arr = new byte[(int) is.length()];
is.readBytes(arr, 0, (int) is.length());
- zkStateReader.getZkClient().create(zkPath, arr, CreateMode.PERSISTENT, true);
+ zkStateReader.getZkClient().create(zkPath, arr, CreateMode.PERSISTENT);
} catch (KeeperException | InterruptedException e) {
throw new IOException(
"Error uploading file to zookeeper path " + source.toString() + " to " + zkPath,
@@ -317,13 +317,13 @@ public class BackupManager {
+ ZkStateReader.COLLECTION_PROPS_ZKNODE;
try {
- if (!zkStateReader.getZkClient().exists(zkPath, true)) {
+ if (!zkStateReader.getZkClient().exists(zkPath)) {
// Nothing to back up
return;
}
try (OutputStream os = repository.createOutput(dest)) {
- byte[] data = zkStateReader.getZkClient().getData(zkPath, null, null, true);
+ byte[] data = zkStateReader.getZkClient().getData(zkPath, null, null);
os.write(data);
}
} catch (KeeperException | InterruptedException e) {
diff --git a/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java b/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java
index acdbd722717..db83b2e6d11 100644
--- a/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java
+++ b/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotManager.java
@@ -74,7 +74,7 @@ public class SolrSnapshotManager {
SolrZkClient zkClient, String collectionName, String commitName)
throws KeeperException, InterruptedException {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.ofNullable(commitName));
- return zkClient.exists(zkPath, true);
+ return zkClient.exists(zkPath);
}
/**
@@ -90,7 +90,7 @@ public class SolrSnapshotManager {
SolrZkClient zkClient, String collectionName, CollectionSnapshotMetaData meta)
throws KeeperException, InterruptedException {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.of(meta.getName()));
- zkClient.makePath(zkPath, Utils.toJSON(meta), CreateMode.PERSISTENT, true);
+ zkClient.makePath(zkPath, Utils.toJSON(meta), CreateMode.PERSISTENT);
}
/**
@@ -106,7 +106,7 @@ public class SolrSnapshotManager {
SolrZkClient zkClient, String collectionName, CollectionSnapshotMetaData meta)
throws KeeperException, InterruptedException {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.of(meta.getName()));
- zkClient.setData(zkPath, Utils.toJSON(meta), -1, true);
+ zkClient.setData(zkPath, Utils.toJSON(meta), -1);
}
/**
@@ -122,7 +122,7 @@ public class SolrSnapshotManager {
SolrZkClient zkClient, String collectionName, String commitName)
throws InterruptedException, KeeperException {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.of(commitName));
- zkClient.delete(zkPath, -1, true);
+ zkClient.delete(zkPath, -1);
}
/**
@@ -138,11 +138,11 @@ public class SolrSnapshotManager {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.empty());
try {
// Delete the meta-data for each snapshot.
- Collection<String> snapshots = zkClient.getChildren(zkPath, null, true);
+ Collection<String> snapshots = zkClient.getChildren(zkPath, null);
for (String snapshot : snapshots) {
String path = getSnapshotMetaDataZkPath(collectionName, Optional.of(snapshot));
try {
- zkClient.delete(path, -1, true);
+ zkClient.delete(path, -1);
} catch (KeeperException ex) {
// Gracefully handle the case when the zk node doesn't exist
if (ex.code() != KeeperException.Code.NONODE) {
@@ -152,7 +152,7 @@ public class SolrSnapshotManager {
}
// Delete the parent node.
- zkClient.delete(zkPath, -1, true);
+ zkClient.delete(zkPath, -1);
} catch (KeeperException ex) {
// Gracefully handle the case when the zk node doesn't exist (e.g. if no snapshots were
// created for this collection).
@@ -180,7 +180,7 @@ public class SolrSnapshotManager {
try {
@SuppressWarnings({"unchecked"})
Map<String, Object> data =
- (Map<String, Object>) Utils.fromJSON(zkClient.getData(zkPath, null, null, true));
+ (Map<String, Object>) Utils.fromJSON(zkClient.getData(zkPath, null, null));
return Optional.of(new CollectionSnapshotMetaData(data));
} catch (KeeperException ex) {
// Gracefully handle the case when the zk node for a specific
@@ -208,7 +208,7 @@ public class SolrSnapshotManager {
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.empty());
try {
- Collection<String> snapshots = zkClient.getChildren(zkPath, null, true);
+ Collection<String> snapshots = zkClient.getChildren(zkPath, null);
for (String snapshot : snapshots) {
Optional<CollectionSnapshotMetaData> s =
getCollectionLevelSnapshot(zkClient, collectionName, snapshot);
diff --git a/solr/core/src/java/org/apache/solr/filestore/ClusterFileStore.java b/solr/core/src/java/org/apache/solr/filestore/ClusterFileStore.java
index 043192aa0d8..9eb61fd5822 100644
--- a/solr/core/src/java/org/apache/solr/filestore/ClusterFileStore.java
+++ b/solr/core/src/java/org/apache/solr/filestore/ClusterFileStore.java
@@ -92,7 +92,7 @@ public class ClusterFileStore extends JerseyResource implements ClusterFileStore
coreContainer
.getZkController()
.getZkClient()
- .create(TMP_ZK_NODE, "true".getBytes(UTF_8), CreateMode.EPHEMERAL, true);
+ .create(TMP_ZK_NODE, "true".getBytes(UTF_8), CreateMode.EPHEMERAL);
if (requestBody == null)
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "no payload");
@@ -142,7 +142,7 @@ public class ClusterFileStore extends JerseyResource implements ClusterFileStore
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage());
} finally {
try {
- coreContainer.getZkController().getZkClient().delete(TMP_ZK_NODE, -1, true);
+ coreContainer.getZkController().getZkClient().delete(TMP_ZK_NODE, -1);
} catch (Exception e) {
log.error("Unexpected error ", e);
}
@@ -275,14 +275,14 @@ public class ClusterFileStore extends JerseyResource implements ClusterFileStore
coreContainer
.getZkController()
.getZkClient()
- .create(TMP_ZK_NODE, "true".getBytes(UTF_8), CreateMode.EPHEMERAL, true);
+ .create(TMP_ZK_NODE, "true".getBytes(UTF_8), CreateMode.EPHEMERAL);
fileStore.delete(filePath);
} catch (Exception e) {
log.error("Unknown error", e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
} finally {
try {
- coreContainer.getZkController().getZkClient().delete(TMP_ZK_NODE, -1, true);
+ coreContainer.getZkController().getZkClient().delete(TMP_ZK_NODE, -1);
} catch (Exception e) {
log.error("Unexpected error ", e);
}
diff --git a/solr/core/src/java/org/apache/solr/filestore/DistribFileStore.java b/solr/core/src/java/org/apache/solr/filestore/DistribFileStore.java
index 797b1f584e5..398075663a4 100644
--- a/solr/core/src/java/org/apache/solr/filestore/DistribFileStore.java
+++ b/solr/core/src/java/org/apache/solr/filestore/DistribFileStore.java
@@ -355,7 +355,6 @@ public class DistribFileStore implements FileStore {
CreateMode.PERSISTENT,
null,
false,
- true,
0);
} catch (Exception e) {
@@ -539,7 +538,7 @@ public class DistribFileStore implements FileStore {
private void checkInZk(String path) {
try {
// fail if file exists
- if (coreContainer.getZkController().getZkClient().exists(ZK_PACKAGESTORE + path, true)) {
+ if (coreContainer.getZkController().getZkClient().exists(ZK_PACKAGESTORE + path)) {
throw new SolrException(BAD_REQUEST, "The path exist ZK, delete and retry");
}
@@ -563,11 +562,7 @@ public class DistribFileStore implements FileStore {
@SuppressWarnings({"rawtypes"})
List l = null;
try {
- l =
- coreContainer
- .getZkController()
- .getZkClient()
- .getChildren(ZK_PACKAGESTORE + path, null, true);
+ l = coreContainer.getZkController().getZkClient().getChildren(ZK_PACKAGESTORE + path, null);
} catch (KeeperException.NoNodeException e) {
// does not matter
}
@@ -680,7 +675,7 @@ public class DistribFileStore implements FileStore {
public static void deleteZKFileEntry(SolrZkClient client, String path) {
try {
- client.delete(ZK_PACKAGESTORE + path, -1, true);
+ client.delete(ZK_PACKAGESTORE + path, -1);
} catch (KeeperException | InterruptedException e) {
log.error("", e);
}
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java b/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java
index 195a3f66087..3bda1f7ddc4 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java
@@ -115,8 +115,7 @@ public class ClusterStatus {
List<String> liveNodes = null;
if (withLiveNodes || collection != null) {
- liveNodes =
- zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null, true);
+ liveNodes = zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null);
// add live_nodes
if (withLiveNodes) clusterStatus.add("live_nodes", liveNodes);
}
@@ -146,11 +145,11 @@ public class ClusterStatus {
// add the roles map
if (withRoles) {
Map<?, ?> roles = Collections.emptyMap();
- if (zkStateReader.getZkClient().exists(ZkStateReader.ROLES, true)) {
+ if (zkStateReader.getZkClient().exists(ZkStateReader.ROLES)) {
roles =
(Map<?, ?>)
Utils.fromJSON(
- zkStateReader.getZkClient().getData(ZkStateReader.ROLES, null, null, true));
+ zkStateReader.getZkClient().getData(ZkStateReader.ROLES, null, null));
}
clusterStatus.add("roles", roles);
}
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerZk.java b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerZk.java
index a0978c02759..09d8cbcddf6 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerZk.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerZk.java
@@ -79,8 +79,7 @@ public class SecurityConfHandlerZk extends SecurityConfHandler {
.setData(
SOLR_SECURITY_CONF_PATH,
Utils.toJSON(securityConfig.getData()),
- securityConfig.getVersion(),
- true);
+ securityConfig.getVersion());
log.debug("Persisted security.json to {}", SOLR_SECURITY_CONF_PATH);
return true;
} catch (KeeperException.BadVersionException bdve) {
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
index 7d6e5ec65c0..b81c6925354 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
@@ -158,7 +158,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
}
// Show a directory listing
- List<String> children = zkClient.getChildren(adminFile, null, true);
+ List<String> children = zkClient.getChildren(adminFile, null);
if (children.size() > 0) {
NamedList<SimpleOrderedMap<Object>> files = new SimpleOrderedMap<>();
@@ -169,7 +169,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
SimpleOrderedMap<Object> fileInfo = new SimpleOrderedMap<>();
files.add(f, fileInfo);
- List<String> fchildren = zkClient.getChildren(adminFile + "/" + f, null, true);
+ List<String> fchildren = zkClient.getChildren(adminFile + "/" + f, null);
if (fchildren.size() > 0) {
fileInfo.add("directory", true);
} else {
@@ -187,8 +187,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
params.set(CommonParams.WT, "raw");
req.setParams(params);
ContentStreamBase content =
- new ContentStreamBase.ByteArrayStream(
- zkClient.getData(adminFile, null, null, true), adminFile);
+ new ContentStreamBase.ByteArrayStream(zkClient.getData(adminFile, null, null), adminFile);
content.setContentType(getSafeContentType(req.getParams().get(USE_CONTENT_TYPE)));
rsp.add(RawResponseWriter.CONTENT, content);
@@ -353,7 +352,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
}
// Make sure the file exists, is readable and is not a hidden file
- if (!zkClient.exists(adminFile, true)) {
+ if (!zkClient.exists(adminFile)) {
rsp.setException(
new SolrException(SolrException.ErrorCode.NOT_FOUND, "Can not find: " + adminFile));
return null;
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
index 5bb3cc95245..45d6ea65ce4 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
@@ -282,7 +282,7 @@ public final class ZookeeperInfoHandler extends RequestHandlerBase {
// cache is stale, rebuild the full list ...
cachedCollections = new ArrayList<String>();
- List<String> fromZk = zkClient.getChildren("/collections", this, true);
+ List<String> fromZk = zkClient.getChildren("/collections", this);
if (fromZk != null) cachedCollections.addAll(fromZk);
// sort the final merged set of collections
@@ -623,7 +623,7 @@ public final class ZookeeperInfoHandler extends RequestHandlerBase {
Stat stat = new Stat();
try {
// Trickily, the call to zkClient.getData fills in the stat variable
- byte[] data = zkClient.getData(path, null, stat, true);
+ byte[] data = zkClient.getData(path, null, stat);
if (stat.getEphemeralOwner() != 0) {
writeKeyValue(json, "ephemeral", true, false);
@@ -656,7 +656,7 @@ public final class ZookeeperInfoHandler extends RequestHandlerBase {
json.startArray();
try {
- List<String> children = zkClient.getChildren(path, null, true);
+ List<String> children = zkClient.getChildren(path, null);
java.util.Collections.sort(children);
boolean first = true;
@@ -711,7 +711,7 @@ public final class ZookeeperInfoHandler extends RequestHandlerBase {
String dataStrErr = null;
Stat stat = new Stat();
// Trickily, the call to zkClient.getData fills in the stat variable
- byte[] data = zkClient.getData(path, null, stat, true);
+ byte[] data = zkClient.getData(path, null, stat);
if (null != data) {
try {
dataStr = (new BytesRef(data)).utf8ToString();
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperRead.java b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperRead.java
index c3299f6d49b..bf50e28c43c 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperRead.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperRead.java
@@ -88,20 +88,18 @@ public class ZookeeperRead extends AdminAPIBase implements ZooKeeperReadApis {
zkPath = sanitizeZkPath(zkPath);
try {
- Stat stat = coreContainer.getZkController().getZkClient().exists(zkPath, null, true);
+ Stat stat = coreContainer.getZkController().getZkClient().exists(zkPath, null);
listResponse.stat = createAnnotatedStatFrom(stat);
if (includeChildren != null && !includeChildren.booleanValue()) {
return listResponse;
}
- List<String> l =
- coreContainer.getZkController().getZkClient().getChildren(zkPath, null, false);
+ List<String> l = coreContainer.getZkController().getZkClient().getChildren(zkPath, null);
String prefix = zkPath.endsWith("/") ? zkPath : zkPath + "/";
Map<String, Stat> stats = new LinkedHashMap<>();
for (String s : l) {
try {
- stats.put(
- s, coreContainer.getZkController().getZkClient().exists(prefix + s, null, false));
+ stats.put(s, coreContainer.getZkController().getZkClient().exists(prefix + s, null));
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -162,7 +160,7 @@ public class ZookeeperRead extends AdminAPIBase implements ZooKeeperReadApis {
private byte[] readPathFromZookeeper(String path) {
byte[] d;
try {
- d = coreContainer.getZkController().getZkClient().getData(path, null, null, false);
+ d = coreContainer.getZkController().getZkClient().getData(path, null, null);
} catch (KeeperException.NoNodeException e) {
throw new SolrException(SolrException.ErrorCode.NOT_FOUND, "No such node: " + path);
} catch (Exception e) {
diff --git a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java
index 5e8acc3bcfd..426ec449cb4 100644
--- a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java
+++ b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java
@@ -217,7 +217,7 @@ public class SchemaDesignerAPI implements SchemaDesignerConstants {
String filePath = getConfigSetZkPath(getMutableId(configSet), file);
byte[] data;
try {
- data = zkStateReader().getZkClient().getData(filePath, null, null, true);
+ data = zkStateReader().getZkClient().getData(filePath, null, null);
} catch (KeeperException | InterruptedException e) {
throw new IOException("Error reading file: " + filePath, SolrZkClient.checkInterrupted(e));
}
@@ -272,7 +272,7 @@ public class SchemaDesignerAPI implements SchemaDesignerConstants {
// apply the update and reload the temp collection / re-index sample docs
SolrZkClient zkClient = zkStateReader().getZkClient();
try {
- zkClient.setData(zkPath, data, true);
+ zkClient.setData(zkPath, data);
} catch (KeeperException | InterruptedException e) {
throw new IOException(
"Failed to save data in ZK at path: " + zkPath, SolrZkClient.checkInterrupted(e));
@@ -396,8 +396,8 @@ public class SchemaDesignerAPI implements SchemaDesignerConstants {
SolrZkClient zkClient = zkStateReader().getZkClient();
String configId = mutableId;
try {
- if (!zkClient.exists(getConfigSetZkPath(mutableId, null), true)) {
- if (zkClient.exists(getConfigSetZkPath(configSet, null), true)) {
+ if (!zkClient.exists(getConfigSetZkPath(mutableId, null))) {
+ if (zkClient.exists(getConfigSetZkPath(configSet, null))) {
configId = configSet;
} else {
throw new SolrException(
@@ -1353,7 +1353,7 @@ public class SchemaDesignerAPI implements SchemaDesignerConstants {
private boolean pathExistsInZk(final String zkPath) throws IOException {
SolrZkClient zkClient = zkStateReader().getZkClient();
try {
- return zkClient.exists(zkPath, true);
+ return zkClient.exists(zkPath);
} catch (KeeperException | InterruptedException e) {
throw new IOException(
"Failed to check if path exists: " + zkPath, SolrZkClient.checkInterrupted(e));
diff --git a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
index 95b9190ba3d..90a7763a16e 100644
--- a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
+++ b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerConfigSetHelper.java
@@ -633,7 +633,7 @@ class SchemaDesignerConfigSetHelper implements SchemaDesignerConstants {
int currentVersion = -1;
final String path = getManagedSchemaZkPath(configSet);
try {
- Stat stat = cc.getZkController().getZkClient().exists(path, null, true);
+ Stat stat = cc.getZkController().getZkClient().exists(path, null);
if (stat != null) {
currentVersion = stat.getVersion();
}
@@ -855,7 +855,7 @@ class SchemaDesignerConfigSetHelper implements SchemaDesignerConstants {
for (String path : toRemoveFiles) {
try {
- zkClient.delete(path, -1, false);
+ zkClient.delete(path, -1);
} catch (KeeperException.NoNodeException nne) {
// no-op
} catch (KeeperException | InterruptedException e) {
@@ -921,9 +921,9 @@ class SchemaDesignerConfigSetHelper implements SchemaDesignerConstants {
for (String path : langFilesToRestore) {
String copyToPath = path.replace(origPathDir, replacePathDir);
try {
- if (!zkClient.exists(copyToPath, true)) {
- zkClient.makePath(copyToPath, false, true);
- zkClient.setData(copyToPath, zkClient.getData(path, null, null, true), true);
+ if (!zkClient.exists(copyToPath)) {
+ zkClient.makePath(copyToPath, false);
+ zkClient.setData(copyToPath, zkClient.getData(path, null, null));
}
} catch (KeeperException | InterruptedException e) {
throw new IOException(
diff --git a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerSettingsDAO.java b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerSettingsDAO.java
index bf8e3d26e93..a824e70381d 100644
--- a/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerSettingsDAO.java
+++ b/solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerSettingsDAO.java
@@ -130,7 +130,7 @@ class SchemaDesignerSettingsDAO implements SchemaDesignerConstants {
byte[] data = null;
Stat stat = new Stat();
try {
- data = cc.getZkController().getZkStateReader().getZkClient().getData(path, null, stat, true);
+ data = cc.getZkController().getZkStateReader().getZkClient().getData(path, null, stat);
} catch (KeeperException.NoNodeException nne) {
// ignore
} catch (KeeperException | InterruptedException e) {
diff --git a/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java b/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
index 0dcd34d9fa1..943c9248a62 100644
--- a/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
+++ b/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
@@ -190,14 +190,14 @@ public class PackageManager implements Closeable {
List<SolrPackageInstance> ret = new ArrayList<>();
packages = new HashMap<>();
try {
- if (zkClient.exists(ZkStateReader.SOLR_PKGS_PATH, true)) {
+ if (zkClient.exists(ZkStateReader.SOLR_PKGS_PATH)) {
@SuppressWarnings("unchecked")
Map<String, List<Map<?, ?>>> packagesZnodeMap =
(Map<String, List<Map<?, ?>>>)
getMapper()
.readValue(
new String(
- zkClient.getData(ZkStateReader.SOLR_PKGS_PATH, null, null, true),
+ zkClient.getData(ZkStateReader.SOLR_PKGS_PATH, null, null),
StandardCharsets.UTF_8),
Map.class)
.get("packages");
@@ -333,7 +333,7 @@ public class PackageManager implements Closeable {
private void ensureCollectionsExist(List<String> collections) {
try {
- List<String> existingCollections = zkClient.getChildren("/collections", null, true);
+ List<String> existingCollections = zkClient.getChildren("/collections", null);
Set<String> nonExistent = new HashSet<>(collections);
nonExistent.removeAll(existingCollections);
if (!nonExistent.isEmpty()) {
@@ -1099,7 +1099,7 @@ public class PackageManager implements Closeable {
public Map<String, String> getDeployedCollections(String packageName) {
List<String> allCollections;
try {
- allCollections = zkClient.getChildren(ZkStateReader.COLLECTIONS_ZKNODE, null, true);
+ allCollections = zkClient.getChildren(ZkStateReader.COLLECTIONS_ZKNODE, null);
} catch (KeeperException | InterruptedException e) {
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, e);
}
diff --git a/solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java b/solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java
index 7e5c0e16b29..013d3639e55 100644
--- a/solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java
+++ b/solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java
@@ -124,17 +124,15 @@ public class RepositoryManager {
@SuppressWarnings({"unchecked"})
List<PackageRepository> repos = getMapper().readValue(existingRepositoriesJson, List.class);
repos.add(new DefaultPackageRepository(repoName, uri));
- if (packageManager.zkClient.exists(PackageUtils.REPOSITORIES_ZK_PATH, true) == false) {
+ if (packageManager.zkClient.exists(PackageUtils.REPOSITORIES_ZK_PATH) == false) {
packageManager.zkClient.create(
PackageUtils.REPOSITORIES_ZK_PATH,
getMapper().writeValueAsString(repos).getBytes(StandardCharsets.UTF_8),
- CreateMode.PERSISTENT,
- true);
+ CreateMode.PERSISTENT);
} else {
packageManager.zkClient.setData(
PackageUtils.REPOSITORIES_ZK_PATH,
- getMapper().writeValueAsString(repos).getBytes(StandardCharsets.UTF_8),
- true);
+ getMapper().writeValueAsString(repos).getBytes(StandardCharsets.UTF_8));
}
try (InputStream is = new URI(uri + "/publickey.der").toURL().openStream()) {
@@ -167,10 +165,9 @@ public class RepositoryManager {
private String getRepositoriesJson(SolrZkClient zkClient)
throws UnsupportedEncodingException, KeeperException, InterruptedException {
- if (zkClient.exists(PackageUtils.REPOSITORIES_ZK_PATH, true)) {
+ if (zkClient.exists(PackageUtils.REPOSITORIES_ZK_PATH)) {
return new String(
- zkClient.getData(PackageUtils.REPOSITORIES_ZK_PATH, null, null, true),
- StandardCharsets.UTF_8);
+ zkClient.getData(PackageUtils.REPOSITORIES_ZK_PATH, null, null), StandardCharsets.UTF_8);
}
return "[]";
}
diff --git a/solr/core/src/java/org/apache/solr/pkg/PackageAPI.java b/solr/core/src/java/org/apache/solr/pkg/PackageAPI.java
index 16ed45ef0ab..24ea22cd387 100644
--- a/solr/core/src/java/org/apache/solr/pkg/PackageAPI.java
+++ b/solr/core/src/java/org/apache/solr/pkg/PackageAPI.java
@@ -113,18 +113,14 @@ public class PackageAPI {
refreshPackages(thisWatch);
}
}
- },
- true);
+ });
}
public void refreshPackages(Watcher watcher) {
final Stat stat = new Stat();
try {
final byte[] data =
- coreContainer
- .getZkController()
- .getZkClient()
- .getData(SOLR_PKGS_PATH, watcher, stat, true);
+ coreContainer.getZkController().getZkClient().getData(SOLR_PKGS_PATH, watcher, stat);
pkgs = readPkgsFromZk(data, stat);
packageLoader.refreshPackageConf();
} catch (KeeperException.ConnectionLossException | KeeperException.SessionExpiredException e) {
@@ -144,8 +140,7 @@ public class PackageAPI {
if (data == null || stat == null) {
stat = new Stat();
- data =
- coreContainer.getZkController().getZkClient().getData(SOLR_PKGS_PATH, null, stat, true);
+ data = coreContainer.getZkController().getZkClient().getData(SOLR_PKGS_PATH, null, stat);
}
Packages packages = null;
if (data == null || data.length == 0) {
diff --git a/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java b/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
index b2f449aeb86..54e6838902b 100644
--- a/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
+++ b/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
@@ -234,7 +234,6 @@ public abstract class ManagedResourceStorage {
protected SolrZkClient zkClient;
protected String znodeBase;
- protected boolean retryOnConnLoss = true;
public ZooKeeperStorageIO(SolrZkClient zkClient, String znodeBase) {
this.zkClient = zkClient;
@@ -246,8 +245,8 @@ public abstract class ManagedResourceStorage {
throws SolrException {
// validate connectivity and the configured znode base
try {
- if (!zkClient.exists(znodeBase, retryOnConnLoss)) {
- zkClient.makePath(znodeBase, retryOnConnLoss);
+ if (!zkClient.exists(znodeBase)) {
+ zkClient.makePath(znodeBase);
}
} catch (Exception exc) {
String errMsg =
@@ -264,7 +263,7 @@ public abstract class ManagedResourceStorage {
public boolean exists(String storedResourceId) throws IOException {
final String znodePath = getZnodeForResource(storedResourceId);
try {
- return zkClient.exists(znodePath, retryOnConnLoss);
+ return zkClient.exists(znodePath);
} catch (Exception e) {
if (e instanceof IOException) {
throw (IOException) e;
@@ -279,8 +278,8 @@ public abstract class ManagedResourceStorage {
final String znodePath = getZnodeForResource(storedResourceId);
byte[] znodeData = null;
try {
- if (zkClient.exists(znodePath, retryOnConnLoss)) {
- znodeData = zkClient.getData(znodePath, null, null, retryOnConnLoss);
+ if (zkClient.exists(znodePath)) {
+ znodeData = zkClient.getData(znodePath, null, null);
}
} catch (Exception e) {
if (e instanceof IOException) {
@@ -303,18 +302,17 @@ public abstract class ManagedResourceStorage {
@Override
public OutputStream openOutputStream(String storedResourceId) throws IOException {
final String znodePath = getZnodeForResource(storedResourceId);
- final boolean retryOnConnLoss = this.retryOnConnLoss;
ByteArrayOutputStream baos =
new ByteArrayOutputStream() {
@Override
public void close() {
byte[] znodeData = toByteArray();
try {
- if (zkClient.exists(znodePath, retryOnConnLoss)) {
- zkClient.setData(znodePath, znodeData, retryOnConnLoss);
+ if (zkClient.exists(znodePath)) {
+ zkClient.setData(znodePath, znodeData);
log.info("Wrote {} bytes to existing znode {}", znodeData.length, znodePath);
} else {
- zkClient.makePath(znodePath, znodeData, retryOnConnLoss);
+ zkClient.makePath(znodePath, znodeData);
log.info("Wrote {} bytes to new znode {}", znodeData.length, znodePath);
}
} catch (Exception e) {
@@ -346,10 +344,10 @@ public abstract class ManagedResourceStorage {
// this might be overkill for a delete operation
try {
- if (zkClient.exists(znodePath, retryOnConnLoss)) {
+ if (zkClient.exists(znodePath)) {
log.debug("Attempting to delete znode {}", znodePath);
- zkClient.delete(znodePath, -1, retryOnConnLoss);
- wasDeleted = zkClient.exists(znodePath, retryOnConnLoss);
+ zkClient.delete(znodePath, -1);
+ wasDeleted = zkClient.exists(znodePath);
if (wasDeleted) {
log.info("Deleted znode {}", znodePath);
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
index 75c2f9c9a93..e1d8ad5b5ab 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
@@ -178,7 +178,7 @@ public final class ManagedIndexSchema extends IndexSchema {
final byte[] data = writer.toString().getBytes(StandardCharsets.UTF_8);
if (createOnly) {
try {
- zkClient.create(managedSchemaPath, data, CreateMode.PERSISTENT, true);
+ zkClient.create(managedSchemaPath, data, CreateMode.PERSISTENT);
schemaZkVersion = 0;
log.info("Created and persisted managed schema znode at {}", managedSchemaPath);
} catch (KeeperException.NodeExistsException e) {
@@ -190,7 +190,7 @@ public final class ManagedIndexSchema extends IndexSchema {
} else {
try {
// Assumption: the path exists
- Stat stat = zkClient.setData(managedSchemaPath, data, schemaZkVersion, true);
+ Stat stat = zkClient.setData(managedSchemaPath, data, schemaZkVersion);
schemaZkVersion = stat.getVersion();
log.info(
"Persisted managed schema version {} at {}", schemaZkVersion, managedSchemaPath);
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
index a67c11f6654..83797b7c0f8 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java
@@ -123,7 +123,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
+ ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME;
try {
// check if we are using the legacy managed-schema file name.
- if (zkClient.exists(legacyManagedSchemaPath, true)) {
+ if (zkClient.exists(legacyManagedSchemaPath)) {
log.debug(
"Legacy managed schema resource {} found - loading legacy managed schema instead of {} file.",
ManagedIndexSchemaFactory.LEGACY_MANAGED_SCHEMA_RESOURCE_NAME,
@@ -218,7 +218,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
Stat stat = new Stat();
try {
// Attempt to load the managed schema
- byte[] data = zkClient.getData(managedSchemaPath, null, stat, true);
+ byte[] data = zkClient.getData(managedSchemaPath, null, stat);
schemaZkVersion = stat.getVersion();
schemaInputStream =
new ZkSolrResourceLoader.ZkByteArrayInputStream(data, managedSchemaPath, stat);
@@ -247,7 +247,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
} catch (IOException e) {
try {
// Retry to load the managed schema, in case it was created since the first attempt
- byte[] data = zkClient.getData(managedSchemaPath, null, stat, true);
+ byte[] data = zkClient.getData(managedSchemaPath, null, stat);
schemaZkVersion = stat.getVersion();
schemaInputStream = new ByteArrayInputStream(data);
loadedResource = managedSchemaPath;
@@ -468,7 +468,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
boolean locked = false;
try {
try {
- zkClient.makePath(lockPath, null, CreateMode.EPHEMERAL, null, true, true);
+ zkClient.makePath(lockPath, null, CreateMode.EPHEMERAL, null, true);
locked = true;
} catch (Exception e) {
// some other node already started the upgrade, or an error occurred - bail out
@@ -485,14 +485,14 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
try {
if (zkController.pathExists(nonManagedSchemaPath)) {
// First, copy the non-managed schema znode content to the upgraded schema znode
- byte[] bytes = zkController.getZkClient().getData(nonManagedSchemaPath, null, null, true);
+ byte[] bytes = zkController.getZkClient().getData(nonManagedSchemaPath, null, null);
final String upgradedSchemaPath = nonManagedSchemaPath + UPGRADED_SCHEMA_EXTENSION;
ZkMaintenanceUtils.ensureExists(upgradedSchemaPath, zkController.getZkClient());
- zkController.getZkClient().setData(upgradedSchemaPath, bytes, true);
+ zkController.getZkClient().setData(upgradedSchemaPath, bytes);
// Then delete the non-managed schema znode
- if (zkController.getZkClient().exists(nonManagedSchemaPath, true)) {
+ if (zkController.getZkClient().exists(nonManagedSchemaPath)) {
try {
- zkController.getZkClient().delete(nonManagedSchemaPath, -1, true);
+ zkController.getZkClient().delete(nonManagedSchemaPath, -1);
} catch (KeeperException.NoNodeException ex) {
// ignore - someone beat us to it
}
@@ -522,7 +522,7 @@ public class ManagedIndexSchemaFactory extends IndexSchemaFactory implements Sol
if (locked) {
// unlock
try {
- zkClient.delete(lockPath, -1, true);
+ zkClient.delete(lockPath, -1);
} catch (KeeperException.NoNodeException nne) {
// ignore - someone else deleted it
} catch (Exception e) {
diff --git a/solr/core/src/java/org/apache/solr/schema/SchemaManager.java b/solr/core/src/java/org/apache/solr/schema/SchemaManager.java
index 62c7434bb0f..b2ae09fcd22 100644
--- a/solr/core/src/java/org/apache/solr/schema/SchemaManager.java
+++ b/solr/core/src/java/org/apache/solr/schema/SchemaManager.java
@@ -520,10 +520,10 @@ public class SchemaManager {
SolrZkClient zkClient = zkLoader.getZkController().getZkClient();
String managedSchemaPath = zkLoader.getConfigSetZkPath() + "/" + schemaResourceName;
try {
- if (!zkClient.exists(managedSchemaPath, true)) {
+ if (!zkClient.exists(managedSchemaPath)) {
String backupName =
schemaResourceName + ManagedIndexSchemaFactory.UPGRADED_SCHEMA_EXTENSION;
- if (!zkClient.exists(zkLoader.getConfigSetZkPath() + "/" + backupName, true)) {
+ if (!zkClient.exists(zkLoader.getConfigSetZkPath() + "/" + backupName)) {
log.warn(
"Unable to retrieve fresh managed schema, neither {} nor {} exist.",
schemaResourceName,
diff --git a/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java b/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java
index 15d479608f4..21af5c3c656 100644
--- a/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java
+++ b/solr/core/src/java/org/apache/solr/schema/ZkIndexSchemaReader.java
@@ -101,7 +101,7 @@ public class ZkIndexSchemaReader implements OnReconnect {
SchemaWatcher watcher = new SchemaWatcher(this);
try {
- zkClient.exists(managedSchemaPath, watcher, true);
+ zkClient.exists(managedSchemaPath, watcher);
} catch (KeeperException e) {
final String msg = "Error creating ZooKeeper watch for the managed schema";
log.error(msg, e);
@@ -190,7 +190,7 @@ public class ZkIndexSchemaReader implements OnReconnect {
synchronized (getSchemaUpdateLock()) {
final ManagedIndexSchema oldSchema = managedIndexSchemaFactory.getSchema();
if (expectedZkVersion == -1 || oldSchema.schemaZkVersion < expectedZkVersion) {
- byte[] data = zkClient.getData(managedSchemaPath, watcher, stat, true);
+ byte[] data = zkClient.getData(managedSchemaPath, watcher, stat);
if (stat.getVersion() != oldSchema.schemaZkVersion) {
if (log.isInfoEnabled()) {
log.info("Retrieved schema version {} from Zookeeper", stat.getVersion());
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 0e3642501c5..97a9677b69b 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -400,7 +400,7 @@ public class HttpSolrCall {
.getZkController()
.zkStateReader
.getZkClient()
- .exists(DocCollection.getCollectionPath(collectionName), true)) {
+ .exists(DocCollection.getCollectionPath(collectionName))) {
// no change and such a collection does not exist. go back
return;
}
diff --git a/solr/core/src/java/org/apache/solr/servlet/QueryRateLimiter.java b/solr/core/src/java/org/apache/solr/servlet/QueryRateLimiter.java
index dae744c0df4..4d82dfcf76c 100644
--- a/solr/core/src/java/org/apache/solr/servlet/QueryRateLimiter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/QueryRateLimiter.java
@@ -80,7 +80,7 @@ public class QueryRateLimiter extends RequestRateLimiter {
Map<String, Object> clusterPropsJson =
(Map<String, Object>)
- Utils.fromJSON(zkClient.getData(ZkStateReader.CLUSTER_PROPS, null, new Stat(), true));
+ Utils.fromJSON(zkClient.getData(ZkStateReader.CLUSTER_PROPS, null, new Stat()));
byte[] configInput = Utils.toJSON(clusterPropsJson.get(RL_CONFIG_KEY));
if (configInput.length == 0) {
diff --git a/solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.java b/solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.java
index d7c86595dbc..9124fd2b16a 100644
--- a/solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.java
+++ b/solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.java
@@ -101,8 +101,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
String content =
new String(
- zkClient.getData("/configs/upconfig2/schema.xml", null, null, true),
- StandardCharsets.UTF_8);
+ zkClient.getData("/configs/upconfig2/schema.xml", null, null), StandardCharsets.UTF_8);
assertTrue(
"There should be content in the node! ", content.contains("Apache Software Foundation"));
}
@@ -243,7 +242,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
assertEquals("Copy up to intermediate file should have succeeded.", 0, res);
assertTrue(
"Should have created an intermediate node on ZK",
- zkClient.exists("/powerup/solrconfig.xml", true));
+ zkClient.exists("/powerup/solrconfig.xml"));
// copy individual file up
// src and cp3 are valid
@@ -259,8 +258,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
res = CLITestHelper.runTool(args, ZkCpTool.class);
assertEquals("Copy up to named file should have succeeded.", 0, res);
assertTrue(
- "Should NOT have created an intermediate node on ZK",
- zkClient.exists("/copyUpFile.xml", true));
+ "Should NOT have created an intermediate node on ZK", zkClient.exists("/copyUpFile.xml"));
// copy individual file down
// src and cp3 are valid
@@ -288,8 +286,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
res = CLITestHelper.runTool(args, ZkCpTool.class);
assertEquals("Copy from somewhere in ZK to ZK root should have succeeded.", 0, res);
- assertTrue(
- "Should have found znode /solrconfig.xml: ", zkClient.exists("/solrconfig.xml", true));
+ assertTrue("Should have found znode /solrconfig.xml: ", zkClient.exists("/solrconfig.xml"));
// Check that the form path/ works for copying files up. Should append the last bit of the
// source path to the dst
@@ -313,8 +310,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
assertEquals("Copy should have succeeded.", 0, res);
String content =
- new String(
- zkClient.getData("/cp7/conf/stopwords", null, null, true), StandardCharsets.UTF_8);
+ new String(zkClient.getData("/cp7/conf/stopwords", null, null), StandardCharsets.UTF_8);
assertTrue("There should be content in the node! ", content.contains("{Some Arbitrary Data}"));
res = CLITestHelper.runTool(args, ZkCpTool.class);
@@ -336,8 +332,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
assertEquals("Copy should have succeeded.", 0, res);
content =
- new String(
- zkClient.getData("/cp9/conf/stopwords", null, null, true), StandardCharsets.UTF_8);
+ new String(zkClient.getData("/cp9/conf/stopwords", null, null), StandardCharsets.UTF_8);
assertTrue("There should be content in the node! ", content.contains("{Some Arbitrary Data}"));
// Copy an individual empty file up and back down and insure it's still a file
@@ -409,7 +404,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
// Now does the moved directory match the original on disk?
verifyZkLocalPathsMatch(srcPathCheck, "/mv2");
// And are we sure the old path is gone?
- assertFalse("/configs/mv1 Znode should not be there: ", zkClient.exists("/configs/mv1", true));
+ assertFalse("/configs/mv1 Znode should not be there: ", zkClient.exists("/configs/mv1"));
// Files are in mv2
// Now fail if we specify "file:". Everything should still be in /mv2
@@ -432,7 +427,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
res = CLITestHelper.runTool(args, ZkMvTool.class);
assertEquals("Move should have succeeded.", 0, res);
- assertFalse("Znode /mv3 really should be gone", zkClient.exists("/mv3", true));
+ assertFalse("Znode /mv3 really should be gone", zkClient.exists("/mv3"));
// Now does the moved directory match the original on disk?
verifyZkLocalPathsMatch(srcPathCheck, "/mv4");
@@ -442,8 +437,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
res = CLITestHelper.runTool(args, ZkMvTool.class);
assertEquals("Move should have succeeded.", 0, res);
assertTrue(
- "Should be able to move a single file",
- zkClient.exists("/testmvsingle/solrconfig.xml", true));
+ "Should be able to move a single file", zkClient.exists("/testmvsingle/solrconfig.xml"));
zkClient.makePath("/parentNode", true);
@@ -454,10 +448,9 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
assertEquals("Move should have succeeded.", 0, res);
assertTrue(
"Should be able to move a single file to a parent znode",
- zkClient.exists("/parentnode/schema.xml", true));
+ zkClient.exists("/parentnode/schema.xml"));
String content =
- new String(
- zkClient.getData("/parentnode/schema.xml", null, null, true), StandardCharsets.UTF_8);
+ new String(zkClient.getData("/parentnode/schema.xml", null, null), StandardCharsets.UTF_8);
assertTrue(
"There should be content in the node! ", content.contains("Apache Software Foundation"));
}
@@ -566,16 +559,14 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
res = CLITestHelper.runTool(args, ZkRmTool.class);
assertEquals("Should have removed node /configs/rm1", 0, res);
- assertFalse(
- "Znode /configs/toremove really should be gone", zkClient.exists("/configs/rm1", true));
+ assertFalse("Znode /configs/toremove really should be gone", zkClient.exists("/configs/rm1"));
// Check that zk prefix also works.
args = new String[] {"rm", "--recursive", "--zk-host", zkAddr, "zk:/configs/rm2"};
res = CLITestHelper.runTool(args, ZkRmTool.class);
assertEquals("Should have removed node /configs/rm2", 0, res);
- assertFalse(
- "Znode /configs/toremove2 really should be gone", zkClient.exists("/configs/rm2", true));
+ assertFalse("Znode /configs/toremove2 really should be gone", zkClient.exists("/configs/rm2"));
// This should silently just refuse to do anything to the / or /zookeeper
args = new String[] {"rm", "--recursive", "--zk-host", zkAddr, "zk:/"};
@@ -593,14 +584,14 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
}
private static boolean isEphemeral(String zkPath) throws KeeperException, InterruptedException {
- Stat znodeStat = zkClient.exists(zkPath, null, true);
+ Stat znodeStat = zkClient.exists(zkPath, null);
return znodeStat.getEphemeralOwner() != 0;
}
void verifyAllZNodesAreFiles(Path fileRoot, String zkRoot)
throws KeeperException, InterruptedException {
- for (String child : zkClient.getChildren(zkRoot, null, true)) {
+ for (String child : zkClient.getChildren(zkRoot, null)) {
// Skip ephemeral nodes
if (!zkRoot.endsWith("/")) {
zkRoot += "/";
@@ -622,8 +613,7 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
void checkPathOnZk(Path path) {
String znode = ZkMaintenanceUtils.createZkNodeName(zkRoot, fileRoot, path);
try { // It's easier to catch this exception and fail than catch it everywhere else.
- assertTrue(
- "Should have found " + znode + " on Zookeeper", zkClient.exists(znode, true));
+ assertTrue("Should have found " + znode + " on Zookeeper", zkClient.exists(znode));
} catch (Exception e) {
fail(
"Caught unexpected exception "
@@ -659,10 +649,10 @@ public class SolrCLIZkToolsTest extends SolrCloudTestCase {
// Note, no fuss here with Windows path names.
private void verifyFirstZNodesInSecond(String first, String second)
throws KeeperException, InterruptedException {
- for (String node : zkClient.getChildren(first, null, true)) {
+ for (String node : zkClient.getChildren(first, null)) {
String fNode = first + "/" + node;
String sNode = second + "/" + node;
- assertTrue("Node " + sNode + " not found. Exists on " + fNode, zkClient.exists(sNode, true));
+ assertTrue("Node " + sNode + " not found. Exists on " + fNode, zkClient.exists(sNode));
verifyFirstZNodesInSecond(fNode, sNode);
}
}
diff --git a/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java b/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java
index 26cc304ef84..afdc3ad81cd 100644
--- a/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java
+++ b/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java
@@ -103,7 +103,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
.withUrl(zkServer.getZkAddress())
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build();
- zkClient.makePath("/solr", false, true);
+ zkClient.makePath("/solr", false);
if (log.isInfoEnabled()) {
log.info("####SETUP_END {}", getTestName());
@@ -125,7 +125,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
assertEquals(0, CLITestHelper.runTool(args, ZkCpTool.class));
assertArrayEquals(
- zkClient.getData("/data.txt", null, null, true), data.getBytes(StandardCharsets.UTF_8));
+ zkClient.getData("/data.txt", null, null), data.getBytes(StandardCharsets.UTF_8));
// test re-put to existing
data = "my data deux";
@@ -138,7 +138,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
assertEquals(0, CLITestHelper.runTool(args, ZkCpTool.class));
assertArrayEquals(
- zkClient.getData("/data.txt", null, null, true), data.getBytes(StandardCharsets.UTF_8));
+ zkClient.getData("/data.txt", null, null), data.getBytes(StandardCharsets.UTF_8));
}
@Test
@@ -217,8 +217,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
assertEquals(0, CLITestHelper.runTool(args, ZkCpTool.class));
- String fromZk =
- new String(zkClient.getData("/foo.xml", null, null, true), StandardCharsets.UTF_8);
+ String fromZk = new String(zkClient.getData("/foo.xml", null, null), StandardCharsets.UTF_8);
Path localFile = SOLR_HOME.resolve("solr-stress-new.xml");
String fromLocalFile = Files.readString(localFile);
assertEquals("Should get back what we put in ZK", fromZk, fromLocalFile);
@@ -238,8 +237,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
assertEquals(0, CLITestHelper.runTool(args, ZkCpTool.class));
- String fromZk =
- new String(zkClient.getData("/foo.xml", null, null, true), StandardCharsets.UTF_8);
+ String fromZk = new String(zkClient.getData("/foo.xml", null, null), StandardCharsets.UTF_8);
Path localFile = SOLR_HOME.resolve("solr-stress-new.xml");
String fromLocalFile = Files.readString(localFile);
assertEquals("Should get back what we put in ZK", fromZk, fromLocalFile);
@@ -345,11 +343,11 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
assertEquals(0, CLITestHelper.runTool(args, ConfigSetUploadTool.class));
- assertTrue(zkClient.exists(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, true));
+ assertTrue(zkClient.exists(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname));
final Path confDir = ExternalPaths.TECHPRODUCTS_CONFIGSET;
List<String> zkFiles =
- zkClient.getChildren(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, null, true);
+ zkClient.getChildren(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, null);
try (Stream<Path> filesStream = Files.list(confDir)) {
assertEquals(
@@ -372,7 +370,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
ZkNodeProps collectionProps =
ZkNodeProps.load(
- zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/collection1", null, null, true));
+ zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/collection1", null, null));
assertTrue(collectionProps.containsKey("configName"));
assertEquals(confsetname, collectionProps.getStr("configName"));
@@ -398,8 +396,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
try (Stream<Path> filesStream = Files.list(destDir.resolve("conf"))) {
List<Path> files = filesStream.toList();
- zkFiles =
- zkClient.getChildren(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, null, true);
+ zkFiles = zkClient.getChildren(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, null);
assertEquals(
"Comparing original conf files that were to be uploaded to what is in ZK",
files.size(),
@@ -443,14 +440,14 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
assertEquals(0, CLITestHelper.runTool(args, ZkRmTool.class));
- assertEquals(0, zkClient.getChildren("/configs", null, true).size());
+ assertEquals(0, zkClient.getChildren("/configs", null).size());
}
@Test
public void testGet() throws Exception {
String getNode = "/getNode";
byte[] data = "getNode-data".getBytes(StandardCharsets.UTF_8);
- zkClient.create(getNode, data, CreateMode.PERSISTENT, true);
+ zkClient.create(getNode, data, CreateMode.PERSISTENT);
Path localFile = Files.createTempFile("temp", ".data");
@@ -478,7 +475,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
random().nextBoolean()
? zLibCompressor.compressBytes(data)
: zLibCompressor.compressBytes(data, data.length / 10);
- zkClient.create(getNode, compressedData, CreateMode.PERSISTENT, true);
+ zkClient.create(getNode, compressedData, CreateMode.PERSISTENT);
Path localFile = Files.createTempFile("temp", ".data");
@@ -496,7 +493,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
String getNode = "/getFileNode";
byte[] data = "getFileNode-data".getBytes(StandardCharsets.UTF_8);
- zkClient.create(getNode, data, CreateMode.PERSISTENT, true);
+ zkClient.create(getNode, data, CreateMode.PERSISTENT);
Path file =
tmpDir.resolve("solrtest-getfile-" + this.getClass().getName() + "-" + System.nanoTime());
@@ -519,7 +516,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
random().nextBoolean()
? zLibCompressor.compressBytes(data)
: zLibCompressor.compressBytes(data, data.length / 10);
- zkClient.create(getNode, compressedData, CreateMode.PERSISTENT, true);
+ zkClient.create(getNode, compressedData, CreateMode.PERSISTENT);
Path file =
tmpDir.resolve("solrtest-getfile-" + this.getClass().getName() + "-" + System.nanoTime());
@@ -607,7 +604,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {
.withTimeout(
AbstractFullDistribZkTestBase.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)
.build()) {
- zkClient.getData("/", null, null, true);
+ zkClient.getData("/", null, null);
} catch (KeeperException.NoAuthException e) {
excepted = true;
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
index a8f36698f4f..b6b7b67211c 100644
--- a/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
@@ -124,7 +124,7 @@ public class AliasIntegrationTest extends SolrCloudTestCase {
assertEquals("collection1meta", aliases.get(0));
assertEquals("collection2meta", aliases.get(1));
// ensure we have the back-compat format in ZK:
- final byte[] rawBytes = zkStateReader.getZkClient().getData(ALIASES, null, null, true);
+ final byte[] rawBytes = zkStateReader.getZkClient().getData(ALIASES, null, null);
assertTrue(
((Map<String, Map<String, ?>>) Utils.fromJSON(rawBytes)).get("collection").get("meta1")
instanceof String);
diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
index d4ad2628c32..203d035318e 100644
--- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
+++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
@@ -275,7 +275,7 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
int oldLiveNodes =
ZkStateReader.from(cloudClient)
.getZkClient()
- .getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null, true)
+ .getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null)
.size();
assertEquals(5, oldLiveNodes);
diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java
index 7d963ee6b9a..87f71cc0570 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java
@@ -171,8 +171,7 @@ public class CollectionPropsTest extends SolrCloudTestCase {
new String(
cluster
.getZkClient()
- .getData(
- "/collections/" + collectionName + "/collectionprops.json", null, null, true),
+ .getData("/collections/" + collectionName + "/collectionprops.json", null, null),
StandardCharsets.UTF_8);
} catch (Exception e) {
collectionpropsInZk = "Could not get file from ZooKeeper: " + e.getMessage();
@@ -222,7 +221,7 @@ public class CollectionPropsTest extends SolrCloudTestCase {
log.info("deleting props");
zkStateReader
.getZkClient()
- .delete("/collections/" + collectionName + "/collectionprops.json", -1, true);
+ .delete("/collections/" + collectionName + "/collectionprops.json", -1);
assertEquals(1, watcher.waitForTrigger());
final Map<String, String> props = watcher.getProps();
assertTrue(props.toString(), props.isEmpty());
diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionStateZnodeTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionStateZnodeTest.java
index ad31c1317cb..3d52f744004 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CollectionStateZnodeTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionStateZnodeTest.java
@@ -51,10 +51,10 @@ public class CollectionStateZnodeTest extends SolrCloudTestCase {
(n, c) -> SolrCloudTestCase.replicasForCollectionAreFullyActive(n, c, 2, 2));
assertTrue(
"Collection path does not exist",
- zkClient().exists(DocCollection.getCollectionPath(collectionName), true));
+ zkClient().exists(DocCollection.getCollectionPath(collectionName)));
Stat stat = new Stat();
- zkClient().getData(DocCollection.getCollectionPath(collectionName), null, stat, true);
+ zkClient().getData(DocCollection.getCollectionPath(collectionName), null, stat);
DocCollection c = getCollectionState(collectionName);
@@ -69,6 +69,6 @@ public class CollectionStateZnodeTest extends SolrCloudTestCase {
assertFalse(
"collection state should not exist",
- zkClient().exists(DocCollection.getCollectionPath(collectionName), true));
+ zkClient().exists(DocCollection.getCollectionPath(collectionName)));
}
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
index 20f17609ffb..ad6c7d08e9b 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
@@ -135,13 +135,13 @@ public class DeleteShardTest extends SolrCloudTestCase {
String collectionRoot = ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection;
String leaderElectPath = collectionRoot + "/leader_elect/" + sliceId;
- assertEquals(shouldExist, cluster.getZkClient().exists(leaderElectPath, true));
+ assertEquals(shouldExist, cluster.getZkClient().exists(leaderElectPath));
String leaderPath = collectionRoot + "/leaders/" + sliceId;
- assertEquals(shouldExist, cluster.getZkClient().exists(leaderPath, true));
+ assertEquals(shouldExist, cluster.getZkClient().exists(leaderPath));
String termPath = collectionRoot + "/terms/" + sliceId;
- assertEquals(shouldExist, cluster.getZkClient().exists(termPath, true));
+ assertEquals(shouldExist, cluster.getZkClient().exists(termPath));
// Check if the shard name is present in any node under the collection root.
// This way, new/unexpected stuff could be detected.
diff --git a/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java b/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java
index 152a5742bd9..003a04bda61 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DistributedQueueTest.java
@@ -340,9 +340,9 @@ public class DistributedQueueTest extends SolrTestCaseJ4 {
}
protected String setupNewDistributedQueueZNode(String znodePath) throws Exception {
- if (!zkClient.exists("/", true)) zkClient.makePath("/", false, true);
- if (zkClient.exists(znodePath, true)) zkClient.clean(znodePath);
- zkClient.makePath(znodePath, false, true);
+ if (!zkClient.exists("/")) zkClient.makePath("/", false);
+ if (zkClient.exists(znodePath)) zkClient.clean(znodePath);
+ zkClient.makePath(znodePath, false);
return znodePath;
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java
index e8519f6382c..7591dde5362 100644
--- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionContextKeyTest.java
@@ -129,7 +129,6 @@ public class LeaderElectionContextKeyTest extends SolrCloudTestCase {
throws KeeperException, InterruptedException {
return client.getChildren(
"/collections/" + collection + "/leader_elect/" + shard + LeaderElector.ELECTION_NODE,
- null,
- true);
+ null);
}
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java
index c92645ed710..45e2b3f67c6 100644
--- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java
@@ -295,8 +295,7 @@ public class LeaderElectionTest extends SolrTestCaseJ4 {
while (iterCount-- > 0) {
try {
byte[] data =
- zkClient.getData(
- ZkStateReader.getShardLeadersPath(collection, slice), null, null, true);
+ zkClient.getData(ZkStateReader.getShardLeadersPath(collection, slice), null, null);
ZkCoreNodeProps leaderProps = new ZkCoreNodeProps(ZkNodeProps.load(data));
return leaderProps.getCoreUrl();
} catch (NoNodeException | SessionExpiredException e) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java
index 72f062e44c4..01b8f4d1368 100644
--- a/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java
@@ -280,7 +280,7 @@ public class LeaderVoteWaitTimeoutTest extends SolrCloudTestCase {
List<String> children =
zkClient()
.getChildren(
- "/collections/" + collectionName + "/leader_elect/shard1/election", null, true);
+ "/collections/" + collectionName + "/leader_elect/shard1/election", null);
log.info("{} election nodes:{}", collectionName, children);
throw e;
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java
index 4c0ad7af750..12e84a97a42 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java
@@ -76,7 +76,7 @@ public class OutOfBoxZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.withUrl(zkServer.getZkHost())
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build();
- zkClient.makePath("/solr", false, true);
+ zkClient.makePath("/solr", false);
zkClient.close();
zkClient =
@@ -85,21 +85,17 @@ public class OutOfBoxZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build();
zkClient.create(
- "/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.makePath(
- "/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.create(
- "/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.makePath(
- "/unprotectedMakePathNode",
- "content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ "/unprotectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.create(
SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH,
"content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ CreateMode.PERSISTENT);
zkClient.close();
if (log.isInfoEnabled()) {
@@ -152,7 +148,7 @@ public class OutOfBoxZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
protected void assertOpenACLUnsafeAllover(
SolrZkClient zkClient, String path, List<String> verifiedList) throws Exception {
- List<ACL> acls = zkClient.getACL(path, new Stat(), true);
+ List<ACL> acls = zkClient.getACL(path, new Stat());
if (log.isInfoEnabled()) {
log.info("Verifying {}", path);
}
@@ -169,7 +165,7 @@ public class OutOfBoxZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
"Path " + path + " does not have OPEN_ACL_UNSAFE", ZooDefs.Ids.OPEN_ACL_UNSAFE, acls);
}
verifiedList.add(path);
- List<String> children = zkClient.getChildren(path, null, false);
+ List<String> children = zkClient.getChildren(path, null);
for (String child : children) {
assertOpenACLUnsafeAllover(
zkClient, path + ((path.endsWith("/")) ? "" : "/") + child, verifiedList);
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
index 2f3f2201ede..7d0eeba82a3 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
@@ -89,7 +89,7 @@ public class OverriddenZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
"readonlyACLUsername",
"readonlyACLPassword")
.getSolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT)) {
- zkClient.makePath("/solr", false, true);
+ zkClient.makePath("/solr", false);
}
try (SolrZkClient zkClient =
@@ -100,17 +100,13 @@ public class OverriddenZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
"readonlyACLPassword")
.getSolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT)) {
zkClient.create(
- "/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.makePath(
- "/protectedMakePathNode",
- "content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ "/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.create(
SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH,
"content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ CreateMode.PERSISTENT);
}
try (SolrZkClient zkClient =
@@ -123,15 +119,9 @@ public class OverriddenZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
("connectAndAllACLUsername:connectAndAllACLPassword")
.getBytes(DATA_ENCODING)))) {
zkClient.create(
- "/unprotectedCreateNode",
- "content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ "/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.makePath(
- "/unprotectedMakePathNode",
- "content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ "/unprotectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
}
if (log.isInfoEnabled()) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
index a6b95ae7e7a..ab2548e30fa 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
@@ -452,7 +452,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
when(clusterStateMock.getLiveNodes()).thenReturn(liveNodes);
- when(solrZkClientMock.setData(anyString(), any(), anyInt(), anyBoolean()))
+ when(solrZkClientMock.setData(anyString(), any(), anyInt()))
.then(
invocation -> {
System.out.println(
@@ -465,7 +465,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
return null;
});
- when(solrZkClientMock.getData(anyString(), any(), any(), anyBoolean()))
+ when(solrZkClientMock.getData(anyString(), any(), any()))
.thenAnswer(
invocation -> {
byte[] data = zkClientData.get(invocation.getArgument(0));
@@ -475,14 +475,14 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
return data;
});
- when(solrZkClientMock.create(any(), any(), any(), anyBoolean()))
+ when(solrZkClientMock.create(any(), any(), any()))
.thenAnswer(
invocation -> {
zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
return invocation.getArgument(0);
});
- when(solrZkClientMock.exists(any(String.class), anyBoolean()))
+ when(solrZkClientMock.exists(any(String.class)))
.thenAnswer(
invocation -> {
String key = invocation.getArgument(0);
@@ -569,7 +569,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
.when(distribStateManagerMock)
.makePath(anyString());
- when(solrZkClientMock.exists(any(String.class), isNull(), anyBoolean()))
+ when(solrZkClientMock.exists(any(String.class), isNull()))
.thenAnswer(
invocation -> {
String key = invocation.getArgument(0);
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
index 757da989ad9..84666910816 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
@@ -154,13 +154,13 @@ public class OverseerTest extends SolrTestCaseJ4 {
// live node
final String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
- zkClient.makePath(nodePath, CreateMode.EPHEMERAL, true);
+ zkClient.makePath(nodePath, CreateMode.EPHEMERAL);
}
private void deleteNode(final String path) {
try {
- zkClient.delete(path, -1, true);
+ zkClient.delete(path, -1);
} catch (NoNodeException e) {
// fine
log.warn("cancelElection did not find election node to remove");
@@ -1643,9 +1643,9 @@ public class OverseerTest extends SolrTestCaseJ4 {
final String path =
ZkStateReader.COLLECTIONS_ZKNODE + "/" + testCollectionName + "/state.json";
- byte[] data = zkClient.getData(path, null, null, true);
+ byte[] data = zkClient.getData(path, null, null);
// Simulate an external modification of state.json
- zkClient.setData(path, data, true);
+ zkClient.setData(path, data);
m =
new ZkNodeProps(
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java
index 2909539433f..d87bf88439c 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java
@@ -271,7 +271,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
throws Exception {
byte[] oldPropsData = null;
try {
- oldPropsData = zkClient.getData(path, null, null, true);
+ oldPropsData = zkClient.getData(path, null, null);
} catch (KeeperException.NoNodeException e) {
// okay, properties just don't exist
}
@@ -365,13 +365,11 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
zkClient.create(
"/configs/myconf/firstDummyFile",
"first dummy content".getBytes(UTF_8),
- CreateMode.PERSISTENT,
- true);
+ CreateMode.PERSISTENT);
zkClient.create(
"/configs/myconf/anotherDummyFile",
"second dummy content".getBytes(UTF_8),
- CreateMode.PERSISTENT,
- true);
+ CreateMode.PERSISTENT);
// Checking error when configuration name specified already exists
ignoreException("already exists");
@@ -389,10 +387,10 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
assertEquals(400l, statusCode);
assertTrue(
"Expected file doesnt exist in zk. It's possibly overwritten",
- zkClient.exists("/configs/myconf/firstDummyFile", true));
+ zkClient.exists("/configs/myconf/firstDummyFile"));
assertTrue(
"Expected file doesnt exist in zk. It's possibly overwritten",
- zkClient.exists("/configs/myconf/anotherDummyFile", true));
+ zkClient.exists("/configs/myconf/anotherDummyFile"));
zkClient.close();
solrClient.close();
@@ -450,7 +448,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
assertTrue(
"managed-schema file should have been uploaded",
- zkClient.exists("/configs/" + configSetName + "/managed-schema", true));
+ zkClient.exists("/configs/" + configSetName + "/managed-schema"));
} finally {
zkClient.close();
}
@@ -558,15 +556,14 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
0, uploadConfigSet(configsetName, configsetSuffix, null, true, false, v2, false, false));
for (String f : extraFiles) {
assertTrue(
- "Expecting file " + f + " to exist in ConfigSet but it's gone",
- zkClient.exists(f, true));
+ "Expecting file " + f + " to exist in ConfigSet but it's gone", zkClient.exists(f));
}
assertEquals(
0, uploadConfigSet(configsetName, configsetSuffix, null, true, true, v2, false, false));
for (String f : extraFiles) {
assertFalse(
"Expecting file " + f + " to be deleted from ConfigSet but it wasn't",
- zkClient.exists(f, true));
+ zkClient.exists(f));
}
assertConfigsetFiles(configsetName, configsetSuffix, zkClient);
}
@@ -600,7 +597,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
String f = configPath + "/test." + fileEnding;
assertFalse(
"Expecting file " + f + " to not exist, because it has a forbidden file type",
- zkClient.exists(f, true));
+ zkClient.exists(f));
}
}
}
@@ -791,8 +788,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
assertFalse(
"New file should not exist, since the trust check did not succeed.",
zkClient.exists(
- "/configs/" + configsetName + configsetSuffix + "/test/upload/path/solrconfig.xml",
- true));
+ "/configs/" + configsetName + configsetSuffix + "/test/upload/path/solrconfig.xml"));
assertConfigsetFiles(configsetName, configsetSuffix, zkClient);
unIgnoreException("ConfigSet uploads do not allow cleanup=true when filePath is used.");
}
@@ -839,8 +835,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
+ configsetName
+ configsetSuffix
+ "/test/different/path/solrconfig."
- + fileType,
- true));
+ + fileType));
unIgnoreException("is forbidden for use in configSets");
}
}
@@ -1015,8 +1010,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
List<String> children =
zkClient.getChildren(
String.format(Locale.ROOT, "/configs/%s%s", configsetName, configsetSuffixTrusted),
- null,
- true);
+ null);
assertEquals("The configSet should only have one file uploaded.", 1, children.size());
assertEquals("Incorrect file uploaded.", "solrconfig.xml", children.get(0));
@@ -1040,8 +1034,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
children =
zkClient.getChildren(
String.format(Locale.ROOT, "/configs/%s%s", configsetName, configsetSuffixUntrusted),
- null,
- true);
+ null);
assertEquals("The configSet should only have one file uploaded.", 1, children.size());
assertEquals("Incorrect file uploaded.", "solrconfig.xml", children.get(0));
}
@@ -1054,8 +1047,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
zkClient.getData(
String.format(Locale.ROOT, "/configs/%s%s/%s", configsetName, configsetSuffix, configFile),
null,
- stat,
- true);
+ stat);
return stat.getVersion();
}
@@ -1144,22 +1136,20 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {
throws KeeperException, InterruptedException, IOException {
assertTrue(
"managed-schema.xml file should have been uploaded",
- zkClient.exists("/configs/" + configSetName + suffix + "/managed-schema.xml", true));
+ zkClient.exists("/configs/" + configSetName + suffix + "/managed-schema.xml"));
assertArrayEquals(
"managed-schema.xml file contents on zookeeper are not exactly same as that of the file uploaded in config",
- zkClient.getData(
- "/configs/" + configSetName + suffix + "/managed-schema.xml", null, null, true),
+ zkClient.getData("/configs/" + configSetName + suffix + "/managed-schema.xml", null, null),
readFile("solr/configsets/upload/" + configSetName + "/managed-schema.xml"));
assertTrue(
"solrconfig.xml file should have been uploaded",
- zkClient.exists("/configs/" + configSetName + suffix + "/solrconfig.xml", true));
- byte data[] = zkClient.getData("/configs/" + configSetName + suffix, null, null, true);
+ zkClient.exists("/configs/" + configSetName + suffix + "/solrconfig.xml"));
+ byte data[] = zkClient.getData("/configs/" + configSetName + suffix, null, null);
// assertEquals("{\"trusted\": false}", new String(data, StandardCharsets.UTF_8));
assertArrayEquals(
"solrconfig.xml file contents on zookeeper are not exactly same as that of the file uploaded in config",
- zkClient.getData(
- "/configs/" + configSetName + suffix + "/solrconfig.xml", null, null, true),
+ zkClient.getData("/configs/" + configSetName + suffix + "/solrconfig.xml", null, null),
readFile("solr/configsets/upload/" + configSetName + "/solrconfig.xml"));
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIZkFailure.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIZkFailure.java
index 0b8ccf57b7a..0cce6aef96f 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIZkFailure.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPIZkFailure.java
@@ -156,8 +156,7 @@ public class TestConfigSetsAPIZkFailure extends SolrTestCaseJ4 {
.getZkClient()
.setData(
"/configs/" + baseConfigSetName,
- "{\"trusted\": false}".getBytes(StandardCharsets.UTF_8),
- true);
+ "{\"trusted\": false}".getBytes(StandardCharsets.UTF_8));
}
private StringBuilder getConfigSetProps(Map<String, String> map) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestDistributedMap.java b/solr/core/src/test/org/apache/solr/cloud/TestDistributedMap.java
index aa5915f007b..3f614246afa 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestDistributedMap.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestDistributedMap.java
@@ -64,9 +64,9 @@ public class TestDistributedMap extends SolrTestCaseJ4 {
.build()) {
String path = getAndMakeInitialPath(zkClient);
DistributedMap map = createMap(zkClient, path);
- assertFalse(zkClient.exists(path + "/" + DistributedMap.PREFIX + "foo", true));
+ assertFalse(zkClient.exists(path + "/" + DistributedMap.PREFIX + "foo"));
map.put("foo", new byte[0]);
- assertTrue(zkClient.exists(path + "/" + DistributedMap.PREFIX + "foo", true));
+ assertTrue(zkClient.exists(path + "/" + DistributedMap.PREFIX + "foo"));
}
}
@@ -79,12 +79,7 @@ public class TestDistributedMap extends SolrTestCaseJ4 {
String path = getAndMakeInitialPath(zkClient);
byte[] data = "data".getBytes(Charset.defaultCharset());
zkClient.makePath(
- path + "/" + DistributedMap.PREFIX + "foo",
- data,
- CreateMode.PERSISTENT,
- null,
- false,
- true);
+ path + "/" + DistributedMap.PREFIX + "foo", data, CreateMode.PERSISTENT, null, false);
DistributedMap map = createMap(zkClient, path);
assertArrayEquals(data, map.get("foo"));
}
@@ -104,8 +99,7 @@ public class TestDistributedMap extends SolrTestCaseJ4 {
new byte[0],
CreateMode.PERSISTENT,
null,
- false,
- true);
+ false);
assertTrue(map.contains("foo"));
}
}
@@ -124,11 +118,10 @@ public class TestDistributedMap extends SolrTestCaseJ4 {
new byte[0],
CreateMode.PERSISTENT,
null,
- false,
- true);
+ false);
assertTrue(map.remove("foo"));
assertFalse(map.contains("foo"));
- assertFalse(zkClient.exists(path + "/" + DistributedMap.PREFIX + "foo", true));
+ assertFalse(zkClient.exists(path + "/" + DistributedMap.PREFIX + "foo"));
}
}
@@ -256,7 +249,7 @@ public class TestDistributedMap extends SolrTestCaseJ4 {
protected String getAndMakeInitialPath(SolrZkClient zkClient)
throws KeeperException, InterruptedException {
String path = String.format(Locale.ROOT, "/%s/%s", getClass().getName(), getSaferTestName());
- zkClient.makePath(path, false, true);
+ zkClient.makePath(path, false);
return path;
}
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
index 0d9d6cfbfc0..e0d095b6559 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
@@ -197,9 +197,7 @@ public class TestPullReplica extends SolrCloudTestCase {
cluster
.getZkClient()
.getChildren(
- ZkStateReader.getShardLeadersElectPath(collectionName, s.getName()),
- null,
- true);
+ ZkStateReader.getShardLeadersElectPath(collectionName, s.getName()), null);
assertEquals(
"Unexpected election nodes for Shard: "
+ s.getName()
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java b/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java
index 003ca168c0e..1c992140e07 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java
@@ -125,7 +125,7 @@ public class TestQueryingOnDownCollection extends SolrCloudTestCase {
byte[] collectionState =
cluster
.getZkClient()
- .getData("/collections/" + COLLECTION_NAME + "/state.json", null, null, true);
+ .getData("/collections/" + COLLECTION_NAME + "/state.json", null, null);
Map<String, Map<String, ?>> infectedState =
(Map<String, Map<String, ?>>) Utils.fromJSON(collectionState);
@@ -141,8 +141,7 @@ public class TestQueryingOnDownCollection extends SolrCloudTestCase {
cluster
.getZkClient()
- .setData(
- "/collections/" + COLLECTION_NAME + "/state.json", Utils.toJSON(infectedState), true);
+ .setData("/collections/" + COLLECTION_NAME + "/state.json", Utils.toJSON(infectedState));
cluster
.getJettySolrRunner(0)
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java
index 762802ddd45..de4f130fecb 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestRebalanceLeaders.java
@@ -262,8 +262,7 @@ public class TestRebalanceLeaders extends SolrCloudTestCase {
+ "/leader_elect/"
+ slice.getName()
+ "/election",
- null,
- true);
+ null);
if (leaderQueue.size() != liveReplicas.size()) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java b/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java
index 0badfb7e768..956c59b3085 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestStressLiveNodes.java
@@ -93,7 +93,7 @@ public class TestStressLiveNodes extends SolrCloudTestCase {
SolrZkClient client = newSolrZkClient();
try {
ArrayList<String> result =
- new ArrayList<>(client.getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null, true));
+ new ArrayList<>(client.getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null));
Collections.sort(result);
return result;
} finally {
@@ -255,7 +255,7 @@ public class TestStressLiveNodes extends SolrCloudTestCase {
for (int i = 0; running && i < numNodesToAdd; i++) {
final String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/thrasher-" + id + "-" + i;
try {
- client.makePath(nodePath, CreateMode.EPHEMERAL, true);
+ client.makePath(nodePath, CreateMode.EPHEMERAL);
numAdded++;
} catch (Exception e) {
log.error("failed to create: {}", nodePath, e);
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
index d6f455c052f..c52ca5805b1 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
@@ -226,9 +226,7 @@ public class TestTlogReplica extends SolrCloudTestCase {
cluster
.getZkClient()
.getChildren(
- ZkStateReader.getShardLeadersElectPath(collectionName, s.getName()),
- null,
- true);
+ ZkStateReader.getShardLeadersElectPath(collectionName, s.getName()), null);
assertEquals(
"Unexpected election nodes for Shard: "
+ s.getName()
diff --git a/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java
index aca50b7bd3a..7ea461d323d 100644
--- a/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/VMParamsZkACLAndCredentialsProvidersTest.java
@@ -102,7 +102,7 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.withConnTimeOut(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build();
- zkClient.makePath("/solr", false, true);
+ zkClient.makePath("/solr", false);
zkClient.close();
zkClient =
@@ -111,15 +111,14 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build();
zkClient.create(
- "/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.makePath(
- "/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.create(
SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH,
"content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ CreateMode.PERSISTENT);
zkClient.close();
clearSecuritySystemProperties();
@@ -140,12 +139,9 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.addAuthInfo(
"digest", (ALL_USERNAME + ":" + ALL_PASSWORD).getBytes(StandardCharsets.UTF_8));
zkClient.create(
- "/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);
+ "/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.makePath(
- "/unprotectedMakePathNode",
- "content".getBytes(DATA_ENCODING),
- CreateMode.PERSISTENT,
- false);
+ "/unprotectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT);
zkClient.close();
setDigestZkSystemProps();
@@ -316,8 +312,8 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.getBytes(StandardCharsets.UTF_8));
zkClient.create(
- "/security.json", "{}".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, false);
- assertEquals(OPEN_ACL_UNSAFE, zkClient.getACL("/security.json", null, false));
+ "/security.json", "{}".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT);
+ assertEquals(OPEN_ACL_UNSAFE, zkClient.getACL("/security.json", null));
}
setSecuritySystemProperties();
@@ -327,7 +323,7 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build()) {
ZkController.createClusterZkNodes(zkClient);
- assertNotEquals(OPEN_ACL_UNSAFE, zkClient.getACL("/security.json", null, false));
+ assertNotEquals(OPEN_ACL_UNSAFE, zkClient.getACL("/security.json", null));
}
useZkCredentialsInjector(ConnectWithReadonlyCredsInjector.class);
@@ -338,8 +334,7 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build()) {
NoAuthException e =
- assertThrows(
- NoAuthException.class, () -> zkClient.getData("/security.json", null, null, false));
+ assertThrows(NoAuthException.class, () -> zkClient.getData("/security.json", null, null));
assertEquals("/solr/security.json", e.getPath());
}
}
@@ -405,27 +400,27 @@ public class VMParamsZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
boolean setData,
boolean delete)
throws Exception {
- doTest(getData, () -> zkClient.getData(path, null, null, false));
- doTest(list, () -> zkClient.getChildren(path, null, false));
+ doTest(getData, () -> zkClient.getData(path, null, null));
+ doTest(list, () -> zkClient.getChildren(path, null));
doTest(
create,
() -> {
- zkClient.create(path + "/subnode", null, CreateMode.PERSISTENT, false);
- zkClient.delete(path + "/subnode", -1, false);
+ zkClient.create(path + "/subnode", null, CreateMode.PERSISTENT);
+ zkClient.delete(path + "/subnode", -1);
});
doTest(
create,
() -> {
- zkClient.makePath(path + "/subnode/subsubnode", false);
- zkClient.delete(path + "/subnode/subsubnode", -1, false);
- zkClient.delete(path + "/subnode", -1, false);
+ zkClient.makePath(path + "/subnode/subsubnode");
+ zkClient.delete(path + "/subnode/subsubnode", -1);
+ zkClient.delete(path + "/subnode", -1);
});
- doTest(setData, () -> zkClient.setData(path, (byte[]) null, false));
+ doTest(setData, () -> zkClient.setData(path, (byte[]) null));
// Actually about the ACLs on /solr, but that is protected
- doTest(delete, () -> zkClient.delete(path, -1, false));
+ doTest(delete, () -> zkClient.delete(path, -1));
}
interface ExceptingRunnable {
diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
index 7b5840efc64..ebe2640bcb5 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
@@ -201,7 +201,7 @@ public class ZkControllerTest extends SolrCloudTestCase {
String nodeName = zkController.getNodeName();
String liveNodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
SolrZkClient zkClient = zkController.getZkClient();
- byte[] actualData = zkClient.getData(liveNodePath, null, null, true);
+ byte[] actualData = zkClient.getData(liveNodePath, null, null);
Map<String, Object> liveProps = (Map<String, Object>) Utils.fromJSON(actualData);
String expectedSolrVersion = SolrVersion.LATEST.toString();
@@ -273,8 +273,7 @@ public class ZkControllerTest extends SolrCloudTestCase {
.makePath(
DocCollection.getCollectionPathRoot(collectionName),
new byte[0],
- CreateMode.PERSISTENT,
- true);
+ CreateMode.PERSISTENT);
ZkNodeProps m =
new ZkNodeProps(
@@ -439,30 +438,29 @@ public class ZkControllerTest extends SolrCloudTestCase {
// touchConfDir doesn't make the znode
Stat s = new Stat();
- assertFalse(zkClient.exists(zkpath, true));
+ assertFalse(zkClient.exists(zkpath));
zkClient.makePath(zkpath, true);
- assertTrue(zkClient.exists(zkpath, true));
- assertNull(zkClient.getData(zkpath, null, s, true));
+ assertTrue(zkClient.exists(zkpath));
+ assertNull(zkClient.getData(zkpath, null, s));
assertEquals(0, s.getVersion());
// touchConfDir should only set the data to new byte[] {0}
ZkController.touchConfDir(loader);
- assertTrue(zkClient.exists(zkpath, true));
- assertArrayEquals(
- ZkController.TOUCHED_ZNODE_DATA, zkClient.getData(zkpath, null, s, true));
+ assertTrue(zkClient.exists(zkpath));
+ assertArrayEquals(ZkController.TOUCHED_ZNODE_DATA, zkClient.getData(zkpath, null, s));
assertEquals(1, s.getVersion());
// set new data to check if touchConfDir overwrites later
byte[] data = "{\"key\", \"new data\"".getBytes(StandardCharsets.UTF_8);
- s = zkClient.setData(zkpath, data, true);
+ s = zkClient.setData(zkpath, data);
assertEquals(2, s.getVersion());
// make sure touchConfDir doesn't overwrite existing data.
// touchConfDir should update version.
- assertTrue(zkClient.exists(zkpath, true));
+ assertTrue(zkClient.exists(zkpath));
ZkController.touchConfDir(loader);
- assertTrue(zkClient.exists(zkpath, true));
- assertArrayEquals(data, zkClient.getData(zkpath, null, s, true));
+ assertTrue(zkClient.exists(zkpath));
+ assertArrayEquals(data, zkClient.getData(zkpath, null, s));
assertEquals(3, s.getVersion());
}
}
@@ -503,7 +501,7 @@ public class ZkControllerTest extends SolrCloudTestCase {
byte[] data = Utils.toJSON(liveNodeData);
// persistent since we're about to close this zkClient
- zkClient.create(liveNodePath, data, CreateMode.PERSISTENT, true);
+ zkClient.create(liveNodePath, data, CreateMode.PERSISTENT);
}
// Now try to create a ZkController - this should fail due to version incompatibility
@@ -583,7 +581,7 @@ public class ZkControllerTest extends SolrCloudTestCase {
byte[] data = Utils.toJSON(liveNodeData);
// persistent since we're about to close this zkClient
- zkClient.create(liveNodePath, data, CreateMode.PERSISTENT, true);
+ zkClient.create(liveNodePath, data, CreateMode.PERSISTENT);
}
// Now try to create a ZkController - this should fail due to minor version incompatibility
@@ -638,10 +636,7 @@ public class ZkControllerTest extends SolrCloudTestCase {
server
.getZkClient()
.create(
- "/clusterstate.json",
- "{}".getBytes(StandardCharsets.UTF_8),
- CreateMode.PERSISTENT,
- true);
+ "/clusterstate.json", "{}".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT);
AtomicInteger idx = new AtomicInteger();
CountDownLatch latch = new CountDownLatch(nThreads);
CountDownLatch done = new CountDownLatch(nThreads);
@@ -667,7 +662,7 @@ public class ZkControllerTest extends SolrCloudTestCase {
});
}
done.await();
- assertFalse(server.getZkClient().exists("/clusterstate.json", true));
+ assertFalse(server.getZkClient().exists("/clusterstate.json"));
assertNull(exception.get());
} finally {
ExecutorUtil.shutdownNowAndAwaitTermination(svc);
diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java
index 2ce44a8b65c..9a87c507f67 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java
@@ -92,7 +92,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
.withUrl(conn.getServer().getZkHost())
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build()) {
- assertTrue(zkClient.exists("/solr", true));
+ assertTrue(zkClient.exists("/solr"));
}
}
}
@@ -108,8 +108,8 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
zkClient.clean("/");
- assertFalse(zkClient.exists("/test", true));
- assertFalse(zkClient.exists("/zz", true));
+ assertFalse(zkClient.exists("/test"));
+ assertFalse(zkClient.exists("/zz"));
}
}
@@ -125,7 +125,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
.build()) {
String shardsPath = "/collections/collection1/shards";
- zkClient.makePath(shardsPath, false, true);
+ zkClient.makePath(shardsPath, false);
int zkServerPort = server.getPort();
// this tests disconnect state
@@ -178,8 +178,8 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
thread2.join();
- assertNotNull(zkClient.exists("/collections/collection3", null, true));
- assertNotNull(zkClient.exists("/collections/collection1", null, true));
+ assertNotNull(zkClient.exists("/collections/collection3", null));
+ assertNotNull(zkClient.exists("/collections/collection1", null));
// simulate session expiration
@@ -206,8 +206,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
}
assertNotNull(
- "Node does not exist, but it should",
- zkClient.exists("/collections/collection4", null, true));
+ "Node does not exist, but it should", zkClient.exists("/collections/collection4", null));
} finally {
@@ -254,8 +253,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
}
watchesDone.countDown();
}
- },
- true);
+ });
}
for (int i = 1; i <= numColls; i++) {
@@ -295,14 +293,13 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
cnt.incrementAndGet();
// remake watch
try {
- zkClient.getChildren("/collections", this, true);
+ zkClient.getChildren("/collections", this);
latch.countDown();
} catch (KeeperException | InterruptedException e) {
throw new RuntimeException(e);
}
}
- },
- true);
+ });
zkClient.makePath("/collections/collection99/shards", true);
latch.await(); // wait until watch has been re-created
@@ -337,7 +334,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
// should work
zkClient.makePath(
- "/test/path/here", (byte[]) null, CreateMode.PERSISTENT, (Watcher) null, true, true, 1);
+ "/test/path/here", (byte[]) null, CreateMode.PERSISTENT, (Watcher) null, true, 1);
zkClient.clean("/");
@@ -353,7 +350,6 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
CreateMode.PERSISTENT,
(Watcher) null,
true,
- true,
1));
zkClient.clean("/");
@@ -387,7 +383,7 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
ZkMaintenanceUtils.ensureExists(
"/collection/collection", bytes, CreateMode.PERSISTENT, zkClient, 2);
- byte[] returnedBytes = zkClient.getData("/collection/collection", null, null, true);
+ byte[] returnedBytes = zkClient.getData("/collection/collection", null, null);
assertNull("We skipped 2 path parts, so data won't be written", returnedBytes);
@@ -403,14 +399,14 @@ public class ZkSolrClientTest extends SolrTestCaseJ4 {
configureCluster(4).withJettyConfig(jetty -> jetty.enableV2(true)).configure();
try {
SolrZkClient zkClient = cluster.getZkClient();
- zkClient.create("/test-node", null, CreateMode.PERSISTENT, true);
+ zkClient.create("/test-node", null, CreateMode.PERSISTENT);
- Stat stat = zkClient.exists("/test-node", null, true);
+ Stat stat = zkClient.exists("/test-node", null);
int cversion = stat.getCversion();
zkClient.multi(
op -> op.create().withMode(CreateMode.PERSISTENT).forPath("/test-node/abc", null),
op -> op.delete().withVersion(-1).forPath("/test-node/abc"));
- stat = zkClient.exists("/test-node", null, true);
+ stat = zkClient.exists("/test-node", null);
assertTrue(stat.getCversion() >= cversion + 2);
} finally {
cluster.shutdown();
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java
index 5092a8aca24..90421919c80 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java
@@ -711,7 +711,7 @@ public class ShardSplitTest extends BasicDistributedZkTest {
TimeOut timeOut = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
while (!timeOut.hasTimedOut()) {
timeOut.sleep(500);
- if (ZkStateReader.from(cloudClient).getZkClient().exists(path, true)) {
+ if (ZkStateReader.from(cloudClient).getZkClient().exists(path)) {
log.info("=== found lock node");
break;
}
@@ -729,13 +729,13 @@ public class ShardSplitTest extends BasicDistributedZkTest {
// make sure the lock still exists
assertTrue(
"lock znode expected but missing",
- ZkStateReader.from(cloudClient).getZkClient().exists(path, true));
+ ZkStateReader.from(cloudClient).getZkClient().exists(path));
// let the first split proceed
TestInjection.splitLatch.countDown();
timeOut = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
while (!timeOut.hasTimedOut()) {
timeOut.sleep(500);
- if (!ZkStateReader.from(cloudClient).getZkClient().exists(path, true)) {
+ if (!ZkStateReader.from(cloudClient).getZkClient().exists(path)) {
break;
}
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java
index 626c7a4dc0f..0b5d097d947 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java
@@ -67,15 +67,13 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
NamedList<Object> request = create.process(cloudClient).getResponse();
if (request.get("success") != null) {
- assertTrue(
- getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, false));
+ assertTrue(getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName));
CollectionAdminRequest.Delete delete =
CollectionAdminRequest.deleteCollection(collectionName);
cloudClient.request(delete);
- assertFalse(
- getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, false));
+ assertFalse(getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName));
// currently, removing a collection does not wait for cores to be unloaded
TimeOut timeout = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
@@ -121,7 +119,7 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
NamedList<Object> request = create.process(cloudClient).getResponse();
assertNotNull(request.get("success"));
SolrZkClient.NodeData node =
- getZkClient().getNode(DocCollection.getCollectionPath(collectionName), null, true);
+ getZkClient().getNode(DocCollection.getCollectionPath(collectionName), null);
DocCollection c =
ClusterState.createFromCollectionMap(
@@ -159,26 +157,25 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
assertTrue(
ZkStateReader.from(cloudClient)
.getZkClient()
- .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, false));
+ .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName));
String configName =
cloudClient.getClusterStateProvider().getCollection(collectionName).getConfigName();
// config for this collection is '.AUTOCREATED', and exists globally
assertTrue(configName.endsWith(".AUTOCREATED"));
- assertTrue(getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName, true));
+ assertTrue(getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName));
CollectionAdminRequest.Delete delete =
CollectionAdminRequest.deleteCollection(collectionName);
cloudClient.request(delete);
// collection has been deleted
- assertFalse(
- getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, false));
+ assertFalse(getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName));
// ... and so has its autocreated config set
assertFalse(
"The auto-created config set should have been deleted with its collection",
- getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName, true));
+ getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName));
}
}
@@ -194,8 +191,7 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
if (requestInitial.get("success") != null) {
// collection exists now
assertTrue(
- getZkClient()
- .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameInitial, false));
+ getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameInitial));
String configName =
cloudClient
@@ -205,7 +201,7 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
// config for this collection is '.AUTOCREATED', and exists globally
assertTrue(configName.endsWith(".AUTOCREATED"));
- assertTrue(getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName, true));
+ assertTrue(getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName));
// create a second collection, sharing the same configSet
String collectionNameWithSharedConfig =
@@ -221,8 +217,7 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
assertTrue(
"The new collection should exist after a successful creation",
getZkClient()
- .exists(
- ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameWithSharedConfig, false));
+ .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameWithSharedConfig));
String configNameOfSecondCollection =
cloudClient
@@ -243,12 +238,11 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
// initial collection has been deleted
assertFalse(
- getZkClient()
- .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameInitial, false));
+ getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameInitial));
// ... but not its autocreated config set, since it is shared with another collection
assertTrue(
"The auto-created config set should NOT have been deleted. Another collection is using it.",
- getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName, true));
+ getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName));
// delete the second collection - the config set should now be deleted, since it is no longer
// shared any other collection
@@ -259,13 +253,12 @@ public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestB
// the collection has been deleted
assertFalse(
getZkClient()
- .exists(
- ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameWithSharedConfig, false));
+ .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionNameWithSharedConfig));
// ... and the config set is now also deleted - once it doesn't get referenced by any
// collection
assertFalse(
"The auto-created config set should have been deleted now. No collection is referencing it.",
- getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName, true));
+ getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + configName));
}
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java
index 9d8f1c60469..d0de765bd69 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionAPI.java
@@ -266,11 +266,11 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
private void deleteThemAll(SolrZkClient zkClient, String node)
throws KeeperException, InterruptedException {
- List<String> kids = zkClient.getChildren(node, null, true);
+ List<String> kids = zkClient.getChildren(node, null);
for (String kid : kids) {
deleteThemAll(zkClient, node + "/" + kid);
}
- zkClient.delete(node, -1, true);
+ zkClient.delete(node, -1);
}
private void assertCountsForRepFactorAndNrtReplicas(CloudSolrClient client, String collectionName)
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestLocalFSCloudBackupRestore.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestLocalFSCloudBackupRestore.java
index 38a18d78543..426d9db92fc 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestLocalFSCloudBackupRestore.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestLocalFSCloudBackupRestore.java
@@ -78,9 +78,7 @@ public class TestLocalFSCloudBackupRestore extends AbstractCloudBackupRestoreTes
cluster
.getZkClient()
.delete(
- ZkConfigSetService.CONFIGS_ZKNODE + "/" + "confFaulty" + "/" + "solrconfig.xml",
- -1,
- true);
+ ZkConfigSetService.CONFIGS_ZKNODE + "/" + "confFaulty" + "/" + "solrconfig.xml", -1);
boolean whitespacesInPath = random().nextBoolean();
if (whitespacesInPath) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java
index cb07e84f5b5..3e7e575ca44 100644
--- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateReaderTest.java
@@ -193,7 +193,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
ZkWriteCommand wc = new ZkWriteCommand("c1", state);
writer.enqueueUpdate(reader.getClusterState(), Collections.singletonList(wc), null);
writer.writePendingUpdates();
- assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", true));
+ assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json"));
reader.waitForState(
"c1", 1, TimeUnit.SECONDS, (liveNodes, collectionState) -> collectionState != null);
@@ -256,7 +256,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
writer.enqueueUpdate(reader.getClusterState(), Collections.singletonList(wc), null);
writer.writePendingUpdates();
- assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", true));
+ assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json"));
// reader.forceUpdateCollection("c1");
reader.waitForState("c1", TIMEOUT, TimeUnit.SECONDS, (n, c) -> c != null);
@@ -265,7 +265,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
assertFalse(ref.isLazilyLoaded());
Stat stat = new Stat();
- fixture.zkClient.getData(ZkStateReader.getCollectionPath("c1"), null, stat, false);
+ fixture.zkClient.getData(ZkStateReader.getCollectionPath("c1"), null, stat);
assertEquals(Instant.ofEpochMilli(stat.getCtime()), ref.get().getCreationTime());
}
@@ -420,7 +420,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
writer.enqueueUpdate(reader.getClusterState(), Collections.singletonList(wc), null);
writer.writePendingUpdates();
- assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", true));
+ assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json"));
reader.forciblyRefreshAllClusterStateSlow();
ClusterState.CollectionRef ref = reader.getClusterState().getCollectionRef("c1");
@@ -507,7 +507,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
writer.enqueueUpdate(reader.getClusterState(), Collections.singletonList(wc), null);
writer.writePendingUpdates();
- assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", true));
+ assertTrue(fixture.zkClient.exists(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json"));
reader.forciblyRefreshAllClusterStateSlow();
ClusterState.CollectionRef ref = reader.getClusterState().getCollectionRef("c1");
@@ -902,9 +902,9 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
String livePath = ZkStateReader.LIVE_NODES_ZKNODE;
// Clear any existing live node children.
- List<String> nodes = zkClient.getChildren(livePath, null, true);
+ List<String> nodes = zkClient.getChildren(livePath, null);
for (String node : nodes) {
- zkClient.delete(livePath + "/" + node, -1, true);
+ zkClient.delete(livePath + "/" + node, -1);
}
// Create two live nodes with valid SemVer strings.
@@ -913,14 +913,14 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
props1.put(LIVE_NODE_SOLR_VERSION, "9.1.2");
props1.put(LIVE_NODE_NODE_NAME, node1);
byte[] data1 = Utils.toJSON(props1);
- zkClient.create(livePath + "/" + node1, data1, CreateMode.EPHEMERAL, true);
+ zkClient.create(livePath + "/" + node1, data1, CreateMode.EPHEMERAL);
String node2 = "node2_solr";
Map<String, Object> props2 = new HashMap<>();
props2.put(LIVE_NODE_SOLR_VERSION, "9.0.1");
props2.put(LIVE_NODE_NODE_NAME, node2);
byte[] data2 = Utils.toJSON(props2);
- zkClient.create(livePath + "/" + node2, data2, CreateMode.EPHEMERAL, true);
+ zkClient.create(livePath + "/" + node2, data2, CreateMode.EPHEMERAL);
var lowestVersion = reader.fetchLowestSolrVersion();
assertTrue("Expected lowest version to be present", lowestVersion.isPresent());
@@ -935,14 +935,14 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
String livePath = ZkStateReader.LIVE_NODES_ZKNODE;
// Clear any existing live node children.
- List<String> nodes = zkClient.getChildren(livePath, null, true);
+ List<String> nodes = zkClient.getChildren(livePath, null);
for (String node : nodes) {
- zkClient.delete(livePath + "/" + node, -1, true);
+ zkClient.delete(livePath + "/" + node, -1);
}
// Create a live node with empty data.
String emptyNode = "empty_node";
- zkClient.create(livePath + "/" + emptyNode, new byte[0], CreateMode.EPHEMERAL, true);
+ zkClient.create(livePath + "/" + emptyNode, new byte[0], CreateMode.EPHEMERAL);
var lowestVersion = reader.fetchLowestSolrVersion();
assertTrue("Expected lowest version to be present for empty node", lowestVersion.isPresent());
@@ -956,17 +956,16 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
String livePath = ZkStateReader.LIVE_NODES_ZKNODE;
// Clear any existing live node children.
- List<String> nodes = zkClient.getChildren(livePath, null, true);
+ List<String> nodes = zkClient.getChildren(livePath, null);
for (String node : nodes) {
- zkClient.delete(livePath + "/" + node, -1, true);
+ zkClient.delete(livePath + "/" + node, -1);
}
String node1 = "node1_solr";
zkClient.create(
livePath + "/" + node1,
Utils.toJSON(Map.<String, Object>of(LIVE_NODE_SOLR_VERSION, "888.0.0")),
- CreateMode.EPHEMERAL,
- true);
+ CreateMode.EPHEMERAL);
var lowestVersion1 = reader.fetchLowestSolrVersion();
assertTrue(
@@ -974,7 +973,7 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
assertEquals("after high node", SolrVersion.valueOf("888.0.0"), lowestVersion1.get());
String node2 = "node2_solr";
- zkClient.create(livePath + "/" + node2, new byte[0], CreateMode.EPHEMERAL, true);
+ zkClient.create(livePath + "/" + node2, new byte[0], CreateMode.EPHEMERAL);
var lowestVersion2 = reader.fetchLowestSolrVersion();
assertTrue("Expected lowest version to be present for empty node", lowestVersion2.isPresent());
@@ -988,9 +987,9 @@ public class ZkStateReaderTest extends SolrTestCaseJ4 {
String livePath = ZkStateReader.LIVE_NODES_ZKNODE;
// Clear any existing live node children.
- List<String> nodes = zkClient.getChildren(livePath, null, true);
+ List<String> nodes = zkClient.getChildren(livePath, null);
for (String node : nodes) {
- zkClient.delete(livePath + "/" + node, -1, true);
+ zkClient.delete(livePath + "/" + node, -1);
}
var lowestVersion = reader.fetchLowestSolrVersion();
diff --git a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
index 93a97e5bd90..7166057abe1 100644
--- a/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/overseer/ZkStateWriterTest.java
@@ -322,11 +322,11 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {
(Map<?, ?>)
Utils.fromJSON(
zkClient.getData(
- ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null, true));
+ ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null));
assertNotNull(map.get("c1"));
Stat stat = new Stat();
- zkClient.getData(ZkStateReader.getCollectionPath("c1"), null, stat, false);
+ zkClient.getData(ZkStateReader.getCollectionPath("c1"), null, stat);
assertEquals(
Instant.ofEpochMilli(stat.getCtime()),
clusterState.getCollection("c1").getCreationTime());
@@ -379,15 +379,15 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {
int c2Version = state.getCollection("c2").getZNodeVersion();
// Simulate an external modification to /collections/c2/state.json
- byte[] data = zkClient.getData(DocCollection.getCollectionPath("c2"), null, null, true);
- zkClient.setData(DocCollection.getCollectionPath("c2"), data, true);
+ byte[] data = zkClient.getData(DocCollection.getCollectionPath("c2"), null, null);
+ zkClient.setData(DocCollection.getCollectionPath("c2"), data);
// get the most up-to-date state
reader.forceUpdateCollection("c2");
state = reader.getClusterState();
Stat stat = new Stat();
- zkClient.getData(ZkStateReader.getCollectionPath("c2"), null, stat, false);
+ zkClient.getData(ZkStateReader.getCollectionPath("c2"), null, stat);
assertEquals(
Instant.ofEpochMilli(stat.getCtime()), state.getCollection("c2").getCreationTime());
@@ -472,7 +472,7 @@ public class ZkStateWriterTest extends SolrTestCaseJ4 {
writer.writePendingUpdates();
byte[] data =
- zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null, true);
+ zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null);
Map<?, ?> map = (Map<?, ?>) Utils.fromJSON(data);
assertNotNull(map.get("c1"));
}
diff --git a/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java b/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java
index 37dffc09030..6189a145471 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestConfigReload.java
@@ -77,15 +77,15 @@ public class TestConfigReload extends AbstractFullDistribZkTestBase {
Stat stat = new Stat();
byte[] data = null;
try {
- data = client.getData(resPath, null, stat, true);
+ data = client.getData(resPath, null, stat);
} catch (KeeperException.NoNodeException e) {
data = "{}".getBytes(StandardCharsets.UTF_8);
log.info("creating_node {}", resPath);
- client.create(resPath, data, CreateMode.PERSISTENT, true);
+ client.create(resPath, data, CreateMode.PERSISTENT);
}
long startTime = System.nanoTime();
- Stat newStat = client.setData(resPath, data, true);
- client.setData("/configs/conf1", new byte[] {1}, true);
+ Stat newStat = client.setData(resPath, data);
+ client.setData("/configs/conf1", new byte[] {1});
assertTrue(newStat.getVersion() > stat.getVersion());
if (log.isInfoEnabled()) {
log.info("new_version {}", newStat.getVersion());
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java b/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java
index ea4cd30a048..ed5bd6353dd 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/ZookeeperReadAPITest.java
@@ -95,9 +95,7 @@ public class ZookeeperReadAPITest extends SolrCloudTestCase {
bytes[i] = (byte) random().nextInt(128);
}
try {
- cluster
- .getZkClient()
- .create("/configs/_default/testdata", bytes, CreateMode.PERSISTENT, true);
+ cluster.getZkClient().create("/configs/_default/testdata", bytes, CreateMode.PERSISTENT);
final var testDataRequest = new ZookeeperReadApi.ReadNode("/configs/_default/testdata");
final var testDataResponse = testDataRequest.process(client);
@@ -109,7 +107,7 @@ public class ZookeeperReadAPITest extends SolrCloudTestCase {
}
}
} finally {
- cluster.getZkClient().delete("/configs/_default/testdata", -1, true);
+ cluster.getZkClient().delete("/configs/_default/testdata", -1);
}
}
}
diff --git a/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerAPI.java b/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerAPI.java
index c1848c0d2f8..0822693db8d 100644
--- a/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerAPI.java
+++ b/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerAPI.java
@@ -124,7 +124,7 @@ public class TestSchemaDesignerAPI extends SolrCloudTestCase implements SchemaDe
String mutableId = getMutableId(configSet);
assertFalse(cc.getZkController().getClusterState().hasCollection(mutableId));
SolrZkClient zkClient = cc.getZkController().getZkClient();
- assertFalse(zkClient.exists("/configs/" + mutableId, true));
+ assertFalse(zkClient.exists("/configs/" + mutableId));
}
@Test
@@ -687,7 +687,7 @@ public class TestSchemaDesignerAPI extends SolrCloudTestCase implements SchemaDe
String mutableId = getMutableId(configSet);
assertFalse(cc.getZkController().getClusterState().hasCollection(mutableId));
SolrZkClient zkClient = cc.getZkController().getZkClient();
- assertFalse(zkClient.exists("/configs/" + mutableId, true));
+ assertFalse(zkClient.exists("/configs/" + mutableId));
SolrQuery query = new SolrQuery("*:*");
query.setRows(0);
diff --git a/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerConfigSetHelper.java b/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerConfigSetHelper.java
index 851fe64f892..d2ed61fc037 100644
--- a/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerConfigSetHelper.java
+++ b/solr/core/src/test/org/apache/solr/handler/designer/TestSchemaDesignerConfigSetHelper.java
@@ -177,8 +177,7 @@ public class TestSchemaDesignerConfigSetHelper extends SolrCloudTestCase
assertTrue(
cluster
.getZkClient()
- .exists(
- SchemaDesignerAPI.getConfigSetZkPath(mutableId, "lang/stopwords_en.txt"), true));
+ .exists(SchemaDesignerAPI.getConfigSetZkPath(mutableId, "lang/stopwords_en.txt")));
assertNotNull(schema.getFieldTypeByName("text_fr"));
assertNotNull(schema.getFieldOrNull("*_txt_fr"));
assertNull(schema.getFieldOrNull("*_txt_ga"));
@@ -201,8 +200,7 @@ public class TestSchemaDesignerConfigSetHelper extends SolrCloudTestCase
assertTrue(
cluster
.getZkClient()
- .exists(
- SchemaDesignerAPI.getConfigSetZkPath(mutableId, "lang/stopwords_en.txt"), true));
+ .exists(SchemaDesignerAPI.getConfigSetZkPath(mutableId, "lang/stopwords_en.txt")));
assertNotNull(schema.getFieldTypeByName("text_fr"));
assertNotNull(schema.getFieldOrNull("*_txt_fr"));
assertNull(schema.getFieldOrNull("*_txt_ga"));
diff --git a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
index 88113d83cf8..7c1ade8b189 100644
--- a/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
+++ b/solr/core/src/test/org/apache/solr/pkg/TestPackages.java
@@ -629,8 +629,7 @@ public class TestPackages extends SolrCloudTestCase {
1,
() ->
NavigableObject.wrap(
- Utils.fromJSON(
- cluster.getZkClient().getData(SOLR_PKGS_PATH, null, new Stat(), true))),
+ Utils.fromJSON(cluster.getZkClient().getData(SOLR_PKGS_PATH, null, new Stat()))),
Map.of(":packages:test_pkg[0]:version", "0.12", ":packages:test_pkg[0]:files[0]", FILE2));
// post a new jar with a proper signature
@@ -652,8 +651,7 @@ public class TestPackages extends SolrCloudTestCase {
1,
() ->
NavigableObject.wrap(
- Utils.fromJSON(
- cluster.getZkClient().getData(SOLR_PKGS_PATH, null, new Stat(), true))),
+ Utils.fromJSON(cluster.getZkClient().getData(SOLR_PKGS_PATH, null, new Stat()))),
Map.of(":packages:test_pkg[1]:version", "0.13", ":packages:test_pkg[1]:files[0]", FILE3));
// Now we will just delete one version
@@ -677,8 +675,7 @@ public class TestPackages extends SolrCloudTestCase {
1,
() ->
NavigableObject.wrap(
- Utils.fromJSON(
- cluster.getZkClient().getData(SOLR_PKGS_PATH, null, new Stat(), true))),
+ Utils.fromJSON(cluster.getZkClient().getData(SOLR_PKGS_PATH, null, new Stat()))),
Map.of(":packages:test_pkg[0]:version", "0.13", ":packages:test_pkg[0]:files[0]", FILE3));
// So far we have been verifying the details with ZK directly
diff --git a/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchema.java b/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchema.java
index 0709dd48d64..959ea8554cd 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchema.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchema.java
@@ -99,16 +99,16 @@ public class TestCloudManagedSchema extends AbstractFullDistribZkTestBase {
private String getFileContentFromZooKeeper(SolrZkClient zkClient, String fileName)
throws KeeperException, InterruptedException {
- return (new String(zkClient.getData(fileName, null, null, true), StandardCharsets.UTF_8));
+ return (new String(zkClient.getData(fileName, null, null), StandardCharsets.UTF_8));
}
protected final void assertFileNotInZooKeeper(
SolrZkClient zkClient, String parent, String fileName) throws Exception {
- List<String> kids = zkClient.getChildren(parent, null, true);
+ List<String> kids = zkClient.getChildren(parent, null);
for (String kid : kids) {
if (kid.equalsIgnoreCase(fileName)) {
String rawContent =
- new String(zkClient.getData(fileName, null, null, true), StandardCharsets.UTF_8);
+ new String(zkClient.getData(fileName, null, null), StandardCharsets.UTF_8);
fail(
"File '"
+ fileName
diff --git a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java
index 2cc881cecc2..e4cb2156890 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java
@@ -73,11 +73,11 @@ public class TestManagedSchemaThreadSafety extends SolrTestCaseJ4 {
}
@Override
- public byte[] getData(String path, Watcher watcher, Stat stat, boolean retryOnConnLoss)
+ public byte[] getData(String path, Watcher watcher, Stat stat)
throws KeeperException, InterruptedException {
byte[] data;
try {
- data = super.getData(path, watcher, stat, retryOnConnLoss);
+ data = super.getData(path, watcher, stat);
} catch (NoNodeException e) {
if (isSlowpoke()) {
// System.out.println("suspending "+Thread.currentThread()+" on " + path);
@@ -161,7 +161,7 @@ public class TestManagedSchemaThreadSafety extends SolrTestCaseJ4 {
public Boolean answer(InvocationOnMock invocation) throws Throwable {
String path = (String) invocation.getArguments()[0];
perhapsExpired();
- Boolean exists = client.exists(path, true);
+ Boolean exists = client.exists(path);
perhapsExpired();
return exists;
}
diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
index 453d96401e6..eb970d03f1a 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -111,7 +111,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {
JettySolrRunner randomJetty = cluster.getRandomJetty(random());
String baseUrl = randomJetty.getBaseUrl().toString();
verifySecurityStatus(cl, baseUrl + authcPrefix, "/errorMessages", null, 20);
- zkClient().setData("/security.json", STD_CONF.replace("'", "\"").getBytes(UTF_8), true);
+ zkClient().setData("/security.json", STD_CONF.replace("'", "\"").getBytes(UTF_8));
verifySecurityStatus(
cl, baseUrl + authcPrefix, "authentication/class", "solr.BasicAuthPlugin", 20);
diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
index 183e6ba3235..f6f35c37d3b 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
@@ -80,7 +80,7 @@ public class BasicAuthOnSingleNodeTest extends SolrCloudAuthTestCase {
// Deleting security.json will disable security - before SOLR-9679 it would instead cause an
// exception
- cluster.getZkClient().delete("/security.json", -1, false);
+ cluster.getZkClient().delete("/security.json", -1);
int count = 0;
boolean done = false;
diff --git a/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java b/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java
index bc5e1576842..b1d90c14218 100644
--- a/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java
+++ b/solr/core/src/test/org/apache/solr/security/TestAuthorizationFramework.java
@@ -53,8 +53,7 @@ public class TestAuthorizationFramework extends AbstractFullDistribZkTestBase {
new ZkStateReader(zkServer.getZkAddress(), TIMEOUT, TIMEOUT)) {
zkStateReader
.getZkClient()
- .create(
- ZkStateReader.SOLR_SECURITY_CONF_PATH, SECURITY_JSON, CreateMode.PERSISTENT, true);
+ .create(ZkStateReader.SOLR_SECURITY_CONF_PATH, SECURITY_JSON, CreateMode.PERSISTENT);
}
}
diff --git a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
index 36896af2a3d..c154e868516 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
@@ -214,8 +214,7 @@ public class TimeRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProcess
+ "/"
+ COLLECTION_PROPS_ZKNODE,
null,
- null,
- true);
+ null);
assertNotNull(data);
assertTrue(data.length > 0);
@SuppressWarnings("unchecked")
@@ -1048,8 +1047,7 @@ public class TimeRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProcess
aliasUpdate.countDown();
}
},
- stat,
- true);
+ stat);
}
/**
@@ -1272,7 +1270,7 @@ public class TimeRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProcess
}
// now grab the zk data, so we can hack in our legacy collections...
- byte[] data = zkStateReader.getZkClient().getData("/aliases.json", null, null, true);
+ byte[] data = zkStateReader.getZkClient().getData("/aliases.json", null, null);
// some tidbits for handling zk data here are swiped from Aliases.json
Map<String, Map> aliasMap;
@@ -1293,7 +1291,7 @@ public class TimeRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProcess
colAliases.put(alias, String.join(",", legacy24, legacy23));
data = Utils.toJSON(aliasMap);
- zkStateReader.getZkClient().setData("/aliases.json", data, true);
+ zkStateReader.getZkClient().setData("/aliases.json", data);
zkStateReader.aliasesManager.update(); // make sure we've updated with the data we just sent
diff --git a/solr/modules/cross-dc/src/java/org/apache/solr/crossdc/common/ConfUtil.java b/solr/modules/cross-dc/src/java/org/apache/solr/crossdc/common/ConfUtil.java
index 8fe185b8352..2fde6a6d270 100644
--- a/solr/modules/cross-dc/src/java/org/apache/solr/crossdc/common/ConfUtil.java
+++ b/solr/modules/cross-dc/src/java/org/apache/solr/crossdc/common/ConfUtil.java
@@ -58,15 +58,14 @@ public class ConfUtil {
if (solrClient != null) {
try {
if (solrClient.exists(
- System.getProperty(CrossDcConf.ZK_CROSSDC_PROPS_PATH, CrossDcConf.CROSSDC_PROPERTIES),
- true)) {
+ System.getProperty(
+ CrossDcConf.ZK_CROSSDC_PROPS_PATH, CrossDcConf.CROSSDC_PROPERTIES))) {
byte[] data =
solrClient.getData(
System.getProperty(
CrossDcConf.ZK_CROSSDC_PROPS_PATH, CrossDcConf.CROSSDC_PROPERTIES),
null,
- null,
- true);
+ null);
if (data == null) {
log.error("{} file in Zookeeper has no data", CrossDcConf.CROSSDC_PROPERTIES);
diff --git a/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java b/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java
index a4cb9a97cc3..920bf4579f1 100644
--- a/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java
+++ b/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringCollectionsHandlerTest.java
@@ -77,7 +77,7 @@ public class MirroringCollectionsHandlerTest extends SolrTestCaseJ4 {
Mockito.when(zkController.getZkClient()).thenReturn(solrZkClient);
Mockito.doAnswer(inv -> null)
.when(solrZkClient)
- .getData(Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ .getData(Mockito.anyString(), Mockito.any(), Mockito.any());
captor = ArgumentCaptor.forClass(MirroredSolrRequest.class);
Mockito.doNothing().when(sink).submit(captor.capture());
// make ConfUtil happy
diff --git a/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringConfigSetsHandlerTest.java b/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringConfigSetsHandlerTest.java
index 21a8d378208..97a4687c64d 100644
--- a/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringConfigSetsHandlerTest.java
+++ b/solr/modules/cross-dc/src/test/org/apache/solr/crossdc/handler/MirroringConfigSetsHandlerTest.java
@@ -104,7 +104,7 @@ public class MirroringConfigSetsHandlerTest extends SolrTestCaseJ4 {
Mockito.when(zkController.getZkClient()).thenReturn(solrZkClient);
Mockito.doAnswer(inv -> null)
.when(solrZkClient)
- .getData(Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ .getData(Mockito.anyString(), Mockito.any(), Mockito.any());
captor = ArgumentCaptor.forClass(MirroredSolrRequest.class);
Mockito.doNothing().when(sink).submit(captor.capture());
}
diff --git a/solr/modules/jwt-auth/src/test/org/apache/solr/security/jwt/JWTAuthPluginIntegrationTest.java b/solr/modules/jwt-auth/src/test/org/apache/solr/security/jwt/JWTAuthPluginIntegrationTest.java
index dc281359b8c..22f0850f70f 100644
--- a/solr/modules/jwt-auth/src/test/org/apache/solr/security/jwt/JWTAuthPluginIntegrationTest.java
+++ b/solr/modules/jwt-auth/src/test/org/apache/solr/security/jwt/JWTAuthPluginIntegrationTest.java
@@ -380,7 +380,7 @@ public class JWTAuthPluginIntegrationTest extends SolrCloudAuthTestCase {
.withDefaultClusterProperty("useLegacyReplicaAssignment", "false")
.build();
String securityJson = createMockOAuthSecurityJson(pemFilePath);
- myCluster.zkSetData("/security.json", securityJson.getBytes(Charset.defaultCharset()), true);
+ myCluster.zkSetData("/security.json", securityJson.getBytes(Charset.defaultCharset()));
RTimer timer = new RTimer();
do { // Wait timeoutMs time for the security.json change to take effect
Thread.sleep(200);
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
index f9d202f5949..13e0dfab88c 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java
@@ -116,7 +116,7 @@ public class ZkClientClusterStateProvider
try {
// read configName from collections/collection node
String path = ZkStateReader.COLLECTIONS_ZKNODE + "/" + coll;
- byte[] data = zkClient.getData(path, null, null, true);
+ byte[] data = zkClient.getData(path, null, null);
if (data != null && data.length > 0) {
ZkNodeProps configProp = ZkNodeProps.load(data);
String configName = configProp.getStr(ZkStateReader.CONFIGNAME_PROP);
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
index a71542cfbdc..b361bcd0662 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkDistribStateManager.java
@@ -66,7 +66,7 @@ public class ZkDistribStateManager implements DistribStateManager {
@Override
public boolean hasData(String path) throws IOException, KeeperException, InterruptedException {
try {
- return zkClient.exists(path, true);
+ return zkClient.exists(path);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new AlreadyClosedException();
@@ -77,7 +77,7 @@ public class ZkDistribStateManager implements DistribStateManager {
public List<String> listData(String path, Watcher watcher)
throws NoSuchElementException, IOException, KeeperException, InterruptedException {
try {
- return zkClient.getChildren(path, watcher, true);
+ return zkClient.getChildren(path, watcher);
} catch (KeeperException.NoNodeException e) {
throw new NoSuchElementException(path);
} catch (InterruptedException e) {
@@ -97,7 +97,7 @@ public class ZkDistribStateManager implements DistribStateManager {
throws NoSuchElementException, IOException, KeeperException, InterruptedException {
Stat stat = new Stat();
try {
- byte[] bytes = zkClient.getData(path, watcher, stat, true);
+ byte[] bytes = zkClient.getData(path, watcher, stat);
return new VersionedData(
stat.getVersion(),
bytes,
@@ -128,7 +128,7 @@ public class ZkDistribStateManager implements DistribStateManager {
public void makePath(String path, byte[] data, CreateMode createMode, boolean failOnExists)
throws AlreadyExistsException, IOException, KeeperException, InterruptedException {
try {
- zkClient.makePath(path, data, createMode, null, failOnExists, true);
+ zkClient.makePath(path, data, createMode, null, failOnExists);
} catch (KeeperException.NodeExistsException e) {
throw new AlreadyExistsException(path);
} catch (InterruptedException e) {
@@ -145,7 +145,7 @@ public class ZkDistribStateManager implements DistribStateManager {
KeeperException,
InterruptedException {
try {
- return zkClient.create(path, data, mode, true);
+ return zkClient.create(path, data, mode);
} catch (KeeperException.NoNodeException e) {
throw new NoSuchElementException(path);
} catch (KeeperException.NodeExistsException e) {
@@ -165,7 +165,7 @@ public class ZkDistribStateManager implements DistribStateManager {
KeeperException,
InterruptedException {
try {
- zkClient.delete(path, version, true);
+ zkClient.delete(path, version);
} catch (KeeperException.NoNodeException e) {
throw new NoSuchElementException(path);
} catch (KeeperException.NotEmptyException e) {
@@ -186,7 +186,7 @@ public class ZkDistribStateManager implements DistribStateManager {
KeeperException,
InterruptedException {
try {
- zkClient.setData(path, data, version, true);
+ zkClient.setData(path, data, version);
} catch (KeeperException.NoNodeException e) {
throw new NoSuchElementException(path);
} catch (KeeperException.BadVersionException e) {
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ClusterProperties.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ClusterProperties.java
index 38e9e046266..f70ba68c099 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ClusterProperties.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ClusterProperties.java
@@ -94,7 +94,7 @@ public class ClusterProperties {
try {
Map<String, Object> properties =
(Map<String, Object>)
- Utils.fromJSON(client.getData(ZkStateReader.CLUSTER_PROPS, null, new Stat(), true));
+ Utils.fromJSON(client.getData(ZkStateReader.CLUSTER_PROPS, null, new Stat()));
return properties;
} catch (KeeperException.NoNodeException e) {
return Collections.emptyMap();
@@ -154,23 +154,21 @@ public class ClusterProperties {
for (; ; ) {
Stat s = new Stat();
try {
- if (client.exists(ZkStateReader.CLUSTER_PROPS, true)) {
+ if (client.exists(ZkStateReader.CLUSTER_PROPS)) {
@SuppressWarnings({"rawtypes"})
Map properties =
- (Map) Utils.fromJSON(client.getData(ZkStateReader.CLUSTER_PROPS, null, s, true));
+ (Map) Utils.fromJSON(client.getData(ZkStateReader.CLUSTER_PROPS, null, s));
if (propertyValue == null) {
// Don't update ZK unless absolutely necessary.
if (properties.get(propertyName) != null) {
properties.remove(propertyName);
- client.setData(
- ZkStateReader.CLUSTER_PROPS, Utils.toJSON(properties), s.getVersion(), true);
+ client.setData(ZkStateReader.CLUSTER_PROPS, Utils.toJSON(properties), s.getVersion());
}
} else {
// Don't update ZK unless absolutely necessary.
if (!propertyValue.equals(properties.get(propertyName))) {
properties.put(propertyName, propertyValue);
- client.setData(
- ZkStateReader.CLUSTER_PROPS, Utils.toJSON(properties), s.getVersion(), true);
+ client.setData(ZkStateReader.CLUSTER_PROPS, Utils.toJSON(properties), s.getVersion());
}
}
} else {
@@ -178,7 +176,7 @@ public class ClusterProperties {
Map properties = new LinkedHashMap();
properties.put(propertyName, propertyValue);
client.makePath(
- ZkStateReader.CLUSTER_PROPS, Utils.toJSON(properties), CreateMode.PERSISTENT, true);
+ ZkStateReader.CLUSTER_PROPS, Utils.toJSON(properties), CreateMode.PERSISTENT);
}
} catch (KeeperException.BadVersionException | KeeperException.NodeExistsException e) {
// race condition
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionProperties.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionProperties.java
index e036ac76217..25b13086267 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionProperties.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionProperties.java
@@ -67,8 +67,7 @@ public class CollectionProperties {
try {
return (Map<String, String>)
Utils.fromJSON(
- client.getData(
- ZkStateReader.getCollectionPropsPath(collection), null, new Stat(), true));
+ client.getData(ZkStateReader.getCollectionPropsPath(collection), null, new Stat()));
} catch (KeeperException.NoNodeException e) {
return Collections.emptyMap();
} catch (KeeperException | InterruptedException e) {
@@ -94,25 +93,25 @@ public class CollectionProperties {
while (true) {
Stat s = new Stat();
try {
- if (client.exists(znodePath, true)) {
+ if (client.exists(znodePath)) {
Map<String, String> properties =
- (Map<String, String>) Utils.fromJSON(client.getData(znodePath, null, s, true));
+ (Map<String, String>) Utils.fromJSON(client.getData(znodePath, null, s));
if (propertyValue == null) {
if (properties.remove(propertyName)
!= null) { // Don't update ZK unless absolutely necessary.
- client.setData(znodePath, Utils.toJSON(properties), s.getVersion(), true);
+ client.setData(znodePath, Utils.toJSON(properties), s.getVersion());
}
} else {
if (!propertyValue.equals(
properties.put(
propertyName, propertyValue))) { // Don't update ZK unless absolutely necessary.
- client.setData(znodePath, Utils.toJSON(properties), s.getVersion(), true);
+ client.setData(znodePath, Utils.toJSON(properties), s.getVersion());
}
}
} else {
Map<String, String> properties = new LinkedHashMap<>();
properties.put(propertyName, propertyValue);
- client.create(znodePath, Utils.toJSON(properties), CreateMode.PERSISTENT, true);
+ client.create(znodePath, Utils.toJSON(properties), CreateMode.PERSISTENT);
}
} catch (KeeperException.BadVersionException | KeeperException.NodeExistsException e) {
// race condition
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionPropertiesZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionPropertiesZkStateReader.java
index 083f7ec0def..d23014e5849 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionPropertiesZkStateReader.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionPropertiesZkStateReader.java
@@ -316,7 +316,7 @@ public class CollectionPropertiesZkStateReader implements Closeable {
while (true) {
try {
Stat stat = new Stat();
- byte[] data = zkClient.getData(znodePath, watcher, stat, true);
+ byte[] data = zkClient.getData(znodePath, watcher, stat);
@SuppressWarnings("unchecked")
Map<String, String> props = (Map<String, String>) Utils.fromJSON(data);
return new VersionedCollectionProps(stat.getVersion(), props);
@@ -328,7 +328,7 @@ public class CollectionPropertiesZkStateReader implements Closeable {
} catch (KeeperException.NoNodeException e) {
if (watcher != null) {
// Leave an exists watch in place in case a collectionprops.json is created later.
- Stat exists = zkClient.exists(znodePath, watcher, true);
+ Stat exists = zkClient.exists(znodePath, watcher);
if (exists != null) {
// Rare race condition, we tried to fetch the data and couldn't find it, then we found
// it exists. Loop and try again.
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
index 781289df2f7..1995bae34bd 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/PerReplicaStatesOps.java
@@ -59,12 +59,12 @@ public class PerReplicaStatesOps {
assert CommonTestInjection.injectBreakpoint(
PerReplicaStatesOps.class.getName() + "/beforePrsFetch");
if (current != null) {
- Stat stat = zkClient.exists(current.path, null, true);
+ Stat stat = zkClient.exists(current.path, null);
if (stat == null) return new PerReplicaStates(path, 0, Collections.emptyList());
if (current.cversion == stat.getCversion()) return current; // not modifiedZkStateReaderTest
}
Stat stat = new Stat();
- List<String> children = zkClient.getChildren(path, null, stat, true);
+ List<String> children = zkClient.getChildren(path, null, stat);
return new PerReplicaStates(path, stat.getCversion(), Collections.unmodifiableList(children));
} catch (KeeperException.NoNodeException e) {
throw new PrsZkNodeNotFoundException(
@@ -115,7 +115,7 @@ public class PerReplicaStatesOps {
try {
zkClient.multi(ops);
} catch (KeeperException e) {
- log.error("Multi-op exception: {}", zkClient.getChildren(znode, null, true));
+ log.error("Multi-op exception: {}", zkClient.getChildren(znode, null));
throw e;
}
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
index 487fa6b427b..0a35bad37e5 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SecurityNodeWatcher.java
@@ -71,12 +71,9 @@ class SecurityNodeWatcher implements Watcher {
new SolrZkClient.NodeData(new Stat(), "{}".getBytes(StandardCharsets.UTF_8));
if (Event.EventType.NodeDeleted.equals(event.getType())) {
// Node deleted, just recreate watch without attempting a read - SOLR-9679
- zkStateReader.getZkClient().exists(ZkStateReader.SOLR_SECURITY_CONF_PATH, this, true);
+ zkStateReader.getZkClient().exists(ZkStateReader.SOLR_SECURITY_CONF_PATH, this);
} else {
- data =
- zkStateReader
- .getZkClient()
- .getNode(ZkStateReader.SOLR_SECURITY_CONF_PATH, this, true);
+ data = zkStateReader.getZkClient().getNode(ZkStateReader.SOLR_SECURITY_CONF_PATH, this);
}
try {
callback.call(data);
@@ -97,7 +94,7 @@ class SecurityNodeWatcher implements Watcher {
}
void register() throws InterruptedException, KeeperException {
- zkStateReader.getZkClient().exists(ZkStateReader.SOLR_SECURITY_CONF_PATH, this, true);
+ zkStateReader.getZkClient().exists(ZkStateReader.SOLR_SECURITY_CONF_PATH, this);
securityData = getSecurityProps(true);
}
@@ -108,9 +105,9 @@ class SecurityNodeWatcher implements Watcher {
return new ZkStateReader.ConfigData(securityData.data, securityData.version);
}
try {
- if (zkStateReader.getZkClient().exists(ZkStateReader.SOLR_SECURITY_CONF_PATH, true)) {
+ if (zkStateReader.getZkClient().exists(ZkStateReader.SOLR_SECURITY_CONF_PATH)) {
SolrZkClient.NodeData d =
- zkStateReader.getZkClient().getNode(ZkStateReader.SOLR_SECURITY_CONF_PATH, null, true);
+ zkStateReader.getZkClient().getNode(ZkStateReader.SOLR_SECURITY_CONF_PATH, null);
return d != null && d.data.length > 0
? new ZkStateReader.ConfigData(
(Map<String, Object>) Utils.fromJSON(d.data), d.stat.getVersion())
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java
index eaefc7589fc..164af46dc05 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/SolrZkClient.java
@@ -317,7 +317,7 @@ public class SolrZkClient implements Closeable {
return client.getZookeeperClient().isConnected();
}
- public void delete(final String path, final int version, boolean retryOnConnLoss)
+ public void delete(final String path, final int version)
throws InterruptedException, KeeperException {
runWithCorrectThrows(
"deleting znode", () -> client.delete().withVersion(version).forPath(path));
@@ -326,9 +326,8 @@ public class SolrZkClient implements Closeable {
/**
* Wraps the watcher so that it doesn't fire off ZK's event queue. In order to guarantee that a
* watch object will only be triggered once for a given notification, users need to wrap their
- * watcher using this method before calling {@link #exists(String, org.apache.zookeeper.Watcher,
- * boolean)} or {@link #getData(String, org.apache.zookeeper.Watcher,
- * org.apache.zookeeper.data.Stat, boolean)}.
+ * watcher using this method before calling {@link #exists(String, org.apache.zookeeper.Watcher)}
+ * or {@link #getData(String, org.apache.zookeeper.Watcher, org.apache.zookeeper.data.Stat)}.
*/
public Watcher wrapWatcher(final Watcher watcher) {
if (watcher == null || watcher instanceof ProcessWatchWithExecutor) return watcher;
@@ -349,7 +348,7 @@ public class SolrZkClient implements Closeable {
* @throws InterruptedException If the server transaction is interrupted.
* @throws IllegalArgumentException if an invalid path is specified
*/
- public Stat exists(final String path, final Watcher watcher, boolean retryOnConnLoss)
+ public Stat exists(final String path, final Watcher watcher)
throws KeeperException, InterruptedException {
Stat result =
runWithCorrectThrows(
@@ -359,15 +358,14 @@ public class SolrZkClient implements Closeable {
}
/** Returns true if path exists */
- public Boolean exists(final String path, boolean retryOnConnLoss)
- throws KeeperException, InterruptedException {
+ public Boolean exists(final String path) throws KeeperException, InterruptedException {
Boolean result =
runWithCorrectThrows("checking exists", () -> client.checkExists().forPath(path) != null);
return result;
}
/** Returns children of the node at the path */
- public List<String> getChildren(final String path, final Watcher watcher, boolean retryOnConnLoss)
+ public List<String> getChildren(final String path, final Watcher watcher)
throws KeeperException, InterruptedException {
List<String> result =
runWithCorrectThrows(
@@ -377,8 +375,7 @@ public class SolrZkClient implements Closeable {
}
/** Returns children of the node at the path */
- public List<String> getChildren(
- final String path, final Watcher watcher, Stat stat, boolean retryOnConnLoss)
+ public List<String> getChildren(final String path, final Watcher watcher, Stat stat)
throws KeeperException, InterruptedException {
List<String> result =
runWithCorrectThrows(
@@ -393,8 +390,7 @@ public class SolrZkClient implements Closeable {
}
/** Returns node's data */
- public byte[] getData(
- final String path, final Watcher watcher, final Stat stat, boolean retryOnConnLoss)
+ public byte[] getData(final String path, final Watcher watcher, final Stat stat)
throws KeeperException, InterruptedException {
byte[] result =
runWithCorrectThrows(
@@ -408,15 +404,14 @@ public class SolrZkClient implements Closeable {
return result;
}
- public NodeData getNode(final String path, Watcher watcher, boolean retryOnConnLoss)
+ public NodeData getNode(final String path, Watcher watcher)
throws KeeperException, InterruptedException {
Stat stat = new Stat();
- return new NodeData(stat, getData(path, watcher, stat, retryOnConnLoss));
+ return new NodeData(stat, getData(path, watcher, stat));
}
/** Returns node's state */
- public Stat setData(
- final String path, final byte[] data, final int version, boolean retryOnConnLoss)
+ public Stat setData(final String path, final byte[] data, final int version)
throws KeeperException, InterruptedException {
Stat result =
runWithCorrectThrows(
@@ -436,14 +431,14 @@ public class SolrZkClient implements Closeable {
byte[] zkData = null;
Stat s = new Stat();
try {
- if (exists(path, true)) {
- zkData = getData(path, null, s, true);
+ if (exists(path)) {
+ zkData = getData(path, null, s);
modified = editor.apply(s, zkData);
if (modified == null) {
// no change , no need to persist
return;
}
- setData(path, modified, s.getVersion(), true);
+ setData(path, modified, s.getVersion());
break;
} else {
modified = editor.apply(s, null);
@@ -451,7 +446,7 @@ public class SolrZkClient implements Closeable {
// no change , no need to persist
return;
}
- create(path, modified, CreateMode.PERSISTENT, true);
+ create(path, modified, CreateMode.PERSISTENT);
break;
}
} catch (KeeperException.BadVersionException | KeeperException.NodeExistsException e) {
@@ -461,8 +456,7 @@ public class SolrZkClient implements Closeable {
}
/** Returns path of created node */
- public String create(
- final String path, final byte[] data, final CreateMode createMode, boolean retryOnConnLoss)
+ public String create(final String path, final byte[] data, final CreateMode createMode)
throws KeeperException, InterruptedException {
String result =
runWithCorrectThrows(
@@ -475,12 +469,7 @@ public class SolrZkClient implements Closeable {
*
* @param stat Output argument that captures created node details
*/
- public String create(
- final String path,
- final byte[] data,
- final CreateMode createMode,
- boolean retryOnConnLoss,
- Stat stat)
+ public String create(final String path, final byte[] data, final CreateMode createMode, Stat stat)
throws KeeperException, InterruptedException {
String result =
runWithCorrectThrows(
@@ -495,29 +484,28 @@ public class SolrZkClient implements Closeable {
* <p>e.g. If <code>path=/solr/group/node</code> and none of the nodes, solr, group, node exist,
* each will be created.
*/
- public void makePath(String path, boolean retryOnConnLoss)
- throws KeeperException, InterruptedException {
- makePath(path, null, CreateMode.PERSISTENT, retryOnConnLoss);
+ public void makePath(String path) throws KeeperException, InterruptedException {
+ makePath(path, null, CreateMode.PERSISTENT);
}
- public void makePath(String path, boolean failOnExists, boolean retryOnConnLoss)
+ public void makePath(String path, boolean failOnExists)
throws KeeperException, InterruptedException {
- makePath(path, null, CreateMode.PERSISTENT, null, failOnExists, retryOnConnLoss, 0);
+ makePath(path, null, CreateMode.PERSISTENT, null, failOnExists, 0);
}
- public void makePath(String path, byte[] data, boolean failOnExists, boolean retryOnConnLoss)
- throws IOException, KeeperException, InterruptedException {
- makePath(path, data, CreateMode.PERSISTENT, null, failOnExists, retryOnConnLoss, 0);
+ public void makePath(String path, byte[] data, boolean failOnExists)
+ throws KeeperException, InterruptedException {
+ makePath(path, data, CreateMode.PERSISTENT, null, failOnExists, 0);
}
- public void makePath(String path, Path data, boolean retryOnConnLoss)
+ public void makePath(String path, Path data)
throws IOException, KeeperException, InterruptedException {
- makePath(path, Files.readAllBytes(data), retryOnConnLoss);
+ makePath(path, Files.readAllBytes(data));
}
- public void makePath(String path, CreateMode createMode, boolean retryOnConnLoss)
+ public void makePath(String path, CreateMode createMode)
throws KeeperException, InterruptedException {
- makePath(path, null, createMode, retryOnConnLoss);
+ makePath(path, null, createMode);
}
/**
@@ -525,9 +513,8 @@ public class SolrZkClient implements Closeable {
*
* @param data to set on the last zkNode
*/
- public void makePath(String path, byte[] data, boolean retryOnConnLoss)
- throws KeeperException, InterruptedException {
- makePath(path, data, CreateMode.PERSISTENT, retryOnConnLoss);
+ public void makePath(String path, byte[] data) throws KeeperException, InterruptedException {
+ makePath(path, data, CreateMode.PERSISTENT);
}
/**
@@ -538,9 +525,9 @@ public class SolrZkClient implements Closeable {
*
* @param data to set on the last zkNode
*/
- public void makePath(String path, byte[] data, CreateMode createMode, boolean retryOnConnLoss)
+ public void makePath(String path, byte[] data, CreateMode createMode)
throws KeeperException, InterruptedException {
- makePath(path, data, createMode, null, retryOnConnLoss);
+ makePath(path, data, createMode, null);
}
/**
@@ -551,10 +538,9 @@ public class SolrZkClient implements Closeable {
*
* @param data to set on the last zkNode
*/
- public void makePath(
- String path, byte[] data, CreateMode createMode, Watcher watcher, boolean retryOnConnLoss)
+ public void makePath(String path, byte[] data, CreateMode createMode, Watcher watcher)
throws KeeperException, InterruptedException {
- makePath(path, data, createMode, watcher, true, retryOnConnLoss, 0);
+ makePath(path, data, createMode, watcher, true, 0);
}
/**
@@ -566,14 +552,9 @@ public class SolrZkClient implements Closeable {
* @param data to set on the last zkNode
*/
public void makePath(
- String path,
- byte[] data,
- CreateMode createMode,
- Watcher watcher,
- boolean failOnExists,
- boolean retryOnConnLoss)
+ String path, byte[] data, CreateMode createMode, Watcher watcher, boolean failOnExists)
throws KeeperException, InterruptedException {
- makePath(path, data, createMode, watcher, failOnExists, retryOnConnLoss, 0);
+ makePath(path, data, createMode, watcher, failOnExists, 0);
}
/**
@@ -584,8 +565,6 @@ public class SolrZkClient implements Closeable {
*
* <p>skipPathParts will force the call to fail if the first skipPathParts do not exist already.
*
- * <p>Note: retryOnConnLoss is no longer respected at all and is ignored
- *
* <p>Note: if failOnExists == false then we will always overwrite the existing data with the
* given data
*/
@@ -595,7 +574,6 @@ public class SolrZkClient implements Closeable {
CreateMode createMode,
Watcher watcher,
boolean failOnExists,
- boolean retryOnConnLoss,
int skipPathParts)
throws KeeperException, InterruptedException {
log.debug("makePath: {}", path);
@@ -653,7 +631,7 @@ public class SolrZkClient implements Closeable {
} catch (KeeperException.NodeExistsException e) {
// There can be a race exception when this is called in parallel
if (!failOnExists) {
- setData(finalPath, finalData, true);
+ setData(finalPath, finalData);
} else {
throw e;
}
@@ -662,10 +640,9 @@ public class SolrZkClient implements Closeable {
});
}
- public void makePath(
- String zkPath, CreateMode createMode, Watcher watcher, boolean retryOnConnLoss)
+ public void makePath(String zkPath, CreateMode createMode, Watcher watcher)
throws KeeperException, InterruptedException {
- makePath(zkPath, null, createMode, watcher, retryOnConnLoss);
+ makePath(zkPath, null, createMode, watcher);
}
/**
@@ -711,7 +688,7 @@ public class SolrZkClient implements Closeable {
public void ensureExists(
final String path, final byte[] data, CreateMode createMode, int skipPathParts)
throws KeeperException, InterruptedException {
- if (exists(path, true)) {
+ if (exists(path)) {
return;
}
try {
@@ -724,20 +701,19 @@ public class SolrZkClient implements Closeable {
throw new KeeperException.NoNodeException(path);
}
String startingPath = path.substring(0, endingIndex);
- if (!exists(startingPath, true)) {
+ if (!exists(startingPath)) {
throw new KeeperException.NoNodeException(startingPath);
}
}
- makePath(path, data, createMode, null, true, true, skipPathParts);
+ makePath(path, data, createMode, null, true, skipPathParts);
} catch (KeeperException.NodeExistsException ignored) {
// it's okay if another beats us creating the node
}
}
/** Write data to ZooKeeper. */
- public Stat setData(String path, byte[] data, boolean retryOnConnLoss)
- throws KeeperException, InterruptedException {
- return setData(path, data, -1, retryOnConnLoss);
+ public Stat setData(String path, byte[] data) throws KeeperException, InterruptedException {
+ return setData(path, data, -1);
}
/**
@@ -746,12 +722,12 @@ public class SolrZkClient implements Closeable {
* @param path path to upload file to e.g. /solr/conf/solrconfig.xml
* @param source a filepath to read data from
*/
- public Stat setData(String path, Path source, boolean retryOnConnLoss)
+ public Stat setData(String path, Path source)
throws IOException, KeeperException, InterruptedException {
if (log.isDebugEnabled()) {
log.debug("Write to ZooKeeper: {} to {}", source.toAbsolutePath(), path);
}
- return setData(path, Files.readAllBytes(source), retryOnConnLoss);
+ return setData(path, Files.readAllBytes(source));
}
/**
@@ -798,8 +774,8 @@ public class SolrZkClient implements Closeable {
/** Fills string with printout of current ZooKeeper layout. */
public void printLayout(String path, int indent, StringBuilder string)
throws KeeperException, InterruptedException {
- byte[] data = getData(path, null, null, true);
- List<String> children = getChildren(path, null, true);
+ byte[] data = getData(path, null, null);
+ List<String> children = getChildren(path, null);
StringBuilder dent = new StringBuilder();
dent.append(" ".repeat(Math.max(0, indent)));
string.append(dent).append(path).append(" (").append(children.size()).append(")").append(NEWL);
@@ -951,8 +927,7 @@ public class SolrZkClient implements Closeable {
/**
* @return the ACLs on a single node in ZooKeeper.
*/
- public List<ACL> getACL(String path, Stat stat, boolean retryOnConnLoss)
- throws KeeperException, InterruptedException {
+ public List<ACL> getACL(String path, Stat stat) throws KeeperException, InterruptedException {
return runWithCorrectThrows(
"getting acls", () -> client.getACL().storingStatIn(stat).forPath(path));
}
@@ -1027,7 +1002,7 @@ public class SolrZkClient implements Closeable {
}
public String listZnode(String path, Boolean recurse)
- throws KeeperException, InterruptedException, SolrServerException {
+ throws KeeperException, InterruptedException {
return ZkMaintenanceUtils.listZnode(this, path, recurse);
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java
index 8be068d50ca..0d98a65da7c 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkMaintenanceUtils.java
@@ -86,7 +86,7 @@ public class ZkMaintenanceUtils {
StringBuilder sb = new StringBuilder();
if (!recursive) {
- for (String node : zkClient.getChildren(root, null, true)) {
+ for (String node : zkClient.getChildren(root, null)) {
if (!node.equals("zookeeper")) {
sb.append(node).append(System.lineSeparator());
}
@@ -142,7 +142,7 @@ public class ZkMaintenanceUtils {
// Make sure --recursive is specified if the source has children.
if (!recursive) {
if (srcIsZk) {
- if (zkClient.getChildren(src, null, true).size() != 0) {
+ if (zkClient.getChildren(src, null).size() != 0) {
throw new SolrServerException(
"Zookeeper node " + src + " has children and recursive is false");
}
@@ -172,7 +172,7 @@ public class ZkMaintenanceUtils {
// Copying individual files from ZK requires special handling since downloadFromZK assumes the
// node has children. This is kind of a weak test for the notion of "directory" on Zookeeper. ZK
// -> local copy where ZK is a parent node
- if (zkClient.getChildren(src, null, true).size() > 0) {
+ if (zkClient.getChildren(src, null).size() > 0) {
downloadFromZK(zkClient, src, Path.of(dst));
return;
}
@@ -184,7 +184,7 @@ public class ZkMaintenanceUtils {
}
dst = normalizeDest(src, dst, srcIsZk, dstIsZk);
}
- byte[] data = zkClient.getData(src, null, null, true);
+ byte[] data = zkClient.getData(src, null, null);
Path filename = Path.of(dst);
Path parentDir = filename.getParent();
if (parentDir != null) {
@@ -225,9 +225,9 @@ public class ZkMaintenanceUtils {
String destName = normalizeDest(src, dst, true, true);
// Special handling if the source has no children, i.e. copying just a single file.
- if (zkClient.getChildren(src, null, true).size() == 0) {
- zkClient.makePath(destName, false, true);
- zkClient.setData(destName, zkClient.getData(src, null, null, true), true);
+ if (zkClient.getChildren(src, null).size() == 0) {
+ zkClient.makePath(destName, false);
+ zkClient.setData(destName, zkClient.getData(src, null, null));
} else {
traverseZkTree(zkClient, src, VISIT_ORDER.VISIT_PRE, new ZkCopier(zkClient, src, destName));
}
@@ -244,8 +244,8 @@ public class ZkMaintenanceUtils {
private static void checkAllZnodesThere(SolrZkClient zkClient, String src, String dst)
throws KeeperException, InterruptedException, SolrServerException {
- for (String node : zkClient.getChildren(src, null, true)) {
- if (!zkClient.exists(dst + "/" + node, true)) {
+ for (String node : zkClient.getChildren(src, null)) {
+ if (!zkClient.exists(dst + "/" + node)) {
throw new SolrServerException(
"mv command did not move node " + dst + "/" + node + " source left intact");
}
@@ -264,7 +264,7 @@ public class ZkMaintenanceUtils {
try {
if (!znode.equals("/")) {
try {
- zkClient.delete(znode, -1, true);
+ zkClient.delete(znode, -1);
} catch (KeeperException.NotEmptyException e) {
clean(zkClient, znode);
}
@@ -303,7 +303,7 @@ public class ZkMaintenanceUtils {
for (String subpath : paths) {
if (!subpath.equals("/")) {
try {
- zkClient.delete(subpath, -1, true);
+ zkClient.delete(subpath, -1);
} catch (KeeperException.NotEmptyException | KeeperException.NoNodeException e) {
// expected
}
@@ -357,14 +357,14 @@ public class ZkMaintenanceUtils {
try {
// if the path exists (and presumably we're uploading data to it) just set its data
if (file.getFileName().toString().equals(ZKNODE_DATA_FILE)
- && zkClient.exists(zkNode, true)) {
- zkClient.setData(zkNode, file, true);
+ && zkClient.exists(zkNode)) {
+ zkClient.setData(zkNode, file);
} else if (file == rootPath) {
// We are only uploading a single file, preVisitDirectory was never called
- if (zkClient.exists(zkPath, true)) {
- zkClient.setData(zkPath, file, true);
+ if (zkClient.exists(zkPath)) {
+ zkClient.setData(zkPath, file);
} else {
- zkClient.makePath(zkPath, Files.readAllBytes(file), false, true);
+ zkClient.makePath(zkPath, Files.readAllBytes(file), false);
}
} else {
// Skip path parts here because they should have been created during
@@ -376,7 +376,6 @@ public class ZkMaintenanceUtils {
CreateMode.PERSISTENT,
null,
false,
- true,
pathParts);
}
@@ -401,7 +400,7 @@ public class ZkMaintenanceUtils {
} else {
// Skip path parts here because they should have been created during previous visits
int pathParts = dir.getNameCount() + partsOffset;
- zkClient.makePath(zkNode, null, CreateMode.PERSISTENT, null, true, true, pathParts);
+ zkClient.makePath(zkNode, null, CreateMode.PERSISTENT, null, true, pathParts);
}
} catch (KeeperException.NodeExistsException ignored) {
// Using fail-on-exists == false has side effect of makePath attempting to setData on
@@ -420,13 +419,13 @@ public class ZkMaintenanceUtils {
private static boolean isEphemeral(SolrZkClient zkClient, String zkPath)
throws KeeperException, InterruptedException {
- Stat znodeStat = zkClient.exists(zkPath, null, true);
+ Stat znodeStat = zkClient.exists(zkPath, null);
return znodeStat.getEphemeralOwner() != 0;
}
private static int copyDataDown(SolrZkClient zkClient, String zkPath, Path file)
throws IOException, KeeperException, InterruptedException {
- byte[] data = zkClient.getData(zkPath, null, null, true);
+ byte[] data = zkClient.getData(zkPath, null, null);
if (data != null && data.length > 0) { // There are apparently basically empty ZNodes.
log.info("Writing file {}", file);
Files.write(file, data);
@@ -438,7 +437,7 @@ public class ZkMaintenanceUtils {
public static void downloadFromZK(SolrZkClient zkClient, String zkPath, Path file)
throws IOException {
try {
- List<String> children = zkClient.getChildren(zkPath, null, true);
+ List<String> children = zkClient.getChildren(zkPath, null);
// If it has no children, it's a leaf node, write the associated data from the ZNode.
// Otherwise, continue recursively traversing, but write any associated data to a special file
if (children.size() == 0) {
@@ -512,7 +511,7 @@ public class ZkMaintenanceUtils {
}
List<String> children;
try {
- children = zkClient.getChildren(path, null, true);
+ children = zkClient.getChildren(path, null);
} catch (KeeperException.NoNodeException r) {
return;
}
@@ -653,11 +652,11 @@ public class ZkMaintenanceUtils {
int skipPathParts)
throws KeeperException, InterruptedException {
- if (zkClient.exists(path, true)) {
+ if (zkClient.exists(path)) {
return;
}
try {
- zkClient.makePath(path, data, createMode, null, true, true, skipPathParts);
+ zkClient.makePath(path, data, createMode, null, true, skipPathParts);
} catch (NodeExistsException ignored) {
// it's okay if another beats us creating the node
}
@@ -684,8 +683,8 @@ public class ZkMaintenanceUtils {
if (!path.equals(source)) {
finalDestination += "/" + path.substring(source.length() + 1);
}
- zkClient.makePath(finalDestination, false, true);
- zkClient.setData(finalDestination, zkClient.getData(path, null, null, true), true);
+ zkClient.makePath(finalDestination, false);
+ zkClient.setData(finalDestination, zkClient.getData(path, null, null));
}
}
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index e54684c3973..2f60c7aad9b 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -670,7 +670,7 @@ public class ZkStateReader implements SolrCloseable {
synchronized (refreshCollectionListLock) {
List<String> children = null;
try {
- children = zkClient.getChildren(COLLECTIONS_ZKNODE, watcher, true);
+ children = zkClient.getChildren(COLLECTIONS_ZKNODE, watcher);
} catch (KeeperException.NoNodeException e) {
log.warn("Error fetching collection names: ", e);
// fall through
@@ -764,7 +764,7 @@ public class ZkStateReader implements SolrCloseable {
if (cachedDocCollection != null) {
Stat freshStats = null;
try {
- freshStats = zkClient.exists(DocCollection.getCollectionPath(collName), null, true);
+ freshStats = zkClient.exists(DocCollection.getCollectionPath(collName), null);
lastUpdateTime = System.nanoTime();
} catch (Exception e) {
}
@@ -803,7 +803,7 @@ public class ZkStateReader implements SolrCloseable {
synchronized (refreshLiveNodesLock) {
SortedSet<String> newLiveNodes;
try {
- List<String> nodeList = zkClient.getChildren(LIVE_NODES_ZKNODE, watcher, true);
+ List<String> nodeList = zkClient.getChildren(LIVE_NODES_ZKNODE, watcher);
newLiveNodes = new TreeSet<>(nodeList);
} catch (KeeperException.NoNodeException | AlreadyClosedException e) {
newLiveNodes = emptySortedSet();
@@ -885,14 +885,14 @@ public class ZkStateReader implements SolrCloseable {
*/
public Optional<SolrVersion> fetchLowestSolrVersion()
throws KeeperException, InterruptedException {
- List<String> liveNodeNames = zkClient.getChildren(LIVE_NODES_ZKNODE, null, true);
+ List<String> liveNodeNames = zkClient.getChildren(LIVE_NODES_ZKNODE, null);
SolrVersion lowest = null;
// the last version to not specify its version in live nodes
final SolrVersion UNSPECIFIED_VERSION = SolrVersion.valueOf("9.9.0");
for (String nodeName : liveNodeNames) {
String path = LIVE_NODES_ZKNODE + "/" + nodeName;
- byte[] data = zkClient.getData(path, null, null, true);
+ byte[] data = zkClient.getData(path, null, null);
if (data == null || data.length == 0) {
return Optional.of(UNSPECIFIED_VERSION);
}
@@ -1178,8 +1178,7 @@ public class ZkStateReader implements SolrCloseable {
while (true) {
try {
byte[] data =
- zkClient.getData(
- ZkStateReader.CLUSTER_PROPS, clusterPropertiesWatcher, new Stat(), true);
+ zkClient.getData(ZkStateReader.CLUSTER_PROPS, clusterPropertiesWatcher, new Stat());
this.clusterProperties = (Map<String, Object>) Utils.fromJSON(data);
log.debug("Loaded cluster properties: {}", this.clusterProperties);
@@ -1192,7 +1191,7 @@ public class ZkStateReader implements SolrCloseable {
log.debug("Loaded empty cluster properties");
// set an exists watch, and if the node has been created since the last call,
// read the data again
- if (zkClient.exists(ZkStateReader.CLUSTER_PROPS, clusterPropertiesWatcher, true) == null)
+ if (zkClient.exists(ZkStateReader.CLUSTER_PROPS, clusterPropertiesWatcher) == null)
return;
}
}
@@ -1326,7 +1325,7 @@ public class ZkStateReader implements SolrCloseable {
Stat stat = new Stat();
List<String> replicaStates = null;
try {
- replicaStates = zkClient.getChildren(collectionPath, this, stat, true);
+ replicaStates = zkClient.getChildren(collectionPath, this, stat);
PerReplicaStates newStates =
new PerReplicaStates(collectionPath, stat.getCversion(), replicaStates);
DocCollection oldState = collectionWatches.getDocCollection(coll);
@@ -1446,7 +1445,7 @@ public class ZkStateReader implements SolrCloseable {
while (true) {
try {
Stat stat = new Stat();
- byte[] data = zkClient.getData(collectionPath, watcher, stat, true);
+ byte[] data = zkClient.getData(collectionPath, watcher, stat);
// This factory method can detect a missing configName and supply it by reading it from the
// old ZK location.
@@ -1464,7 +1463,7 @@ public class ZkStateReader implements SolrCloseable {
} catch (KeeperException.NoNodeException e) {
if (watcher != null) {
// Leave an exists watch in place in case a state.json is created later.
- Stat exists = zkClient.exists(collectionPath, watcher, true);
+ Stat exists = zkClient.exists(collectionPath, watcher);
if (exists != null) {
// Rare race condition, we tried to fetch the data and couldn't find it, then we found
// it exists. Loop and try again.
@@ -1477,7 +1476,7 @@ public class ZkStateReader implements SolrCloseable {
ZkStateReader.class.getName() + "/exercised", e);
// could be a race condition that state.json and PRS entries are deleted between the
// state.json fetch and PRS entry fetch
- Stat exists = zkClient.exists(collectionPath, watcher, true);
+ Stat exists = zkClient.exists(collectionPath, watcher);
if (exists == null) {
log.info(
"PRS entry for collection {} not found in ZK. It was probably deleted between state.json read and PRS entry read.",
@@ -1981,7 +1980,7 @@ public class ZkStateReader implements SolrCloseable {
private void refreshAliases(AliasesManager watcher) throws KeeperException, InterruptedException {
synchronized (getUpdateLock()) {
constructState(Collections.emptySet());
- zkClient.exists(ALIASES, watcher, true);
+ zkClient.exists(ALIASES, watcher);
}
aliasesManager.update();
}
@@ -2040,7 +2039,7 @@ public class ZkStateReader implements SolrCloseable {
try {
try {
final Stat stat =
- getZkClient().setData(ALIASES, modAliasesJson, curAliases.getZNodeVersion(), true);
+ getZkClient().setData(ALIASES, modAliasesJson, curAliases.getZNodeVersion());
setIfNewer(new SolrZkClient.NodeData(stat, modAliasesJson));
return;
} catch (KeeperException.BadVersionException e) {
@@ -2084,7 +2083,7 @@ public class ZkStateReader implements SolrCloseable {
// Call sync() first to ensure the subsequent read (getData) is up-to-date.
zkClient.runWithCorrectThrows(
"syncing aliases", () -> zkClient.getCuratorFramework().sync().forPath(ALIASES));
- return setIfNewer(zkClient.getNode(ALIASES, null, true));
+ return setIfNewer(zkClient.getNode(ALIASES, null));
}
// ZK Watcher interface
@@ -2098,7 +2097,7 @@ public class ZkStateReader implements SolrCloseable {
log.debug("Aliases: updating");
// re-register the watch
- setIfNewer(zkClient.getNode(ALIASES, this, true));
+ setIfNewer(zkClient.getNode(ALIASES, this));
} catch (NoNodeException e) {
// /aliases.json will not always exist
} catch (KeeperException.ConnectionLossException
diff --git a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java
index 0231c1aee1e..7a0fa5283cb 100644
--- a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java
+++ b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/SolrZkClientTest.java
@@ -85,7 +85,7 @@ public class SolrZkClientTest extends SolrCloudTestCase {
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build()) {
// Set up chroot
- client.makePath("/solr", false, true);
+ client.makePath("/solr", false);
}
defaultClient =
@@ -215,12 +215,10 @@ public class SolrZkClientTest extends SolrCloudTestCase {
ZkStateReader.from(solrClient)
.getZkClient()
- .getData(
- "/collections/" + getSaferTestName() + "/collectionprops.json", wrapped1A, null, true);
+ .getData("/collections/" + getSaferTestName() + "/collectionprops.json", wrapped1A, null);
ZkStateReader.from(solrClient)
.getZkClient()
- .getData(
- "/collections/" + getSaferTestName() + "/collectionprops.json", wrapped2A, null, true);
+ .getData("/collections/" + getSaferTestName() + "/collectionprops.json", wrapped2A, null);
CollectionAdminRequest.setCollectionProperty(getSaferTestName(), "baz", "bam")
.process(solrClient);
@@ -234,12 +232,10 @@ public class SolrZkClientTest extends SolrCloudTestCase {
ZkStateReader.from(solrClient)
.getZkClient()
- .getData(
- "/collections/" + getSaferTestName() + "/collectionprops.json", wrapped1A, null, true);
+ .getData("/collections/" + getSaferTestName() + "/collectionprops.json", wrapped1A, null);
ZkStateReader.from(solrClient)
.getZkClient()
- .getData(
- "/collections/" + getSaferTestName() + "/collectionprops.json", wrappedB, null, true);
+ .getData("/collections/" + getSaferTestName() + "/collectionprops.json", wrappedB, null);
CollectionAdminRequest.setCollectionProperty(getSaferTestName(), "baz", "bang")
.process(solrClient);
@@ -256,7 +252,7 @@ public class SolrZkClientTest extends SolrCloudTestCase {
private static boolean canRead(SolrZkClient zkClient, String path)
throws KeeperException, InterruptedException {
try {
- zkClient.getData(path, null, null, true);
+ zkClient.getData(path, null, null);
return true;
} catch (KeeperException.NoAuthException e) {
return false;
@@ -316,12 +312,12 @@ public class SolrZkClientTest extends SolrCloudTestCase {
try {
Stat createStat = new Stat();
defaultClient.create(
- path, "hello".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, false, createStat);
+ path, "hello".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, createStat);
Stat readStat = new Stat();
- defaultClient.getData(path, null, readStat, false);
+ defaultClient.getData(path, null, readStat);
assertEquals(createStat, readStat);
} finally {
- defaultClient.delete(path, 0, false);
+ defaultClient.delete(path, 0);
}
}
@@ -331,12 +327,12 @@ public class SolrZkClientTest extends SolrCloudTestCase {
try {
Stat createStat = new Stat();
defaultClient.create(
- path, "hello".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, true, createStat);
+ path, "hello".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, createStat);
Stat readStat = new Stat();
- defaultClient.getData(path, null, readStat, false);
+ defaultClient.getData(path, null, readStat);
assertEquals(createStat, readStat);
} finally {
- defaultClient.delete(path, 0, false);
+ defaultClient.delete(path, 0);
}
}
}
diff --git a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestPerReplicaStates.java b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestPerReplicaStates.java
index ab650bdc608..52ee6ff7d7e 100644
--- a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestPerReplicaStates.java
+++ b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestPerReplicaStates.java
@@ -86,12 +86,12 @@ public class TestPerReplicaStates extends SolrCloudTestCase {
public void testReplicaStateOperations() throws Exception {
String root = "/testReplicaStateOperations";
- cluster.getZkClient().create(root, null, CreateMode.PERSISTENT, true);
+ cluster.getZkClient().create(root, null, CreateMode.PERSISTENT);
List<String> states = List.of("R1:2:A", "R1:1:A:L", "R1:0:D", "R3:0:A", "R4:13:A");
for (String state : states) {
- cluster.getZkClient().create(root + "/" + state, null, CreateMode.PERSISTENT, true);
+ cluster.getZkClient().create(root + "/" + state, null, CreateMode.PERSISTENT);
}
ZkStateReader zkStateReader = cluster.getZkStateReader();
@@ -106,7 +106,7 @@ public class TestPerReplicaStates extends SolrCloudTestCase {
rs = PerReplicaStatesOps.fetch(root, zkStateReader.getZkClient(), null);
assertEquals(4, rs.states.size());
assertTrue(rs.cversion >= 6);
- assertEquals(6, cluster.getZkClient().getChildren(root, null, true).size());
+ assertEquals(6, cluster.getZkClient().getChildren(root, null).size());
ops = PerReplicaStatesOps.flipState("R1", State.DOWN, rs);
assertEquals(4, ops.ops.size());
diff --git a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkMaintenanceUtils.java b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkMaintenanceUtils.java
index 20c3652d9d6..67b932956c9 100644
--- a/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkMaintenanceUtils.java
+++ b/solr/solrj-zookeeper/src/test/org/apache/solr/common/cloud/TestZkMaintenanceUtils.java
@@ -80,18 +80,17 @@ public class TestZkMaintenanceUtils extends SolrTestCaseJ4 {
String data2 = "myStringData2";
String longData = "myLongStringData";
// create zk nodes that have the same path length
- zkClient.create("/myPath", null, CreateMode.PERSISTENT, true);
- zkClient.create(path, null, CreateMode.PERSISTENT, true);
+ zkClient.create("/myPath", null, CreateMode.PERSISTENT);
+ zkClient.create(path, null, CreateMode.PERSISTENT);
zkClient.create(
- path + "/file1.txt", data1.getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, true);
- zkClient.create(path + "/nothing.txt", null, CreateMode.PERSISTENT, true);
+ path + "/file1.txt", data1.getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT);
+ zkClient.create(path + "/nothing.txt", null, CreateMode.PERSISTENT);
zkClient.create(
- path + "/file2.txt", data2.getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, true);
+ path + "/file2.txt", data2.getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT);
zkClient.create(
path + "/some_longer_file2.txt",
longData.getBytes(StandardCharsets.UTF_8),
- CreateMode.PERSISTENT,
- true);
+ CreateMode.PERSISTENT);
/* RUN */
// delete all nodes that contain "file"
@@ -137,9 +136,9 @@ public class TestZkMaintenanceUtils extends SolrTestCaseJ4 {
.withUrl(zkServer.getZkHost())
.withTimeout(10000, TimeUnit.MILLISECONDS)
.build()) {
- zkClient.makePath("/testTraverseZkTree/1/1", true, true);
- zkClient.makePath("/testTraverseZkTree/1/2", false, true);
- zkClient.makePath("/testTraverseZkTree/2", false, true);
+ zkClient.makePath("/testTraverseZkTree/1/1", true);
+ zkClient.makePath("/testTraverseZkTree/1/2", false);
+ zkClient.makePath("/testTraverseZkTree/2", false);
assertEquals(
Arrays.asList(
"/testTraverseZkTree",
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClusterStateSSLTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClusterStateSSLTest.java
index 4fde78387a4..529b95373f6 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClusterStateSSLTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClusterStateSSLTest.java
@@ -64,9 +64,7 @@ public class HttpClusterStateSSLTest extends SolrCloudTestCase {
// verify the base_url is actually stored with https in it on the server-side
byte[] stateJsonBytes =
- cluster
- .getZkClient()
- .getData(DocCollection.getCollectionPath(collectionId), null, null, true);
+ cluster.getZkClient().getData(DocCollection.getCollectionPath(collectionId), null, null);
assertNotNull(stateJsonBytes);
Map<String, Object> replicasMap =
(Map<String, Object>)
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java
index 2f1641d5859..19c1a75de39 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java
@@ -84,7 +84,7 @@ public class TestCloudSolrClientConnections extends SolrTestCaseJ4 {
assertTrue(
"List of uploaded configs does not contain 'testconfig'",
- cluster.getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + "testconfig", true));
+ cluster.getZkClient().exists(ZkStateReader.CONFIGS_ZKNODE + "/" + "testconfig"));
} finally {
cluster.shutdown();
diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java b/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java
index e0129faaf10..595b2025f3b 100644
--- a/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java
@@ -193,8 +193,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
Utils.fromJSON(
SolrCloudTestCase.cluster
.getZkClient()
- .getData(
- DocCollection.getCollectionPath(testCollection), null, null, true)));
+ .getData(DocCollection.getCollectionPath(testCollection), null, null)));
assertNull(
rsp._get(
@@ -300,7 +299,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
Stat stat = null;
CollectionAdminRequest.createCollection(NONPRS_COLL, "conf", 10, 1)
.process(cluster.getSolrClient());
- stat = cluster.getZkClient().exists(DocCollection.getCollectionPath(NONPRS_COLL), null, true);
+ stat = cluster.getZkClient().exists(DocCollection.getCollectionPath(NONPRS_COLL), null);
log.info("");
// the actual number can vary depending on batching
assertTrue(stat.getVersion() >= 2);
@@ -310,7 +309,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
.setPerReplicaState(Boolean.TRUE)
.process(cluster.getSolrClient());
String PRS_PATH = DocCollection.getCollectionPath(PRS_COLL);
- stat = cluster.getZkClient().exists(PRS_PATH, null, true);
+ stat = cluster.getZkClient().exists(PRS_PATH, null);
// +1 after all replica are added with on state.json write to CreateCollectionCmd.setData()
assertEquals(1, stat.getVersion());
// For each replica:
@@ -325,7 +324,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
CollectionAdminRequest.addReplicaToShard(PRS_COLL, "shard1")
.process(cluster.getSolrClient());
cluster.waitForActiveCollection(PRS_COLL, 10, 11);
- stat = cluster.getZkClient().exists(PRS_PATH, null, true);
+ stat = cluster.getZkClient().exists(PRS_PATH, null);
// For the new replica:
// +2 for state.json overseer writes, even though there's no longer PRS updates from
// overseer, current code would still do a "TOUCH" on the PRS entry
@@ -345,7 +344,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
CollectionAdminRequest.deleteReplica(PRS_COLL, "shard1", addedReplica.getName())
.process(cluster.getSolrClient());
cluster.waitForActiveCollection(PRS_COLL, 10, 10);
- stat = cluster.getZkClient().exists(PRS_PATH, null, true);
+ stat = cluster.getZkClient().exists(PRS_PATH, null);
// For replica deletion
// +1 for ZkController#unregister, which delete the PRS entry from data node
// overseer, current code would still do a "TOUCH" on the PRS entry
@@ -354,7 +353,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
for (JettySolrRunner j : cluster.getJettySolrRunners()) {
j.stop();
j.start(true);
- stat = cluster.getZkClient().exists(PRS_PATH, null, true);
+ stat = cluster.getZkClient().exists(PRS_PATH, null);
// ensure restart does not update the state.json, after addReplica/deleteReplica, 2 more
// updates hence at version 3 on state.json version
assertEquals(3, stat.getVersion());
@@ -372,7 +371,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
// wait for the new replica to be active
cluster.waitForActiveCollection(PRS_COLL, 10, 11);
- stat = cluster.getZkClient().exists(PRS_PATH, null, true);
+ stat = cluster.getZkClient().exists(PRS_PATH, null);
// +1 for a new replica
assertEquals(4, stat.getVersion());
DocCollection c = cluster.getZkStateReader().getCollection(PRS_COLL);
@@ -394,7 +393,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase {
.get(newreplica.name)
.isLeader);
PerReplicaStates prs = PerReplicaStatesOps.fetch(PRS_PATH, cluster.getZkClient(), null);
- stat = cluster.getZkClient().exists(PRS_PATH, null, true);
+ stat = cluster.getZkClient().exists(PRS_PATH, null);
// the version should not have updated
assertEquals(4, stat.getVersion());
} finally {
diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientCompressedDataTest.java b/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientCompressedDataTest.java
index dbdbbc39449..71f95b23c4b 100644
--- a/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientCompressedDataTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/cloud/SolrZkClientCompressedDataTest.java
@@ -76,10 +76,10 @@ public class SolrZkClientCompressedDataTest extends SolrTestCase {
byte[] arr = state.getBytes(StandardCharsets.UTF_8);
byte[] compressedData = zLibStateCompression.compressBytes(arr);
String path = ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json";
- zkClient.create(path, compressedData, CreateMode.PERSISTENT, true);
+ zkClient.create(path, compressedData, CreateMode.PERSISTENT);
byte[] data =
- zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null, true);
+ zkClient.getData(ZkStateReader.COLLECTIONS_ZKNODE + "/c1/state.json", null, null);
Map<?, ?> map = (Map<?, ?>) Utils.fromJSON(data);
assertEquals(arr.length, data.length);
assertNotNull(map.get("c1"));
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index 26c21b60007..e00ff7f5a8f 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -803,7 +803,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
CoreContainer cc = h.getCoreContainer();
if (cc.getNumAllCores() > 0 && cc.isZooKeeperAware()) {
try {
- cc.getZkController().getZkClient().exists("/", false);
+ cc.getZkController().getZkClient().exists("/");
} catch (KeeperException e) {
log.error("Testing connectivity to ZK by checking for root path failed", e);
fail("Trying to tear down a ZK aware core container with ZK not reachable");
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
index 82bae1ea2f4..48c17cc3f7b 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
@@ -297,18 +297,14 @@ public abstract class AbstractFullDistribZkTestBase extends BaseDistributedSearc
.create(
ZkStateReader.CLUSTER_PROPS,
Utils.toJSON(Collections.singletonMap(URL_SCHEME, HTTPS)),
- CreateMode.PERSISTENT,
- true);
+ CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException e) {
ZkNodeProps props =
ZkNodeProps.load(
- zkStateReader
- .getZkClient()
- .getData(ZkStateReader.CLUSTER_PROPS, null, null, true));
+ zkStateReader.getZkClient().getData(ZkStateReader.CLUSTER_PROPS, null, null));
zkStateReader
.getZkClient()
- .setData(
- ZkStateReader.CLUSTER_PROPS, Utils.toJSON(props.plus(URL_SCHEME, HTTPS)), true);
+ .setData(ZkStateReader.CLUSTER_PROPS, Utils.toJSON(props.plus(URL_SCHEME, HTTPS)));
}
}
}
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index aca47b08e53..ee8ced5a367 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -300,7 +300,7 @@ public class MiniSolrCloudCluster {
.withUrl(zkServer.getZkHost())
.withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS)
.build()) {
- if (!zkClient.exists("/solr/initialized", true)) {
+ if (!zkClient.exists("/solr/initialized")) {
zkClient.makePath("/solr/initialized", "yes".getBytes(Charset.defaultCharset()), true);
if (jettyConfig.sslConfig != null && jettyConfig.sslConfig.isSSLMode()) {
zkClient.makePath(
@@ -644,9 +644,7 @@ public class MiniSolrCloudCluster {
// cleanup any property before removing the configset
getZkClient()
.delete(
- ZkConfigSetService.CONFIGS_ZKNODE + "/" + configSet + "/" + DEFAULT_FILENAME,
- -1,
- true);
+ ZkConfigSetService.CONFIGS_ZKNODE + "/" + configSet + "/" + DEFAULT_FILENAME, -1);
} catch (KeeperException.NoNodeException nne) {
}
new ConfigSetAdminRequest.Delete().setConfigSetName(configSet).process(solrClient);
@@ -735,10 +733,9 @@ public class MiniSolrCloudCluster {
* Set data in zk without exposing caller to the ZK API, i.e. tests won't need to include
* Zookeeper dependencies
*/
- public void zkSetData(String path, byte[] data, boolean retryOnConnLoss)
- throws InterruptedException {
+ public void zkSetData(String path, byte[] data) throws InterruptedException {
try {
- getZkClient().setData(path, data, -1, retryOnConnLoss);
+ getZkClient().setData(path, data, -1);
} catch (KeeperException e) {
throw new SolrException(ErrorCode.UNKNOWN, "Failed writing to Zookeeper", e);
}
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MockSolrZkClient.java b/solr/test-framework/src/java/org/apache/solr/cloud/MockSolrZkClient.java
index c1c73fb853a..e9bd640d101 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MockSolrZkClient.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MockSolrZkClient.java
@@ -29,15 +29,13 @@ public class MockSolrZkClient extends SolrZkClient {
}
@Override
- public Boolean exists(final String path, boolean retryOnConnLoss)
- throws KeeperException, InterruptedException {
+ public Boolean exists(final String path) throws KeeperException, InterruptedException {
return false;
}
@Override
- public byte[] getData(
- final String path, final Watcher watcher, final Stat stat, boolean retryOnConnLoss)
+ public byte[] getData(final String path, final Watcher watcher, final Stat stat)
throws KeeperException, InterruptedException {
return null;
}
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
index 1b501e52995..03b721330ec 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
@@ -451,7 +451,7 @@ public class ZkTestServer {
.withUrl(getZkHost())
.withTimeout(10000, TimeUnit.MILLISECONDS)
.build()) {
- client.makePath(path, null, CreateMode.PERSISTENT, null, false, true, 0);
+ client.makePath(path, null, CreateMode.PERSISTENT, null, false, 0);
} catch (InterruptedException | KeeperException e) {
log.error("Error checking path {}", path, e);
throw new IOException("Error checking path " + path, SolrZkClient.checkInterrupted(e));
@@ -655,7 +655,7 @@ public class ZkTestServer {
if (log.isInfoEnabled()) {
log.info("put {} to {}", file.toAbsolutePath(), destPath);
}
- zkClient.makePath(destPath, Files.readAllBytes(file), false, true);
+ zkClient.makePath(destPath, Files.readAllBytes(file), false);
}
// static to share with distrib test
@@ -702,7 +702,7 @@ public class ZkTestServer {
}
public void makeSolrZkNode() throws Exception {
- rootClient.makePath("/solr", false, true);
+ rootClient.makePath("/solr", false);
}
public void tryCleanSolrZkNode() throws Exception {
@@ -710,7 +710,7 @@ public class ZkTestServer {
}
void tryCleanPath(String path) throws Exception {
- if (rootClient.exists(path, true)) {
+ if (rootClient.exists(path)) {
rootClient.clean(path);
}
}
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java
index d2c5ed6df91..f4bc7e54bb8 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractCollectionsAPIDistributedZkTestBase.java
@@ -105,9 +105,7 @@ public abstract class AbstractCollectionsAPIDistributedZkTestBase extends SolrCl
CollectionAdminRequest.listCollections(cluster.getSolrClient()).contains(collectionName));
assertFalse(
- cluster
- .getZkClient()
- .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, true));
+ cluster.getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName));
}
@Test
@@ -123,9 +121,7 @@ public abstract class AbstractCollectionsAPIDistributedZkTestBase extends SolrCl
CollectionAdminRequest.listCollections(cluster.getSolrClient()).contains(collectionName));
assertFalse(
- cluster
- .getZkClient()
- .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, true));
+ cluster.getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName));
}
@Test