Commit 8b936635 authored by unknown's avatar unknown

trx0roll.c:

  Fix the rollback progress printout in crash recovery


innobase/trx/trx0roll.c:
  Fix the rollback progress printout in crash recovery
parent 8da9faaa
...@@ -30,9 +30,13 @@ Created 3/26/1996 Heikki Tuuri ...@@ -30,9 +30,13 @@ Created 3/26/1996 Heikki Tuuri
/* This many pages must be undone before a truncate is tried within rollback */ /* This many pages must be undone before a truncate is tried within rollback */
#define TRX_ROLL_TRUNC_THRESHOLD 1 #define TRX_ROLL_TRUNC_THRESHOLD 1
/* In crash recovery, the current trx to be rolled back */
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 /* 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. */ rolled back. Then we can print how many % the rollback has progressed. */
ib_longlong trx_roll_max_undo_no; ib_longlong trx_roll_max_undo_no;
/* Auxiliary variable which tells the previous progress % we printed */ /* Auxiliary variable which tells the previous progress % we printed */
ulint trx_roll_progress_printed_pct; ulint trx_roll_progress_printed_pct;
...@@ -432,6 +436,7 @@ loop: ...@@ -432,6 +436,7 @@ loop:
ut_a(thr == que_fork_start_command(fork)); 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 = ut_conv_dulint_to_longlong(trx->undo_no);
trx_roll_progress_printed_pct = 0; trx_roll_progress_printed_pct = 0;
rows_to_undo = trx_roll_max_undo_no; rows_to_undo = trx_roll_max_undo_no;
...@@ -443,7 +448,7 @@ loop: ...@@ -443,7 +448,7 @@ loop:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Rolling back trx with id %lu %lu, %lu%s rows to undo", " InnoDB: Rolling back trx with id %lu %lu, %lu%s rows to undo\n",
(ulong) ut_dulint_get_high(trx->id), (ulong) ut_dulint_get_high(trx->id),
(ulong) ut_dulint_get_low(trx->id), (ulong) ut_dulint_get_low(trx->id),
(ulong) rows_to_undo, unit); (ulong) rows_to_undo, unit);
...@@ -502,6 +507,8 @@ loop: ...@@ -502,6 +507,8 @@ loop:
(ulong) ut_dulint_get_low(trx->id)); (ulong) ut_dulint_get_low(trx->id));
mem_heap_free(heap); mem_heap_free(heap);
trx_roll_crash_recv_trx = NULL;
goto loop; goto loop;
leave_function: leave_function:
...@@ -877,17 +884,17 @@ try_again: ...@@ -877,17 +884,17 @@ try_again:
ut_ad(ut_dulint_cmp(ut_dulint_add(undo_no, 1), trx->undo_no) == 0); ut_ad(ut_dulint_cmp(ut_dulint_add(undo_no, 1), trx->undo_no) == 0);
/* We print rollback progress info if we are in a crash recovery /* We print rollback progress info if we are in a crash recovery
and the transaction has at least 1000 row operations to undo. and the transaction has at least 1000 row operations to undo. */
Transactions in crash recovery have sess == NULL. */
if (trx == trx_roll_crash_recv_trx && trx_roll_max_undo_no > 1000) {
if (trx->sess == NULL && trx_roll_max_undo_no > 1000) {
progress_pct = 100 - (ulint) progress_pct = 100 - (ulint)
((ut_conv_dulint_to_longlong(undo_no) * 100) ((ut_conv_dulint_to_longlong(undo_no) * 100)
/ trx_roll_max_undo_no); / trx_roll_max_undo_no);
if (progress_pct != trx_roll_progress_printed_pct) { if (progress_pct != trx_roll_progress_printed_pct) {
if (trx_roll_progress_printed_pct == 0) { if (trx_roll_progress_printed_pct == 0) {
fprintf(stderr, fprintf(stderr,
"\nInnoDB: Progress in percents: %lu", (ulong) progress_pct); "\nInnoDB: Progress in percents: %lu\n", (ulong) progress_pct);
} else { } else {
fprintf(stderr, fprintf(stderr,
" %lu", (ulong) progress_pct); " %lu", (ulong) progress_pct);
......
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