From: Date: August 11 2005 1:36pm Subject: bk commit into 4.1 tree (ingo:1.2371) BUG#12296 List-Archive: http://lists.mysql.com/internals/28150 X-Bug: 12296 Message-Id: Below is the list of changes that have just been committed into a local 4.1 repository of mydev. When mydev 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 1.2371 05/08/11 13:36:19 ingo@stripped +3 -0 Bug#12296 - CHECKSUM TABLE reports 0 for the table Skipping deleted records instead of breaking the loop during checksum calculation. sql/sql_table.cc 1.297 05/08/11 13:36:13 ingo@stripped +8 -1 Bug#12296 - CHECKSUM TABLE reports 0 for the table Skipping deleted records instead of breaking the loop during checksum calculation. mysql-test/t/myisam.test 1.40 05/08/11 13:36:13 ingo@stripped +15 -0 Bug#12296 - CHECKSUM TABLE reports 0 for the table The test case. mysql-test/r/myisam.result 1.51 05/08/11 13:36:12 ingo@stripped +14 -0 Bug#12296 - CHECKSUM TABLE reports 0 for the table The test result. # 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: ingo # Host: chilla.local # Root: /home/mydev/mysql-4.1-4100 --- 1.296/sql/sql_table.cc 2005-07-27 00:54:24 +02:00 +++ 1.297/sql/sql_table.cc 2005-08-11 13:36:13 +02:00 @@ -3745,9 +3745,16 @@ protocol->store_null(); else { - while (!t->file->rnd_next(t->record[0])) + for (;;) { ha_checksum row_crc= 0; + int error= t->file->rnd_next(t->record[0]); + if (unlikely(error)) + { + if (error == HA_ERR_RECORD_DELETED) + continue; + break; + } if (t->record[0] != (byte*) t->field[0]->ptr) row_crc= my_checksum(row_crc, t->record[0], ((byte*) t->field[0]->ptr) - t->record[0]); --- 1.50/mysql-test/r/myisam.result 2005-07-27 18:53:20 +02:00 +++ 1.51/mysql-test/r/myisam.result 2005-08-11 13:36:12 +02:00 @@ -595,3 +595,17 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A 8 NULL NULL YES BTREE drop table t1; +create table t1 (c1 int); +insert into t1 values (1),(2),(3),(4); +checksum table t1; +Table Checksum +test.t1 149057747 +delete from t1 where c1 = 1; +create table t2 as select * from t1; +checksum table t1; +Table Checksum +test.t1 984116287 +checksum table t2; +Table Checksum +test.t2 984116287 +drop table t1; --- 1.39/mysql-test/t/myisam.test 2005-08-04 13:30:31 +02:00 +++ 1.40/mysql-test/t/myisam.test 2005-08-11 13:36:13 +02:00 @@ -575,4 +575,19 @@ drop table t1; +# +# Bug#12296 - CHECKSUM TABLE reports 0 for the table +# This happened if the first record was marked as deleted. +# +create table t1 (c1 int); +insert into t1 values (1),(2),(3),(4); +checksum table t1; +delete from t1 where c1 = 1; +create table t2 as select * from t1; +# The following returns 0 with the bug in place. +checksum table t1; +# The above should give the same number as the following. +checksum table t2; +drop table t1; + # End of 4.1 tests