mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
row0purge.c, row0mysql.c, os0file.c, os0file.h, fil0fil.h, fil0fil.c:
IMPORT TABLESPACE must reset lsns if they are too high ha_innodb.cc: DISCARD/IMPORT TABLESPACE must have a TL_WRITE lock on the table
This commit is contained in:
@@ -1871,6 +1871,16 @@ row_discard_tablespace_for_mysql(
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
if (table->space == 0) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: table %s\n"
|
||||
"InnoDB: is in the system tablespace 0 which cannot be discarded\n", name);
|
||||
err = DB_ERROR;
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
|
||||
|
||||
sprintf(buf,
|
||||
@@ -1967,6 +1977,7 @@ row_import_tablespace_for_mysql(
|
||||
{
|
||||
dict_table_t* table;
|
||||
ibool success;
|
||||
dulint current_lsn;
|
||||
ulint err = DB_SUCCESS;
|
||||
|
||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
@@ -1975,6 +1986,30 @@ row_import_tablespace_for_mysql(
|
||||
|
||||
trx->op_info = (char*) "importing tablespace";
|
||||
|
||||
current_lsn = log_get_lsn();
|
||||
|
||||
/* It is possible, though very improbable, that the lsn's in the
|
||||
tablespace to be imported have risen above the current system lsn, if
|
||||
a lengthy purge, ibuf merge, or rollback was performed on a backup
|
||||
taken with ibbackup. If that is the case, reset page lsn's in the
|
||||
file. We assume that mysqld was shut down after it performed these
|
||||
cleanup operations on the .ibd file, so that it stamped the latest lsn
|
||||
to the FIL_PAGE_FILE_FLUSH_LSN in the first page of the .ibd file.
|
||||
|
||||
TODO: reset also the trx id's in clustered index records and write
|
||||
a new space id to each data page. That would allow us to import clean
|
||||
.ibd files from another MySQL installation. */
|
||||
|
||||
success = fil_reset_too_high_lsns(name, current_lsn);
|
||||
|
||||
if (!success) {
|
||||
err = DB_ERROR;
|
||||
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
/* Serialize data dictionary operations with dictionary mutex:
|
||||
no deadlocks can occur then in these operations */
|
||||
|
||||
@@ -1988,6 +2023,16 @@ row_import_tablespace_for_mysql(
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
if (table->space == 0) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Error: table %s\n"
|
||||
"InnoDB: is in the system tablespace 0 which cannot be imported\n", name);
|
||||
err = DB_ERROR;
|
||||
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
if (!table->tablespace_discarded) {
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
|
Reference in New Issue
Block a user