WL#6947: InnoDB: Use DBUG_PRINT for tracing

Status: Complete   —   Priority: Medium

There is lots of code like this in InnoDB:

#ifdef UNIV_DEBUG
/** If the following is set to TRUE, this module prints a lot of
trace information of individual record operations */
UNIV_INTERN ibool	btr_cur_print_record_ops = FALSE;
#endif /* UNIV_DEBUG */

and

#ifdef UNIV_DEBUG
	if (btr_cur_print_record_ops && thr) {
		btr_cur_trx_report(thr_get_trx(thr)->id, index, "insert ");
		dtuple_print(stderr, entry);
	}
#endif /* UNIV_DEBUG */

These flags can only be set on compilation time or from a debugger.
As a result, most of this diagnostics has not been used in the past decade.

It would be better to use the DBUG facility, so that the printouts from various
InnoDB subsystems can be enabled by the --debug command line parameter.
The InnoDB-internal flags will be replaced with DBUG labels as follows:

ib_buf	buf_debug_prints
ib_cur	btr_cur_print_record_ops
ib_lock	lock_print_waits
ib_log	log_debug_writes
ib_que	que_trace_on
ib_purge	srv_print_thread_releases
ib_alter_table	row_log_apply_print
ib_create_index	row_log_apply_print
ib_merge_sort
row_merge_print_read,row_merge_print_write,row_merge_print_block,row_merge_print_block_read,row_merge_print_block_write

The following flags are unused and will be removed:

srv_print_buf_io
srv_print_lock_waits
srv_print_log_io
srv_print_latch_waits

The following flags are next to useless and will be removed:

os_aio_print_debug	(set in the source code to enable a never-seen printout)
pars_print_lexed	(only used in UNIV_SQL_DEBUG)