List:Commits« Previous MessageNext Message »
From:jani Date:June 1 2006 1:27pm
Subject:bk commit into 5.1 tree (jani:1.2185)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jani. When jani 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.2185 06/06/01 16:27:44 jani@stripped +10 -0
  Merge jamppa@stripped:/home/bk/mysql-5.1-new
  into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-new-marvel

  sql/table.cc
    1.217 06/06/01 16:27:35 jani@stripped +0 -0
    Auto merged

  sql/sql_table.cc
    1.339 06/06/01 16:27:35 jani@stripped +0 -0
    Auto merged

  sql/sql_show.cc
    1.342 06/06/01 16:27:35 jani@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.554 06/06/01 16:27:34 jani@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.548 06/06/01 16:27:34 jani@stripped +0 -0
    Auto merged

  sql/mysql_priv.h
    1.407 06/06/01 16:27:33 jani@stripped +0 -0
    Auto merged

  sql/item.h
    1.200 06/06/01 16:27:33 jani@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.cc
    1.312 06/06/01 16:27:33 jani@stripped +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.120 06/06/01 16:27:33 jani@stripped +0 -0
    Auto merged

  configure.in
    1.358 06/06/01 16:27:32 jani@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:	jani
# Host:	ua141d10.elisa.omakaista.fi
# Root:	/home/my/bk/mysql-5.1-new-marvel/RESYNC

--- 1.357/configure.in	2006-05-30 16:07:39 +03:00
+++ 1.358/configure.in	2006-06-01 16:27:32 +03:00
@@ -778,48 +778,6 @@
 AC_SUBST(WRAPLIBS)
 
 if test "$TARGET_LINUX" = "true"; then
-  AC_MSG_CHECKING([for atomic operations])
-
-  AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-
-  atom_ops=
-  AC_TRY_RUN([
-#include <asm/atomic.h>
-int main()
-{
-  atomic_t v;
-
-  atomic_set(&v, 23);
-  atomic_add(5, &v);
-  return atomic_read(&v) == 28 ? 0 : -1;
-}
-  ],
-  [AC_DEFINE([HAVE_ATOMIC_ADD], [1],
-             [atomic_add() from <asm/atomic.h> (Linux only)])
-   atom_ops="${atom_ops}atomic_add "],
-  )
-  AC_TRY_RUN([
-#include <asm/atomic.h>
-int main()
-{
-  atomic_t v;
-
-  atomic_set(&v, 23);
-  atomic_sub(5, &v);
-  return atomic_read(&v) == 18 ? 0 : -1;
-}
-  ],
-  [AC_DEFINE([HAVE_ATOMIC_SUB], [1],
-             [atomic_sub() from <asm/atomic.h> (Linux only)])
-   atom_ops="${atom_ops}atomic_sub "],
-  )
-
-  if test -z "$atom_ops"; then atom_ops="no"; fi
-  AC_MSG_RESULT($atom_ops)
-
-  AC_LANG_RESTORE
-
   AC_ARG_WITH(pstack,
     [  --with-pstack           Use the pstack backtrace library],
     [ USE_PSTACK=$withval ],
@@ -1630,6 +1588,20 @@
 	      [Define to 1 if you want to use fast mutexes])
   fi
 fi
+
+AC_ARG_WITH([atomic-ops],
+	    AC_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
+	    [Implement atomic operations using pthread rwlocks or atomic CPU
+             instructions for multi-processor (default) or uniprocessor
+             configuration]), , [with_atomic_ops=smp])
+case "$with_atomic_ops" in
+  "up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
+                  [Assume single-CPU mode, no concurrency]) ;;
+  "rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
+                  [Use pthread rwlocks for atomic ops]) ;;
+  "smp") ;;
+   *) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
+esac
 
 # Force static compilation to avoid linking problems/get more speed
 AC_ARG_WITH(mysqld-ldflags,

--- 1.199/sql/item.h	2006-05-31 20:50:56 +03:00
+++ 1.200/sql/item.h	2006-06-01 16:27:33 +03:00
@@ -417,6 +417,8 @@
                   required, otherwise we only reading it and SELECT
                   privilege might be required.
   */
+  Settable_routine_parameter() {}
+  virtual ~Settable_routine_parameter() {}
   virtual void set_required_privilege(bool rw) {};
 
   /*
@@ -2330,6 +2332,7 @@
     max_length= item->max_length;
     decimals= item->decimals;
     collation.set(item->collation);
+    unsigned_flag= item->unsigned_flag;
     return 0;
   };
   virtual void store(Item *)= 0;

--- 1.406/sql/mysql_priv.h	2006-05-28 15:54:19 +03:00
+++ 1.407/sql/mysql_priv.h	2006-06-01 16:27:33 +03:00
@@ -849,6 +849,7 @@
 bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *t);
 Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
 			Item ***copy_func, Field **from_field,
+                        Field **def_field,
 			bool group, bool modify_item,
 			bool table_cant_handle_bit_fields,
                         bool make_copy_field,
@@ -1106,6 +1107,13 @@
 bool setup_tables(THD *thd, Name_resolution_context *context,
                   List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
                   Item **conds, TABLE_LIST **leaves, bool select_insert);
+bool setup_tables_and_check_access (THD *thd, 
+                                    Name_resolution_context *context,
+                                    List<TABLE_LIST> *from_clause, 
+                                    TABLE_LIST *tables, Item **conds, 
+                                    TABLE_LIST **leaves, 
+                                    bool select_insert,
+                                    ulong want_access);
 int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
 	       List<Item> *sum_func_list, uint wild_num);
 bool setup_fields(THD *thd, Item** ref_pointer_array,
@@ -1549,6 +1557,7 @@
 extern int mysqld_server_started;
 extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
 extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
+extern pthread_cond_t COND_global_read_lock;
 extern pthread_attr_t connection_attrib;
 extern I_List<THD> threads;
 extern I_List<NAMED_LIST> key_caches;

--- 1.547/sql/mysqld.cc	2006-05-31 14:18:04 +03:00
+++ 1.548/sql/mysqld.cc	2006-06-01 16:27:34 +03:00
@@ -329,7 +329,7 @@
 static char *default_character_set_name;
 static char *character_set_filesystem_name;
 static char *my_bind_addr_str;
-static char *default_collation_name;
+static char *default_collation_name, *default_storage_engine_str;
 static char mysql_data_home_buff[2];
 static struct passwd *user_info;
 static I_List<THD> thread_cache;
@@ -2650,12 +2650,6 @@
   if (add_status_vars(status_vars))
     return 1; // an error was already reported
 
-  if (plugin_init())
-  {
-    sql_print_error("Failed to init plugins.");
-    return 1;
-  }
-
   load_defaults(conf_file_name, groups, &argc, &argv);
   defaults_argv=argv;
   get_options(argc,argv);
@@ -3172,6 +3166,12 @@
     using_update_log=1;
   }
 
+  if (plugin_init())
+  {
+    sql_print_error("Failed to init plugins.");
+    return 1;
+  }
+
   /* We have to initialize the storage engines before CSV logging */
   if (ha_init())
   {
@@ -3218,15 +3218,27 @@
   /*
     Check that the default storage engine is actually available.
   */
-  if (!ha_storage_engine_is_enabled(global_system_variables.table_type))
   {
-    if (!opt_bootstrap)
+    LEX_STRING name= { default_storage_engine_str,
+                       strlen(default_storage_engine_str) };
+    handlerton *hton= ha_resolve_by_name(0, &name);
+    if (hton == NULL)
     {
-      sql_print_error("Default storage engine (%s) is not available",
-                      global_system_variables.table_type->name);
+      sql_print_error("Unknown/unsupported table type: %s",
+                      default_storage_engine_str);
       unireg_abort(1);
     }
-    global_system_variables.table_type= &myisam_hton;
+    if (!ha_storage_engine_is_enabled(hton))
+    {
+      if (!opt_bootstrap)
+      {
+        sql_print_error("Default storage engine (%s) is not available",
+                        default_storage_engine_str);
+        unireg_abort(1);
+      }
+      hton= &myisam_hton;
+    }
+    global_system_variables.table_type= hton;
   }
 
   tc_log= (total_ha_2pc > 1 ? (opt_bin_log  ?
@@ -4967,7 +4979,8 @@
    "Set the default storage engine (table type) for tables.", 0, 0,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-table-type", OPT_STORAGE_ENGINE,
-   "(deprecated) Use --default-storage-engine.", 0, 0,
+   "(deprecated) Use --default-storage-engine.",
+   (gptr*)default_storage_engine_str, (gptr*)default_storage_engine_str,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.",
    (gptr*) &default_tz_name, (gptr*) &default_tz_name,
@@ -6996,8 +7009,8 @@
   sys_charset_system.value= (char*) system_charset_info->csname;
   character_set_filesystem_name= (char*) "binary";
 
-
   /* Set default values for some option variables */
+  default_storage_engine_str="MyISAM";
   global_system_variables.table_type= &myisam_hton;
   global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
   global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
@@ -7457,17 +7470,6 @@
   case OPT_BOOTSTRAP:
     opt_noacl=opt_bootstrap=1;
     break;
-  case OPT_STORAGE_ENGINE:
-  {
-    LEX_STRING name= { argument, strlen(argument) };
-    if ((global_system_variables.table_type=
-                        ha_resolve_by_name(current_thd, &name)) == NULL)
-    {
-      fprintf(stderr,"Unknown/unsupported table type: %s\n",argument);
-      exit(1);
-    }
-    break;
-  }
   case OPT_SERVER_ID:
     server_id_supplied = 1;
     break;

--- 1.553/sql/sql_parse.cc	2006-05-30 19:23:59 +03:00
+++ 1.554/sql/sql_parse.cc	2006-06-01 16:27:34 +03:00
@@ -5188,23 +5188,35 @@
 
 bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
 {
+  Security_context * backup_ctx= thd->security_ctx;
+
+  /* we need to switch to the saved context (if any) */
+  if (all_tables->security_ctx)
+    thd->security_ctx= all_tables->security_ctx;
+
   if (check_access(thd, privilege, all_tables->db,
 		   &all_tables->grant.privilege, 0, 0,
                    test(all_tables->schema_table)))
-    return 1;
+    goto deny;
 
   /* Show only 1 table for check_grant */
   if (grant_option && check_grant(thd, privilege, all_tables, 0, 1, 0))
-    return 1;
+    goto deny;
+
+  thd->security_ctx= backup_ctx;
 
   /* Check rights on tables of subselects and implictly opened tables */
   TABLE_LIST *subselects_tables;
   if ((subselects_tables= all_tables->next_global))
   {
     if ((check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
-      return 1;
+      goto deny;
   }
   return 0;
+
+deny:
+  thd->security_ctx= backup_ctx;
+  return 1;
 }
 
 
@@ -5385,6 +5397,7 @@
   ulong found_access=0;
   TABLE_LIST *org_tables= tables;
   TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
+  Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
   /*
     The check that first_not_own_table is not reached is for the case when
     the given table list refers to the list for prelocking (contains tables
@@ -5392,12 +5405,17 @@
   */
   for (; tables != first_not_own_table; tables= tables->next_global)
   {
+    if (tables->security_ctx)
+      sctx= tables->security_ctx;
+    else
+      sctx= backup_ctx;
+
     if (tables->schema_table && 
         (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
     {
       if (!no_errors)
         my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
-                 thd->security_ctx->priv_user, thd->security_ctx->priv_host,
+                 sctx->priv_user, sctx->priv_host,
                  information_schema_name.str);
       return TRUE;
     }
@@ -5406,12 +5424,13 @@
        Remove SHOW_VIEW_ACL, because it will be checked during making view
      */
     tables->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
-    if (tables->derived || tables->schema_table || tables->belong_to_view ||
+    if (tables->derived || tables->schema_table ||
         (tables->table && (int)tables->table->s->tmp_table) ||
         my_tz_check_n_skip_implicit_tables(&tables,
                                            thd->lex->time_zone_tables_used))
       continue;
-    if ((thd->security_ctx->master_access & want_access) ==
+    thd->security_ctx= sctx;
+    if ((sctx->master_access & want_access) ==
         (want_access & ~EXTRA_ACL) &&
 	thd->db)
       tables->grant.privilege= want_access;
@@ -5423,19 +5442,23 @@
       {
 	if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
 			 0, no_errors, test(tables->schema_table)))
-	  return TRUE;				// Access denied
+	  goto deny;                            // Access denied
 	found_access=tables->grant.privilege;
 	found=1;
       }
     }
     else if (check_access(thd,want_access,tables->db,&tables->grant.privilege,
 			  0, no_errors, test(tables->schema_table)))
-      return TRUE;
+      goto deny;
   }
+  thd->security_ctx= backup_ctx;
   if (grant_option)
     return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
 		       test(want_access & EXTRA_ACL), UINT_MAX, no_errors);
   return FALSE;
+deny:
+  thd->security_ctx= backup_ctx;
+  return TRUE;
 }
 
 

--- 1.341/sql/sql_show.cc	2006-06-01 01:24:27 +03:00
+++ 1.342/sql/sql_show.cc	2006-06-01 16:27:35 +03:00
@@ -2376,7 +2376,6 @@
   TABLE *table= tables->table;
   SELECT_LEX *select_lex= &lex->select_lex;
   SELECT_LEX *old_all_select_lex= lex->all_selects_list;
-  TABLE_LIST **save_query_tables_last= lex->query_tables_last;
   enum_sql_command save_sql_command= lex->sql_command;
   SELECT_LEX *lsel= tables->schema_select_lex;
   ST_SCHEMA_TABLE *schema_table= tables->schema_table;
@@ -2395,6 +2394,7 @@
   enum legacy_db_type not_used;
   Open_tables_state open_tables_state_backup;
   bool save_view_prepare_mode= lex->view_prepare_mode;
+  Query_tables_list query_tables_list_backup;
   lex->view_prepare_mode= TRUE;
   DBUG_ENTER("get_all_tables");
 
@@ -2407,6 +2407,8 @@
   */
   lex->sql_command= SQLCOM_SHOW_FIELDS;
 
+  lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
+
   /*
     We should not introduce deadlocks even if we already have some
     tables open and locked, since we won't lock tables which we will
@@ -2447,8 +2449,7 @@
                                              show_table_list->db),
                                             show_table_list->alias));
     thd->temporary_tables= 0;
-    close_thread_tables(thd);
-    show_table_list->table= 0;
+    close_tables_for_reopen(thd, &show_table_list);
     goto err;
   }
 
@@ -2559,9 +2560,10 @@
               in this case.
             */
             res= schema_table->process_table(thd, show_table_list, table,
-                                            res, base_name,
-                                            show_table_list->alias);
-            close_thread_tables(thd);
+                                             res, base_name,
+                                             show_table_list->alias);
+            close_tables_for_reopen(thd, &show_table_list);
+            DBUG_ASSERT(!lex->query_tables_own_last);
             if (res)
               goto err;
           }
@@ -2578,11 +2580,10 @@
   error= 0;
 err:
   thd->restore_backup_open_tables_state(&open_tables_state_backup);
+  lex->restore_backup_query_tables_list(&query_tables_list_backup);
   lex->derived_tables= derived_tables;
   lex->all_selects_list= old_all_select_lex;
-  lex->query_tables_last= save_query_tables_last;
   lex->view_prepare_mode= save_view_prepare_mode;
-  *save_query_tables_last= 0;
   lex->sql_command= save_sql_command;
   DBUG_RETURN(error);
 }

--- 1.338/sql/sql_table.cc	2006-06-01 15:51:48 +03:00
+++ 1.339/sql/sql_table.cc	2006-06-01 16:27:35 +03:00
@@ -3897,6 +3897,7 @@
       */
       ha_autocommit_or_rollback(thd, 1);
       close_thread_tables(thd);
+      lex->reset_query_tables_list(FALSE);
       if (protocol->write())
 	goto err;
       continue;
@@ -3922,6 +3923,7 @@
       protocol->store(buff, length, system_charset_info);
       ha_autocommit_or_rollback(thd, 0);
       close_thread_tables(thd);
+      lex->reset_query_tables_list(FALSE);
       table->table=0;				// For query cache
       if (protocol->write())
 	goto err;
@@ -4674,7 +4676,8 @@
                            HA_CREATE_INFO *create_info,
                            ALTER_INFO *alter_info, uint order_num,
                            uint *index_drop_buffer, uint *index_drop_count,
-                           uint *index_add_buffer, uint *index_add_count)
+                           uint *index_add_buffer, uint *index_add_count,
+                           bool varchar)
 {
   Field **f_ptr, *field;
   uint changes= 0, tmp;
@@ -4709,7 +4712,8 @@
       create_info->used_fields & HA_CREATE_USED_CHARSET ||
       create_info->used_fields & HA_CREATE_USED_DEFAULT_CHARSET ||
       (alter_info->flags & (ALTER_RECREATE | ALTER_FOREIGN_KEY)) ||
-      order_num)
+      order_num ||
+      (table->s->frm_version < FRM_VER_TRUE_VARCHAR && varchar))
     DBUG_RETURN(ALTER_TABLE_DATA_CHANGED);
 
   /*
@@ -4883,7 +4887,7 @@
   uint db_create_options, used_fields;
   handlerton *old_db_type, *new_db_type;
   uint need_copy_table= 0;
-  bool no_table_reopen= FALSE;
+  bool no_table_reopen= FALSE, varchar= FALSE;
 #ifdef WITH_PARTITION_STORAGE_ENGINE
   uint fast_alter_partition= 0;
   bool partition_changed= FALSE;
@@ -5118,6 +5122,8 @@
   Field **f_ptr,*field;
   for (f_ptr=table->field ; (field= *f_ptr) ; f_ptr++)
   {
+    if (field->type() == MYSQL_TYPE_STRING)
+      varchar= TRUE;
     /* Check if field should be dropped */
     Alter_drop *drop;
     drop_it.rewind();
@@ -5453,7 +5459,8 @@
                                     key_info_buffer, key_count,
                                     create_info, alter_info, order_num,
                                     index_drop_buffer, &index_drop_count,
-                                    index_add_buffer, &index_add_count);
+                                    index_add_buffer, &index_add_count,
+                                    varchar);
   }
 
   /*

--- 1.216/sql/table.cc	2006-05-30 14:24:28 +03:00
+++ 1.217/sql/table.cc	2006-06-01 16:27:35 +03:00
@@ -2355,12 +2355,23 @@
       // previous MySQL version
       error= TRUE;
       if (MYSQL_VERSION_ID > table->s->mysql_version)
+      {
         my_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE, MYF(0), table->alias,
                  table_f_count, table->s->fields, table->s->mysql_version,
                  MYSQL_VERSION_ID);
+        sql_print_error(ER(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE),
+                        table->alias, table_f_count, table->s->fields,
+                        table->s->mysql_version, MYSQL_VERSION_ID);
+        DBUG_RETURN(error);
+
+      }
       else if (MYSQL_VERSION_ID == table->s->mysql_version)
+      {
         my_error(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED,MYF(0), table->alias,
                  table_f_count, table->s->fields);
+        sql_print_error(ER(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED), table->alias,
+                        table_f_count, table->s->fields);
+      }
       else
         /*
           moving from newer mysql to older one -> let's say not an error but
Thread
bk commit into 5.1 tree (jani:1.2185)jani1 Jun