mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-15977 Assertion !thd->in_sub_stmt failed in trans_commit_stmt
This commit is contained in:
161
mysql-test/suite/sql_sequence/rebuild.result
Normal file
161
mysql-test/suite/sql_sequence/rebuild.result
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
#
|
||||||
|
# MDEV-15977 Assertion `! thd->in_sub_stmt' failed in trans_commit_stmt
|
||||||
|
#
|
||||||
|
CREATE SEQUENCE s1 ENGINE=InnoDB;
|
||||||
|
ALTER TABLE s1 FORCE;
|
||||||
|
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||||
|
CREATE TABLE t2 (b VARCHAR(64)) ENGINE=MyISAM;
|
||||||
|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.PARTITIONS;
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
select * from t2;
|
||||||
|
b
|
||||||
|
t2
|
||||||
|
t1
|
||||||
|
s1
|
||||||
|
users
|
||||||
|
threads
|
||||||
|
table_lock_waits_summary_by_table
|
||||||
|
table_io_waits_summary_by_table
|
||||||
|
table_io_waits_summary_by_index_usage
|
||||||
|
socket_summary_by_instance
|
||||||
|
socket_summary_by_event_name
|
||||||
|
socket_instances
|
||||||
|
setup_timers
|
||||||
|
setup_objects
|
||||||
|
setup_instruments
|
||||||
|
setup_consumers
|
||||||
|
setup_actors
|
||||||
|
session_connect_attrs
|
||||||
|
session_account_connect_attrs
|
||||||
|
rwlock_instances
|
||||||
|
performance_timers
|
||||||
|
objects_summary_global_by_type
|
||||||
|
mutex_instances
|
||||||
|
hosts
|
||||||
|
host_cache
|
||||||
|
file_summary_by_instance
|
||||||
|
file_summary_by_event_name
|
||||||
|
file_instances
|
||||||
|
events_waits_summary_global_by_event_name
|
||||||
|
events_waits_summary_by_user_by_event_name
|
||||||
|
events_waits_summary_by_thread_by_event_name
|
||||||
|
events_waits_summary_by_instance
|
||||||
|
events_waits_summary_by_host_by_event_name
|
||||||
|
events_waits_summary_by_account_by_event_name
|
||||||
|
events_waits_history_long
|
||||||
|
events_waits_history
|
||||||
|
events_waits_current
|
||||||
|
events_statements_summary_global_by_event_name
|
||||||
|
events_statements_summary_by_user_by_event_name
|
||||||
|
events_statements_summary_by_thread_by_event_name
|
||||||
|
events_statements_summary_by_host_by_event_name
|
||||||
|
events_statements_summary_by_digest
|
||||||
|
events_statements_summary_by_account_by_event_name
|
||||||
|
events_statements_history_long
|
||||||
|
events_statements_history
|
||||||
|
events_statements_current
|
||||||
|
events_stages_summary_global_by_event_name
|
||||||
|
events_stages_summary_by_user_by_event_name
|
||||||
|
events_stages_summary_by_thread_by_event_name
|
||||||
|
events_stages_summary_by_host_by_event_name
|
||||||
|
events_stages_summary_by_account_by_event_name
|
||||||
|
events_stages_history_long
|
||||||
|
events_stages_history
|
||||||
|
events_stages_current
|
||||||
|
cond_instances
|
||||||
|
accounts
|
||||||
|
user
|
||||||
|
transaction_registry
|
||||||
|
time_zone_transition_type
|
||||||
|
time_zone_transition
|
||||||
|
time_zone_name
|
||||||
|
time_zone_leap_second
|
||||||
|
time_zone
|
||||||
|
tables_priv
|
||||||
|
table_stats
|
||||||
|
slow_log
|
||||||
|
servers
|
||||||
|
roles_mapping
|
||||||
|
proxies_priv
|
||||||
|
procs_priv
|
||||||
|
proc
|
||||||
|
plugin
|
||||||
|
innodb_table_stats
|
||||||
|
innodb_index_stats
|
||||||
|
index_stats
|
||||||
|
host
|
||||||
|
help_topic
|
||||||
|
help_relation
|
||||||
|
help_keyword
|
||||||
|
help_category
|
||||||
|
gtid_slave_pos
|
||||||
|
general_log
|
||||||
|
func
|
||||||
|
event
|
||||||
|
db
|
||||||
|
columns_priv
|
||||||
|
column_stats
|
||||||
|
test_suppressions
|
||||||
|
global_suppressions
|
||||||
|
ALL_PLUGINS
|
||||||
|
APPLICABLE_ROLES
|
||||||
|
CHARACTER_SETS
|
||||||
|
CHECK_CONSTRAINTS
|
||||||
|
COLLATIONS
|
||||||
|
COLLATION_CHARACTER_SET_APPLICABILITY
|
||||||
|
COLUMNS
|
||||||
|
COLUMN_PRIVILEGES
|
||||||
|
ENABLED_ROLES
|
||||||
|
ENGINES
|
||||||
|
EVENTS
|
||||||
|
FILES
|
||||||
|
GLOBAL_STATUS
|
||||||
|
GLOBAL_VARIABLES
|
||||||
|
KEY_CACHES
|
||||||
|
KEY_COLUMN_USAGE
|
||||||
|
PARAMETERS
|
||||||
|
PARTITIONS
|
||||||
|
PLUGINS
|
||||||
|
PROCESSLIST
|
||||||
|
PROFILING
|
||||||
|
REFERENTIAL_CONSTRAINTS
|
||||||
|
ROUTINES
|
||||||
|
SCHEMATA
|
||||||
|
SCHEMA_PRIVILEGES
|
||||||
|
SESSION_STATUS
|
||||||
|
SESSION_VARIABLES
|
||||||
|
STATISTICS
|
||||||
|
SYSTEM_VARIABLES
|
||||||
|
TABLES
|
||||||
|
TABLESPACES
|
||||||
|
TABLE_CONSTRAINTS
|
||||||
|
TABLE_PRIVILEGES
|
||||||
|
TRIGGERS
|
||||||
|
USER_PRIVILEGES
|
||||||
|
VIEWS
|
||||||
|
GEOMETRY_COLUMNS
|
||||||
|
SPATIAL_REF_SYS
|
||||||
|
CLIENT_STATISTICS
|
||||||
|
INDEX_STATISTICS
|
||||||
|
USER_STATISTICS
|
||||||
|
INNODB_LOCKS
|
||||||
|
INNODB_CMPMEM
|
||||||
|
INNODB_CMP_PER_INDEX
|
||||||
|
INNODB_LOCK_WAITS
|
||||||
|
TABLE_STATISTICS
|
||||||
|
INNODB_BUFFER_PAGE_LRU
|
||||||
|
INNODB_SYS_FIELDS
|
||||||
|
INNODB_SYS_COLUMNS
|
||||||
|
INNODB_SYS_FOREIGN_COLS
|
||||||
|
INNODB_BUFFER_POOL_STATS
|
||||||
|
INNODB_TRX
|
||||||
|
INNODB_SYS_FOREIGN
|
||||||
|
INNODB_SYS_TABLES
|
||||||
|
INNODB_BUFFER_PAGE
|
||||||
|
INNODB_METRICS
|
||||||
|
INNODB_SYS_INDEXES
|
||||||
|
INNODB_SYS_VIRTUAL
|
||||||
|
DROP TABLE t1, t2, s1;
|
18
mysql-test/suite/sql_sequence/rebuild.test
Normal file
18
mysql-test/suite/sql_sequence/rebuild.test
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-15977 Assertion `! thd->in_sub_stmt' failed in trans_commit_stmt
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE SEQUENCE s1 ENGINE=InnoDB;
|
||||||
|
ALTER TABLE s1 FORCE;
|
||||||
|
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||||
|
CREATE TABLE t2 (b VARCHAR(64)) ENGINE=MyISAM;
|
||||||
|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.PARTITIONS;
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
select * from t1;
|
||||||
|
select * from t2;
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
DROP TABLE t1, t2, s1;
|
||||||
|
|
@ -487,9 +487,12 @@ int SEQUENCE::read_initial_values(TABLE *table)
|
|||||||
Doing mysql_lock_tables() may have started a read only transaction.
|
Doing mysql_lock_tables() may have started a read only transaction.
|
||||||
If that happend, it's better that we commit it now, as a lot of
|
If that happend, it's better that we commit it now, as a lot of
|
||||||
code assumes that there is no active stmt transaction directly after
|
code assumes that there is no active stmt transaction directly after
|
||||||
open_tables()
|
open_tables().
|
||||||
|
But we also don't want to commit the stmt transaction while in a
|
||||||
|
substatement, see MDEV-15977.
|
||||||
*/
|
*/
|
||||||
if (!has_active_transaction && !thd->transaction.stmt.is_empty())
|
if (!has_active_transaction && !thd->transaction.stmt.is_empty() &&
|
||||||
|
!thd->in_sub_stmt)
|
||||||
trans_commit_stmt(thd);
|
trans_commit_stmt(thd);
|
||||||
}
|
}
|
||||||
write_unlock(table);
|
write_unlock(table);
|
||||||
|
Reference in New Issue
Block a user