1
0
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:
Michael Widenius
2012-08-07 07:25:15 +03:00
parent 0a70eb33d1
commit b39e6e3d09
30 changed files with 559 additions and 168 deletions

View File

@ -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);