Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS
Cause: In case of version based condtional comments, if the condition evaluates to false, it is converted to a regular comment for replication by replacing "!" by " ". Nested comment in a conditional comment is replicated as is. Nested comments are supported only in case of conditional comments and when a the comment on slave is no more a conditional comment, the statement execution fails on the slave. Fix: Convert the nested comment, start from "/*" to "(*" and comment end from "*/" to "*)" for replication. Change-Id: I1a8e385a267b2370529eade094f0258fa96886c0
This commit is contained in:
parent
a13157a561
commit
4d1de554bb
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2018, MariaDB Corporation
|
||||
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2020, MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -940,17 +940,27 @@ static inline uint int_token(const char *str,uint length)
|
||||
*/
|
||||
bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
|
||||
{
|
||||
// only one level of nested comments are allowed
|
||||
DBUG_ASSERT(remaining_recursions_permitted == 0 ||
|
||||
remaining_recursions_permitted == 1);
|
||||
reg1 uchar c;
|
||||
while (! lip->eof())
|
||||
{
|
||||
c= lip->yyGet();
|
||||
|
||||
if (remaining_recursions_permitted > 0)
|
||||
if (remaining_recursions_permitted == 1)
|
||||
{
|
||||
if ((c == '/') && (lip->yyPeek() == '*'))
|
||||
{
|
||||
lip->yyUnput('('); // Replace nested "/*..." with "(*..."
|
||||
lip->yySkip(); // and skip "("
|
||||
|
||||
lip->yySkip(); /* Eat asterisk */
|
||||
consume_comment(lip, remaining_recursions_permitted-1);
|
||||
if (consume_comment(lip, 0))
|
||||
return true;
|
||||
|
||||
lip->yyUnput(')'); // Replace "...*/" with "...*)"
|
||||
lip->yySkip(); // and skip ")"
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user