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 {
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 */
......
......@@ -2070,7 +2070,7 @@ error:
// This one has no env
int toku_open_brt (const char *fname, const char *dbname, int is_create, BRT *newbrt, int nodesize, CACHETABLE cachetable, TOKUTXN txn,
int (*compare_fun)(DB*,const DBT*,const DBT*), DB *db) {
int (*compare_fun)(DB*,const DBT*,const DBT*), DB *db) {
BRT brt;
int r;
const int only_create = 0;
......
......@@ -828,6 +828,8 @@ int toku_brt_create(BRT *brt_ptr) {
brt->nodesize = BRT_DEFAULT_NODE_SIZE;
brt->compare_fun = 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;
return 0;
}
......@@ -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);
if (r != 0) {
toku_omt_destroy(&brt->txns);
toku_free(brt);
return r;
}
......@@ -1126,6 +1129,8 @@ int toku_close_brt (BRT brt) {
if (brt->database_name) toku_free(brt->database_name);
if (brt->skey) { toku_free(brt->skey); }
if (brt->sval) { toku_free(brt->sval); }
assert(toku_omt_size(brt->txns)==0);
toku_omt_destroy(&brt->txns);
toku_free(brt);
return 0;
}
......
......@@ -362,6 +362,8 @@ static void cleanup_txn (TOKUTXN txn) {
}
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);
return;
......@@ -467,7 +469,12 @@ int toku_logger_txn_begin (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGER
TAGMALLOC(TOKUTXN, result);
if (result==0) return errno;
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->logger = logger;
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