Skip to content

Commit 9c88a54

Browse files
author
Nirbhay Choubey
committed
MDEV-11179: WSREP transaction excceded size limit in Galera cluster
... causes MariaDB to crash On error, the wsrep replication buffer (binlog) is dumped to a file to aid investigations. In order to also include the binlog header, FDLE object is also needed. This object is only available for wsrep- threads. Fix: Instantiate an FDLE object for non-wsrep threads.
1 parent dbb06d2 commit 9c88a54

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

sql/wsrep_applier.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ Format_description_log_event* wsrep_get_apply_format(THD* thd)
7373
{
7474
return (Format_description_log_event*) thd->wsrep_apply_format;
7575
}
76+
77+
DBUG_ASSERT(thd->wsrep_rgi);
78+
7679
return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
7780
}
7881

sql/wsrep_binlog.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,13 @@ void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end)
442442
void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
443443
size_t buf_len)
444444
{
445+
DBUG_ENTER("wsrep_dump_rbr_buf_with_header");
446+
445447
char filename[PATH_MAX]= {0};
446448
File file;
447449
IO_CACHE cache;
448450
Log_event_writer writer(&cache);
449-
Format_description_log_event *ev= wsrep_get_apply_format(thd);
451+
Format_description_log_event *ev;
450452

451453
int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld_v2.log",
452454
wsrep_data_home_dir, thd->thread_id,
@@ -455,7 +457,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
455457
if (len >= PATH_MAX)
456458
{
457459
WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len);
458-
return;
460+
DBUG_VOID_RETURN;
459461
}
460462

461463
if ((file= mysql_file_open(key_file_wsrep_gra_log, filename,
@@ -477,6 +479,13 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
477479
goto cleanup2;
478480
}
479481

482+
/*
483+
Instantiate an FDLE object for non-wsrep threads (to be written
484+
to the dump file).
485+
*/
486+
ev= (thd->wsrep_applier) ? wsrep_get_apply_format(thd) :
487+
(new Format_description_log_event(4));
488+
480489
if (writer.write(ev) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) ||
481490
flush_io_cache(&cache))
482491
{
@@ -489,5 +498,9 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
489498

490499
cleanup1:
491500
mysql_file_close(file, MYF(MY_WME));
501+
502+
if (!thd->wsrep_applier) delete ev;
503+
504+
DBUG_VOID_RETURN;
492505
}
493506

0 commit comments

Comments
 (0)