Commit f554fe51 authored by sjaakola's avatar sjaakola Committed by Julius Goryavsky

MDEV-30456 ALTER TABLE algorithm clause not replicated

Fixing the regression happening with galera.galera_toi_ddl_nonconflicting
The problem, surfaced by the test, was due to multi-statement used in the test.
The test issues two queries, as multi-statement:

--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);

With this, the session's THD structure has in query_string member
the full multi-statement, and this was used as base query in
TOI replication rewriting.

The fix is to pass actual length of the ALTER statement part for
TOI replication.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 96fa3aad
......@@ -2234,10 +2234,10 @@ static int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len)
}
static int wsrep_alter_table_query(THD *thd, uchar** buf, size_t* buf_len,
Alter_info *alter_info)
const Alter_info *alter_info)
{
String log_query;
log_query.append(thd->query());
log_query.append(thd->query(), thd->query_length());
/*
if user has specified the alter algorithm by session variable alter_algorithm
......@@ -2247,8 +2247,8 @@ static int wsrep_alter_table_query(THD *thd, uchar** buf, size_t* buf_len,
if (thd->variables.alter_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
alter_info->requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_NONE)
{
if (log_query.append(" ,") ||
log_query.append(alter_info->algorithm_clause(thd)))
if (log_query.append(MYF(" ,")) ||
log_query.append(MYF(alter_info->algorithm_clause(thd))))
{
WSREP_WARN("alter table string failed: schema: %s, query: %s",
thd->get_db(), thd->query());
......@@ -2630,7 +2630,8 @@ static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len);
}
static int wsrep_TOI_event_buf(THD* thd, uchar** buf, size_t* buf_len, Alter_info *alter_info)
static int wsrep_TOI_event_buf(THD* thd, uchar** buf, size_t* buf_len,
const Alter_info *alter_info)
{
int err;
switch (thd->lex->sql_command)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment