Commit 0fa35ddf authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Amend fix for MDEV-17236

Simplify, and make it work with system tablespace outside of
innodb data home.

Also, do not reread TRX_SYS page  in endless loop,
if it appears to be corrupted.

Use finite number of attempts.
parent 7e4bbd3a
...@@ -3233,35 +3233,24 @@ the first slot rollback segments of TRX_SYS_PAGE_NO. ...@@ -3233,35 +3233,24 @@ the first slot rollback segments of TRX_SYS_PAGE_NO.
@retval DB_SUCCESS if srv_undo_space_id assigned successfully. */ @retval DB_SUCCESS if srv_undo_space_id assigned successfully. */
static dberr_t xb_assign_undo_space_start() static dberr_t xb_assign_undo_space_start()
{ {
ulint dirnamelen;
char name[1000];
pfs_os_file_t file; pfs_os_file_t file;
byte* buf; byte* buf;
byte* page; byte* page;
bool ret; bool ret;
dberr_t error = DB_SUCCESS; dberr_t error = DB_SUCCESS;
ulint space, page_no; ulint space, page_no;
int n_retries = 5;
if (srv_undo_tablespaces == 0) { if (srv_undo_tablespaces == 0) {
return error; return error;
} }
os_normalize_path(srv_data_home); file = os_file_create(0, srv_sys_space.first_datafile()->filepath(),
dirnamelen = strlen(srv_data_home); OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);
memcpy(name, srv_data_home, dirnamelen);
if (dirnamelen && name[dirnamelen - 1] != OS_PATH_SEPARATOR) {
name[dirnamelen++] = OS_PATH_SEPARATOR;
}
snprintf(name + dirnamelen, (sizeof name) - dirnamelen,
"%s", srv_sys_space.first_datafile()->name());
file = os_file_create(0, name, OS_FILE_OPEN,
OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);
if (!ret) { if (!ret) {
msg("mariabackup: Error in opening %s\n", name); msg("mariabackup: Error in opening %s\n", srv_sys_space.first_datafile()->filepath());
return DB_ERROR; return DB_ERROR;
} }
...@@ -3278,7 +3267,14 @@ static dberr_t xb_assign_undo_space_start() ...@@ -3278,7 +3267,14 @@ static dberr_t xb_assign_undo_space_start()
/* TRX_SYS page can't be compressed or encrypted. */ /* TRX_SYS page can't be compressed or encrypted. */
if (buf_page_is_corrupted(false, page, univ_page_size)) { if (buf_page_is_corrupted(false, page, univ_page_size)) {
goto retry; if (n_retries--) {
os_thread_sleep(1000);
goto retry;
} else {
msg("mariabackup: TRX_SYS page corrupted.\n");
error = DB_ERROR;
goto func_exit;
}
} }
/* 0th slot always points to system tablespace. /* 0th slot always points to system tablespace.
......
--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:3M;ibdata_second:1M:autoextend --innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:3M;ibdata_second:1M:autoextend --innodb-undo-tablespaces=2
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment