Commit 61d34063 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4890], remove tabs from roll.c, rollback.c, txn.c

git-svn-id: file:///svn/toku/tokudb@43731 c7de825b-a66e-492c-adef-691d508d4ae1
parent 403ddb8f
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$" #ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
...@@ -60,8 +61,8 @@ toku_commit_fdelete (u_int8_t file_was_open, ...@@ -60,8 +61,8 @@ toku_commit_fdelete (u_int8_t file_was_open,
assert(r==0); assert(r==0);
} }
{ {
char *fname_in_env = fixup_fname(&bs_fname); char *fname_in_env = fixup_fname(&bs_fname);
char *fname_in_cwd = toku_cachetable_get_fname_in_cwd(txn->logger->ct, fname_in_env); char *fname_in_cwd = toku_cachetable_get_fname_in_cwd(txn->logger->ct, fname_in_env);
// bug fix for #4718 // bug fix for #4718
// bug was introduced in with fix for #3590 // bug was introduced in with fix for #3590
...@@ -81,10 +82,10 @@ toku_commit_fdelete (u_int8_t file_was_open, ...@@ -81,10 +82,10 @@ toku_commit_fdelete (u_int8_t file_was_open,
assert_zero(r); assert_zero(r);
} }
r = unlink(fname_in_cwd); r = unlink(fname_in_cwd);
assert(r==0 || errno==ENOENT); assert(r==0 || errno==ENOENT);
toku_free(fname_in_env); toku_free(fname_in_env);
toku_free(fname_in_cwd); toku_free(fname_in_cwd);
} }
done: done:
return 0; return 0;
...@@ -147,13 +148,13 @@ toku_rollback_fcreate (FILENUM filenum, ...@@ -147,13 +148,13 @@ toku_rollback_fcreate (FILENUM filenum,
assert(r==0); assert(r==0);
{ {
char *fname_in_env = fixup_fname(&bs_fname); char *fname_in_env = fixup_fname(&bs_fname);
char *fname_in_cwd = toku_cachetable_get_fname_in_cwd(txn->logger->ct, fname_in_env); char *fname_in_cwd = toku_cachetable_get_fname_in_cwd(txn->logger->ct, fname_in_env);
r = unlink(fname_in_cwd); r = unlink(fname_in_cwd);
assert(r==0 || errno==ENOENT); assert(r==0 || errno==ENOENT);
toku_free(fname_in_env); toku_free(fname_in_env);
toku_free(fname_in_cwd); toku_free(fname_in_cwd);
} }
done: done:
return 0; return 0;
...@@ -174,7 +175,7 @@ static int find_ft_from_filenum (OMTVALUE v, void *filenumvp) { ...@@ -174,7 +175,7 @@ static int find_ft_from_filenum (OMTVALUE v, void *filenumvp) {
// The oplsn argument is ZERO_LSN for normal operation. When this function is called for recovery, it has the LSN of // The oplsn argument is ZERO_LSN for normal operation. When this function is called for recovery, it has the LSN of
// the operation (insert, delete, update, etc). // the operation (insert, delete, update, etc).
static int do_insertion (enum ft_msg_type type, FILENUM filenum, BYTESTRING key, BYTESTRING *data, TOKUTXN txn, LSN oplsn, static int do_insertion (enum ft_msg_type type, FILENUM filenum, BYTESTRING key, BYTESTRING *data, TOKUTXN txn, LSN oplsn,
BOOL reset_root_xid_that_created) { BOOL reset_root_xid_that_created) {
CACHEFILE cf; CACHEFILE cf;
// 2954 - ignore messages for aborted hot-index // 2954 - ignore messages for aborted hot-index
int r = toku_txn_ignore_contains(txn, filenum); int r = toku_txn_ignore_contains(txn, filenum);
...@@ -195,13 +196,13 @@ static int do_insertion (enum ft_msg_type type, FILENUM filenum, BYTESTRING key, ...@@ -195,13 +196,13 @@ static int do_insertion (enum ft_msg_type type, FILENUM filenum, BYTESTRING key,
assert(r==0); assert(r==0);
FT h = hv; FT h = hv;
if (oplsn.lsn != 0) { // if we are executing the recovery algorithm if (oplsn.lsn != 0) { // if we are executing the recovery algorithm
LSN treelsn = toku_ft_checkpoint_lsn(h); LSN treelsn = toku_ft_checkpoint_lsn(h);
if (oplsn.lsn <= treelsn.lsn) { // if operation was already applied to tree ... if (oplsn.lsn <= treelsn.lsn) { // if operation was already applied to tree ...
r = 0; // ... do not apply it again. r = 0; // ... do not apply it again.
goto cleanup; goto cleanup;
} }
} }
DBT key_dbt,data_dbt; DBT key_dbt,data_dbt;
XIDS xids = toku_txn_get_xids(txn); XIDS xids = toku_txn_get_xids(txn);
...@@ -214,10 +215,10 @@ static int do_insertion (enum ft_msg_type type, FILENUM filenum, BYTESTRING key, ...@@ -214,10 +215,10 @@ static int do_insertion (enum ft_msg_type type, FILENUM filenum, BYTESTRING key,
: toku_init_dbt(&data_dbt) }}; : toku_init_dbt(&data_dbt) }};
r = toku_ft_root_put_cmd(h, &ftcmd); r = toku_ft_root_put_cmd(h, &ftcmd);
if (r == 0 && reset_root_xid_that_created) { if (r == 0 && reset_root_xid_that_created) {
TXNID new_root_xid_that_created = xids_get_outermost_xid(xids); TXNID new_root_xid_that_created = xids_get_outermost_xid(xids);
toku_reset_root_xid_that_created(h, new_root_xid_that_created); toku_reset_root_xid_that_created(h, new_root_xid_that_created);
} }
} }
cleanup: cleanup:
toku_cachefile_unpin_fd(cf); toku_cachefile_unpin_fd(cf);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$" #ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
...@@ -350,7 +351,7 @@ static void rollback_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM logna ...@@ -350,7 +351,7 @@ static void rollback_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM logna
} }
static int rollback_fetch_callback (CACHEFILE cachefile, int fd, BLOCKNUM logname, u_int32_t fullhash, static int rollback_fetch_callback (CACHEFILE cachefile, int fd, BLOCKNUM logname, u_int32_t fullhash,
void **rollback_pv, void** UU(disk_data), PAIR_ATTR *sizep, int * UU(dirtyp), void *extraargs) { void **rollback_pv, void** UU(disk_data), PAIR_ATTR *sizep, int * UU(dirtyp), void *extraargs) {
int r; int r;
FT h = extraargs; FT h = extraargs;
assert(h->cf == cachefile); assert(h->cf == cachefile);
...@@ -577,7 +578,7 @@ void toku_get_and_pin_rollback_log_for_new_entry (TOKUTXN txn, ROLLBACK_LOG_NODE ...@@ -577,7 +578,7 @@ void toku_get_and_pin_rollback_log_for_new_entry (TOKUTXN txn, ROLLBACK_LOG_NODE
rollback_log_create(txn, txn->spilled_rollback_tail, txn->spilled_rollback_tail_hash, &pinned_log); rollback_log_create(txn, txn->spilled_rollback_tail, txn->spilled_rollback_tail_hash, &pinned_log);
} }
assert(pinned_log->txnid == txn->txnid64); assert(pinned_log->txnid == txn->txnid64);
assert(pinned_log->blocknum.b != ROLLBACK_NONE.b); assert(pinned_log->blocknum.b != ROLLBACK_NONE.b);
*log = pinned_log; *log = pinned_log;
} }
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$" #ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
...@@ -23,9 +24,9 @@ static void verify_snapshot_system(TOKULOGGER logger); ...@@ -23,9 +24,9 @@ static void verify_snapshot_system(TOKULOGGER logger);
static TXN_STATUS_S txn_status; static TXN_STATUS_S txn_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l) { \
txn_status.status[k].keyname = #k; \ txn_status.status[k].keyname = #k; \
txn_status.status[k].type = t; \ txn_status.status[k].type = t; \
txn_status.status[k].legend = "txn: " l; \ txn_status.status[k].legend = "txn: " l; \
} }
static void static void
...@@ -49,7 +50,7 @@ status_init(void) { ...@@ -49,7 +50,7 @@ status_init(void) {
void void
toku_txn_get_status(TOKULOGGER logger, TXN_STATUS s) { toku_txn_get_status(TOKULOGGER logger, TXN_STATUS s) {
if (!txn_status.initialized) if (!txn_status.initialized)
status_init(); status_init();
{ {
time_t oldest_starttime; time_t oldest_starttime;
STATUS_VALUE(TXN_OLDEST_LIVE) = toku_logger_get_oldest_living_xid(logger, &oldest_starttime); STATUS_VALUE(TXN_OLDEST_LIVE) = toku_logger_get_oldest_living_xid(logger, &oldest_starttime);
...@@ -229,7 +230,7 @@ toku_txn_create_txn ( ...@@ -229,7 +230,7 @@ toku_txn_create_txn (
STATUS_VALUE(TXN_BEGIN)++; STATUS_VALUE(TXN_BEGIN)++;
STATUS_VALUE(TXN_NUM_OPEN)++; STATUS_VALUE(TXN_NUM_OPEN)++;
if (STATUS_VALUE(TXN_NUM_OPEN) > STATUS_VALUE(TXN_MAX_OPEN)) if (STATUS_VALUE(TXN_NUM_OPEN) > STATUS_VALUE(TXN_MAX_OPEN))
STATUS_VALUE(TXN_MAX_OPEN) = STATUS_VALUE(TXN_NUM_OPEN); STATUS_VALUE(TXN_MAX_OPEN) = STATUS_VALUE(TXN_NUM_OPEN);
if (garbage_collection_debug) { if (garbage_collection_debug) {
verify_snapshot_system(logger); verify_snapshot_system(logger);
...@@ -357,13 +358,13 @@ toku_txn_load_txninfo (TOKUTXN txn, TXNINFO info) { ...@@ -357,13 +358,13 @@ toku_txn_load_txninfo (TOKUTXN txn, TXNINFO info) {
int toku_txn_commit_txn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, int toku_txn_commit_txn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra, TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra,
bool release_multi_operation_client_lock) bool release_multi_operation_client_lock)
// Effect: Doesn't close the txn, just performs the commit operations. // Effect: Doesn't close the txn, just performs the commit operations.
// If release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken) // If release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken)
{ {
return toku_txn_commit_with_lsn(txn, nosync, yield, yieldv, ZERO_LSN, return toku_txn_commit_with_lsn(txn, nosync, yield, yieldv, ZERO_LSN,
poll, poll_extra, poll, poll_extra,
release_multi_operation_client_lock); release_multi_operation_client_lock);
} }
...@@ -391,7 +392,7 @@ log_xcommit(void *thunk) { ...@@ -391,7 +392,7 @@ log_xcommit(void *thunk) {
int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, LSN oplsn, int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, LSN oplsn,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra, TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra,
bool release_multi_operation_client_lock) bool release_multi_operation_client_lock)
// Effect: Among other things: if release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken) // Effect: Among other things: if release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken)
{ {
if (txn->state==TOKUTXN_PREPARING) { if (txn->state==TOKUTXN_PREPARING) {
...@@ -428,8 +429,8 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv ...@@ -428,8 +429,8 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv
r = info.r; r = info.r;
} }
if (r==0) { if (r==0) {
r = toku_rollback_commit(txn, yield, yieldv, oplsn); r = toku_rollback_commit(txn, yield, yieldv, oplsn);
STATUS_VALUE(TXN_COMMIT)++; STATUS_VALUE(TXN_COMMIT)++;
} }
// Make sure we release that lock (even if there was an error) // Make sure we release that lock (even if there was an error)
if (release_multi_operation_client_lock) toku_multi_operation_client_unlock(); if (release_multi_operation_client_lock) toku_multi_operation_client_unlock();
...@@ -438,7 +439,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv ...@@ -438,7 +439,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv
int toku_txn_abort_txn(TOKUTXN txn, YIELDF yield, void *yieldv, int toku_txn_abort_txn(TOKUTXN txn, YIELDF yield, void *yieldv,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra, TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra,
bool release_multi_operation_client_lock) bool release_multi_operation_client_lock)
// Effect: Doesn't close the txn, just performs the abort operations. // Effect: Doesn't close the txn, just performs the abort operations.
// If release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken) // If release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken)
{ {
...@@ -447,7 +448,7 @@ int toku_txn_abort_txn(TOKUTXN txn, YIELDF yield, void *yieldv, ...@@ -447,7 +448,7 @@ int toku_txn_abort_txn(TOKUTXN txn, YIELDF yield, void *yieldv,
int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn, int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra, TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra,
bool release_multi_operation_client_lock) bool release_multi_operation_client_lock)
// Effect: Ammong other things, if release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken) // Effect: Ammong other things, if release_multi_operation_client_lock is true, then unlock that lock (even if an error path is taken)
{ {
if (txn->state==TOKUTXN_PREPARING) { if (txn->state==TOKUTXN_PREPARING) {
...@@ -469,8 +470,8 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn, ...@@ -469,8 +470,8 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
txn->do_fsync = FALSE; txn->do_fsync = FALSE;
r = toku_log_xabort(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64); r = toku_log_xabort(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64);
if (r==0) { if (r==0) {
r = toku_rollback_abort(txn, yield, yieldv, oplsn); r = toku_rollback_abort(txn, yield, yieldv, oplsn);
STATUS_VALUE(TXN_ABORT)++; STATUS_VALUE(TXN_ABORT)++;
} }
// Make sure we multi_operation_client_unlock release will happen even if there is an error // Make sure we multi_operation_client_unlock release will happen even if there is an error
if (release_multi_operation_client_lock) toku_multi_operation_client_unlock(); if (release_multi_operation_client_lock) toku_multi_operation_client_unlock();
...@@ -523,28 +524,28 @@ int toku_logger_get_txn_from_xid (TOKULOGGER logger, TOKU_XA_XID *xid, DB_TXN ** ...@@ -523,28 +524,28 @@ int toku_logger_get_txn_from_xid (TOKULOGGER logger, TOKU_XA_XID *xid, DB_TXN **
int toku_logger_recover_txn (TOKULOGGER logger, struct tokulogger_preplist preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags) { int toku_logger_recover_txn (TOKULOGGER logger, struct tokulogger_preplist preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags) {
if (flags==DB_FIRST) { if (flags==DB_FIRST) {
// Anything in the returned list goes back on the prepared list. // Anything in the returned list goes back on the prepared list.
while (!toku_list_empty(&logger->prepared_and_returned_txns)) { while (!toku_list_empty(&logger->prepared_and_returned_txns)) {
struct toku_list *h = toku_list_head(&logger->prepared_and_returned_txns); struct toku_list *h = toku_list_head(&logger->prepared_and_returned_txns);
toku_list_remove(h); toku_list_remove(h);
toku_list_push(&logger->prepared_txns, h); toku_list_push(&logger->prepared_txns, h);
} }
} else if (flags!=DB_NEXT) { } else if (flags!=DB_NEXT) {
return EINVAL; return EINVAL;
} }
long i; long i;
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
if (!toku_list_empty(&logger->prepared_txns)) { if (!toku_list_empty(&logger->prepared_txns)) {
struct toku_list *h = toku_list_head(&logger->prepared_txns); struct toku_list *h = toku_list_head(&logger->prepared_txns);
toku_list_remove(h); toku_list_remove(h);
toku_list_push(&logger->prepared_and_returned_txns, h); toku_list_push(&logger->prepared_and_returned_txns, h);
TOKUTXN txn = toku_list_struct(h, struct tokutxn, prepared_txns_link); TOKUTXN txn = toku_list_struct(h, struct tokutxn, prepared_txns_link);
assert(txn->container_db_txn); assert(txn->container_db_txn);
preplist[i].txn = txn->container_db_txn; preplist[i].txn = txn->container_db_txn;
preplist[i].xid = txn->xa_xid; preplist[i].xid = txn->xa_xid;
} else { } else {
break; break;
} }
} }
*retp = i; *retp = i;
return 0; return 0;
......
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