Skip to content

Commit

Permalink
MDEV-11179: WSREP transaction excceded size limit in Galera cluster
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
Nirbhay Choubey committed Dec 12, 2016
1 parent dbb06d2 commit 9c88a54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sql/wsrep_applier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Format_description_log_event* wsrep_get_apply_format(THD* thd)
{
return (Format_description_log_event*) thd->wsrep_apply_format;
}

DBUG_ASSERT(thd->wsrep_rgi);

return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
}

Expand Down
17 changes: 15 additions & 2 deletions sql/wsrep_binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,13 @@ void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end)
void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
size_t buf_len)
{
DBUG_ENTER("wsrep_dump_rbr_buf_with_header");

char filename[PATH_MAX]= {0};
File file;
IO_CACHE cache;
Log_event_writer writer(&cache);
Format_description_log_event *ev= wsrep_get_apply_format(thd);
Format_description_log_event *ev;

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

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

/*
Instantiate an FDLE object for non-wsrep threads (to be written
to the dump file).
*/
ev= (thd->wsrep_applier) ? wsrep_get_apply_format(thd) :
(new Format_description_log_event(4));

if (writer.write(ev) || my_b_write(&cache, (uchar*)rbr_buf, buf_len) ||
flush_io_cache(&cache))
{
Expand All @@ -489,5 +498,9 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,

cleanup1:
mysql_file_close(file, MYF(MY_WME));

if (!thd->wsrep_applier) delete ev;

DBUG_VOID_RETURN;
}

0 comments on commit 9c88a54

Please sign in to comment.