Commit ac103294 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Start adding the lists. Addresses #749.

git-svn-id: file:///svn/tokudb@3647 c7de825b-a66e-492c-adef-691d508d4ae1
parent d765a3e7
...@@ -131,6 +131,7 @@ struct brt { ...@@ -131,6 +131,7 @@ struct brt {
void *skey,*sval; /* Used for DBT return values. */ void *skey,*sval; /* Used for DBT return values. */
OMT txns; // transactions that are using this OMT (note that the transaction checks the cf also)
}; };
/* serialization code */ /* serialization code */
......
...@@ -828,6 +828,8 @@ int toku_brt_create(BRT *brt_ptr) { ...@@ -828,6 +828,8 @@ int toku_brt_create(BRT *brt_ptr) {
brt->nodesize = BRT_DEFAULT_NODE_SIZE; brt->nodesize = BRT_DEFAULT_NODE_SIZE;
brt->compare_fun = toku_default_compare_fun; brt->compare_fun = toku_default_compare_fun;
brt->dup_compare = toku_default_compare_fun; brt->dup_compare = toku_default_compare_fun;
int r = toku_omt_create(&brt->txns);
if (r!=0) { toku_free(brt); return r; }
*brt_ptr = brt; *brt_ptr = brt;
return 0; return 0;
} }
...@@ -1103,6 +1105,7 @@ int toku_open_brt (const char *fname, const char *dbname, int is_create, BRT *ne ...@@ -1103,6 +1105,7 @@ int toku_open_brt (const char *fname, const char *dbname, int is_create, BRT *ne
r = toku_brt_open(brt, fname, fname, dbname, is_create, only_create, load_flags, cachetable, txn, db); r = toku_brt_open(brt, fname, fname, dbname, is_create, only_create, load_flags, cachetable, txn, db);
if (r != 0) { if (r != 0) {
toku_omt_destroy(&brt->txns);
toku_free(brt); toku_free(brt);
return r; return r;
} }
...@@ -1126,6 +1129,8 @@ int toku_close_brt (BRT brt) { ...@@ -1126,6 +1129,8 @@ int toku_close_brt (BRT brt) {
if (brt->database_name) toku_free(brt->database_name); if (brt->database_name) toku_free(brt->database_name);
if (brt->skey) { toku_free(brt->skey); } if (brt->skey) { toku_free(brt->skey); }
if (brt->sval) { toku_free(brt->sval); } if (brt->sval) { toku_free(brt->sval); }
assert(toku_omt_size(brt->txns)==0);
toku_omt_destroy(&brt->txns);
toku_free(brt); toku_free(brt);
return 0; return 0;
} }
......
...@@ -362,6 +362,8 @@ static void cleanup_txn (TOKUTXN txn) { ...@@ -362,6 +362,8 @@ static void cleanup_txn (TOKUTXN txn) {
} }
list_remove(&txn->live_txns_link); list_remove(&txn->live_txns_link);
assert(toku_omt_size(txn->used_open_brtcachefile_pairs)==0);
toku_omt_destroy(&txn->used_open_brtcachefile_pairs);
toku_free(txn); toku_free(txn);
return; return;
...@@ -467,7 +469,12 @@ int toku_logger_txn_begin (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGER ...@@ -467,7 +469,12 @@ int toku_logger_txn_begin (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGER
TAGMALLOC(TOKUTXN, result); TAGMALLOC(TOKUTXN, result);
if (result==0) return errno; if (result==0) return errno;
int r =toku_log_xbegin(logger, &result->first_lsn, 0, parent_tokutxn ? parent_tokutxn->txnid64 : 0); int r =toku_log_xbegin(logger, &result->first_lsn, 0, parent_tokutxn ? parent_tokutxn->txnid64 : 0);
if (r!=0) { toku_logger_panic(logger, r); return r; } if (r!=0) { toku_logger_panic(logger, r); toku_free(result); return r; }
if ((r=toku_omt_create(&result->used_open_brtcachefile_pairs))!=0) {
toku_logger_panic(logger, r);
toku_free(result);
return r;
}
result->txnid64 = result->first_lsn.lsn; result->txnid64 = result->first_lsn.lsn;
result->logger = logger; result->logger = logger;
result->parent = parent_tokutxn; result->parent = parent_tokutxn;
......
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