epugh commented on code in PR #4672:
URL: https://github.com/apache/solr/pull/4672#discussion_r3659316510
##########
solr/core/src/java/org/apache/solr/cli/CreateTool.java:
##########
@@ -226,53 +206,37 @@ protected void createCollection(CloudSolrClient
cloudSolrClient, CommandLine cli
ensureConfDirExists(solrInstallDirPath, confDirPath);
printDefaultConfigsetWarningIfNecessary(cli);
- Set<String> liveNodes = cloudSolrClient.getClusterState().getLiveNodes();
- if (liveNodes.isEmpty())
- throw new IllegalStateException(
- "No live nodes found! Cannot create a collection until "
- + "there is at least 1 live node in the cluster.");
-
- String solrUrl;
- if (CLIUtils.hasConnectionOption(cli)) {
- solrUrl = CLIUtils.normalizeSolrUrl(cli);
- } else {
- String firstLiveNode = liveNodes.iterator().next();
- solrUrl =
ZkStateReader.from(cloudSolrClient).getBaseUrlForNodeName(firstLiveNode);
- }
+ String solrUrl = CLIUtils.normalizeSolrUrl(cli);
// build a URL to create the collection
int numShards = cli.getParsedOptionValue(SHARDS_OPTION, 1);
int replicationFactor =
cli.getParsedOptionValue(REPLICATION_FACTOR_OPTION, 1);
- boolean configExistsInZk =
+ boolean configExists =
confName != null
&& !confName.trim().isEmpty()
- &&
ZkStateReader.from(cloudSolrClient).getZkClient().exists("/configs/" +
confName);
+ && new
ConfigsetsApi.ListConfigSet().process(solrClient).configSets.contains(confName);
- if (configExistsInZk) {
+ if (configExists) {
echo("Re-using existing configuration directory " + confName);
} else { // if (confdir != null && !confdir.trim().isEmpty()) {
if (confName == null || confName.trim().isEmpty()) {
confName = collectionName;
}
- // TODO: This should be done using the configSet API. This would let us
remove
- // the direct dependency on ZooKeeper APIs. Unlike the bin/solr zk
comamnds that
- // work directly with ZooKeeper.
final Path configsetsDirPath =
CLIUtils.getConfigSetsDir(solrInstallDirPath);
- ConfigSetService configSetService =
- new
ZkConfigSetService(ZkStateReader.from(cloudSolrClient).getZkClient());
Path confPath = ConfigSetService.getConfigsetPath(confDir,
configsetsDirPath.toString());
echoIfVerbose(
"Uploading "
+ confPath.toAbsolutePath()
+ " for config "
+ confName
- + " to ZooKeeper at "
- + cloudSolrClient.getClusterStateProvider().getQuorumHosts());
- // We will trust the config since we have the Zookeeper Address
- configSetService.uploadConfig(confName, confPath);
+ + " using the Configsets V2 API");
Review Comment:
so, this only happens with verbose parameter, and I think it's a bit of
debugging/helping someone understand which apis are being used... So yes, I
think until we remove v1, someone might want to know "oh, it's using the v2
api"...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]