List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:September 24 2010 6:47am
Subject:bzr push into mysql-5.5-runtime branch (jon.hauglid:3142 to 3143)
View as plain text  
 3143 Jon Olav Hauglid	2010-09-24 [merge]
      Merge from mysql-5.5-bugfixing to mysql-5.5-runtime.

    modified:
      mysql-test/r/type_newdecimal.result
      mysql-test/suite/perfschema/r/server_init.result
      mysql-test/suite/perfschema/t/server_init.test
      mysql-test/t/type_newdecimal.test
      sql/field.cc
      sql/log.cc
      sql/log.h
      sql/sql_plugin.cc
      sql/sql_repl.cc
      storage/perfschema/pfs_engine_table.cc
 3142 Jon Olav Hauglid	2010-09-23
      Followup to Bug #56422 CHECK TABLE run when the table is locked
                             reports corruption along with timeout
      
      This patch updates the result file for the
      parts.partition_special_innodb test case which was, by mistake,
      not updated in the original patch.

    modified:
      mysql-test/suite/parts/r/partition_special_innodb.result
=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result	2010-04-11 06:52:42 +0000
+++ b/mysql-test/r/type_newdecimal.result	2010-09-23 12:38:24 +0000
@@ -1908,4 +1908,16 @@ group by PAY.id + 1;
 mult	v_net_with_discount	v_total
 1.0000	27.18	27.180000
 DROP TABLE currencies, payments, sub_tasks;
+#
+# BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
+#
+CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
+INSERT INTO t1 VALUES (0);
+SELECT AVG(DISTINCT a) FROM t1;
+AVG(DISTINCT a)
+0.00000000
+SELECT SUM(DISTINCT a) FROM t1;
+SUM(DISTINCT a)
+0.0000
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/suite/perfschema/r/server_init.result'
--- a/mysql-test/suite/perfschema/r/server_init.result	2010-08-12 13:50:23 +0000
+++ b/mysql-test/suite/perfschema/r/server_init.result	2010-09-17 01:04:34 +0000
@@ -116,18 +116,10 @@ where name like "wait/synch/mutex/sql/LO
 count(name)
 1
 select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOG_INFO::lock";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
 where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex";
 count(name)
 1
 select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state";
-count(name)
-1
-select count(name) from MUTEX_INSTANCES
 where name like "wait/synch/mutex/sql/LOCK_event_metadata";
 count(name)
 1
@@ -144,15 +136,15 @@ where name like "wait/synch/mutex/sql/Cv
 count(name)
 1
 select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_xid_cache";
+where name like "wait/synch/mutex/sql/LOCK_audit_mask";
 count(name)
 1
 select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_plugin";
+where name like "wait/synch/mutex/sql/LOCK_xid_cache";
 count(name)
 1
 select count(name) from MUTEX_INSTANCES
-where name like "wait/synch/mutex/sql/LOCK_gdl";
+where name like "wait/synch/mutex/sql/LOCK_plugin";
 count(name)
 1
 select count(name) from MUTEX_INSTANCES
@@ -212,10 +204,6 @@ where name like "wait/synch/cond/sql/Que
 count(name)
 1
 select count(name) from COND_INSTANCES
-where name like "wait/synch/cond/sql/Event_scheduler::COND_state";
-count(name)
-1
-select count(name) from COND_INSTANCES
 where name like "wait/synch/cond/sql/COND_queue_state";
 count(name)
 1

=== modified file 'mysql-test/suite/perfschema/t/server_init.test'
--- a/mysql-test/suite/perfschema/t/server_init.test	2010-08-12 13:50:23 +0000
+++ b/mysql-test/suite/perfschema/t/server_init.test	2010-09-17 01:04:34 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
 
 # Tests for PERFORMANCE_SCHEMA
 
@@ -43,10 +43,6 @@ select count(name) from MUTEX_INSTANCES
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
 
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/mysys/THR_LOCK_myisam_log";
-
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/mysys/THR_LOCK_heap";
 
@@ -83,11 +79,6 @@ select count(name) from MUTEX_INSTANCES
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_delayed_insert";
 
-# Named LOCK_uuid_short in 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/LOCK_uuid_short";
-
-# Named LOCK_uuid_generator in 5.5, LOCK_uuid_short in 6.0
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_uuid_generator";
 
@@ -130,14 +121,16 @@ select count(name) from MUTEX_INSTANCES
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_rpl_status";
 
-select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOG_INFO::lock";
+# LOG_INFO object are created on demand, and are not global.
+# select count(name) from MUTEX_INSTANCES
+#  where name like "wait/synch/mutex/sql/LOG_INFO::lock";
 
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex";
 
-select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state";
+# The event scheduler may be disabled
+# select count(name) from MUTEX_INSTANCES
+#  where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state";
 
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_event_metadata";
@@ -148,16 +141,11 @@ select count(name) from MUTEX_INSTANCES
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_user_locks";
 
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/LOCK_mdl";
-
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/Cversion_lock";
 
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/LOCK_audit_mask";
+select count(name) from MUTEX_INSTANCES
+ where name like "wait/synch/mutex/sql/LOCK_audit_mask";
 
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_xid_cache";
@@ -165,28 +153,13 @@ select count(name) from MUTEX_INSTANCES
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/LOCK_plugin";
 
-select count(name) from MUTEX_INSTANCES
- where name like "wait/synch/mutex/sql/LOCK_gdl";
+# Not a global variable, may be destroyed already.
+# select count(name) from MUTEX_INSTANCES
+#  where name like "wait/synch/mutex/sql/LOCK_gdl";
 
 select count(name) from MUTEX_INSTANCES
  where name like "wait/synch/mutex/sql/tz_LOCK";
 
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/slave_start";
-
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML";
-
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_active";
-
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from MUTEX_INSTANCES
-#  where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_get";
-
 # Verify that these global rwlocks have been properly initilized in sql
 
 select count(name) from RWLOCK_INSTANCES
@@ -230,25 +203,10 @@ select count(name) from COND_INSTANCES
 select count(name) from COND_INSTANCES
  where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed";
 
-select count(name) from COND_INSTANCES
- where name like "wait/synch/cond/sql/Event_scheduler::COND_state";
+# The event scheduler may be disabled
+# select count(name) from COND_INSTANCES
+#  where name like "wait/synch/cond/sql/Event_scheduler::COND_state";
 
 select count(name) from COND_INSTANCES
  where name like "wait/synch/cond/sql/COND_queue_state";
 
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from COND_INSTANCES
-#  where name like "wait/synch/cond/sql/COND_mdl";
-
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from COND_INSTANCES
-#  where name like "wait/synch/cond/sql/BML_class::COND_BML";
-
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from COND_INSTANCES
-#  where name like "wait/synch/cond/sql/BML_class::COND_BML_registered";
-
-# Does not exist in mysql 5.5, 6.0 only
-# select count(name) from COND_INSTANCES
-#  where name like "wait/synch/cond/sql/BML_class::COND_BML_release";
-

=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test	2010-04-11 06:52:42 +0000
+++ b/mysql-test/t/type_newdecimal.test	2010-09-23 12:38:24 +0000
@@ -1509,5 +1509,14 @@ group by PAY.id + 1;
 
 DROP TABLE currencies, payments, sub_tasks;
 
+--echo #
+--echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
+--echo #
+
+CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
+INSERT INTO t1 VALUES (0);
+SELECT AVG(DISTINCT a) FROM t1;
+SELECT SUM(DISTINCT a) FROM t1;
+DROP TABLE t1;
 
 --echo End of 5.1 tests

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-08-23 09:56:21 +0000
+++ b/sql/field.cc	2010-09-23 12:38:24 +0000
@@ -9104,7 +9104,7 @@ void Create_field::init_for_tmp_table(en
   case MYSQL_TYPE_NEWDECIMAL:
   case MYSQL_TYPE_FLOAT:
   case MYSQL_TYPE_DOUBLE:
-    pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER |
+    pack_flag= FIELDFLAG_NUMBER |
       (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT;
     break;
 
@@ -9153,12 +9153,13 @@ void Create_field::init_for_tmp_table(en
     (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
     (is_unsigned ? 0 : FIELDFLAG_DECIMAL);
 
-  DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d",
+  DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s%s, pack_type: %d",
                        FLAGSTR(pack_flag, FIELDFLAG_BINARY),
                        FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
                        FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
                        FLAGSTR(pack_flag, FIELDFLAG_GEOM),
                        FLAGSTR(pack_flag, FIELDFLAG_BLOB),
+                       FLAGSTR(pack_flag, FIELDFLAG_DECIMAL),
                        f_packtype(pack_flag)));
   DBUG_VOID_RETURN;
 }

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-08-30 08:36:02 +0000
+++ b/sql/log.cc	2010-09-06 17:18:44 +0000
@@ -5284,11 +5284,8 @@ int MYSQL_BIN_LOG::wait_for_update_bin_l
                                            const struct timespec *timeout)
 {
   int ret= 0;
-  const char* old_msg = thd->proc_info;
   DBUG_ENTER("wait_for_update_bin_log");
-  old_msg= thd->enter_cond(&update_cond, &LOCK_log,
-                           "Master has sent all binlog to slave; "
-                           "waiting for binlog to be updated");
+
   if (!timeout)
     mysql_cond_wait(&update_cond, &LOCK_log);
   else

=== modified file 'sql/log.h'
--- a/sql/log.h	2010-08-20 11:22:46 +0000
+++ b/sql/log.h	2010-09-06 17:18:44 +0000
@@ -460,6 +460,7 @@ public:
   inline char* get_log_fname() { return log_file_name; }
   inline char* get_name() { return name; }
   inline mysql_mutex_t* get_log_lock() { return &LOCK_log; }
+  inline mysql_cond_t* get_log_cond() { return &update_cond; }
   inline IO_CACHE* get_log_file() { return &log_file; }
 
   inline void lock_index() { mysql_mutex_lock(&LOCK_index);}

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2010-08-23 09:38:10 +0000
+++ b/sql/sql_plugin.cc	2010-09-21 21:24:29 +0000
@@ -519,7 +519,7 @@ static st_plugin_dl *plugin_dl_add(const
       /* no op */;
 
     cur= (struct st_mysql_plugin*)
-          my_malloc(i*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME));
+      my_malloc((i+1)*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME));
     if (!cur)
     {
       free_plugin_mem(&plugin_dl);

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2010-07-26 10:52:59 +0000
+++ b/sql/sql_repl.cc	2010-09-06 17:18:44 +0000
@@ -448,6 +448,8 @@ void mysql_binlog_send(THD* thd, char* l
   const char *errmsg = "Unknown error";
   NET* net = &thd->net;
   mysql_mutex_t *log_lock;
+  mysql_cond_t *log_cond;
+
   bool binlog_can_be_corrupted= FALSE;
 #ifndef DBUG_OFF
   int left_events = max_binlog_dump_events;
@@ -591,7 +593,8 @@ impossible position";
     mysql_bin_log, and it's already inited, and it will be destroyed
     only at shutdown).
   */
-  log_lock = mysql_bin_log.get_log_lock();
+  log_lock= mysql_bin_log.get_log_lock();
+  log_cond= mysql_bin_log.get_log_cond();
   if (pos > BIN_LOG_HEADER_SIZE)
   {
     /* reset transmit packet for the event read from binary log
@@ -826,6 +829,7 @@ impossible position";
 #ifndef DBUG_OFF
           ulong hb_info_counter= 0;
 #endif
+          const char* old_msg= thd->proc_info;
           signal_cnt= mysql_bin_log.signal_cnt;
           do 
           {
@@ -834,6 +838,9 @@ impossible position";
               DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0);
               set_timespec_nsec(*heartbeat_ts, heartbeat_period);
             }
+            thd->enter_cond(log_cond, log_lock,
+                            "Master has sent all binlog to slave; "
+                            "waiting for binlog to be updated");
             ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts);
             DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL));
             if (ret == ETIMEDOUT || ret == ETIME)
@@ -849,12 +856,15 @@ impossible position";
 #endif
               /* reset transmit packet for the heartbeat event */
               if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
+              {
+                thd->exit_cond(old_msg);
                 goto err;
+              }
               if (send_heartbeat_event(net, packet, coord))
               {
                 errmsg = "Failed on my_net_write()";
                 my_errno= ER_UNKNOWN_ERROR;
-                mysql_mutex_unlock(log_lock);
+                thd->exit_cond(old_msg);
                 goto err;
               }
             }
@@ -863,7 +873,7 @@ impossible position";
               DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
             }
           } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
-          mysql_mutex_unlock(log_lock);
+          thd->exit_cond(old_msg);
         }
         break;
             

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-08-12 14:08:52 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-09-17 19:03:09 +0000
@@ -223,6 +223,8 @@ int PFS_engine_table::read_row(TABLE *ta
                                Field **fields)
 {
   my_bitmap_map *org_bitmap;
+  Field *f;
+  Field **fields_reset;
 
   /*
     Make sure the table structure is as expected before mapping
@@ -240,6 +242,16 @@ int PFS_engine_table::read_row(TABLE *ta
 
   /* We internally write to Fields to support the read interface */
   org_bitmap= dbug_tmp_use_all_columns(table, table->write_set);
+
+  /*
+    Some callers of the storage engine interface do not honor the
+    f->is_null() flag, and will attempt to read the data itself.
+    A known offender is mysql_checksum_table().
+    For robustness, reset every field.
+  */
+  for (fields_reset= fields; (f= *fields_reset) ; fields_reset++)
+    f->reset();
+
   int result= read_row_values(table, buf, fields, read_all);
   dbug_tmp_restore_column_map(table->write_set, org_bitmap);
 


Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20100924064643-0gpk0kemht1c13pr.bundle
Thread
bzr push into mysql-5.5-runtime branch (jon.hauglid:3142 to 3143) Jon Olav Hauglid24 Sep