summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2020-04-03 00:43:09 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2020-04-07 15:05:38 +0300
commit5836191c8f0658d5d75484766fdcc3d838b0a5c1 (patch)
treef55ca1a7ea0d0dbdf0757bb18bd9fd6d1f651081 /sql/handler.cc
parentcd88a606f5c50db2c6ffe79c8a1a2fa00c06d4c4 (diff)
downloadmariadb-git-5836191c8f0658d5d75484766fdcc3d838b0a5c1.tar.gz
MDEV-21168: Active XA transactions stop slave from working after backup
was restored. Optionally rollback prepared XA's on "mariabackup --prepare". The fix MUST NOT be ported on 10.5+, as MDEV-742 fix solves the issue for slaves.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 914a4dc07b1..d739ce7cd5b 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1806,29 +1806,33 @@ int ha_commit_or_rollback_by_xid(XID *xid, bool commit)
#ifndef DBUG_OFF
-/**
- @note
- This does not need to be multi-byte safe or anything
-*/
-static char* xid_to_str(char *buf, XID *xid)
+/** Converts XID to string.
+
+@param[out] buf output buffer
+@param[in] xid XID to convert
+
+@return pointer to converted string
+
+@note This does not need to be multi-byte safe or anything */
+char *xid_to_str(char *buf, const XID &xid)
{
int i;
char *s=buf;
*s++='\'';
- for (i=0; i < xid->gtrid_length+xid->bqual_length; i++)
+ for (i= 0; i < xid.gtrid_length + xid.bqual_length; i++)
{
- uchar c=(uchar)xid->data[i];
+ uchar c= (uchar) xid.data[i];
/* is_next_dig is set if next character is a number */
bool is_next_dig= FALSE;
if (i < XIDDATASIZE)
{
- char ch= xid->data[i+1];
+ char ch= xid.data[i + 1];
is_next_dig= (ch >= '0' && ch <='9');
}
- if (i == xid->gtrid_length)
+ if (i == xid.gtrid_length)
{
*s++='\'';
- if (xid->bqual_length)
+ if (xid.bqual_length)
{
*s++='.';
*s++='\'';
@@ -1949,7 +1953,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
{
#ifndef DBUG_OFF
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- DBUG_PRINT("info", ("ignore xid %s", xid_to_str(buf, info->list+i)));
+ DBUG_PRINT("info",
+ ("ignore xid %s", xid_to_str(buf, info->list[i])));
#endif
xid_cache_insert(info->list+i, XA_PREPARED);
info->found_foreign_xids++;
@@ -1979,7 +1984,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
if (rc == 0)
{
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- DBUG_PRINT("info", ("commit xid %s", xid_to_str(buf, info->list+i)));
+ DBUG_PRINT("info",
+ ("commit xid %s", xid_to_str(buf, info->list[i])));
}
#endif
}
@@ -1993,8 +1999,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
if (rc == 0)
{
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- DBUG_PRINT("info", ("rollback xid %s",
- xid_to_str(buf, info->list+i)));
+ DBUG_PRINT("info",
+ ("rollback xid %s", xid_to_str(buf, info->list[i])));
}
#endif
}