List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:November 22 2006 10:20am
Subject:bk commit into 5.1 tree (mats:1.2371) BUG#24490
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats 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@stripped, 2006-11-22 11:20:07+01:00, mats@romeo.(none) +5 -0
  BUG#24490 (segfault inside unpack_row at Field_bit_as_char::set_default()):
  Field_bit_as_char::set_default() was not defined, so it used Field_bit::set_default() instead,
  which uses unset bit_ptr internally.

  mysql-test/extra/rpl_tests/rpl_row_tabledefs.test@stripped, 2006-11-22 11:20:01+01:00, mats@romeo.(none) +20 -20
    Doing select using ORDER BY to prevent differences due to table-internal ordering.

  mysql-test/r/rpl_row_tabledefs_2myisam.result@stripped, 2006-11-22 11:20:01+01:00, mats@romeo.(none) +26 -26
    Result change

  mysql-test/r/rpl_row_tabledefs_3innodb.result@stripped, 2006-11-22 11:20:01+01:00, mats@romeo.(none) +26 -26
    Result change

  sql/field.h@stripped, 2006-11-22 11:20:01+01:00, mats@romeo.(none) +8 -0
    Adding Field_bit_as_char::set_default() since it cannot use Field_bit::set_default().
    The function Field_bit::set_default() does changes to the bits stored among the null bits,
    but this is undefined for Field_bit_as_char, causing a crash.  Ideally, the inheritance
    should be Field > Field_bit_as_char > Field_bit, but this requires a significant rewrite.
    
    Adding Doxygen comment with a refactor TODO.

  sql/log_event.cc@stripped, 2006-11-22 11:20:02+01:00, mats@romeo.(none) +11 -7
    Field_bit and Field_bit_as_char both use the FIELD_TYPE_BIT as type for the field. Since
    bit_ptr is undefined for Field_bit_as_char, the code that manipulates the null bit-internal
    bits is conditioned on bit_len, which is set to 0 for Field_bit_as_char.

# 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:	mats
# Host:	romeo.(none)
# Root:	/home/bk/memcheck-mysql-5.1

--- 1.191/sql/field.h	2006-11-22 11:20:16 +01:00
+++ 1.192/sql/field.h	2006-11-22 11:20:16 +01:00
@@ -1488,6 +1488,13 @@
 };
 
 
+/**
+  BIT field represented as chars for non-MyISAM tables.
+
+  @todo The inheritance relationship is backwards since Field_bit is
+  an extended version of Field_bit_as_char and not the other way
+  around. Hence, we should refactor it to fix the hierarchy order.
+ */
 class Field_bit_as_char: public Field_bit {
 public:
   Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
@@ -1499,6 +1506,7 @@
   int store(double nr) { return Field_bit::store(nr); }
   int store(longlong nr, bool unsigned_val)
   { return Field_bit::store(nr, unsigned_val); }
+  virtual void set_default() { Field::set_default(); }
   void sql_type(String &str) const;
 };
 

--- 1.254/sql/log_event.cc	2006-11-22 11:20:16 +01:00
+++ 1.255/sql/log_event.cc	2006-11-22 11:20:16 +01:00
@@ -6578,10 +6578,13 @@
 
       case FIELD_TYPE_BIT:
         Field_bit *f= static_cast<Field_bit*>(*field_ptr);
-        my_ptrdiff_t const offset= table->record[1] - table->record[0];
-        uchar const bits=
-          get_rec_bits(f->bit_ptr + offset, f->bit_ofs, f->bit_len);
-        set_rec_bits(bits, f->bit_ptr, f->bit_ofs, f->bit_len);
+        if (f->bit_len > 0)
+        {
+          my_ptrdiff_t const offset= table->record[1] - table->record[0];
+          uchar const bits=
+            get_rec_bits(f->bit_ptr + offset, f->bit_ofs, f->bit_len);
+          set_rec_bits(bits, f->bit_ptr, f->bit_ofs, f->bit_len);
+        }
         break;
       }
     }
@@ -6682,7 +6685,7 @@
        present on the master from table->record[1], if there are any.
     */
     copy_extra_record_fields(table, master_reclength, master_fields);
-    
+
     /*
        REPLACE is defined as either INSERT or DELETE + INSERT.  If
        possible, we can replace it with an UPDATE, but that will not
@@ -7216,10 +7219,8 @@
     Don't print debug messages when running valgrind since they can
     trigger false warnings.
    */
-#ifndef HAVE_purify
   DBUG_DUMP("record[0]", (const char *)table->record[0], m_master_reclength);
   DBUG_DUMP("m_after_image", (const char *)m_after_image, m_master_reclength);
-#endif
 
   /*
     If we will access rows using the random access method, m_key will
@@ -7258,6 +7259,9 @@
   */
   bmove_align(table->record[0], m_after_image, table->s->reclength);
   copy_extra_record_fields(table, m_master_reclength, m_width);
+
+  valgrind_check_mem(table->record[0], table->s->reclength);
+  valgrind_check_mem(table->record[1], table->s->reclength);
 
   /*
     Now we have the right row to update.  The old row (the one we're

--- 1.5/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test	2006-11-22 11:20:16 +01:00
+++ 1.6/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test	2006-11-22 11:20:16 +01:00
@@ -80,28 +80,28 @@
 INSERT INTO t1_bit VALUES (2,5);
 INSERT INTO t1_char VALUES (1,2);
 INSERT INTO t1_char VALUES (2,5);
-SELECT * FROM t1_int;
-SELECT * FROM t1_bit;
-SELECT * FROM t1_char;
+SELECT * FROM t1_int ORDER BY a;
+SELECT * FROM t1_bit ORDER BY a;
+SELECT * FROM t1_char ORDER BY a;
 --echo **** On Slave ****
 sync_slave_with_master;
-SELECT a,b,x FROM t1_int;
-SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
-SELECT a,b,x FROM t1_char;
+SELECT a,b,x FROM t1_int ORDER BY a;
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
+SELECT a,b,x FROM t1_char ORDER BY a;
 
 --echo **** On Master ****
 connection master;
 UPDATE t1_int  SET b=2*b WHERE a=2;
 UPDATE t1_char SET b=2*b WHERE a=2;
 UPDATE t1_bit  SET b=2*b WHERE a=2;
-SELECT * FROM t1_int;
-SELECT * FROM t1_bit;
-SELECT * FROM t1_char;
+SELECT * FROM t1_int ORDER BY a;
+SELECT * FROM t1_bit ORDER BY a;
+SELECT * FROM t1_char ORDER BY a;
 --echo **** On Slave ****
 sync_slave_with_master;
-SELECT a,b,x FROM t1_int;
-SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
-SELECT a,b,x FROM t1_char;
+SELECT a,b,x FROM t1_int ORDER BY a;
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
+SELECT a,b,x FROM t1_char ORDER BY a;
 
 # Each of these inserts should generate an error and stop the slave
 
@@ -188,11 +188,11 @@
 connection master;
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
-SELECT * FROM t7;
-SELECT * FROM t8;
+SELECT * FROM t7 ORDER BY a;
+SELECT * FROM t8 ORDER BY a;
 sync_slave_with_master;
-SELECT * FROM t7;
-SELECT * FROM t8;
+SELECT * FROM t7 ORDER BY a;
+SELECT * FROM t8 ORDER BY a;
 
 # We will now try to update and then delete a row on the master where
 # the extra field on the slave does not have a default value. This
@@ -216,20 +216,20 @@
 --echo **** On Master ****
 connection master;
 UPDATE t1_nodef SET b=2*b WHERE a=1;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 
 --echo **** On Slave ****
 sync_slave_with_master;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 
 --echo **** On Master ****
 connection master;
 DELETE FROM t1_nodef WHERE a=2;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 
 --echo **** On Slave ****
 sync_slave_with_master;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 
 --echo **** Cleanup ****
 connection master;

--- 1.6/mysql-test/r/rpl_row_tabledefs_2myisam.result	2006-11-22 11:20:16 +01:00
+++ 1.7/mysql-test/r/rpl_row_tabledefs_2myisam.result	2006-11-22 11:20:16 +01:00
@@ -46,60 +46,60 @@
 INSERT INTO t1_bit VALUES (2,5);
 INSERT INTO t1_char VALUES (1,2);
 INSERT INTO t1_char VALUES (2,5);
-SELECT * FROM t1_int;
+SELECT * FROM t1_int ORDER BY a;
 a	b
 1	2
 2	5
-SELECT * FROM t1_bit;
+SELECT * FROM t1_bit ORDER BY a;
 a	b
 1	2
 2	5
-SELECT * FROM t1_char;
+SELECT * FROM t1_char ORDER BY a;
 a	b
 1	2
 2	5
 **** On Slave ****
-SELECT a,b,x FROM t1_int;
+SELECT a,b,x FROM t1_int ORDER BY a;
 a	b	x
-2	5	4711
 1	2	42
-SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+2	5	4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
 a	b	HEX(x)	HEX(y)	HEX(z)
-2	5	5	1C	1
 1	2	3	15	2
-SELECT a,b,x FROM t1_char;
+2	5	5	1C	1
+SELECT a,b,x FROM t1_char ORDER BY a;
 a	b	x
-2	5	Foo is a bar
 1	2	Just a test
+2	5	Foo is a bar
 **** On Master ****
 UPDATE t1_int  SET b=2*b WHERE a=2;
 UPDATE t1_char SET b=2*b WHERE a=2;
 UPDATE t1_bit  SET b=2*b WHERE a=2;
-SELECT * FROM t1_int;
+SELECT * FROM t1_int ORDER BY a;
 a	b
 1	2
 2	10
-SELECT * FROM t1_bit;
+SELECT * FROM t1_bit ORDER BY a;
 a	b
 1	2
 2	10
-SELECT * FROM t1_char;
+SELECT * FROM t1_char ORDER BY a;
 a	b
 1	2
 2	10
 **** On Slave ****
-SELECT a,b,x FROM t1_int;
+SELECT a,b,x FROM t1_int ORDER BY a;
 a	b	x
-2	10	4711
 1	2	42
-SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+2	10	4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
 a	b	HEX(x)	HEX(y)	HEX(z)
-2	10	5	1C	1
 1	2	3	15	2
-SELECT a,b,x FROM t1_char;
+2	10	5	1C	1
+SELECT a,b,x FROM t1_char ORDER BY a;
 a	b	x
-2	10	Foo is a bar
 1	2	Just a test
+2	10	Foo is a bar
 INSERT INTO t9 VALUES (2);
 INSERT INTO t1_nodef VALUES (1,2);
 SHOW SLAVE STATUS;
@@ -327,22 +327,22 @@
 Seconds_Behind_Master	#
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
-SELECT * FROM t7;
+SELECT * FROM t7 ORDER BY a;
 a
 1
 2
 3
-SELECT * FROM t8;
+SELECT * FROM t8 ORDER BY a;
 a
 1
 2
 3
-SELECT * FROM t7;
+SELECT * FROM t7 ORDER BY a;
 a	e1	e2	e3	e4	e5	e6	e7	e8
 1	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 2	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 3	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
-SELECT * FROM t8;
+SELECT * FROM t8 ORDER BY a;
 a	e1	e2	e3	e4	e5	e6	e7	e8
 1	0	0	0	0	0	0	0	0
 2	0	0	0	0	0	0	0	0
@@ -358,22 +358,22 @@
 INSERT INTO t1_nodef VALUES (2,4,6);
 **** On Master ****
 UPDATE t1_nodef SET b=2*b WHERE a=1;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b
 1	4
 2	4
 **** On Slave ****
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b	x
 1	4	3
 2	4	6
 **** On Master ****
 DELETE FROM t1_nodef WHERE a=2;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b
 1	4
 **** On Slave ****
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b	x
 1	4	3
 **** Cleanup ****

--- 1.3/mysql-test/r/rpl_row_tabledefs_3innodb.result	2006-11-22 11:20:16 +01:00
+++ 1.4/mysql-test/r/rpl_row_tabledefs_3innodb.result	2006-11-22 11:20:16 +01:00
@@ -46,60 +46,60 @@
 INSERT INTO t1_bit VALUES (2,5);
 INSERT INTO t1_char VALUES (1,2);
 INSERT INTO t1_char VALUES (2,5);
-SELECT * FROM t1_int;
+SELECT * FROM t1_int ORDER BY a;
 a	b
 1	2
 2	5
-SELECT * FROM t1_bit;
+SELECT * FROM t1_bit ORDER BY a;
 a	b
 1	2
 2	5
-SELECT * FROM t1_char;
+SELECT * FROM t1_char ORDER BY a;
 a	b
 1	2
 2	5
 **** On Slave ****
-SELECT a,b,x FROM t1_int;
+SELECT a,b,x FROM t1_int ORDER BY a;
 a	b	x
-2	5	4711
 1	2	42
-SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+2	5	4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
 a	b	HEX(x)	HEX(y)	HEX(z)
-2	5	5	1C	1
 1	2	3	15	2
-SELECT a,b,x FROM t1_char;
+2	5	5	1C	1
+SELECT a,b,x FROM t1_char ORDER BY a;
 a	b	x
-2	5	Foo is a bar
 1	2	Just a test
+2	5	Foo is a bar
 **** On Master ****
 UPDATE t1_int  SET b=2*b WHERE a=2;
 UPDATE t1_char SET b=2*b WHERE a=2;
 UPDATE t1_bit  SET b=2*b WHERE a=2;
-SELECT * FROM t1_int;
+SELECT * FROM t1_int ORDER BY a;
 a	b
 1	2
 2	10
-SELECT * FROM t1_bit;
+SELECT * FROM t1_bit ORDER BY a;
 a	b
 1	2
 2	10
-SELECT * FROM t1_char;
+SELECT * FROM t1_char ORDER BY a;
 a	b
 1	2
 2	10
 **** On Slave ****
-SELECT a,b,x FROM t1_int;
+SELECT a,b,x FROM t1_int ORDER BY a;
 a	b	x
-2	10	4711
 1	2	42
-SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit;
+2	10	4711
+SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
 a	b	HEX(x)	HEX(y)	HEX(z)
-2	10	5	1C	1
 1	2	3	15	2
-SELECT a,b,x FROM t1_char;
+2	10	5	1C	1
+SELECT a,b,x FROM t1_char ORDER BY a;
 a	b	x
-2	10	Foo is a bar
 1	2	Just a test
+2	10	Foo is a bar
 INSERT INTO t9 VALUES (2);
 INSERT INTO t1_nodef VALUES (1,2);
 SHOW SLAVE STATUS;
@@ -327,22 +327,22 @@
 Seconds_Behind_Master	#
 INSERT INTO t7 VALUES (1),(2),(3);
 INSERT INTO t8 VALUES (1),(2),(3);
-SELECT * FROM t7;
+SELECT * FROM t7 ORDER BY a;
 a
 1
 2
 3
-SELECT * FROM t8;
+SELECT * FROM t8 ORDER BY a;
 a
 1
 2
 3
-SELECT * FROM t7;
+SELECT * FROM t7 ORDER BY a;
 a	e1	e2	e3	e4	e5	e6	e7	e8
 1	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 2	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 3	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
-SELECT * FROM t8;
+SELECT * FROM t8 ORDER BY a;
 a	e1	e2	e3	e4	e5	e6	e7	e8
 1	0	0	0	0	0	0	0	0
 2	0	0	0	0	0	0	0	0
@@ -358,22 +358,22 @@
 INSERT INTO t1_nodef VALUES (2,4,6);
 **** On Master ****
 UPDATE t1_nodef SET b=2*b WHERE a=1;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b
 1	4
 2	4
 **** On Slave ****
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b	x
 1	4	3
 2	4	6
 **** On Master ****
 DELETE FROM t1_nodef WHERE a=2;
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b
 1	4
 **** On Slave ****
-SELECT * FROM t1_nodef;
+SELECT * FROM t1_nodef ORDER BY a;
 a	b	x
 1	4	3
 **** Cleanup ****
Thread
bk commit into 5.1 tree (mats:1.2371) BUG#24490Mats Kindahl22 Nov