List:Commits« Previous MessageNext Message »
From:konstantin Date:May 14 2006 8:51pm
Subject:bk commit into 5.0 tree (konstantin:1.2138)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2138 06/05/15 00:51:12 konstantin@stripped +13 -0
  Merge mysql.com:/opt/local/work/mysql-5.0-root
  into  mysql.com:/opt/local/work/mysql-5.0-runtime-merge

  sql/sql_yacc.yy
    1.469 06/05/15 00:51:02 konstantin@stripped +0 -0
    Auto merged

  sql/sql_table.cc
    1.310 06/05/15 00:51:02 konstantin@stripped +0 -0
    Auto merged

  sql/share/errmsg.txt
    1.64 06/05/15 00:51:02 konstantin@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.545 06/05/15 00:51:01 konstantin@stripped +0 -0
    Auto merged

  sql/sp_head.cc
    1.211 06/05/15 00:51:01 konstantin@stripped +0 -0
    Auto merged

  sql/mysql_priv.h
    1.386 06/05/15 00:51:01 konstantin@stripped +0 -0
    Auto merged

  sql/item_func.h
    1.139 06/05/15 00:51:01 konstantin@stripped +0 -0
    Auto merged

  sql/item_func.cc
    1.285 06/05/15 00:51:01 konstantin@stripped +0 -0
    Auto merged

  sql/item.cc
    1.220 06/05/15 00:51:01 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/trigger-grant.result
    1.6 06/05/15 00:51:00 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/trigger-grant.result
    1.5 06/05/15 00:51:00 konstantin@stripped +0 -0
    Change mode to -rw-rw-r--

  mysql-test/r/im_options_unset.result
    1.4 06/05/15 00:50:58 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/im_options_unset.result
    1.3 06/05/15 00:50:58 konstantin@stripped +0 -0
    Change mode to -rw-rw-r--

  mysql-test/r/im_options_set.result
    1.4 06/05/15 00:50:52 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/im_options_set.result
    1.3 06/05/15 00:50:52 konstantin@stripped +0 -0
    Change mode to -rw-rw-r--

  mysql-test/mysql-test-run.pl
    1.95 06/05/15 00:48:16 konstantin@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	konstantin
# Host:	dragonfly.local
# Root:	/opt/local/work/mysql-5.0-runtime-merge/RESYNC

--- 1.219/sql/item.cc	2006-05-12 13:55:14 +04:00
+++ 1.220/sql/item.cc	2006-05-15 00:51:01 +04:00
@@ -1889,7 +1889,6 @@
   name= (char*) str_arg;
   decimals= (uint8) decimal_value.frac;
   fixed= 1;
-  unsigned_flag= !decimal_value.sign();
   max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
                                              decimals, unsigned_flag);
 }
@@ -1899,7 +1898,6 @@
   int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
   decimals= (uint8) decimal_value.frac;
   fixed= 1;
-  unsigned_flag= !decimal_value.sign();
   max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
                                              decimals, unsigned_flag);
 }
@@ -1910,7 +1908,6 @@
   double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
   decimals= (uint8) decimal_value.frac;
   fixed= 1;
-  unsigned_flag= !decimal_value.sign();
   max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
                                              decimals, unsigned_flag);
 }
@@ -1923,7 +1920,6 @@
   name= (char*) str;
   decimals= (uint8) decimal_par;
   max_length= length;
-  unsigned_flag= !decimal_value.sign();
   fixed= 1;
 }
 
@@ -1933,7 +1929,6 @@
   my_decimal2decimal(value_par, &decimal_value);
   decimals= (uint8) decimal_value.frac;
   fixed= 1;
-  unsigned_flag= !decimal_value.sign();
   max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
                                              decimals, unsigned_flag);
 }
@@ -1945,7 +1940,6 @@
                     &decimal_value, precision, scale);
   decimals= (uint8) decimal_value.frac;
   fixed= 1;
-  unsigned_flag= !decimal_value.sign();
   max_length= my_decimal_precision_to_length(precision, decimals,
                                              unsigned_flag);
 }

--- 1.284/sql/item_func.cc	2006-05-09 12:44:13 +04:00
+++ 1.285/sql/item_func.cc	2006-05-15 00:51:01 +04:00
@@ -4120,6 +4120,18 @@
 }
 
 
+bool Item_func_get_user_var::set_value(THD *thd,
+                                       sp_rcontext */*ctx*/, Item *it)
+{
+  Item_func_set_user_var *suv= new Item_func_set_user_var(get_name(), it);
+  /*
+    Item_func_set_user_var is not fixed after construction, call
+    fix_fields().
+  */
+  return (!suv || suv->fix_fields(thd, &it) || suv->check() || suv->update());
+}
+
+
 bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref)
 {
   DBUG_ASSERT(fixed == 0);
@@ -4752,6 +4764,7 @@
     dummy_table->alias = empty_name;
     dummy_table->maybe_null = maybe_null;
     dummy_table->in_use= current_thd;
+    dummy_table->copy_blobs= TRUE;
     share->table_cache_key = empty_name;
     share->table_name = empty_name;
   }

--- 1.138/sql/item_func.h	2006-05-04 16:30:35 +04:00
+++ 1.139/sql/item_func.h	2006-05-15 00:51:01 +04:00
@@ -1179,7 +1179,8 @@
 };
 
 
-class Item_func_get_user_var :public Item_func
+class Item_func_get_user_var :public Item_func,
+                              private Settable_routine_parameter
 {
   user_var_entry *var_entry;
 
@@ -1206,6 +1207,15 @@
   table_map used_tables() const
   { return const_item() ? 0 : RAND_TABLE_BIT; }
   bool eq(const Item *item, bool binary_cmp) const;
+
+private:
+  bool set_value(THD *thd, sp_rcontext *ctx, Item *it);
+
+public:
+  Settable_routine_parameter *get_settable_routine_parameter()
+  {
+    return this;
+  }
 };
 
 

--- 1.385/sql/mysql_priv.h	2006-05-09 10:26:19 +04:00
+++ 1.386/sql/mysql_priv.h	2006-05-15 00:51:01 +04:00
@@ -718,12 +718,6 @@
                         List<create_field> &fields, List<Key> &keys,
                         bool tmp_table, uint select_field_count);
 
-TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
-			       TABLE_LIST *create_table,
-			       List<create_field> *extra_fields,
-			       List<Key> *keys,
-			       List<Item> *items,
-                               MYSQL_LOCK **lock);
 bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
                        HA_CREATE_INFO *create_info,
                        TABLE_LIST *table_list,
@@ -1315,10 +1309,11 @@
 
 MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
                               uint flags, bool *need_reopen);
-/* mysql_lock_tables() flags bits */
+/* mysql_lock_tables() and open_table() flags bits */
 #define MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK      0x0001
 #define MYSQL_LOCK_IGNORE_FLUSH                 0x0002
 #define MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN        0x0004
+#define MYSQL_OPEN_IGNORE_LOCKED_TABLES         0x0008
 
 void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
 void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);

--- 1.544/sql/sql_parse.cc	2006-05-10 14:12:25 +04:00
+++ 1.545/sql/sql_parse.cc	2006-05-15 00:51:01 +04:00
@@ -3835,7 +3835,6 @@
     if (thd->security_ctx->user)              // If not replication
     {
       LEX_USER *user;
-      uint counter;
 
       List_iterator <LEX_USER> user_list(lex->users_list);
       while ((user= user_list++))
@@ -3853,7 +3852,8 @@
                           user->host.str, thd->security_ctx->host_or_ip))
         {
           // TODO: use check_change_password()
-          if (check_acl_user(user, &counter) && user->password.str &&
+          if (is_acl_user(user->host.str, user->user.str) &&
+              user->password.str &&
               check_access(thd, UPDATE_ACL,"mysql",0,1,1,0))
           {
             my_message(ER_PASSWORD_NOT_ALLOWED,

--- 1.309/sql/sql_table.cc	2006-05-10 00:34:25 +04:00
+++ 1.310/sql/sql_table.cc	2006-05-15 00:51:02 +04:00
@@ -1796,105 +1796,6 @@
 
 
 /****************************************************************************
-** Create table from a list of fields and items
-****************************************************************************/
-
-TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
-			       TABLE_LIST *create_table,
-			       List<create_field> *extra_fields,
-			       List<Key> *keys,
-			       List<Item> *items,
-			       MYSQL_LOCK **lock)
-{
-  TABLE tmp_table;		// Used during 'create_field()'
-  TABLE *table= 0;
-  uint select_field_count= items->elements;
-  /* Add selected items to field list */
-  List_iterator_fast<Item> it(*items);
-  Item *item;
-  Field *tmp_field;
-  bool not_used;
-  DBUG_ENTER("create_table_from_items");
-
-  tmp_table.alias= 0;
-  tmp_table.timestamp_field= 0;
-  tmp_table.s= &tmp_table.share_not_to_be_used;
-  tmp_table.s->db_create_options=0;
-  tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
-  tmp_table.s->db_low_byte_first= test(create_info->db_type == DB_TYPE_MYISAM ||
-                                       create_info->db_type == DB_TYPE_HEAP);
-  tmp_table.null_row=tmp_table.maybe_null=0;
-
-  while ((item=it++))
-  {
-    create_field *cr_field;
-    Field *field;
-    if (item->type() == Item::FUNC_ITEM)
-      field=item->tmp_table_field(&tmp_table);
-    else
-      field=create_tmp_field(thd, &tmp_table, item, item->type(),
-                             (Item ***) 0, &tmp_field, 0, 0, 0, 0, 0);
-    if (!field ||
-	!(cr_field=new create_field(field,(item->type() == Item::FIELD_ITEM ?
-					   ((Item_field *)item)->field :
-					   (Field*) 0))))
-      DBUG_RETURN(0);
-    if (item->maybe_null)
-      cr_field->flags &= ~NOT_NULL_FLAG;
-    extra_fields->push_back(cr_field);
-  }
-  /*
-    create and lock table
-
-    We don't log the statement, it will be logged later.
-
-    If this is a HEAP table, the automatic DELETE FROM which is written to the
-    binlog when a HEAP table is opened for the first time since startup, must
-    not be written: 1) it would be wrong (imagine we're in CREATE SELECT: we
-    don't want to delete from it) 2) it would be written before the CREATE
-    TABLE, which is a wrong order. So we keep binary logging disabled when we
-    open_table().
-    TODO: create and open should be done atomic !
-  */
-  {
-    tmp_disable_binlog(thd);
-    if (!mysql_create_table(thd, create_table->db, create_table->table_name,
-                            create_info, *extra_fields, *keys, 0,
-                            select_field_count))
-    {
-      if (! (table= open_table(thd, create_table, thd->mem_root, (bool*) 0,
-                               MYSQL_LOCK_IGNORE_FLUSH)))
-        quick_rm_table(create_info->db_type, create_table->db,
-                       table_case_name(create_info, create_table->table_name));
-    }
-    reenable_binlog(thd);
-    if (!table)                                   // open failed
-      DBUG_RETURN(0);
-  }
-
-  /*
-    FIXME: What happens if trigger manages to be created while we are
-           obtaining this lock ? May be it is sensible just to disable
-           trigger execution in this case ? Or will MYSQL_LOCK_IGNORE_FLUSH
-           save us from that ?
-  */
-  table->reginfo.lock_type=TL_WRITE;
-  if (! ((*lock)= mysql_lock_tables(thd, &table, 1,
-                                    MYSQL_LOCK_IGNORE_FLUSH, &not_used)))
-  {
-    VOID(pthread_mutex_lock(&LOCK_open));
-    hash_delete(&open_cache,(byte*) table);
-    VOID(pthread_mutex_unlock(&LOCK_open));
-    quick_rm_table(create_info->db_type, create_table->db,
-		   table_case_name(create_info, create_table->table_name));
-    DBUG_RETURN(0);
-  }
-  table->file->extra(HA_EXTRA_WRITE_CACHE);
-  DBUG_RETURN(table);
-}
-
-
-/****************************************************************************
 ** Alter a table definition
 ****************************************************************************/
 

--- 1.468/sql/sql_yacc.yy	2006-05-12 13:55:14 +04:00
+++ 1.469/sql/sql_yacc.yy	2006-05-15 00:51:02 +04:00
@@ -448,6 +448,7 @@
 %token  NUMERIC_SYM
 %token  NVARCHAR_SYM
 %token  OFFSET_SYM
+%token  OJ_SYM
 %token  OLD_PASSWORD
 %token  ON
 %token  ONE_SHOT_SYM
@@ -5246,11 +5247,14 @@
           }
           expr '}'
 	  {
+	    LEX *lex= Lex;
             YYERROR_UNLESS($3 && $7);
             add_join_on($7,$10);
             Lex->pop_context();
             $7->outer_join|=JOIN_TYPE_LEFT;
             $$=$7;
+            if (!($$= lex->current_select->nest_last_join(lex->thd)))
+              YYABORT;
           }
 	| select_derived_init get_select_lex select_derived2
           {

--- 1.63/sql/share/errmsg.txt	2006-05-03 15:42:34 +04:00
+++ 1.64/sql/share/errmsg.txt	2006-05-15 00:51:02 +04:00
@@ -5475,7 +5475,7 @@
 	eng "Duplicate handler declared in the same block"
 	ger "Doppelter Handler im selben Block deklariert"
 ER_SP_NOT_VAR_ARG 42000
-	eng "OUT or INOUT argument %d for routine %s is not a variable"
+	eng "OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger"
 ER_SP_NO_RETSET 0A000
 	eng "Not allowed to return a result set from a %s"

--- 1.94/mysql-test/mysql-test-run.pl	2006-05-09 10:26:19 +04:00
+++ 1.95/mysql-test/mysql-test-run.pl	2006-05-15 00:48:16 +04:00
@@ -918,6 +918,7 @@
    path_err =>        "$opt_vardir/log/im.err",
    path_log =>        "$opt_vardir/log/im.log",
    path_pid =>        "$opt_vardir/run/im.pid",
+   path_angel_pid =>  "$opt_vardir/run/im.angel.pid",
    path_sock =>       "$sockdir/im.sock",
    port =>            $im_port,
    start_timeout =>   $master->[0]->{'start_timeout'},
@@ -1188,6 +1189,7 @@
   $ENV{'NDB_STATUS_OK'}=      "YES";
 
   $ENV{'IM_PATH_PID'}=        $instance_manager->{path_pid};
+  $ENV{'IM_PATH_ANGEL_PID'}=  $instance_manager->{path_angel_pid};
   $ENV{'IM_PORT'}=            $instance_manager->{port};
 
   $ENV{'IM_MYSQLD1_SOCK'}=    $instance_manager->{instances}->[0]->{path_sock};
@@ -1813,6 +1815,7 @@
 
 [manager]
 pid-file            = $instance_manager->{path_pid}
+angel-pid-file      = $instance_manager->{path_angel_pid}
 socket              = $instance_manager->{path_sock}
 port                = $instance_manager->{port}
 password-file       = $instance_manager->{password_file}
@@ -1837,7 +1840,7 @@
 language            = $path_language
 character-sets-dir  = $path_charsetsdir
 basedir             = $path_my_basedir
-server_id           =$server_id
+server_id           = $server_id
 skip-stack-trace
 skip-innodb
 skip-bdb
@@ -2805,6 +2808,18 @@
 sub im_stop($) {
   my $instance_manager = shift;
 
+  # Obtain mysqld-process pids before we start stopping IM (it can delete pid
+  # files).
+
+  my @mysqld_pids = ();
+  my $instances = $instance_manager->{'instances'};
+
+  push(@mysqld_pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'}))
+    if -r $instances->[0]->{'path_pid'};
+
+  push(@mysqld_pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'}))
+    if -r $instances->[1]->{'path_pid'};
+
   # Re-read pid from the file, since during tests Instance Manager could have
   # been restarted, so its pid could have been changed.
 
@@ -2812,34 +2827,79 @@
     mtr_get_pid_from_file($instance_manager->{'path_pid'})
       if -f $instance_manager->{'path_pid'};
 
+  if (-f $instance_manager->{'path_angel_pid'})
+  {
+    $instance_manager->{'angel_pid'} =
+      mtr_get_pid_from_file($instance_manager->{'path_angel_pid'})
+  }
+  else
+  {
+    $instance_manager->{'angel_pid'} = undef;
+  }
+
   # Inspired from mtr_stop_mysqld_servers().
 
   start_reap_all();
 
-  # Create list of pids. We should stop Instance Manager and all started
-  # mysqld-instances. Some of them may be nonguarded, so IM will not stop them
-  # on shutdown.
+  # Try graceful shutdown.
 
-  my @pids = ( $instance_manager->{'pid'} );
-  my $instances = $instance_manager->{'instances'};
+  mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1);
+
+  # Check that all processes died.
+
+  my $clean_shutdown= 0;
 
-  if ( -r $instances->[0]->{'path_pid'} )
+  while (1)
   {
-    push(@pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'}));
+    last if kill (0, $instance_manager->{'pid'});
+
+    last if (defined $instance_manager->{'angel_pid'}) &&
+            kill (0, $instance_manager->{'angel_pid'});
+
+    foreach my $pid (@mysqld_pids)
+    {
+      last if kill (0, $pid);
+    }
+
+    $clean_shutdown= 1;
+    last;
   }
 
-  if ( -r $instances->[1]->{'path_pid'} )
+  # Kill leftovers (the order is important).
+
+  unless ($clean_shutdown)
   {
-    push(@pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'}));
-  }
+    mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
+      if defined $instance_manager->{'angel_pid'};
+    
+    mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1);
 
-  # Kill processes.
+    # Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM
+    # will not stop them on shutdown. So, we should firstly try to end them
+    # legally.
+
+    mtr_kill_processes(\@mysqld_pids);
+
+    # Complain in error log so that a warning will be shown.
+
+    my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
+
+    open (ERRLOG, ">>$errlog") ||
+      mtr_error("Can not open error log ($errlog)");
+
+    my $ts= localtime();
+    print ERRLOG
+      "Warning: [$ts] Instance Manager did not shutdown gracefully.\n";
+
+    close ERRLOG;
+  }
 
-  mtr_kill_processes(\@pids);
+  # That's all.
 
   stop_reap_all();
 
   $instance_manager->{'pid'} = undef;
+  $instance_manager->{'angel_pid'} = undef;
 }
 
 

--- 1.210/sql/sp_head.cc	2006-05-12 13:55:14 +04:00
+++ 1.211/sql/sp_head.cc	2006-05-15 00:51:01 +04:00
@@ -671,6 +671,7 @@
   DBUG_ASSERT(m_lex.is_empty() || m_thd);
   while ((lex= (LEX *)m_lex.pop()))
   {
+    lex_end(m_thd->lex);
     delete m_thd->lex;
     m_thd->lex= lex;
   }
@@ -1641,7 +1642,10 @@
   */
   merge_table_list(thd, sublex->query_tables, sublex);
   if (! sublex->sp_lex_in_use)
+  {
+    lex_end(sublex);
     delete sublex;
+  }
   thd->lex= oldlex;
   DBUG_VOID_RETURN;
 }
Thread
bk commit into 5.0 tree (konstantin:1.2138)konstantin14 May