Java Code Examples for org.apache.solr.common.cloud.SolrZkClient#makePath()
The following examples show how to use
org.apache.solr.common.cloud.SolrZkClient#makePath() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZkTestServer.java From lucene-solr with Apache License 2.0 | 6 votes |
public static void putConfig(String confName, SolrZkClient zkClient, String zkChroot, File solrhome, final String srcName, String destName) throws Exception { File file = new File(solrhome, "collection1" + File.separator + "conf" + File.separator + srcName); if (!file.exists()) { if (log.isInfoEnabled()) { log.info("skipping {} because it doesn't exist", file.getAbsolutePath()); } return; } String destPath = "/configs/" + confName + "/" + destName; if (zkChroot != null) { destPath = zkChroot + destPath; } if (log.isInfoEnabled()) { log.info("put {} to {}", file.getAbsolutePath(), destPath); } zkClient.makePath(destPath, file, false, true); }
Example 2
Source File: SaslZkACLProviderTest.java From lucene-solr with Apache License 2.0 | 6 votes |
protected void setupZNodes() throws Exception { SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); try { zkClient.create("/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.makePath("/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.create(SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH, "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); } finally { zkClient.close(); } zkClient = new SolrZkClientNoACLs(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); try { zkClient.create("/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.makePath("/unprotectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); } finally { zkClient.close(); } }
Example 3
Source File: CdcrProcessStateManager.java From lucene-solr with Apache License 2.0 | 6 votes |
private void createStateNode() { SolrZkClient zkClient = core.getCoreContainer().getZkController().getZkClient(); try { if (!zkClient.exists(this.getZnodePath(), true)) { if (!zkClient.exists(this.getZnodeBase(), true)) { // Should be a no-op if the node exists zkClient.makePath(this.getZnodeBase(), null, CreateMode.PERSISTENT, null, false, true); } zkClient.create(this.getZnodePath(), DEFAULT_STATE.getBytes(), CreateMode.PERSISTENT, true); if (log.isInfoEnabled()) { log.info("Created znode {}", this.getZnodePath()); } } } catch (KeeperException.NodeExistsException ne) { // Someone got in first and created the node. } catch (KeeperException | InterruptedException e) { log.warn("Failed to create CDCR process state node", e); } }
Example 4
Source File: CdcrBufferStateManager.java From lucene-solr with Apache License 2.0 | 6 votes |
private void createStateNode() { SolrZkClient zkClient = core.getCoreContainer().getZkController().getZkClient(); try { if (!zkClient.exists(this.getZnodePath(), true)) { if (!zkClient.exists(this.getZnodeBase(), true)) { zkClient.makePath(this.getZnodeBase(), null, CreateMode.PERSISTENT, null, false, true); // Should be a no-op if node exists } zkClient.create(this.getZnodePath(), DEFAULT_STATE.getBytes(), CreateMode.PERSISTENT, true); if (log.isInfoEnabled()) { log.info("Created znode {}", this.getZnodePath()); } } } catch (KeeperException.NodeExistsException ne) { // Someone got in first and created the node. } catch (KeeperException | InterruptedException e) { log.warn("Failed to create CDCR buffer state node", e); } }
Example 5
Source File: ZkController.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Validates if the chroot exists in zk (or if it is successfully created). * Optionally, if create is set to true this method will create the path in * case it doesn't exist * * @return true if the path exists or is created false if the path doesn't * exist and 'create' = false */ public static boolean checkChrootPath(String zkHost, boolean create) throws KeeperException, InterruptedException { if (!SolrZkClient.containsChroot(zkHost)) { return true; } log.trace("zkHost includes chroot"); String chrootPath = zkHost.substring(zkHost.indexOf("/"), zkHost.length()); SolrZkClient tmpClient = new SolrZkClient(zkHost.substring(0, zkHost.indexOf("/")), 60000, 30000, null, null, null); boolean exists = tmpClient.exists(chrootPath, true); if (!exists && create) { tmpClient.makePath(chrootPath, false, true); exists = true; } tmpClient.close(); return exists; }
Example 6
Source File: OverseerTest.java From lucene-solr with Apache License 2.0 | 5 votes |
public MockZKController(String zkAddress, String nodeName, List<Overseer> overseers) throws InterruptedException, TimeoutException, IOException, KeeperException { this.overseers = overseers; this.nodeName = nodeName; zkClient = new SolrZkClient(zkAddress, TIMEOUT); ZkController.createClusterZkNodes(zkClient); zkStateReader = new ZkStateReader(zkClient); zkStateReader.createClusterStateWatchersAndUpdate(); // live node final String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName; zkClient.makePath(nodePath, CreateMode.EPHEMERAL, true); }
Example 7
Source File: ZkSolrClientTest.java From lucene-solr with Apache License 2.0 | 5 votes |
@SuppressWarnings({"try"}) public void testClean() throws Exception { try (ZkConnection conn = new ZkConnection ()) { final SolrZkClient zkClient = conn.getClient(); zkClient.makePath("/test/path/here", true); zkClient.makePath("/zz/path/here", true); zkClient.clean("/"); assertFalse(zkClient.exists("/test", true)); assertFalse(zkClient.exists("/zz", true)); } }
Example 8
Source File: ZkCLITest.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); if (log.isInfoEnabled()) { log.info("####SETUP_START {}", getTestName()); } String exampleHome = SolrJettyTestBase.legacyExampleCollection1SolrHome(); Path tmpDir = createTempDir(); solrHome = exampleHome; zkDir = tmpDir.resolve("zookeeper/server1/data"); log.info("ZooKeeper dataDir:{}", zkDir); zkServer = new ZkTestServer(zkDir); zkServer.run(); System.setProperty("zkHost", zkServer.getZkAddress()); SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT); zkClient.makePath("/solr", false, true); zkClient.close(); this.zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); if (log.isInfoEnabled()) { log.info("####SETUP_END {}", getTestName()); } }
Example 9
Source File: LeaderElectionTest.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); Path zkDir = createTempDir("zkData"); server = new ZkTestServer(zkDir); server.setTheTickTime(1000); server.run(); zkClient = new SolrZkClient(server.getZkAddress(), TIMEOUT); zkStateReader = new ZkStateReader(zkClient); seqToThread = Collections.synchronizedMap(new HashMap<Integer,Thread>()); zkClient.makePath("/collections/collection1", true); zkClient.makePath("/collections/collection2", true); }
Example 10
Source File: OverriddenZkACLAndCredentialsProvidersTest.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); if (log.isInfoEnabled()) { log.info("####SETUP_START {}", getTestName()); } createTempDir(); zkDir =createTempDir().resolve("zookeeper/server1/data"); log.info("ZooKeeper dataDir:{}", zkDir); zkServer = new ZkTestServer(zkDir); zkServer.run(false); System.setProperty("zkHost", zkServer.getZkAddress()); SolrZkClient zkClient = new SolrZkClientFactoryUsingCompletelyNewProviders("connectAndAllACLUsername", "connectAndAllACLPassword", "readonlyACLUsername", "readonlyACLPassword").getSolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT); zkClient.makePath("/solr", false, true); zkClient.close(); zkClient = new SolrZkClientFactoryUsingCompletelyNewProviders("connectAndAllACLUsername", "connectAndAllACLPassword", "readonlyACLUsername", "readonlyACLPassword").getSolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); zkClient.create("/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.makePath("/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.create(SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH, "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.close(); zkClient = new SolrZkClientFactoryUsingCompletelyNewProviders(null, null, null, null).getSolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); zkClient.getSolrZooKeeper().addAuthInfo("digest", ("connectAndAllACLUsername:connectAndAllACLPassword").getBytes(DATA_ENCODING)); zkClient.create("/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.makePath("/unprotectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false); zkClient.close(); if (log.isInfoEnabled()) { log.info("####SETUP_END {}", getTestName()); } }
Example 11
Source File: BackupManager.java From lucene-solr with Apache License 2.0 | 5 votes |
private void uploadToZk(SolrZkClient zkClient, URI sourceDir, String destZkPath) throws IOException { Preconditions.checkArgument(repository.exists(sourceDir), "Path {} does not exist", sourceDir); Preconditions.checkArgument(repository.getPathType(sourceDir) == PathType.DIRECTORY, "Path {} is not a directory", sourceDir); for (String file : repository.listAll(sourceDir)) { String zkNodePath = destZkPath + "/" + file; URI path = repository.resolve(sourceDir, file); PathType t = repository.getPathType(path); switch (t) { case FILE: { try (IndexInput is = repository.openInput(sourceDir, file, IOContext.DEFAULT)) { byte[] arr = new byte[(int) is.length()]; // probably ok since the config file should be small. is.readBytes(arr, 0, (int) is.length()); zkClient.makePath(zkNodePath, arr, true); } catch (KeeperException | InterruptedException e) { throw new IOException(SolrZkClient.checkInterrupted(e)); } break; } case DIRECTORY: { if (!file.startsWith(".")) { uploadToZk(zkClient, path, zkNodePath); } break; } default: throw new IllegalStateException("Unknown path type " + t); } } }
Example 12
Source File: HadoopAuthFilter.java From lucene-solr with Apache License 2.0 | 5 votes |
protected CuratorFramework getCuratorClient(SolrZkClient zkClient) throws KeeperException, InterruptedException { // should we try to build a RetryPolicy off of the ZkController? RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); if (zkClient == null) { throw new IllegalArgumentException("zkClient required"); } String zkHost = zkClient.getZkServerAddress(); String zkChroot = zkHost.contains("/")? zkHost.substring(zkHost.indexOf("/")): ""; String zkNamespace = zkChroot + SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH; zkNamespace = zkNamespace.startsWith("/") ? zkNamespace.substring(1) : zkNamespace; String zkConnectionString = zkHost.contains("/")? zkHost.substring(0, zkHost.indexOf("/")): zkHost; SolrZkToCuratorCredentialsACLs curatorToSolrZk = new SolrZkToCuratorCredentialsACLs(zkClient); final int connectionTimeoutMs = 30000; // this value is currently hard coded, see SOLR-7561. // Create /security znode upfront. Without this, the curator framework creates this directory path // without the appropriate ACL configuration. This issue is possibly related to HADOOP-11973 try { zkClient.makePath(SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH, CreateMode.PERSISTENT, true); } catch (KeeperException ex) { if (ex.code() != KeeperException.Code.NODEEXISTS) { throw ex; } } curatorFramework = CuratorFrameworkFactory.builder() .namespace(zkNamespace) .connectString(zkConnectionString) .retryPolicy(retryPolicy) .aclProvider(curatorToSolrZk.getACLProvider()) .authorization(curatorToSolrZk.getAuthInfos()) .sessionTimeoutMs(zkClient.getZkClientTimeout()) .connectionTimeoutMs(connectionTimeoutMs) .build(); curatorFramework.start(); return curatorFramework; }
Example 13
Source File: SolrXmlInZkTest.java From lucene-solr with Apache License 2.0 | 4 votes |
private void setUpZkAndDiskXml(boolean toZk, boolean leaveOnLocal) throws Exception { Path tmpDir = createTempDir(); Path solrHome = tmpDir.resolve("home"); copyMinConf(new File(solrHome.toFile(), "myCollect")); if (leaveOnLocal) { FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr-stress-new.xml"), new File(solrHome.toFile(), "solr.xml")); } ignoreException("No UpdateLog found - cannot sync"); ignoreException("No UpdateLog found - cannot recover"); System.setProperty("zkClientTimeout", "8000"); zkDir = tmpDir.resolve("zookeeper" + System.nanoTime()).resolve("server1").resolve("data"); zkServer = new ZkTestServer(zkDir); zkServer.run(); System.setProperty("zkHost", zkServer.getZkAddress()); zkServer.buildZooKeeper("solrconfig.xml", "schema.xml"); zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT); if (toZk) { zkClient.makePath("solr.xml", XML_FOR_ZK.getBytes(StandardCharsets.UTF_8), true); } zkClient.close(); if (log.isInfoEnabled()) { log.info("####SETUP_START {}", getTestName()); } // set some system properties for use by tests Properties props = new Properties(); props.setProperty("solr.test.sys.prop1", "propone"); props.setProperty("solr.test.sys.prop2", "proptwo"); cfg = SolrDispatchFilter.loadNodeConfig(solrHome, props); if (log.isInfoEnabled()) { log.info("####SETUP_END {}", getTestName()); } }
Example 14
Source File: ConfigSetsHandler.java From lucene-solr with Apache License 2.0 | 4 votes |
private void handleConfigUploadRequest(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { if (!"true".equals(System.getProperty("configset.upload.enabled", "true"))) { throw new SolrException(ErrorCode.BAD_REQUEST, "Configset upload feature is disabled. To enable this, start Solr with '-Dconfigset.upload.enabled=true'."); } String configSetName = req.getParams().get(NAME); if (StringUtils.isBlank(configSetName)) { throw new SolrException(ErrorCode.BAD_REQUEST, "The configuration name should be provided in the \"name\" parameter"); } SolrZkClient zkClient = coreContainer.getZkController().getZkClient(); String configPathInZk = ZkConfigManager.CONFIGS_ZKNODE + Path.SEPARATOR + configSetName; if (zkClient.exists(configPathInZk, true)) { throw new SolrException(ErrorCode.BAD_REQUEST, "The configuration " + configSetName + " already exists in zookeeper"); } Iterator<ContentStream> contentStreamsIterator = req.getContentStreams().iterator(); if (!contentStreamsIterator.hasNext()) { throw new SolrException(ErrorCode.BAD_REQUEST, "No stream found for the config data to be uploaded"); } InputStream inputStream = contentStreamsIterator.next().getStream(); // Create a node for the configuration in zookeeper boolean trusted = getTrusted(req); zkClient.makePath(configPathInZk, ("{\"trusted\": " + Boolean.toString(trusted) + "}"). getBytes(StandardCharsets.UTF_8), true); ZipInputStream zis = new ZipInputStream(inputStream, StandardCharsets.UTF_8); ZipEntry zipEntry = null; while ((zipEntry = zis.getNextEntry()) != null) { String filePathInZk = configPathInZk + "/" + zipEntry.getName(); if (zipEntry.isDirectory()) { zkClient.makePath(filePathInZk, true); } else { createZkNodeIfNotExistsAndSetData(zkClient, filePathInZk, IOUtils.toByteArray(zis)); } } zis.close(); }
Example 15
Source File: TestConfigSetsAPI.java From lucene-solr with Apache License 2.0 | 4 votes |
@Test public void testUploadErrors() throws Exception { final SolrClient solrClient = getHttpSolrClient(solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString()); ByteBuffer emptyData = ByteBuffer.allocate(0); // Checking error when no configuration name is specified in request @SuppressWarnings({"rawtypes"}) Map map = postDataAndGetResponse(solrCluster.getSolrClient(), solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/admin/configs?action=UPLOAD", emptyData, null, null); assertNotNull(map); long statusCode = (long) getObjectByPath(map, false, Arrays.asList("responseHeader", "status")); assertEquals(400l, statusCode); SolrZkClient zkClient = new SolrZkClient(solrCluster.getZkServer().getZkAddress(), AbstractZkTestCase.TIMEOUT, 45000, null); // Create dummy config files in zookeeper zkClient.makePath("/configs/myconf", true); zkClient.create("/configs/myconf/firstDummyFile", "first dummy content".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, true); zkClient.create("/configs/myconf/anotherDummyFile", "second dummy content".getBytes(StandardCharsets.UTF_8), CreateMode.PERSISTENT, true); // Checking error when configuration name specified already exists map = postDataAndGetResponse(solrCluster.getSolrClient(), solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/admin/configs?action=UPLOAD&name=myconf", emptyData, null, null); assertNotNull(map); statusCode = (long) getObjectByPath(map, false, Arrays.asList("responseHeader", "status")); assertEquals(400l, statusCode); assertTrue("Expected file doesnt exist in zk. It's possibly overwritten", zkClient.exists("/configs/myconf/firstDummyFile", true)); assertTrue("Expected file doesnt exist in zk. It's possibly overwritten", zkClient.exists("/configs/myconf/anotherDummyFile", true)); zkClient.close(); solrClient.close(); }
Example 16
Source File: ZkSolrClientTest.java From lucene-solr with Apache License 2.0 | 4 votes |
@Test @SuppressWarnings({"try"}) public void testMultipleWatchesAsync() throws Exception { try (ZkConnection conn = new ZkConnection()) { final SolrZkClient zkClient = conn.getClient(); zkClient.makePath("/collections", true); final int numColls = random().nextInt(100); final CountDownLatch latch = new CountDownLatch(numColls); final CountDownLatch watchesDone = new CountDownLatch(numColls); final Set<String> collectionsInProgress = new HashSet<>(numColls); AtomicInteger maxCollectionsInProgress = new AtomicInteger(); for (int i = 1; i <= numColls; i ++) { String collPath = "/collections/collection" + i; zkClient.makePath(collPath, true); zkClient.getChildren(collPath, new Watcher() { @Override public void process(WatchedEvent event) { synchronized (collectionsInProgress) { collectionsInProgress.add(event.getPath()); // Will be something like /collections/collection## maxCollectionsInProgress.set(Math.max(maxCollectionsInProgress.get(), collectionsInProgress.size())); } latch.countDown(); try { latch.await(10000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) {} synchronized (collectionsInProgress) { collectionsInProgress.remove(event.getPath()); } watchesDone.countDown(); } }, true); } for (int i = 1; i <= numColls; i ++) { String shardsPath = "/collections/collection" + i + "/shards"; zkClient.makePath(shardsPath, true); } assertTrue(latch.await(10000, TimeUnit.MILLISECONDS)); assertEquals("All collections should have been processed in parallel", numColls, maxCollectionsInProgress.get()); // just as sanity check for the test: assertTrue(watchesDone.await(10000, TimeUnit.MILLISECONDS)); synchronized (collectionsInProgress) { assertEquals(0, collectionsInProgress.size()); } } }
Example 17
Source File: ZkSolrClientTest.java From lucene-solr with Apache License 2.0 | 4 votes |
@SuppressWarnings({"try"}) public void testWatchChildren() throws Exception { try (ZkConnection conn = new ZkConnection ()) { final SolrZkClient zkClient = conn.getClient(); final AtomicInteger cnt = new AtomicInteger(); final CountDownLatch latch = new CountDownLatch(1); zkClient.makePath("/collections", true); zkClient.getChildren("/collections", new Watcher() { @Override public void process(WatchedEvent event) { cnt.incrementAndGet(); // remake watch try { zkClient.getChildren("/collections", this, true); 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 zkClient.makePath("collections/collection99/config=collection1", true); zkClient.makePath("collections/collection99/config=collection3", true); zkClient.makePath("/collections/collection97/shards", true); // pause for the watches to fire Thread.sleep(700); if (cnt.intValue() < 2) { Thread.sleep(4000); // wait a bit more } if (cnt.intValue() < 2) { Thread.sleep(4000); // wait a bit more } assertEquals(2, cnt.intValue()); } }
Example 18
Source File: ZkSolrClientTest.java From lucene-solr with Apache License 2.0 | 4 votes |
@SuppressWarnings({"try"}) public void testSkipPathPartsOnMakePath() throws Exception { try (ZkConnection conn = new ZkConnection()) { final SolrZkClient zkClient = conn.getClient(); zkClient.makePath("/test", true); // should work zkClient.makePath("/test/path/here", (byte[]) null, CreateMode.PERSISTENT, (Watcher) null, true, true, 1); zkClient.clean("/"); // should not work KeeperException e =expectThrows(KeeperException.NoNodeException.class, "We should not be able to create this path", () -> zkClient.makePath("/test/path/here", (byte[]) null, CreateMode.PERSISTENT, (Watcher) null, true, true, 1)); zkClient.clean("/"); ZkCmdExecutor zkCmdExecutor = new ZkCmdExecutor(30000); expectThrows(KeeperException.NoNodeException.class, "We should not be able to create this path", () -> zkCmdExecutor.ensureExists("/collection/collection/leader", (byte[]) null, CreateMode.PERSISTENT, zkClient, 2)); zkClient.makePath("/collection", true); expectThrows(KeeperException.NoNodeException.class, "We should not be able to create this path", () -> zkCmdExecutor.ensureExists("/collections/collection/leader", (byte[]) null, CreateMode.PERSISTENT, zkClient, 2)); zkClient.makePath("/collection/collection", true); byte[] bytes = new byte[10]; zkCmdExecutor.ensureExists("/collection/collection", bytes, CreateMode.PERSISTENT, zkClient, 2); byte[] returnedBytes = zkClient.getData("/collection/collection", null, null, true); assertNull("We skipped 2 path parts, so data won't be written", returnedBytes); zkClient.makePath("/collection/collection/leader", true); zkCmdExecutor.ensureExists("/collection/collection/leader", (byte[]) null, CreateMode.PERSISTENT, zkClient, 2); } }
Example 19
Source File: TestDistributedMap.java From lucene-solr with Apache License 2.0 | 4 votes |
protected String getAndMakeInitialPath(SolrZkClient zkClient) throws KeeperException, InterruptedException { String path = String.format(Locale.ROOT, "/%s/%s", getClass().getName(), getSaferTestName()); zkClient.makePath(path, false, true); return path; }
Example 20
Source File: SolrSnapshotManager.java From lucene-solr with Apache License 2.0 | 2 votes |
/** * This method creates an entry for the named snapshot for the specified collection in Zookeeper. * * @param zkClient Zookeeper client * @param collectionName The name of the collection * @param meta The {@linkplain CollectionSnapshotMetaData} corresponding to named snapshot * @throws KeeperException In case of Zookeeper error * @throws InterruptedException In case of thread interruption. */ 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); }