List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:October 1 2010 7:35pm
Subject:bzr push into mysql-5.1-bugteam branch (mattias.jonsson:3520 to 3521)
View as plain text  
 3521 Mattias Jonsson	2010-10-01 [merge]
      merge

    added:
      mysql-test/r/partition_binlog_stmt.result
      mysql-test/t/partition_binlog_stmt.test
    modified:
      mysql-test/r/partition.result
      mysql-test/t/partition.test
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/table.cc
      sql/table.h
 3520 Vasil Dimov	2010-10-01 [merge]
      Merge mysql-5.1-innodb -> mysql-5.1-bugteam

    added:
      mysql-test/suite/innodb_plugin/r/innodb_bug53756.result
      mysql-test/suite/innodb_plugin/t/innodb_bug53756-master.opt
      mysql-test/suite/innodb_plugin/t/innodb_bug53756.test
    modified:
      storage/innobase/btr/btr0btr.c
      storage/innobase/btr/btr0cur.c
      storage/innobase/btr/btr0pcur.c
      storage/innobase/btr/btr0sea.c
      storage/innobase/buf/buf0flu.c
      storage/innobase/eval/eval0eval.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/ut0rnd.ic
      storage/innobase/lock/lock0lock.c
      storage/innobase/log/log0recv.c
      storage/innobase/os/os0file.c
      storage/innobase/que/que0que.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0purge.c
      storage/innobase/row/row0umod.c
      storage/innobase/row/row0upd.c
      storage/innobase/row/row0vers.c
      storage/innobase/trx/trx0purge.c
      storage/innobase/trx/trx0roll.c
      storage/innobase/trx/trx0sys.c
      storage/innobase/trx/trx0trx.c
      storage/innobase/trx/trx0undo.c
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/btr/btr0btr.c
      storage/innodb_plugin/btr/btr0cur.c
      storage/innodb_plugin/btr/btr0pcur.c
      storage/innodb_plugin/btr/btr0sea.c
      storage/innodb_plugin/buf/buf0flu.c
      storage/innodb_plugin/dict/dict0crea.c
      storage/innodb_plugin/dict/dict0dict.c
      storage/innodb_plugin/dict/dict0load.c
      storage/innodb_plugin/eval/eval0eval.c
      storage/innodb_plugin/handler/ha_innodb.cc
      storage/innodb_plugin/handler/i_s.cc
      storage/innodb_plugin/include/os0sync.h
      storage/innodb_plugin/include/univ.i
      storage/innodb_plugin/include/ut0rnd.ic
      storage/innodb_plugin/log/log0recv.c
      storage/innodb_plugin/os/os0file.c
      storage/innodb_plugin/que/que0que.c
      storage/innodb_plugin/row/row0mysql.c
      storage/innodb_plugin/row/row0purge.c
      storage/innodb_plugin/row/row0umod.c
      storage/innodb_plugin/row/row0vers.c
      storage/innodb_plugin/trx/trx0purge.c
      storage/innodb_plugin/trx/trx0roll.c
      storage/innodb_plugin/trx/trx0sys.c
      storage/innodb_plugin/trx/trx0trx.c
      storage/innodb_plugin/trx/trx0undo.c
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2010-09-10 09:52:35 +0000
+++ b/mysql-test/r/partition.result	2010-10-01 13:41:27 +0000
@@ -1,5 +1,20 @@
 drop table if exists t1, t2;
 #
+# Bug#57113: ha_partition::extra(ha_extra_function):
+#            Assertion `m_extra_cache' failed
+CREATE TABLE t1
+(id INT NOT NULL PRIMARY KEY,
+name VARCHAR(16) NOT NULL,
+year YEAR,
+INDEX name (name(8))
+)
+PARTITION BY HASH(id) PARTITIONS 2;
+INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
+CREATE TABLE t2 (id INT);
+INSERT INTO t2 VALUES (1),(2);
+UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
+DROP TABLE t1, t2;
+#
 # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update 
 #
 CREATE TABLE t1 (

=== added file 'mysql-test/r/partition_binlog_stmt.result'
--- a/mysql-test/r/partition_binlog_stmt.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_binlog_stmt.result	2010-10-01 11:39:04 +0000
@@ -0,0 +1,13 @@
+DROP TABLE IF EXISTS t1;
+#
+# Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
+#            partitioned MyISAM table
+CREATE TABLE t1
+(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+name TINYBLOB NOT NULL,
+modified TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+INDEX namelocs (name(255))) ENGINE = MyISAM
+PARTITION BY HASH(id) PARTITIONS 2;
+LOAD DATA LOCAL INFILE 'init_file.txt'
+INTO TABLE t1 (name);
+DROP TABLE t1;

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2010-08-10 08:43:12 +0000
+++ b/mysql-test/t/partition.test	2010-09-30 13:57:33 +0000
@@ -15,6 +15,28 @@ drop table if exists t1, t2;
 --enable_warnings
 
 --echo #
+--echo # Bug#57113: ha_partition::extra(ha_extra_function):
+--echo #            Assertion `m_extra_cache' failed
+CREATE TABLE t1
+(id INT NOT NULL PRIMARY KEY,
+ name VARCHAR(16) NOT NULL,
+ year YEAR,
+ INDEX name (name(8))
+)
+PARTITION BY HASH(id) PARTITIONS 2;
+
+INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
+
+CREATE TABLE t2 (id INT);
+
+INSERT INTO t2 VALUES (1),(2);
+
+UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
+
+DROP TABLE t1, t2;
+
+
+--echo #
 --echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update 
 --echo #
 CREATE TABLE t1 (

=== added file 'mysql-test/t/partition_binlog_stmt.test'
--- a/mysql-test/t/partition_binlog_stmt.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_binlog_stmt.test	2010-10-01 11:39:04 +0000
@@ -0,0 +1,26 @@
+--source include/have_partition.inc
+--source include/have_binlog_format_statement.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo #
+--echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
+--echo #            partitioned MyISAM table
+--write_file init_file.txt
+abcd
+EOF
+
+CREATE TABLE t1
+(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ name TINYBLOB NOT NULL,
+ modified TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+ INDEX namelocs (name(255))) ENGINE = MyISAM
+PARTITION BY HASH(id) PARTITIONS 2;
+
+LOAD DATA LOCAL INFILE 'init_file.txt'
+INTO TABLE t1 (name);
+
+--remove_file init_file.txt
+DROP TABLE t1;

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2010-09-10 09:52:35 +0000
+++ b/sql/ha_partition.cc	2010-10-01 13:41:27 +0000
@@ -2451,6 +2451,21 @@ err1:
 /****************************************************************************
                 MODULE open/close object
 ****************************************************************************/
+
+
+/**
+  A destructor for partition-specific TABLE_SHARE data.
+*/
+
+void ha_data_partition_destroy(void *ha_data)
+{
+  if (ha_data)
+  {
+    HA_DATA_PARTITION *ha_part_data= (HA_DATA_PARTITION*) ha_data;
+    pthread_mutex_destroy(&ha_part_data->LOCK_auto_inc);
+  }
+}
+
 /*
   Open handler object
 
@@ -2607,6 +2622,8 @@ int ha_partition::open(const char *name,
     }
     DBUG_PRINT("info", ("table_share->ha_data 0x%p", ha_data));
     bzero(ha_data, sizeof(HA_DATA_PARTITION));
+    table_share->ha_data_destroy= ha_data_partition_destroy;
+    VOID(pthread_mutex_init(&ha_data->LOCK_auto_inc, MY_MUTEX_INIT_FAST));
   }
   if (is_not_tmp_table)
     pthread_mutex_unlock(&table_share->mutex);
@@ -5555,7 +5572,6 @@ int ha_partition::extra(enum ha_extra_fu
     DBUG_RETURN(prepare_for_rename());
     break;
   case HA_EXTRA_PREPARE_FOR_UPDATE:
-    DBUG_ASSERT(m_extra_cache);
     /*
       Needs to be run on the first partition in the range now, and 
       later in late_extra_cache, when switching to a new partition to scan.
@@ -5563,6 +5579,8 @@ int ha_partition::extra(enum ha_extra_fu
     m_extra_prepare_for_update= TRUE;
     if (m_part_spec.start_part != NO_CURRENT_PART_ID)
     {
+      if (!m_extra_cache)
+        m_extra_cache_part_id= m_part_spec.start_part;
       DBUG_ASSERT(m_extra_cache_part_id == m_part_spec.start_part);
       VOID(m_file[m_part_spec.start_part]->extra(HA_EXTRA_PREPARE_FOR_UPDATE));
     }
@@ -5825,19 +5843,22 @@ void ha_partition::late_extra_cache(uint
 {
   handler *file;
   DBUG_ENTER("ha_partition::late_extra_cache");
-  DBUG_PRINT("info", ("extra_cache %u partid %u size %u", m_extra_cache,
+  DBUG_PRINT("info", ("extra_cache %u prepare %u partid %u size %u",
+                      m_extra_cache, m_extra_prepare_for_update,
                       partition_id, m_extra_cache_size));
 
   if (!m_extra_cache && !m_extra_prepare_for_update)
     DBUG_VOID_RETURN;
   file= m_file[partition_id];
-  if (m_extra_cache_size == 0)
-    VOID(file->extra(HA_EXTRA_CACHE));
-  else
-    VOID(file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size));
+  if (m_extra_cache)
+  {
+    if (m_extra_cache_size == 0)
+      VOID(file->extra(HA_EXTRA_CACHE));
+    else
+      VOID(file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size));
+  }
   if (m_extra_prepare_for_update)
   {
-    DBUG_ASSERT(m_extra_cache);
     VOID(file->extra(HA_EXTRA_PREPARE_FOR_UPDATE));
   }
   m_extra_cache_part_id= partition_id;

=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h	2010-09-07 15:56:43 +0000
+++ b/sql/ha_partition.h	2010-10-01 11:39:49 +0000
@@ -44,6 +44,7 @@ typedef struct st_partition_share
 typedef struct st_ha_data_partition
 {
   ulonglong next_auto_inc_val;                 /**< first non reserved value */
+  pthread_mutex_t LOCK_auto_inc;
   bool auto_inc_initialized;
 } HA_DATA_PARTITION;
 
@@ -948,8 +949,9 @@ private:
     DBUG_ASSERT(table_share->ha_data && !auto_increment_lock);
     if(table_share->tmp_table == NO_TMP_TABLE)
     {
+      HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
       auto_increment_lock= TRUE;
-      pthread_mutex_lock(&table_share->mutex);
+      pthread_mutex_lock(&ha_data->LOCK_auto_inc);
     }
   }
   virtual void unlock_auto_increment()
@@ -962,7 +964,8 @@ private:
     */
     if(auto_increment_lock && !auto_increment_safe_stmt_log_lock)
     {
-      pthread_mutex_unlock(&table_share->mutex);
+      HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
+      pthread_mutex_unlock(&ha_data->LOCK_auto_inc);
       auto_increment_lock= FALSE;
     }
   }

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-07-20 18:07:36 +0000
+++ b/sql/table.cc	2010-10-01 11:39:04 +0000
@@ -425,6 +425,11 @@ void free_table_share(TABLE_SHARE *share
       key_info->flags= 0;
     }
   }
+  if (share->ha_data_destroy)
+  {
+    share->ha_data_destroy(share->ha_data);
+    share->ha_data_destroy= NULL;
+  }
   /* We must copy mem_root from share because share is allocated through it */
   memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root));
   free_root(&mem_root, MYF(0));                 // Free's share
@@ -1616,6 +1621,11 @@ static int open_binary_frm(THD *thd, TAB
   delete crypted;
   delete handler_file;
   hash_free(&share->name_hash);
+  if (share->ha_data_destroy)
+  {
+    share->ha_data_destroy(share->ha_data);
+    share->ha_data_destroy= NULL;
+  }
 
   open_table_error(share, error, share->open_errno, errarg);
   DBUG_RETURN(error);

=== modified file 'sql/table.h'
--- a/sql/table.h	2010-08-02 07:50:15 +0000
+++ b/sql/table.h	2010-10-01 11:39:04 +0000
@@ -463,6 +463,7 @@ typedef struct st_table_share
 
   /** place to store storage engine specific data */
   void *ha_data;
+  void (*ha_data_destroy)(void *); /* An optional destructor for ha_data. */
 
 
   /*


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20101001162940-d8n2vl9s8l7wy1bo.bundle
Thread
bzr push into mysql-5.1-bugteam branch (mattias.jonsson:3520 to 3521) Mattias Jonsson1 Oct