mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Added support of thd->tx_read_only
Moved timestamp handling from all handler::write() methods in the storage engines to handler::ha_write sql/handler.cc: Added PSI_CALL's
This commit is contained in:
@ -2907,6 +2907,16 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
|
||||
if (! (flags & MYSQL_OPEN_HAS_MDL_LOCK))
|
||||
{
|
||||
/*
|
||||
Check if we're trying to take a write lock in a read only transaction.
|
||||
*/
|
||||
if (table_list->mdl_request.type >= MDL_SHARED_WRITE &&
|
||||
thd->tx_read_only)
|
||||
{
|
||||
my_error(ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION, MYF(0));
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
|
||||
/*
|
||||
We are not under LOCK TABLES and going to acquire write-lock/
|
||||
modify the base table. We need to acquire protection against
|
||||
@ -4706,6 +4716,15 @@ lock_table_names(THD *thd,
|
||||
! (flags & MYSQL_OPEN_SKIP_TEMPORARY) &&
|
||||
find_temporary_table(thd, table))))
|
||||
{
|
||||
/*
|
||||
Write lock on normal tables is not allowed in a read only transaction.
|
||||
*/
|
||||
if (thd->tx_read_only)
|
||||
{
|
||||
my_error(ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION, MYF(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) &&
|
||||
schema_set.insert(table))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
Reference in New Issue
Block a user