List:Commits« Previous MessageNext Message »
From:vasil.dimov Date:June 18 2012 6:42am
Subject:bzr push into mysql-trunk branch (vasil.dimov:4026 to 4028)
View as plain text  
 4028 Vasil Dimov	2012-06-15
      Extend the check on sanity of mysql.innodb_table_stats and
      mysql.innodb_index_stats wrt the number of FKs there are pointing to
      and out of each of the two tables.
      
      If there is a FK between those two tables, InnoDB may assert.

    modified:
      storage/innobase/dict/dict0dict.cc
      storage/innobase/dict/dict0stats.cc
      storage/innobase/include/dict0dict.h
 4027 Vasil Dimov	2012-06-15
      Remove unused struct dict_stats_struct

    modified:
      storage/innobase/dict/dict0stats.cc
 4026 Sunny Bains	2012-06-18
      Bug#14139728 - STLPORT NAME CLASH WITH MUTEX_T
      
      Rename mutex_struct to ib_mutex_t. Get rid of the #define from mutex_t to
      ib_mutex_t.
      
      rb://1100 Approved by Marko Makela

    modified:
      storage/innobase/buf/buf0buddy.cc
      storage/innobase/buf/buf0buf.cc
      storage/innobase/buf/buf0flu.cc
      storage/innobase/buf/buf0lru.cc
      storage/innobase/dict/dict0dict.cc
      storage/innobase/dict/dict0stats_background.cc
      storage/innobase/fil/fil0fil.cc
      storage/innobase/fts/fts0fts.cc
      storage/innobase/ha/hash0hash.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/ibuf/ibuf0ibuf.cc
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
      storage/innobase/include/buf0dblwr.h
      storage/innobase/include/dict0dict.h
      storage/innobase/include/dict0mem.h
      storage/innobase/include/fts0fts.h
      storage/innobase/include/fts0types.h
      storage/innobase/include/hash0hash.h
      storage/innobase/include/hash0hash.ic
      storage/innobase/include/lock0lock.h
      storage/innobase/include/log0log.h
      storage/innobase/include/log0recv.h
      storage/innobase/include/mem0dbg.h
      storage/innobase/include/os0sync.h
      storage/innobase/include/que0que.h
      storage/innobase/include/srv0mon.h
      storage/innobase/include/srv0srv.h
      storage/innobase/include/sync0rw.h
      storage/innobase/include/sync0rw.ic
      storage/innobase/include/sync0sync.h
      storage/innobase/include/sync0sync.ic
      storage/innobase/include/sync0types.h
      storage/innobase/include/trx0purge.h
      storage/innobase/include/trx0rseg.h
      storage/innobase/include/trx0sys.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/ut0wqueue.h
      storage/innobase/mem/mem0dbg.cc
      storage/innobase/mem/mem0pool.cc
      storage/innobase/os/os0file.cc
      storage/innobase/os/os0sync.cc
      storage/innobase/row/row0log.cc
      storage/innobase/row/row0mysql.cc
      storage/innobase/srv/srv0mon.cc
      storage/innobase/srv/srv0srv.cc
      storage/innobase/sync/sync0arr.cc
      storage/innobase/sync/sync0rw.cc
      storage/innobase/sync/sync0sync.cc
      storage/innobase/trx/trx0i_s.cc
      storage/innobase/trx/trx0sys.cc
=== modified file 'storage/innobase/dict/dict0dict.cc'
--- a/storage/innobase/dict/dict0dict.cc	revid:sunny.bains@stripped
+++ b/storage/innobase/dict/dict0dict.cc	revid:vasil.dimov@stripped
@@ -5893,6 +5893,30 @@ dict_table_schema_check(
 		}
 	}
 
+	if (req_schema->n_foreign != UT_LIST_GET_LEN(table->foreign_list)) {
+		ut_snprintf(
+			errstr, errstr_sz,
+			"Table %s has %lu foreign key(s) pointing to other "
+			"tables, but it must have %lu.",
+			ut_format_name(req_schema->table_name,
+				       TRUE, buf, sizeof(buf)),
+			UT_LIST_GET_LEN(table->foreign_list),
+			req_schema->n_foreign);
+		return(DB_ERROR);
+	}
+
+	if (req_schema->n_referenced != UT_LIST_GET_LEN(table->referenced_list)) {
+		ut_snprintf(
+			errstr, errstr_sz,
+			"There are %lu foreign key(s) pointing to %s, "
+			"but there must be %lu.",
+			UT_LIST_GET_LEN(table->referenced_list),
+			ut_format_name(req_schema->table_name,
+				       TRUE, buf, sizeof(buf)),
+			req_schema->n_referenced);
+		return(DB_ERROR);
+	}
+
 	return(DB_SUCCESS);
 }
 /* @} */

=== modified file 'storage/innobase/dict/dict0stats.cc'
--- a/storage/innobase/dict/dict0stats.cc	revid:sunny.bains@stripped
+++ b/storage/innobase/dict/dict0stats.cc	revid:vasil.dimov@stripped
@@ -134,13 +134,6 @@ descending to lower levels and fetch N_S
 from that level */
 #define N_DIFF_REQUIRED(index)	(N_SAMPLE_PAGES(index) * 10)
 
-/** Open handles on the stats tables. Currently this is used to increase the
-reference count of the stats tables. */
-typedef struct dict_stats_struct {
-	dict_table_t*	table_stats;	/*!< Handle to open TABLE_STATS_NAME */
-	dict_table_t*	index_stats;	/*!< Handle to open INDEX_STATS_NAME */
-} dict_stats_t;
-
 /*********************************************************************//**
 Checks whether the persistent statistics storage exists and that all
 tables have the proper structure.
@@ -176,7 +169,9 @@ dict_stats_persistent_storage_check(
 	dict_table_schema_t	table_stats_schema = {
 		TABLE_STATS_NAME,
 		UT_ARR_SIZE(table_stats_columns),
-		table_stats_columns
+		table_stats_columns,
+		0 /* n_foreign */,
+		0 /* n_referenced */
 	};
 
 	/* definition for the table INDEX_STATS_NAME */
@@ -208,7 +203,9 @@ dict_stats_persistent_storage_check(
 	dict_table_schema_t	index_stats_schema = {
 		INDEX_STATS_NAME,
 		UT_ARR_SIZE(index_stats_columns),
-		index_stats_columns
+		index_stats_columns,
+		0 /* n_foreign */,
+		0 /* n_referenced */
 	};
 
 	char		errstr[512];

=== modified file 'storage/innobase/include/dict0dict.h'
--- a/storage/innobase/include/dict0dict.h	revid:sunny.bains@stripped
+++ b/storage/innobase/include/dict0dict.h	revid:vasil.dimov@stripped
@@ -1619,6 +1619,14 @@ struct dict_table_schema_struct {
 	dict_col_meta_t*	columns;	/* metadata for the columns;
 						this array has n_cols
 						elements */
+	ulint			n_foreign;	/* number of foreign keys this
+						table has, pointing to other
+						tables (where this table is
+						FK child) */
+	ulint			n_referenced;	/* number of foreign keys other
+						tables have, pointing to this
+						table (where this table is
+						parent) */
 };
 typedef struct dict_table_schema_struct dict_table_schema_t;
 /* @} */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (vasil.dimov:4026 to 4028) vasil.dimov18 Jun