Commit 7c7f026c authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:3028] Suppress engine status on failed assert for tests that expect to fail.

git-svn-id: file:///svn/toku/tokudb@25860 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6976c1b5
......@@ -532,6 +532,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -547,6 +547,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -553,6 +553,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -553,6 +553,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -557,6 +557,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -744,6 +744,7 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf("void db_env_set_recover_callback2 (void (*)(void*), void*) %s;\n", VISIBLE);
printf("void db_env_set_loader_size_factor (uint32_t) %s;\n", VISIBLE);
printf("void db_env_set_mvcc_garbage_collection_verification(u_int32_t) %s;\n", VISIBLE);
printf("void db_env_enable_engine_status(u_int32_t) %s;\n", VISIBLE);
printf("#if defined(__cplusplus)\n}\n#endif\n");
printf("#endif\n");
return 0;
......
......@@ -491,6 +491,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -491,6 +491,7 @@ void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visib
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -24,6 +24,7 @@
db_env_set_recover_callback2;
db_env_set_loader_size_factor;
db_env_set_mvcc_garbage_collection_verification;
db_env_enable_engine_status;
toku_os_get_max_rss;
......
......@@ -365,6 +365,7 @@ static int run_test(void)
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->set_default_bt_compare(env, tpch_dbt_cmp); CKERR(r);
// select which TPC-H table to load
if ( USE_REGION ) {
......
......@@ -15,6 +15,7 @@ static void run_test (void) {
DB_ENV *env;
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
DB *db;
......@@ -30,6 +31,7 @@ static void run_recover (void) {
// run recovery
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
exit(0);
......@@ -40,6 +42,7 @@ static void run_no_recover (void) {
int r;
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
exit(0);
......
......@@ -25,6 +25,7 @@ static void run_test (void) {
DB_ENV *env;
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
DB *dba;
......@@ -68,6 +69,7 @@ static void run_recover (void) {
CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == DB_RUNRECOVERY);
......@@ -87,6 +89,7 @@ static void run_no_recover (void) {
int r;
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
exit(0);
......
......@@ -25,6 +25,7 @@ static void run_test (void) {
DB *dba;
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r);
......@@ -58,6 +59,7 @@ static void run_recover (void) {
CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR2(r, DB_RUNRECOVERY);
......@@ -77,6 +79,7 @@ static void run_no_recover (void) {
int r;
r = db_env_create(&env, 0); CKERR(r);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
exit(0);
......
......@@ -33,6 +33,7 @@ static void insert_some (int outeri, BOOL close_env) {
DB *db;
DB_TXN *tid;
r=db_env_create(&env, 0); assert(r==0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
......@@ -84,6 +85,7 @@ static void make_db (BOOL close_env) {
CKERR(r);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
......
......@@ -32,8 +32,10 @@ static void insert_some (int outeri, BOOL close_env) {
DB *db;
DB_TXN *tid;
r=db_env_create(&env, 0); assert(r==0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
......@@ -76,6 +78,7 @@ static void make_db (BOOL close_env) {
CKERR(r);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
......
......@@ -32,6 +32,7 @@ static void insert_some (int outeri, BOOL close_env) {
DB *db;
DB_TXN *tid;
r=db_env_create(&env, 0); assert(r==0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
......@@ -76,6 +77,7 @@ static void make_db (BOOL close_env) {
CKERR(r);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r=env->set_lk_max_locks(env, 2*maxcount); CKERR(r);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
......
......@@ -20,6 +20,7 @@ test_truncate_txn_abort (int n) {
DBC *cursor;
r = db_env_create(&env, 0); assert(r == 0);
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
r = env->open(env, ENVDIR, DB_INIT_MPOOL + DB_INIT_LOCK + DB_INIT_TXN + DB_PRIVATE + DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); assert(r == 0);
int i;
......
......@@ -66,6 +66,8 @@ static u_int64_t logsuppressfail; // number of times unable to suppre
static time_t startuptime; // timestamp of system startup
static DB_ENV * most_recent_env; // most recently opened env, used for engine status on crash
static uint32_t engine_status_enable = 1; // if zero, suppress engine status output on failed assert, for test programs only
static void
init_status_info(void) {
num_inserts = 0;
......@@ -2071,7 +2073,14 @@ int (*toku_maybe_get_engine_status_text_p)(char* buff, int buffsize) = toku_mayb
static int
toku_maybe_get_engine_status_text (char * buff, int buffsize) {
DB_ENV * env = most_recent_env;
int r = env_get_engine_status_text(env, buff, buffsize);
int r;
if (engine_status_enable) {
r = env_get_engine_status_text(env, buff, buffsize);
}
else {
r = ENODATA;
snprintf(buff, buffsize, "Engine status not available: disabled by user. This should only happen in test programs.\n");
}
return r;
}
......@@ -2088,6 +2097,8 @@ toku_env_create(DB_ENV ** envp, u_int32_t flags) {
int r = ENOSYS;
DB_ENV* result = NULL;
engine_status_enable = 1;
if (flags!=0) { r = EINVAL; goto cleanup; }
MALLOC(result);
if (result == 0) { r = ENOMEM; goto cleanup; }
......@@ -5915,7 +5926,11 @@ db_env_set_mvcc_garbage_collection_verification(u_int32_t verification_mode) {
garbage_collection_debug = (verification_mode != 0);
}
// Purpose: allow test programs that expect to fail to suppress engine status output on failed assert.
void
db_env_enable_engine_status(uint32_t enable) {
engine_status_enable = enable;
}
// HACK: To ensure toku_pthread_yield gets included in the .so
// non-static would require a prototype in a header
......
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