List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:March 6 2009 7:55pm
Subject:Re: bzr commit into mysql-6.0 branch (davi:2742) Bug#989 WL#4284
View as plain text  
* Davi Arnaut <Davi.Arnaut@stripped> [09/03/06 22:42]:
>  2742 Davi Arnaut	2009-03-06
>       Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order
>       WL#4284: Transactional DDL locking
>       
>       Currently the MySQL server does not keep metadata locks on
>       schema objects for the duration of a transaction, thus failing
>       to guarantee the integrity of the schema objects being used
>       during the transaction and to protect then from concurrent
>       DDL operations. This also poses a problem for replication as
>       a DDL operation might be replicated even thought there are
>       active transactions using the object being modified.
>       
>       The solution is to defer the release of metadata locks until
>       a active transaction is either committed or rolled back. This
>       prevents other statements from modifying the table for the
>       entire duration of the transaction. This provides commitment
>       ordering for guaranteeing serializability across multiple
>       transactions.

Please highlight the incompatible changes: the new case when
ER_LOCK_DEADLOCK is returned.

I guess, you don't need to highlight the incompatible change that 
you can't drop a table that has an active transaction against it
 - but it's important to highlight that FLUSH TABLES WITH READ
LOCK now waits for active transactions to complete, and, as a
consequence, set global read_only=0/1.

>    DBUG_RETURN(res || thd->is_error());
>  
> @@ -6680,6 +6722,13 @@ bool reload_acl_and_cache(THD *thd, ulon
>      query_cache.flush();			// RESET QUERY CACHE
>    }
>  #endif /*HAVE_QUERY_CACHE*/
> +
> +  /*
> +    Release any metadata locks acquired during the above reloads.
> +  */
> +  if (!thd->locked_tables_mode)
> +    thd->mdl_context.release_all_locks();
> +

There is an implicit unlock of locked tables here. Just remove it.
Add a test case and document as an incompatible change in the
changeset comment. 

Unlock of locked tables must cause an implicit commit. In this
place it doesn't. This is how me and Serg agreed to fix it.

Same goes for sql_servers.cc code, which is a copy-paste.

> +++ b/sql/transaction.cc	2009-03-06 19:27:34 +0000
> @@ -98,6 +98,9 @@ bool trans_begin(THD *thd, uint flags)
>  
>    thd->locked_tables_list.unlock_locked_tables(thd);
>  
> +  if (!thd->locked_tables_mode)
> +    thd->mdl_context.release_all_locks();

You've just left the locked tables mode, no need to check for it.



-- 
Thread
bzr commit into mysql-6.0 branch (davi:2742) Bug#989 WL#4284Davi Arnaut6 Mar
  • Re: bzr commit into mysql-6.0 branch (davi:2742) Bug#989 WL#4284Konstantin Osipov6 Mar