Commit 964383c6 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Candidate fix for #2999. [t:2999]

git-svn-id: file:///svn/toku/tokudb@24980 c7de825b-a66e-492c-adef-691d508d4ae1
parent ef960b35
...@@ -716,6 +716,16 @@ loader-cleanup-test0.tdbrun: loader-cleanup-test.tdb$(BINSUF) ...@@ -716,6 +716,16 @@ loader-cleanup-test0.tdbrun: loader-cleanup-test.tdb$(BINSUF)
loader-cleanup-test1.tdbrun: loader-cleanup-test.tdb$(BINSUF) loader-cleanup-test1.tdbrun: loader-cleanup-test.tdb$(BINSUF)
$(VGRIND) ./$< -s -r 8000 -p -e 1 $(SUMMARIZE_CMD) $(VGRIND) ./$< -s -r 8000 -p -e 1 $(SUMMARIZE_CMD)
ROOT_FIFO_41_RUNS = $(foreach num, $(shell seq 1 100), root_fifo_41_$(num)_populate.tdbrun root_fifo_41_$(num)_nopopulate.tdbrun)
root_fifo_41.tdbrun: $(ROOT_FIFO_41_RUNS)
@echo -n
root_fifo_41_%_populate.tdbrun: root_fifo_41.tdb
$(VGRIND) ./$< -n $(patsubst root_fifo_41_%_populate.tdbrun, %, $@) -h $(patsubst %.tdbrun, %.tdbdir, $@) -populate $(SUMMARIZE_CMD)
@rm -rf $(patsubst %.tdbrun, %.dir, $@)
root_fifo_41_%_nopopulate.tdbrun: root_fifo_41.tdb
$(VGRIND) ./$< -n $(patsubst root_fifo_41_%_nopopulate.tdbrun, %, $@) -h $(patsubst %.tdbrun, %.tdbdir, $@) $(SUMMARIZE_CMD)
@rm -rf $(patsubst %.tdbrun, %.dir, $@)
LOADER_USE_DEFAULT_TESTS = create-abort create-close no-puts reference-test stress-test tpch-load LOADER_USE_DEFAULT_TESTS = create-abort create-close no-puts reference-test stress-test tpch-load
loader-tests: $(LOADER_TESTS) loader-tests: $(LOADER_TESTS)
......
...@@ -8,12 +8,13 @@ DB *null_db = NULL; ...@@ -8,12 +8,13 @@ DB *null_db = NULL;
DB_TXN *null_txn = NULL; DB_TXN *null_txn = NULL;
DBC *null_cursor = NULL; DBC *null_cursor = NULL;
static void create_non_empty(int n) { static void create_non_empty(int n, const char *dirname) {
DB_ENV *env = null_env; DB_ENV *env = null_env;
int r; int r;
r = db_env_create(&env, 0); assert(r == 0); assert(env != NULL); r = db_env_create(&env, 0); assert(r == 0); assert(env != NULL);
r = env->set_redzone(env, 0); assert(r == 0);
r = env->open(env, r = env->open(env,
ENVDIR, dirname,
DB_INIT_MPOOL+DB_INIT_LOG+DB_INIT_LOCK+DB_INIT_TXN+DB_PRIVATE+DB_CREATE, DB_INIT_MPOOL+DB_INIT_LOG+DB_INIT_LOCK+DB_INIT_TXN+DB_PRIVATE+DB_CREATE,
S_IRWXU+S_IRWXG+S_IRWXO); S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0); assert(r == 0);
...@@ -76,23 +77,31 @@ static void root_fifo_verify(DB_ENV *env, int n, int expectn) { ...@@ -76,23 +77,31 @@ static void root_fifo_verify(DB_ENV *env, int n, int expectn) {
r = db->close(db, 0); assert(r == 0); db = null_db; r = db->close(db, 0); assert(r == 0); db = null_db;
} }
static void root_fifo_41(int n, int ntxn, BOOL do_populate) { static void root_fifo_41(int n, int ntxn, BOOL do_populate, char const* dirname) {
if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n); if (verbose) printf("%s:%d %d\n", __FUNCTION__, __LINE__, n);
int r; int r;
if (dirname==NULL) dirname=ENVDIR;
// create the env // create the env
r = system("rm -rf " ENVDIR); {
CKERR(r); int size = 20+strlen(dirname);
toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); char rmstring[size];
snprintf(rmstring, size, "rm -rf %s", dirname);
r = system(rmstring);
CKERR(r);
}
toku_os_mkdir(dirname, S_IRWXU+S_IRWXG+S_IRWXO);
// populate // populate
if (do_populate) if (do_populate)
create_non_empty(n); create_non_empty(n, dirname);
DB_ENV *env = null_env; DB_ENV *env = null_env;
r = db_env_create(&env, 0); assert(r == 0); assert(env != NULL); r = db_env_create(&env, 0); assert(r == 0); assert(env != NULL);
r = env->set_redzone(env, 0); assert(r == 0);
r = env->open(env, r = env->open(env,
ENVDIR, dirname,
DB_INIT_MPOOL+DB_INIT_LOG+DB_INIT_LOCK+DB_INIT_TXN+DB_PRIVATE+DB_CREATE, DB_INIT_MPOOL+DB_INIT_LOG+DB_INIT_LOCK+DB_INIT_TXN+DB_PRIVATE+DB_CREATE,
S_IRWXU+S_IRWXG+S_IRWXO); S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0); assert(r == 0);
...@@ -139,7 +148,19 @@ static void root_fifo_41(int n, int ntxn, BOOL do_populate) { ...@@ -139,7 +148,19 @@ static void root_fifo_41(int n, int ntxn, BOOL do_populate) {
r = env->close(env, 0); assert(r == 0); env = null_env; r = env->close(env, 0); assert(r == 0); env = null_env;
} }
static int parseint (char const *str) {
char *end;
errno=0;
int v = strtol(str, &end, 10);
if (errno!=0 || *end!=0) {
fprintf(stderr, "This argument should be an int: %s\n", str);
exit(1);
}
return v;
}
int test_main(int argc, char *const argv[]) { int test_main(int argc, char *const argv[]) {
char const* dirname = NULL;
int i; int i;
int n = -1; int n = -1;
int ntxn = -1; int ntxn = -1;
...@@ -149,31 +170,30 @@ int test_main(int argc, char *const argv[]) { ...@@ -149,31 +170,30 @@ int test_main(int argc, char *const argv[]) {
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-v") == 0) { if (strcmp(argv[i], "-v") == 0) {
verbose = 1; verbose = 1;
continue; } else if (strcmp(argv[i], "-n") == 0) {
} assert(i+1 < argc);
if (strcmp(argv[i], "-n") == 0) { n = parseint(argv[++i]);
if (i+1 < argc) } else if (strcmp(argv[i], "-ntxn") == 0) {
n = atoi(argv[++i]); assert(i+1 < argc);
continue; ntxn = parseint(argv[++i]);
} } else if (strcmp(argv[i], "-populate") == 0) {
if (strcmp(argv[i], "-ntxn") == 0) {
if (i+1 < argc)
ntxn = atoi(argv[++i]);
continue;
}
if (strcmp(argv[i], "-populate") == 0) {
do_populate = TRUE; do_populate = TRUE;
continue; } else if (strcmp(argv[i], "-h")==0) {
} assert(i+1<argc);
dirname = argv[++i];
} else {
fprintf(stderr, "What is this argument? %s\n", argv[i]);
exit(1);
}
} }
if (n >= 0) if (n >= 0)
root_fifo_41(n, ntxn == -1 ? 1 : ntxn, do_populate); root_fifo_41(n, ntxn == -1 ? 1 : ntxn, do_populate, dirname);
else { else {
for (i=0; i<100; i++) { for (i=0; i<100; i++) {
for (ntxn=1; ntxn<=4; ntxn++) { for (ntxn=1; ntxn<=4; ntxn++) {
root_fifo_41(i, ntxn, FALSE); root_fifo_41(i, ntxn, FALSE, dirname);
root_fifo_41(i, ntxn, TRUE); root_fifo_41(i, ntxn, TRUE, dirname);
} }
} }
} }
......
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