MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tim Date:November 6 2007 11:40pm
Subject:bk commit into 5.1 tree (tsmith:1.2605) BUG#31860
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tsmith. When tsmith 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@stripped, 2007-11-06 16:40:50-07:00, tsmith@stripped +6 -0
  Apply snapshot innodb-5.1-ss2034
  
  The following bugs are fixed:
  
  Bug #31860: Server crashes after inserting into InnoDB table with auto_increment column
    In the Bug 16979 fix there was an erroneous assertion that
    autoincrement columns can't contain negative values. With the fix, the
    autoincrement table counter is set to 0 if the maximum value read from
    the autoinc column index is negative.

  mysql-test/r/innodb.result@stripped, 2007-11-06 16:33:49-07:00, tsmith@stripped +16 -0
    Apply snapshot innodb-5.1-ss2034
    
    Revision r2034:
    Fix for Bug# 31860, in the Bug 16979 fix there was an erroneous assertion that
    autoincrement columns can't contain negative values. With the fix, the
    autoincrement table counter is set to 0 if the maximum value read from
    the autoinc column index is negative.
    
    Add test for the bug fix but the test is not really useful as the server
    needs to be restarted half way through the test. It has been added for 
    reference only.

  mysql-test/t/innodb.test@stripped, 2007-11-06 16:33:49-07:00, tsmith@stripped +19 -0
    Apply snapshot innodb-5.1-ss2034
    
    Revision r2034:
    Fix for Bug# 31860, in the Bug 16979 fix there was an erroneous assertion that
    autoincrement columns can't contain negative values. With the fix, the
    autoincrement table counter is set to 0 if the maximum value read from
    the autoinc column index is negative.
    
    Add test for the bug fix but the test is not really useful as the server
    needs to be restarted half way through the test. It has been added for 
    reference only.

  storage/innobase/handler/ha_innodb.cc@stripped, 2007-11-06 16:33:49-07:00, tsmith@stripped +15 -18
    Apply snapshot innodb-5.1-ss2034
    
    Revision r2017:
    Use "InnoDB:" prefix in error messages.
    
    
    Revision r2018:
    Remove ut_print_timestamp(), this should have been removed when the following
    changes were made by MySQL.
    
    	ChangeSet@stripped  2005-08-11 19:19:20+03:00  jani@stripped
    
    Fix error message so that it conforms to "  InnoDB: Error: ...".

  storage/innobase/include/univ.i@stripped, 2007-11-06 16:33:49-07:00, tsmith@stripped +8 -8
    Apply snapshot innodb-5.1-ss2034
    
    Revision r2015:
    UNIV_MEM_ASSERT_RW(), UNIV_MEM_ASSERT_W(): Remove warnings on 64-bit systems.

  storage/innobase/row/row0sel.c@stripped, 2007-11-06 16:33:49-07:00, tsmith@stripped +5 -2
    Apply snapshot innodb-5.1-ss2034
    
    Revision r2034:
    Fix for Bug# 31860, in the Bug 16979 fix there was an erroneous assertion that
    autoincrement columns can't contain negative values. With the fix, the
    autoincrement table counter is set to 0 if the maximum value read from
    the autoinc column index is negative.
    
    Add test for the bug fix but the test is not really useful as the server
    needs to be restarted half way through the test. It has been added for 
    reference only.

  storage/innobase/sync/sync0sync.c@stripped, 2007-11-06 16:33:49-07:00, tsmith@stripped +1 -1
    Apply snapshot innodb-5.1-ss2034
    
    Revision r2017:
    Use "InnoDB:" prefix in error messages.

diff -Nrup a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
--- a/mysql-test/r/innodb.result	2007-11-06 15:23:45 -07:00
+++ b/mysql-test/r/innodb.result	2007-11-06 16:33:49 -07:00
@@ -3152,6 +3152,22 @@ c25 CHAR(255), c26 CHAR(255), c27 CHAR(2
 c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
 ) ENGINE = InnoDB;
 ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note	1051	Unknown table 't1'
+CREATE TABLE t1(
+id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-10);
+SELECT * FROM t1;
+id
+-10
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+id
+-10
+1
+DROP TABLE t1;
 SET TX_ISOLATION='read-committed';
 SET AUTOCOMMIT=0;
 DROP TABLE IF EXISTS t1, t2;
diff -Nrup a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
--- a/mysql-test/t/innodb.test	2007-11-06 15:23:45 -07:00
+++ b/mysql-test/t/innodb.test	2007-11-06 16:33:49 -07:00
@@ -2290,6 +2290,25 @@ CREATE TABLE t1 (
 	c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
 	) ENGINE = InnoDB;
 
+#
+# Bug #31860 InnoDB assumes AUTOINC values can only be positive.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(
+	id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
+	) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-10);
+SELECT * FROM t1;
+#
+# NOTE: The server really needs to be restarted at this point
+# for the test to be useful.  
+#
+# Without the fix InnoDB would trip over an assertion here.
+INSERT INTO t1 VALUES(NULL);
+# The next value should be 1 and not -9 or a -ve number
+SELECT * FROM t1;
+DROP TABLE t1;
+
 # 
 # Bug #21409 Incorrect result returned when in READ-COMMITTED with
 # query_cache ON
diff -Nrup a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
--- a/storage/innobase/handler/ha_innodb.cc	2007-11-06 15:23:45 -07:00
+++ b/storage/innobase/handler/ha_innodb.cc	2007-11-06 16:33:49 -07:00
@@ -1144,7 +1144,6 @@ innobase_query_caching_of_table_permitte
 	}
 
 	if (trx->has_search_latch) {
-		ut_print_timestamp(stderr);
 		sql_print_error("The calling thread is holding the adaptive "
 				"search, latch though calling "
 				"innobase_query_caching_of_table_permitted.");
@@ -2322,7 +2321,6 @@ ha_innobase::open(
 	ib_table = dict_table_get(norm_name, TRUE);
 
 	if (NULL == ib_table) {
-		ut_print_timestamp(stderr);
 		sql_print_error("Cannot find or open table %s from\n"
 				"the internal data dictionary of InnoDB "
 				"though the .frm file for the\n"
@@ -2346,7 +2344,6 @@ ha_innobase::open(
 	}
 
 	if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) {
-		ut_print_timestamp(stderr);
 		sql_print_error("MySQL is trying to open a table handle but "
 				"the .ibd file for\ntable %s does not exist.\n"
 				"Have you deleted the .ibd file from the "
@@ -3420,7 +3417,7 @@ no_commit:
 			/*
 			ut_print_timestamp(stderr);
 			fprintf(stderr,
-				"  InnoDB error: ALTER TABLE is holding lock"
+				"  InnoDB: ALTER TABLE is holding lock"
 				" on %lu tables!\n",
 				prebuilt->trx->mysql_n_tables_locked);
 			*/
@@ -5723,7 +5720,6 @@ ha_innobase::info(
 
 		for (i = 0; i < table->s->keys; i++) {
 			if (index == NULL) {
-				ut_print_timestamp(stderr);
 				sql_print_error("Table %s contains fewer "
 						"indexes inside InnoDB than "
 						"are defined in the MySQL "
@@ -5739,7 +5735,6 @@ ha_innobase::info(
 			for (j = 0; j < table->key_info[i].key_parts; j++) {
 
 				if (j + 1 > index->n_uniq) {
-					ut_print_timestamp(stderr);
 					sql_print_error(
 "Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking "
 "statistics for %lu columns. Have you mixed up .frm files from different "
@@ -5804,7 +5799,6 @@ ha_innobase::info(
 			ret = innobase_read_and_init_auto_inc(&auto_inc);
 
 			if (ret != 0) {
-				ut_print_timestamp(stderr);
 				sql_print_error("Cannot get table %s auto-inc"
 						"counter value in ::info\n",
 						ib_table->name);
@@ -6578,14 +6572,17 @@ ha_innobase::transactional_table_lock(
 
 	if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
 		ut_print_timestamp(stderr);
-		fprintf(stderr, "  InnoDB error:\n"
-"MySQL is trying to use a table handle but the .ibd file for\n"
-"table %s does not exist.\n"
-"Have you deleted the .ibd file from the database directory under\n"
-"the MySQL datadir?"
-"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"how you can resolve the problem.\n",
-				prebuilt->table->name);
+		fprintf(stderr,
+			"  InnoDB: MySQL is trying to use a table handle"
+			" but the .ibd file for\n"
+			"InnoDB: table %s does not exist.\n"
+			"InnoDB: Have you deleted the .ibd file"
+			" from the database directory under\n"
+			"InnoDB: the MySQL datadir?"
+			"InnoDB: See"
+			" http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
+			"InnoDB: how you can resolve the problem.\n",
+			prebuilt->table->name);
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -7194,7 +7191,8 @@ ha_innobase::innobase_read_and_init_auto
 			++auto_inc;
 			dict_table_autoinc_initialize(innodb_table, auto_inc);
 		} else {
-			fprintf(stderr, " InnoDB error (%lu): Couldn't read "
+			ut_print_timestamp(stderr);
+			fprintf(stderr, "  InnoDB: Error: (%lu) Couldn't read "
 				"the max AUTOINC value from the index (%s).\n",
 				error, index->name);
 
@@ -7281,8 +7279,7 @@ ha_innobase::innobase_get_auto_increment
 		and can be ignored. */
 		} else if (error != DB_DEADLOCK) {
 
-			ut_print_timestamp(stderr);
-			sql_print_error(" InnoDB Error %lu in "
+			sql_print_error("InnoDB: Error: %lu in "
 					"::innobase_get_auto_increment()",
 					error);
 		}
diff -Nrup a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
--- a/storage/innobase/include/univ.i	2007-11-06 15:23:46 -07:00
+++ b/storage/innobase/include/univ.i	2007-11-06 16:33:49 -07:00
@@ -309,22 +309,22 @@ typedef void* os_thread_ret_t;
 # define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
 # define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
 # define UNIV_MEM_ASSERT_RW(addr, size) do {				\
-	const void* _p = (const void*)					\
+	const void* _p = (const void*) (ulint)				\
 		VALGRIND_CHECK_MEM_IS_DEFINED(addr, size);		\
 	if (UNIV_LIKELY_NULL(_p))					\
-		fprintf(stderr, "%s:%d: %p[%u] undefined at %d\n",	\
+		fprintf(stderr, "%s:%d: %p[%u] undefined at %ld\n",	\
 			__FILE__, __LINE__,				\
-			(const void*) (addr), (unsigned) (size),	\
-			((const char*) _p) - ((const char*) (addr)));	\
+			(const void*) (addr), (unsigned) (size), (long)	\
+			(((const char*) _p) - ((const char*) (addr))));	\
 	} while (0)
 # define UNIV_MEM_ASSERT_W(addr, size) do {				\
-	const void* _p = (const void*)					\
+	const void* _p = (const void*) (ulint)				\
 		VALGRIND_CHECK_MEM_IS_ADDRESSABLE(addr, size);		\
 	if (UNIV_LIKELY_NULL(_p))					\
-		fprintf(stderr, "%s:%d: %p[%u] unwritable at %d\n",	\
+		fprintf(stderr, "%s:%d: %p[%u] unwritable at %ld\n",	\
 			__FILE__, __LINE__,				\
-			(const void*) (addr), (unsigned) (size),	\
-			((const char*) _p) - ((const char*) (addr)));	\
+			(const void*) (addr), (unsigned) (size), (long)	\
+			(((const char*) _p) - ((const char*) (addr))));	\
 	} while (0)
 #else
 # define UNIV_MEM_VALID(addr, size) do {} while(0)
diff -Nrup a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
--- a/storage/innobase/row/row0sel.c	2007-11-06 15:23:46 -07:00
+++ b/storage/innobase/row/row0sel.c	2007-11-06 16:33:49 -07:00
@@ -4526,7 +4526,8 @@ row_search_check_if_query_cache_permitte
 }
 
 /***********************************************************************
-Read the AUTOINC column from the current row. */
+Read the AUTOINC column from the current row. If the value is less than
+0 and the type is not unsigned then we reset the value to 0. */
 static
 ib_longlong
 row_search_autoinc_read_column(
@@ -4594,7 +4595,9 @@ row_search_autoinc_read_column(
 		mem_heap_free(heap);
 	}
 
-	ut_a(value >= 0);
+	if (!unsigned_type && value < 0) {
+		value = 0;
+	}
 
 	return(value);
 }
diff -Nrup a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
--- a/storage/innobase/sync/sync0sync.c	2007-07-24 19:27:13 -06:00
+++ b/storage/innobase/sync/sync0sync.c	2007-11-06 16:33:49 -07:00
@@ -830,7 +830,7 @@ sync_thread_levels_g(
 				mutex = slot->latch;
 
 				fprintf(stderr,
-					"InnoDB error: sync levels should be"
+					"InnoDB: sync levels should be"
 					" > %lu but a level is %lu\n",
 					(ulong) limit, (ulong) slot->level);
 
Thread
bk commit into 5.1 tree (tsmith:1.2605) BUG#31860tim7 Nov