Skip to content

Commit 1ba7234

Browse files
committed
Follow-up to MDEV-11713: Make more use of DBUG_LOG
1 parent 7c81f15 commit 1ba7234

File tree

8 files changed

+58
-73
lines changed

8 files changed

+58
-73
lines changed

storage/innobase/buf/buf0flu.cc

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3761,9 +3761,7 @@ FlushObserver::FlushObserver(
37613761
m_removed->at(i) = 0;
37623762
}
37633763

3764-
#ifdef FLUSH_LIST_OBSERVER_DEBUG
3765-
ib::info() << "FlushObserver constructor: " << m_trx->id;
3766-
#endif /* FLUSH_LIST_OBSERVER_DEBUG */
3764+
DBUG_LOG("flush", "FlushObserver(): trx->id=" << m_trx->id);
37673765
}
37683766

37693767
/** FlushObserver deconstructor */
@@ -3774,9 +3772,7 @@ FlushObserver::~FlushObserver()
37743772
UT_DELETE(m_flushed);
37753773
UT_DELETE(m_removed);
37763774

3777-
#ifdef FLUSH_LIST_OBSERVER_DEBUG
3778-
ib::info() << "FlushObserver deconstructor: " << m_trx->id;
3779-
#endif /* FLUSH_LIST_OBSERVER_DEBUG */
3775+
DBUG_LOG("flush", "~FlushObserver(): trx->id=" << m_trx->id);
37803776
}
37813777

37823778
/** Check whether trx is interrupted
@@ -3809,10 +3805,7 @@ FlushObserver::notify_flush(
38093805
m_stage->inc();
38103806
}
38113807

3812-
#ifdef FLUSH_LIST_OBSERVER_DEBUG
3813-
ib::info() << "Flush <" << bpage->id.space()
3814-
<< ", " << bpage->id.page_no() << ">";
3815-
#endif /* FLUSH_LIST_OBSERVER_DEBUG */
3808+
DBUG_LOG("flush", "Flush " << bpage->id);
38163809
}
38173810

38183811
/** Notify observer of a remove
@@ -3827,10 +3820,7 @@ FlushObserver::notify_remove(
38273820

38283821
m_removed->at(buf_pool->instance_no)++;
38293822

3830-
#ifdef FLUSH_LIST_OBSERVER_DEBUG
3831-
ib::info() << "Remove <" << bpage->id.space()
3832-
<< ", " << bpage->id.page_no() << ">";
3833-
#endif /* FLUSH_LIST_OBSERVER_DEBUG */
3823+
DBUG_LOG("flush", "Remove " << bpage->id);
38343824
}
38353825

38363826
/** Flush dirty pages and wait. */

storage/innobase/fil/fil0fil.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7376,14 +7376,17 @@ fil_space_get_crypt_data(
73767376
space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
73777377
ut_free(buf);
73787378

7379-
#ifdef UNIV_DEBUG
7380-
ib::info() << "Read page 0 from tablespace for"
7381-
<< "space " << space_id
7382-
<< " name " << space->name
7383-
<< " key_id " << (space->crypt_data ? space->crypt_data->key_id : 0)
7384-
<< " encryption " << (space->crypt_data ? space->crypt_data->encryption : 0)
7385-
<< " handle " << node->handle;
7386-
#endif
7379+
DBUG_LOG("crypt",
7380+
"Read page 0 from"
7381+
<< " tablespace " << space_id
7382+
<< " name " << space->name
7383+
<< " key_id " << (space->crypt_data
7384+
? space->crypt_data->key_id
7385+
: 0)
7386+
<< " encryption "
7387+
<< (space->crypt_data
7388+
? space->crypt_data->encryption : 0)
7389+
<< " handle " << node->handle);
73877390

73887391
ut_a(space->id == space_id);
73897392

storage/innobase/fil/fil0pagecompress.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,8 @@ fil_decompress_page(
487487
*write_size = actual_size;
488488
}
489489

490-
#ifdef UNIV_PAGECOMPRESS_DEBUG
491-
ib::info() << "Preparing for decompress for len "
492-
<< actual_size << ".";
493-
#endif /* UNIV_PAGECOMPRESS_DEBUG */
490+
DBUG_LOG("compress", "Preparing for decompress for len "
491+
<< actual_size << ".");
494492

495493
switch(compression_alg) {
496494
case PAGE_ZLIB_ALGORITHM:

storage/innobase/handler/ha_innodb.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5255,13 +5255,13 @@ innobase_rollback(
52555255
error = trx_rollback_for_mysql(trx);
52565256

52575257
if (trx->state == TRX_STATE_FORCED_ROLLBACK) {
5258-
#ifdef UNIV_DEBUG
5258+
#ifndef DBUG_OFF
52595259
char buffer[1024];
52605260

5261-
ib::info() << "Forced rollback : "
5262-
<< thd_get_error_context_description(thd,
5263-
buffer, sizeof(buffer), 512);
5264-
#endif /* UNIV_DEBUG */
5261+
DBUG_LOG("trx", "Forced rollback: "
5262+
<< thd_get_error_context_description(
5263+
thd, buffer, sizeof buffer, 512));
5264+
#endif /* !DBUG_OFF */
52655265

52665266
trx->state = TRX_STATE_NOT_STARTED;
52675267
}

storage/innobase/lock/lock0lock.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,12 +2780,10 @@ RecLock::jump_queue(
27802780
ut_ad(conflict_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT);
27812781
ut_ad(conflict_lock->trx->lock.wait_lock == conflict_lock);
27822782

2783-
#ifdef UNIV_DEBUG
2784-
ib::info() << "Granting High Priority Transaction (ID): "
2785-
<< lock->trx->id << " the lock jumping over"
2786-
<< " waiting Transaction (ID): "
2787-
<< conflict_lock->trx->id;
2788-
#endif /* UNIV_DEBUG */
2783+
DBUG_LOG("trx",
2784+
"Granting High Priority Transaction "
2785+
<< lock->trx->id << " a lock jumping over"
2786+
<< " waiting Transaction " << conflict_lock->trx->id);
27892787

27902788
lock_reset_lock_and_trx_wait(lock);
27912789
return(true);
@@ -2954,11 +2952,12 @@ RecLock::make_trx_hit_list(
29542952

29552953
/* Assert that it is not waiting for current record. */
29562954
ut_ad(trx->lock.wait_lock != next);
2957-
#ifdef UNIV_DEBUG
2958-
ib::info() << "High Priority Transaction (ID): "
2959-
<< lock->trx->id << " waking up blocking"
2960-
<< " transaction (ID): " << trx->id;
2961-
#endif /* UNIV_DEBUG */
2955+
2956+
DBUG_LOG("trx", "High Priority Transaction "
2957+
<< lock->trx->id
2958+
<< " waking up blocking transaction "
2959+
<< trx->id);
2960+
29622961
trx->lock.was_chosen_as_deadlock_victim = true;
29632962
lock_cancel_waiting_and_release(trx->lock.wait_lock);
29642963
trx_mutex_exit(trx);

storage/innobase/row/row0purge.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -515,22 +515,22 @@ row_purge_remove_sec_if_poss_leaf(
515515
page = btr_cur_get_page(btr_cur);
516516

517517
if (!lock_test_prdt_page_lock(
518-
trx,
519-
page_get_space_id(page),
520-
page_get_page_no(page))
521-
&& page_get_n_recs(page) < 2
522-
&& page_get_page_no(page) !=
523-
dict_index_get_page(index)) {
518+
trx,
519+
page_get_space_id(page),
520+
page_get_page_no(page))
521+
&& page_get_n_recs(page) < 2
522+
&& btr_cur_get_block(btr_cur)
523+
->page.id.page_no() !=
524+
dict_index_get_page(index)) {
524525
/* this is the last record on page,
525526
and it has a "page" lock on it,
526527
which mean search is still depending
527528
on it, so do not delete */
528-
#ifdef UNIV_DEBUG
529-
ib::info() << "skip purging last"
530-
" record on page "
531-
<< page_get_page_no(page)
532-
<< ".";
533-
#endif /* UNIV_DEBUG */
529+
DBUG_LOG("purge",
530+
"skip purging last"
531+
" record on page "
532+
<< btr_cur_get_block(btr_cur)
533+
->page.id);
534534

535535
btr_pcur_close(&pcur);
536536
mtr_commit(&mtr);

storage/innobase/trx/trx0purge.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,9 @@ trx_purge_mark_undo_for_truncate(
933933
return;
934934
}
935935

936-
#ifdef UNIV_DEBUG
937-
ib::info() << "UNDO tablespace with space identifier "
938-
<< undo_trunc->get_marked_space_id() << " marked for truncate";
939-
#endif /* UNIV_DEBUG */
936+
DBUG_LOG("undo",
937+
"marking for truncate UNDO tablespace "
938+
<< undo_trunc->get_marked_space_id());
940939

941940
/* Step-3: Iterate over all the rsegs of selected UNDO tablespace
942941
and mark them temporarily unavailable for allocation.*/

storage/innobase/trx/trx0trx.cc

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,24 +3379,20 @@ trx_kill_blocking(trx_t* trx)
33793379

33803380
trx_mutex_exit(victim_trx);
33813381

3382-
#ifdef UNIV_DEBUG
3382+
#ifndef DBUG_OFF
33833383
char buffer[1024];
3384-
char* thr_text;
3385-
trx_id_t id;
3384+
#endif /* !DBUG_OFF */
33863385

3387-
thr_text = thd_get_error_context_description(victim_trx->mysql_thd,
3388-
buffer, sizeof(buffer),
3389-
512);
3390-
id = victim_trx->id;
3391-
#endif /* UNIV_DEBUG */
3392-
trx_rollback_for_mysql(victim_trx);
3386+
DBUG_LOG("trx",
3387+
"High Priority Transaction "
3388+
<< trx->id << " killed transaction "
3389+
<< victim_trx->id << " in hit list"
3390+
<< " - "
3391+
<< thd_get_error_context_description(
3392+
victim_trx->mysql_thd,
3393+
buffer, sizeof(buffer), 512));
33933394

3394-
#ifdef UNIV_DEBUG
3395-
ib::info() << "High Priority Transaction (ID): "
3396-
<< trx->id << " killed transaction (ID): "
3397-
<< id << " in hit list"
3398-
<< " - " << thr_text;
3399-
#endif /* UNIV_DEBUG */
3395+
trx_rollback_for_mysql(victim_trx);
34003396
trx_mutex_enter(victim_trx);
34013397

34023398
version++;

0 commit comments

Comments
 (0)