mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
Bug#54728: Replace the dulint struct with a 64-bit integer.
This commit is contained in:
parent
eb07ae4605
commit
c1567ecebd
89 changed files with 874 additions and 1572 deletions
|
|
@ -444,7 +444,7 @@ fill_trx_row(
|
|||
|
||||
ut_ad(mutex_own(&kernel_mutex));
|
||||
|
||||
row->trx_id = trx_get_id(trx);
|
||||
row->trx_id = trx->id;
|
||||
row->trx_started = (ib_time_t) trx->start_time;
|
||||
row->trx_state = trx_get_que_state_str(trx);
|
||||
|
||||
|
|
@ -462,7 +462,7 @@ fill_trx_row(
|
|||
row->trx_wait_started = 0;
|
||||
}
|
||||
|
||||
row->trx_weight = (ullint) ut_conv_dulint_to_longlong(TRX_WEIGHT(trx));
|
||||
row->trx_weight = (ullint) TRX_WEIGHT(trx);
|
||||
|
||||
if (trx->mysql_thd == NULL) {
|
||||
/* For internal transactions e.g., purge and transactions
|
||||
|
|
@ -527,7 +527,7 @@ thd_done:
|
|||
|
||||
row->trx_rows_locked = lock_number_of_rows_locked(trx);
|
||||
|
||||
row->trx_rows_modified = ut_conv_dulint_to_longlong(trx->undo_no);
|
||||
row->trx_rows_modified = trx->undo_no;
|
||||
|
||||
row->trx_concurrency_tickets = trx->n_tickets_to_enter_innodb;
|
||||
|
||||
|
|
|
|||
|
|
@ -145,47 +145,44 @@ void
|
|||
trx_purge_arr_get_biggest(
|
||||
/*======================*/
|
||||
trx_undo_arr_t* arr, /*!< in: purge array */
|
||||
trx_id_t* trx_no, /*!< out: transaction number: ut_dulint_zero
|
||||
trx_id_t* trx_no, /*!< out: transaction number: 0
|
||||
if array is empty */
|
||||
undo_no_t* undo_no)/*!< out: undo number */
|
||||
{
|
||||
trx_undo_inf_t* cell;
|
||||
trx_id_t pair_trx_no;
|
||||
undo_no_t pair_undo_no;
|
||||
int trx_cmp;
|
||||
ulint n_used;
|
||||
ulint i;
|
||||
ulint n;
|
||||
|
||||
n = 0;
|
||||
n_used = arr->n_used;
|
||||
pair_trx_no = ut_dulint_zero;
|
||||
pair_undo_no = ut_dulint_zero;
|
||||
n = arr->n_used;
|
||||
pair_trx_no = 0;
|
||||
pair_undo_no = 0;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
cell = trx_undo_arr_get_nth_info(arr, i);
|
||||
if (n) {
|
||||
for (i = 0;; i++) {
|
||||
cell = trx_undo_arr_get_nth_info(arr, i);
|
||||
|
||||
if (cell->in_use) {
|
||||
n++;
|
||||
trx_cmp = ut_dulint_cmp(cell->trx_no, pair_trx_no);
|
||||
if (!cell->in_use) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((trx_cmp > 0)
|
||||
|| ((trx_cmp == 0)
|
||||
&& (ut_dulint_cmp(cell->undo_no,
|
||||
pair_undo_no) >= 0))) {
|
||||
if ((cell->trx_no > pair_trx_no)
|
||||
|| ((cell->trx_no == pair_trx_no)
|
||||
&& cell->undo_no >= pair_undo_no)) {
|
||||
|
||||
pair_trx_no = cell->trx_no;
|
||||
pair_undo_no = cell->undo_no;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == n_used) {
|
||||
*trx_no = pair_trx_no;
|
||||
*undo_no = pair_undo_no;
|
||||
|
||||
return;
|
||||
if (!--n) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*trx_no = pair_trx_no;
|
||||
*undo_no = pair_undo_no;
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
|
|
@ -233,8 +230,8 @@ trx_purge_sys_create(void)
|
|||
|
||||
purge_sys->n_pages_handled = 0;
|
||||
|
||||
purge_sys->purge_trx_no = ut_dulint_zero;
|
||||
purge_sys->purge_undo_no = ut_dulint_zero;
|
||||
purge_sys->purge_trx_no = 0;
|
||||
purge_sys->purge_undo_no = 0;
|
||||
purge_sys->next_stored = FALSE;
|
||||
|
||||
rw_lock_create(trx_purge_latch_key,
|
||||
|
|
@ -257,7 +254,7 @@ trx_purge_sys_create(void)
|
|||
|
||||
purge_sys->query = trx_purge_graph_build();
|
||||
|
||||
purge_sys->view = read_view_oldest_copy_or_open_new(ut_dulint_zero,
|
||||
purge_sys->view = read_view_oldest_copy_or_open_new(0,
|
||||
purge_sys->heap);
|
||||
}
|
||||
|
||||
|
|
@ -370,7 +367,7 @@ trx_purge_add_update_undo_to_history(
|
|||
}
|
||||
|
||||
/* Write the trx number to the undo log header */
|
||||
mlog_write_dulint(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
|
||||
mlog_write_ull(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
|
||||
/* Write information about delete markings to the undo log header */
|
||||
|
||||
if (!undo->del_marks) {
|
||||
|
|
@ -512,9 +509,9 @@ trx_purge_truncate_rseg_history(
|
|||
page_t* undo_page;
|
||||
trx_ulogf_t* log_hdr;
|
||||
trx_usegf_t* seg_hdr;
|
||||
int cmp;
|
||||
ulint n_removed_logs = 0;
|
||||
mtr_t mtr;
|
||||
trx_id_t undo_trx_no;
|
||||
|
||||
ut_ad(mutex_own(&(purge_sys->mutex)));
|
||||
|
||||
|
|
@ -540,15 +537,16 @@ loop:
|
|||
hdr_addr.page, &mtr);
|
||||
|
||||
log_hdr = undo_page + hdr_addr.boffset;
|
||||
undo_trx_no = mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO);
|
||||
|
||||
cmp = ut_dulint_cmp(mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO),
|
||||
limit_trx_no);
|
||||
if (cmp == 0) {
|
||||
trx_undo_truncate_start(rseg, rseg->space, hdr_addr.page,
|
||||
hdr_addr.boffset, limit_undo_no);
|
||||
}
|
||||
if (undo_trx_no >= limit_trx_no) {
|
||||
if (undo_trx_no == limit_trx_no) {
|
||||
trx_undo_truncate_start(rseg, rseg->space,
|
||||
hdr_addr.page,
|
||||
hdr_addr.boffset,
|
||||
limit_undo_no);
|
||||
}
|
||||
|
||||
if (cmp >= 0) {
|
||||
mutex_enter(&kernel_mutex);
|
||||
ut_a(trx_sys->rseg_history_len >= n_removed_logs);
|
||||
trx_sys->rseg_history_len -= n_removed_logs;
|
||||
|
|
@ -614,7 +612,7 @@ trx_purge_truncate_history(void)
|
|||
trx_purge_arr_get_biggest(purge_sys->arr, &limit_trx_no,
|
||||
&limit_undo_no);
|
||||
|
||||
if (ut_dulint_is_zero(limit_trx_no)) {
|
||||
if (limit_trx_no == 0) {
|
||||
|
||||
limit_trx_no = purge_sys->purge_trx_no;
|
||||
limit_undo_no = purge_sys->purge_undo_no;
|
||||
|
|
@ -623,13 +621,12 @@ trx_purge_truncate_history(void)
|
|||
/* We play safe and set the truncate limit at most to the purge view
|
||||
low_limit number, though this is not necessary */
|
||||
|
||||
if (ut_dulint_cmp(limit_trx_no, purge_sys->view->low_limit_no) >= 0) {
|
||||
if (limit_trx_no >= purge_sys->view->low_limit_no) {
|
||||
limit_trx_no = purge_sys->view->low_limit_no;
|
||||
limit_undo_no = ut_dulint_zero;
|
||||
limit_undo_no = 0;
|
||||
}
|
||||
|
||||
ut_ad((ut_dulint_cmp(limit_trx_no,
|
||||
purge_sys->view->low_limit_no) <= 0));
|
||||
ut_ad(limit_trx_no <= purge_sys->view->low_limit_no);
|
||||
|
||||
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
|
||||
|
||||
|
|
@ -684,8 +681,8 @@ trx_purge_rseg_get_next_history_log(
|
|||
|
||||
ut_a(rseg->last_page_no != FIL_NULL);
|
||||
|
||||
purge_sys->purge_trx_no = ut_dulint_add(rseg->last_trx_no, 1);
|
||||
purge_sys->purge_undo_no = ut_dulint_zero;
|
||||
purge_sys->purge_trx_no = rseg->last_trx_no + 1;
|
||||
purge_sys->purge_undo_no = 0;
|
||||
purge_sys->next_stored = FALSE;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
|
@ -787,7 +784,7 @@ trx_purge_choose_next_log(void)
|
|||
|
||||
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
|
||||
|
||||
min_trx_no = ut_dulint_max;
|
||||
min_trx_no = IB_ULONGLONG_MAX;
|
||||
|
||||
min_rseg = NULL;
|
||||
|
||||
|
|
@ -796,9 +793,8 @@ trx_purge_choose_next_log(void)
|
|||
|
||||
if (rseg->last_page_no != FIL_NULL) {
|
||||
|
||||
if ((min_rseg == NULL)
|
||||
|| (ut_dulint_cmp(min_trx_no,
|
||||
rseg->last_trx_no) > 0)) {
|
||||
if (min_rseg == NULL
|
||||
|| min_trx_no > rseg->last_trx_no) {
|
||||
|
||||
min_rseg = rseg;
|
||||
min_trx_no = rseg->last_trx_no;
|
||||
|
|
@ -848,7 +844,7 @@ trx_purge_choose_next_log(void)
|
|||
|
||||
if (rec == &trx_purge_dummy_rec) {
|
||||
|
||||
purge_sys->purge_undo_no = ut_dulint_zero;
|
||||
purge_sys->purge_undo_no = 0;
|
||||
purge_sys->page_no = page_no;
|
||||
purge_sys->offset = 0;
|
||||
} else {
|
||||
|
|
@ -1041,8 +1037,7 @@ trx_purge_fetch_next_rec(
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
if (ut_dulint_cmp(purge_sys->purge_trx_no,
|
||||
purge_sys->view->low_limit_no) >= 0) {
|
||||
if (purge_sys->purge_trx_no >= purge_sys->view->low_limit_no) {
|
||||
purge_sys->state = TRX_STOP_PURGE;
|
||||
|
||||
trx_purge_truncate_if_arr_empty();
|
||||
|
|
@ -1052,10 +1047,10 @@ trx_purge_fetch_next_rec(
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
/* fprintf(stderr, "Thread %lu purging trx %lu undo record %lu\n",
|
||||
/* fprintf(stderr, "Thread %lu purging trx %llu undo record %llu\n",
|
||||
os_thread_get_curr_id(),
|
||||
ut_dulint_get_low(purge_sys->purge_trx_no),
|
||||
ut_dulint_get_low(purge_sys->purge_undo_no)); */
|
||||
(ullint) purge_sys->purge_trx_no,
|
||||
(ullint) purge_sys->purge_undo_no); */
|
||||
|
||||
*roll_ptr = trx_undo_build_roll_ptr(FALSE, (purge_sys->rseg)->id,
|
||||
purge_sys->page_no,
|
||||
|
|
@ -1064,8 +1059,7 @@ trx_purge_fetch_next_rec(
|
|||
*cell = trx_purge_arr_store_info(purge_sys->purge_trx_no,
|
||||
purge_sys->purge_undo_no);
|
||||
|
||||
ut_ad(ut_dulint_cmp(purge_sys->purge_trx_no,
|
||||
(purge_sys->view)->low_limit_no) < 0);
|
||||
ut_ad(purge_sys->purge_trx_no < purge_sys->view->low_limit_no);
|
||||
|
||||
/* The following call will advance the stored values of purge_trx_no
|
||||
and purge_undo_no, therefore we had to store them first */
|
||||
|
|
@ -1157,7 +1151,7 @@ trx_purge(
|
|||
}
|
||||
}
|
||||
|
||||
purge_sys->view = read_view_oldest_copy_or_open_new(ut_dulint_zero,
|
||||
purge_sys->view = read_view_oldest_copy_or_open_new(0,
|
||||
purge_sys->heap);
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
|
|
@ -1215,8 +1209,8 @@ trx_purge_sys_print(void)
|
|||
|
||||
fprintf(stderr, "InnoDB: Purge trx n:o " TRX_ID_FMT
|
||||
", undo n:o " TRX_ID_FMT "\n",
|
||||
TRX_ID_PREP_PRINTF(purge_sys->purge_trx_no),
|
||||
TRX_ID_PREP_PRINTF(purge_sys->purge_undo_no));
|
||||
(ullint) purge_sys->purge_trx_no,
|
||||
(ullint) purge_sys->purge_undo_no);
|
||||
fprintf(stderr,
|
||||
"InnoDB: Purge next stored %lu, page_no %lu, offset %lu,\n"
|
||||
"InnoDB: Purge hdr_page_no %lu, hdr_offset %lu\n",
|
||||
|
|
|
|||
|
|
@ -242,8 +242,8 @@ trx_undo_page_report_insert(
|
|||
|
||||
/* Store first some general parameters to the undo log */
|
||||
*ptr++ = TRX_UNDO_INSERT_REC;
|
||||
ptr += mach_dulint_write_much_compressed(ptr, trx->undo_no);
|
||||
ptr += mach_dulint_write_much_compressed(ptr, index->table->id);
|
||||
ptr += mach_ull_write_much_compressed(ptr, trx->undo_no);
|
||||
ptr += mach_ull_write_much_compressed(ptr, index->table->id);
|
||||
/*----------------------------------------*/
|
||||
/* Store then the fields required to uniquely determine the record
|
||||
to be inserted in the clustered index */
|
||||
|
|
@ -289,7 +289,7 @@ trx_undo_rec_get_pars(
|
|||
ibool* updated_extern, /*!< out: TRUE if we updated an
|
||||
externally stored fild */
|
||||
undo_no_t* undo_no, /*!< out: undo log record number */
|
||||
dulint* table_id) /*!< out: table id */
|
||||
table_id_t* table_id) /*!< out: table id */
|
||||
{
|
||||
byte* ptr;
|
||||
ulint type_cmpl;
|
||||
|
|
@ -309,11 +309,11 @@ trx_undo_rec_get_pars(
|
|||
*type = type_cmpl & (TRX_UNDO_CMPL_INFO_MULT - 1);
|
||||
*cmpl_info = type_cmpl / TRX_UNDO_CMPL_INFO_MULT;
|
||||
|
||||
*undo_no = mach_dulint_read_much_compressed(ptr);
|
||||
ptr += mach_dulint_get_much_compressed_size(*undo_no);
|
||||
*undo_no = mach_ull_read_much_compressed(ptr);
|
||||
ptr += mach_ull_get_much_compressed_size(*undo_no);
|
||||
|
||||
*table_id = mach_dulint_read_much_compressed(ptr);
|
||||
ptr += mach_dulint_get_much_compressed_size(*table_id);
|
||||
*table_id = mach_ull_read_much_compressed(ptr);
|
||||
ptr += mach_ull_get_much_compressed_size(*table_id);
|
||||
|
||||
return(ptr);
|
||||
}
|
||||
|
|
@ -598,9 +598,9 @@ trx_undo_page_report_modify(
|
|||
type_cmpl_ptr = ptr;
|
||||
|
||||
*ptr++ = (byte) type_cmpl;
|
||||
ptr += mach_dulint_write_much_compressed(ptr, trx->undo_no);
|
||||
ptr += mach_ull_write_much_compressed(ptr, trx->undo_no);
|
||||
|
||||
ptr += mach_dulint_write_much_compressed(ptr, table->id);
|
||||
ptr += mach_ull_write_much_compressed(ptr, table->id);
|
||||
|
||||
/*----------------------------------------*/
|
||||
/* Store the state of the info bits */
|
||||
|
|
@ -620,16 +620,16 @@ trx_undo_page_report_modify(
|
|||
by some other trx as it must have committed by now for us to
|
||||
allow an over-write. */
|
||||
if (ignore_prefix) {
|
||||
ignore_prefix = ut_dulint_cmp(trx_id, trx->id) != 0;
|
||||
ignore_prefix = (trx_id != trx->id);
|
||||
}
|
||||
ptr += mach_dulint_write_compressed(ptr, trx_id);
|
||||
ptr += mach_ull_write_compressed(ptr, trx_id);
|
||||
|
||||
field = rec_get_nth_field(rec, offsets,
|
||||
dict_index_get_sys_col_pos(
|
||||
index, DATA_ROLL_PTR), &flen);
|
||||
ut_ad(flen == DATA_ROLL_PTR_LEN);
|
||||
|
||||
ptr += mach_dulint_write_compressed(ptr, trx_read_roll_ptr(field));
|
||||
ptr += mach_ull_write_compressed(ptr, trx_read_roll_ptr(field));
|
||||
|
||||
/*----------------------------------------*/
|
||||
/* Store then the fields required to uniquely determine the
|
||||
|
|
@ -848,11 +848,11 @@ trx_undo_update_rec_get_sys_cols(
|
|||
|
||||
/* Read the values of the system columns */
|
||||
|
||||
*trx_id = mach_dulint_read_compressed(ptr);
|
||||
ptr += mach_dulint_get_compressed_size(*trx_id);
|
||||
*trx_id = mach_ull_read_compressed(ptr);
|
||||
ptr += mach_ull_get_compressed_size(*trx_id);
|
||||
|
||||
*roll_ptr = mach_dulint_read_compressed(ptr);
|
||||
ptr += mach_dulint_get_compressed_size(*roll_ptr);
|
||||
*roll_ptr = mach_ull_read_compressed(ptr);
|
||||
ptr += mach_ull_get_compressed_size(*roll_ptr);
|
||||
|
||||
return(ptr);
|
||||
}
|
||||
|
|
@ -1168,7 +1168,7 @@ trx_undo_report_row_operation(
|
|||
index, otherwise NULL */
|
||||
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
|
||||
inserted undo log record,
|
||||
ut_dulint_zero if BTR_NO_UNDO_LOG
|
||||
0 if BTR_NO_UNDO_LOG
|
||||
flag was specified */
|
||||
{
|
||||
trx_t* trx;
|
||||
|
|
@ -1186,7 +1186,7 @@ trx_undo_report_row_operation(
|
|||
|
||||
if (flags & BTR_NO_UNDO_LOG_FLAG) {
|
||||
|
||||
*roll_ptr = ut_dulint_zero;
|
||||
*roll_ptr = 0;
|
||||
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
|
@ -1284,7 +1284,7 @@ trx_undo_report_row_operation(
|
|||
undo->top_undo_no = trx->undo_no;
|
||||
undo->guess_block = undo_block;
|
||||
|
||||
UT_DULINT_INC(trx->undo_no);
|
||||
trx->undo_no++;
|
||||
|
||||
mutex_exit(&trx->undo_mutex);
|
||||
|
||||
|
|
@ -1433,7 +1433,7 @@ trx_undo_prev_version_build(
|
|||
trx_id_t rec_trx_id;
|
||||
ulint type;
|
||||
undo_no_t undo_no;
|
||||
dulint table_id;
|
||||
table_id_t table_id;
|
||||
trx_id_t trx_id;
|
||||
roll_ptr_t roll_ptr;
|
||||
roll_ptr_t old_roll_ptr;
|
||||
|
|
@ -1523,7 +1523,7 @@ trx_undo_prev_version_build(
|
|||
roll_ptr, info_bits,
|
||||
NULL, heap, &update);
|
||||
|
||||
if (ut_dulint_cmp(table_id, index->table->id) != 0) {
|
||||
if (UNIV_UNLIKELY(table_id != index->table->id)) {
|
||||
ptr = NULL;
|
||||
|
||||
fprintf(stderr,
|
||||
|
|
@ -1544,16 +1544,14 @@ trx_undo_prev_version_build(
|
|||
fprintf(stderr,
|
||||
"InnoDB: table %s, index %s, n_uniq %lu\n"
|
||||
"InnoDB: undo rec address %p, type %lu cmpl_info %lu\n"
|
||||
"InnoDB: undo rec table id %lu %lu,"
|
||||
" index table id %lu %lu\n"
|
||||
"InnoDB: undo rec table id %llu,"
|
||||
" index table id %llu\n"
|
||||
"InnoDB: dump of 150 bytes in undo rec: ",
|
||||
index->table_name, index->name,
|
||||
(ulong) dict_index_get_n_unique(index),
|
||||
undo_rec, (ulong) type, (ulong) cmpl_info,
|
||||
(ulong) ut_dulint_get_high(table_id),
|
||||
(ulong) ut_dulint_get_low(table_id),
|
||||
(ulong) ut_dulint_get_high(index->table->id),
|
||||
(ulong) ut_dulint_get_low(index->table->id));
|
||||
(ullint) table_id,
|
||||
(ullint) index->table->id);
|
||||
ut_print_buf(stderr, undo_rec, 150);
|
||||
fputs("\n"
|
||||
"InnoDB: index record ", stderr);
|
||||
|
|
@ -1564,14 +1562,10 @@ trx_undo_prev_version_build(
|
|||
fprintf(stderr, "\n"
|
||||
"InnoDB: Record trx id " TRX_ID_FMT
|
||||
", update rec trx id " TRX_ID_FMT "\n"
|
||||
"InnoDB: Roll ptr in rec %lu %lu, in update rec"
|
||||
" %lu %lu\n",
|
||||
TRX_ID_PREP_PRINTF(rec_trx_id),
|
||||
TRX_ID_PREP_PRINTF(trx_id),
|
||||
(ulong) ut_dulint_get_high(old_roll_ptr),
|
||||
(ulong) ut_dulint_get_low(old_roll_ptr),
|
||||
(ulong) ut_dulint_get_high(roll_ptr),
|
||||
(ulong) ut_dulint_get_low(roll_ptr));
|
||||
"InnoDB: Roll ptr in rec " TRX_ID_FMT
|
||||
", in update rec" TRX_ID_FMT "\n",
|
||||
(ullint) rec_trx_id, (ullint) trx_id,
|
||||
(ullint) old_roll_ptr, (ullint) roll_ptr);
|
||||
|
||||
trx_purge_sys_print();
|
||||
return(DB_ERROR);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static trx_t* trx_roll_crash_recv_trx = NULL;
|
|||
|
||||
/** In crash recovery we set this to the undo n:o of the current trx to be
|
||||
rolled back. Then we can print how many % the rollback has progressed. */
|
||||
static ib_int64_t trx_roll_max_undo_no;
|
||||
static undo_no_t trx_roll_max_undo_no;
|
||||
|
||||
/** Auxiliary variable which tells the previous progress % we printed */
|
||||
static ulint trx_roll_progress_printed_pct;
|
||||
|
|
@ -443,7 +443,7 @@ trx_rollback_active(
|
|||
ut_a(thr == que_fork_start_command(fork));
|
||||
|
||||
trx_roll_crash_recv_trx = trx;
|
||||
trx_roll_max_undo_no = ut_conv_dulint_to_longlong(trx->undo_no);
|
||||
trx_roll_max_undo_no = trx->undo_no;
|
||||
trx_roll_progress_printed_pct = 0;
|
||||
rows_to_undo = trx_roll_max_undo_no;
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ trx_rollback_active(
|
|||
fprintf(stderr,
|
||||
" InnoDB: Rolling back trx with id " TRX_ID_FMT ", %lu%s"
|
||||
" rows to undo\n",
|
||||
TRX_ID_PREP_PRINTF(trx->id),
|
||||
(ullint) trx->id,
|
||||
(ulong) rows_to_undo, unit);
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
|
|
@ -478,8 +478,9 @@ trx_rollback_active(
|
|||
mutex_exit(&kernel_mutex);
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Waiting for rollback of trx id %lu to end\n",
|
||||
(ulong) ut_dulint_get_low(trx->id));
|
||||
"InnoDB: Waiting for rollback of trx id "
|
||||
TRX_ID_FMT " to end\n",
|
||||
(ullint) trx->id);
|
||||
os_thread_sleep(100000);
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
|
@ -488,16 +489,15 @@ trx_rollback_active(
|
|||
mutex_exit(&kernel_mutex);
|
||||
|
||||
if (trx_get_dict_operation(trx) != TRX_DICT_OP_NONE
|
||||
&& !ut_dulint_is_zero(trx->table_id)) {
|
||||
&& trx->table_id != 0) {
|
||||
|
||||
/* If the transaction was for a dictionary operation, we
|
||||
drop the relevant table, if it still exists */
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Dropping table with id %lu %lu"
|
||||
"InnoDB: Dropping table with id %llu"
|
||||
" in recovery if it exists\n",
|
||||
(ulong) ut_dulint_get_high(trx->table_id),
|
||||
(ulong) ut_dulint_get_low(trx->table_id));
|
||||
(ullint) trx->table_id);
|
||||
|
||||
table = dict_table_get_on_id_low(trx->table_id);
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ trx_rollback_active(
|
|||
|
||||
fprintf(stderr, "\nInnoDB: Rolling back of trx id " TRX_ID_FMT
|
||||
" completed\n",
|
||||
TRX_ID_PREP_PRINTF(trx->id));
|
||||
(ullint) trx->id);
|
||||
mem_heap_free(heap);
|
||||
|
||||
trx_roll_crash_recv_trx = NULL;
|
||||
|
|
@ -574,7 +574,7 @@ loop:
|
|||
fprintf(stderr,
|
||||
"InnoDB: Cleaning up trx with id "
|
||||
TRX_ID_FMT "\n",
|
||||
TRX_ID_PREP_PRINTF(trx->id));
|
||||
(ullint) trx->id);
|
||||
trx_cleanup_at_db_startup(trx);
|
||||
goto loop;
|
||||
|
||||
|
|
@ -710,7 +710,7 @@ trx_undo_arr_store_info(
|
|||
} else {
|
||||
n++;
|
||||
|
||||
if (0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
|
||||
if (cell->undo_no == undo_no) {
|
||||
|
||||
if (stored_here) {
|
||||
stored_here->in_use = FALSE;
|
||||
|
|
@ -754,7 +754,7 @@ trx_undo_arr_remove_info(
|
|||
cell = trx_undo_arr_get_nth_info(arr, i);
|
||||
|
||||
if (cell->in_use
|
||||
&& 0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
|
||||
&& cell->undo_no == undo_no) {
|
||||
|
||||
cell->in_use = FALSE;
|
||||
|
||||
|
|
@ -769,7 +769,7 @@ trx_undo_arr_remove_info(
|
|||
|
||||
/*******************************************************************//**
|
||||
Gets the biggest undo number in an array.
|
||||
@return biggest value, ut_dulint_zero if the array is empty */
|
||||
@return biggest value, 0 if the array is empty */
|
||||
static
|
||||
undo_no_t
|
||||
trx_undo_arr_get_biggest(
|
||||
|
|
@ -784,14 +784,14 @@ trx_undo_arr_get_biggest(
|
|||
|
||||
n = 0;
|
||||
n_used = arr->n_used;
|
||||
biggest = ut_dulint_zero;
|
||||
biggest = 0;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
cell = trx_undo_arr_get_nth_info(arr, i);
|
||||
|
||||
if (cell->in_use) {
|
||||
n++;
|
||||
if (ut_dulint_cmp(cell->undo_no, biggest) > 0) {
|
||||
if (cell->undo_no > biggest) {
|
||||
|
||||
biggest = cell->undo_no;
|
||||
}
|
||||
|
|
@ -827,9 +827,9 @@ trx_roll_try_truncate(
|
|||
if (arr->n_used > 0) {
|
||||
biggest = trx_undo_arr_get_biggest(arr);
|
||||
|
||||
if (ut_dulint_cmp(biggest, limit) >= 0) {
|
||||
if (biggest >= limit) {
|
||||
|
||||
limit = ut_dulint_add(biggest, 1);
|
||||
limit = biggest + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -865,9 +865,9 @@ trx_roll_pop_top_rec(
|
|||
undo->top_page_no, mtr);
|
||||
offset = undo->top_offset;
|
||||
|
||||
/* fprintf(stderr, "Thread %lu undoing trx %lu undo record %lu\n",
|
||||
os_thread_get_curr_id(), ut_dulint_get_low(trx->id),
|
||||
ut_dulint_get_low(undo->top_undo_no)); */
|
||||
/* fprintf(stderr, "Thread %lu undoing trx " TRX_ID_FMT
|
||||
" undo record " TRX_ID_FMT "\n",
|
||||
os_thread_get_curr_id(), trx->id, undo->top_undo_no); */
|
||||
|
||||
prev_rec = trx_undo_get_prev_rec(undo_page + offset,
|
||||
undo->hdr_page_no, undo->hdr_offset,
|
||||
|
|
@ -938,15 +938,14 @@ try_again:
|
|||
undo = upd_undo;
|
||||
} else if (!upd_undo || upd_undo->empty) {
|
||||
undo = ins_undo;
|
||||
} else if (ut_dulint_cmp(upd_undo->top_undo_no,
|
||||
ins_undo->top_undo_no) > 0) {
|
||||
} else if (upd_undo->top_undo_no > ins_undo->top_undo_no) {
|
||||
undo = upd_undo;
|
||||
} else {
|
||||
undo = ins_undo;
|
||||
}
|
||||
|
||||
if (!undo || undo->empty
|
||||
|| (ut_dulint_cmp(limit, undo->top_undo_no) > 0)) {
|
||||
|| limit > undo->top_undo_no) {
|
||||
|
||||
if ((trx->undo_no_arr)->n_used == 0) {
|
||||
/* Rollback is ending */
|
||||
|
|
@ -978,7 +977,7 @@ try_again:
|
|||
|
||||
undo_no = trx_undo_rec_get_undo_no(undo_rec);
|
||||
|
||||
ut_ad(ut_dulint_cmp(ut_dulint_add(undo_no, 1), trx->undo_no) == 0);
|
||||
ut_ad(undo_no + 1 == trx->undo_no);
|
||||
|
||||
/* We print rollback progress info if we are in a crash recovery
|
||||
and the transaction has at least 1000 row operations to undo. */
|
||||
|
|
@ -986,8 +985,7 @@ try_again:
|
|||
if (trx == trx_roll_crash_recv_trx && trx_roll_max_undo_no > 1000) {
|
||||
|
||||
progress_pct = 100 - (ulint)
|
||||
((ut_conv_dulint_to_longlong(undo_no) * 100)
|
||||
/ trx_roll_max_undo_no);
|
||||
((undo_no * 100) / trx_roll_max_undo_no);
|
||||
if (progress_pct != trx_roll_progress_printed_pct) {
|
||||
if (trx_roll_progress_printed_pct == 0) {
|
||||
fprintf(stderr,
|
||||
|
|
@ -1090,22 +1088,21 @@ trx_rollback(
|
|||
|
||||
/* Initialize the rollback field in the transaction */
|
||||
|
||||
if (sig->type == TRX_SIG_TOTAL_ROLLBACK) {
|
||||
|
||||
trx->roll_limit = ut_dulint_zero;
|
||||
|
||||
} else if (sig->type == TRX_SIG_ROLLBACK_TO_SAVEPT) {
|
||||
|
||||
switch (sig->type) {
|
||||
case TRX_SIG_TOTAL_ROLLBACK:
|
||||
trx->roll_limit = 0;
|
||||
break;
|
||||
case TRX_SIG_ROLLBACK_TO_SAVEPT:
|
||||
trx->roll_limit = (sig->savept).least_undo_no;
|
||||
|
||||
} else if (sig->type == TRX_SIG_ERROR_OCCURRED) {
|
||||
|
||||
break;
|
||||
case TRX_SIG_ERROR_OCCURRED:
|
||||
trx->roll_limit = trx->last_sql_stat_start.least_undo_no;
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
ut_error;
|
||||
}
|
||||
|
||||
ut_a(ut_dulint_cmp(trx->roll_limit, trx->undo_no) <= 0);
|
||||
ut_a(trx->roll_limit <= trx->undo_no);
|
||||
|
||||
trx->pages_undone = 0;
|
||||
|
||||
|
|
@ -1269,8 +1266,8 @@ trx_finish_rollback_off_kernel(
|
|||
|
||||
#ifdef UNIV_DEBUG
|
||||
if (lock_print_waits) {
|
||||
fprintf(stderr, "Trx %lu rollback finished\n",
|
||||
(ulong) ut_dulint_get_low(trx->id));
|
||||
fprintf(stderr, "Trx " TRX_ID_FMT " rollback finished\n",
|
||||
(ullint) trx->id);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
|
|
|
|||
|
|
@ -236,8 +236,8 @@ trx_rseg_mem_create(
|
|||
node_addr.page,
|
||||
mtr) + node_addr.boffset;
|
||||
|
||||
rseg->last_trx_no = mtr_read_dulint(
|
||||
undo_log_hdr + TRX_UNDO_TRX_NO, mtr);
|
||||
rseg->last_trx_no = mach_read_from_8(
|
||||
undo_log_hdr + TRX_UNDO_TRX_NO);
|
||||
rseg->last_del_marks = mtr_read_ulint(
|
||||
undo_log_hdr + TRX_UNDO_DEL_MARKS, MLOG_2BYTES, mtr);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -664,8 +664,8 @@ trx_sys_flush_max_trx_id(void)
|
|||
|
||||
sys_header = trx_sysf_get(&mtr);
|
||||
|
||||
mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
|
||||
trx_sys->max_trx_id, &mtr);
|
||||
mlog_write_ull(sys_header + TRX_SYS_TRX_ID_STORE,
|
||||
trx_sys->max_trx_id, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
|
|
@ -912,8 +912,7 @@ trx_sysf_create(
|
|||
sys_header = trx_sysf_get(mtr);
|
||||
|
||||
/* Start counting transaction ids from number 1 up */
|
||||
mach_write_to_8(sys_header + TRX_SYS_TRX_ID_STORE,
|
||||
ut_dulint_create(0, 1));
|
||||
mach_write_to_8(sys_header + TRX_SYS_TRX_ID_STORE, 1);
|
||||
|
||||
/* Reset the rollback segment slots. Old versions of InnoDB
|
||||
define TRX_SYS_N_RSEGS as 256 (TRX_SYS_OLD_N_RSEGS) and expect
|
||||
|
|
@ -950,7 +949,7 @@ trx_sys_init_at_db_start(void)
|
|||
/*==========================*/
|
||||
{
|
||||
trx_sysf_t* sys_header;
|
||||
ib_int64_t rows_to_undo = 0;
|
||||
ib_uint64_t rows_to_undo = 0;
|
||||
const char* unit = "";
|
||||
trx_t* trx;
|
||||
mtr_t mtr;
|
||||
|
|
@ -976,12 +975,10 @@ trx_sys_init_at_db_start(void)
|
|||
to the disk-based header! Thus trx id values will not overlap when
|
||||
the database is repeatedly started! */
|
||||
|
||||
trx_sys->max_trx_id = ut_dulint_add(
|
||||
ut_dulint_align_up(mtr_read_dulint(
|
||||
sys_header
|
||||
+ TRX_SYS_TRX_ID_STORE, &mtr),
|
||||
TRX_SYS_TRX_ID_WRITE_MARGIN),
|
||||
2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
|
||||
trx_sys->max_trx_id = 2 * TRX_SYS_TRX_ID_WRITE_MARGIN
|
||||
+ ut_uint64_align_up(mach_read_from_8(sys_header
|
||||
+ TRX_SYS_TRX_ID_STORE),
|
||||
TRX_SYS_TRX_ID_WRITE_MARGIN);
|
||||
|
||||
UT_LIST_INIT(trx_sys->mysql_trx_list);
|
||||
trx_dummy_sess = sess_open();
|
||||
|
|
@ -992,9 +989,8 @@ trx_sys_init_at_db_start(void)
|
|||
|
||||
for (;;) {
|
||||
|
||||
if ( trx->conc_state != TRX_PREPARED) {
|
||||
rows_to_undo += ut_conv_dulint_to_longlong(
|
||||
trx->undo_no);
|
||||
if (trx->conc_state != TRX_PREPARED) {
|
||||
rows_to_undo += trx->undo_no;
|
||||
}
|
||||
|
||||
trx = UT_LIST_GET_NEXT(trx_list, trx);
|
||||
|
|
@ -1017,7 +1013,7 @@ trx_sys_init_at_db_start(void)
|
|||
(ulong) rows_to_undo, unit);
|
||||
|
||||
fprintf(stderr, "InnoDB: Trx id counter is " TRX_ID_FMT "\n",
|
||||
TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
|
||||
(ullint) trx_sys->max_trx_id);
|
||||
}
|
||||
|
||||
UT_LIST_INIT(trx_sys->view_list);
|
||||
|
|
@ -1061,7 +1057,7 @@ trx_sys_file_format_max_write(
|
|||
mtr_t mtr;
|
||||
byte* ptr;
|
||||
buf_block_t* block;
|
||||
ulint tag_value_low;
|
||||
ib_uint64_t tag_value;
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
|
|
@ -1072,17 +1068,13 @@ trx_sys_file_format_max_write(
|
|||
file_format_max.name = trx_sys_file_format_id_to_name(format_id);
|
||||
|
||||
ptr = buf_block_get_frame(block) + TRX_SYS_FILE_FORMAT_TAG;
|
||||
tag_value_low = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
|
||||
tag_value = format_id + TRX_SYS_FILE_FORMAT_TAG_MAGIC_N;
|
||||
|
||||
if (name) {
|
||||
*name = file_format_max.name;
|
||||
}
|
||||
|
||||
mlog_write_dulint(
|
||||
ptr,
|
||||
ut_dulint_create(TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH,
|
||||
tag_value_low),
|
||||
&mtr);
|
||||
mlog_write_ull(ptr, tag_value, &mtr);
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
|
|
@ -1100,8 +1092,7 @@ trx_sys_file_format_max_read(void)
|
|||
mtr_t mtr;
|
||||
const byte* ptr;
|
||||
const buf_block_t* block;
|
||||
ulint format_id;
|
||||
dulint file_format_id;
|
||||
ib_id_t file_format_id;
|
||||
|
||||
/* Since this is called during the startup phase it's safe to
|
||||
read the value without a covering mutex. */
|
||||
|
|
@ -1115,16 +1106,15 @@ trx_sys_file_format_max_read(void)
|
|||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
format_id = file_format_id.low - TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
|
||||
file_format_id -= TRX_SYS_FILE_FORMAT_TAG_MAGIC_N;
|
||||
|
||||
if (file_format_id.high != TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH
|
||||
|| format_id >= FILE_FORMAT_NAME_N) {
|
||||
if (file_format_id >= FILE_FORMAT_NAME_N) {
|
||||
|
||||
/* Either it has never been tagged, or garbage in it. */
|
||||
return(ULINT_UNDEFINED);
|
||||
}
|
||||
|
||||
return(format_id);
|
||||
return((ulint) file_format_id);
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
|
|
@ -1416,7 +1406,7 @@ trx_sys_read_file_format_id(
|
|||
byte buf[UNIV_PAGE_SIZE * 2];
|
||||
page_t* page = ut_align(buf, UNIV_PAGE_SIZE);
|
||||
const byte* ptr;
|
||||
dulint file_format_id;
|
||||
ib_id_t file_format_id;
|
||||
|
||||
*format_id = ULINT_UNDEFINED;
|
||||
|
||||
|
|
@ -1430,9 +1420,9 @@ trx_sys_read_file_format_id(
|
|||
if (!success) {
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
|
||||
fprintf(stderr,
|
||||
" ibbackup: Error: trying to read system tablespace file format,\n"
|
||||
" ibbackup: but could not open the tablespace file %s!\n",
|
||||
|
|
@ -1449,9 +1439,9 @@ trx_sys_read_file_format_id(
|
|||
if (!success) {
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
|
||||
fprintf(stderr,
|
||||
" ibbackup: Error: trying to read system table space file format,\n"
|
||||
" ibbackup: but failed to read the tablespace file %s!\n",
|
||||
|
|
@ -1465,17 +1455,16 @@ trx_sys_read_file_format_id(
|
|||
/* get the file format from the page */
|
||||
ptr = page + TRX_SYS_FILE_FORMAT_TAG;
|
||||
file_format_id = mach_read_from_8(ptr);
|
||||
file_format_id -= TRX_SYS_FILE_FORMAT_TAG_MAGIC_N;
|
||||
|
||||
*format_id = file_format_id.low - TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW;
|
||||
|
||||
if (file_format_id.high != TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_HIGH
|
||||
|| *format_id >= FILE_FORMAT_NAME_N) {
|
||||
if (file_format_id >= FILE_FORMAT_NAME_N) {
|
||||
|
||||
/* Either it has never been tagged, or garbage in it. */
|
||||
*format_id = ULINT_UNDEFINED;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
*format_id = (ulint) file_format_id;
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ trx_create(
|
|||
|
||||
trx->isolation_level = TRX_ISO_REPEATABLE_READ;
|
||||
|
||||
trx->id = ut_dulint_zero;
|
||||
trx->no = ut_dulint_max;
|
||||
trx->id = 0;
|
||||
trx->no = IB_ULONGLONG_MAX;
|
||||
|
||||
trx->support_xa = TRUE;
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ trx_create(
|
|||
trx->must_flush_log_later = FALSE;
|
||||
|
||||
trx->dict_operation = TRX_DICT_OP_NONE;
|
||||
trx->table_id = ut_dulint_zero;
|
||||
trx->table_id = 0;
|
||||
|
||||
trx->mysql_thd = NULL;
|
||||
trx->active_trans = 0;
|
||||
|
|
@ -137,8 +137,8 @@ trx_create(
|
|||
|
||||
trx->rseg = NULL;
|
||||
|
||||
trx->undo_no = ut_dulint_zero;
|
||||
trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
|
||||
trx->undo_no = 0;
|
||||
trx->last_sql_stat_start.least_undo_no = 0;
|
||||
trx->insert_undo = NULL;
|
||||
trx->update_undo = NULL;
|
||||
trx->undo_no_arr = NULL;
|
||||
|
|
@ -392,9 +392,9 @@ trx_list_insert_ordered(
|
|||
trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
|
||||
|
||||
while (trx2 != NULL) {
|
||||
if (ut_dulint_cmp(trx->id, trx2->id) >= 0) {
|
||||
if (trx->id >= trx2->id) {
|
||||
|
||||
ut_ad(ut_dulint_cmp(trx->id, trx2->id) == 1);
|
||||
ut_ad(trx->id > trx2->id);
|
||||
break;
|
||||
}
|
||||
trx2 = UT_LIST_GET_NEXT(trx_list, trx2);
|
||||
|
|
@ -463,7 +463,7 @@ trx_lists_init_at_db_start(void)
|
|||
TRX_ID_FMT
|
||||
" was in the"
|
||||
" XA prepared state.\n",
|
||||
TRX_ID_PREP_PRINTF(trx->id));
|
||||
(ullint) trx->id);
|
||||
|
||||
if (srv_force_recovery == 0) {
|
||||
|
||||
|
|
@ -495,9 +495,9 @@ trx_lists_init_at_db_start(void)
|
|||
trx->conc_state = TRX_ACTIVE;
|
||||
|
||||
/* A running transaction always has the number
|
||||
field inited to ut_dulint_max */
|
||||
field inited to IB_ULONGLONG_MAX */
|
||||
|
||||
trx->no = ut_dulint_max;
|
||||
trx->no = IB_ULONGLONG_MAX;
|
||||
}
|
||||
|
||||
if (undo->dict_operation) {
|
||||
|
|
@ -507,8 +507,7 @@ trx_lists_init_at_db_start(void)
|
|||
}
|
||||
|
||||
if (!undo->empty) {
|
||||
trx->undo_no = ut_dulint_add(undo->top_undo_no,
|
||||
1);
|
||||
trx->undo_no = undo->top_undo_no + 1;
|
||||
}
|
||||
|
||||
trx_list_insert_ordered(trx);
|
||||
|
|
@ -539,8 +538,7 @@ trx_lists_init_at_db_start(void)
|
|||
"InnoDB: Transaction "
|
||||
TRX_ID_FMT " was in the"
|
||||
" XA prepared state.\n",
|
||||
TRX_ID_PREP_PRINTF(
|
||||
trx->id));
|
||||
(ullint) trx->id);
|
||||
|
||||
if (srv_force_recovery == 0) {
|
||||
|
||||
|
|
@ -571,9 +569,9 @@ trx_lists_init_at_db_start(void)
|
|||
|
||||
/* A running transaction always has
|
||||
the number field inited to
|
||||
ut_dulint_max */
|
||||
IB_ULONGLONG_MAX */
|
||||
|
||||
trx->no = ut_dulint_max;
|
||||
trx->no = IB_ULONGLONG_MAX;
|
||||
}
|
||||
|
||||
trx->rseg = rseg;
|
||||
|
|
@ -589,11 +587,9 @@ trx_lists_init_at_db_start(void)
|
|||
trx->update_undo = undo;
|
||||
|
||||
if ((!undo->empty)
|
||||
&& (ut_dulint_cmp(undo->top_undo_no,
|
||||
trx->undo_no) >= 0)) {
|
||||
&& undo->top_undo_no >= trx->undo_no) {
|
||||
|
||||
trx->undo_no = ut_dulint_add(undo->top_undo_no,
|
||||
1);
|
||||
trx->undo_no = undo->top_undo_no + 1;
|
||||
}
|
||||
|
||||
undo = UT_LIST_GET_NEXT(undo_list, undo);
|
||||
|
|
@ -655,7 +651,7 @@ trx_start_low(
|
|||
ut_ad(trx->rseg == NULL);
|
||||
|
||||
if (trx->is_purge) {
|
||||
trx->id = ut_dulint_zero;
|
||||
trx->id = 0;
|
||||
trx->conc_state = TRX_ACTIVE;
|
||||
trx->start_time = time(NULL);
|
||||
|
||||
|
|
@ -673,10 +669,10 @@ trx_start_low(
|
|||
|
||||
trx->id = trx_sys_get_new_trx_id();
|
||||
|
||||
/* The initial value for trx->no: ut_dulint_max is used in
|
||||
/* The initial value for trx->no: IB_ULONGLONG_MAX is used in
|
||||
read_view_open_now: */
|
||||
|
||||
trx->no = ut_dulint_max;
|
||||
trx->no = IB_ULONGLONG_MAX;
|
||||
|
||||
trx->rseg = rseg;
|
||||
|
||||
|
|
@ -941,8 +937,8 @@ trx_commit_off_kernel(
|
|||
|
||||
trx->conc_state = TRX_NOT_STARTED;
|
||||
trx->rseg = NULL;
|
||||
trx->undo_no = ut_dulint_zero;
|
||||
trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
|
||||
trx->undo_no = 0;
|
||||
trx->last_sql_stat_start.least_undo_no = 0;
|
||||
|
||||
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
|
||||
ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);
|
||||
|
|
@ -967,8 +963,8 @@ trx_cleanup_at_db_startup(
|
|||
|
||||
trx->conc_state = TRX_NOT_STARTED;
|
||||
trx->rseg = NULL;
|
||||
trx->undo_no = ut_dulint_zero;
|
||||
trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
|
||||
trx->undo_no = 0;
|
||||
trx->last_sql_stat_start.least_undo_no = 0;
|
||||
|
||||
UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
|
||||
}
|
||||
|
|
@ -1631,7 +1627,7 @@ trx_mark_sql_stat_end(
|
|||
ut_a(trx);
|
||||
|
||||
if (trx->conc_state == TRX_NOT_STARTED) {
|
||||
trx->undo_no = ut_dulint_zero;
|
||||
trx->undo_no = 0;
|
||||
}
|
||||
|
||||
trx->last_sql_stat_start.least_undo_no = trx->undo_no;
|
||||
|
|
@ -1651,7 +1647,7 @@ trx_print(
|
|||
{
|
||||
ibool newline;
|
||||
|
||||
fprintf(f, "TRANSACTION " TRX_ID_FMT, TRX_ID_PREP_PRINTF(trx->id));
|
||||
fprintf(f, "TRANSACTION " TRX_ID_FMT, (ullint) trx->id);
|
||||
|
||||
switch (trx->conc_state) {
|
||||
case TRX_NOT_STARTED:
|
||||
|
|
@ -1735,10 +1731,10 @@ trx_print(
|
|||
fputs(", holds adaptive hash latch", f);
|
||||
}
|
||||
|
||||
if (!ut_dulint_is_zero(trx->undo_no)) {
|
||||
if (trx->undo_no != 0) {
|
||||
newline = TRUE;
|
||||
fprintf(f, ", undo log entries %lu",
|
||||
(ulong) ut_dulint_get_low(trx->undo_no));
|
||||
fprintf(f, ", undo log entries %llu",
|
||||
(ullint) trx->undo_no);
|
||||
}
|
||||
|
||||
if (newline) {
|
||||
|
|
@ -1754,11 +1750,11 @@ trx_print(
|
|||
Compares the "weight" (or size) of two transactions. Transactions that
|
||||
have edited non-transactional tables are considered heavier than ones
|
||||
that have not.
|
||||
@return <0, 0 or >0; similar to strcmp(3) */
|
||||
@return TRUE if weight(a) >= weight(b) */
|
||||
UNIV_INTERN
|
||||
int
|
||||
trx_weight_cmp(
|
||||
/*===========*/
|
||||
ibool
|
||||
trx_weight_ge(
|
||||
/*==========*/
|
||||
const trx_t* a, /*!< in: the first transaction to be compared */
|
||||
const trx_t* b) /*!< in: the second transaction to be compared */
|
||||
{
|
||||
|
|
@ -1769,19 +1765,14 @@ trx_weight_cmp(
|
|||
not edited non-transactional tables. */
|
||||
|
||||
a_notrans_edit = a->mysql_thd != NULL
|
||||
&& thd_has_edited_nontrans_tables(a->mysql_thd);
|
||||
&& thd_has_edited_nontrans_tables(a->mysql_thd);
|
||||
|
||||
b_notrans_edit = b->mysql_thd != NULL
|
||||
&& thd_has_edited_nontrans_tables(b->mysql_thd);
|
||||
&& thd_has_edited_nontrans_tables(b->mysql_thd);
|
||||
|
||||
if (a_notrans_edit && !b_notrans_edit) {
|
||||
if (a_notrans_edit != b_notrans_edit) {
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (!a_notrans_edit && b_notrans_edit) {
|
||||
|
||||
return(-1);
|
||||
return(a_notrans_edit);
|
||||
}
|
||||
|
||||
/* Either both had edited non-transactional tables or both had
|
||||
|
|
@ -1792,13 +1783,11 @@ trx_weight_cmp(
|
|||
fprintf(stderr,
|
||||
"%s TRX_WEIGHT(a): %lld+%lu, TRX_WEIGHT(b): %lld+%lu\n",
|
||||
__func__,
|
||||
ut_conv_dulint_to_longlong(a->undo_no),
|
||||
UT_LIST_GET_LEN(a->trx_locks),
|
||||
ut_conv_dulint_to_longlong(b->undo_no),
|
||||
UT_LIST_GET_LEN(b->trx_locks));
|
||||
a->undo_no, UT_LIST_GET_LEN(a->trx_locks),
|
||||
b->undo_no, UT_LIST_GET_LEN(b->trx_locks));
|
||||
#endif
|
||||
|
||||
return(ut_dulint_cmp(TRX_WEIGHT(a), TRX_WEIGHT(b)));
|
||||
return(TRX_WEIGHT(a) >= TRX_WEIGHT(b));
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
|
|
@ -1980,14 +1969,13 @@ trx_recover_for_mysql(
|
|||
fprintf(stderr,
|
||||
" InnoDB: Transaction " TRX_ID_FMT " in"
|
||||
" prepared state after recovery\n",
|
||||
TRX_ID_PREP_PRINTF(trx->id));
|
||||
(ullint) trx->id);
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Transaction contains changes"
|
||||
" to %lu rows\n",
|
||||
(ulong) ut_conv_dulint_to_longlong(
|
||||
trx->undo_no));
|
||||
" to %llu rows\n",
|
||||
(ullint) trx->undo_no);
|
||||
|
||||
count++;
|
||||
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ trx_undo_header_create_log(
|
|||
{
|
||||
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_CREATE, mtr);
|
||||
|
||||
mlog_catenate_dulint_compressed(mtr, trx_id);
|
||||
mlog_catenate_ull_compressed(mtr, trx_id);
|
||||
}
|
||||
#else /* !UNIV_HOTBACKUP */
|
||||
# define trx_undo_header_create_log(undo_page,trx_id,mtr) ((void) 0)
|
||||
|
|
@ -687,7 +687,7 @@ trx_undo_insert_header_reuse_log(
|
|||
{
|
||||
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_REUSE, mtr);
|
||||
|
||||
mlog_catenate_dulint_compressed(mtr, trx_id);
|
||||
mlog_catenate_ull_compressed(mtr, trx_id);
|
||||
}
|
||||
#else /* !UNIV_HOTBACKUP */
|
||||
# define trx_undo_insert_header_reuse_log(undo_page,trx_id,mtr) ((void) 0)
|
||||
|
|
@ -708,7 +708,7 @@ trx_undo_parse_page_header(
|
|||
{
|
||||
trx_id_t trx_id;
|
||||
|
||||
ptr = mach_dulint_parse_compressed(ptr, end_ptr, &trx_id);
|
||||
ptr = mach_ull_parse_compressed(ptr, end_ptr, &trx_id);
|
||||
|
||||
if (ptr == NULL) {
|
||||
|
||||
|
|
@ -1098,8 +1098,7 @@ trx_undo_truncate_end(
|
|||
break;
|
||||
}
|
||||
|
||||
if (ut_dulint_cmp(trx_undo_rec_get_undo_no(rec), limit)
|
||||
>= 0) {
|
||||
if (trx_undo_rec_get_undo_no(rec) >= limit) {
|
||||
/* Truncate at least this record off, maybe
|
||||
more */
|
||||
trunc_here = rec;
|
||||
|
|
@ -1152,7 +1151,7 @@ trx_undo_truncate_start(
|
|||
|
||||
ut_ad(mutex_own(&(rseg->mutex)));
|
||||
|
||||
if (ut_dulint_is_zero(limit)) {
|
||||
if (!limit) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -1174,7 +1173,7 @@ loop:
|
|||
|
||||
last_rec = trx_undo_page_get_last_rec(undo_page, hdr_page_no,
|
||||
hdr_offset);
|
||||
if (ut_dulint_cmp(trx_undo_rec_get_undo_no(last_rec), limit) >= 0) {
|
||||
if (trx_undo_rec_get_undo_no(last_rec) >= limit) {
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
|
|
@ -1296,7 +1295,7 @@ trx_undo_mem_create_at_db_start(
|
|||
|
||||
undo_header = undo_page + offset;
|
||||
|
||||
trx_id = mtr_read_dulint(undo_header + TRX_UNDO_TRX_ID, mtr);
|
||||
trx_id = mach_read_from_8(undo_header + TRX_UNDO_TRX_ID);
|
||||
|
||||
xid_exists = mtr_read_ulint(undo_header + TRX_UNDO_XID_EXISTS,
|
||||
MLOG_1BYTE, mtr);
|
||||
|
|
@ -1320,7 +1319,7 @@ trx_undo_mem_create_at_db_start(
|
|||
undo->dict_operation = mtr_read_ulint(
|
||||
undo_header + TRX_UNDO_DICT_TRANS, MLOG_1BYTE, mtr);
|
||||
|
||||
undo->table_id = mtr_read_dulint(undo_header + TRX_UNDO_TABLE_ID, mtr);
|
||||
undo->table_id = mach_read_from_8(undo_header + TRX_UNDO_TABLE_ID);
|
||||
undo->state = state;
|
||||
undo->size = flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr);
|
||||
|
||||
|
|
@ -1709,7 +1708,7 @@ trx_undo_mark_as_dict_operation(
|
|||
ut_error;
|
||||
case TRX_DICT_OP_INDEX:
|
||||
/* Do not discard the table on recovery. */
|
||||
undo->table_id = ut_dulint_zero;
|
||||
undo->table_id = 0;
|
||||
break;
|
||||
case TRX_DICT_OP_TABLE:
|
||||
undo->table_id = trx->table_id;
|
||||
|
|
@ -1720,8 +1719,8 @@ trx_undo_mark_as_dict_operation(
|
|||
+ TRX_UNDO_DICT_TRANS,
|
||||
TRUE, MLOG_1BYTE, mtr);
|
||||
|
||||
mlog_write_dulint(hdr_page + undo->hdr_offset + TRX_UNDO_TABLE_ID,
|
||||
undo->table_id, mtr);
|
||||
mlog_write_ull(hdr_page + undo->hdr_offset + TRX_UNDO_TABLE_ID,
|
||||
undo->table_id, mtr);
|
||||
|
||||
undo->dict_operation = TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue