Commit 86c886bf authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4876], [t:4919], finish removing ydb lock from loader, clean up some code for 4876

git-svn-id: file:///svn/toku/tokudb@44093 c7de825b-a66e-492c-adef-691d508d4ae1
parent 565e6820
......@@ -19,9 +19,6 @@
extern "C" {
#endif
// typedef void(*voidfp)(void *thunk);
// typedef void(*YIELDF)(voidfp, void *fpthunk, void *yieldthunk);
struct roll_entry;
#include "logger.h"
......
......@@ -206,14 +206,6 @@ BOOL toku_txn_requires_checkpoint(TOKUTXN txn) {
return (!txn->parent && txn->checkpoint_needed_before_commit);
}
//TODO(yoni): inline this function manually
static void
log_xcommit(void *thunk) {
struct xcommit_info *info = thunk;
TOKUTXN txn = info->txn;
info->r = toku_log_xcommit(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64); // exits holding neither of the tokulogger locks.
}
int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, LSN oplsn,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra)
// Effect: Among other things: if release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken)
......@@ -236,14 +228,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, LSN oplsn,
txn->progress_poll_fun = poll;
txn->progress_poll_fun_extra = poll_extra;
{
struct xcommit_info info = {
.r = 0,
.txn = txn,
};
log_xcommit(&info);
r = info.r;
}
r = toku_log_xcommit(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64);
if (r==0) {
r = toku_rollback_commit(txn, oplsn);
STATUS_VALUE(TXN_COMMIT)++;
......
......@@ -285,11 +285,9 @@ int toku_loader_create_loader(DB_ENV *env,
if (loader->i->loader_flags & LOADER_USE_PUTS) {
XCALLOC_N(loader->i->N, loader->i->ekeys);
XCALLOC_N(loader->i->N, loader->i->evals);
toku_ydb_unlock();
// the following function grabs the ydb lock, so we
// first unlock before calling it
rval = ft_loader_close_and_redirect(loader);
toku_ydb_lock();
assert_zero(rval);
for (int i=0; i<N; i++) {
loader->i->ekeys[i].flags = DB_DBT_REALLOC;
......
......@@ -1668,7 +1668,7 @@ locked_env_create_indexer(DB_ENV *env,
}
static int
locked_env_create_loader(DB_ENV *env,
env_create_loader(DB_ENV *env,
DB_TXN *txn,
DB_LOADER **blp,
DB *src_db,
......@@ -1677,9 +1677,7 @@ locked_env_create_loader(DB_ENV *env,
uint32_t db_flags[N],
uint32_t dbt_flags[N],
uint32_t loader_flags) {
toku_ydb_lock();
int r = toku_loader_create_loader(env, txn, blp, src_db, N, dbs, db_flags, dbt_flags, loader_flags);
toku_ydb_unlock();
return r;
}
......@@ -2440,7 +2438,6 @@ toku_env_create(DB_ENV ** envp, u_int32_t flags) {
SENV(txn_stat);
SENV(set_redzone);
SENV(create_indexer);
SENV(create_loader);
SENV(get_lock_timeout);
SENV(set_lock_timeout);
#undef SENV
......@@ -2466,6 +2463,7 @@ toku_env_create(DB_ENV ** envp, u_int32_t flags) {
result->set_errfile = toku_env_set_errfile;
result->set_errpfx = toku_env_set_errpfx;
result->txn_begin = locked_txn_begin;
result->create_loader = env_create_loader;
MALLOC(result->i);
if (result->i == 0) { r = ENOMEM; goto cleanup; }
......
......@@ -281,6 +281,8 @@ locked_txn_id(DB_TXN *txn) {
static int
toku_txn_txn_stat (DB_TXN *txn, struct txn_stat **txn_stat) {
XMALLOC(*txn_stat);
// TODO: (Zardosht) make sure thread safety of this is resolved
// with some tokutxn lock that Leif is working on
return toku_logger_txn_rollback_raw_count(db_txn_struct_i(txn)->tokutxn, &(*txn_stat)->rollback_raw_count);
}
......
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