MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:December 17 2009 5:55am
Subject:bzr commit into mysql-5.0-bugteam branch (ramil:2823) Bug#49465
View as plain text  
#At file:///home/ram/mysql/b49465-5.0-bugteam/ based on revid:joro@stripped

 2823 Ramil Kalimullin	2009-12-17
      Fix for bug#49465: valgrind warnings and incorrect live checksum...
      
      Problem: inserting a record we don't set unused null bits in the
      record buffer if no default field values used.
      That may lead to wrong live checksum calculation.
      
      Fix: set unused null bits in the record buffer in such cases.
     @ mysql-test/r/myisam.result
        Fix for bug#49465: valgrind warnings and incorrect live checksum...
          - test result.
     @ mysql-test/t/myisam.test
        Fix for bug#49465: valgrind warnings and incorrect live checksum...
          - test case.
     @ sql/sql_insert.cc
        Fix for bug#49465: valgrind warnings and incorrect live checksum...
          - set unused null bits to 1 in the record buffer in case we
        don't call restore_record() before a fill_record() call
        (when no default values used).

    modified:
      mysql-test/r/myisam.result
      mysql-test/t/myisam.test
      sql/sql_insert.cc
=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2008-08-26 13:48:50 +0000
+++ b/mysql-test/r/myisam.result	2009-12-17 05:55:03 +0000
@@ -1883,4 +1883,19 @@ CHECK TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
+#
+# Bug #49465: valgrind warnings and incorrect live checksum...
+#
+CREATE TABLE t1(
+a VARCHAR(1), b VARCHAR(1), c VARCHAR(1),
+f VARCHAR(1), g VARCHAR(1), h VARCHAR(1),
+i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1;
+INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', '');
+CHECKSUM TABLE t1 QUICK;
+Table	Checksum
+test.t1	467455460
+CHECKSUM TABLE t1 EXTENDED;
+Table	Checksum
+test.t1	467455460
+DROP TABLE t1;
 End of 5.0 tests

=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test	2008-08-26 13:48:50 +0000
+++ b/mysql-test/t/myisam.test	2009-12-17 05:55:03 +0000
@@ -1225,4 +1225,18 @@ SELECT a FROM t1;
 CHECK TABLE t1;
 DROP TABLE t1; 
 
+
+--echo #
+--echo # Bug #49465: valgrind warnings and incorrect live checksum...
+--echo #
+CREATE TABLE t1(
+a VARCHAR(1), b VARCHAR(1), c VARCHAR(1),
+f VARCHAR(1), g VARCHAR(1), h VARCHAR(1),
+i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1;
+INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', '');
+CHECKSUM TABLE t1 QUICK;
+CHECKSUM TABLE t1 EXTENDED;
+DROP TABLE t1;
+
+
 --echo End of 5.0 tests

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-09-04 06:51:54 +0000
+++ b/sql/sql_insert.cc	2009-12-17 05:55:03 +0000
@@ -787,12 +787,21 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
 	restore_record(table,s->default_values);	// Get empty record
       else
       {
+        TABLE_SHARE *share= table->s;
+
         /*
           Fix delete marker. No need to restore rest of record since it will
           be overwritten by fill_record() anyway (and fill_record() does not
           use default values in this case).
         */
-	table->record[0][0]= table->s->default_values[0];
+        table->record[0][0]= share->default_values[0];
+
+        /* Fix undefined null_bits. */
+        if (share->null_bytes > 1 && share->last_null_bit_pos)
+        {
+          table->record[0][share->null_bytes - 1]= 
+            share->default_values[share->null_bytes - 1];
+        }
       }
       if (fill_record_n_invoke_before_triggers(thd, table->field, *values, 0,
                                                table->triggers,


Attachment: [text/bzr-bundle] bzr/ramil@mysql.com-20091217055503-x5gma5nmhcgit5em.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (ramil:2823) Bug#49465Ramil Kalimullin17 Dec