Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fe784950
Commit
fe784950
authored
Jun 11, 2021
by
Dmitry Shulga
Committed by
Sergei Golubchik
Jun 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16708: fixed assert firing in the method THD::reset_for_the_next_command
parent
994e3f40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
sql/sql_binlog.cc
sql/sql_binlog.cc
+21
-1
sql/sql_class.h
sql/sql_class.h
+27
-0
No files found.
sql/sql_binlog.cc
View file @
fe784950
...
...
@@ -354,8 +354,28 @@ void mysql_client_binlog_statement(THD* thd)
(
ev
->
flags
&
LOG_EVENT_SKIP_REPLICATION_F
?
OPTION_SKIP_REPLICATION
:
0
);
err
=
ev
->
apply_event
(
rgi
);
{
/*
For conventional statements thd->lex points to thd->main_lex, that is
thd->lex == &thd->main_lex. On the other hand, for prepared statement
thd->lex points to the LEX object explicitly allocated for execution
of the prepared statement and in this case thd->lex != &thd->main_lex.
On handling the BINLOG statement, invocation of ev->apply_event(rgi)
initiates the following sequence of calls
Rows_log_event::do_apply_event -> THD::reset_for_next_command
Since the method THD::reset_for_next_command() contains assert
DBUG_ASSERT(lex == &main_lex)
this sequence of calls results in crash when a binlog event is
applied in PS mode. So, reset the current lex temporary to point to
thd->main_lex before running ev->apply_event() and restore its
original value on return.
*/
LEX
*
backup_lex
;
thd
->
backup_and_reset_current_lex
(
&
backup_lex
);
err
=
ev
->
apply_event
(
rgi
);
thd
->
restore_current_lex
(
backup_lex
);
}
thd
->
variables
.
option_bits
=
(
thd
->
variables
.
option_bits
&
~
OPTION_SKIP_REPLICATION
)
|
save_skip_replication
;
...
...
sql/sql_class.h
View file @
fe784950
...
...
@@ -5453,6 +5453,33 @@ class THD: public THD_count, /* this must be first */
return
(
variables
.
old_behavior
&
OLD_MODE_UTF8_IS_UTF8MB3
?
MY_UTF8_IS_UTF8MB3
:
0
);
}
/**
Save current lex to the output parameter and reset it to point to
main_lex. This method is called from mysql_client_binlog_statement()
to temporary
@param[out] backup_lex original value of current lex
*/
void
backup_and_reset_current_lex
(
LEX
**
backup_lex
)
{
*
backup_lex
=
lex
;
lex
=
&
main_lex
;
}
/**
Restore current lex to its original value it had before calling the method
backup_and_reset_current_lex().
@param backup_lex original value of current lex
*/
void
restore_current_lex
(
LEX
*
backup_lex
)
{
lex
=
backup_lex
;
}
}
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment