Merge mysql-5.1 -> mysql-5.5
The actual Bug#11754376 does not exist in MySQL 5.5 because at startup we drop entries for temporary tables from InnoDB dictionary cache (only if ROW_FORMAT is not REDUNDANT). But nevertheless the bug in normalize_table_name_low() is present so we fix it.
This commit is contained in:
commit
c8d8a92300
4
mysql-test/suite/innodb/r/innodb_bug11754376.result
Normal file
4
mysql-test/suite/innodb/r/innodb_bug11754376.result
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
|
||||
SET SESSION DEBUG='+d,test_normalize_table_name_low';
|
||||
DROP TABLE bug11754376;
|
||||
SET SESSION DEBUG='-d,test_normalize_table_name_low';
|
16
mysql-test/suite/innodb/t/innodb_bug11754376.test
Normal file
16
mysql-test/suite/innodb/t/innodb_bug11754376.test
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON GRACEFUL SHUTDOWN
|
||||
#
|
||||
|
||||
-- source include/have_debug.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
|
||||
|
||||
# This will invoke test_normalize_table_name_low() in debug builds
|
||||
|
||||
SET SESSION DEBUG='+d,test_normalize_table_name_low';
|
||||
|
||||
DROP TABLE bug11754376;
|
||||
|
||||
SET SESSION DEBUG='-d,test_normalize_table_name_low';
|
@ -3292,37 +3292,114 @@ normalize_table_name_low(
|
||||
{
|
||||
char* name_ptr;
|
||||
char* db_ptr;
|
||||
ulint db_len;
|
||||
char* ptr;
|
||||
|
||||
/* Scan name from the end */
|
||||
|
||||
ptr = strend(name)-1;
|
||||
ptr = strend(name) - 1;
|
||||
|
||||
/* seek to the last path separator */
|
||||
while (ptr >= name && *ptr != '\\' && *ptr != '/') {
|
||||
ptr--;
|
||||
}
|
||||
|
||||
name_ptr = ptr + 1;
|
||||
|
||||
DBUG_ASSERT(ptr > name);
|
||||
/* skip any number of path separators */
|
||||
while (ptr >= name && (*ptr == '\\' || *ptr == '/')) {
|
||||
ptr--;
|
||||
}
|
||||
|
||||
ptr--;
|
||||
DBUG_ASSERT(ptr >= name);
|
||||
|
||||
/* seek to the last but one path separator or one char before
|
||||
the beginning of name */
|
||||
db_len = 0;
|
||||
while (ptr >= name && *ptr != '\\' && *ptr != '/') {
|
||||
ptr--;
|
||||
db_len++;
|
||||
}
|
||||
|
||||
db_ptr = ptr + 1;
|
||||
|
||||
memcpy(norm_name, db_ptr, strlen(name) + 1 - (db_ptr - name));
|
||||
memcpy(norm_name, db_ptr, db_len);
|
||||
|
||||
norm_name[name_ptr - db_ptr - 1] = '/';
|
||||
norm_name[db_len] = '/';
|
||||
|
||||
memcpy(norm_name + db_len + 1, name_ptr, strlen(name_ptr) + 1);
|
||||
|
||||
if (set_lower_case) {
|
||||
innobase_casedn_str(norm_name);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(DBUG_OFF)
|
||||
/*********************************************************************
|
||||
Test normalize_table_name_low(). */
|
||||
static
|
||||
void
|
||||
test_normalize_table_name_low()
|
||||
/*===========================*/
|
||||
{
|
||||
char norm_name[128];
|
||||
const char* test_data[][2] = {
|
||||
/* input, expected result */
|
||||
{"./mysqltest/t1", "mysqltest/t1"},
|
||||
{"./test/#sql-842b_2", "test/#sql-842b_2"},
|
||||
{"./test/#sql-85a3_10", "test/#sql-85a3_10"},
|
||||
{"./test/#sql2-842b-2", "test/#sql2-842b-2"},
|
||||
{"./test/bug29807", "test/bug29807"},
|
||||
{"./test/foo", "test/foo"},
|
||||
{"./test/innodb_bug52663", "test/innodb_bug52663"},
|
||||
{"./test/t", "test/t"},
|
||||
{"./test/t1", "test/t1"},
|
||||
{"./test/t10", "test/t10"},
|
||||
{"/a/b/db/table", "db/table"},
|
||||
{"/a/b/db///////table", "db/table"},
|
||||
{"/a/b////db///////table", "db/table"},
|
||||
{"/var/tmp/mysqld.1/#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
|
||||
{"db/table", "db/table"},
|
||||
{"ddd/t", "ddd/t"},
|
||||
{"d/ttt", "d/ttt"},
|
||||
{"d/t", "d/t"},
|
||||
{".\\mysqltest\\t1", "mysqltest/t1"},
|
||||
{".\\test\\#sql-842b_2", "test/#sql-842b_2"},
|
||||
{".\\test\\#sql-85a3_10", "test/#sql-85a3_10"},
|
||||
{".\\test\\#sql2-842b-2", "test/#sql2-842b-2"},
|
||||
{".\\test\\bug29807", "test/bug29807"},
|
||||
{".\\test\\foo", "test/foo"},
|
||||
{".\\test\\innodb_bug52663", "test/innodb_bug52663"},
|
||||
{".\\test\\t", "test/t"},
|
||||
{".\\test\\t1", "test/t1"},
|
||||
{".\\test\\t10", "test/t10"},
|
||||
{"C:\\a\\b\\db\\table", "db/table"},
|
||||
{"C:\\a\\b\\db\\\\\\\\\\\\\\table", "db/table"},
|
||||
{"C:\\a\\b\\\\\\\\db\\\\\\\\\\\\\\table", "db/table"},
|
||||
{"C:\\var\\tmp\\mysqld.1\\#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
|
||||
{"db\\table", "db/table"},
|
||||
{"ddd\\t", "ddd/t"},
|
||||
{"d\\ttt", "d/ttt"},
|
||||
{"d\\t", "d/t"},
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < UT_ARR_SIZE(test_data); i++) {
|
||||
printf("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);
|
||||
|
||||
if (strcmp(norm_name, test_data[i][1]) == 0) {
|
||||
printf("ok\n");
|
||||
} else {
|
||||
printf("got \"%s\"\n", norm_name);
|
||||
ut_error;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !DBUG_OFF */
|
||||
|
||||
/********************************************************************//**
|
||||
Get the upper limit of the MySQL integral and floating-point type.
|
||||
@return maximum allowed value for the field */
|
||||
@ -7343,6 +7420,11 @@ ha_innobase::delete_table(
|
||||
|
||||
DBUG_ENTER("ha_innobase::delete_table");
|
||||
|
||||
DBUG_EXECUTE_IF(
|
||||
"test_normalize_table_name_low",
|
||||
test_normalize_table_name_low();
|
||||
);
|
||||
|
||||
/* Strangely, MySQL passes the table name without the '.frm'
|
||||
extension, in contrast to ::create */
|
||||
normalize_table_name(norm_name, name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user