List:Internals« Previous MessageNext Message »
From:ingo Date:August 29 2005 5:08pm
Subject:bk commit into 4.1 tree (ingo:1.2392) BUG#12296
View as plain text  
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.2392 05/08/29 17:08:41 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.300 05/08/29 17:08:36 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/29 17:08:36 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/29 17:08:36 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.299/sql/sql_table.cc	2005-08-22 11:19:56 +02:00
+++ 1.300/sql/sql_table.cc	2005-08-29 17:08:36 +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-29 17:08:36 +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, t2;

--- 1.39/mysql-test/t/myisam.test	2005-08-04 13:30:31 +02:00
+++ 1.40/mysql-test/t/myisam.test	2005-08-29 17:08:36 +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, t2;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (ingo:1.2392) BUG#12296ingo29 Aug