Skip to content

Commit

Permalink
Merge bb-10.2-ext into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Dec 20, 2017
2 parents 2534b5c + 69e88de commit 1ec8d45
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 34 deletions.
4 changes: 1 addition & 3 deletions mysql-test/suite/innodb/r/alter_crash.result
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,8 @@ ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
ERROR HY000: Lost connection to MySQL server during query
# Startup the server after the crash
SELECT * FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test/#sql-ib%';
WHERE name LIKE 'test/#sql-%';
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
# Drop the orphaned rebuilt table.
SHOW TABLES;
Tables_in_test
t2
Expand Down Expand Up @@ -123,7 +122,6 @@ ERROR HY000: Lost connection to MySQL server during query
SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = ID;
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
FLUSH TABLES;
# Files in datadir after manual recovery.
t1.frm
t1.ibd
Expand Down
45 changes: 15 additions & 30 deletions mysql-test/suite/innodb/t/alter_crash.test
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ let $orig_table_id = `SELECT table_id
--error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);

--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc

let TABLENAME_INC= $MYSQLTEST_VARDIR/tmp/tablename.inc;
perl;
die unless open OUT, ">$ENV{TABLENAME_INC}";
Expand All @@ -86,12 +83,15 @@ EOF
source $TABLENAME_INC;
remove_file $TABLENAME_INC;

move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;

--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc

--replace_result $orig_table_id ID
eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id;

move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;

--echo # Files in datadir after manual recovery.
--list_files $MYSQLD_DATADIR/test

Expand Down Expand Up @@ -125,26 +125,13 @@ let $orig_table_id = `SELECT table_id
--error 2013
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);

remove_files_wildcard $datadir/test #sql-*.frm;

--echo # Startup the server after the crash
--source include/start_mysqld.inc

SELECT * FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test/#sql-ib%';

perl;
die unless open OUT, ">$ENV{TABLENAME_INC}";
chdir "$ENV{'datadir'}/test";
my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm";
print OUT 'let $tablename=', $frm_file[0], ';';
close OUT or die;
EOF
source $TABLENAME_INC;
remove_file $TABLENAME_INC;

--echo # Drop the orphaned rebuilt table.
--disable_query_log
eval DROP TABLE `#mysql50#$tablename`;
--enable_query_log
WHERE name LIKE 'test/#sql-%';

SHOW TABLES;
INSERT INTO t2 VALUES (5,6),(7,8);
Expand Down Expand Up @@ -180,26 +167,24 @@ let $orig_table_id = `select table_id from
--error 2013
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE;

--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc

--replace_result $orig_table_id ID
eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id;

perl;
die unless open OUT, ">$ENV{TABLENAME_INC}";
chdir "$ENV{'datadir'}/test";
my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm";
print OUT 'let $tablename=', $frm_file[0], ';';
close OUT or die;
EOF

source $TABLENAME_INC;
remove_file $TABLENAME_INC;

move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;

FLUSH TABLES;
--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc

--replace_result $orig_table_id ID
eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id;

--echo # Files in datadir after manual recovery.
--list_files $MYSQLD_DATADIR/test
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2917,7 +2917,7 @@ row_mysql_drop_garbage_tables()
table_name = mem_heap_strdupl(
heap,
reinterpret_cast<const char*>(field), len);
if (strstr(table_name, "/" TEMP_FILE_PREFIX_INNODB)) {
if (strstr(table_name, "/" TEMP_FILE_PREFIX "-")) {
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);

Expand Down

0 comments on commit 1ec8d45

Please sign in to comment.