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
773479f5
Commit
773479f5
authored
Dec 21, 2018
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for partial backup for partitioned table.
parent
2cf30866
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
8 deletions
+90
-8
extra/mariabackup/xtrabackup.cc
extra/mariabackup/xtrabackup.cc
+15
-8
mysql-test/suite/mariabackup/partition_partial.result
mysql-test/suite/mariabackup/partition_partial.result
+31
-0
mysql-test/suite/mariabackup/partition_partial.test
mysql-test/suite/mariabackup/partition_partial.test
+44
-0
No files found.
extra/mariabackup/xtrabackup.cc
View file @
773479f5
...
...
@@ -1469,7 +1469,7 @@ debug_sync_point(const char *name)
}
static
std
::
vector
<
std
::
string
>
tables_for_export
;
static
std
::
set
<
std
::
string
>
tables_for_export
;
static
void
append_export_table
(
const
char
*
dbname
,
const
char
*
tablename
,
bool
is_remote
)
{
...
...
@@ -1481,7 +1481,15 @@ static void append_export_table(const char *dbname, const char *tablename, bool
char
*
p
=
strrchr
(
buf
,
'.'
);
if
(
p
)
*
p
=
0
;
tables_for_export
.
push_back
(
ut_get_name
(
0
,
buf
));
std
::
string
name
=
ut_get_name
(
0
,
buf
);
/* Strip partition name comment from table name, if any */
if
(
ends_with
(
name
.
c_str
(),
"*/"
))
{
size_t
pos
=
name
.
rfind
(
"/*"
);
if
(
pos
!=
std
::
string
::
npos
)
name
.
resize
(
pos
);
}
tables_for_export
.
insert
(
name
);
}
}
...
...
@@ -1496,9 +1504,10 @@ static int create_bootstrap_file()
fputs
(
"SET NAMES UTF8;
\n
"
,
f
);
enumerate_ibd_files
(
append_export_table
);
for
(
size_t
i
=
0
;
i
<
tables_for_export
.
size
();
i
++
)
for
(
std
::
set
<
std
::
string
>::
iterator
it
=
tables_for_export
.
begin
();
it
!=
tables_for_export
.
end
();
it
++
)
{
const
char
*
tab
=
tables_for_export
[
i
].
c_str
();
const
char
*
tab
=
it
->
c_str
();
fprintf
(
f
,
"BEGIN NOT ATOMIC "
"DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;"
...
...
@@ -1528,7 +1537,7 @@ static int prepare_export()
snprintf
(
cmdline
,
sizeof
cmdline
,
IF_WIN
(
"
\"
"
,
""
)
"
\"
%s
\"
--mysqld
\"
%s
\"
"
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0"
" --innodb --innodb-fast-shutdown=0
--loose-partition
"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --skip-log-error --bootstrap < "
BOOTSTRAP_FILENAME
IF_WIN
(
"
\"
"
,
""
),
mariabackup_exe
,
...
...
@@ -1540,7 +1549,7 @@ static int prepare_export()
sprintf
(
cmdline
,
IF_WIN
(
"
\"
"
,
""
)
"
\"
%s
\"
--mysqld"
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0"
" --innodb --innodb-fast-shutdown=0
--loose-partition
"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --log-error= --bootstrap < "
BOOTSTRAP_FILENAME
IF_WIN
(
"
\"
"
,
""
),
mariabackup_exe
,
...
...
@@ -5851,7 +5860,6 @@ check_all_privileges()
mysql_free_result
(
result
);
int
check_result
=
PRIVILEGE_OK
;
bool
reload_checked
=
false
;
/* FLUSH TABLES WITH READ LOCK */
if
(
!
opt_no_lock
)
...
...
@@ -5859,7 +5867,6 @@ check_all_privileges()
check_result
|=
check_privilege
(
granted_privileges
,
"RELOAD"
,
"*"
,
"*"
);
reload_checked
=
true
;
}
if
(
!
opt_no_lock
)
...
...
mysql-test/suite/mariabackup/partition_partial.result
0 → 100644
View file @
773479f5
CREATE TABLE t1(i INT) ENGINE INNODB
PARTITION BY RANGE (i)
(PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN (200),
PARTITION p3 VALUES LESS THAN (300),
PARTITION p4 VALUES LESS THAN (400));
INSERT INTO t1 VALUES (1), (101), (201), (301);
# xtrabackup backup
INSERT INTO t1 VALUES (1), (101), (201), (301);
# xtrabackup prepare
CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder;
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder;
SELECT * FROM t1;
i
1
101
201
301
DROP TABLE t1;
DROP TABLE t1_placeholder;
mysql-test/suite/mariabackup/partition_partial.test
0 → 100644
View file @
773479f5
#--source include/innodb_page_size.inc
# import partitioned table from table from partial backup
CREATE
TABLE
t1
(
i
INT
)
ENGINE
INNODB
PARTITION
BY
RANGE
(
i
)
(
PARTITION
p1
VALUES
LESS
THAN
(
100
),
PARTITION
p2
VALUES
LESS
THAN
(
200
),
PARTITION
p3
VALUES
LESS
THAN
(
300
),
PARTITION
p4
VALUES
LESS
THAN
(
400
));
INSERT
INTO
t1
VALUES
(
1
),
(
101
),
(
201
),
(
301
);
echo
# xtrabackup backup;
let
$targetdir
=
$MYSQLTEST_VARDIR
/
tmp
/
backup
;
--
disable_result_log
exec
$XTRABACKUP
--
defaults
-
file
=
$MYSQLTEST_VARDIR
/
my
.
cnf
--
backup
"--tables=test.t1"
--
target
-
dir
=
$targetdir
;
--
enable_result_log
INSERT
INTO
t1
VALUES
(
1
),
(
101
),
(
201
),
(
301
);
echo
# xtrabackup prepare;
--
disable_result_log
exec
$XTRABACKUP
--
defaults
-
file
=
$MYSQLTEST_VARDIR
/
my
.
cnf
--
defaults
-
group
-
suffix
=.
1
--
prepare
--
export
--
target
-
dir
=
$targetdir
;
--
enable_result_log
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
CREATE
TABLE
t1_placeholder
(
i
INT
)
ENGINE
INNODB
;
let
$i
=
4
;
while
(
$i
)
{
eval
ALTER
TABLE
t1_placeholder
DISCARD
TABLESPACE
;
copy_file
$targetdir
/
test
/
t1
#P#p$i.cfg $MYSQLD_DATADIR/test/t1_placeholder.cfg;
copy_file
$targetdir
/
test
/
t1
#P#p$i.ibd $MYSQLD_DATADIR/test/t1_placeholder.ibd;
eval
ALTER
TABLE
t1_placeholder
IMPORT
TABLESPACE
;
eval
ALTER
TABLE
t1
EXCHANGE
PARTITION
p
$i
WITH
TABLE
t1_placeholder
;
dec
$i
;
}
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1_placeholder
;
rmdir
$targetdir
;
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