Commit 92766ad6 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:3972], add a keyrange_op to stress test

git-svn-id: file:///svn/toku/tokudb@35724 c7de825b-a66e-492c-adef-691d508d4ae1
parent 65e31f4a
......@@ -24,7 +24,7 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
//
if (verbose) printf("starting creation of pthreads\n");
const int num_threads = 4 + cli_args->num_ptquery_threads;
const int num_threads = 5 + 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);
......@@ -42,9 +42,10 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
// make the guy that updates the db
myargs[2].operation = update_op;
myargs[3].operation = loader_op;
myargs[4].operation = keyrange_op;
// make the guy that does point queries
for (int i = 4; i < num_threads; i++) {
for (int i = 5; i < num_threads; i++) {
myargs[i].operation = ptquery_op;
}
run_workers(myargs, num_threads, cli_args->time_of_test, false);
......
......@@ -210,6 +210,21 @@ static int UU() loader_op(DB_ENV *env, DB** UU(dbp), DB_TXN* txn, ARG UU(arg)) {
return 0;
}
static int UU() keyrange_op(DB_ENV *UU(env), DB **dbp, DB_TXN *txn, ARG arg) {
int r;
DB* db = *dbp;
int rand_key = random();
if (arg->bounded_update_range) {
rand_key = rand_key % arg->n;
}
DBT key;
dbt_init(&key, &rand_key, sizeof rand_key);
u_int64_t less,equal,greater;
int is_exact;
r = db->key_range64(db, txn, &key, &less, &equal, &greater, &is_exact);
assert(r == 0);
return r;
}
static int UU() scan_op(DB_ENV *env, DB **dbp, DB_TXN *txn, ARG arg) {
return scan_op_and_maybe_check_sum(env, dbp, txn, arg, true);
......
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