Skip to content
Snippets Groups Projects
Commit ce955478 authored by hxd's avatar hxd
Browse files

[cassandra] add sigar-dist for cassandra 2.2+ test, and tracing function for recording logs

parent 0c25a3fc
No related branches found
No related tags found
No related merge requests found
...@@ -77,4 +77,7 @@ For keyspace `ycsb`, table `usertable`: ...@@ -77,4 +77,7 @@ For keyspace `ycsb`, table `usertable`:
* Defaults for max and core connections can be found here: https://datastax.github.io/java-driver/2.1.8/features/pooling/#pool-size. Cassandra 2.0.X falls under protocol V2, Cassandra 2.1+ falls under protocol V3. * Defaults for max and core connections can be found here: https://datastax.github.io/java-driver/2.1.8/features/pooling/#pool-size. Cassandra 2.0.X falls under protocol V2, Cassandra 2.1+ falls under protocol V3.
* `cassandra.connecttimeoutmillis` * `cassandra.connecttimeoutmillis`
* `cassandra.readtimeoutmillis` * `cassandra.readtimeoutmillis`
* Defaults for connect and read timeouts can be found here: https://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/SocketOptions.html. * Defaults for connect and read timeouts can be found here: https://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/SocketOptions.html.
\ No newline at end of file * `cassandra.tracing`
* Default is false
* https://docs.datastax.com/en/cql/3.3/cql/cql_reference/tracing_r.html
\ No newline at end of file
...@@ -85,6 +85,9 @@ public class CassandraCQLClient extends DB { ...@@ -85,6 +85,9 @@ public class CassandraCQLClient extends DB {
public static final String READ_TIMEOUT_MILLIS_PROPERTY = public static final String READ_TIMEOUT_MILLIS_PROPERTY =
"cassandra.readtimeoutmillis"; "cassandra.readtimeoutmillis";
public static final String TRACING_PROPERTY = "cassandra.tracing";
public static final String TRACING_PROPERTY_DEFAULT = "false";
/** /**
* Count the number of times initialized to teardown on the last * Count the number of times initialized to teardown on the last
* {@link #cleanup()}. * {@link #cleanup()}.
...@@ -93,6 +96,8 @@ public class CassandraCQLClient extends DB { ...@@ -93,6 +96,8 @@ public class CassandraCQLClient extends DB {
private static boolean debug = false; private static boolean debug = false;
private static boolean trace = false;
/** /**
* Initialize any state for this DB. Called once per DB instance; there is one * Initialize any state for this DB. Called once per DB instance; there is one
* DB instance per client thread. * DB instance per client thread.
...@@ -116,7 +121,8 @@ public class CassandraCQLClient extends DB { ...@@ -116,7 +121,8 @@ public class CassandraCQLClient extends DB {
debug = debug =
Boolean.parseBoolean(getProperties().getProperty("debug", "false")); Boolean.parseBoolean(getProperties().getProperty("debug", "false"));
trace = Boolean.valueOf(getProperties().getProperty(TRACING_PROPERTY, TRACING_PROPERTY_DEFAULT));
String host = getProperties().getProperty(HOSTS_PROPERTY); String host = getProperties().getProperty(HOSTS_PROPERTY);
if (host == null) { if (host == null) {
throw new DBException(String.format( throw new DBException(String.format(
...@@ -254,7 +260,10 @@ public class CassandraCQLClient extends DB { ...@@ -254,7 +260,10 @@ public class CassandraCQLClient extends DB {
if (debug) { if (debug) {
System.out.println(stmt.toString()); System.out.println(stmt.toString());
} }
if (trace) {
stmt.enableTracing();
}
ResultSet rs = session.execute(stmt); ResultSet rs = session.execute(stmt);
if (rs.isExhausted()) { if (rs.isExhausted()) {
...@@ -343,7 +352,10 @@ public class CassandraCQLClient extends DB { ...@@ -343,7 +352,10 @@ public class CassandraCQLClient extends DB {
if (debug) { if (debug) {
System.out.println(stmt.toString()); System.out.println(stmt.toString());
} }
if (trace) {
stmt.enableTracing();
}
ResultSet rs = session.execute(stmt); ResultSet rs = session.execute(stmt);
HashMap<String, ByteIterator> tuple; HashMap<String, ByteIterator> tuple;
...@@ -432,7 +444,10 @@ public class CassandraCQLClient extends DB { ...@@ -432,7 +444,10 @@ public class CassandraCQLClient extends DB {
if (debug) { if (debug) {
System.out.println(insertStmt.toString()); System.out.println(insertStmt.toString());
} }
if (trace) {
insertStmt.enableTracing();
}
session.execute(insertStmt); session.execute(insertStmt);
return Status.OK; return Status.OK;
...@@ -465,7 +480,10 @@ public class CassandraCQLClient extends DB { ...@@ -465,7 +480,10 @@ public class CassandraCQLClient extends DB {
if (debug) { if (debug) {
System.out.println(stmt.toString()); System.out.println(stmt.toString());
} }
if (trace) {
stmt.enableTracing();
}
session.execute(stmt); session.execute(stmt);
return Status.OK; return Status.OK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment