List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:October 2 2008 9:06pm
Subject:bzr push into mysql-6.0 branch (kostja:2720 to 2721) Bug#36473
View as plain text  
 2721 Konstantin Osipov	2008-10-03
      A fix and a test case for Bug#36473 Assertion "! is_set()" fails in 
      Diagnostics_area::set_ok_status with Falcon.
      
      When running in strict mode, update_auto_increment() function
      may return an error. In case of Bug#36473 the error was due to an 
      out of range auto increment value for a TINYINT column.
      Falcon handler implementation did not check for the return value
      and that led to an attempt to commit statement transaction in the
      server and return success status to the user.
      Fix by checking the return value of update_auto_increment().
modified:
  mysql-test/suite/falcon/r/falcon_bugs.result
  mysql-test/suite/falcon/t/falcon_bugs.test
  storage/falcon/ha_falcon.cpp

 2720 Konstantin Osipov	2008-10-02
      Bug #36072 Two constants having same value in THD::options
      Change OPTION_ALLOW_BATCH to bit 34.
modified:
  sql/mysql_priv.h

=== modified file 'mysql-test/suite/falcon/r/falcon_bugs.result'
--- a/mysql-test/suite/falcon/r/falcon_bugs.result	2007-11-26 15:50:23 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bugs.result	2008-10-02 21:05:39 +0000
@@ -3263,4 +3263,20 @@ count(*)
 select count(*) from t2 where b = 150;
 count(*)
 1
+#
+# Bug #36473 Assertion "! is_set()" fails in
+# Diagnostics_area::set_ok_status with Falcon
+# Ensure that we check the return value of update_auto_increment().
+#
+set @@storage_engine = falcon;
+drop table if exists t1;
+create table t1 (a tinyint(4) NOT NULL auto_increment, primary key (a));
+set @@sql_mode='strict_all_tables';
+set auto_increment_increment=1000;
+set auto_increment_offset=700;
+insert into t1 values (null);
+ERROR 22003: Out of range value for column 'a' at row 1
+set @@sql_mode=default;
+set auto_increment_offset=default;
+set auto_increment_increment=default;
 DROP TABLE t1, t2;

=== modified file 'mysql-test/suite/falcon/t/falcon_bugs.test'
--- a/mysql-test/suite/falcon/t/falcon_bugs.test	2007-12-19 18:55:35 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bugs.test	2008-10-02 21:05:39 +0000
@@ -1772,5 +1772,26 @@ update t1, t2 set t1.b = 150, t2.b = t1.
 select count(*) from t1 where b = 150;
 select count(*) from t2 where b = 150;
 
+
+--echo #
+--echo # Bug #36473 Assertion "! is_set()" fails in
+--echo # Diagnostics_area::set_ok_status with Falcon
+--echo # Ensure that we check the return value of update_auto_increment().
+--echo #
+set @@storage_engine = falcon;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a tinyint(4) NOT NULL auto_increment, primary key (a));
+set @@sql_mode='strict_all_tables';
+set auto_increment_increment=1000;
+set auto_increment_offset=700;
+--error ER_WARN_DATA_OUT_OF_RANGE
+insert into t1 values (null);
+set @@sql_mode=default;
+set auto_increment_offset=default;
+set auto_increment_increment=default;
+
 # Final cleanup.
 DROP TABLE t1, t2;

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-09-04 18:30:34 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-10-02 21:05:39 +0000
@@ -1079,14 +1079,19 @@ int StorageInterface::write_row(uchar *b
 
 	if (table->next_number_field && buff == table->record[0])
 		{
-		update_auto_increment();
+		int code = update_auto_increment();
+		/*
+		   May fail, e.g. due to an out of range value in STRICT mode.
+		*/
+		if (code)
+			DBUG_RETURN(code);
 
 		/*
 		   If the new value is less than the current highest value, it will be
 		   ignored by setSequenceValue().
 		*/
 
-		int code = storageShare->setSequenceValue(table->next_number_field->val_int());
+		code = storageShare->setSequenceValue(table->next_number_field->val_int());
 
 		if (code)
 			DBUG_RETURN(error(code));

Thread
bzr push into mysql-6.0 branch (kostja:2720 to 2721) Bug#36473Konstantin Osipov2 Oct