List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:February 21 2008 1:45pm
Subject:Re: bk commit into 5.1 tree (anozdrin:1.2661) BUG#30217
View as plain text  
Hi,

* Alexander Nozdrin <alik@stripped> [08/01/28 16:49]:

> ChangeSet@stripped, 2008-01-28 16:20:15+03:00, anozdrin@quad. +14 -0
>   Fix for Bug#30217: Views: changes in metadata behaviour
>   between 5.0 and 5.1.
> diff -Nrup a/mysql-test/include/ddl_i18n.check_views.inc
> b/mysql-test/include/ddl_i18n.check_views.inc
> --- a/mysql-test/include/ddl_i18n.check_views.inc	2007-06-28 21:34:50 +04:00
> +++ b/mysql-test/include/ddl_i18n.check_views.inc	2008-01-28 16:20:13 +03:00
> @@ -9,6 +9,10 @@ SHOW CREATE VIEW v1|
>  
>  SHOW CREATE VIEW v2|
>  
> +--echo
> +
> +SHOW CREATE VIEW v3|
> +

Please add a test case that shows the output of SHOW CREATE
VIEW/SELECT * FROM INFORMATION_SCHEMA after the view was restored
from backup.

>  void Item_string::print(String *str)
>  {
> -  str->append('_');
> -  str->append(collation.collation->csname);
> +  THD *thd= current_thd;
> +  bool dump_utf8_query= thd->get_dump_utf8_query();

Please do not use a global variable in THD. Either add a new
virtual method (::print_utf8) or a parameter to the existing 
hierarchy of print() methods.

> +  init(); // TODO: why call it here, why not in init_for_queries()?
> +

If you would like to push this or other not directly related
comments (below), let's discuss them and add in a separate patch.

> +/**
> +  This operation just contains the code common for THD-instance
> +  initialization for a new connection and for COM_CHANGE_USER
> +  implementation.
>  */
> +/**
> +  Initialize THD instance for connection processing.
>  
> -/*
> -  Init THD for query processing.
> -  This has to be called once before we call mysql_parse.
> -  See also comments in sql_class.h.
> +  Initialize memory roots necessary for query processing and (!)
> +  pre-allocate memory for it. We can't do that in THD constructor because
> +  there are use cases (acl_init, delayed inserts, watcher threads, killing
> +  mysqld) where it's vital to not allocate excessive and not used memory.
> +
> +  TODO: is it really the case? It seems, THD::init_for_queries() is always
> +  called for THD instance. It seems, the real reason is that THD instance
> +  can be cached, i.e. one THD instance can serve several connections. So,
> +  this operation pre-allocates memory for the new connection. Similarly,
> +  cleanup() frees pre-allocated memory for the connection.
> +
> +  This operation must be be called once before query parsing (i.e. before
> +  calling mysql_parse()).
> +
> +  @note This operation does not return error. If preallocation fails, it
> +  will be noticed at the first call to alloc_root().
>  */
> +/**
> +  Change user context (implement COM_CHANGE_USER).
>  
> -  SYNOPSIS
> -    change_user()
> -
> -  IMPLEMENTATION
> -    Reset all resources that are connection specific
> +  Basically change_user() resets all resources that are connection
> +  specific.
>  */
>  
> +/**
> +  Cleanup THD instance after connection.
> +
> +  Reverse operation for THD::init_for_queries(). THD::cleanup() frees all
> +  the connection-specific memory so that THD instance can be placed back
> +  into the cache and then used for handling another connection.
> +*/
>  
> +/**
> +  Cleanup THD instance after query execution.
> +  This function is used to reset thread data to its default state. It is
> +  called once after processing one atomic query.
> +  Unfortunately there is no distinguish operation to be called before
> +  processing atomic query -- this logic is distributed in the code. For
> +  example, one can consider sql_parse.cc (dispatch_command(), alloc_root(),
> +  mysql_parse() and so on).
> +
> +  @note This function is not suitable for setting thread data to some
> +  non-default values, as there is only one replication thread, so different
> +  master threads may overwrite data of each other on slave.
>  */

-- 
-- Konstantin Osipov              Software Developer, Moscow, Russia
-- MySQL AB, www.mysql.com   The best DATABASE COMPANY in the GALAXY
Thread
bk commit into 5.1 tree (anozdrin:1.2661) BUG#30217Alexander Nozdrin28 Jan
  • Re: bk commit into 5.1 tree (anozdrin:1.2661) BUG#30217Konstantin Osipov21 Feb