From 9441fcf5d8458e08e4fd82563f2ad1b4b2991660 Mon Sep 17 00:00:00 2001 From: Pierre Salagnac Date: Thu, 18 Dec 2025 16:05:01 +0100 Subject: [PATCH 1/2] SOLR-16116: Remove retryOnConnLoss parameter --- .../solr/api/ZkClusterPluginsSource.java | 2 +- .../java/org/apache/solr/cli/AuthTool.java | 8 +- .../java/org/apache/solr/cli/CreateTool.java | 4 +- .../org/apache/solr/cli/ZkMkrootTool.java | 2 +- .../java/org/apache/solr/cli/ZkRmTool.java | 2 +- .../java/org/apache/solr/cloud/CloudUtil.java | 4 +- .../cloud/DistributedApiAsyncTracker.java | 16 +-- .../cloud/DistributedClusterStateUpdater.java | 10 +- .../org/apache/solr/cloud/DistributedMap.java | 20 ++- .../apache/solr/cloud/ElectionContext.java | 2 +- .../org/apache/solr/cloud/LeaderElector.java | 23 ++-- .../java/org/apache/solr/cloud/Overseer.java | 8 +- .../solr/cloud/OverseerElectionContext.java | 2 +- .../solr/cloud/OverseerNodePrioritizer.java | 5 +- .../solr/cloud/OverseerTaskProcessor.java | 8 +- .../apache/solr/cloud/OverseerTaskQueue.java | 22 ++- .../solr/cloud/RefreshCollectionMessage.java | 2 +- .../cloud/ShardLeaderElectionContext.java | 2 +- .../solr/cloud/SizeLimitedDistributedMap.java | 4 +- .../apache/solr/cloud/ZkConfigSetService.java | 21 ++- .../org/apache/solr/cloud/ZkController.java | 59 ++++----- .../apache/solr/cloud/ZkDistributedLock.java | 9 +- .../solr/cloud/ZkDistributedLockFactory.java | 4 +- .../apache/solr/cloud/ZkDistributedQueue.java | 20 +-- .../org/apache/solr/cloud/ZkShardTerms.java | 8 +- .../solr/cloud/ZkSolrResourceLoader.java | 4 +- .../api/collections/CreateCollectionCmd.java | 6 +- .../api/collections/DeleteCollectionCmd.java | 4 +- .../api/collections/OverseerRoleCmd.java | 8 +- .../api/collections/OverseerStatusCmd.java | 4 +- .../cloud/api/collections/SplitShardCmd.java | 9 +- .../solr/cloud/overseer/ZkStateWriter.java | 6 +- .../java/org/apache/solr/core/NodeConfig.java | 2 +- .../org/apache/solr/core/RequestParams.java | 3 +- .../java/org/apache/solr/core/SolrCore.java | 2 +- .../solr/core/backup/BackupManager.java | 6 +- .../core/snapshots/SolrSnapshotManager.java | 18 +-- .../solr/filestore/ClusterFileStore.java | 8 +- .../solr/filestore/DistribFileStore.java | 11 +- .../solr/handler/admin/ClusterStatus.java | 7 +- .../handler/admin/SecurityConfHandlerZk.java | 3 +- .../handler/admin/ShowFileRequestHandler.java | 9 +- .../handler/admin/ZookeeperInfoHandler.java | 8 +- .../solr/handler/admin/ZookeeperRead.java | 10 +- .../handler/designer/SchemaDesignerAPI.java | 10 +- .../SchemaDesignerConfigSetHelper.java | 10 +- .../designer/SchemaDesignerSettingsDAO.java | 2 +- .../solr/packagemanager/PackageManager.java | 8 +- .../packagemanager/RepositoryManager.java | 13 +- .../java/org/apache/solr/pkg/PackageAPI.java | 11 +- .../solr/rest/ManagedResourceStorage.java | 24 ++-- .../solr/schema/ManagedIndexSchema.java | 4 +- .../schema/ManagedIndexSchemaFactory.java | 18 +-- .../org/apache/solr/schema/SchemaManager.java | 4 +- .../solr/schema/ZkIndexSchemaReader.java | 4 +- .../org/apache/solr/servlet/HttpSolrCall.java | 2 +- .../apache/solr/servlet/QueryRateLimiter.java | 2 +- .../apache/solr/cli/SolrCLIZkToolsTest.java | 46 +++---- .../apache/solr/cli/ZkSubcommandsTest.java | 33 +++-- .../solr/cloud/AliasIntegrationTest.java | 2 +- .../solr/cloud/BasicDistributedZk2Test.java | 2 +- .../solr/cloud/CollectionPropsTest.java | 5 +- .../solr/cloud/CollectionStateZnodeTest.java | 6 +- .../apache/solr/cloud/DeleteShardTest.java | 6 +- .../solr/cloud/DistributedQueueTest.java | 6 +- .../cloud/LeaderElectionContextKeyTest.java | 3 +- .../apache/solr/cloud/LeaderElectionTest.java | 3 +- .../solr/cloud/LeaderVoteWaitTimeoutTest.java | 2 +- ...OfBoxZkACLAndCredentialsProvidersTest.java | 20 ++- ...iddenZkACLAndCredentialsProvidersTest.java | 22 +-- ...rseerCollectionConfigSetProcessorTest.java | 10 +- .../org/apache/solr/cloud/OverseerTest.java | 8 +- .../apache/solr/cloud/TestConfigSetsAPI.java | 48 +++---- .../cloud/TestConfigSetsAPIZkFailure.java | 3 +- .../apache/solr/cloud/TestDistributedMap.java | 21 +-- .../apache/solr/cloud/TestPullReplica.java | 4 +- .../cloud/TestQueryingOnDownCollection.java | 5 +- .../solr/cloud/TestRebalanceLeaders.java | 3 +- .../solr/cloud/TestStressLiveNodes.java | 4 +- .../apache/solr/cloud/TestTlogReplica.java | 4 +- ...aramsZkACLAndCredentialsProvidersTest.java | 43 +++--- .../apache/solr/cloud/ZkControllerTest.java | 35 +++-- .../apache/solr/cloud/ZkSolrClientTest.java | 34 +++-- .../cloud/api/collections/ShardSplitTest.java | 6 +- .../SimpleCollectionCreateDeleteTest.java | 35 ++--- .../api/collections/TestCollectionAPI.java | 4 +- .../TestLocalFSCloudBackupRestore.java | 4 +- .../cloud/overseer/ZkStateReaderTest.java | 37 +++--- .../cloud/overseer/ZkStateWriterTest.java | 12 +- .../apache/solr/handler/TestConfigReload.java | 8 +- .../handler/admin/ZookeeperReadAPITest.java | 6 +- .../designer/TestSchemaDesignerAPI.java | 4 +- .../TestSchemaDesignerConfigSetHelper.java | 6 +- .../org/apache/solr/pkg/TestPackages.java | 9 +- .../solr/schema/TestCloudManagedSchema.java | 6 +- .../schema/TestManagedSchemaThreadSafety.java | 6 +- .../security/BasicAuthIntegrationTest.java | 2 +- .../security/BasicAuthOnSingleNodeTest.java | 2 +- .../security/TestAuthorizationFramework.java | 3 +- .../TimeRoutedAliasUpdateProcessorTest.java | 10 +- .../apache/solr/crossdc/common/ConfUtil.java | 7 +- .../MirroringCollectionsHandlerTest.java | 2 +- .../MirroringConfigSetsHandlerTest.java | 2 +- .../jwt/JWTAuthPluginIntegrationTest.java | 2 +- .../impl/ZkClientClusterStateProvider.java | 2 +- .../solrj/impl/ZkDistribStateManager.java | 14 +- .../solr/common/cloud/ClusterProperties.java | 14 +- .../common/cloud/CollectionProperties.java | 13 +- .../CollectionPropertiesZkStateReader.java | 4 +- .../common/cloud/PerReplicaStatesOps.java | 6 +- .../common/cloud/SecurityNodeWatcher.java | 13 +- .../solr/common/cloud/SolrZkClient.java | 125 +++++++----------- .../solr/common/cloud/ZkMaintenanceUtils.java | 51 ++++--- .../solr/common/cloud/ZkStateReader.java | 31 +++-- .../solr/common/cloud/SolrZkClientTest.java | 28 ++-- .../common/cloud/TestPerReplicaStates.java | 6 +- .../common/cloud/TestZkMaintenanceUtils.java | 19 ++- .../solrj/impl/HttpClusterStateSSLTest.java | 4 +- .../impl/TestCloudSolrClientConnections.java | 2 +- .../PerReplicaStatesIntegrationTest.java | 17 ++- .../cloud/SolrZkClientCompressedDataTest.java | 4 +- .../java/org/apache/solr/SolrTestCaseJ4.java | 2 +- .../cloud/AbstractFullDistribZkTestBase.java | 10 +- .../solr/cloud/MiniSolrCloudCluster.java | 11 +- .../apache/solr/cloud/MockSolrZkClient.java | 6 +- .../org/apache/solr/cloud/ZkTestServer.java | 8 +- ...ctCollectionsAPIDistributedZkTestBase.java | 8 +- 127 files changed, 628 insertions(+), 828 deletions(-) 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 Map plugins() throws IOException { try { Map clusterPropsJson = (Map) - 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) 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 @@ private void handleBasicAuth(CommandLine cli) throws Exception { 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 @@ private void handleBasicAuth(CommandLine cli) throws Exception { 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 @@ private void clearSecurityJson(CommandLine cli, boolean updateIncludeFileOnly) t 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 b6790b4a4fa..61de0817a9b 100644 --- a/solr/core/src/java/org/apache/solr/cli/CreateTool.java +++ b/solr/core/src/java/org/apache/solr/cli/CreateTool.java @@ -254,9 +254,7 @@ protected void createCollection(CloudSolrClient cloudSolrClient, CommandLine cli 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 void runImpl(CommandLine cli) throws Exception { 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 void runImpl(CommandLine cli) throws Exception { } 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 static String unifiedResourcePath(SolrResourceLoader loader) { public static Map getTrustedKeys(SolrZkClient zk, String dir) { Map result = new HashMap<>(); try { - List children = zk.getChildren("/keys/" + dir, null, true); + List 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 @@ enum State { 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 @@ void createNewInFlightTask(String asyncId) throws KeeperException, InterruptedEx 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 @@ private void doStateDotJsonCasUpdate(ClusterState updatedState) 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 @@ private void doStateDotJsonCasUpdate(ClusterState updatedState) jsonPath, collection.getZNodeVersion()); } - zkStateReader - .getZkClient() - .setData(jsonPath, stateJson, collection.getZNodeVersion(), true); + zkStateReader.getZkClient().setData(jsonPath, stateJson, collection.getZNodeVersion()); } } } @@ -577,7 +575,7 @@ private void doStateDotJsonCasUpdate(ClusterState updatedState) 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 static void executeNodeDownStateUpdate(String nodeName, ZkStateReader zkS try { final List 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 @@ private void assertKeyFormat(String trackingId) { 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 boolean putIfAbsent(String trackingId, byte[] data) 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 boolean putIfAbsent(String trackingId, byte[] data) } 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 int size() throws KeeperException, InterruptedException { 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 boolean remove(String trackingId) throws KeeperException, InterruptedExce /** Helper method to clear all child nodes for a parent node. */ public void clear() throws KeeperException, InterruptedException { - List childNames = zookeeper.getChildren(dir, null, true); + List 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 keys() throws KeeperException, InterruptedException { - List childs = zookeeper.getChildren(dir, null, true); + List childs = zookeeper.getChildren(dir, null); final List 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 void cancelElection() throws InterruptedException, KeeperException { 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 @@ private void checkIfIamLeader(final ElectionContext context, boolean replacement context.checkIfIamLeaderFired(); // get all other numbers... final String holdElectionPath = context.electionPath + ELECTION_NODE; - List seqs = zkClient.getChildren(holdElectionPath, null, true); + List seqs = zkClient.getChildren(holdElectionPath, null); sortSeqs(seqs); String leaderSeqNodeName = @@ -114,7 +114,7 @@ private void checkIfIamLeader(final ElectionContext context, boolean replacement 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 @@ private void checkIfIamLeader(final ElectionContext context, boolean replacement 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 int joinElection(ElectionContext context, boolean replacement, boolean jo 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 int joinElection(ElectionContext context, boolean replacement, boolean jo 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 int joinElection(ElectionContext context, boolean replacement, boolean jo cont = false; } catch (ConnectionLossException e) { // we don't know if we made our node or not... - List entries = zkClient.getChildren(shardsElectZkPath, null, true); + List entries = zkClient.getChildren(shardsElectZkPath, null); boolean foundId = false; for (String entry : entries) { @@ -336,7 +329,7 @@ public void process(WatchedEvent event) { 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 @@ private void checkIfIamStillLeader() { 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 @@ private void checkIfIamStillLeader() { 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 @@ private LeaderStatus amILeader() { 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 @@ OverseerTaskQueue getConfigSetQueue(final SolrZkClient zkClient, Stats zkStats) 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 @@ void runLeaderProcess(boolean weAreReplacement, int pauseBeforeStartMs) 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 OverseerNodePrioritizer( public synchronized void prioritizeOverseerNodes(String overseerId) throws Exception { SolrZkClient zk = zkStateReader.getZkClient(); List 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 l = (List) 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 static List getSortedOverseerNodeNames(SolrZkClient zk) public static List getSortedElectionNodes(SolrZkClient zk, String path) throws KeeperException, InterruptedException { - List children = zk.getChildren(path, null, true); + List children = zk.getChildren(path, null); LeaderElector.sortSeqs(children); return children; } @@ -461,7 +461,7 @@ public static String getLeaderId(SolrZkClient zkClient) 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 @@ protected LeaderStatus amILeader() { 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 void allowOverseerPendingTasksToComplete() { public boolean containsTaskWithRequestId(String requestIdKey, String requestId) throws KeeperException, InterruptedException { - List childNames = zookeeper.getChildren(dir, null, true); + List 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 void remove(QueueEvent event, boolean setResult) 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 void remove(QueueEvent event, boolean setResult) // Remove the request node try { - zookeeper.delete(path, -1, true); + zookeeper.delete(path, -1); } catch (KeeperException.NoNodeException ignored) { } } finally { @@ -214,10 +214,10 @@ private String createData(String path, byte[] data, CreateMode mode) 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 QueueEvent offer(byte[] data, long timeout) throws KeeperException, Inter 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 QueueEvent offer(byte[] data, long timeout) throws KeeperException, Inter 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 String getTailId() throws KeeperException, InterruptedException { 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 ClusterState run(ClusterState clusterState, Overseer overseer, ZkStateWri 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 @@ private boolean waitForReplicasToComeUp(int timeoutms) throws InterruptedExcepti 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 boolean putIfAbsent(String trackingId, byte[] data) private void shrinkIfNeeded() throws KeeperException, InterruptedException { if (this.size() >= maxSize) { // Bring down the size - List children = zookeeper.getChildren(dir, null, true); + List children = zookeeper.getChildren(dir, null); int cleanupSize = maxSize / 10; @@ -79,7 +79,7 @@ protected boolean lessThan(Long a, Long b) { Map 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 @@ protected Long getCurrentSchemaModificationVersion( 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 String configSetName(CoreDescriptor cd) { @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 void uploadFileToConfig( 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 void setConfigMetadata(String configName, Map data) throw 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 Map getConfigMetadata(String configName) throws IOExcepti @SuppressWarnings("unchecked") Map data = (Map) - 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 void downloadConfig(String configName, Path dir) throws IOException { @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 byte[] downloadFileFromConfig(String configName, String filePath) throws @Override public List 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 List getAllConfigFiles(String configName) throws IOException { private void copyConfigDirFromZk(String fromZkPath, String toZkPath) throws IOException { try { - List files = zkClient.getChildren(fromZkPath, null, true); + List files = zkClient.getChildren(fromZkPath, null); for (String file : files) { - List children = zkClient.getChildren(fromZkPath + "/" + file, null, true); + List children = zkClient.getChildren(fromZkPath + "/" + file, null); if (children.size() == 0) { copyData(fromZkPath + "/" + file, toZkPath + "/" + file); } else { @@ -335,7 +334,7 @@ private void copyData(String fromZkFilePath, String toZkFilePath) 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 @@ private void onReconnect() { */ 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 @@ private void registerAllCoresAsDown(boolean updateLastPublished) throws SessionE + "/leader_elect/" + slice + "/election", - null, - true) + null) .size(); if (children == 0) { log.debug( @@ -1031,7 +1029,7 @@ public static void createClusterZkNodes(SolrZkClient zkClient) private static void repairSecurityJson(SolrZkClient zkClient) throws KeeperException, InterruptedException { - List securityConfAcl = zkClient.getACL(ZkStateReader.SOLR_SECURITY_CONF_PATH, null, true); + List securityConfAcl = zkClient.getACL(ZkStateReader.SOLR_SECURITY_CONF_PATH, null); ACLProvider aclProvider = zkClient.getZkACLProvider(); boolean tryUpdate = false; @@ -1089,7 +1087,7 @@ private void init() { 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 @@ private void checkForExistingEphemeralNode() throws KeeperException, Interrupted String nodeName = getNodeName(); String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName; - if (!zkClient.exists(nodePath, true)) { + if (!zkClient.exists(nodePath)) { return; } @@ -1126,8 +1124,7 @@ private void checkForExistingEphemeralNode() throws KeeperException, Interrupted 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 static boolean checkChrootPath(String zkHost, boolean create) .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 void removeEphemeralLiveNode() throws KeeperException, InterruptedExcepti 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 void removeEphemeralLiveNode() throws KeeperException, InterruptedExcepti .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 String getNodeName() { /** 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 ZkCoreNodeProps getLeaderProps( 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 static void linkConfSet(SolrZkClient zkClient, String collection, String 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 static void linkConfSet(SolrZkClient zkClient, String collection, String } // 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 static void linkConfSet(SolrZkClient zkClient, String collection, String } // 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 void rejoinOverseerElection(String electionNode, boolean joinAtHead) { 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 void rejoinShardLeaderElection(SolrParams params) { 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 static int persistConfigResourceToZooKeeper( 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 static int persistConfigResourceToZooKeeper( } 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 static int persistConfigResourceToZooKeeper( } 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 void process(WatchedEvent event) { 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 @@ private boolean fireEventListeners(String zkDir) { 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 @@ protected ZkDistributedLock(SolrZkClient zkClient, String lockDir, String lockNo + DistributedCollectionConfigSetCommandRunner.ZK_PATH_SEPARATOR + lockNodePrefix, null, - CreateMode.EPHEMERAL_SEQUENTIAL, - false); + CreateMode.EPHEMERAL_SEQUENTIAL); sequence = getSequenceFromNodename(lockNode); } @@ -143,7 +142,7 @@ public void waitUntilAcquired() { 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 @@ public void waitUntilAcquired() { @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 @@ public boolean isAcquired() { * {@code null} if the lock is ours. */ String nodeToWatch() throws KeeperException, InterruptedException { - List locks = zkClient.getChildren(lockDir, null, true); + List 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 @@ protected StringBuilder getPathPrefix() { 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 void remove(Collection paths) throws KeeperException, Interrupted 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 void offer(byte[] data) throws KeeperException, InterruptedException { 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 void offer(byte[] data) throws KeeperException, InterruptedException { // 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 @@ TreeSet fetchZkChildren(Watcher watcher) throws InterruptedException, Ke try { TreeSet orderedChildren = new TreeSet<>(); - List childNames = zookeeper.getChildren(dir, watcher, true); + List childNames = zookeeper.getChildren(dir, watcher); stats.setQueueLength(childNames.size()); for (String childName : childNames) { // Check format @@ -426,7 +426,7 @@ TreeSet fetchZkChildren(Watcher watcher) throws InterruptedException, Ke } 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 Collection> peekElements( 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 @@ private byte[] firstElement() throws KeeperException, InterruptedException { 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 @@ private byte[] removeFirst() throws KeeperException, InterruptedException { } 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 @@ private boolean saveTerms(ShardTerms newTerms, String action) 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 @@ private void ensureTermNodeExist() { try { Map 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 void refreshTerms() { 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) Utils.fromJSON(data), stat.getVersion()); } catch (KeeperException | InterruptedException e) { Throwable cause = SolrZkClient.checkInterrupted(e); @@ -431,7 +431,7 @@ private void registerWatcher() throws KeeperException { }; 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 ZkSolrResourceLoader( public Pair 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 InputStream openResource(String resource) throws IOException { 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 void call(ClusterState clusterState, ZkNodeProps message, NamedList resu 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 void call(ClusterState state, ZkNodeProps message, NamedList resu 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 void call(ClusterState state, ZkNodeProps message, NamedList resu } String roleName = message.getStr("role"); - boolean nodeExists = zkClient.exists(ZkStateReader.ROLES, true); + boolean nodeExists = zkClient.exists(ZkStateReader.ROLES); if (nodeExists) { @SuppressWarnings("unchecked") Map> tmp = (Map>) - 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 void call(ClusterState state, ZkNodeProps message, NamedList resu } 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 void call(ClusterState state, ZkNodeProps message, NamedList resu 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 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 8548a0bc17a..cfb4babf9af 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 @@ -211,10 +211,7 @@ public boolean split(ClusterState clusterState, ZkNodeProps message, NamedList -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 void uploadCollectionProperties(String collectionName) throws IOException 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 void downloadCollectionProperties(String collectionName) throws IOExcepti + 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 static boolean snapshotExists( 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 static void createCollectionLevelSnapshot( 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 static void updateCollectionLevelSnapshot( 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 static void deleteCollectionLevelSnapshot( 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 static void cleanupCollectionLevelSnapshots(SolrZkClient zkClient, String String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.empty()); try { // Delete the meta-data for each snapshot. - Collection snapshots = zkClient.getChildren(zkPath, null, true); + Collection 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 static void cleanupCollectionLevelSnapshots(SolrZkClient zkClient, String } // 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 static Optional getCollectionLevelSnapshot( try { @SuppressWarnings({"unchecked"}) Map data = - (Map) Utils.fromJSON(zkClient.getData(zkPath, null, null, true)); + (Map) 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 static Collection listSnapshots( String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.empty()); try { - Collection snapshots = zkClient.getChildren(zkPath, null, true); + Collection snapshots = zkClient.getChildren(zkPath, null); for (String snapshot : snapshots) { Optional 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 UploadToFileStoreResponse uploadFile( 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 UploadToFileStoreResponse uploadFile( 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 @@ private void doClusterDelete(String filePath) { 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 @@ private void distribute(FileInfo info) { CreateMode.PERSISTENT, null, false, - true, 0); } catch (Exception e) { @@ -539,7 +538,7 @@ public void delete(String path) { 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 void refresh(String path) { @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 @@ private static Map _getKeys(Path solrHome) throws IOException { 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 void getClusterStatus(NamedList results, SolrVersion solrVersion) List 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 void getClusterStatus(NamedList results, SolrVersion solrVersion) // 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 @@ protected boolean persistConf(SecurityConfig securityConfig) throws IOException .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 @@ private void showFromZooKeeper( } // Show a directory listing - List children = zkClient.getChildren(adminFile, null, true); + List children = zkClient.getChildren(adminFile, null); if (children.size() > 0) { NamedList> files = new SimpleOrderedMap<>(); @@ -169,7 +169,7 @@ private void showFromZooKeeper( SimpleOrderedMap fileInfo = new SimpleOrderedMap<>(); files.add(f, fileInfo); - List fchildren = zkClient.getChildren(adminFile + "/" + f, null, true); + List fchildren = zkClient.getChildren(adminFile + "/" + f, null); if (fchildren.size() > 0) { fileInfo.add("directory", true); } else { @@ -187,8 +187,7 @@ private void showFromZooKeeper( 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 static String getAdminFileFromZooKeeper( } // 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 @@ private synchronized List getCollections(SolrZkClient zkClient) // cache is stale, rebuild the full list ... cachedCollections = new ArrayList(); - List fromZk = zkClient.getChildren("/collections", this, true); + List fromZk = zkClient.getChildren("/collections", this); if (fromZk != null) cachedCollections.addAll(fromZk); // sort the final merged set of collections @@ -623,7 +623,7 @@ boolean printTree(JSONWriter json, String path) throws IOException { 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 @@ boolean printTree(JSONWriter json, String path) throws IOException { json.startArray(); try { - List children = zkClient.getChildren(path, null, true); + List children = zkClient.getChildren(path, null); java.util.Collections.sort(children); boolean first = true; @@ -711,7 +711,7 @@ boolean printZnode(JSONWriter json, String path) throws IOException { 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 ZooKeeperListChildrenResponse listNodes(String zkPath, Boolean includeChi 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 l = - coreContainer.getZkController().getZkClient().getChildren(zkPath, null, false); + List l = coreContainer.getZkController().getZkClient().getChildren(zkPath, null); String prefix = zkPath.endsWith("/") ? zkPath : zkPath + "/"; Map 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 void write(OutputStream output) throws IOException, WebApplicationExcepti 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 void getFileContents(SolrQueryRequest req, SolrQueryResponse rsp) throws 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 void updateFileContents(SolrQueryRequest req, SolrQueryResponse rsp) // 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 void downloadConfig(SolrQueryRequest req, SolrQueryResponse rsp) throws I 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 @@ private void validateNewConfigSetName(String configSet) { 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 @@ int getCurrentSchemaVersion(final String configSet) throws IOException { 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 @@ protected ManagedIndexSchema removeLanguageSpecificObjectsAndFiles( 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 @@ protected ManagedIndexSchema restoreLanguageSpecificObjectsAndFiles( 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 @@ private ConfigOverlay getConfigOverlay(String config) throws IOException { 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 List fetchInstalledPackageInstances() throws SolrExc List 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>> packagesZnodeMap = (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 Map getPackagesDeployedAsClusterLevelPlugins private void ensureCollectionsExist(List collections) { try { - List existingCollections = zkClient.getChildren("/collections", null, true); + List existingCollections = zkClient.getChildren("/collections", null); Set nonExistent = new HashSet<>(collections); nonExistent.removeAll(existingCollections); if (!nonExistent.isEmpty()) { @@ -1099,7 +1099,7 @@ public void undeploy( public Map getDeployedCollections(String packageName) { List 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 b56d6441709..05a908393d7 100644 --- a/solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java +++ b/solr/core/src/java/org/apache/solr/packagemanager/RepositoryManager.java @@ -122,17 +122,15 @@ public void addRepository(String repoName, String uri) throws Exception { @SuppressWarnings({"unchecked"}) List 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()) { @@ -162,10 +160,9 @@ public void addKey(byte[] key, String destinationKeyFilename) throws Exception { 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 void process(WatchedEvent event) { 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 @@ private Packages readPkgsFromZk(byte[] data, Stat stat) 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 static class ZooKeeperStorageIO implements StorageIO { protected SolrZkClient zkClient; protected String znodeBase; - protected boolean retryOnConnLoss = true; public ZooKeeperStorageIO(SolrZkClient zkClient, String znodeBase) { this.zkClient = zkClient; @@ -246,8 +245,8 @@ public void configure(SolrResourceLoader loader, NamedList initArgs) 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 void configure(SolrResourceLoader loader, NamedList initArgs) 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 InputStream openInputStream(String storedResourceId) throws IOException { 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 InputStream openInputStream(String storedResourceId) throws IOException { @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 boolean delete(String storedResourceId) throws IOException { // 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 @@ boolean persistManagedSchemaToZooKeeper(boolean createOnly) { 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 @@ boolean persistManagedSchemaToZooKeeper(boolean createOnly) { } 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 String lookupZKManagedSchemaPath() { + 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 ManagedIndexSchema create( 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 ManagedIndexSchema create( } 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 @@ private void zkUgradeToManagedSchema() { 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 @@ private void zkUgradeToManagedSchema() { 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 @@ private void zkUgradeToManagedSchema() { 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 @@ private ManagedIndexSchema getFreshManagedSchema(SolrCore core) 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 SchemaWatcher createSchemaWatcher() { 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 @@ void updateSchema(Watcher watcher, int expectedZkVersion) 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 @@ protected void extractRemotePath(String collectionName) .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 @@ private static RateLimiterConfig constructQueryRateLimiterConfig(SolrZkClient zk Map clusterPropsJson = (Map) - 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 void testUpconfig() throws Exception { 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 void testCp() throws Exception { 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 void testCp() throws Exception { 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 void testCp() throws Exception { 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 void testCp() throws Exception { 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 void testCp() throws Exception { 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 void testMv() throws Exception { // 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 void testMv() throws Exception { 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 void testMv() throws Exception { 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 void testMv() throws Exception { 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 void testRm() throws Exception { 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 @@ private void verifyZkLocalPathsMatch(Path fileRoot, String zkRoot) } 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 @@ void verifyAllFilesAreZNodes(Path fileRoot, String zkRoot) throws IOException { 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 @@ private void verifyZnodesMatch(String first, String second) // 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 void setUp() throws Exception { .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 void testPut() throws Exception { 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 void testPut() throws Exception { 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 void testPutFile() throws Exception { 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 void testPutFileWithoutSlash() throws Exception { 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 void testUpConfigLinkConfigClearZk() throws Exception { 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 zkFiles = - zkClient.getChildren(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, null, true); + zkClient.getChildren(ZkConfigSetService.CONFIGS_ZKNODE + "/" + confsetname, null); try (Stream filesStream = Files.list(confDir)) { assertEquals( @@ -372,7 +370,7 @@ public void testUpConfigLinkConfigClearZk() throws Exception { 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 void testUpConfigLinkConfigClearZk() throws Exception { try (Stream filesStream = Files.list(destDir.resolve("conf"))) { List 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 void testUpConfigLinkConfigClearZk() throws Exception { 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 void testGetCompressed() throws Exception { 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 void testGetFile() throws Exception { 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 void testGetFileCompressed() throws Exception { 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 void testUpdateAcls() throws Exception { .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 void testProperties() throws Exception { 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>) 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 @@ private void bringDownShardIndexSomeDocsAndRecover() throws Exception { 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 @@ private void waitForValue(String propertyName, String expectedValue) throws Inte 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 void testWatcher() throws KeeperException, InterruptedException, IOExcept 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 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 void testZkNodeLocation() throws Exception { (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 void testZkNodeLocation() throws Exception { 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 @@ private void assertShardMetadata(String collection, String sliceId, boolean shou 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 void run() { } 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 @@ private List getElectionNodes(String collection, String shard, SolrZkCli 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 @@ private String getLeaderUrl(final String collection, final String slice) 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 void testMostInSyncReplicasCanWinElection() throws Exception { List 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 void setUp() throws Exception { .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 void setUp() throws Exception { .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 void testOpenACLUnsafeAllover() throws Exception { protected void assertOpenACLUnsafeAllover( SolrZkClient zkClient, String path, List verifiedList) throws Exception { - List acls = zkClient.getACL(path, new Stat(), true); + List acls = zkClient.getACL(path, new Stat()); if (log.isInfoEnabled()) { log.info("Verifying {}", path); } @@ -169,7 +165,7 @@ protected void assertOpenACLUnsafeAllover( "Path " + path + " does not have OPEN_ACL_UNSAFE", ZooDefs.Ids.OPEN_ACL_UNSAFE, acls); } verifiedList.add(path); - List children = zkClient.getChildren(path, null, false); + List 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 void setUp() throws Exception { "readonlyACLUsername", "readonlyACLPassword") .getSolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT)) { - zkClient.makePath("/solr", false, true); + zkClient.makePath("/solr", false); } try (SolrZkClient zkClient = @@ -100,17 +100,13 @@ public void setUp() throws Exception { "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 void setUp() throws Exception { ("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 @@ protected Set commonMocks(int liveNodesCount, boolean distributedCluster 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 @@ protected Set commonMocks(int liveNodesCount, boolean distributedCluster 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 @@ protected Set commonMocks(int liveNodesCount, boolean distributedCluster 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 Void answer(InvocationOnMock invocation) { .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 MockZKController(String zkAddress, String nodeName, List overse // 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 void testExternalClusterStateChangeBehavior() throws Exception { 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 @@ private NamedList getConfigSetPropertiesFromZk(SolrZkClient zkClient, St 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 void testUploadErrors() throws Exception { 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 void testUploadErrors() throws Exception { 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 void testUploadLegacyManagedSchemaFile() throws Exception { 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 void testOverwriteWithCleanup(boolean v2) throws Exception { 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 void testOverwriteWithForbiddenFiles(boolean v2) throws Exception { 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 void testSingleWithCleanup(boolean v2) throws Exception { 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 void testSingleFileForbiddenType(boolean v2) throws Exception { + configsetName + configsetSuffix + "/test/different/path/solrconfig." - + fileType, - true)); + + fileType)); unIgnoreException("is forbidden for use in configSets"); } } @@ -1015,8 +1010,7 @@ public void testSingleFileNewConfig(boolean v2) throws Exception { List 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 void testSingleFileNewConfig(boolean v2) throws Exception { 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 @@ private int getConfigZNodeVersion( zkClient.getData( String.format(Locale.ROOT, "/configs/%s%s/%s", configsetName, configsetSuffix, configFile), null, - stat, - true); + stat); return stat.getVersion(); } @@ -1144,22 +1136,20 @@ private void assertConfigsetFiles(String configSetName, String suffix, SolrZkCli 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 @@ private void setupBaseConfigSet(String baseConfigSetName, Map ol .getZkClient() .setData( "/configs/" + baseConfigSetName, - "{\"trusted\": false}".getBytes(StandardCharsets.UTF_8), - true); + "{\"trusted\": false}".getBytes(StandardCharsets.UTF_8)); } private StringBuilder getConfigSetProps(Map 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 void testPut() throws KeeperException, InterruptedException { .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 void testGet() throws KeeperException, InterruptedException { 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 void testContains() throws KeeperException, InterruptedException { new byte[0], CreateMode.PERSISTENT, null, - false, - true); + false); assertTrue(map.contains("foo")); } } @@ -124,11 +118,10 @@ public void testRemove() throws KeeperException, InterruptedException { 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 @@ protected DistributedMap createMap(SolrZkClient zkClient, String path) { 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 void testCreateDelete() throws Exception { 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 @@ private void downAllReplicas() throws Exception { byte[] collectionState = cluster .getZkClient() - .getData("/collections/" + COLLECTION_NAME + "/state.json", null, null, true); + .getData("/collections/" + COLLECTION_NAME + "/state.json", null, null); Map> infectedState = (Map>) Utils.fromJSON(collectionState); @@ -141,8 +141,7 @@ private void downAllReplicas() throws Exception { 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 @@ private void checkOneQueue(DocCollection coll, Slice slice, Set liveRep + "/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 @@ private static List getTrueLiveNodesFromZk() throws Exception { SolrZkClient client = newSolrZkClient(); try { ArrayList 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 Integer call() { 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 void testCreateDelete() throws Exception { 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 void setUp() throws Exception { .withConnTimeOut(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS) .build(); - zkClient.makePath("/solr", false, true); + zkClient.makePath("/solr", false); zkClient.close(); zkClient = @@ -111,15 +111,14 @@ public void setUp() throws Exception { .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 void setUp() throws Exception { .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 void testRepairACL() throws Exception { .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 void testRepairACL() throws Exception { .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 void testRepairACL() throws Exception { .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 @@ protected static void doTest( 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 void testLiveNodeDataStored() throws Exception { 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 liveProps = (Map) Utils.fromJSON(actualData); String expectedSolrVersion = SolrVersion.LATEST.toString(); @@ -273,8 +273,7 @@ public List getCoreDescriptors() { .makePath( DocCollection.getCollectionPathRoot(collectionName), new byte[0], - CreateMode.PERSISTENT, - true); + CreateMode.PERSISTENT); ZkNodeProps m = new ZkNodeProps( @@ -439,30 +438,29 @@ public void testTouchConfDir() throws Exception { // 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 void testVersionCompatibilityFailsStartup() throws Exception { 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 void testMinorVersionCompatibilityFailsStartup() throws Exception { 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 void testCheckNoOldClusterstate() throws Exception { 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 void testCheckNoOldClusterstate() throws Exception { }); } 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 void testMakeRootNode() throws Exception { .withUrl(conn.getServer().getZkHost()) .withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS) .build()) { - assertTrue(zkClient.exists("/solr", true)); + assertTrue(zkClient.exists("/solr")); } } } @@ -108,8 +108,8 @@ public void testClean() throws Exception { 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 void testReconnect() throws Exception { .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 void run() { 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 void run() { } 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 void process(WatchedEvent event) { } watchesDone.countDown(); } - }, - true); + }); } for (int i = 1; i <= numColls; i++) { @@ -295,14 +293,13 @@ public void process(WatchedEvent event) { 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 void testSkipPathPartsOnMakePath() throws Exception { // 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 void testSkipPathPartsOnMakePath() throws Exception { CreateMode.PERSISTENT, (Watcher) null, true, - true, 1)); zkClient.clean("/"); @@ -387,7 +383,7 @@ public void testSkipPathPartsOnMakePath() throws Exception { 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 void testZkBehavior() throws Exception { 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 void testSplitLocking() throws Exception { 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 void testSplitLocking() throws Exception { // 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 void testCreateAndDeleteThenCreateAgain() throws Exception { NamedList 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 void testPropertiesOfReplica() throws Exception { NamedList 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 void testDeleteAlsoDeletesAutocreatedConfigSet() throws Exception { 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 void testDeleteDoesNotDeleteSharedAutocreatedConfigSet() throws Exception 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 void testDeleteDoesNotDeleteSharedAutocreatedConfigSet() throws Exception // 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 void testDeleteDoesNotDeleteSharedAutocreatedConfigSet() throws Exception 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 void testDeleteDoesNotDeleteSharedAutocreatedConfigSet() throws Exception // 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 void testDeleteDoesNotDeleteSharedAutocreatedConfigSet() throws Exception // 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 @@ private void testNoConfigset() throws Exception { private void deleteThemAll(SolrZkClient zkClient, String node) throws KeeperException, InterruptedException { - List kids = zkClient.getChildren(node, null, true); + List 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 static void setupClass() throws Exception { 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 void testCollectionStateWatcherCaching() throws Exception { 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 void testWatchedCollectionCreation() throws Exception { 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 void testWatchedCollectionCreation() throws Exception { 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 void testForciblyRefreshAllClusterState() throws Exception { 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 void testForciblyRefreshAllClusterStateCompressed() throws Exception { 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 void testFetchLowestSolrVersion_validNodes() throws Exception { String livePath = ZkStateReader.LIVE_NODES_ZKNODE; // Clear any existing live node children. - List nodes = zkClient.getChildren(livePath, null, true); + List 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 void testFetchLowestSolrVersion_validNodes() throws Exception { 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 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 void testFetchLowestSolrVersion_noData() throws Exception { String livePath = ZkStateReader.LIVE_NODES_ZKNODE; // Clear any existing live node children. - List nodes = zkClient.getChildren(livePath, null, true); + List 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 void testFetchLowestSolrVersion_blankAndHighVersion() throws Exception { String livePath = ZkStateReader.LIVE_NODES_ZKNODE; // Clear any existing live node children. - List nodes = zkClient.getChildren(livePath, null, true); + List 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.of(LIVE_NODE_SOLR_VERSION, "888.0.0")), - CreateMode.EPHEMERAL, - true); + CreateMode.EPHEMERAL); var lowestVersion1 = reader.fetchLowestSolrVersion(); assertTrue( @@ -974,7 +973,7 @@ public void testFetchLowestSolrVersion_blankAndHighVersion() throws Exception { 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 void testFetchLowestSolrVersion_noLiveNodes() throws Exception { String livePath = ZkStateReader.LIVE_NODES_ZKNODE; // Clear any existing live node children. - List nodes = zkClient.getChildren(livePath, null, true); + List 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 void testSingleExternalCollection() throws Exception { (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 void testExternalModification() throws Exception { 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 void testSingleExternalCollectionCompressedState() throws Exception { 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 @@ private void checkConfReload(SolrZkClient client, String resPath, String name, S 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 void testZkread() throws Exception { 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 void testZkread() throws Exception { } } } 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 void testTSV() throws Exception { 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 void testBasicUserWorkflow() throws Exception { 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 void testEnableDisableOptions() throws Exception { 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 void testEnableDisableOptions() throws Exception { 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 void testAPI() throws Exception { 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 void testAPI() throws Exception { 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 void testAPI() throws Exception { 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 void test() throws Exception { 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 kids = zkClient.getChildren(parent, null, true); + List 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 @@ boolean isSlowpoke() { } @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 @@ private ZkController createZkController(SolrZkClient client) 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 void testBasicAuth() throws Exception { 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 void testDeleteSecurityJsonZnode() throws Exception { // 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 void distribSetUp() throws Exception { 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 void test() throws Exception { + "/" + COLLECTION_PROPS_ZKNODE, null, - null, - true); + null); assertNotNull(data); assertTrue(data.length > 0); @SuppressWarnings("unchecked") @@ -1048,8 +1047,7 @@ public void process(WatchedEvent watchedEvent) { aliasUpdate.countDown(); } }, - stat, - true); + stat); } /** @@ -1272,7 +1270,7 @@ private void manuallyConstructLegacyTRA() throws Exception { } // 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 aliasMap; @@ -1293,7 +1291,7 @@ private void manuallyConstructLegacyTRA() throws Exception { 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 static void fillProperties(SolrZkClient solrClient, Map p 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 void setUp() throws Exception { 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 void setUp() throws Exception { 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 1650fbb4788..9aa4c099306 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 @@ -379,7 +379,7 @@ private MiniSolrCloudCluster configureClusterMockOauth( .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 static ClusterState createFromJsonSupportingLegacyConfigName( 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 Map getJson(String path) @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 boolean hasData(String path) throws IOException, KeeperException, Interru public List 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 VersionedData getData(String path, Watcher watcher) 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 void makePath(String path) 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 String createData(String path, byte[] data, CreateMode mode) 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 void removeData(String path, int version) 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 void setData(String path, byte[] data, int version) 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 Map getClusterProperties() throws IOException { try { Map properties = (Map) - 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 void setClusterProperty(String propertyName, Object propertyValue) throws 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 void setClusterProperty(String propertyName, Object propertyValue) throws 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 Map getCollectionProperties(String collection) throws IOE try { return (Map) 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 void setCollectionProperty(String collection, String propertyName, String while (true) { Stat s = new Stat(); try { - if (client.exists(znodePath, true)) { + if (client.exists(znodePath)) { Map properties = - (Map) Utils.fromJSON(client.getData(znodePath, null, s, true)); + (Map) 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 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 @@ private VersionedCollectionProps fetchCollectionProperties(String collection, Wa 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 props = (Map) Utils.fromJSON(data); return new VersionedCollectionProps(stat.getVersion(), props); @@ -328,7 +328,7 @@ private VersionedCollectionProps fetchCollectionProperties(String collection, Wa } 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 static PerReplicaStates fetch( 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 children = zkClient.getChildren(path, null, stat, true); + List 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 @@ private void persist( 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 @@ public void process(WatchedEvent event) { 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 @@ public void process(WatchedEvent event) { } 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 @@ ZkStateReader.ConfigData getSecurityProps(boolean getFresh) { 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) 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 boolean isConnected() { 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 void delete(final String path, final int version, boolean retryOnConnLoss /** * 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 Watcher wrapWatcher(final Watcher watcher) { * @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 Stat exists(final String path, final Watcher watcher, boolean retryOnConn } /** 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 getChildren(final String path, final Watcher watcher, boolean retryOnConnLoss) + public List getChildren(final String path, final Watcher watcher) throws KeeperException, InterruptedException { List result = runWithCorrectThrows( @@ -377,8 +375,7 @@ public List getChildren(final String path, final Watcher watcher, boolea } /** Returns children of the node at the path */ - public List getChildren( - final String path, final Watcher watcher, Stat stat, boolean retryOnConnLoss) + public List getChildren(final String path, final Watcher watcher, Stat stat) throws KeeperException, InterruptedException { List result = runWithCorrectThrows( @@ -393,8 +390,7 @@ public List getChildren( } /** 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 byte[] getData( 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 void atomicUpdate(String path, BiFunction editor) 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 void atomicUpdate(String path, BiFunction editor) // 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 void atomicUpdate(String path, BiFunction editor) } /** 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 String create( * * @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 String create( *

e.g. If path=/solr/group/node 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 void makePath(String path, CreateMode createMode, boolean retryOnConnLoss * * @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 void makePath(String path, byte[] data, boolean retryOnConnLoss) * * @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 void makePath(String path, byte[] data, CreateMode createMode, boolean re * * @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 void makePath( * @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 void makePath( * *

skipPathParts will force the call to fail if the first skipPathParts do not exist already. * - *

Note: retryOnConnLoss is no longer respected at all and is ignored - * *

Note: if failOnExists == false then we will always overwrite the existing data with the * given data */ @@ -595,7 +574,6 @@ public void makePath( CreateMode createMode, Watcher watcher, boolean failOnExists, - boolean retryOnConnLoss, int skipPathParts) throws KeeperException, InterruptedException { log.debug("makePath: {}", path); @@ -653,7 +631,7 @@ public void makePath( } 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 void makePath( }); } - 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 void ensureExists(final String path, final byte[] data, CreateMode create 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 void ensureExists( 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 Stat setData(String path, byte[] data, boolean retryOnConnLoss) * @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 List multi(final List ops) /** 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 children = getChildren(path, null, true); + byte[] data = getData(path, null, null); + List 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 ACLProvider getZkACLProvider() { /** * @return the ACLs on a single node in ZooKeeper. */ - public List getACL(String path, Stat stat, boolean retryOnConnLoss) - throws KeeperException, InterruptedException { + public List getACL(String path, Stat stat) throws KeeperException, InterruptedException { return runWithCorrectThrows( "getting acls", () -> client.getACL().storingStatIn(stat).forPath(path)); } @@ -1027,7 +1002,7 @@ public void upConfig(Path confPath, String confName) throws IOException { } 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 static String listZnode(SolrZkClient zkClient, String path, Boolean recur 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 static void zkTransfer( // 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 static void zkTransfer( // 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 static void zkTransfer( } 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 static void moveZnode(SolrZkClient zkClient, String src, String dst) 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 static void moveZnode(SolrZkClient zkClient, String src, String dst) 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 static void clean(SolrZkClient zkClient, String path) 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 static void clean(SolrZkClient zkClient, String path, Predicate f 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 FileVisitResult visitFile(Path file, BasicFileAttributes attrs) 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 FileVisitResult visitFile(Path file, BasicFileAttributes attrs) CreateMode.PERSISTENT, null, false, - true, pathParts); } @@ -401,7 +400,7 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) } 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 FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) 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 @@ private static int copyDataDown(SolrZkClient zkClient, String zkPath, Path file) public static void downloadFromZK(SolrZkClient zkClient, String zkPath, Path file) throws IOException { try { - List children = zkClient.getChildren(zkPath, null, true); + List 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 static void traverseZkTree( } List children; try { - children = zkClient.getChildren(path, null, true); + children = zkClient.getChildren(path, null); } catch (KeeperException.NoNodeException r) { return; } @@ -653,11 +652,11 @@ public static void ensureExists( 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 void visit(String path) throws InterruptedException, KeeperException { 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 @@ private void refreshCollectionList(Watcher watcher) throws KeeperException, Inte synchronized (refreshCollectionListLock) { List 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 synchronized DocCollection get(boolean allowCached) { 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 @@ private void refreshLiveNodes(Watcher watcher) throws KeeperException, Interrupt synchronized (refreshLiveNodesLock) { SortedSet newLiveNodes; try { - List nodeList = zkClient.getChildren(LIVE_NODES_ZKNODE, watcher, true); + List nodeList = zkClient.getChildren(LIVE_NODES_ZKNODE, watcher); newLiveNodes = new TreeSet<>(nodeList); } catch (KeeperException.NoNodeException | AlreadyClosedException e) { newLiveNodes = emptySortedSet(); @@ -885,14 +885,14 @@ public void removeLiveNodesListener(LiveNodesListener listener) { */ public Optional fetchLowestSolrVersion() throws KeeperException, InterruptedException { - List liveNodeNames = zkClient.getChildren(LIVE_NODES_ZKNODE, null, true); + List 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 @@ private void loadClusterProperties() { 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) Utils.fromJSON(data); log.debug("Loaded cluster properties: {}", this.clusterProperties); @@ -1192,7 +1191,7 @@ private void loadClusterProperties() { 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 @@ private void refreshAndWatchChildren() throws KeeperException, InterruptedExcept Stat stat = new Stat(); List 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 @@ private DocCollection fetchCollectionState(String coll, Watcher watcher) 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 @@ private DocCollection fetchCollectionState(String coll, Watcher watcher) } 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 @@ private DocCollection fetchCollectionState(String coll, Watcher watcher) 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 AliasesManager getAliasesManager() { 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 void applyModificationAndExportToZk(UnaryOperator op) { 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 boolean update() throws KeeperException, InterruptedException { // 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 void process(WatchedEvent event) { 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 void setUp() throws Exception { .withTimeout(AbstractZkTestCase.TIMEOUT, TimeUnit.MILLISECONDS) .build()) { // Set up chroot - client.makePath("/solr", false, true); + client.makePath("/solr", false); } defaultClient = @@ -215,12 +215,10 @@ public void process(WatchedEvent event) { 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 void process(WatchedEvent event) { 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 void process(WatchedEvent event) { 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 void testCreateWithStat() throws InterruptedException, KeeperException { 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 void testCreateWithStatAndRetry() throws InterruptedException, KeeperExce 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 void testEntries() { public void testReplicaStateOperations() throws Exception { String root = "/testReplicaStateOperations"; - cluster.getZkClient().create(root, null, CreateMode.PERSISTENT, true); + cluster.getZkClient().create(root, null, CreateMode.PERSISTENT); List 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 void testReplicaStateOperations() throws Exception { 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 void testClean() throws KeeperException, InterruptedException, SolrServer 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 void testTraverseZkTree() throws Exception { .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 void testHttpClusterStateWithSSL() throws Exception { // 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 replicasMap = (Map) 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 void testCloudClientUploads() throws Exception { 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 void testRestart() throws Exception { 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 void testZkNodeVersions() throws Exception { 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 void testZkNodeVersions() throws Exception { .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 void testZkNodeVersions() throws Exception { 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 void testZkNodeVersions() throws Exception { 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 void testZkNodeVersions() throws Exception { 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 void testZkNodeVersions() throws Exception { // 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 void testZkNodeVersions() throws Exception { .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 void getData() throws Exception { 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 b216fd980e6..9253e2f7cb2 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -808,7 +808,7 @@ public static void deleteCore() { 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 67922db5a42..c7c46d77d09 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 @@ -301,18 +301,14 @@ public void distribSetUp() throws Exception { .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 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 void deleteAllConfigSets() throws Exception { // 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 SolrZkClient getZkClient() { * 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 MockSolrZkClient() { } @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 void ensurePathExists(String path) throws IOException { .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 static void putConfig( 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 void buildZooKeeper(Path solrhome, String config, String schema) throws E } public void makeSolrZkNode() throws Exception { - rootClient.makePath("/solr", false, true); + rootClient.makePath("/solr", false); } public void tryCleanSolrZkNode() throws Exception { @@ -710,7 +710,7 @@ public void tryCleanSolrZkNode() throws Exception { } 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 void testCreationAndDeletion() throws Exception { 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 void deleteCollectionRemovesStaleZkCollectionsNode() throws Exception { CollectionAdminRequest.listCollections(cluster.getSolrClient()).contains(collectionName)); assertFalse( - cluster - .getZkClient() - .exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, true)); + cluster.getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName)); } @Test From 6253ef73233efaa351ca5ec9dd26cca5654cd94e Mon Sep 17 00:00:00 2001 From: Pierre Salagnac Date: Mon, 29 Dec 2025 16:12:00 +0100 Subject: [PATCH 2/2] Add changelog --- .../unreleased/SOLR-16116-remove-retryOnConnLoss.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog/unreleased/SOLR-16116-remove-retryOnConnLoss.yml 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