Bug #49465 valgrind warnings and incorrect live checksum...

Submitted: 4 Dec 2009 19:03 Modified: 12 Mar 2010 16:39
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:5.0.88,5.1.41, 5.1.43 OS:Any
Assigned to: Ramil Kalimullin CPU Architecture:Any
Tags: checksum, valgrind

[4 Dec 2009 19:03] Shane Bester
Description:
with a certain number of fields in a table, checksum causes valgrind errors.
more-over, the output of checksum table
5.1.41 valgrind output:
Use of uninitialised value of size 8                       
at: crc32 (crc32.c:289)                                    
by: my_checksum (checksum.c:39)                            
by: mi_checksum (mi_checksum.c:55)                         
by: mi_write (mi_write.c:143)                              
by: ha_myisam::write_row (ha_myisam.cc:780)                
by: handler::ha_write_row(unsigned char*) (handler.cc:4650)
by: write_record (sql_insert.cc:1581)                      
by: mysql_insert (sql_insert.cc:810)                       
by: mysql_execute_command(THD*) (sql_parse.cc:3179)        
by: mysql_parse (sql_parse.cc:5970)                        
by: dispatch_command (sql_parse.cc:1231)                   
by: do_command(THD*) (sql_parse.cc:872)                    

mysql> checksum table t1 quick;
+---------+------------+
| Table   | Checksum   |
+---------+------------+
| test.t1 | 1104745215 | <-------this will be kinda random :-0
+---------+------------+
1 row in set (0.00 sec)

mysql> checksum table t1 extended;
+---------+-----------+
| Table   | Checksum  |
+---------+-----------+
| test.t1 | 467455460 |
+---------+-----------+
1 row in set (0.00 sec)

How to repeat:
run mysqld under valgrind, then:

drop table if exists `t1`;
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)
) engine=myisam default charset=latin1 checksum=1;
insert into `t1` values ('','','','','','','','','');
checksum table `t1` quick;    #get the live checksum
checksum table `t1` extended; #recalculate
[4 Dec 2009 19:12] Valeriy Kravchuk
Verified just as described:

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.1.43-debug |
+--------------+
1 row in set (0.00 sec)

mysql> drop table if exists `t1`;
Query OK, 0 rows affected (0.00 sec)

mysql> 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)
    -> ) engine=myisam default charset=latin1 checksum=1;
Query OK, 0 rows affected (0.06 sec)

mysql> insert into `t1` values ('','','','','','','','','');
Query OK, 1 row affected (0.00 sec)

mysql> checksum table `t1` quick;    #get the live checksum
+---------+------------+
| Table   | Checksum   |
+---------+------------+
| test.t1 | 2422371598 |
+---------+------------+
1 row in set (0.00 sec)

mysql> checksum table `t1` extended; #recalculate
+---------+-----------+
| Table   | Checksum  |
+---------+-----------+
| test.t1 | 467455460 |
+---------+-----------+
1 row in set (0.00 sec)
[11 Dec 2009 18:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/93746

2868 Ramil Kalimullin	2009-12-11
      Fix for bug#49465: valgrind warnings and incorrect live checksum...
      
      Problem: writing a record we don't set unused null bits in the
      record buffer in some cases. That may lead to wrong live checksum
      calculation.
      
      Fix: set unused null bits in the record buffer.
     @ 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_base.cc
        Fix for bug#49465: valgrind warnings and incorrect live checksum...
          - fillrecord(): set undefined null bits in the record buffer.
[15 Dec 2009 20:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/94273

2868 Ramil Kalimullin	2009-12-16
      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).
[17 Dec 2009 5:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/94657

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).
[19 Dec 2009 8:27] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091219082307-f3i4fn0tm8trb3c0) (version source revid:alik@sun.com-20091217193315-s3ck6ltg8m1zz6r3) (merge vers: 6.0.14-alpha) (pib:15)
[19 Dec 2009 8:30] Bugs System
Pushed into 5.5.1-m2 (revid:alik@sun.com-20091219082021-f34nq4jytwamozz0) (version source revid:alexey.kopytov@sun.com-20091217150904-ugetvos7v0bo83qe) (merge vers: 5.5.0-beta) (pib:15)
[19 Dec 2009 8:33] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20091219082213-nhjjgmphote4ntxj) (version source revid:alik@sun.com-20091217191654-rb9sci536v96viaz) (pib:15)
[5 Jan 2010 20:08] Paul DuBois
Noted in 5.5.1, 6.0.14 changelogs.

Valgrind warnings for CHECKSUM TABLE were corrected.
[14 Jan 2010 8:26] Bugs System
Pushed into 5.0.90 (revid:joro@sun.com-20100114082402-05fod2h6z9x9wok8) (version source revid:ramil@mysql.com-20091217055503-x5gma5nmhcgit5em) (merge vers: 5.0.89) (pib:16)
[14 Jan 2010 18:32] Paul DuBois
Noted in 5.0.90 changelog.

Setting report to NDI pending push to 5.1.x, Celosia.
[15 Jan 2010 8:59] Bugs System
Pushed into 5.1.43 (revid:joro@sun.com-20100115085139-qkh0i0fpohd9u9p5) (version source revid:jimw@mysql.com-20091217191514-t4zu0fd4z9534u1q) (merge vers: 5.1.42) (pib:16)
[15 Jan 2010 18:39] Paul DuBois
Noted in 5.1.43 changelog.

Setting report to NDI pending push to Celosia.
[12 Mar 2010 14:13] Bugs System
Pushed into 5.1.44-ndb-7.0.14 (revid:jonas@mysql.com-20100312135944-t0z8s1da2orvl66x) (version source revid:jonas@mysql.com-20100312115609-woou0te4a6s4ae9y) (merge vers: 5.1.44-ndb-7.0.14) (pib:16)
[12 Mar 2010 14:29] Bugs System
Pushed into 5.1.44-ndb-6.2.19 (revid:jonas@mysql.com-20100312134846-tuqhd9w3tv4xgl3d) (version source revid:jonas@mysql.com-20100312060623-mx6407w2vx76h3by) (merge vers: 5.1.44-ndb-6.2.19) (pib:16)
[12 Mar 2010 14:45] Bugs System
Pushed into 5.1.44-ndb-6.3.33 (revid:jonas@mysql.com-20100312135724-xcw8vw2lu3mijrhn) (version source revid:jonas@mysql.com-20100312103652-snkltsd197l7q2yg) (merge vers: 5.1.44-ndb-6.3.33) (pib:16)
[12 Mar 2010 16:39] Paul DuBois
Fixed in earlier 5.1.x, 5.5.x.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.