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

marcuse pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 537321e9c7 Remove stress server functionality
537321e9c7 is described below

commit 537321e9c7d2696cddc35e808a48846cb67ba52a
Author: Marcus Eriksson <marc...@apache.org>
AuthorDate: Thu Apr 7 09:06:53 2022 +0200

    Remove stress server functionality
    
    Patch by marcuse; reviewed by Brandon Williams for CASSANDRA-17535
---
 CHANGES.txt                                        |   1 +
 .../cassandra/pages/tools/cassandra_stress.adoc    |   2 -
 redhat/cassandra.spec                              |   1 -
 tools/bin/cassandra-stressd                        |  79 ------------
 .../src/org/apache/cassandra/stress/Stress.java    |  88 +-------------
 .../org/apache/cassandra/stress/StressServer.java  | 135 ---------------------
 .../cassandra/stress/settings/CliOption.java       |   1 -
 .../apache/cassandra/stress/settings/Legacy.java   |   5 -
 .../cassandra/stress/settings/SettingsCommand.java |  12 --
 .../cassandra/stress/settings/SettingsMisc.java    |  25 ----
 .../cassandra/stress/settings/StressSettings.java  |   8 +-
 11 files changed, 7 insertions(+), 350 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 39078e562f..b79aa276b5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.1
+ * Remove stress server functionality (CASSANDRA-17535)
  * Reduce histogram snapshot long[] allocation overhead during speculative 
read and write threshold updates (CASSANDRA-17523)
  * Add guardrail for creation of secondary indexes (CASSANDRA-17498)
  * Add guardrail to disallow creation of uncompressed tables (CASSANDRA-17504)
diff --git a/doc/modules/cassandra/pages/tools/cassandra_stress.adoc 
b/doc/modules/cassandra/pages/tools/cassandra_stress.adoc
index bcef193c37..7cf3548c48 100644
--- a/doc/modules/cassandra/pages/tools/cassandra_stress.adoc
+++ b/doc/modules/cassandra/pages/tools/cassandra_stress.adoc
@@ -67,8 +67,6 @@ Primary Options:::
     Custom transport factories
   -port:;;
     The port to connect to cassandra nodes on
-  -sendto:;;
-    Specify a stress server to send this command to
   -graph:;;
     Graph recorded metrics
   -tokenrange:;;
diff --git a/redhat/cassandra.spec b/redhat/cassandra.spec
index 15be0b0478..d11e9b0c53 100644
--- a/redhat/cassandra.spec
+++ b/redhat/cassandra.spec
@@ -190,7 +190,6 @@ This package contains extra tools for working with 
Cassandra clusters.
 
 %files tools
 %attr(755,root,root) %{_bindir}/sstabledump
-%attr(755,root,root) %{_bindir}/cassandra-stressd
 %attr(755,root,root) %{_bindir}/compaction-stress
 %attr(755,root,root) %{_bindir}/sstableexpiredblockers
 %attr(755,root,root) %{_bindir}/sstablelevelreset
diff --git a/tools/bin/cassandra-stressd b/tools/bin/cassandra-stressd
deleted file mode 100755
index 83f8006ca5..0000000000
--- a/tools/bin/cassandra-stressd
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# 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.
-
-DESC="Cassandra Stress Test Daemon"
-if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    # Locations (in order) to use when searching for an include file.
-    for include in "`dirname "$0"`/cassandra.in.sh" \
-                   "$HOME/.cassandra.in.sh" \
-                   /usr/share/cassandra/cassandra.in.sh \
-                   /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh; do
-        if [ -r "$include" ]; then
-            . "$include"
-            break
-        fi
-    done
-elif [ -r "$CASSANDRA_INCLUDE" ]; then
-    . "$CASSANDRA_INCLUDE"
-fi
-
-if [ -z "$CLASSPATH" ]; then
-    echo "You must set the CLASSPATH var" >&2
-    exit 1
-fi
-
-case "$1" in
-  start)
-    echo "Starting $DESC: "
-    "$JAVA" -server -cp "$CLASSPATH" $JVM_OPTS \
-            -Dcassandra.storagedir="$cassandra_storagedir" \
-            -Dlogback.configurationFile=logback-tools.xml \
-            org.apache.cassandra.stress.StressServer $@ 1> ./stressd.out.log 
2> ./stressd.err.log &
-    echo $! > ./stressd.pid
-    echo "done."
-  ;;
-  
-  stop)
-    PID=`cat ./stressd.pid 2> /dev/null`
-    
-    if [ "x$PID" = "x" ]; then
-      echo "$DESC is not running."
-    else
-      kill -9 $PID
-      rm ./stressd.pid
-      echo "$DESC is stopped."
-    fi
-  ;;
-
-  status)
-    PID=`cat ./stressd.pid 2> /dev/null`
-
-    if [ "x$PID" = "x" ]; then
-      echo "$DESC is not running."
-    else
-      echo "$DESC is running with pid $PID."
-    fi
-  ;;
-
-  *)
-    echo "Usage: $0 start|stop|status [-h <host>]"
-  ;;
-esac
-
-# vi:ai sw=4 ts=4 tw=0 et
diff --git a/tools/stress/src/org/apache/cassandra/stress/Stress.java 
b/tools/stress/src/org/apache/cassandra/stress/Stress.java
index e505633040..c104e5c7cf 100644
--- a/tools/stress/src/org/apache/cassandra/stress/Stress.java
+++ b/tools/stress/src/org/apache/cassandra/stress/Stress.java
@@ -18,8 +18,6 @@
 package org.apache.cassandra.stress;
 
 import java.io.*;
-import java.net.Socket;
-import java.net.SocketException;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.stress.settings.StressSettings;
@@ -51,8 +49,6 @@ public final class Stress
      *   thread count with a high error rate / low count to get some basic 
numbers
      */
 
-    private static volatile boolean stopped = false;
-
     public static void main(String[] arguments) throws Exception
     {
         System.exit(run(arguments));
@@ -101,52 +97,11 @@ public final class Stress
                 logout.addStream(new 
PrintStream(settings.graph.temporaryLogFile));
             }
 
-            if (settings.sendToDaemon != null)
-            {
-                Socket socket = new Socket(settings.sendToDaemon, 2159);
-
-                ObjectOutputStream out = new 
ObjectOutputStream(socket.getOutputStream());
-                BufferedReader inp = new BufferedReader(new 
InputStreamReader(socket.getInputStream()));
-
-                Runtime.getRuntime().addShutdownHook(new ShutDown(socket, 
out));
-
-                out.writeObject(settings);
-
-                String line;
-
-                try
-                {
-                    while (!socket.isClosed() && (line = inp.readLine()) != 
null)
-                    {
-                        if (line.equals("END") || line.equals("FAILURE"))
-                        {
-                            out.writeInt(1);
-                            break;
-                        }
-
-                        logout.println(line);
-                    }
-                }
-                catch (SocketException e)
-                {
-                    if (!stopped)
-                        e.printStackTrace();
-                }
-
-                out.close();
-                inp.close();
-
-                socket.close();
-            }
-            else
-            {
-                StressAction stressAction = new StressAction(settings, logout);
-                stressAction.run();
-                logout.flush();
-                if (settings.graph.inGraphMode())
-                    new StressGraph(settings, arguments).generateGraph();
-            }
-
+            StressAction stressAction = new StressAction(settings, logout);
+            stressAction.run();
+            logout.flush();
+            if (settings.graph.inGraphMode())
+                new StressGraph(settings, arguments).generateGraph();
         }
         catch (Throwable t)
         {
@@ -164,37 +119,4 @@ public final class Stress
     {
         StressSettings.printHelp();
     }
-
-    private static class ShutDown extends Thread
-    {
-        private final Socket socket;
-        private final ObjectOutputStream out;
-
-        public ShutDown(Socket socket, ObjectOutputStream out)
-        {
-            this.out = out;
-            this.socket = socket;
-        }
-
-        public void run()
-        {
-            try
-            {
-                if (!socket.isClosed())
-                {
-                    System.out.println("Control-C caught. Canceling running 
action and shutting down...");
-
-                    out.writeInt(1);
-                    out.close();
-
-                    stopped = true;
-                }
-            }
-            catch (IOException e)
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-
 }
diff --git a/tools/stress/src/org/apache/cassandra/stress/StressServer.java 
b/tools/stress/src/org/apache/cassandra/stress/StressServer.java
deleted file mode 100644
index c00fb5452d..0000000000
--- a/tools/stress/src/org/apache/cassandra/stress/StressServer.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
-* 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.cassandra.stress;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.commons.cli.*;
-
-import org.apache.cassandra.concurrent.NamedThreadFactory;
-import org.apache.cassandra.stress.settings.StressSettings;
-import org.apache.cassandra.stress.util.MultiResultLogger;
-import org.apache.cassandra.stress.util.ResultLogger;
-
-public class StressServer
-{
-    private static final Options availableOptions = new Options();
-
-    static
-    {
-        availableOptions.addOption("h", "host", true, "Host to listen for 
connections.");
-    }
-
-    private static final AtomicInteger threadCounter = new AtomicInteger(1);
-
-    public static void main(String[] args) throws Exception
-    {
-        ServerSocket serverSocket = null;
-        CommandLineParser parser  = new PosixParser();
-
-        InetAddress address = InetAddress.getByName("127.0.0.1");
-
-        try
-        {
-            CommandLine cmd = parser.parse(availableOptions, args);
-
-            if (cmd.hasOption("h"))
-            {
-                address = InetAddress.getByName(cmd.getOptionValue("h"));
-            }
-        }
-        catch (ParseException e)
-        {
-            System.err.printf("Usage: ./bin/stressd start|stop|status [-h 
<host>]");
-            System.exit(1);
-        }
-
-        try
-        {
-            serverSocket = new ServerSocket(2159, 0, address);
-        }
-        catch (IOException e)
-        {
-            System.err.printf("Could not listen on port: %s:2159.%n", 
address.getHostAddress());
-            System.exit(1);
-        }
-
-        for (;;)
-            new StressThread(serverSocket.accept()).start();
-    }
-
-    public static class StressThread extends Thread
-    {
-        private final Socket socket;
-
-        public StressThread(Socket client)
-        {
-            this.socket = client;
-        }
-
-        public void run()
-        {
-            try
-            {
-                ObjectInputStream in = new 
ObjectInputStream(socket.getInputStream());
-                PrintStream out = new PrintStream(socket.getOutputStream());
-                ResultLogger log = new MultiResultLogger(out);
-
-                StressAction action = new StressAction((StressSettings) 
in.readObject(), log);
-                Thread actionThread = NamedThreadFactory.createThread(action, 
"stress-" + threadCounter.incrementAndGet());
-                actionThread.start();
-
-                while (actionThread.isAlive())
-                {
-                    try
-                    {
-                        if (in.readInt() == 1)
-                        {
-                            actionThread.interrupt();
-                            break;
-                        }
-                    }
-                    catch (Exception e)
-                    {
-                        // continue without problem
-                    }
-                }
-
-                out.close();
-                in.close();
-                socket.close();
-            }
-            catch (IOException e)
-            {
-                throw new RuntimeException(e.getMessage(), e);
-            }
-            catch (Exception e)
-            {
-                e.printStackTrace();
-            }
-        }
-
-    }
-
-}
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/settings/CliOption.java 
b/tools/stress/src/org/apache/cassandra/stress/settings/CliOption.java
index 018669a3ce..eba276e241 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/CliOption.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/CliOption.java
@@ -37,7 +37,6 @@ public enum CliOption
     LOG("Where to log progress to, and the interval at which to do it", 
SettingsLog.helpPrinter()),
     TRANSPORT("Custom transport factories", SettingsTransport.helpPrinter()),
     PORT("The port to connect to cassandra nodes on", 
SettingsPort.helpPrinter()),
-    SENDTO("-send-to", "Specify a stress server to send this command to", 
SettingsMisc.sendToDaemonHelpPrinter()),
     GRAPH("-graph", "Graph recorded metrics", SettingsGraph.helpPrinter()),
     TOKENRANGE("Token range settings", SettingsTokenRange.helpPrinter())
     ;
diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/Legacy.java 
b/tools/stress/src/org/apache/cassandra/stress/settings/Legacy.java
index ba94e3f170..c026874159 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/Legacy.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/Legacy.java
@@ -65,7 +65,6 @@ public class Legacy implements Serializable
         availableOptions.addOption("R",  "replication-strategy", true,   
"Replication strategy to use (only on insert if keyspace does not exist), 
default:org.apache.cassandra.locator.SimpleStrategy");
         availableOptions.addOption("O",  "strategy-properties",  true,   
"Replication strategy properties in the following format 
<dc_name>:<num>,<dc_name>:<num>,...");
         availableOptions.addOption("V",  "average-size-values",  false,  
"Generate column values of average rather than specific size");
-        availableOptions.addOption("T",  "send-to",              true,   "Send 
this as a request to the stress daemon at specified address.");
         availableOptions.addOption("I",  "compression",          true,   
"Specify the compression to use for sstable, default:no compression");
         availableOptions.addOption("Q",  "query-names",          true,   
"Comma-separated list of column names to retrieve from each row.");
         availableOptions.addOption("Z",  "compaction-strategy",  true,   
"CompactionStrategy to use.");
@@ -238,10 +237,6 @@ public class Legacy implements Serializable
             if (cmd.hasOption("D"))
                 r.add("-node", "file=" + cmd.getOptionValue("D"));
 
-
-            if (cmd.hasOption("send-to"))
-                r.add("-send-to", cmd.getOptionValue("send-to"));
-
             if (cmd.hasOption("Z"))
                 r.add("-schema", "compaction=" + cmd.getOptionValue("Z"));
 
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java 
b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
index 314774a0c5..af10719a6f 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommand.java
@@ -233,16 +233,4 @@ public abstract class SettingsCommand implements 
Serializable
     {
         GroupedOptions.printOptions(System.out, type.toLowerCase(), new 
Uncertainty(), new Count(), new Duration());
     }
-
-    static Runnable helpPrinter(final Command type)
-    {
-        return new Runnable()
-        {
-            @Override
-            public void run()
-            {
-                printHelp(type);
-            }
-        };
-    }
 }
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java 
b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java
index 3e69754423..1f21a61da2 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java
@@ -216,29 +216,4 @@ class SettingsMisc implements Serializable
             }
         });
     }
-
-    static Runnable sendToDaemonHelpPrinter()
-    {
-        return () -> {
-            System.out.println("Usage: -sendto <host>");
-            System.out.println();
-            System.out.println("Specify a host running the stress server to 
send this stress command to");
-        };
-    }
-
-    static String getSendToDaemon(Map<String, String[]> clArgs)
-    {
-        String[] params = clArgs.remove("-send-to");
-        if (params == null)
-            params = clArgs.remove("-sendto");
-        if (params == null)
-            return null;
-        if (params.length != 1)
-        {
-            sendToDaemonHelpPrinter().run();
-            System.out.println("Invalid -sendto specifier: " + 
Arrays.toString(params));
-            System.exit(1);
-        }
-        return params[0];
-    }
 }
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java 
b/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java
index 7026eb0cce..e402173309 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java
@@ -43,7 +43,6 @@ public class StressSettings implements Serializable
     public final SettingsSchema schema;
     public final SettingsTransport transport;
     public final SettingsPort port;
-    public final String sendToDaemon;
     public final SettingsGraph graph;
     public final SettingsTokenRange tokenRange;
 
@@ -59,7 +58,6 @@ public class StressSettings implements Serializable
                           SettingsSchema schema,
                           SettingsTransport transport,
                           SettingsPort port,
-                          String sendToDaemon,
                           SettingsGraph graph,
                           SettingsTokenRange tokenRange)
     {
@@ -75,7 +73,6 @@ public class StressSettings implements Serializable
         this.schema = schema;
         this.transport = transport;
         this.port = port;
-        this.sendToDaemon = sendToDaemon;
         this.graph = graph;
         this.tokenRange = tokenRange;
     }
@@ -190,7 +187,6 @@ public class StressSettings implements Serializable
         SettingsCommand command = SettingsCommand.get(clArgs);
         if (command == null)
             throw new IllegalArgumentException("No command specified");
-        String sendToDaemon = SettingsMisc.getSendToDaemon(clArgs);
         SettingsPort port = SettingsPort.get(clArgs);
         SettingsRate rate = SettingsRate.get(clArgs, command);
         SettingsPopulation generate = SettingsPopulation.get(clArgs, command);
@@ -221,7 +217,7 @@ public class StressSettings implements Serializable
             System.exit(1);
         }
 
-        return new StressSettings(command, rate, generate, insert, columns, 
errors, log, mode, node, schema, transport, port, sendToDaemon, graph, 
tokenRange);
+        return new StressSettings(command, rate, generate, insert, columns, 
errors, log, mode, node, schema, transport, port, graph, tokenRange);
     }
 
     private static Map<String, String[]> parseMap(String[] args)
@@ -295,8 +291,6 @@ public class StressSettings implements Serializable
         transport.printSettings(out);
         out.println("Port:");
         port.printSettings(out);
-        out.println("Send To Daemon:");
-        out.printf("  " + (sendToDaemon != null ? sendToDaemon : "*not set*") 
+ "%n");
         out.println("Graph:");
         graph.printSettings(out);
         out.println("TokenRange:");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to