LP #1462114: BF long wait detection can create huge log files

Description

**Reported in Launchpad by Swany last update 18-11-2015 11:14:00

As seen in the following function, "BF lock wait long" condition turns on innodb status with lock monitor, but it never shuts it off. The InnoDB status monitor can be very large, as it lists all transactions and a good deal of lock information, and thus it can generate very large log files that make it difficult to find good information. It might be better to use the same function as SHOW ENGINE INNODB STATUS to get the status, and write it out to a dedicated Galera file.

Barring that, here is at least a fix that stops collecting the InnoDB status once the BF wait timeout condition ends. Included is also a fix to avoid writing thousands of BF wait timeout messages to the log.

wsrep_is_BF_lock_timeout(
/====================/
srv_slot_t* slot) /* in: lock slot to check for lock priority */
{
if (wsrep_on(thr_get_trx(slot->thr)->mysql_thd) &&
wsrep_thd_is_brute_force((thr_get_trx(slot->thr))->mysql_thd)) {
fprintf(stderr, "WSREP: BF lock wait long\n");
srv_print_innodb_monitor = TRUE;
srv_print_innodb_lock_monitor = TRUE;
os_event_set(lock_sys->timeout_event);
return TRUE;
}
return FALSE;
}

Here is a fix (I just typed this into the bug comment page, so apologies if I made a typo:
wsrep_is_BF_lock_timeout(
/====================/
srv_slot_t* slot) /* in: lock slot to check for lock priority */
{ static char bf_count = 0;
if (wsrep_on(thr_get_trx(slot->thr)->mysql_thd) &&
wsrep_thd_is_brute_force((thr_get_trx(slot->thr))->mysql_thd)) {
if(bf_count == 0 || bf_count >= 100) {
if(!bf_count) {
fprintf(stderr, "WSREP: BF lock wait long\n");
} else {
fprintf(stderr, "WSREP: BF lock wait long [%d messages suppressed]\n",bf_count);
bf_count = 0;
}
if(bf_count == 0) {
srv_print_innodb_monitor = TRUE;
srv_print_innodb_lock_monitor = TRUE;
}
++bf_count;
os_event_set(lock_sys->timeout_event);
return TRUE;
}
if(bf_count) {
fprintf(stderr, "WSREP: BF lock wait ended [%d messages suppressed]\n",bf_count);
srv_print_innodb_monitor = FALSE;
srv_print_innodb_lock_monitor = FALSE;
bf_count = 0;
}
return FALSE;
}

Environment

None

Smart Checklist

Activity

Show:

Julia Vural March 4, 2025 at 9:27 PM

It appears that this issue is no longer being worked on, so we are closing it for housekeeping purposes. If you believe the issue still exists, please open a new ticket after confirming it's present in the latest release.

Won't Do

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 12, 2018 at 12:21 PM
Updated March 4, 2025 at 9:27 PM
Resolved March 4, 2025 at 9:27 PM