You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/08/20 01:33:35 UTC

[lucene-solr] 01/04: @569 Revert cloud.sh changes that were not meant to be committed.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 54105e8011348e1ebd104ba2016195833919548d
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Aug 19 19:51:11 2020 -0500

    @569 Revert cloud.sh changes that were not meant to be committed.
---
 .../byTask/tasks/DeleteCollectionTask.java         | 85 ++++++++++++++++++++++
 solr/cloud-dev/cloud.sh                            |  9 ++-
 2 files changed, 91 insertions(+), 3 deletions(-)

diff --git a/solr/benchmark/src/java/org/apache/solr/benchmark/byTask/tasks/DeleteCollectionTask.java b/solr/benchmark/src/java/org/apache/solr/benchmark/byTask/tasks/DeleteCollectionTask.java
new file mode 100644
index 0000000..a9eac7e
--- /dev/null
+++ b/solr/benchmark/src/java/org/apache/solr/benchmark/byTask/tasks/DeleteCollectionTask.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.benchmark.byTask.tasks;
+
+import org.apache.lucene.benchmark.byTask.PerfRunData;
+import org.apache.lucene.benchmark.byTask.tasks.PerfTask;
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class CreateCollectionTask extends PerfTask {
+
+  static AtomicInteger count = new AtomicInteger();
+
+  private String name;
+  private String numShards;
+
+  private String numReplicas;
+
+  public CreateCollectionTask(PerfRunData runData) {
+    super(runData);
+  }
+
+
+  @Override
+  protected String getLogMessage(int recsCount) {
+    return "collection created";
+  }
+  
+  @Override
+  public int doLogic() throws Exception {
+    SolrClient solrServer = (SolrClient) getRunData().getPerfObject("solr.admin.client");
+    //String collectionName = "solrj_test" + count.incrementAndGet();
+
+    String collectionName = name;
+    CollectionAdminResponse response = CollectionAdminRequest
+        .createCollection(collectionName, "_default", 2, 4)
+        .setMaxShardsPerNode(100).process(solrServer);
+    
+    return 1;
+  }
+
+  /**
+   * Set the params (docSize only)
+   *
+   * @param params
+   *          docSize, or 0 for no limit.
+   */
+  @Override
+  public void setParams(String params) {
+    // can't call super because super doesn't understand our
+    // params syntax
+    this.params = params;
+    String [] splits = params.split(",");
+    for (int i = 0; i < splits.length; i++) {
+      if (splits[i].startsWith("name[") == true){
+        name = splits[i].substring("name[".length(),splits[i].length() - 1);
+      }
+      if (splits[i].startsWith("numShards[") == true){
+        numShards = splits[i].substring("numShards[".length(),splits[i].length() - 1);
+      }
+      if (splits[i].startsWith("numReplicas[") == true){
+        numReplicas = splits[i].substring("numReplicas[".length(),splits[i].length() - 1);
+      }
+    }
+  }
+  
+}
diff --git a/solr/cloud-dev/cloud.sh b/solr/cloud-dev/cloud.sh
index 0e7a5e3..ccbfce8 100644
--- a/solr/cloud-dev/cloud.sh
+++ b/solr/cloud-dev/cloud.sh
@@ -90,7 +90,7 @@
 #
 ##################################################################################
 
-DEFAULT_VCS_WORKSPACE='/data2/lucene-solr'
+DEFAULT_VCS_WORKSPACE='../code/lucene-solr'
 
 ############## Normally  no need to edit below this line ##############
 
@@ -254,7 +254,7 @@ cleanIfReq() {
 recompileIfReq() {
   if [[ "$RECOMPILE" = true ]]; then
     pushd "$VCS_WORK"/solr
-    ant clean server create-package
+    ant clean create-package
     if [[ "$?" -ne 0 ]]; then
       echo "BUILD FAIL - cloud.sh stopping, see above output for details"; popd; exit 7;
     fi
@@ -288,7 +288,10 @@ copyTarball() {
 # Assume that zookeeper holds it if it is   #
 #############################################
 testZookeeper() {
-  echo "no"
+  PORT_FOUND=$( netstat -an | grep '\b'${ZK_PORT}'\s' | grep LISTEN | awk '{print $4}' | sed -E 's/.*\b('${ZK_PORT}')\s*/\1/');
+  if [[ -z  "$PORT_FOUND" ]]; then
+    echo "No process listening on port ${ZK_PORT}. Please start zookeeper and try again"; exit 8;
+  fi
 }
 
 ##########################