3494 Marc Alff 2012-04-10 [merge]
Merge mysql-trunk --> mysql-trunk-pfs-tuning
removed:
mysql-test/suite/rpl/t/rpl_report_port-slave.opt
modified:
libmysqld/lib_sql.cc
mysql-test/suite/rpl/r/rpl_corruption.result
mysql-test/suite/rpl/r/rpl_master_pos_wait.result
mysql-test/suite/rpl/r/rpl_report_port.result
mysql-test/suite/rpl/t/rpl_corruption.test
mysql-test/suite/rpl/t/rpl_master_pos_wait.test
mysql-test/suite/rpl/t/rpl_report_port.test
mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test
storage/innobase/dict/dict0boot.cc
storage/innobase/dict/dict0crea.cc
storage/innobase/dict/dict0load.cc
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/i_s.cc
storage/innobase/include/dict0boot.h
storage/innobase/include/dict0crea.h
storage/innobase/include/dict0load.h
storage/innobase/os/os0file.cc
3493 Marc Alff 2012-04-06 [merge]
Merge mysql-trunk --> mysql-trunk-pfs-tuning
modified:
mysql-test/collections/default.push
mysql-test/mysql-test-run.pl
mysql-test/suite/perfschema/include/digest_cleanup.inc
mysql-test/suite/perfschema/include/digest_execution.inc
mysql-test/suite/perfschema/include/digest_setup.inc
mysql-test/suite/perfschema/r/digest_table_full.result
mysql-test/suite/perfschema/r/start_server_no_digests.result
mysql-test/suite/perfschema/r/statement_digest.result
mysql-test/suite/perfschema/r/statement_digest_consumers.result
mysql-test/suite/perfschema/r/statement_digest_consumers2.result
storage/innobase/include/ut0vec.ic
storage/perfschema/pfs_digest.cc
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2012-03-13 13:16:27 +0000
+++ b/libmysqld/lib_sql.cc 2012-04-06 18:58:01 +0000
@@ -349,6 +349,8 @@ static int emb_stmt_execute(MYSQL_STMT *
set_stmt_errmsg(stmt, net);
DBUG_RETURN(1);
}
+ else if (stmt->mysql->status == MYSQL_STATUS_GET_RESULT)
+ stmt->mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT;
DBUG_RETURN(0);
}
=== modified file 'mysql-test/suite/rpl/r/rpl_corruption.result'
--- a/mysql-test/suite/rpl/r/rpl_corruption.result 2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result 2012-04-09 11:08:46 +0000
@@ -26,13 +26,13 @@ include/wait_for_slave_io_error.inc [err
SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug="d,corrupt_read_log_event";
START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1721]
+include/wait_for_slave_io_error.inc [errno=1595,1741]
SET GLOBAL debug="";
SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network
SET GLOBAL debug="d,corrupt_queue_event";
START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1721]
+include/wait_for_slave_io_error.inc [errno=1595,1741]
# 6. Slave. Corruption in relay log
SET GLOBAL debug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD;
=== modified file 'mysql-test/suite/rpl/r/rpl_master_pos_wait.result'
--- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result 2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result 2012-04-09 22:45:19 +0000
@@ -35,8 +35,8 @@ SQL_THREAD_WAIT_AFTER_GTIDS('', 2)
0
SELECT SQL_THREAD_WAIT_AFTER_GTIDS('error-gtid', 2);
ERROR HY000: Malformed GTID set specification 'error-gtid'.
-SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 2);
+SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 0);
STOP SLAVE SQL_THREAD;
-SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 2)
+SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 0)
NULL
include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/r/rpl_report_port.result'
--- a/mysql-test/suite/rpl/r/rpl_report_port.result 2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_report_port.result 2012-04-10 06:03:57 +0000
@@ -3,9 +3,12 @@ Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
[connection master]
-include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
include/start_slave.inc
[Slave restarted with the report-port set to some value]
include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.]
+include/rpl_restart_server.inc [server_number=2 parameters: --report-port=]
+include/start_slave.inc
+[Slave restarted with the report-port set to the value of slave's port number]
+include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/t/rpl_corruption.test'
--- a/mysql-test/suite/rpl/t/rpl_corruption.test 2012-03-06 22:52:58 +0000
+++ b/mysql-test/suite/rpl/t/rpl_corruption.test 2012-04-09 11:08:46 +0000
@@ -80,7 +80,7 @@ reap;
SET GLOBAL debug="d,corrupt_read_log_event";
--connection slave
START SLAVE IO_THREAD;
-let $slave_io_errno= 1236;
+let $slave_io_errno= 1236; # ER_MASTER_FATAL_ERROR_READING_BINLOG
--source include/wait_for_slave_io_error.inc
--connection master
@@ -91,7 +91,7 @@ SET GLOBAL master_verify_checksum=0;
SET GLOBAL debug="d,corrupt_read_log_event";
--connection slave
START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1721;
+let $slave_io_errno= 1595,1741; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc
--connection master
SET GLOBAL debug="";
@@ -102,14 +102,14 @@ SET GLOBAL master_verify_checksum=1;
--connection slave
SET GLOBAL debug="d,corrupt_queue_event";
START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1721;
+let $slave_io_errno= 1595,1741; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc
# Emulate corruption in relay log
--echo # 6. Slave. Corruption in relay log
SET GLOBAL debug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD;
-let $slave_sql_errno= 1593;
+let $slave_sql_errno= 1593; # ER_SLAVE_FATAL_ERROR
--source include/wait_for_slave_sql_error.inc
# Start normal replication and compare same table on master
=== modified file 'mysql-test/suite/rpl/t/rpl_master_pos_wait.test'
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test 2012-02-14 07:55:14 +0000
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test 2012-04-09 22:45:19 +0000
@@ -53,7 +53,7 @@ SELECT SQL_THREAD_WAIT_AFTER_GTIDS('erro
# SQL_THREAD_WAIT_AFTER_GTIDS: Check if it hangs when slave is
# idle and STOP SLAVE is issued.
#
-send SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 2);
+send SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 0);
--connection slave1
STOP SLAVE SQL_THREAD;
--connection slave
=== removed file 'mysql-test/suite/rpl/t/rpl_report_port-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_report_port-slave.opt 2012-02-28 08:32:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_report_port-slave.opt 1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---report-port=
=== modified file 'mysql-test/suite/rpl/t/rpl_report_port.test'
--- a/mysql-test/suite/rpl/t/rpl_report_port.test 2012-03-09 02:37:16 +0000
+++ b/mysql-test/suite/rpl/t/rpl_report_port.test 2012-04-10 06:02:27 +0000
@@ -10,22 +10,18 @@
#
#====Method====
#
-# Start replication with report port not set.This will give the actual port
-# number of the slave (ie. SLAVE_PORT) for the on doing SHOW SLAVE HOSTS on
-# the master.
-# Restart the slave server with report port set to 9000 and start the slave.
+# Start replication with report port set to 9000 and restart the slave.
# In this case on doing SHOW SLAVE HOSTS on the master, we get the port number
# of the slave to be 9000.
+# In the second case restart the slave server with report port not set. In this
+# case on doing SHOW SLAVE HOSTS on the master, we get the actual port number
+# of the slave (ie. SLAVE_PORT).
source include/master-slave.inc;
+source include/have_binlog_format_mixed.inc;
connection master;
---let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
---let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
---let assert_cond= $report_port = "$SLAVE_MYPORT"
---source include/assert.inc
-
# Start the server with some value being passed to the report_port= <option>
# this will be used incase we have to mask the value of the slave's port
# number in certain situations.
@@ -46,4 +42,25 @@ connection master;
--let assert_cond= $report_port = "9000"
--source include/assert.inc
+
+# Start the server with the report-port being passed with no value. So on SHOW SLAVE HOSTS
+# on the master the value of slave's port should be the actual value of the slave port.
+
+--let $rpl_server_number= 2
+--let $rpl_server_parameters= --report-port=
+--source include/rpl_restart_server.inc
+
+connection slave;
+--source include/start_slave.inc
+
+--echo [Slave restarted with the report-port set to the value of slave's port number]
+
+connection master;
+
+# The value reported is the actual value of the slave's port.
+--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
+--let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
+--let assert_cond= $report_port = "$SLAVE_MYPORT"
+--source include/assert.inc
+
--source include/rpl_end.inc
=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test 2012-02-09 16:24:17 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test 2012-04-06 12:42:28 +0000
@@ -3,6 +3,10 @@
#
-- source include/have_innodb.inc
+# --force-restart from
+# mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic-master.opt
+# does not seem to work on Windows (test being executed without a restart)
+-- source include/not_windows.inc
# Check the default value and save for later restoration
SET @orig = @@global.innodb_buffer_pool_filename;
=== modified file 'storage/innobase/dict/dict0boot.cc'
--- a/storage/innobase/dict/dict0boot.cc 2012-02-28 04:24:24 +0000
+++ b/storage/innobase/dict/dict0boot.cc 2012-04-06 15:40:06 +0000
@@ -476,7 +476,7 @@ dict_insert_initial_data(void)
}
/*****************************************************************//**
-Creates and initializes the data dictionary at the database creation. */
+Creates and initializes the data dictionary at the server bootstrap. */
UNIV_INTERN
void
dict_create(void)
=== modified file 'storage/innobase/dict/dict0crea.cc'
--- a/storage/innobase/dict/dict0crea.cc 2012-02-17 10:19:45 +0000
+++ b/storage/innobase/dict/dict0crea.cc 2012-04-06 15:40:06 +0000
@@ -1272,7 +1272,7 @@ dict_create_or_check_foreign_constraint_
trx_t* trx;
ulint error;
ibool success;
- ibool srv_file_per_table_backup;
+ my_bool srv_file_per_table_backup;
ut_a(srv_get_active_thread_type() == SRV_NONE);
@@ -1318,7 +1318,7 @@ dict_create_or_check_foreign_constraint_
VARBINARY, like in other InnoDB system tables, to get a clean
design. */
- srv_file_per_table_backup = (ibool) srv_file_per_table;
+ srv_file_per_table_backup = srv_file_per_table;
/* We always want SYSTEM tables to be created inside the system
tablespace. */
@@ -1382,7 +1382,7 @@ dict_create_or_check_foreign_constraint_
success = dict_check_sys_foreign_tables_exist();
ut_a(success);
- srv_file_per_table = (my_bool) srv_file_per_table_backup;
+ srv_file_per_table = srv_file_per_table_backup;
return(error);
}
=== modified file 'storage/innobase/dict/dict0load.cc'
--- a/storage/innobase/dict/dict0load.cc 2012-03-08 14:22:07 +0000
+++ b/storage/innobase/dict/dict0load.cc 2012-04-06 15:40:06 +0000
@@ -46,7 +46,8 @@ Created 4/24/1996 Heikki Tuuri
#include "fts0priv.h"
-/** Following are six InnoDB system tables */
+/** Following are the InnoDB system tables. The positions in
+this array are referenced by enum dict_system_table_id. */
static const char* SYSTEM_TABLE_NAME[] = {
"SYS_TABLES",
"SYS_INDEXES",
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2012-04-02 08:25:26 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2012-04-09 15:38:48 +0000
@@ -2343,7 +2343,7 @@ innobase_invalidate_query_cache(
/* Argument TRUE below means we are using transactions */
#ifdef HAVE_QUERY_CACHE
- mysql_query_cache_invalidate4((THD*) trx->mysql_thd,
+ mysql_query_cache_invalidate4(static_cast<THD*>(trx->mysql_thd),
full_name,
(uint32) full_name_len,
TRUE);
@@ -2527,7 +2527,8 @@ trx_is_interrupted(
/*===============*/
trx_t* trx) /*!< in: transaction */
{
- return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd));
+ return(trx && trx->mysql_thd
+ && thd_killed(static_cast<THD*>(trx->mysql_thd)));
}
/**********************************************************************//**
@@ -2540,7 +2541,7 @@ trx_is_strict(
trx_t* trx) /*!< in: transaction */
{
return(trx && trx->mysql_thd
- && THDVAR((THD*) trx->mysql_thd, strict_mode));
+ && THDVAR(static_cast<THD*>(trx->mysql_thd), strict_mode));
}
/**************************************************************//**
@@ -3825,32 +3826,35 @@ ha_innobase::primary_key_is_clustered()
/** Always normalize table name to lower case on Windows */
#ifdef __WIN__
-#define normalize_table_name(norm_name, name) \
- normalize_table_name_low(norm_name, name, TRUE)
+#define normalize_table_name(name) \
+ normalize_table_name_low(name, TRUE)
#else
-#define normalize_table_name(norm_name, name) \
- normalize_table_name_low(norm_name, name, FALSE)
+#define normalize_table_name(name) \
+ normalize_table_name_low(name, FALSE)
#endif /* __WIN__ */
/*****************************************************************//**
Normalizes a table name string. A normalized name consists of the
-database name catenated to '/' and table name. An example:
-test/mytable. On Windows normalization puts both the database name and the
-table name always to lower case if "set_lower_case" is set to TRUE. */
+database name catenated to '/' and table name. An example: test/mytable.
+On Windows normalization puts both the database name and the
+table name always to lower case if "set_lower_case" is set to TRUE.
+Memory for norm_name is allocated here and must be freed by the caller.
+@return normalized name as a null-terminated string*/
static
-void
+char*
normalize_table_name_low(
/*=====================*/
- char* norm_name, /*!< out: normalized name as a
- null-terminated string */
const char* name, /*!< in: table name string */
ibool set_lower_case) /*!< in: TRUE if we want to set name
to lower case */
{
+ char* norm_name;
char* name_ptr;
+ ulint name_len;
char* db_ptr;
ulint db_len;
char* ptr;
+ ulint norm_len;
/* Scan name from the end */
@@ -3862,6 +3866,7 @@ normalize_table_name_low(
}
name_ptr = ptr + 1;
+ name_len = strlen(name_ptr);
/* skip any number of path separators */
while (ptr >= name && (*ptr == '\\' || *ptr == '/')) {
@@ -3880,15 +3885,21 @@ normalize_table_name_low(
db_ptr = ptr + 1;
+ norm_len = db_len + name_len + sizeof "/";
+ norm_name = static_cast<char*>(mem_alloc(norm_len));
+
memcpy(norm_name, db_ptr, db_len);
norm_name[db_len] = '/';
- memcpy(norm_name + db_len + 1, name_ptr, strlen(name_ptr) + 1);
+ /* Copy the name and null-byte. */
+ memcpy(norm_name + db_len + 1, name_ptr, name_len + 1);
if (set_lower_case) {
innobase_casedn_str(norm_name);
}
+
+ return(norm_name);
}
#if !defined(DBUG_OFF)
@@ -3899,7 +3910,7 @@ void
test_normalize_table_name_low()
/*===========================*/
{
- char norm_name[128];
+ char* norm_name;
const char* test_data[][2] = {
/* input, expected result */
{"./mysqltest/t1", "mysqltest/t1"},
@@ -3945,7 +3956,7 @@ test_normalize_table_name_low()
"testing \"%s\", expected \"%s\"... ",
test_data[i][0], test_data[i][1]);
- normalize_table_name_low(norm_name, test_data[i][0], FALSE);
+ norm_name = normalize_table_name_low(test_data[i][0], FALSE);
if (strcmp(norm_name, test_data[i][1]) == 0) {
printf("ok\n");
@@ -3953,6 +3964,8 @@ test_normalize_table_name_low()
printf("got \"%s\"\n", norm_name);
ut_error;
}
+
+ mem_free(norm_name);
}
}
#endif /* !DBUG_OFF */
@@ -4354,12 +4367,11 @@ ha_innobase::open(
uint test_if_locked) /*!< in: not used */
{
dict_table_t* ib_table;
- char norm_name[1000];
+ char* norm_name;
THD* thd;
ulint retries = 0;
char* is_part = NULL;
- ibool par_case_name_set = FALSE;
- char par_case_name[MAX_FULL_NAME_LEN + 1];
+ char* par_case_name = NULL;
DBUG_ENTER("ha_innobase::open");
@@ -4375,8 +4387,6 @@ ha_innobase::open(
innobase_release_temporary_latches(ht, thd);
}
- normalize_table_name(norm_name, name);
-
user_thd = NULL;
if (!(share=get_share())) {
@@ -4384,6 +4394,8 @@ ha_innobase::open(
DBUG_RETURN(1);
}
+ norm_name = normalize_table_name(name);
+
/* Will be allocated if it is needed in ::update_row() */
upd_buf = NULL;
upd_buf_size = 0;
@@ -4424,24 +4436,22 @@ retry:
case them in the system table. */
if (innobase_get_lower_case_table_names() == 1) {
- if (!par_case_name_set) {
+ if (par_case_name == NULL) {
#ifndef __WIN__
/* Check for the table using lower
case name, including the partition
separator "P" */
- memcpy(par_case_name, norm_name,
- strlen(norm_name));
- par_case_name[strlen(norm_name)] = 0;
+ par_case_name = mem_strdup(norm_name);
innobase_casedn_str(par_case_name);
#else
/* On Windows platfrom, check
whether there exists table name in
system table whose name is
not being normalized to lower case */
- normalize_table_name_low(
- par_case_name, name, FALSE);
+ par_case_name =
+ normalize_table_name_low(
+ name, FALSE);
#endif
- par_case_name_set = TRUE;
}
ib_table = dict_table_open_on_name(
@@ -4499,12 +4509,20 @@ retry:
"how you can resolve the problem.\n",
norm_name);
my_errno = ENOENT;
+ mem_free(norm_name);
+ if (par_case_name) {
+ mem_free(par_case_name);
+ }
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
table_opened:
+ if (par_case_name) {
+ mem_free(par_case_name);
+ }
+
MONITOR_INC(MONITOR_TABLE_OPEN);
if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) {
@@ -4519,6 +4537,8 @@ table_opened:
my_errno = ENOENT;
dict_table_close(ib_table, FALSE, FALSE);
+ mem_free(norm_name);
+
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
@@ -4683,6 +4703,8 @@ table_opened:
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
+ mem_free(norm_name);
+
DBUG_RETURN(0);
}
@@ -7954,7 +7976,7 @@ create_table_check_doc_id_col(
*doc_id_col = i;
} else {
push_warning_printf(
- (THD*) trx->mysql_thd,
+ static_cast<THD*>(trx->mysql_thd),
Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: FTS_DOC_ID column must be "
@@ -7982,17 +8004,18 @@ create_table_def(
const TABLE* form, /*!< in: information on table
columns and indexes */
const char* table_name, /*!< in: table name */
- const char* path_of_temp_table,
- /*!< in: if this is a table explicitly
+ const char* temp_path, /*!< in: if this is a table explicitly
created by the user with the
TEMPORARY keyword, then this
parameter is the dir path where the
table should be placed if we create
an .ibd file for it (no .ibd extension
- in the path, though) */
+ in the path, though). Otherwise this
+ is NULL */
ulint flags, /*!< in: table flags */
ulint flags2) /*!< in: table flags2 */
{
+ THD* thd = static_cast<THD*>(trx->mysql_thd);
dict_table_t* table;
ulint n_cols;
int error;
@@ -8011,13 +8034,13 @@ create_table_def(
DBUG_ENTER("create_table_def");
DBUG_PRINT("enter", ("table_name: %s", table_name));
- DBUG_ASSERT(trx->mysql_thd != NULL);
+ DBUG_ASSERT(thd != NULL);
/* MySQL does the name length check. But we do additional check
on the name length here */
if (strlen(table_name) > MAX_FULL_NAME_LEN) {
push_warning_printf(
- (THD*) trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
+ thd, Sql_condition::WARN_LEVEL_WARN,
ER_TABLE_NAME,
"InnoDB: Table Name or Database Name is too long");
@@ -8029,7 +8052,7 @@ create_table_def(
if (strcmp(strchr(table_name, '/') + 1,
"innodb_table_monitor") == 0) {
push_warning(
- (THD*) trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
+ thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_WRONG_COMMAND,
DEPRECATED_MSG_INNODB_TABLE_MONITOR);
}
@@ -8071,9 +8094,9 @@ create_table_def(
flags, flags2);
}
- if (flags2 & DICT_TF2_TEMPORARY) {
+ if (temp_path) {
table->dir_path_of_temp_table =
- mem_heap_strdup(table->heap, path_of_temp_table);
+ mem_heap_strdup(table->heap, temp_path);
}
heap = mem_heap_create(1000);
@@ -8086,8 +8109,7 @@ create_table_def(
if (!col_type) {
push_warning_printf(
- (THD*) trx->mysql_thd,
- Sql_condition::WARN_LEVEL_WARN,
+ thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_CREATE_TABLE,
"Error creating table '%s' with "
"column '%s'. Please check its "
@@ -8111,8 +8133,7 @@ create_table_def(
/* in data0type.h we assume that the
number fits in one byte in prtype */
push_warning_printf(
- (THD*) trx->mysql_thd,
- Sql_condition::WARN_LEVEL_WARN,
+ thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_CREATE_TABLE,
"In InnoDB, charset-collation codes"
" must be below 256."
@@ -8181,14 +8202,14 @@ err_col:
char buf[100];
char* buf_end = innobase_convert_identifier(
buf, sizeof buf - 1, table_name, strlen(table_name),
- trx->mysql_thd, TRUE);
+ thd, TRUE);
*buf_end = '\0';
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), buf);
}
error_ret:
- error = convert_error_code_to_mysql(error, flags, NULL);
+ error = convert_error_code_to_mysql(error, flags, thd);
DBUG_RETURN(error);
}
@@ -8578,6 +8599,60 @@ innobase_fts_load_stopword(
}
/*****************************************************************//**
+Parses the table name into normal name and temp path if needed.
+The memory for these output strings is allocated here and the
+caller is responsible to free it.
+@return 0 if successful, otherwise, error number */
+UNIV_INTERN
+int
+ha_innobase::parse_table_name(
+/*==========================*/
+ const char* name, /*!< in/out: table name provided*/
+ HA_CREATE_INFO* create_info, /*!< in: more information of the
+ created table, contains also the
+ create statement string */
+ bool use_tablespace, /*!< in: srv_file_per_table */
+ char** norm_name, /*!< out: normalized table name */
+ char** temp_path) /*!< out: absolute path of table */
+{
+ DBUG_ENTER("ha_innobase::parse_table_name");
+
+#ifdef __WIN__
+ /* Names passed in from server are in two formats:
+ 1. <database_name>/<table_name>: for normal table creation
+ 2. full path: for temp table creation, or DATA DIRECTORY.
+
+ When srv_file_per_table is on and mysqld_embedded is off,
+ check for full path pattern, i.e.
+ X:\dir\..., X is a driver letter, or
+ \\dir1\dir2\..., UNC path
+ returns error if it is in full path format, but not creating a temp.
+ table. Currently InnoDB does not support symbolic link on Windows. */
+
+ if (use_tablespace
+ && !mysqld_embedded
+ && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
+
+ if ((name[1] == ':')
+ || (name[0] == '\\' && name[1] == '\\')) {
+ sql_print_error("Cannot create table %s\n", name);
+ DBUG_RETURN(HA_ERR_GENERIC);
+ }
+ }
+#endif
+
+ *norm_name = normalize_table_name(name);
+ *temp_path = NULL;
+
+ /* A full path is used for TEMPORARY TABLE. */
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) {
+ *temp_path = mem_strdup(name);
+ }
+
+ DBUG_RETURN(0);
+}
+
+/*****************************************************************//**
Determines InnoDB table flags.
@retval true if successful, false if error */
UNIV_INTERN
@@ -8812,8 +8887,8 @@ ha_innobase::create(
trx_t* trx;
int primary_key_no;
uint i;
- char name2[FN_REFLEN];
- char norm_name[FN_REFLEN];
+ char* temp_path = NULL; /* absolute path of temp frm */
+ char* norm_name = NULL; /* {database}/{tablename} */
THD* thd = ha_thd();
ib_int64_t auto_inc_value;
@@ -8838,30 +8913,6 @@ ha_innobase::create(
DBUG_ASSERT(thd != NULL);
DBUG_ASSERT(create_info != NULL);
-#ifdef __WIN__
- /* Names passed in from server are in two formats:
- 1. <database_name>/<table_name>: for normal table creation
- 2. full path: for temp table creation, or sym link
-
- When srv_file_per_table is on and mysqld_embedded is off,
- check for full path pattern, i.e.
- X:\dir\..., X is a driver letter, or
- \\dir1\dir2\..., UNC path
- returns error if it is in full path format, but not creating a temp.
- table. Currently InnoDB does not support symbolic link on Windows. */
-
- if (use_tablespace
- && !mysqld_embedded
- && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
-
- if ((name[1] == ':')
- || (name[0] == '\\' && name[1] == '\\')) {
- sql_print_error("Cannot create table %s\n", name);
- DBUG_RETURN(HA_ERR_GENERIC);
- }
- }
-#endif
-
if (form->s->fields > 1000) {
/* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020,
but we play safe here */
@@ -8869,10 +8920,6 @@ ha_innobase::create(
DBUG_RETURN(HA_ERR_TO_BIG_ROW);
}
- strcpy(name2, name);
-
- normalize_table_name(norm_name, name2);
-
/* Create the table definition in InnoDB */
/* Validate create options if innodb_strict_mode is set. */
@@ -8887,6 +8934,12 @@ ha_innobase::create(
DBUG_RETURN(-1);
}
+ error = parse_table_name(name, create_info, use_tablespace,
+ &norm_name, &temp_path);
+ if (error) {
+ DBUG_RETURN(error);
+ }
+
/* Look for a primary key */
primary_key_no = (form->s->primary_key != MAX_KEY ?
(int) form->s->primary_key :
@@ -8900,11 +8953,13 @@ ha_innobase::create(
any user indices to be created. */
if (innobase_index_name_is_reserved(thd, form->key_info,
form->s->keys)) {
- DBUG_RETURN(-1);
+ error = -1;
+ goto cleanup3;
}
if (IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(norm_name, thd)) {
- DBUG_RETURN(HA_ERR_GENERIC);
+ error = HA_ERR_GENERIC;
+ goto cleanup3;
}
/* Get the transaction associated with the current thd, or create one
@@ -8925,7 +8980,8 @@ ha_innobase::create(
row_mysql_lock_data_dictionary(trx);
- error = create_table_def(trx, form, norm_name, name2, flags, flags2);
+ error = create_table_def(trx, form, norm_name, temp_path,
+ flags, flags2);
if (error) {
goto cleanup;
@@ -9096,8 +9152,8 @@ ha_innobase::create(
if (!innobase_fts_load_stopword(innobase_table, NULL, thd)) {
dict_table_close(innobase_table, FALSE, FALSE);
srv_active_wake_master_thread();
- trx_free_for_mysql(trx);
- DBUG_RETURN(-1);
+ error = -1;
+ goto cleanup2;
}
}
@@ -9138,17 +9194,23 @@ ha_innobase::create(
srv_active_wake_master_thread();
- trx_free_for_mysql(trx);
-
- DBUG_RETURN(0);
+ error = 0;
+ goto cleanup2;
cleanup:
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
+cleanup2:
trx_free_for_mysql(trx);
+cleanup3:
+ if (temp_path) {
+ mem_free(temp_path);
+ }
+ mem_free(norm_name);
+
DBUG_RETURN(error);
}
@@ -9233,7 +9295,7 @@ ha_innobase::delete_table(
trx_t* parent_trx;
trx_t* trx;
THD *thd = ha_thd();
- char norm_name[1000];
+ char* norm_name = NULL;
char errstr[1024];
DBUG_ENTER("ha_innobase::delete_table");
@@ -9245,9 +9307,10 @@ ha_innobase::delete_table(
/* Strangely, MySQL passes the table name without the '.frm'
extension, in contrast to ::create */
- normalize_table_name(norm_name, name);
+ norm_name = normalize_table_name(name);
if (IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(norm_name, thd)) {
+ mem_free(norm_name);
DBUG_RETURN(HA_ERR_GENERIC);
}
@@ -9302,25 +9365,26 @@ ha_innobase::delete_table(
#endif /* __WIN__ */
if (is_part) {
- char par_case_name[MAX_FULL_NAME_LEN + 1];
+ char* par_case_name;
#ifndef __WIN__
/* Check for the table using lower
case name, including the partition
separator "P" */
- memcpy(par_case_name, norm_name, strlen(norm_name));
- par_case_name[strlen(norm_name)] = 0;
+ par_case_name = mem_strdup(norm_name);
innobase_casedn_str(par_case_name);
#else
/* On Windows platfrom, check
whether there exists table name in
system table whose name is
not being normalized to lower case */
- normalize_table_name_low(par_case_name, name, FALSE);
+ par_case_name = normalize_table_name_low(
+ name, FALSE);
#endif
- error = row_drop_table_for_mysql(par_case_name, trx,
- thd_sql_command(thd)
- == SQLCOM_DROP_DB);
+ error = row_drop_table_for_mysql(
+ par_case_name, trx,
+ thd_sql_command(thd) == SQLCOM_DROP_DB);
+ mem_free(par_case_name);
}
}
@@ -9341,6 +9405,7 @@ ha_innobase::delete_table(
error = convert_error_code_to_mysql(error, 0, NULL);
+ mem_free(norm_name);
DBUG_RETURN(error);
}
@@ -9439,12 +9504,8 @@ innobase_rename_table(
char* norm_to;
char* norm_from;
- // Magic number 64 arbitrary
- norm_to = (char*) my_malloc(strlen(to) + 64, MYF(0));
- norm_from = (char*) my_malloc(strlen(from) + 64, MYF(0));
-
- normalize_table_name(norm_to, to);
- normalize_table_name(norm_from, from);
+ norm_to = normalize_table_name(to);
+ norm_from = normalize_table_name(from);
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
@@ -9472,28 +9533,27 @@ innobase_rename_table(
#endif /* __WIN__ */
if (is_part) {
- char par_case_name[MAX_FULL_NAME_LEN + 1];
+ char* par_case_name;
#ifndef __WIN__
/* Check for the table using lower
case name, including the partition
separator "P" */
- memcpy(par_case_name, norm_from,
- strlen(norm_from));
- par_case_name[strlen(norm_from)] = 0;
+ par_case_name = mem_strdup(norm_from);
innobase_casedn_str(par_case_name);
#else
/* On Windows platfrom, check
whether there exists table name in
system table whose name is
not being normalized to lower case */
- normalize_table_name_low(par_case_name,
- from, FALSE);
+ par_case_name = normalize_table_name_low(
+ from, FALSE);
#endif
error = row_rename_table_for_mysql(
par_case_name, norm_to, trx,
lock_and_commit);
+ mem_free(par_case_name);
}
}
@@ -9535,8 +9595,8 @@ innobase_rename_table(
log_buffer_flush_to_disk();
}
- my_free(norm_to);
- my_free(norm_from);
+ mem_free(norm_to);
+ mem_free(norm_from);
return(error);
}
@@ -10170,8 +10230,8 @@ ha_innobase::info_low(
"space for table %s but its "
"tablespace has been discarded or "
"the .ibd file is missing. Setting "
- "the free space to zero. "
- "(errno: %d - %s)",
+ "the free space to zero. "
+ "(errno: %d - %s)",
ib_table->name, errno,
my_strerror(errbuf, sizeof(errbuf),
errno));
=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h 2012-03-13 13:54:43 +0000
+++ b/storage/innobase/handler/ha_innodb.h 2012-04-09 15:38:48 +0000
@@ -191,6 +191,11 @@ class ha_innobase: public handler
ha_rows estimate_rows_upper_bound();
void update_create_info(HA_CREATE_INFO* create_info);
+ int parse_table_name(const char*name,
+ HA_CREATE_INFO*create_info,
+ bool use_tablespace,
+ char** norm_name,
+ char** temp_path);
int create(const char *name, register TABLE *form,
HA_CREATE_INFO *create_info);
int truncate();
=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc 2012-03-29 11:19:57 +0000
+++ b/storage/innobase/handler/handler0alter.cc 2012-04-06 15:40:06 +0000
@@ -857,7 +857,7 @@ innobase_fts_check_doc_id_index_in_def(
}
return(FTS_EXIST_DOC_ID_INDEX);
- }
+ }
return(FTS_NOT_EXIST_DOC_ID_INDEX);
}
=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc 2012-02-17 10:19:45 +0000
+++ b/storage/innobase/handler/i_s.cc 2012-04-06 15:40:06 +0000
@@ -5511,10 +5511,11 @@ i_s_common_deinit(
DBUG_RETURN(0);
}
+/** SYS_TABLES ***************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLES */
static ST_FIELD_INFO innodb_sys_tables_fields_info[] =
{
-#define SYS_TABLE_ID 0
+#define SYS_TABLES_ID 0
{STRUCT_FLD(field_name, "TABLE_ID"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
@@ -5523,7 +5524,7 @@ static ST_FIELD_INFO innodb_sys_tables_f
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define SYS_TABLE_NAME 1
+#define SYS_TABLES_NAME 1
{STRUCT_FLD(field_name, "NAME"),
STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
@@ -5532,7 +5533,7 @@ static ST_FIELD_INFO innodb_sys_tables_f
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define SYS_TABLE_FLAG 2
+#define SYS_TABLES_FLAG 2
{STRUCT_FLD(field_name, "FLAG"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
@@ -5541,7 +5542,7 @@ static ST_FIELD_INFO innodb_sys_tables_f
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define SYS_TABLE_NUM_COLUMN 3
+#define SYS_TABLES_NUM_COLUMN 3
{STRUCT_FLD(field_name, "N_COLS"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
@@ -5550,7 +5551,7 @@ static ST_FIELD_INFO innodb_sys_tables_f
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
-#define SYS_TABLE_SPACE 4
+#define SYS_TABLES_SPACE 4
{STRUCT_FLD(field_name, "SPACE"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
@@ -5580,15 +5581,15 @@ i_s_dict_fill_sys_tables(
fields = table_to_fill->field;
- OK(fields[SYS_TABLE_ID]->store(longlong(table->id), TRUE));
+ OK(fields[SYS_TABLES_ID]->store(longlong(table->id), TRUE));
- OK(field_store_string(fields[SYS_TABLE_NAME], table->name));
+ OK(field_store_string(fields[SYS_TABLES_NAME], table->name));
- OK(fields[SYS_TABLE_FLAG]->store(table->flags));
+ OK(fields[SYS_TABLES_FLAG]->store(table->flags));
- OK(fields[SYS_TABLE_NUM_COLUMN]->store(table->n_cols));
+ OK(fields[SYS_TABLES_NUM_COLUMN]->store(table->n_cols));
- OK(fields[SYS_TABLE_SPACE]->store(table->space));
+ OK(fields[SYS_TABLES_SPACE]->store(table->space));
OK(schema_table_store_record(thd, table_to_fill));
@@ -5741,6 +5742,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_i
STRUCT_FLD(flags, 0UL),
};
+/** SYS_TABLESTATS ***********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLESTATS */
static ST_FIELD_INFO innodb_sys_tablestats_fields_info[] =
{
@@ -6020,6 +6022,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_i
STRUCT_FLD(flags, 0UL),
};
+/** SYS_INDEXES **************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_INDEXES */
static ST_FIELD_INFO innodb_sysindex_fields_info[] =
{
@@ -6279,7 +6282,8 @@ UNIV_INTERN struct st_mysql_plugin i_s_i
STRUCT_FLD(flags, 0UL),
};
-/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_COLUMNS */
+/** SYS_COLUMNS **************************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_COLUMNS */
static ST_FIELD_INFO innodb_sys_columns_fields_info[] =
{
#define SYS_COLUMN_TABLE_ID 0
@@ -6517,7 +6521,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_i
/* unsigned long */
STRUCT_FLD(flags, 0UL),
};
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_fields */
+
+/** SYS_FIELDS ***************************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FIELDS */
static ST_FIELD_INFO innodb_sys_fields_fields_info[] =
{
#define SYS_FIELD_INDEX_ID 0
@@ -6729,7 +6735,8 @@ UNIV_INTERN struct st_mysql_plugin i_s_i
STRUCT_FLD(flags, 0UL),
};
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign */
+/** SYS_FOREIGN ********************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FOREIGN */
static ST_FIELD_INFO innodb_sys_foreign_fields_info[] =
{
#define SYS_FOREIGN_ID 0
@@ -6814,6 +6821,7 @@ i_s_dict_fill_sys_foreign(
DBUG_RETURN(0);
}
+
/*******************************************************************//**
Function to populate INFORMATION_SCHEMA.innodb_sys_foreign table. Loop
through each record in SYS_FOREIGN, and extract the foreign key
@@ -6880,6 +6888,7 @@ i_s_sys_foreign_fill_table(
DBUG_RETURN(0);
}
+
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign
@return 0 on success */
@@ -6953,7 +6962,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_i
/* unsigned long */
STRUCT_FLD(flags, 0UL),
};
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols */
+
+/** SYS_FOREIGN_COLS ********************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS */
static ST_FIELD_INFO innodb_sys_foreign_cols_fields_info[] =
{
#define SYS_FOREIGN_COL_ID 0
=== modified file 'storage/innobase/include/dict0boot.h'
--- a/storage/innobase/include/dict0boot.h 2012-02-16 16:33:49 +0000
+++ b/storage/innobase/include/dict0boot.h 2012-04-06 15:40:06 +0000
@@ -88,7 +88,7 @@ void
dict_boot(void);
/*===========*/
/*****************************************************************//**
-Creates and initializes the data dictionary at the database creation. */
+Creates and initializes the data dictionary at the server bootstrap. */
UNIV_INTERN
void
dict_create(void);
=== modified file 'storage/innobase/include/dict0crea.h'
--- a/storage/innobase/include/dict0crea.h 2011-11-08 10:32:23 +0000
+++ b/storage/innobase/include/dict0crea.h 2012-04-06 15:40:06 +0000
@@ -99,7 +99,7 @@ dict_drop_index_tree(
mtr_t* mtr); /*!< in: mtr having the latch on the record page */
/****************************************************************//**
Creates the foreign key constraints system tables inside InnoDB
-at database creation or database start if they are not found or are
+at server bootstrap or server start if they are not found or are
not of the right form.
@return DB_SUCCESS or error code */
UNIV_INTERN
=== modified file 'storage/innobase/include/dict0load.h'
--- a/storage/innobase/include/dict0load.h 2011-12-09 21:08:37 +0000
+++ b/storage/innobase/include/dict0load.h 2012-04-06 15:40:06 +0000
@@ -33,7 +33,7 @@ Created 4/24/1996 Heikki Tuuri
#include "mem0mem.h"
#include "btr0types.h"
-/** enum that defines all 6 system table IDs */
+/** enum that defines all system table IDs. @see SYSTEM_TABLE_NAME[] */
enum dict_system_table_id {
SYS_TABLES = 0,
SYS_INDEXES,
=== modified file 'storage/innobase/os/os0file.cc'
--- a/storage/innobase/os/os0file.cc 2012-02-17 14:51:29 +0000
+++ b/storage/innobase/os/os0file.cc 2012-04-06 15:40:06 +0000
@@ -645,7 +645,8 @@ os_file_handle_error_cond_exit(
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: File operation call: "
- "'%s'.\n", operation);
+ "'%s' returned OS error " ULINTPF ".\n",
+ operation, err);
}
if (should_exit) {
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3493 to 3494) | Marc Alff | 10 Apr |