summaryrefslogtreecommitdiff
path: root/storage/innobase/trx
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/trx')
-rw-r--r--storage/innobase/trx/trx0purge.c19
-rw-r--r--storage/innobase/trx/trx0roll.c14
-rw-r--r--storage/innobase/trx/trx0rseg.c4
-rw-r--r--storage/innobase/trx/trx0sys.c6
-rw-r--r--storage/innobase/trx/trx0trx.c38
-rw-r--r--storage/innobase/trx/trx0undo.c34
6 files changed, 6 insertions, 109 deletions
diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
index 11e089ac90e..25519a09a1d 100644
--- a/storage/innobase/trx/trx0purge.c
+++ b/storage/innobase/trx/trx0purge.c
@@ -197,9 +197,7 @@ void
trx_purge_sys_create(void)
/*======================*/
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
purge_sys = mem_alloc(sizeof(trx_purge_t));
@@ -260,9 +258,8 @@ trx_purge_add_update_undo_to_history(
ut_ad(undo);
rseg = undo->rseg;
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
@@ -341,9 +338,7 @@ trx_purge_free_segment(
/* fputs("Freeing an update undo log segment\n", stderr); */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
loop:
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
@@ -445,9 +440,7 @@ trx_purge_truncate_rseg_history(
ulint n_removed_logs = 0;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
@@ -537,9 +530,7 @@ trx_purge_truncate_history(void)
dulint limit_trx_no;
dulint limit_undo_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx_purge_arr_get_biggest(purge_sys->arr, &limit_trx_no,
&limit_undo_no);
@@ -579,9 +570,7 @@ trx_purge_truncate_if_arr_empty(void)
/*=================================*/
/* out: TRUE if array empty */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (purge_sys->arr->n_used == 0) {
@@ -610,9 +599,7 @@ trx_purge_rseg_get_next_history_log(
ibool del_marks;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
@@ -715,9 +702,7 @@ trx_purge_choose_next_log(void)
ulint offset = 0; /* remove warning (??? bug ???) */
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(purge_sys->next_stored == FALSE);
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
@@ -818,9 +803,7 @@ trx_purge_get_next_rec(
ulint cmpl_info;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(purge_sys->next_stored);
space = purge_sys->rseg->space;
diff --git a/storage/innobase/trx/trx0roll.c b/storage/innobase/trx/trx0roll.c
index 201d1be3656..91dcf035f96 100644
--- a/storage/innobase/trx/trx0roll.c
+++ b/storage/innobase/trx/trx0roll.c
@@ -785,10 +785,8 @@ trx_roll_try_truncate(
dulint limit;
dulint biggest;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&((trx->rseg)->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx->pages_undone = 0;
@@ -831,9 +829,7 @@ trx_roll_pop_top_rec(
trx_undo_rec_t* prev_rec;
page_t* prev_rec_page;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get_s_latched(undo->space,
undo->top_page_no, mtr);
@@ -1060,9 +1056,7 @@ trx_rollback(
que_thr_t* thr;
/* que_thr_t* thr2; */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((trx->undo_no_arr == NULL) || ((trx->undo_no_arr)->n_used == 0));
/* Initialize the rollback field in the transaction */
@@ -1131,9 +1125,7 @@ trx_roll_graph_build(
que_thr_t* thr;
/* que_thr_t* thr2; */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(512);
fork = que_fork_create(NULL, NULL, QUE_FORK_ROLLBACK, heap);
@@ -1160,9 +1152,7 @@ trx_finish_error_processing(
trx_sig_t* sig;
trx_sig_t* next_sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->signals);
@@ -1195,9 +1185,7 @@ trx_finish_partial_rollback_off_kernel(
{
trx_sig_t* sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->signals);
@@ -1228,9 +1216,7 @@ trx_finish_rollback_off_kernel(
trx_sig_t* sig;
trx_sig_t* next_sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(trx->undo_no_arr == NULL || trx->undo_no_arr->n_used == 0);
diff --git a/storage/innobase/trx/trx0rseg.c b/storage/innobase/trx/trx0rseg.c
index 7a6989c7b4f..020f217c90b 100644
--- a/storage/innobase/trx/trx0rseg.c
+++ b/storage/innobase/trx/trx0rseg.c
@@ -60,9 +60,7 @@ trx_rseg_header_create(
page_t* page;
ut_ad(mtr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
sys_header = trx_sysf_get(mtr);
@@ -138,9 +136,7 @@ trx_rseg_mem_create(
ulint sum_of_undo_sizes;
ulint len;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
rseg = mem_alloc(sizeof(trx_rseg_t));
diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
index b87f3d5e090..307a03bfbc3 100644
--- a/storage/innobase/trx/trx0sys.c
+++ b/storage/innobase/trx/trx0sys.c
@@ -547,9 +547,7 @@ trx_in_trx_list(
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
@@ -576,9 +574,7 @@ trx_sys_flush_max_trx_id(void)
trx_sysf_t* sys_header;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
@@ -799,9 +795,7 @@ trx_sysf_rseg_find_free(
ulint page_no;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
sys_header = trx_sysf_get(mtr);
diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
index 6f59d2659ec..2f0c25c323a 100644
--- a/storage/innobase/trx/trx0trx.c
+++ b/storage/innobase/trx/trx0trx.c
@@ -101,9 +101,7 @@ trx_create(
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx = mem_alloc(sizeof(trx_t));
@@ -280,9 +278,7 @@ trx_free(
/*=====*/
trx_t* trx) /* in, own: trx object */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
@@ -406,9 +402,7 @@ trx_list_insert_ordered(
{
trx_t* trx2;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
@@ -633,9 +627,7 @@ trx_assign_rseg(void)
{
trx_rseg_t* rseg = trx_sys->latest_rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
loop:
/* Get next rseg in a round-robin fashion */
@@ -672,9 +664,7 @@ trx_start_low(
{
trx_rseg_t* rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->rseg == NULL);
if (trx->type == TRX_PURGE) {
@@ -749,9 +739,7 @@ trx_commit_off_kernel(
ibool must_flush_log = FALSE;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx->must_flush_log_later = FALSE;
@@ -851,9 +839,7 @@ trx_commit_off_kernel(
ut_ad(trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* The following assignment makes the transaction committed in memory
and makes its changes to data visible to other transactions.
@@ -1036,9 +1022,7 @@ trx_handle_commit_sig_off_kernel(
trx_sig_t* sig;
trx_sig_t* next_sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx->que_state = TRX_QUE_COMMITTING;
@@ -1078,9 +1062,7 @@ trx_end_lock_wait(
{
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
@@ -1107,9 +1089,7 @@ trx_lock_wait_to_suspended(
{
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
@@ -1137,9 +1117,7 @@ trx_sig_reply_wait_to_suspended(
trx_sig_t* sig;
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->reply_signals);
@@ -1172,9 +1150,7 @@ trx_sig_is_compatible(
{
trx_sig_t* sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (UT_LIST_GET_LEN(trx->signals) == 0) {
@@ -1260,9 +1236,7 @@ trx_sig_send(
trx_t* receiver_trx;
ut_ad(trx);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (!trx_sig_is_compatible(trx, type, sender)) {
/* The signal is not compatible with the other signals in
@@ -1332,9 +1306,7 @@ trx_end_signal_handling(
/*====================*/
trx_t* trx) /* in: trx */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->handling_signals == TRUE);
trx->handling_signals = FALSE;
@@ -1368,9 +1340,7 @@ loop:
we can process immediately */
ut_ad(trx);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (trx->handling_signals && (UT_LIST_GET_LEN(trx->signals) == 0)) {
@@ -1471,9 +1441,7 @@ trx_sig_reply(
trx_t* receiver_trx;
ut_ad(sig);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (sig->receiver != NULL) {
ut_ad((sig->receiver)->state == QUE_THR_SIG_REPLY_WAIT);
@@ -1501,9 +1469,7 @@ trx_sig_remove(
trx_sig_t* sig) /* in, own: signal */
{
ut_ad(trx && sig);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(sig->receiver == NULL);
@@ -1820,9 +1786,7 @@ trx_prepare_off_kernel(
dulint lsn;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
@@ -1868,9 +1832,7 @@ trx_prepare_off_kernel(
mutex_enter(&kernel_mutex);
}
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/*--------------------------------------*/
trx->conc_state = TRX_PREPARED;
diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c
index fbcfab38f01..831e337f513 100644
--- a/storage/innobase/trx/trx0undo.c
+++ b/storage/innobase/trx/trx0undo.c
@@ -395,9 +395,7 @@ trx_undo_seg_create(
ibool success;
ut_ad(mtr && id && rseg_hdr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* fputs(type == TRX_UNDO_INSERT
? "Creating insert undo log segment\n"
@@ -836,11 +834,9 @@ trx_undo_add_page(
ulint n_reserved;
ibool success;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(trx->rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
@@ -911,10 +907,8 @@ trx_undo_free_page(
ulint hist_size;
ut_a(hdr_page_no != page_no);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get(space, page_no, mtr);
@@ -961,9 +955,7 @@ trx_undo_free_page_in_rollback(
ulint last_page_no;
ut_ad(undo->hdr_page_no != page_no);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
last_page_no = trx_undo_free_page(undo->rseg, FALSE, undo->space,
undo->hdr_page_no, page_no, mtr);
@@ -1016,10 +1008,8 @@ trx_undo_truncate_end(
trx_rseg_t* rseg;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&(trx->rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
@@ -1096,9 +1086,7 @@ trx_undo_truncate_start(
ulint page_no;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (0 == ut_dulint_cmp(limit, ut_dulint_zero)) {
@@ -1164,9 +1152,9 @@ trx_undo_seg_free(
while (!finished) {
mtr_start(&mtr);
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
mutex_enter(&(rseg->mutex));
seg_header = trx_undo_page_get(undo->space, undo->hdr_page_no,
@@ -1389,9 +1377,7 @@ trx_undo_mem_create(
{
trx_undo_t* undo;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
@@ -1437,11 +1423,9 @@ trx_undo_mem_init_for_reuse(
XID* xid, /* in: X/Open XA transaction identification*/
ulint offset) /* in: undo log header byte offset on page */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&((undo->rseg)->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
- if (undo->id >= TRX_RSEG_N_SLOTS) {
+ if (UNIV_UNLIKELY(undo->id >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
@@ -1501,9 +1485,7 @@ trx_undo_create(
trx_undo_t* undo;
page_t* undo_page;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (rseg->curr_size == rseg->max_size) {
@@ -1561,9 +1543,7 @@ trx_undo_reuse_cached(
page_t* undo_page;
ulint offset;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (type == TRX_UNDO_INSERT) {
@@ -1671,15 +1651,12 @@ trx_undo_assign_undo(
rseg = trx->rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
mutex_enter(&(rseg->mutex));
undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
@@ -1836,9 +1813,8 @@ trx_undo_update_cleanup(
undo = trx->update_undo;
rseg = trx->rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
trx_purge_add_update_undo_to_history(trx, undo_page, mtr);
UT_LIST_REMOVE(undo_list, rseg->update_undo_list, undo);