mirror of https://github.com/apache/cassandra
add -D option to Stress.java to specify list of nodes in a file
patch by mdennis; reviewed by jbellis for CASSANDRA-2149 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1069207 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6fa41e5f1
commit
324ad8b886
|
|
@ -55,6 +55,11 @@
|
|||
* page through large rows when exporting to JSON (CASSANDRA-2041)
|
||||
* add flush_largest_memtables_at and reduce_cache_sizes_at options
|
||||
(CASSANDRA-2142)
|
||||
* add cli 'describe cluster' command (CASSANDRA-2127)
|
||||
* add cli support for setting username/password at 'connect' command
|
||||
(CASSANDRA-2111)
|
||||
* add -D option to Stress.java to allow reading hosts from a file
|
||||
(CASSANDRA-2149)
|
||||
* bound hints CF throughput between 32M and 256M (CASSANDRA-2148)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,23 +17,23 @@
|
|||
*/
|
||||
package org.apache.cassandra.contrib.stress;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||
import java.util.concurrent.atomic.AtomicLongArray;
|
||||
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
import org.apache.cassandra.db.ColumnFamilyType;
|
||||
import org.apache.cassandra.thrift.*;
|
||||
import org.apache.commons.cli.*;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.transport.TFramedTransport;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||
import java.util.concurrent.atomic.AtomicLongArray;
|
||||
|
||||
public class Session
|
||||
{
|
||||
// command line options
|
||||
|
|
@ -53,6 +53,7 @@ public class Session
|
|||
availableOptions.addOption("S", "column-size", true, "Size of column values in bytes, default:34");
|
||||
availableOptions.addOption("C", "cardinality", true, "Number of unique values stored in columns, default:50");
|
||||
availableOptions.addOption("d", "nodes", true, "Host nodes (comma separated), default:locahost");
|
||||
availableOptions.addOption("D", "nodesfile", true, "File containing host nodes (one per line)");
|
||||
availableOptions.addOption("s", "stdev", true, "Standard Deviation Factor, default:0.1");
|
||||
availableOptions.addOption("r", "random", false, "Use random key generator (STDEV will have no effect), default:false");
|
||||
availableOptions.addOption("f", "file", true, "Write output to given file");
|
||||
|
|
@ -130,6 +131,27 @@ public class Session
|
|||
if (cmd.hasOption("d"))
|
||||
nodes = cmd.getOptionValue("d").split(",");
|
||||
|
||||
if (cmd.hasOption("D"))
|
||||
{
|
||||
try
|
||||
{
|
||||
String node = null;
|
||||
List<String> tmpNodes = new ArrayList<String>();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(cmd.getOptionValue("D"))));
|
||||
while ((node = in.readLine()) != null)
|
||||
{
|
||||
if (node.length() > 0)
|
||||
tmpNodes.add(node);
|
||||
}
|
||||
nodes = tmpNodes.toArray(new String[tmpNodes.size()]);
|
||||
in.close();
|
||||
}
|
||||
catch(IOException ioe)
|
||||
{
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd.hasOption("s"))
|
||||
STDev = Float.parseFloat(cmd.getOptionValue("s"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue