Commit 50ceb080 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4144] add command line flags --num_update_threads, --update_txn_size,

and --no-crash_on_update_failure


git-svn-id: file:///svn/toku/tokudb@36985 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2aec9642
......@@ -50,10 +50,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 5 + cli_args->num_ptquery_threads;
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
......@@ -77,10 +77,12 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[3].operation = scan_op;
// make the guy that updates the db
myargs[4].operation = update_op;
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
myargs[i].operation = update_op;
}
// make the guy that does point queries
for (int i = 5; i < num_threads; i++) {
for (int i = 4 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].operation = ptquery_op;
}
......
......@@ -20,14 +20,14 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
int n = cli_args->num_elements;
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 1;
const int num_threads = cli_args->num_update_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
// make the guy that updates the db
myargs[i].operation = update_op;
}
// make the guy that updates the db
myargs[0].operation = update_op;
int num_seconds = random() % cli_args->time_of_test;
run_workers(myargs, num_threads, num_seconds, true);
......
......@@ -43,17 +43,17 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
//
// the threads that we want:
// - one thread constantly updating random values
// - some threads constantly updating random values
// - one thread doing table scan with bulk fetch
// - one thread doing table scan without bulk fetch
// - one thread doing random point queries
// - some threads doing random point queries
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 5 + cli_args->num_ptquery_threads;
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
......@@ -77,13 +77,15 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[3].operation = scan_op;
// make the guy that updates the db
myargs[4].operation = update_op;
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
myargs[i].operation = update_op;
}
// make the guy that does point queries
for (int i = 5; i < num_threads; i++) {
for (int i = 4 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].operation = ptquery_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false);
}
......
......@@ -44,10 +44,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 5 + cli_args->num_ptquery_threads;
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
......@@ -71,11 +71,13 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[3].operation = scan_op;
// make the guy that updates the db
myargs[4].bounded_update_range = false;
myargs[4].operation = update_op;
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
myargs[i].bounded_update_range = false;
myargs[i].operation = update_op;
}
// make the guy that does point queries
for (int i = 5; i < num_threads; i++) {
for (int i = 4 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].bounded_update_range = false;
myargs[i].operation = ptquery_op_no_check;
}
......
......@@ -42,10 +42,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
// - one thread doing random point queries
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 6 + cli_args->num_ptquery_threads;
const int num_threads = 5 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
......@@ -69,16 +69,18 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[3].operation = scan_op;
// make the guy that updates the db
myargs[4].lock_type = STRESS_LOCK_SHARED;
myargs[4].operation = update_op;
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
myargs[i].lock_type = STRESS_LOCK_SHARED;
myargs[i].operation = update_op;
}
// make the guy that sends update broadcasts
myargs[5].lock_type = STRESS_LOCK_EXCL;
myargs[5].sleep_ms = cli_args->update_broadcast_period_ms;
myargs[5].operation = update_broadcast_op;
myargs[4 + cli_args->num_update_threads].lock_type = STRESS_LOCK_EXCL;
myargs[4 + cli_args->num_update_threads].sleep_ms = cli_args->update_broadcast_period_ms;
myargs[4 + cli_args->num_update_threads].operation = update_broadcast_op;
// make the guys that do point queries
for (int i = 6; i < num_threads; i++) {
for (int i = 5 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].operation = ptquery_op;
}
......
......@@ -42,10 +42,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
// - one thread doing random point queries
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 5 + cli_args->num_ptquery_threads;
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
......@@ -69,18 +69,22 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[3].operation = scan_op_no_check;
// make the guy that updates the db
myargs[4].update_history_buffer = toku_xmalloc(n * (sizeof myargs[4].update_history_buffer[0]));
memset(myargs[4].update_history_buffer, 0, n * (sizeof myargs[4].update_history_buffer[0]));
myargs[4].operation = update_with_history_op;
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
myargs[i].update_history_buffer = toku_xmalloc(n * (sizeof myargs[i].update_history_buffer[0]));
memset(myargs[i].update_history_buffer, 0, n * (sizeof myargs[i].update_history_buffer[0]));
myargs[i].operation = update_with_history_op;
}
// make the guys that do point queries
for (int i = 5; i < num_threads; i++) {
for (int i = 4 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].operation = ptquery_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false);
toku_free(myargs[4].update_history_buffer);
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
toku_free(myargs[i].update_history_buffer);
}
}
int
......
......@@ -24,10 +24,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 5 + cli_args->num_ptquery_threads;
const int num_threads = 4 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
myargs[0].fast = TRUE;
......@@ -40,12 +40,15 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[1].operation = scan_op;
// make the guy that updates the db
myargs[2].operation = update_op;
myargs[3].operation = loader_op;
myargs[4].operation = keyrange_op;
myargs[2].operation = loader_op;
myargs[3].operation = keyrange_op;
for (int i = 4; i < 4 + cli_args->num_update_threads; ++i) {
myargs[i].operation = update_op;
}
// make the guy that does point queries
for (int i = 5; i < num_threads; i++) {
for (int i = 4 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].operation = ptquery_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false);
......
......@@ -44,10 +44,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 7 + cli_args->num_ptquery_threads;
const int num_threads = 6 + cli_args->num_update_threads + cli_args->num_ptquery_threads;
struct arg myargs[num_threads];
for (int i = 0; i < num_threads; i++) {
arg_init(&myargs[i], n, dbp, env);
arg_init(&myargs[i], n, dbp, env, cli_args);
}
// make the forward fast scanner
......@@ -74,22 +74,24 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
myargs[3].lock_type = STRESS_LOCK_SHARED;
myargs[3].operation = scan_op;
// make the guy that updates the db
myargs[4].bounded_update_range = false;
myargs[4].lock_type = STRESS_LOCK_SHARED;
myargs[4].operation = update_op;
// make the guy that removes and recreates the db
myargs[4].lock_type = STRESS_LOCK_EXCL;
myargs[4].sleep_ms = 2000; // maybe make this a runtime param at some point
myargs[4].operation = remove_and_recreate_me;
myargs[5].lock_type = STRESS_LOCK_EXCL;
myargs[5].sleep_ms = 2000; // maybe make this a runtime param at some point
myargs[5].operation = remove_and_recreate_me;
myargs[5].operation = truncate_me;
myargs[6].lock_type = STRESS_LOCK_EXCL;
myargs[6].sleep_ms = 2000; // maybe make this a runtime param at some point
myargs[6].operation = truncate_me;
// make the guy that updates the db
for (int i = 6; i < 6 + cli_args->num_update_threads; ++i) {
myargs[i].bounded_update_range = false;
myargs[i].lock_type = STRESS_LOCK_SHARED;
myargs[i].operation = update_op;
}
// make the guy that does point queries
for (int i = 7; i < num_threads; i++) {
for (int i = 6 + cli_args->num_update_threads; i < num_threads; i++) {
myargs[i].lock_type = STRESS_LOCK_SHARED;
myargs[i].bounded_update_range = false;
myargs[i].operation = ptquery_op_no_check;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment