BIND 10 stephen-innodb, updated. 71d62bfab3b7f7017b516a8a662332849b537070 [stephen-innodb] Use InnoDB engine for asynchronous MySQL DHCP Tests
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 28 15:55:43 UTC 2012
The branch, stephen-innodb has been updated
via 71d62bfab3b7f7017b516a8a662332849b537070 (commit)
from ae65cad3fbe923329f674694614e0af560c37018 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 71d62bfab3b7f7017b516a8a662332849b537070
Author: Stephen Morris <stephen at isc.org>
Date: Fri Sep 28 16:45:59 2012 +0100
[stephen-innodb] Use InnoDB engine for asynchronous MySQL DHCP Tests
All MySQL tests use the InnoDB engine: autocommit is enabled for a
synchronous test and disabled for an asynchronous one. In both
cases, a final commit is made just prior to disconnecting from the
database.
Added timers to measure the time taken to connect and disconnect (the
latter being an upper limit on the time taken to do a commit).
Converted some variables to "unsigned long" to avoid warnings from
g++ compiler.
Fixed bug whereby 100 leases were created but only 99 deleted.
-----------------------------------------------------------------------
Summary of changes:
tests/tools/dhcp-ubench/benchmark.cc | 24 ++++++++++++++----------
tests/tools/dhcp-ubench/benchmark.h | 4 ++--
tests/tools/dhcp-ubench/mysql_ubench.cc | 29 ++++++++++++++---------------
3 files changed, 30 insertions(+), 27 deletions(-)
-----------------------------------------------------------------------
diff --git a/tests/tools/dhcp-ubench/benchmark.cc b/tests/tools/dhcp-ubench/benchmark.cc
index c987bf5..cbae814 100644
--- a/tests/tools/dhcp-ubench/benchmark.cc
+++ b/tests/tools/dhcp-ubench/benchmark.cc
@@ -148,33 +148,37 @@ int uBenchmark::run() {
srandom(time(NULL));
try {
- connect();
-
ts_[0] = getTime();
- createLease4Test();
+ connect();
ts_[1] = getTime();
- searchLease4Test();
+ createLease4Test();
ts_[2] = getTime();
- updateLease4Test();
+ searchLease4Test();
ts_[3] = getTime();
- deleteLease4Test();
+ updateLease4Test();
ts_[4] = getTime();
+ deleteLease4Test();
+ ts_[5] = getTime();
+
disconnect();
+ ts_[6] = getTime();
} catch (const std::string& e) {
cout << "Failed: " << e << endl;
return (-1);
}
- printClock("Create leases4", num_, ts_[0], ts_[1]);
- printClock("Search leases4", num_, ts_[1], ts_[2]);
- printClock("Update leases4", num_, ts_[2], ts_[3]);
- printClock("Delete leases4", num_, ts_[3], ts_[4]);
+ printClock("Connect time ", 1, ts_[0], ts_[1]);
+ printClock("Create leases4 ", num_, ts_[1], ts_[2]);
+ printClock("Search leases4 ", num_, ts_[2], ts_[3]);
+ printClock("Update leases4 ", num_, ts_[3], ts_[4]);
+ printClock("Delete leases4 ", num_, ts_[4], ts_[5]);
+ printClock("Disconnect time", 1, ts_[5], ts_[6]);
return (0);
}
diff --git a/tests/tools/dhcp-ubench/benchmark.h b/tests/tools/dhcp-ubench/benchmark.h
index 6001e81..b0deaa4 100644
--- a/tests/tools/dhcp-ubench/benchmark.h
+++ b/tests/tools/dhcp-ubench/benchmark.h
@@ -199,8 +199,8 @@ protected:
/// benchmarks must generate the leases starting from 1.0.0.0 address
const static uint32_t BASE_ADDR4 = 0x01000000;
- /// five timestamps (1 at the beginning and 4 after each step)
- struct timespec ts_[5];
+ /// seven timestamps (1 at the beginning and 5 after each step)
+ struct timespec ts_[7];
/// should compiled statements be used?
bool compiled_stmt_;
diff --git a/tests/tools/dhcp-ubench/mysql_ubench.cc b/tests/tools/dhcp-ubench/mysql_ubench.cc
index b2f58c2..525ad66 100644
--- a/tests/tools/dhcp-ubench/mysql_ubench.cc
+++ b/tests/tools/dhcp-ubench/mysql_ubench.cc
@@ -41,8 +41,6 @@ void MySQL_uBenchmark::stmt_failure(MYSQL_STMT * stmt, const char* operation) {
throw tmp.str();
}
-
-
void MySQL_uBenchmark::failure(const char* operation) {
stringstream tmp;
tmp << "Error " << mysql_errno(conn_) << " during " << operation
@@ -71,19 +69,21 @@ void MySQL_uBenchmark::connect() {
failure("dropping old lease4 entries.");
}
- q = "ALTER TABLE lease4 engine=";
- if (sync_) {
- q += "InnoDB";
- } else {
- q += "MyISAM";
- }
+ q = "ALTER TABLE lease4 engine=InnoDB";
if (mysql_query(conn_, q.c_str())) {
q = "Failed to run query:" + q;
failure(q.c_str());
}
+
+ if (mysql_autocommit(conn_, sync_ ? 1 : 0)) {
+ failure("Failed to disable autocommit");
+ }
}
void MySQL_uBenchmark::disconnect() {
+ if (mysql_commit(conn_)) {
+ failure("Failed to commit changes to the database");
+ }
if (!conn_) {
throw "NULL MySQL connection pointer.";
}
@@ -98,14 +98,14 @@ void MySQL_uBenchmark::createLease4Test() {
uint32_t addr = BASE_ADDR4; // Let's start with 1.0.0.0 address
char hwaddr[20];
- size_t hwaddr_len = 20; // Not a real field
+ unsigned long hwaddr_len = 20; // Not a real field
char client_id[128];
- size_t client_id_len = 128;
+ unsigned long client_id_len = 128;
uint32_t valid_lft = 1000; // We can use the same value for all leases
uint32_t recycle_time = 7; // not supported in any foresable future,
char cltt[48]; // timestamp (specified as text)
- size_t cltt_len;
+ unsigned long cltt_len = 48;
sprintf(cltt, "2012-07-11 15:43:00");
cltt_len = strlen(cltt);
@@ -114,7 +114,7 @@ void MySQL_uBenchmark::createLease4Test() {
bool fixed = false;
char hostname[] = "foo"; // Will generate it dynamically
- size_t hostname_len;
+ unsigned long hostname_len;
hostname_len = strlen(hostname);
bool fqdn_fwd = true; // Let's pretend to do AAAA update
@@ -233,7 +233,7 @@ void MySQL_uBenchmark::createLease4Test() {
sprintf(cltt, "2012-07-11 15:43:%02d", i % 60);
- addr++;
+ addr = BASE_ADDR4 + i;
if (!compiled_stmt_) {
// the first address is 1.0.0.0.
@@ -281,7 +281,6 @@ void MySQL_uBenchmark::createLease4Test() {
failure("Failed to close compiled statement, mysql_stmt_close returned non-zero");
}
}
-
cout << endl;
}
@@ -379,7 +378,7 @@ void MySQL_uBenchmark::searchLease4Test() {
MYSQL_BIND response[11];
- size_t length[11];
+ unsigned long length[11];
my_bool is_null[11];
my_bool error[11];
More information about the bind10-changes
mailing list