Permalink
Browse files

Added the ability to pass in JDBC information for the ProcedureStats …

…collector. Added SQLite JDBC jar.
  • Loading branch information...
1 parent 4449c7a commit d71b4dbdc5cff10fab1e5e045cf51977fe088eeb @apavlo committed Mar 24, 2012
View
@@ -1571,10 +1571,9 @@ BENCHMARKS
<!-- Actual number of connections opened to cluster will be:
NUMCONNECTIONS * CLIENTCOUNT * PROCESSESPERCLIENT * HOSTCOUNT -->
<arg value="NUMCONNECTIONS=${numconnections}" />
-<!-- <arg value="STATSTAG=${statsTag}" /> -->
-<!-- <arg value="STATSDATABASEURL=${statsDatabaseURL}" /> -->
- <arg value="APPLICATIONNAME=${applicationName}" />
- <arg value="SUBAPPLICATIONNAME=${subApplicationName}" />
+ <arg value="STATSTAG=${statsTag}" />
+ <arg value="STATSDATABASEURL=${statsDatabaseURL}" />
+ <arg value="STATSDATABASEJDBC=${statsDatabaseJDBC}" />
<!-- measureoverhead parameters -->
<arg value="transaction=${transaction}"/>
@@ -21,13 +21,17 @@
import java.sql.DriverManager;
import java.sql.SQLException;
+import org.apache.log4j.Logger;
+
/**
* Encapsulates configuration settings for client statistics loading. This is not production
* ready and the schema is subject to change and there are no tools provided to initialize a database
* with the schema nor is the schema documented.
*
*/
public class StatsUploaderSettings {
+ private static final Logger LOG = Logger.getLogger(StatsUploaderSettings.class);
+
final String databaseURL;
final String applicationName;
final String subApplicationName;
@@ -69,6 +73,8 @@ public StatsUploaderSettings(
throw new RuntimeException(msg);
}
+ if (LOG.isDebugEnabled())
+ LOG.debug("Creating new connection to stats database [" + databaseURL + "]");
try {
conn = DriverManager.getConnection(databaseURL);
conn.setAutoCommit(false);
@@ -765,6 +765,7 @@ public BenchmarkComponent(String args[]) {
boolean noConnections = false;
boolean noUploading = false;
String statsDatabaseURL = null;
+ String statsDatabaseJDBC = null;
int statsPollInterval = 10000;
File catalogPath = null;
String projectName = null;
@@ -840,6 +841,9 @@ else if (parts[0].equalsIgnoreCase("WAIT")) {
else if (parts[0].equalsIgnoreCase("STATSDATABASEURL")) {
statsDatabaseURL = parts[1];
}
+ else if (parts[0].equalsIgnoreCase("STATSDATABASEJDBC")) {
+ statsDatabaseJDBC = parts[1];
+ }
else if (parts[0].equalsIgnoreCase("STATSPOLLINTERVAL")) {
statsPollInterval = Integer.parseInt(parts[1]);
}
@@ -885,7 +889,12 @@ else if (parts[0].toLowerCase().startsWith(HStoreConstants.BENCHMARK_PARAM_PREFI
StatsUploaderSettings statsSettings = null;
if (statsDatabaseURL != null && statsDatabaseURL.isEmpty() == false) {
+ LOG.info("statsDatabaseURL => " + statsDatabaseURL);
+
try {
+ if (statsDatabaseJDBC != null && statsDatabaseJDBC.isEmpty() == false) {
+ Class.forName(statsDatabaseJDBC);
+ }
statsSettings = new StatsUploaderSettings(
statsDatabaseURL,
projectName,
@@ -66,8 +66,11 @@
public String snapshotPrefix;
public String snapshotFrequency;
public int snapshotRetain;
+
public String statsDatabaseURL;
+ public String statsDatabaseJDBC;
public int statsPollInterval;
+
public String resultsDatabaseURL;
public String statsTag;//Identifies the result set
public String applicationName;
@@ -193,6 +196,7 @@ public BenchmarkConfig(
int snapshotRetain,
String statsDatabaseURL,
String resultsDatabaseURL,
+ String statsDatabaseJDBC,
int statsPollInterval,
String statsTag,
String applicationName,
@@ -242,10 +246,14 @@ public BenchmarkConfig(
this.snapshotPrefix = snapshotPrefix;
this.snapshotFrequency = snapshotFrequency;
this.snapshotRetain = snapshotRetain;
+
this.resultsDatabaseURL = resultsDatabaseURL;
+
this.statsDatabaseURL = statsDatabaseURL;
+ this.statsDatabaseJDBC = statsDatabaseJDBC;
this.statsTag = statsTag;
this.statsPollInterval = statsPollInterval;
+
this.applicationName = applicationName;
this.subApplicationName = subApplicationName;
@@ -663,6 +663,7 @@ public void startClients() {
allClientArgs.add("CHECKTRANSACTION=" + m_config.checkTransaction);
allClientArgs.add("CHECKTABLES=" + m_config.checkTables);
allClientArgs.add("STATSDATABASEURL=" + m_config.statsDatabaseURL);
+ allClientArgs.add("STATSDATABASEJDBC=" + m_config.statsDatabaseJDBC);
allClientArgs.add("STATSPOLLINTERVAL=" + m_config.statsPollInterval);
// allClientArgs.add("STATSTAG=" + m_config.statsTag);
allClientArgs.add("LOADER=false");
@@ -1247,6 +1248,7 @@ public static void main(final String[] vargs) throws Exception {
// from a "mysqlp" file
// set value to null on failure
String[] databaseURL = { "", "" };
+ String statsDatabaseJDBC = null;
int statsPollInterval = 1000;
// try {
// databaseURL = readConnectionStringFromFile(remotePath);
@@ -1367,9 +1369,15 @@ public static void main(final String[] vargs) throws Exception {
snapshotRetain = Integer.parseInt(parts[1]);
} else if (parts[0].equalsIgnoreCase("NUMCONNECTIONS")) {
clientParams.put(parts[0], parts[1]);
- } else if (parts[0].equalsIgnoreCase("STATSDATABASEURL")) {
+
+ }
+ else if (parts[0].equalsIgnoreCase("STATSDATABASEURL")) {
databaseURL[0] = parts[1];
- } else if (parts[0].equalsIgnoreCase("STATSTAG")) {
+ }
+ else if (parts[0].equalsIgnoreCase("STATSDATABASEJDBC")) {
+ statsDatabaseJDBC = parts[1];
+ }
+ else if (parts[0].equalsIgnoreCase("STATSTAG")) {
statsTag = parts[1];
} else if (parts[0].equalsIgnoreCase("CATALOG")) {
@@ -1571,6 +1579,7 @@ else if (parts[0].equalsIgnoreCase("HOST")) {
snapshotRetain,
databaseURL[0],
databaseURL[1],
+ statsDatabaseJDBC,
statsPollInterval,
statsTag,
applicationName,
Binary file not shown.

0 comments on commit d71b4db

Please sign in to comment.