Commit a522ceda authored by Yoni Fogel's avatar Yoni Fogel

Closes #2153 refs[t:2153] fopen logged only once (unless closed and reopened)....

Closes #2153 refs[t:2153] fopen logged only once (unless closed and reopened).  Removed logger from cachefile_close,
removed txnid from logging of fopen.

git-svn-id: file:///svn/toku/tokudb.2037b@15691 c7de825b-a66e-492c-adef-691d508d4ae1
parent 28752b83
...@@ -236,7 +236,7 @@ struct brtenv { ...@@ -236,7 +236,7 @@ struct brtenv {
extern void toku_brtnode_flush_callback (CACHEFILE cachefile, BLOCKNUM nodename, void *brtnode_v, void *extraargs, long size, BOOL write_me, BOOL keep_me, BOOL for_checkpoint); extern void toku_brtnode_flush_callback (CACHEFILE cachefile, BLOCKNUM nodename, void *brtnode_v, void *extraargs, long size, BOOL write_me, BOOL keep_me, BOOL for_checkpoint);
extern int toku_brtnode_fetch_callback (CACHEFILE cachefile, BLOCKNUM nodename, u_int32_t fullhash, void **brtnode_pv, long *sizep, void*extraargs); extern int toku_brtnode_fetch_callback (CACHEFILE cachefile, BLOCKNUM nodename, u_int32_t fullhash, void **brtnode_pv, long *sizep, void*extraargs);
extern int toku_brt_alloc_init_header(BRT t); extern int toku_brt_alloc_init_header(BRT t);
extern int toku_read_brt_header_and_store_in_cachefile (CACHEFILE cf, struct brt_header **header); extern int toku_read_brt_header_and_store_in_cachefile (CACHEFILE cf, struct brt_header **header, BOOL* was_open);
extern CACHEKEY* toku_calculate_root_offset_pointer (BRT brt, u_int32_t *root_hash); extern CACHEKEY* toku_calculate_root_offset_pointer (BRT brt, u_int32_t *root_hash);
static const BRTNODE null_brtnode=0; static const BRTNODE null_brtnode=0;
......
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
#include "includes.h" #include "includes.h"
#include "ule.h" #include "ule.h"
BOOL ignore_if_was_already_open;
int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) { int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) {
BRTNODE node; BRTNODE node;
int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h); int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
toku_create_new_brtnode(brt, &node, 0, 0); toku_create_new_brtnode(brt, &node, 0, 0);
...@@ -21,7 +22,7 @@ int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) { ...@@ -21,7 +22,7 @@ int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) {
int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_children, BLOCKNUM *children, u_int32_t *subtree_fingerprints, char **keys, int *keylens) { int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_children, BLOCKNUM *children, u_int32_t *subtree_fingerprints, char **keys, int *keylens) {
BRTNODE node; BRTNODE node;
assert(n_children<=BRT_FANOUT); assert(n_children<=BRT_FANOUT);
int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h); int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
toku_create_new_brtnode(brt, &node, height, 0); toku_create_new_brtnode(brt, &node, height, 0);
node->u.n.n_children=n_children; node->u.n.n_children=n_children;
...@@ -46,7 +47,7 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child ...@@ -46,7 +47,7 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
} }
int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) { int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) {
int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h); int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
brt->h->root = blocknum; brt->h->root = blocknum;
brt->h->root_hash.valid = FALSE; brt->h->root_hash.valid = FALSE;
......
...@@ -2950,7 +2950,7 @@ int toku_brt_alloc_init_header(BRT t) { ...@@ -2950,7 +2950,7 @@ int toku_brt_alloc_init_header(BRT t) {
return r; return r;
} }
int toku_read_brt_header_and_store_in_cachefile (CACHEFILE cf, struct brt_header **header) int toku_read_brt_header_and_store_in_cachefile (CACHEFILE cf, struct brt_header **header, BOOL* was_open)
// If the cachefile already has the header, then just get it. // If the cachefile already has the header, then just get it.
// If the cachefile has not been initialized, then don't modify anything. // If the cachefile has not been initialized, then don't modify anything.
{ {
...@@ -2958,9 +2958,11 @@ int toku_read_brt_header_and_store_in_cachefile (CACHEFILE cf, struct brt_header ...@@ -2958,9 +2958,11 @@ int toku_read_brt_header_and_store_in_cachefile (CACHEFILE cf, struct brt_header
struct brt_header *h; struct brt_header *h;
if ((h=toku_cachefile_get_userdata(cf))!=0) { if ((h=toku_cachefile_get_userdata(cf))!=0) {
*header = h; *header = h;
*was_open = TRUE;
return 0; return 0;
} }
} }
*was_open = FALSE;
struct brt_header *h; struct brt_header *h;
int r = toku_deserialize_brtheader_from(toku_cachefile_fd(cf), &h); int r = toku_deserialize_brtheader_from(toku_cachefile_fd(cf), &h);
if (r!=0) return r; if (r!=0) return r;
...@@ -3082,7 +3084,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre ...@@ -3082,7 +3084,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre
} }
if (r!=0) { if (r!=0) {
died_after_open: died_after_open:
toku_cachefile_close(&t->cf, toku_txn_logger(txn), 0, FALSE, ZERO_LSN); toku_cachefile_close(&t->cf, 0, FALSE, ZERO_LSN);
goto died1; goto died1;
} }
assert(t->nodesize>0); assert(t->nodesize>0);
...@@ -3091,8 +3093,9 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre ...@@ -3091,8 +3093,9 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre
died_after_read_and_pin: died_after_read_and_pin:
goto died_after_open; goto died_after_open;
} }
BOOL was_already_open;
if (is_create) { if (is_create) {
r = toku_read_brt_header_and_store_in_cachefile(t->cf, &t->h); r = toku_read_brt_header_and_store_in_cachefile(t->cf, &t->h, &was_already_open);
if (r==TOKUDB_DICTIONARY_NO_HEADER) { if (r==TOKUDB_DICTIONARY_NO_HEADER) {
r = toku_brt_alloc_init_header(t); r = toku_brt_alloc_init_header(t);
if (r != 0) goto died_after_read_and_pin; if (r != 0) goto died_after_read_and_pin;
...@@ -3107,7 +3110,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre ...@@ -3107,7 +3110,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre
} }
else goto found_it; else goto found_it;
} else { } else {
if ((r = toku_read_brt_header_and_store_in_cachefile(t->cf, &t->h))!=0) goto died_after_open; if ((r = toku_read_brt_header_and_store_in_cachefile(t->cf, &t->h, &was_already_open))!=0) goto died_after_open;
found_it: found_it:
t->nodesize = t->h->nodesize; /* inherit the pagesize from the file */ t->nodesize = t->h->nodesize; /* inherit the pagesize from the file */
if (!t->did_set_flags) { if (!t->did_set_flags) {
...@@ -3121,7 +3124,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre ...@@ -3121,7 +3124,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre
} }
} }
} }
if (log_fopen) { if (log_fopen && !was_already_open) { //Only log the fopen that OPENs the file. If it was already open, don't log.
r = toku_logger_log_fopen(txn, fname_in_env, toku_cachefile_filenum(t->cf), t->flags); r = toku_logger_log_fopen(txn, fname_in_env, toku_cachefile_filenum(t->cf), t->flags);
if (r!=0) goto died_after_read_and_pin; if (r!=0) goto died_after_read_and_pin;
} }
...@@ -3404,7 +3407,7 @@ toku_brt_db_delay_closed (BRT zombie, DB* db, int (*close_db)(DB*, u_int32_t), u ...@@ -3404,7 +3407,7 @@ toku_brt_db_delay_closed (BRT zombie, DB* db, int (*close_db)(DB*, u_int32_t), u
return r; return r;
} }
int toku_close_brt_lsn (BRT brt, TOKULOGGER logger, char **error_string, BOOL oplsn_valid, LSN oplsn) { int toku_close_brt_lsn (BRT brt, char **error_string, BOOL oplsn_valid, LSN oplsn) {
assert(toku_omt_size(brt->txns)==0); assert(toku_omt_size(brt->txns)==0);
int r; int r;
while (!toku_list_empty(&brt->cursors)) { while (!toku_list_empty(&brt->cursors)) {
...@@ -3425,7 +3428,7 @@ int toku_close_brt_lsn (BRT brt, TOKULOGGER logger, char **error_string, BOOL op ...@@ -3425,7 +3428,7 @@ int toku_close_brt_lsn (BRT brt, TOKULOGGER logger, char **error_string, BOOL op
//printf("%s:%d closing cachetable\n", __FILE__, __LINE__); //printf("%s:%d closing cachetable\n", __FILE__, __LINE__);
// printf("%s:%d brt=%p ,brt->h=%p\n", __FILE__, __LINE__, brt, brt->h); // printf("%s:%d brt=%p ,brt->h=%p\n", __FILE__, __LINE__, brt, brt->h);
if (error_string) assert(*error_string == 0); if (error_string) assert(*error_string == 0);
r = toku_cachefile_close(&brt->cf, logger, error_string, oplsn_valid, oplsn); r = toku_cachefile_close(&brt->cf, error_string, oplsn_valid, oplsn);
if (r==0 && error_string) assert(*error_string == 0); if (r==0 && error_string) assert(*error_string == 0);
} }
if (brt->temp_descriptor.dbt.data) toku_free(brt->temp_descriptor.dbt.data); if (brt->temp_descriptor.dbt.data) toku_free(brt->temp_descriptor.dbt.data);
...@@ -3433,8 +3436,8 @@ int toku_close_brt_lsn (BRT brt, TOKULOGGER logger, char **error_string, BOOL op ...@@ -3433,8 +3436,8 @@ int toku_close_brt_lsn (BRT brt, TOKULOGGER logger, char **error_string, BOOL op
return r; return r;
} }
int toku_close_brt (BRT brt, TOKULOGGER logger, char **error_string) { int toku_close_brt (BRT brt, char **error_string) {
return toku_close_brt_lsn(brt, logger, error_string, FALSE, ZERO_LSN); return toku_close_brt_lsn(brt, error_string, FALSE, ZERO_LSN);
} }
int toku_brt_create(BRT *brt_ptr) { int toku_brt_create(BRT *brt_ptr) {
...@@ -5138,7 +5141,7 @@ int toku_brt_remove_now(CACHETABLE ct, DBT* iname_dbt_p, DBT* iname_within_cwd_d ...@@ -5138,7 +5141,7 @@ int toku_brt_remove_now(CACHETABLE ct, DBT* iname_dbt_p, DBT* iname_within_cwd_d
char *error_string = NULL; char *error_string = NULL;
r = toku_cachefile_redirect_nullfd(cf); r = toku_cachefile_redirect_nullfd(cf);
assert(r==0); assert(r==0);
r = toku_cachefile_close(&cf, toku_cachefile_logger(cf), &error_string, FALSE, ZERO_LSN); r = toku_cachefile_close(&cf, &error_string, FALSE, ZERO_LSN);
assert(r==0); assert(r==0);
} }
else else
......
...@@ -77,8 +77,8 @@ int toku_brt_delete_both (BRT brt, DBT *k, DBT *v, TOKUTXN txn); ...@@ -77,8 +77,8 @@ int toku_brt_delete_both (BRT brt, DBT *k, DBT *v, TOKUTXN txn);
int toku_brt_maybe_delete_both (BRT brt, DBT *k, DBT *v, TOKUTXN txn, BOOL oplsn_valid, LSN oplsn); int toku_brt_maybe_delete_both (BRT brt, DBT *k, DBT *v, TOKUTXN txn, BOOL oplsn_valid, LSN oplsn);
int toku_brt_db_delay_closed (BRT brt, DB* db, int (*close_db)(DB*, u_int32_t), u_int32_t close_flags); int toku_brt_db_delay_closed (BRT brt, DB* db, int (*close_db)(DB*, u_int32_t), u_int32_t close_flags);
int toku_close_brt (BRT, TOKULOGGER, char **error_string); int toku_close_brt (BRT, char **error_string);
int toku_close_brt_lsn (BRT brt, TOKULOGGER logger, char **error_string, BOOL oplsn_valid, LSN oplsn); int toku_close_brt_lsn (BRT brt, char **error_string, BOOL oplsn_valid, LSN oplsn);
int toku_brt_set_panic(BRT brt, int panic, char *panic_string); int toku_brt_set_panic(BRT brt, int panic, char *panic_string);
......
...@@ -660,7 +660,7 @@ static void remove_cf_from_cachefiles_list (CACHEFILE cf) { ...@@ -660,7 +660,7 @@ static void remove_cf_from_cachefiles_list (CACHEFILE cf) {
static int cachetable_flush_cachefile (CACHETABLE, CACHEFILE cf); static int cachetable_flush_cachefile (CACHETABLE, CACHEFILE cf);
int toku_cachefile_close (CACHEFILE *cfp, TOKULOGGER logger, char **error_string, BOOL oplsn_valid, LSN oplsn) { int toku_cachefile_close (CACHEFILE *cfp, char **error_string, BOOL oplsn_valid, LSN oplsn) {
CACHEFILE cf = *cfp; CACHEFILE cf = *cfp;
CACHETABLE ct = cf->cachetable; CACHETABLE ct = cf->cachetable;
...@@ -750,11 +750,6 @@ int toku_cachefile_close (CACHEFILE *cfp, TOKULOGGER logger, char **error_string ...@@ -750,11 +750,6 @@ int toku_cachefile_close (CACHEFILE *cfp, TOKULOGGER logger, char **error_string
r = close(cf->fd); r = close(cf->fd);
assert(r == 0); assert(r == 0);
cf->fd = -1; cf->fd = -1;
if (logger) {
//assert(cf->fname);
//BYTESTRING bs = {.len=strlen(cf->fname), .data=cf->fname};
//r = toku_log_cfclose(logger, 0, 0, bs, cf->filenum);
}
if (cf->fname_relative_to_env) toku_free(cf->fname_relative_to_env); if (cf->fname_relative_to_env) toku_free(cf->fname_relative_to_env);
toku_free(cf); toku_free(cf);
...@@ -2000,7 +1995,7 @@ toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, char **error_st ...@@ -2000,7 +1995,7 @@ toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, char **error_st
ct->cachefiles_in_checkpoint = cf->next_in_checkpoint; ct->cachefiles_in_checkpoint = cf->next_in_checkpoint;
cf->next_in_checkpoint = NULL; cf->next_in_checkpoint = NULL;
cf->for_checkpoint = FALSE; cf->for_checkpoint = FALSE;
int r = toku_cachefile_close(&cf, logger, error_string, FALSE, ZERO_LSN); int r = toku_cachefile_close(&cf, error_string, FALSE, ZERO_LSN);
if (r!=0) { if (r!=0) {
retval = r; retval = r;
goto panic; goto panic;
......
...@@ -181,7 +181,7 @@ int toku_cachetable_rename (CACHEFILE cachefile, CACHEKEY oldkey, CACHEKEY newke ...@@ -181,7 +181,7 @@ int toku_cachetable_rename (CACHEFILE cachefile, CACHEKEY oldkey, CACHEKEY newke
// object is freed. // object is freed.
// If oplsn_valid is TRUE then use oplsn as the LSN of the close instead of asking the logger. oplsn_valid being TRUE is only allowed during recovery, and requires that you are removing the last reference (otherwise the lsn wouldn't make it in.) // If oplsn_valid is TRUE then use oplsn as the LSN of the close instead of asking the logger. oplsn_valid being TRUE is only allowed during recovery, and requires that you are removing the last reference (otherwise the lsn wouldn't make it in.)
// Returns: 0 if success, otherwise returns an error number. // Returns: 0 if success, otherwise returns an error number.
int toku_cachefile_close (CACHEFILE*, TOKULOGGER, char **error_string, BOOL oplsn_valid, LSN oplsn); int toku_cachefile_close (CACHEFILE*, char **error_string, BOOL oplsn_valid, LSN oplsn);
// Flush the cachefile. // Flush the cachefile.
// Effect: Flush everything owned by the cachefile from the cachetable. All dirty // Effect: Flush everything owned by the cachefile from the cachetable. All dirty
......
...@@ -126,8 +126,7 @@ const struct logtype logtypes[] = { ...@@ -126,8 +126,7 @@ const struct logtype logtypes[] = {
{"BYTESTRING", "descriptor", 0}, {"BYTESTRING", "descriptor", 0},
NULLFIELD}}, NULLFIELD}},
//TODO: #2037 Add dname //TODO: #2037 Add dname
{"fopen", 'O', FA{{"TXNID", "txnid", 0}, {"fopen", 'O', FA{{"BYTESTRING", "iname", 0},
{"BYTESTRING", "iname", 0},
{"FILENUM", "filenum", 0}, {"FILENUM", "filenum", 0},
{"u_int32_t", "treeflags", 0}, {"u_int32_t", "treeflags", 0},
NULLFIELD}}, NULLFIELD}},
......
...@@ -594,7 +594,7 @@ int toku_logger_log_fopen (TOKUTXN txn, const char * fname, FILENUM filenum, uin ...@@ -594,7 +594,7 @@ int toku_logger_log_fopen (TOKUTXN txn, const char * fname, FILENUM filenum, uin
BYTESTRING bs; BYTESTRING bs;
bs.len = strlen(fname); bs.len = strlen(fname);
bs.data = (char*)fname; bs.data = (char*)fname;
return toku_log_fopen (txn->logger, (LSN*)0, 0, toku_txn_get_txnid(txn), bs, filenum, treeflags); return toku_log_fopen (txn->logger, (LSN*)0, 0, bs, filenum, treeflags);
} }
static int toku_fread_u_int8_t_nocrclen (FILE *f, u_int8_t *v) { static int toku_fread_u_int8_t_nocrclen (FILE *f, u_int8_t *v) {
......
...@@ -83,7 +83,7 @@ static void file_map_close_dictionaries(struct file_map *fmap, BOOL recovery_suc ...@@ -83,7 +83,7 @@ static void file_map_close_dictionaries(struct file_map *fmap, BOOL recovery_suc
//Logging is already back on. No need to pass LSN into close. //Logging is already back on. No need to pass LSN into close.
char *error_string = NULL; char *error_string = NULL;
DB *fake_db = tuple->brt->db; //Need to free the fake db that was malloced DB *fake_db = tuple->brt->db; //Need to free the fake db that was malloced
r = toku_close_brt(tuple->brt, NULL, &error_string); r = toku_close_brt(tuple->brt, &error_string);
if (!recovery_succeeded) { if (!recovery_succeeded) {
printf("%s:%d %d %s\n", __FUNCTION__, __LINE__, r, error_string); printf("%s:%d %d %s\n", __FUNCTION__, __LINE__, r, error_string);
assert(r != 0); assert(r != 0);
...@@ -323,7 +323,7 @@ static int internal_toku_recover_fopen_or_fcreate (RECOVER_ENV renv, int flags, ...@@ -323,7 +323,7 @@ static int internal_toku_recover_fopen_or_fcreate (RECOVER_ENV renv, int flags,
close_brt:; close_brt:;
//Note: If brt_open fails, then close_brt will NOT write a header to disk. //Note: If brt_open fails, then close_brt will NOT write a header to disk.
//No need to provide lsn //No need to provide lsn
int rr = toku_close_brt(brt, NULL, NULL); assert(rr == 0); int rr = toku_close_brt(brt, NULL); assert(rr == 0);
toku_free(fixedfname); toku_free(fixedfname);
toku_free(fake_db); //Free memory allocated for the fake db. toku_free(fake_db); //Free memory allocated for the fake db.
return r; return r;
...@@ -348,7 +348,7 @@ static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV ren ...@@ -348,7 +348,7 @@ static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV ren
//The only way this should be dirty, is if its doing a file-format upgrade. //The only way this should be dirty, is if its doing a file-format upgrade.
//If not dirty, header will not be written. //If not dirty, header will not be written.
DB *fake_db = tuple->brt->db; //Need to free the fake db that was malloced DB *fake_db = tuple->brt->db; //Need to free the fake db that was malloced
r = toku_close_brt_lsn(tuple->brt, 0, 0, TRUE, tuple->brt->h->checkpoint_lsn); r = toku_close_brt_lsn(tuple->brt, 0, TRUE, tuple->brt->h->checkpoint_lsn);
assert(r == 0); assert(r == 0);
toku_free(fake_db); //Must free the DB after the brt is closed toku_free(fake_db); //Must free the DB after the brt is closed
file_map_remove(&renv->fmap, l->filenum); file_map_remove(&renv->fmap, l->filenum);
...@@ -489,7 +489,7 @@ static int toku_recover_fclose (struct logtype_fclose *l, RECOVER_ENV UU(renv)) ...@@ -489,7 +489,7 @@ static int toku_recover_fclose (struct logtype_fclose *l, RECOVER_ENV UU(renv))
assert(strcmp(tuple->fname, fixedfname) == 0); assert(strcmp(tuple->fname, fixedfname) == 0);
toku_free(fixedfname); toku_free(fixedfname);
DB *fake_db = tuple->brt->db; //Need to free the fake db that was malloced DB *fake_db = tuple->brt->db; //Need to free the fake db that was malloced
r = toku_close_brt_lsn(tuple->brt, 0, 0, TRUE, l->lsn); r = toku_close_brt_lsn(tuple->brt, 0, TRUE, l->lsn);
assert(r == 0); assert(r == 0);
toku_free(fake_db); //Must free the DB after the brt is closed toku_free(fake_db); //Must free the DB after the brt is closed
file_map_remove(&renv->fmap, l->filenum); file_map_remove(&renv->fmap, l->filenum);
......
...@@ -36,7 +36,7 @@ toku_commit_fdelete (u_int8_t file_was_open, ...@@ -36,7 +36,7 @@ toku_commit_fdelete (u_int8_t file_was_open,
r = toku_cachefile_redirect_nullfd(cf); r = toku_cachefile_redirect_nullfd(cf);
assert(r==0); assert(r==0);
char *error_string = NULL; char *error_string = NULL;
r = toku_cachefile_close(&cf, txn->logger, &error_string, TRUE, oplsn); r = toku_cachefile_close(&cf, &error_string, TRUE, oplsn);
assert(r==0); assert(r==0);
} }
r = unlink(fname); // pathname relative to cwd r = unlink(fname); // pathname relative to cwd
...@@ -64,7 +64,7 @@ toku_rollback_fdelete (u_int8_t UU(file_was_open), ...@@ -64,7 +64,7 @@ toku_rollback_fdelete (u_int8_t UU(file_was_open),
assert(r == 0); assert(r == 0);
char *error_string = NULL; char *error_string = NULL;
// decrement refcount that was incremented in toku_brt_remove_on_commit() // decrement refcount that was incremented in toku_brt_remove_on_commit()
r = toku_cachefile_close(&cf, txn->logger, &error_string, TRUE, oplsn); r = toku_cachefile_close(&cf, &error_string, TRUE, oplsn);
assert(r==0); assert(r==0);
} }
return r; return r;
......
...@@ -36,7 +36,7 @@ static void setup (void) { ...@@ -36,7 +36,7 @@ static void setup (void) {
static void toku_shutdown (void) { static void toku_shutdown (void) {
int r; int r;
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
static void long_long_to_array (unsigned char *a, unsigned long long l) { static void long_long_to_array (unsigned char *a, unsigned long long l) {
......
...@@ -42,7 +42,7 @@ static void test_sub_block(int n) { ...@@ -42,7 +42,7 @@ static void test_sub_block(int n) {
} }
// write to the file // write to the file
error = toku_close_brt(brt, 0, 0); error = toku_close_brt(brt, 0);
assert(error == 0); assert(error == 0);
// verify the brt by walking a cursor through the rows // verify the brt by walking a cursor through the rows
...@@ -69,7 +69,7 @@ static void test_sub_block(int n) { ...@@ -69,7 +69,7 @@ static void test_sub_block(int n) {
error = toku_brt_cursor_close(cursor); error = toku_brt_cursor_close(cursor);
assert(error == 0); assert(error == 0);
error = toku_close_brt(brt, 0, 0); error = toku_close_brt(brt, 0);
assert(error == 0); assert(error == 0);
error = toku_cachetable_close(&ct); error = toku_cachetable_close(&ct);
......
...@@ -82,7 +82,7 @@ static void test_multiple_brt_cursor_dbts(int n, DB *db) { ...@@ -82,7 +82,7 @@ static void test_multiple_brt_cursor_dbts(int n, DB *db) {
toku_free(ptrs[i]); toku_free(ptrs[i]);
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
......
...@@ -110,7 +110,7 @@ static void test_brt_cursor_first(int n, DB *db) { ...@@ -110,7 +110,7 @@ static void test_brt_cursor_first(int n, DB *db) {
else else
assert_cursor_value(brt, DB_FIRST, 0); assert_cursor_value(brt, DB_FIRST, 0);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -151,7 +151,7 @@ static void test_brt_cursor_last(int n, DB *db) { ...@@ -151,7 +151,7 @@ static void test_brt_cursor_last(int n, DB *db) {
else else
assert_cursor_value(brt, DB_LAST, n-1); assert_cursor_value(brt, DB_LAST, n-1);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -194,7 +194,7 @@ static void test_brt_cursor_first_last(int n, DB *db) { ...@@ -194,7 +194,7 @@ static void test_brt_cursor_first_last(int n, DB *db) {
} else } else
assert_cursor_first_last(brt, 0, n-1); assert_cursor_first_last(brt, 0, n-1);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -238,7 +238,7 @@ static void test_brt_cursor_rfirst(int n, DB *db) { ...@@ -238,7 +238,7 @@ static void test_brt_cursor_rfirst(int n, DB *db) {
else else
assert_cursor_value(brt, DB_FIRST, 0); assert_cursor_value(brt, DB_FIRST, 0);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -303,7 +303,7 @@ static void test_brt_cursor_walk(int n, DB *db) { ...@@ -303,7 +303,7 @@ static void test_brt_cursor_walk(int n, DB *db) {
/* walk the tree */ /* walk the tree */
assert_cursor_walk(brt, n); assert_cursor_walk(brt, n);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -369,7 +369,7 @@ static void test_brt_cursor_rwalk(int n, DB *db) { ...@@ -369,7 +369,7 @@ static void test_brt_cursor_rwalk(int n, DB *db) {
/* walk the tree */ /* walk the tree */
assert_cursor_rwalk(brt, n); assert_cursor_rwalk(brt, n);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -465,7 +465,7 @@ static void test_brt_cursor_rand(int n, DB *db) { ...@@ -465,7 +465,7 @@ static void test_brt_cursor_rand(int n, DB *db) {
/* walk the tree */ /* walk the tree */
assert_cursor_walk_inorder(brt, n); assert_cursor_walk_inorder(brt, n);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -544,7 +544,7 @@ static void test_brt_cursor_split(int n, DB *db) { ...@@ -544,7 +544,7 @@ static void test_brt_cursor_split(int n, DB *db) {
r = toku_brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -578,7 +578,7 @@ static void test_multiple_brt_cursors(int n, DB *db) { ...@@ -578,7 +578,7 @@ static void test_multiple_brt_cursors(int n, DB *db) {
assert(r == 0); assert(r == 0);
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -670,7 +670,7 @@ static void test_multiple_brt_cursor_walk(int n, DB *db) { ...@@ -670,7 +670,7 @@ static void test_multiple_brt_cursor_walk(int n, DB *db) {
assert(r == 0); assert(r == 0);
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -742,7 +742,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -742,7 +742,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) {
r = toku_brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -806,7 +806,7 @@ static void test_brt_cursor_set_range(int n, DB *db) { ...@@ -806,7 +806,7 @@ static void test_brt_cursor_set_range(int n, DB *db) {
r = toku_brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
...@@ -867,7 +867,7 @@ static void test_brt_cursor_delete(int n, DB *db) { ...@@ -867,7 +867,7 @@ static void test_brt_cursor_delete(int n, DB *db) {
error = toku_brt_cursor_close(cursor); error = toku_brt_cursor_close(cursor);
assert(error == 0); assert(error == 0);
error = toku_close_brt(brt, 0, 0); error = toku_close_brt(brt, 0);
assert(error == 0); assert(error == 0);
error = toku_cachetable_close(&ct); error = toku_cachetable_close(&ct);
...@@ -987,7 +987,7 @@ static void test_brt_cursor_get_both(int n, DB *db) { ...@@ -987,7 +987,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
error = toku_brt_cursor_close(cursor); error = toku_brt_cursor_close(cursor);
assert(error == 0); assert(error == 0);
error = toku_close_brt(brt, 0, 0); error = toku_close_brt(brt, 0);
assert(error == 0); assert(error == 0);
error = toku_cachetable_close(&ct); error = toku_cachetable_close(&ct);
......
...@@ -20,7 +20,7 @@ static void test_dump_empty_db (void) { ...@@ -20,7 +20,7 @@ static void test_dump_empty_db (void) {
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db); r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0); assert(r==0);
if (verbose) toku_dump_brt(stdout, t); if (verbose) toku_dump_brt(stdout, t);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
...@@ -54,8 +54,8 @@ static void test_multiple_files_of_size (int size) { ...@@ -54,8 +54,8 @@ static void test_multiple_files_of_size (int size) {
toku_verify_brt(t0); toku_verify_brt(t0);
toku_verify_brt(t1); toku_verify_brt(t1);
r = toku_close_brt(t0, 0, 0); assert(r==0); r = toku_close_brt(t0, 0); assert(r==0);
r = toku_close_brt(t1, 0, 0); assert(r==0); r = toku_close_brt(t1, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
...@@ -75,8 +75,8 @@ static void test_multiple_files_of_size (int size) { ...@@ -75,8 +75,8 @@ static void test_multiple_files_of_size (int size) {
brt_lookup_and_check_nodup(t1, key, val); brt_lookup_and_check_nodup(t1, key, val);
} }
r = toku_close_brt(t0, 0, 0); assert(r==0); r = toku_close_brt(t0, 0); assert(r==0);
r = toku_close_brt(t1, 0, 0); assert(r==0); r = toku_close_brt(t1, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
...@@ -114,7 +114,7 @@ static void test_multiple_brts_one_db_one_file (void) { ...@@ -114,7 +114,7 @@ static void test_multiple_brts_one_db_one_file (void) {
brt_lookup_and_check_nodup(trees[0], k, vexpect); brt_lookup_and_check_nodup(trees[0], k, vexpect);
} }
for (i=0; i<MANYN; i++) { for (i=0; i<MANYN; i++) {
r=toku_close_brt(trees[i], 0, 0); assert(r==0); r=toku_close_brt(trees[i], 0); assert(r==0);
} }
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
...@@ -136,7 +136,7 @@ static void test_read_what_was_written (void) { ...@@ -136,7 +136,7 @@ static void test_read_what_was_written (void) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
...@@ -151,7 +151,7 @@ static void test_read_what_was_written (void) { ...@@ -151,7 +151,7 @@ static void test_read_what_was_written (void) {
toku_brt_insert(brt, toku_fill_dbt(&k, "hello", 6), toku_fill_dbt(&v, "there", 6), null_txn); toku_brt_insert(brt, toku_fill_dbt(&k, "hello", 6), toku_fill_dbt(&v, "there", 6), null_txn);
} }
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
...@@ -212,7 +212,7 @@ static void test_read_what_was_written (void) { ...@@ -212,7 +212,7 @@ static void test_read_what_was_written (void) {
} }
} }
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
if (verbose) printf("%s:%d About to close %p\n", __FILE__, __LINE__, ct); if (verbose) printf("%s:%d About to close %p\n", __FILE__, __LINE__, ct);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
...@@ -232,7 +232,7 @@ static void test_read_what_was_written (void) { ...@@ -232,7 +232,7 @@ static void test_read_what_was_written (void) {
} }
} }
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
...@@ -268,7 +268,7 @@ static void test_cursor_last_empty(void) { ...@@ -268,7 +268,7 @@ static void test_cursor_last_empty(void) {
assert(pair.call_count==0); assert(pair.call_count==0);
assert(r==DB_NOTFOUND); assert(r==DB_NOTFOUND);
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
...@@ -319,7 +319,7 @@ static void test_cursor_next (void) { ...@@ -319,7 +319,7 @@ static void test_cursor_next (void) {
assert(pair.call_count==0); assert(pair.call_count==0);
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
...@@ -398,7 +398,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -398,7 +398,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
} }
} }
...@@ -438,7 +438,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -438,7 +438,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
} }
r = toku_close_brt(brt, 0, 0); r = toku_close_brt(brt, 0);
assert(r==0); assert(r==0);
} }
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
...@@ -475,7 +475,7 @@ static void test_large_kv(int bsize, int ksize, int vsize) { ...@@ -475,7 +475,7 @@ static void test_large_kv(int bsize, int ksize, int vsize) {
toku_free(k); toku_free(k);
toku_free(v); toku_free(v);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -514,7 +514,7 @@ static void test_brt_delete_empty(void) { ...@@ -514,7 +514,7 @@ static void test_brt_delete_empty(void) {
r = toku_brt_delete(t, &key, null_txn); r = toku_brt_delete(t, &key, null_txn);
assert(r == 0); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -580,7 +580,7 @@ static void test_brt_delete_present(int n) { ...@@ -580,7 +580,7 @@ static void test_brt_delete_present(int n) {
r = toku_brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r == 0); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -626,7 +626,7 @@ static void test_brt_delete_not_present(int n) { ...@@ -626,7 +626,7 @@ static void test_brt_delete_not_present(int n) {
return value depends */ return value depends */
if (verbose) printf("toku_brt_delete k=%d %d\n", k, r); if (verbose) printf("toku_brt_delete k=%d %d\n", k, r);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -713,7 +713,7 @@ static void test_brt_delete_cursor_first(int n) { ...@@ -713,7 +713,7 @@ static void test_brt_delete_cursor_first(int n) {
r = toku_brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r == 0); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -764,7 +764,7 @@ static void test_insert_delete_lookup(int n) { ...@@ -764,7 +764,7 @@ static void test_insert_delete_lookup(int n) {
} }
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -836,7 +836,7 @@ static void test_brt_delete_both(int n) { ...@@ -836,7 +836,7 @@ static void test_brt_delete_both(int n) {
r = toku_brt_cursor_close(cursor); assert(r == 0); r = toku_brt_cursor_close(cursor); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -873,7 +873,7 @@ static void test_new_brt_cursor_create_close (void) { ...@@ -873,7 +873,7 @@ static void test_new_brt_cursor_create_close (void) {
r = toku_brt_cursor_close(cursors[i]); assert(r == 0); r = toku_brt_cursor_close(cursors[i]); assert(r == 0);
} }
r = toku_close_brt(brt, 0, 0); assert(r == 0); r = toku_close_brt(brt, 0); assert(r == 0);
} }
static void test_new_brt_cursor_first(int n, int dup_mode) { static void test_new_brt_cursor_first(int n, int dup_mode) {
...@@ -925,7 +925,7 @@ static void test_new_brt_cursor_first(int n, int dup_mode) { ...@@ -925,7 +925,7 @@ static void test_new_brt_cursor_first(int n, int dup_mode) {
if (val.data) toku_free(val.data); if (val.data) toku_free(val.data);
r = toku_brt_cursor_close(cursor); assert(r == 0); r = toku_brt_cursor_close(cursor); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct);assert(r==0); r = toku_cachetable_close(&ct);assert(r==0);
} }
...@@ -979,7 +979,7 @@ static void test_new_brt_cursor_last(int n, int dup_mode) { ...@@ -979,7 +979,7 @@ static void test_new_brt_cursor_last(int n, int dup_mode) {
if (val.data) toku_free(val.data); if (val.data) toku_free(val.data);
r = toku_brt_cursor_close(cursor); assert(r == 0); r = toku_brt_cursor_close(cursor); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct);assert(r==0); r = toku_cachetable_close(&ct);assert(r==0);
} }
...@@ -1023,7 +1023,7 @@ static void test_new_brt_cursor_next(int n, int dup_mode) { ...@@ -1023,7 +1023,7 @@ static void test_new_brt_cursor_next(int n, int dup_mode) {
assert(i == n); assert(i == n);
r = toku_brt_cursor_close(cursor); assert(r == 0); r = toku_brt_cursor_close(cursor); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct);assert(r==0); r = toku_cachetable_close(&ct);assert(r==0);
} }
...@@ -1067,7 +1067,7 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) { ...@@ -1067,7 +1067,7 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) {
assert(i == -1); assert(i == -1);
r = toku_brt_cursor_close(cursor); assert(r == 0); r = toku_brt_cursor_close(cursor); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct);assert(r==0); r = toku_cachetable_close(&ct);assert(r==0);
} }
...@@ -1150,7 +1150,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) { ...@@ -1150,7 +1150,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
assert(i == n); assert(i == n);
r = toku_brt_cursor_close(cursor); assert(r == 0); r = toku_brt_cursor_close(cursor); assert(r == 0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct);assert(r==0); r = toku_cachetable_close(&ct);assert(r==0);
} }
...@@ -1209,7 +1209,7 @@ static void test_new_brt_cursor_set_range(int n, int dup_mode) { ...@@ -1209,7 +1209,7 @@ static void test_new_brt_cursor_set_range(int n, int dup_mode) {
r = toku_brt_cursor_close(cursor); assert(r==0); r = toku_brt_cursor_close(cursor); assert(r==0);
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
...@@ -1268,7 +1268,7 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -1268,7 +1268,7 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) {
r = toku_brt_cursor_close(cursor); assert(r==0); r = toku_brt_cursor_close(cursor); assert(r==0);
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -23,7 +23,7 @@ static void test0 (void) { ...@@ -23,7 +23,7 @@ static void test0 (void) {
assert(r==0); assert(r==0);
//printf("%s:%d test0\n", __FILE__, __LINE__); //printf("%s:%d test0\n", __FILE__, __LINE__);
//printf("%s:%d n_items_malloced=%lld\n", __FILE__, __LINE__, n_items_malloced); //printf("%s:%d n_items_malloced=%lld\n", __FILE__, __LINE__, n_items_malloced);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
//printf("%s:%d n_items_malloced=%lld\n", __FILE__, __LINE__, n_items_malloced); //printf("%s:%d n_items_malloced=%lld\n", __FILE__, __LINE__, n_items_malloced);
r = toku_cachetable_close(&ct); r = toku_cachetable_close(&ct);
assert(r==0); assert(r==0);
......
...@@ -27,7 +27,7 @@ static void test1 (void) { ...@@ -27,7 +27,7 @@ static void test1 (void) {
assert(r==0); assert(r==0);
assert(pair.call_count==1); assert(pair.call_count==1);
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
if (verbose) printf("test1 ok\n"); if (verbose) printf("test1 ok\n");
......
...@@ -41,7 +41,7 @@ static void test2 (int memcheck, int limit) { ...@@ -41,7 +41,7 @@ static void test2 (int memcheck, int limit) {
} }
if (verbose) printf("%s:%d inserted\n", __FILE__, __LINE__); if (verbose) printf("%s:%d inserted\n", __FILE__, __LINE__);
r = toku_verify_brt(t); assert(r==0); r = toku_verify_brt(t); assert(r==0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
if (verbose) printf("test2 ok\n"); if (verbose) printf("test2 ok\n");
......
...@@ -31,7 +31,7 @@ static void test3 (int nodesize, int count, int memcheck) { ...@@ -31,7 +31,7 @@ static void test3 (int nodesize, int count, int memcheck) {
toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)), null_txn); toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)), null_txn);
} }
r = toku_verify_brt(t); assert(r==0); r = toku_verify_brt(t); assert(r==0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
gettimeofday(&t1, 0); gettimeofday(&t1, 0);
......
...@@ -31,7 +31,7 @@ static void test4 (int nodesize, int count, int memcheck) { ...@@ -31,7 +31,7 @@ static void test4 (int nodesize, int count, int memcheck) {
toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)), null_txn); toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)), null_txn);
} }
r = toku_verify_brt(t); assert(r==0); r = toku_verify_brt(t); assert(r==0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
gettimeofday(&t1, 0); gettimeofday(&t1, 0);
......
...@@ -49,7 +49,7 @@ static void test5 (void) { ...@@ -49,7 +49,7 @@ static void test5 (void) {
} }
if (verbose) printf("\n"); if (verbose) printf("\n");
toku_free(values); toku_free(values);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free(); toku_memory_check_all_free();
} }
......
...@@ -147,7 +147,7 @@ static void checkpoint_pending(void) { ...@@ -147,7 +147,7 @@ static void checkpoint_pending(void) {
assert(r == 0); assert(r == 0);
assert(n_flush == 0 && n_write_me == 0 && n_keep_me == 0); assert(n_flush == 0 && n_write_me == 0 && n_keep_me == 0);
r = toku_cachefile_close(&cf, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && cf == 0); r = toku_cachefile_close(&cf, 0, FALSE, ZERO_LSN); assert(r == 0 && cf == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -120,7 +120,7 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) { ...@@ -120,7 +120,7 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) {
assert(r == 0); assert(r == 0);
assert(n_flush == 0 && n_write_me == 0 && n_keep_me == 0); assert(n_flush == 0 && n_write_me == 0 && n_keep_me == 0);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -65,7 +65,7 @@ cachetable_count_pinned_test (int n) { ...@@ -65,7 +65,7 @@ cachetable_count_pinned_test (int n) {
assert(toku_cachefile_count_pinned(f1, 1) == 0); assert(toku_cachefile_count_pinned(f1, 1) == 0);
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -73,7 +73,7 @@ cachetable_debug_test (int n) { ...@@ -73,7 +73,7 @@ cachetable_debug_test (int n) {
if (verbose) toku_cachetable_print_hash_histogram(); if (verbose) toku_cachetable_print_hash_histogram();
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -39,7 +39,7 @@ cachetable_fd_test (void) { ...@@ -39,7 +39,7 @@ cachetable_fd_test (void) {
r = toku_cachefile_of_filenum(ct, fn, &newcf); r = toku_cachefile_of_filenum(ct, fn, &newcf);
assert(r == ENOENT); assert(r == ENOENT);
r = toku_cachefile_close(&cf, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && cf == 0); r = toku_cachefile_close(&cf, 0, FALSE, ZERO_LSN); assert(r == 0 && cf == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -92,8 +92,8 @@ test_cachetable_flush (int n) { ...@@ -92,8 +92,8 @@ test_cachetable_flush (int n) {
assert(r == 0); assert(r == 0);
} }
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachefile_close(&f2, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f2 == 0); r = toku_cachefile_close(&f2, 0, FALSE, ZERO_LSN); assert(r == 0 && f2 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -70,7 +70,7 @@ cachetable_getandpin_test (int n) { ...@@ -70,7 +70,7 @@ cachetable_getandpin_test (int n) {
} }
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -112,7 +112,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir ...@@ -112,7 +112,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
assert(r == 0); assert(r == 0);
assert(n_flush == 0 && n_write_me == 0 && n_keep_me == 0); assert(n_flush == 0 && n_write_me == 0 && n_keep_me == 0);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -55,7 +55,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) { ...@@ -55,7 +55,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
// close with the prefetch in progress. the close should block until // close with the prefetch in progress. the close should block until
// all of the reads and writes are complete. // all of the reads and writes are complete.
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -56,7 +56,7 @@ static void cachetable_prefetch_close_leak_test (void) { ...@@ -56,7 +56,7 @@ static void cachetable_prefetch_close_leak_test (void) {
// close with the prefetch in progress. the close should block until // close with the prefetch in progress. the close should block until
// all of the reads and writes are complete. // all of the reads and writes are complete.
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -55,7 +55,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) { ...@@ -55,7 +55,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
// close with the prefetch in progress. the close should block until // close with the prefetch in progress. the close should block until
// all of the reads and writes are complete. // all of the reads and writes are complete.
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -72,7 +72,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) { ...@@ -72,7 +72,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -76,7 +76,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) { ...@@ -76,7 +76,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
assert(r == 0); assert(r == 0);
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -66,7 +66,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) { ...@@ -66,7 +66,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
assert(r == 0); assert(r == 0);
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -77,7 +77,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) { ...@@ -77,7 +77,7 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
assert(r == 0); assert(r == 0);
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -77,7 +77,7 @@ cachetable_put_test (int n) { ...@@ -77,7 +77,7 @@ cachetable_put_test (int n) {
r = toku_cachetable_unpin(f1, k, toku_cachetable_hash(f1, k), CACHETABLE_CLEAN, 1); r = toku_cachetable_unpin(f1, k, toku_cachetable_hash(f1, k), CACHETABLE_CLEAN, 1);
assert(r != 0); assert(r != 0);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -158,7 +158,7 @@ static void test_rename (void) { ...@@ -158,7 +158,7 @@ static void test_rename (void) {
r = toku_cachetable_rename(f, okey, nkey); r = toku_cachetable_rename(f, okey, nkey);
assert(r != 0); assert(r != 0);
r = toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); r = toku_cachefile_close(&f, 0, FALSE, ZERO_LSN);
assert(r == 0); assert(r == 0);
r = toku_cachetable_close(&t); r = toku_cachetable_close(&t);
assert(r == 0); assert(r == 0);
......
...@@ -84,7 +84,7 @@ static void readit (void) { ...@@ -84,7 +84,7 @@ static void readit (void) {
r=toku_cachetable_get_and_pin(f, key, fullhash, &block, &current_size, f_flush, f_fetch, 0); assert(r==0); r=toku_cachetable_get_and_pin(f, key, fullhash, &block, &current_size, f_flush, f_fetch, 0); assert(r==0);
r=toku_cachetable_unpin(f, key, fullhash, CACHETABLE_CLEAN, BLOCKSIZE); assert(r==0); r=toku_cachetable_unpin(f, key, fullhash, CACHETABLE_CLEAN, BLOCKSIZE); assert(r==0);
} }
r = toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); assert(r == 0); r = toku_cachefile_close(&f, 0, FALSE, ZERO_LSN); assert(r == 0);
r = toku_cachetable_close(&t); assert(r == 0); r = toku_cachetable_close(&t); assert(r == 0);
gettimeofday(&end, 0); gettimeofday(&end, 0);
toku_os_get_process_times(&end_usertime, &end_systime); toku_os_get_process_times(&end_usertime, &end_systime);
......
...@@ -287,7 +287,7 @@ static void test0 (void) { ...@@ -287,7 +287,7 @@ static void test0 (void) {
expectN(7); expectN(7);
expectN(6); expectN(6);
expectN(1); expectN(1);
r=toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); r=toku_cachefile_close(&f, 0, FALSE, ZERO_LSN);
assert(r==0); assert(r==0);
r=toku_cachetable_close(&t); r=toku_cachetable_close(&t);
assert(r==0); assert(r==0);
...@@ -352,7 +352,7 @@ static void test_nested_pin (void) { ...@@ -352,7 +352,7 @@ static void test_nested_pin (void) {
r = toku_cachetable_unpin(f, make_blocknum(2), f2hash, CACHETABLE_CLEAN, test_object_size); r = toku_cachetable_unpin(f, make_blocknum(2), f2hash, CACHETABLE_CLEAN, test_object_size);
assert(r==0); assert(r==0);
// toku_os_usleep(1*1000000); // toku_os_usleep(1*1000000);
r = toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); assert(r==0); r = toku_cachefile_close(&f, 0, FALSE, ZERO_LSN); assert(r==0);
r = toku_cachetable_close(&t); assert(r==0); r = toku_cachetable_close(&t); assert(r==0);
} }
...@@ -415,14 +415,14 @@ static void test_multi_filehandles (void) { ...@@ -415,14 +415,14 @@ static void test_multi_filehandles (void) {
r = toku_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), CACHETABLE_CLEAN, 0); assert(r==0); r = toku_cachetable_unpin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), CACHETABLE_CLEAN, 0); assert(r==0);
r = toku_cachetable_unpin(f1, make_blocknum(2), toku_cachetable_hash(f1, make_blocknum(2)), CACHETABLE_CLEAN, 0); assert(r==0); r = toku_cachetable_unpin(f1, make_blocknum(2), toku_cachetable_hash(f1, make_blocknum(2)), CACHETABLE_CLEAN, 0); assert(r==0);
r = toku_cachefile_close(&f1, 0, 0, FALSE, ZERO_LSN); assert(r==0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r==0);
r = toku_cachetable_unpin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), CACHETABLE_CLEAN, 0); assert(r==0); r = toku_cachetable_unpin(f2, make_blocknum(1), toku_cachetable_hash(f2, make_blocknum(1)), CACHETABLE_CLEAN, 0); assert(r==0);
r = toku_cachetable_unpin(f2, make_blocknum(2), toku_cachetable_hash(f2, make_blocknum(2)), CACHETABLE_CLEAN, 0); assert(r==0); r = toku_cachetable_unpin(f2, make_blocknum(2), toku_cachetable_hash(f2, make_blocknum(2)), CACHETABLE_CLEAN, 0); assert(r==0);
r = toku_cachefile_close(&f2, 0, 0, FALSE, ZERO_LSN); assert(r==0); r = toku_cachefile_close(&f2, 0, FALSE, ZERO_LSN); assert(r==0);
r = toku_cachetable_unpin(f3, make_blocknum(2), toku_cachetable_hash(f3, make_blocknum(2)), CACHETABLE_CLEAN, 0); assert(r==0); r = toku_cachetable_unpin(f3, make_blocknum(2), toku_cachetable_hash(f3, make_blocknum(2)), CACHETABLE_CLEAN, 0); assert(r==0);
r = toku_cachefile_close(&f3, 0, 0, FALSE, ZERO_LSN); assert(r==0); r = toku_cachefile_close(&f3, 0, FALSE, ZERO_LSN); assert(r==0);
r = toku_cachetable_close(&t); assert(r==0); r = toku_cachetable_close(&t); assert(r==0);
} }
...@@ -543,7 +543,7 @@ static void test_dirty(void) { ...@@ -543,7 +543,7 @@ static void test_dirty(void) {
assert(dirty == 1); assert(dirty == 1);
assert(pinned == 0); assert(pinned == 0);
r = toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); r = toku_cachefile_close(&f, 0, FALSE, ZERO_LSN);
assert(r == 0); assert(r == 0);
r = toku_cachetable_close(&t); r = toku_cachetable_close(&t);
assert(r == 0); assert(r == 0);
...@@ -620,7 +620,7 @@ static void test_size_resize(void) { ...@@ -620,7 +620,7 @@ static void test_size_resize(void) {
r = toku_cachetable_unpin(f, key, hkey, CACHETABLE_CLEAN, new_size); r = toku_cachetable_unpin(f, key, hkey, CACHETABLE_CLEAN, new_size);
assert(r == 0); assert(r == 0);
r = toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); r = toku_cachefile_close(&f, 0, FALSE, ZERO_LSN);
assert(r == 0); assert(r == 0);
r = toku_cachetable_close(&t); r = toku_cachetable_close(&t);
assert(r == 0); assert(r == 0);
...@@ -688,7 +688,7 @@ static void test_size_flush(void) { ...@@ -688,7 +688,7 @@ static void test_size_flush(void) {
assert(r == 0); assert(r == 0);
} }
r = toku_cachefile_close(&f, 0, 0, FALSE, ZERO_LSN); r = toku_cachefile_close(&f, 0, FALSE, ZERO_LSN);
assert(r == 0); assert(r == 0);
r = toku_cachetable_close(&t); r = toku_cachetable_close(&t);
assert(r == 0); assert(r == 0);
......
...@@ -226,13 +226,13 @@ static void test_chaining (void) { ...@@ -226,13 +226,13 @@ static void test_chaining (void) {
//printf("Close %d (%p), now n_present=%d\n", i, f[i], n_present); //printf("Close %d (%p), now n_present=%d\n", i, f[i], n_present);
//print_ints(); //print_ints();
CACHEFILE oldcf=f[i]; CACHEFILE oldcf=f[i];
r = toku_cachefile_close(&f[i], 0, 0, FALSE, ZERO_LSN); assert(r==0); r = toku_cachefile_close(&f[i], 0, FALSE, ZERO_LSN); assert(r==0);
file_is_not_present(oldcf); file_is_not_present(oldcf);
r = toku_cachetable_openf(&f[i], ct, fname[i], fname[i], O_RDWR, S_IRWXU|S_IRWXG|S_IRWXO); assert(r==0); r = toku_cachetable_openf(&f[i], ct, fname[i], fname[i], O_RDWR, S_IRWXU|S_IRWXG|S_IRWXO); assert(r==0);
} }
} }
for (i=0; i<N_FILES; i++) { for (i=0; i<N_FILES; i++) {
r = toku_cachefile_close(&f[i], 0, 0, FALSE, ZERO_LSN); assert(r==0); r = toku_cachefile_close(&f[i], 0, FALSE, ZERO_LSN); assert(r==0);
} }
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -67,7 +67,7 @@ cachetable_unpin_test (int n) { ...@@ -67,7 +67,7 @@ cachetable_unpin_test (int n) {
r = toku_cachetable_unpin(f1, k, toku_cachetable_hash(f1, k), CACHETABLE_CLEAN, 1); r = toku_cachetable_unpin(f1, k, toku_cachetable_hash(f1, k), CACHETABLE_CLEAN, 1);
assert(r != 0); assert(r != 0);
r = toku_cachefile_close(&f1, NULL_LOGGER, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0); r = toku_cachetable_close(&ct); assert(r == 0 && ct == 0);
} }
......
...@@ -50,7 +50,7 @@ static void test_flat (void) { ...@@ -50,7 +50,7 @@ static void test_flat (void) {
assert(less>=prevless); prevless=less; assert(less>=prevless); prevless=less;
assert(greater<=prevgreater); prevgreater=greater; assert(greater<=prevgreater); prevgreater=greater;
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -72,7 +72,7 @@ static void test_flat (void) { ...@@ -72,7 +72,7 @@ static void test_flat (void) {
assert(equal==0); assert(equal==0);
assert(less+equal+greater == limit*ilimit); assert(less+equal+greater == limit*ilimit);
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -54,7 +54,7 @@ static void test_flat (void) { ...@@ -54,7 +54,7 @@ static void test_flat (void) {
assert(less>=prevless); prevless = less; assert(less>=prevless); prevless = less;
assert(greater<=prevgreater); prevgreater = greater; assert(greater<=prevgreater); prevgreater = greater;
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -60,7 +60,7 @@ static void test_flat (void) { ...@@ -60,7 +60,7 @@ static void test_flat (void) {
assert(equal==0); assert(equal==0);
assert(less+equal+greater == limit); assert(less+equal+greater == limit);
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -53,7 +53,7 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute ...@@ -53,7 +53,7 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute
} }
r = toku_brt_cursor_close(cursor); assert(r==0); r = toku_brt_cursor_close(cursor); assert(r==0);
r = toku_close_brt(brt, 0, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
return 0; return 0;
} }
...@@ -46,7 +46,7 @@ doit (void) { ...@@ -46,7 +46,7 @@ doit (void) {
assert(pair.call_count==0); assert(pair.call_count==0);
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -30,7 +30,7 @@ test_overflow (void) { ...@@ -30,7 +30,7 @@ test_overflow (void) {
char key[]={(char)('a'+i), 0}; char key[]={(char)('a'+i), 0};
toku_brt_insert(t, toku_fill_dbt(&k, key, 2), toku_fill_dbt(&v,buf,sizeof(buf)), null_txn); toku_brt_insert(t, toku_fill_dbt(&k, key, 2), toku_fill_dbt(&v,buf,sizeof(buf)), null_txn);
} }
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -58,7 +58,7 @@ doit (void) { ...@@ -58,7 +58,7 @@ doit (void) {
assert(r==0); assert(r==0);
assert(pair.call_count == 1); assert(pair.call_count == 1);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
} }
......
...@@ -130,7 +130,7 @@ doit (int ksize __attribute__((__unused__))) { ...@@ -130,7 +130,7 @@ doit (int ksize __attribute__((__unused__))) {
r = toku_testsetup_root(t, anode); r = toku_testsetup_root(t, anode);
assert(r==0); assert(r==0);
r = toku_close_brt(t, 0, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
//printf("ksize=%d, unused\n", ksize); //printf("ksize=%d, unused\n", ksize);
......
...@@ -1649,7 +1649,7 @@ int log_compare(const DB_LSN * a, const DB_LSN * b) { ...@@ -1649,7 +1649,7 @@ int log_compare(const DB_LSN * a, const DB_LSN * b) {
static int static int
db_close_before_brt(DB *db, u_int32_t UU(flags)) { db_close_before_brt(DB *db, u_int32_t UU(flags)) {
char *error_string = 0; char *error_string = 0;
int r1 = toku_close_brt(db->i->brt, db->dbenv->i->logger, &error_string); int r1 = toku_close_brt(db->i->brt, &error_string);
if (r1) { if (r1) {
db->dbenv->i->is_panicked = r1; // Panicking the whole environment may be overkill, but I'm not sure what else to do. db->dbenv->i->is_panicked = r1; // Panicking the whole environment may be overkill, but I'm not sure what else to do.
db->dbenv->i->panic_string = error_string; db->dbenv->i->panic_string = error_string;
......
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