From: Sergey Vojtovich Date: April 4 2011 7:02am Subject: Re: bzr commit into mysql-5.1 branch (mattias.jonsson:3642) Bug#60681 Bug#11933226 List-Archive: http://lists.mysql.com/commits/134581 Message-Id: <20110404070204.GA13530@june> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi Mattias, I guess this patch wouldn't compile. Nevertheless ok to push. Regards, Sergey On Thu, Mar 31, 2011 at 08:14:18AM -0000, Mattias Jonsson wrote: > #At file:///C:/ade/mysql-bzr/b11933226-51/ based on revid:jon.hauglid@stripped > > 3642 Mattias Jonsson 2011-03-31 > BUG#11933226 - Bug#60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE > > ha_partition::checksum() was not implemented, but HA_HAS_CHECKSUM table flag > was returned if the underlying handlers supported it, resulting in CHECKSUM TABLE > returned 0 when checksum was enabled. > > Fixed by implementing ha_partition::checksum() by adding all partitions checksums > together. > > modified: > mysql-test/r/partition.result > mysql-test/t/partition.test > sql/ha_partition.cc > sql/ha_partition.h > === modified file 'mysql-test/r/partition.result' > --- a/mysql-test/r/partition.result 2011-03-09 17:12:23 +0000 > +++ b/mysql-test/r/partition.result 2011-03-31 08:14:13 +0000 > @@ -1,5 +1,63 @@ > drop table if exists t1, t2; > # > +# BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE > +# > +CREATE TABLE t1 ( > +i INT > +) ENGINE=MyISAM > +PARTITION BY RANGE (i) ( > +PARTITION p3 VALUES LESS THAN (3), > +PARTITION p5 VALUES LESS THAN (5), > +PARTITION pMax VALUES LESS THAN MAXVALUE); > +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6); > +CHECKSUM TABLE t1; > +Table Checksum > +test.t1 2653438147 > +ALTER TABLE t1 CHECKSUM = 1; > +CHECKSUM TABLE t1 EXTENDED; > +Table Checksum > +test.t1 2653438147 > +# Before patch this returned 0! > +CHECKSUM TABLE t1; > +Table Checksum > +test.t1 2653438147 > +SHOW CREATE TABLE t1; > +Table Create Table > +t1 CREATE TABLE `t1` ( > + `i` int(11) DEFAULT NULL > +) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 > +/*!50100 PARTITION BY RANGE (i) > +(PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM, > + PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM, > + PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ > +DROP TABLE t1; > +# Same test without partitioning > +CREATE TABLE t1 ( > +i INT > +) ENGINE=MyISAM; > +SHOW CREATE TABLE t1; > +Table Create Table > +t1 CREATE TABLE `t1` ( > + `i` int(11) DEFAULT NULL > +) ENGINE=MyISAM DEFAULT CHARSET=latin1 > +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6); > +CHECKSUM TABLE t1; > +Table Checksum > +test.t1 2653438147 > +ALTER TABLE t1 CHECKSUM = 1; > +CHECKSUM TABLE t1 EXTENDED; > +Table Checksum > +test.t1 2653438147 > +CHECKSUM TABLE t1; > +Table Checksum > +test.t1 2653438147 > +SHOW CREATE TABLE t1; > +Table Create Table > +t1 CREATE TABLE `t1` ( > + `i` int(11) DEFAULT NULL > +) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 > +DROP TABLE t1; > +# > # Bug#59297: Can't find record in 'tablename' on update inner join > # > CREATE TABLE t1 ( > > === modified file 'mysql-test/t/partition.test' > --- a/mysql-test/t/partition.test 2011-03-09 17:12:23 +0000 > +++ b/mysql-test/t/partition.test 2011-03-31 08:14:13 +0000 > @@ -15,6 +15,38 @@ drop table if exists t1, t2; > --enable_warnings > > --echo # > +--echo # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE > +--echo # > +CREATE TABLE t1 ( > + i INT > +) ENGINE=MyISAM > + PARTITION BY RANGE (i) ( > + PARTITION p3 VALUES LESS THAN (3), > + PARTITION p5 VALUES LESS THAN (5), > + PARTITION pMax VALUES LESS THAN MAXVALUE); > +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6); > +CHECKSUM TABLE t1; > +ALTER TABLE t1 CHECKSUM = 1; > +CHECKSUM TABLE t1 EXTENDED; > +--echo # Before patch this returned 0! > +CHECKSUM TABLE t1; > +SHOW CREATE TABLE t1; > +DROP TABLE t1; > + > +--echo # Same test without partitioning > +CREATE TABLE t1 ( > + i INT > +) ENGINE=MyISAM; > +SHOW CREATE TABLE t1; > +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6); > +CHECKSUM TABLE t1; > +ALTER TABLE t1 CHECKSUM = 1; > +CHECKSUM TABLE t1 EXTENDED; > +CHECKSUM TABLE t1; > +SHOW CREATE TABLE t1; > +DROP TABLE t1; > + > +--echo # > --echo # Bug#59297: Can't find record in 'tablename' on update inner join > --echo # > > > === modified file 'sql/ha_partition.cc' > --- a/sql/ha_partition.cc 2011-01-24 12:41:44 +0000 > +++ b/sql/ha_partition.cc 2011-03-31 08:14:13 +0000 > @@ -6664,6 +6664,27 @@ void ha_partition::init_table_handle_for > } > > > +/** > + Return the checksum of the table (all partitions) > +*/ > + > +uint ha_partition::checksum() const > +{ > + ha_checksum crc= 0; > + > + DBUG_ENTER("ha_partition::checksum"); > + if ((table_flags() & HA_HAS_CHECKSUM)) > + { > + handler **file= m_file; > + do > + { > + crc+= (*file)->checksum(); > + } while (*(++file)); > + } > + DBUG_RETURN(crc_sum); > +} > + > + > /**************************************************************************** > MODULE enable/disable indexes > ****************************************************************************/ > > === modified file 'sql/ha_partition.h' > --- a/sql/ha_partition.h 2010-10-01 11:39:49 +0000 > +++ b/sql/ha_partition.h 2011-03-31 08:14:13 +0000 > @@ -1100,8 +1100,8 @@ public: > virtual int preload_keys(THD *thd, HA_CHECK_OPT *check_opt); > virtual int dump(THD* thd, int fd = -1); > virtual int net_read_dump(NET* net); > - virtual uint checksum() const; > */ > + virtual uint checksum() const; > > /* > ------------------------------------------------------------------------- > > > -- > MySQL Code Commits Mailing List > For list archives: http://lists.mysql.com/commits > To unsubscribe: http://lists.mysql.com/commits?unsub=svoj@stripped -- Sergey Vojtovich MySQL AB, Software Engineer Izhevsk, Russia, www.mysql.com