Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e80a8420
Commit
e80a8420
authored
Mar 22, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
2fb31821
0cba2c1c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
142 additions
and
13 deletions
+142
-13
extra/mariabackup/common.h
extra/mariabackup/common.h
+3
-1
extra/mariabackup/xtrabackup.cc
extra/mariabackup/xtrabackup.cc
+83
-0
mysql-test/suite/mariabackup/undo_space_id.opt
mysql-test/suite/mariabackup/undo_space_id.opt
+2
-0
mysql-test/suite/mariabackup/undo_space_id.result
mysql-test/suite/mariabackup/undo_space_id.result
+13
-0
mysql-test/suite/mariabackup/undo_space_id.test
mysql-test/suite/mariabackup/undo_space_id.test
+25
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+5
-0
storage/innobase/include/trx0rseg.ic
storage/innobase/include/trx0rseg.ic
+4
-2
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+5
-6
storage/xtradb/srv/srv0start.cc
storage/xtradb/srv/srv0start.cc
+2
-4
No files found.
extra/mariabackup/common.h
View file @
e80a8420
...
...
@@ -28,7 +28,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <my_sys.h>
# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
/** Determine if (i) is a user tablespace id or not. */
# define fil_is_user_tablespace_id(i) (i != 0 \
&& !srv_is_undo_tablespace(i))
#ifdef _MSC_VER
#define stat _stati64
...
...
extra/mariabackup/xtrabackup.cc
View file @
e80a8420
...
...
@@ -2939,6 +2939,83 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
return
(
err
);
}
/** Assign srv_undo_space_id_start variable if there are undo tablespace present.
Read the TRX_SYS page from ibdata1 file and get the minimum space id from
the first slot rollback segments of TRX_SYS_PAGE_NO.
@retval DB_ERROR if file open or page read failed.
@retval DB_SUCCESS if srv_undo_space_id assigned successfully. */
static
dberr_t
xb_assign_undo_space_start
()
{
ulint
dirnamelen
;
char
name
[
1000
];
pfs_os_file_t
file
;
byte
*
buf
;
byte
*
page
;
bool
ret
;
dberr_t
error
=
DB_SUCCESS
;
ulint
space
,
page_no
;
if
(
srv_undo_tablespaces
==
0
)
{
return
error
;
}
os_normalize_path
(
srv_data_home
);
dirnamelen
=
strlen
(
srv_data_home
);
memcpy
(
name
,
srv_data_home
,
dirnamelen
);
if
(
dirnamelen
&&
name
[
dirnamelen
-
1
]
!=
OS_PATH_SEPARATOR
)
{
name
[
dirnamelen
++
]
=
OS_PATH_SEPARATOR
;
}
snprintf
(
name
+
dirnamelen
,
strlen
(
name
)
+
strlen
(
"ibdata1"
),
"%s"
,
"ibdata1"
);
file
=
os_file_create
(
0
,
name
,
OS_FILE_OPEN
,
OS_FILE_NORMAL
,
OS_DATA_FILE
,
true
,
&
ret
);
if
(
!
ret
)
{
msg
(
"mariabackup: Error in opening %s
\n
"
,
name
);
return
DB_ERROR
;
}
buf
=
static_cast
<
byte
*>
(
ut_malloc_nokey
(
2
*
UNIV_PAGE_SIZE
));
page
=
static_cast
<
byte
*>
(
ut_align
(
buf
,
UNIV_PAGE_SIZE
));
retry:
if
(
!
os_file_read
(
IORequestRead
,
file
,
page
,
TRX_SYS_PAGE_NO
*
UNIV_PAGE_SIZE
,
UNIV_PAGE_SIZE
))
{
msg
(
"mariabackup: Reading TRX_SYS page failed.
\n
"
);
error
=
DB_ERROR
;
goto
func_exit
;
}
/* TRX_SYS page can't be compressed or encrypted. */
if
(
buf_page_is_corrupted
(
false
,
page
,
univ_page_size
))
{
goto
retry
;
}
/* 0th slot always points to system tablespace.
1st slot should point to first undotablespace which is minimum. */
page_no
=
mach_read_ulint
(
TRX_SYS
+
TRX_SYS_RSEGS
+
TRX_SYS_RSEG_SLOT_SIZE
+
TRX_SYS_RSEG_PAGE_NO
+
page
,
MLOG_4BYTES
);
ut_ad
(
page_no
!=
FIL_NULL
);
space
=
mach_read_ulint
(
TRX_SYS
+
TRX_SYS_RSEGS
+
TRX_SYS_RSEG_SLOT_SIZE
+
TRX_SYS_RSEG_SPACE
+
page
,
MLOG_4BYTES
);
srv_undo_space_id_start
=
space
;
func_exit:
ut_free
(
buf
);
ret
=
os_file_close
(
file
);
ut_a
(
ret
);
return
error
;
}
/****************************************************************************
Populates the tablespace memory cache by scanning for and opening data files.
@returns DB_SUCCESS or error code.*/
...
...
@@ -2973,6 +3050,12 @@ xb_load_tablespaces()
/* Add separate undo tablespaces to fil_system */
err
=
xb_assign_undo_space_start
();
if
(
err
!=
DB_SUCCESS
)
{
return
err
;
}
err
=
srv_undo_tablespaces_init
(
false
);
if
(
err
!=
DB_SUCCESS
)
{
...
...
mysql-test/suite/mariabackup/undo_space_id.opt
0 → 100644
View file @
e80a8420
--debug=d,innodb_undo_upgrade
--innodb_undo_tablespaces=2
mysql-test/suite/mariabackup/undo_space_id.result
0 → 100644
View file @
e80a8420
# Create 2 UNDO TABLESPACE(UNDO003, UNDO004)
CREATE TABLE t1(a varchar(60)) ENGINE INNODB;
start transaction;
INSERT INTO t1 VALUES(1);
# xtrabackup backup
# Display undo log files from target directory
undo003
undo004
# xtrabackup prepare
# Display undo log files from targer directory
undo003
undo004
DROP TABLE t1;
mysql-test/suite/mariabackup/undo_space_id.test
0 → 100644
View file @
e80a8420
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_debug
.
inc
--
echo
# Create 2 UNDO TABLESPACE(UNDO003, UNDO004)
let
$basedir
=
$MYSQLTEST_VARDIR
/
tmp
/
backup
;
CREATE
TABLE
t1
(
a
varchar
(
60
))
ENGINE
INNODB
;
start
transaction
;
INSERT
INTO
t1
VALUES
(
1
);
--
echo
# xtrabackup backup
--
disable_result_log
exec
$XTRABACKUP
--
defaults
-
file
=
$MYSQLTEST_VARDIR
/
my
.
cnf
--
backup
--
target
-
dir
=
$basedir
;
--
enable_result_log
--
echo
# Display undo log files from target directory
list_files
$basedir
undo
*
;
--
echo
# xtrabackup prepare
exec
$XTRABACKUP
--
prepare
--
apply
-
log
-
only
--
target
-
dir
=
$basedir
;
--
echo
# Display undo log files from targer directory
list_files
$basedir
undo
*
;
DROP
TABLE
t1
;
rmdir
$basedir
;
sql/item_cmpfunc.h
View file @
e80a8420
...
...
@@ -2384,6 +2384,11 @@ class Item_equal: public Item_bool_func
void
sort
(
Item_field_cmpfunc
compare
,
void
*
arg
);
void
fix_length_and_dec
();
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
void
cleanup
()
{
delete
eval_item
;
eval_item
=
NULL
;
}
void
update_used_tables
();
COND
*
build_equal_items
(
THD
*
thd
,
COND_EQUAL
*
inherited
,
bool
link_item_fields
,
...
...
storage/innobase/include/trx0rseg.ic
View file @
e80a8420
...
...
@@ -42,9 +42,11 @@ trx_rsegf_get(
buf_block_t* block;
trx_rsegf_t* header;
ut_ad(space <= srv_undo_tablespaces_active || space == SRV_TMP_SPACE_ID
ut_ad(space <= srv_undo_space_id_start + srv_undo_tablespaces_active
|| space == SRV_TMP_SPACE_ID
|| !srv_was_started);
ut_ad(space <= TRX_SYS_MAX_UNDO_SPACES || space == SRV_TMP_SPACE_ID);
ut_ad(space <= srv_undo_space_id_start + TRX_SYS_MAX_UNDO_SPACES
|| space == SRV_TMP_SPACE_ID);
block = buf_page_get(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
...
...
storage/innobase/srv/srv0start.cc
View file @
e80a8420
...
...
@@ -898,12 +898,11 @@ srv_undo_tablespaces_init(bool create_new_db)
switch
(
srv_operation
)
{
case
SRV_OPERATION_RESTORE_DELTA
:
case
SRV_OPERATION_BACKUP
:
/* MDEV-13561 FIXME: Determine srv_undo_space_id_start
from the undo001 file. */
srv_undo_space_id_start
=
1
;
for
(
i
=
0
;
i
<
n_undo_tablespaces
;
i
++
)
{
undo_tablespace_ids
[
i
]
=
i
+
srv_undo_space_id_start
;
}
prev_space_id
=
srv_undo_space_id_start
-
1
;
break
;
case
SRV_OPERATION_NORMAL
:
if
(
create_new_db
)
{
...
...
@@ -964,7 +963,7 @@ srv_undo_tablespaces_init(bool create_new_db)
undo_tablespace_ids
[
i
]);
/* Should be no gaps in undo tablespace ids. */
ut_a
(
prev_space_id
+
1
==
undo_tablespace_ids
[
i
]);
ut_a
(
!
i
||
prev_space_id
+
1
==
undo_tablespace_ids
[
i
]);
/* The system space id should not be in this array. */
ut_a
(
undo_tablespace_ids
[
i
]
!=
0
);
...
...
@@ -992,14 +991,14 @@ srv_undo_tablespaces_init(bool create_new_db)
not in use and therefore not required by recovery. We only check
that there are no gaps. */
for
(
i
=
prev_space_id
+
1
;
i
<
TRX_SYS_N_RSEGS
;
++
i
)
{
for
(
i
=
prev_space_id
+
1
;
i
<
srv_undo_space_id_start
+
TRX_SYS_N_RSEGS
;
++
i
)
{
char
name
[
OS_FILE_MAX_PATH
];
snprintf
(
name
,
sizeof
(
name
),
"%s%cundo%03zu"
,
srv_undo_dir
,
OS_PATH_SEPARATOR
,
i
);
/* Undo space ids start from 1. */
err
=
srv_undo_tablespace_open
(
name
,
i
);
if
(
err
!=
DB_SUCCESS
)
{
...
...
storage/xtradb/srv/srv0start.cc
View file @
e80a8420
...
...
@@ -1505,14 +1505,12 @@ srv_undo_tablespaces_init(
if
(
backup_mode
)
{
ut_ad
(
!
create_new_db
);
/* MDEV-13561 FIXME: Determine srv_undo_space_id_start
from the undo001 file. */
srv_undo_space_id_start
=
1
;
for
(
i
=
0
;
i
<
n_undo_tablespaces
;
i
++
)
{
undo_tablespace_ids
[
i
]
=
i
+
srv_undo_space_id_start
;
}
prev_space_id
=
srv_undo_space_id_start
-
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment