summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <aivanov@mysql.com>2006-01-31 21:41:48 +0300
committerunknown <aivanov@mysql.com>2006-01-31 21:41:48 +0300
commit6a9a96dc61613ba16e7f87e3681709c2f0e8f580 (patch)
tree9e475e84c7ce72ff8bc4402d9ee012a703984545 /sql/ha_innodb.cc
parent107ad3a03e2b76da117bc05624e807d9936fe73f (diff)
downloadmariadb-git-6a9a96dc61613ba16e7f87e3681709c2f0e8f580.tar.gz
Fixed: BUG#15653, BUG#16157, BUG#16229, BUG#16298, BUG#16387, BUG#16582.
Applied innodb-5.0-ss149/162 snapshots. innobase/btr/btr0sea.c: Applied innodb-5.0-149/162 snapshots. Account for a race condition when dropping the adaptive hash index for a B-tree page (Bug #16582). btr_search_drop_page_hash_index(): Retry the operation if a hash index with different parameters was built meanwhile. Add diagnostics for the case that hash node pointers to the page remain. This fix is from Heikki. btr_search_info-update_hash(), btr_search_info_update_slow(): Document the parameter "info" as in/out. innobase/dict/dict0dict.c: Applied innodb-5.0-149/162 snapshots. Do not mistake TABLENAME_ibfk_0 for auto generated id (Bug #16387). dict_table_get_highest_foreign_id(): Ignore foreign constraint identifiers starting with the pattern TABLENAME_ibfk_0. innobase/dict/dict0load.c: Applied innodb-5.0-149/162 snapshots. dict_load_columns(): Set the charset-collation code DATA_MYSQL_BINARY_CHARSET_COLL for those binary string columns that lack a charset-collation code, i.e., the tables were created with an older version of MySQL/InnoDB than 4.1.2 (Bug #16298). innobase/fil/fil0fil.c: Applied innodb-5.0-149/162 snapshots. Keep track on unflushed modifications to file spaces. When there are tens of thousands of file spaces, flushing all files in fil_flush_file_spaces() would be very slow (Bug #15653). fil_flush_file_spaces(): Only flush unflushed file spaces. fil_space_t, fil_system_t: Add a list of unflushed spaces. innobase/include/univ.i: Applied innodb-5.0-149/162 snapshots. Avoid breaking --with-debug builds on QNS and other systems whose compiler pretends to be GCC 2. Outside __WIN__ define UNIV_INLINE as static inline. innobase/os/os0sync.c: Applied innodb-5.0-149/162 snapshots. Replace goto in os_event_wait with a normal loop. innobase/srv/srv0start.c: Applied innodb-5.0-149/162 snapshots. Fix bug #16157, a crash when innodb_log_group_home_dir is set to an empty string. This patch is from Heikki. mysql-test/r/innodb.result: Applied innodb-5.0-149/162 snapshots. Fixed results for added test cases. mysql-test/t/innodb.test: Applied innodb-5.0-149/162 snapshots. Added test cases. sql/ha_innodb.cc: Applied innodb-5.0-149/162 snapshots. Remove some declarations of unused global variables and member variables of class ha_innobase. Added diagnostic code trx_print() to innobase_query_caching_of_table_permitted() to find reason why we are holding adaptive search latch. Fixed bug #16229 MySQL/InnoDB uses full explicit table locks in trigger processing. Take a InnoDB table lock only if user has explicitly requested a table lock. Added some additional comments to store_lock() and external_lock(). Fixed some code style errors. Remember to use noninlined versions of the functions on ha_innodb.cc ! sql/ha_innodb.h: Applied innodb-5.0-149/162 snapshots. Remove some declarations of unused global variables and member variables of class ha_innobase.
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc59
1 files changed, 36 insertions, 23 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index b33d2dfbd97..1b1326920ad 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -138,8 +138,6 @@ extern "C" {
#define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */
#define HA_INNOBASE_RANGE_COUNT 100
-uint innobase_init_flags = 0;
-ulong innobase_cache_size = 0;
ulong innobase_large_page_size = 0;
/* The default values for the following, type long or longlong, start-up
@@ -187,8 +185,6 @@ it every INNOBASE_WAKE_INTERVAL'th step. */
#define INNOBASE_WAKE_INTERVAL 32
ulong innobase_active_counter = 0;
-char* innobase_home = NULL;
-
static HASH innobase_open_tables;
#ifdef __NETWARE__ /* some special cleanup for NetWare */
@@ -814,7 +810,6 @@ ha_innobase::ha_innobase(TABLE *table_arg)
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_CAN_GEOMETRY |
HA_TABLE_SCAN_ON_INDEX),
- last_dup_key((uint) -1),
start_of_scan(0),
num_write_row(0)
{}
@@ -983,6 +978,11 @@ innobase_query_caching_of_table_permitted(
sql_print_error("The calling thread is holding the adaptive "
"search, latch though calling "
"innobase_query_caching_of_table_permitted.");
+
+ mutex_enter_noninline(&kernel_mutex);
+ trx_print(stderr, trx, 1024);
+ mutex_exit_noninline(&kernel_mutex);
+ ut_error;
}
innobase_release_stat_resources(trx);
@@ -6329,14 +6329,17 @@ ha_innobase::external_lock(
TABLES if AUTOCOMMIT=1. It does not make much sense to acquire
an InnoDB table lock if it is released immediately at the end
of LOCK TABLES, and InnoDB's table locks in that case cause
- VERY easily deadlocks. We do not set InnoDB table locks when
- MySQL sets them at the start of a stored procedure call
- (MySQL does have thd->in_lock_tables TRUE there). */
+ VERY easily deadlocks.
+
+ We do not set InnoDB table locks if user has not explicitly
+ requested a table lock. Note that thd->in_lock_tables
+ can be TRUE on some cases e.g. at the start of a stored
+ procedure call (SQLCOM_CALL). */
if (prebuilt->select_lock_type != LOCK_NONE) {
if (thd->in_lock_tables &&
- thd->lex->sql_command != SQLCOM_CALL &&
+ thd->lex->sql_command == SQLCOM_LOCK_TABLES &&
thd->variables.innodb_table_locks &&
(thd->options & OPTION_NOT_AUTOCOMMIT)) {
@@ -6838,7 +6841,7 @@ ha_innobase::store_lock(
} else if (lock_type != TL_IGNORE) {
- /* We set possible LOCK_X value in external_lock, not yet
+ /* We set possible LOCK_X value in external_lock, not yet
here even if this would be SELECT ... FOR UPDATE */
prebuilt->select_lock_type = LOCK_NONE;
@@ -6847,7 +6850,7 @@ ha_innobase::store_lock(
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
- /* Starting from 5.0.7, we weaken also the table locks
+ /* Starting from 5.0.7, we weaken also the table locks
set at the start of a MySQL stored procedure call, just like
we weaken the locks set at the start of an SQL statement.
MySQL does set thd->in_lock_tables TRUE there, but in reality
@@ -6870,26 +6873,36 @@ ha_innobase::store_lock(
lock_type = TL_READ_NO_INSERT;
}
- /* If we are not doing a LOCK TABLE or DISCARD/IMPORT
- TABLESPACE or TRUNCATE TABLE, then allow multiple writers */
+ /* If we are not doing a LOCK TABLE, DISCARD/IMPORT
+ TABLESPACE or TRUNCATE TABLE then allow multiple
+ writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
+ < TL_WRITE_CONCURRENT_INSERT.
- if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
- lock_type <= TL_WRITE)
+ We especially allow multiple writers if MySQL is at the
+ start of a stored procedure call (SQLCOM_CALL)
+ (MySQL does have thd->in_lock_tables TRUE there). */
+
+ if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
+ && lock_type <= TL_WRITE)
&& (!thd->in_lock_tables
- || thd->lex->sql_command == SQLCOM_CALL)
+ || thd->lex->sql_command == SQLCOM_CALL)
&& !thd->tablespace_op
&& thd->lex->sql_command != SQLCOM_TRUNCATE
- && thd->lex->sql_command != SQLCOM_OPTIMIZE
- && thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
+ && thd->lex->sql_command != SQLCOM_OPTIMIZE
+ && thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
- lock_type = TL_WRITE_ALLOW_WRITE;
+ lock_type = TL_WRITE_ALLOW_WRITE;
}
/* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
to t2. Convert the lock to a normal read lock to allow
- concurrent inserts to t2. */
+ concurrent inserts to t2.
+
+ We especially allow concurrent inserts if MySQL is at the
+ start of a stored procedure call (SQLCOM_CALL)
+ (MySQL does have thd->in_lock_tables TRUE there). */
if (lock_type == TL_READ_NO_INSERT
&& (!thd->in_lock_tables
@@ -6898,10 +6911,10 @@ ha_innobase::store_lock(
lock_type = TL_READ;
}
- lock.type = lock_type;
- }
+ lock.type = lock_type;
+ }
- *to++= &lock;
+ *to++= &lock;
return(to);
}