Commit 1d34be10 authored by Yoni Fogel's avatar Yoni Fogel

closes[t:2542] Add test for loader (both PUT and fast) that verifies no logging

happens for each logger->put()

git-svn-id: file:///svn/toku/tokudb@19684 c7de825b-a66e-492c-adef-691d508d4ae1
parent cdda1ce0
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
toku_set_assert_on_write_enospc; toku_set_assert_on_write_enospc;
toku_test_db_redirect_dictionary; toku_test_db_redirect_dictionary;
toku_test_get_latest_lsn;
local: *; local: *;
}; };
......
...@@ -60,6 +60,7 @@ static void test_loader(DB **dbs) ...@@ -60,6 +60,7 @@ static void test_loader(DB **dbs)
r = loader->set_poll_function(loader, NULL, NULL); r = loader->set_poll_function(loader, NULL, NULL);
CKERR(r); CKERR(r);
uint64_t before_puts = toku_test_get_latest_lsn(env);
// using loader->put, put values into DB // using loader->put, put values into DB
DBT key, val; DBT key, val;
for(int i=0;i<NUM_KV_PAIRS;i++) { for(int i=0;i<NUM_KV_PAIRS;i++) {
...@@ -68,6 +69,8 @@ static void test_loader(DB **dbs) ...@@ -68,6 +69,8 @@ static void test_loader(DB **dbs)
r = loader->put(loader, &key, &val); r = loader->put(loader, &key, &val);
CKERR(r); CKERR(r);
} }
uint64_t after_puts = toku_test_get_latest_lsn(env);
assert(before_puts == after_puts);
// close the loader // close the loader
r = loader->close(loader); r = loader->close(loader);
...@@ -103,8 +106,12 @@ static void run_test(void) ...@@ -103,8 +106,12 @@ static void run_test(void)
int r; int r;
r = system("rm -rf " ENVDIR); CKERR(r); r = system("rm -rf " ENVDIR); CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = toku_os_mkdir(ENVDIR "/log", S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_lg_dir(env, "log");
CKERR(r);
r = env->set_default_bt_compare(env, int64_dbt_cmp); CKERR(r); r = env->set_default_bt_compare(env, int64_dbt_cmp); CKERR(r);
r = env->set_default_dup_compare(env, int64_dbt_cmp); CKERR(r); r = env->set_default_dup_compare(env, int64_dbt_cmp); CKERR(r);
r = env->set_generate_row_callback_for_put(env, put_multiple_generate); r = env->set_generate_row_callback_for_put(env, put_multiple_generate);
......
...@@ -220,6 +220,7 @@ static void test_loader(DB **dbs) ...@@ -220,6 +220,7 @@ static void test_loader(DB **dbs)
r = loader->set_poll_function(loader, poll_function, expect_poll_void); r = loader->set_poll_function(loader, poll_function, expect_poll_void);
CKERR(r); CKERR(r);
uint64_t before_puts = toku_test_get_latest_lsn(env);
// using loader->put, put values into DB // using loader->put, put values into DB
DBT key, val; DBT key, val;
unsigned int k, v; unsigned int k, v;
...@@ -232,6 +233,8 @@ static void test_loader(DB **dbs) ...@@ -232,6 +233,8 @@ static void test_loader(DB **dbs)
CKERR(r); CKERR(r);
if ( CHECK_RESULTS || verbose) { if((i%10000) == 0){printf("."); fflush(stdout);} } if ( CHECK_RESULTS || verbose) { if((i%10000) == 0){printf("."); fflush(stdout);} }
} }
uint64_t after_puts = toku_test_get_latest_lsn(env);
assert(before_puts == after_puts);
if( CHECK_RESULTS || verbose ) {printf("\n"); fflush(stdout);} if( CHECK_RESULTS || verbose ) {printf("\n"); fflush(stdout);}
poll_count=0; poll_count=0;
......
...@@ -5698,3 +5698,14 @@ toku_test_db_redirect_dictionary(DB * db, char * dname_of_new_file, DB_TXN *dbtx ...@@ -5698,3 +5698,14 @@ toku_test_db_redirect_dictionary(DB * db, char * dname_of_new_file, DB_TXN *dbtx
toku_free(new_iname_in_env); toku_free(new_iname_in_env);
return r; return r;
} }
//Tets only function
uint64_t
toku_test_get_latest_lsn(DB_ENV *env) {
LSN rval = ZERO_LSN;
if (env && env->i->logger) {
rval = toku_logger_last_lsn(env->i->logger);
}
return rval.lsn;
}
...@@ -22,4 +22,6 @@ int db_create_toku10(DB **, DB_ENV *, u_int32_t) __attribute__((__visibility__(" ...@@ -22,4 +22,6 @@ int db_create_toku10(DB **, DB_ENV *, u_int32_t) __attribute__((__visibility__("
// test only function // test only function
int toku_test_db_redirect_dictionary(DB * db, char * dname_of_new_file, DB_TXN *dbtxn) __attribute__((__visibility__("default"))); int toku_test_db_redirect_dictionary(DB * db, char * dname_of_new_file, DB_TXN *dbtxn) __attribute__((__visibility__("default")));
uint64_t toku_test_get_latest_lsn(DB_ENV *env) __attribute__((__visibility__("default")));
#endif #endif
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