Skip to content

Commit 0fa35dd

Browse files
committed
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.
1 parent 7e4bbd3 commit 0fa35dd

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

extra/mariabackup/xtrabackup.cc

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,35 +3233,24 @@ the first slot rollback segments of TRX_SYS_PAGE_NO.
32333233
@retval DB_SUCCESS if srv_undo_space_id assigned successfully. */
32343234
static dberr_t xb_assign_undo_space_start()
32353235
{
3236-
ulint dirnamelen;
3237-
char name[1000];
3236+
32383237
pfs_os_file_t file;
32393238
byte* buf;
32403239
byte* page;
32413240
bool ret;
32423241
dberr_t error = DB_SUCCESS;
32433242
ulint space, page_no;
3243+
int n_retries = 5;
32443244

32453245
if (srv_undo_tablespaces == 0) {
32463246
return error;
32473247
}
32483248

3249-
os_normalize_path(srv_data_home);
3250-
dirnamelen = strlen(srv_data_home);
3251-
memcpy(name, srv_data_home, dirnamelen);
3252-
3253-
if (dirnamelen && name[dirnamelen - 1] != OS_PATH_SEPARATOR) {
3254-
name[dirnamelen++] = OS_PATH_SEPARATOR;
3255-
}
3256-
3257-
snprintf(name + dirnamelen, (sizeof name) - dirnamelen,
3258-
"%s", srv_sys_space.first_datafile()->name());
3259-
3260-
file = os_file_create(0, name, OS_FILE_OPEN,
3261-
OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);
3249+
file = os_file_create(0, srv_sys_space.first_datafile()->filepath(),
3250+
OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);
32623251

32633252
if (!ret) {
3264-
msg("mariabackup: Error in opening %s\n", name);
3253+
msg("mariabackup: Error in opening %s\n", srv_sys_space.first_datafile()->filepath());
32653254
return DB_ERROR;
32663255
}
32673256

@@ -3278,7 +3267,14 @@ static dberr_t xb_assign_undo_space_start()
32783267

32793268
/* TRX_SYS page can't be compressed or encrypted. */
32803269
if (buf_page_is_corrupted(false, page, univ_page_size)) {
3281-
goto retry;
3270+
if (n_retries--) {
3271+
os_thread_sleep(1000);
3272+
goto retry;
3273+
} else {
3274+
msg("mariabackup: TRX_SYS page corrupted.\n");
3275+
error = DB_ERROR;
3276+
goto func_exit;
3277+
}
32823278
}
32833279

32843280
/* 0th slot always points to system tablespace.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:3M;ibdata_second:1M:autoextend
1+
--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:3M;ibdata_second:1M:autoextend --innodb-undo-tablespaces=2

0 commit comments

Comments
 (0)