Commit 398ae9ee authored by Nikita Malyavin's avatar Nikita Malyavin

MDEV-33330 Server crash or assertion failure in binlog_get_pending_rows_event

When binlog_get_pending_rows_event was refactored, one usage in
binlog_need_stmt_format has not been taken in mind.

As binlog_get_pending_rows_event now requires existing cache_mngr, this check
is now made first.
parent 7fe764b1
...@@ -528,4 +528,17 @@ a check_row_ts(rs,re) ...@@ -528,4 +528,17 @@ a check_row_ts(rs,re)
set sql_mode=default; set sql_mode=default;
connection master; connection master;
drop tables t1, t2, t3; drop tables t1, t2, t3;
#
# MDEV-33330 Server crash or assertion failure in
# binlog_get_pending_rows_event
#
create or replace table t (x int) with system versioning
partition by system_time interval 1 minute auto partitions 3;
insert into t values (1);
connect con1,localhost,root,,;
set timestamp= @@timestamp+120;
update t set x= x + 1;
connection default;
disconnect con1;
drop table t;
include/rpl_end.inc include/rpl_end.inc
...@@ -442,5 +442,28 @@ set sql_mode=default; ...@@ -442,5 +442,28 @@ set sql_mode=default;
connection master; connection master;
drop tables t1, t2, t3; drop tables t1, t2, t3;
--echo #
--echo # MDEV-33330 Server crash or assertion failure in
--echo # binlog_get_pending_rows_event
--echo #
create or replace table t (x int) with system versioning
partition by system_time interval 1 minute auto partitions 3;
insert into t values (1);
connect (con1,localhost,root,,);
set timestamp= @@timestamp+120;
update t set x= x + 1;
connection default;
# Cleanup
disconnect con1;
drop table t;
#
# End of 11.2 tests
#
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc
--source include/rpl_end.inc --source include/rpl_end.inc
...@@ -3034,9 +3034,14 @@ class THD: public THD_count, /* this must be first */ ...@@ -3034,9 +3034,14 @@ class THD: public THD_count, /* this must be first */
bool binlog_need_stmt_format(bool is_transactional) const bool binlog_need_stmt_format(bool is_transactional) const
{ {
return log_current_statement() && if (!log_current_statement())
!binlog_get_pending_rows_event(binlog_get_cache_mngr(), return false;
use_trans_cache(this, is_transactional)); auto *cache_mngr= binlog_get_cache_mngr();
if (!cache_mngr)
return true;
return !binlog_get_pending_rows_event(cache_mngr,
use_trans_cache(this,
is_transactional));
} }
bool binlog_for_noop_dml(bool transactional_table); bool binlog_for_noop_dml(bool transactional_table);
......
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