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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
598a6028
Commit
598a6028
authored
Apr 30, 2007
by
tomas@whalegate.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb_restore to set correct value force varpart
+ some tests
parent
636a380e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
3 deletions
+61
-3
mysql-test/r/ndb_restore.result
mysql-test/r/ndb_restore.result
+5
-1
mysql-test/r/ndb_restore_compat.result
mysql-test/r/ndb_restore_compat.result
+10
-0
mysql-test/t/ndb_restore.test
mysql-test/t/ndb_restore.test
+11
-1
mysql-test/t/ndb_restore_compat.test
mysql-test/t/ndb_restore_compat.test
+19
-1
storage/ndb/tools/restore/consumer_restore.cpp
storage/ndb/tools/restore/consumer_restore.cpp
+16
-0
No files found.
mysql-test/r/ndb_restore.result
View file @
598a6028
...
@@ -23,7 +23,7 @@ CREATE TABLE `t3_c` (
...
@@ -23,7 +23,7 @@ CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`capgotod`,`CapGoaledatta`)
PRIMARY KEY (`capgotod`,`CapGoaledatta`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
ROW_FORMAT=FIXED
;
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
CREATE TABLE `t4_c` (
CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment,
`capfa` bigint(20) unsigned NOT NULL auto_increment,
...
@@ -129,6 +129,8 @@ create table t7 engine=myisam as select * from t7_c;
...
@@ -129,6 +129,8 @@ create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
create table t10 engine=myisam as select * from t10_c;
ForceVarPart: 0
ForceVarPart: 1
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
...
@@ -137,6 +139,8 @@ SELECT @the_backup_id:=backup_id FROM test.backup_info;
...
@@ -137,6 +139,8 @@ SELECT @the_backup_id:=backup_id FROM test.backup_info;
<the_backup_id>
<the_backup_id>
DROP TABLE test.backup_info;
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
ForceVarPart: 0
ForceVarPart: 1
select count(*) from t1;
select count(*) from t1;
count(*)
count(*)
5
5
...
...
mysql-test/r/ndb_restore_compat.result
View file @
598a6028
...
@@ -47,11 +47,21 @@ SYSTEM_VALUES_ID VALUE
...
@@ -47,11 +47,21 @@ SYSTEM_VALUES_ID VALUE
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
server_id epoch log_name start_pos end_pos
server_id epoch log_name start_pos end_pos
0 151 0 0
0 151 0 0
ForceVarPart: 1
ForceVarPart: 1
ForceVarPart: 1
ForceVarPart: 1
ForceVarPart: 1
TRUNCATE GL;
TRUNCATE GL;
TRUNCATE ACCOUNT;
TRUNCATE ACCOUNT;
TRUNCATE TRANSACTION;
TRUNCATE TRANSACTION;
TRUNCATE SYSTEM_VALUES;
TRUNCATE SYSTEM_VALUES;
TRUNCATE ACCOUNT_TYPE;
TRUNCATE ACCOUNT_TYPE;
ForceVarPart: 1
ForceVarPart: 1
ForceVarPart: 1
ForceVarPart: 1
ForceVarPart: 1
SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED
TIME ACCOUNT_TYPE BALANCE DEPOSIT_COUNT DEPOSIT_SUM WITHDRAWAL_COUNT WITHDRAWAL_SUM PURGED
0 0 10000000 0 0 0 0 1
0 0 10000000 0 0 0 0 1
...
...
mysql-test/t/ndb_restore.test
View file @
598a6028
...
@@ -35,11 +35,13 @@ CREATE TABLE `t2_c` (
...
@@ -35,11 +35,13 @@ CREATE TABLE `t2_c` (
)
ENGINE
=
ndbcluster
DEFAULT
CHARSET
=
latin1
;
)
ENGINE
=
ndbcluster
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
`t2_c`
VALUES
(
500
,
4
,
''
,
'q3.net'
,
'addavp:MK_CASELECTOR=1'
,
'postorod rattoaa'
),(
2
,
1
,
'4'
,
''
,
'addavp:MK_BRANDTAD=345'
,
'REDS Brandtad'
),(
3
,
2
,
'4'
,
'q3.net'
,
'execorder'
,
'fixedRatediPO REDS'
),(
1
,
1
,
'3'
,
''
,
'addavp:MK_BRANDTAD=123'
,
'TEST Brandtad'
),(
6
,
5
,
''
,
'told.q3.net'
,
'addavp:MK_BRANDTAD=123'
,
'Brandtad Toldzone'
),(
4
,
3
,
'3'
,
'q3.net'
,
'addavp:MK_POOLHINT=2'
,
'ratedi PO TEST'
);
INSERT
INTO
`t2_c`
VALUES
(
500
,
4
,
''
,
'q3.net'
,
'addavp:MK_CASELECTOR=1'
,
'postorod rattoaa'
),(
2
,
1
,
'4'
,
''
,
'addavp:MK_BRANDTAD=345'
,
'REDS Brandtad'
),(
3
,
2
,
'4'
,
'q3.net'
,
'execorder'
,
'fixedRatediPO REDS'
),(
1
,
1
,
'3'
,
''
,
'addavp:MK_BRANDTAD=123'
,
'TEST Brandtad'
),(
6
,
5
,
''
,
'told.q3.net'
,
'addavp:MK_BRANDTAD=123'
,
'Brandtad Toldzone'
),(
4
,
3
,
'3'
,
'q3.net'
,
'addavp:MK_POOLHINT=2'
,
'ratedi PO TEST'
);
# Added ROW_FORMAT=FIXED to use below to see that setting is preserved
# by restore
CREATE
TABLE
`t3_c`
(
CREATE
TABLE
`t3_c`
(
`CapGoaledatta`
smallint
(
5
)
unsigned
NOT
NULL
default
'0'
,
`CapGoaledatta`
smallint
(
5
)
unsigned
NOT
NULL
default
'0'
,
`capgotod`
smallint
(
5
)
unsigned
NOT
NULL
default
'0'
,
`capgotod`
smallint
(
5
)
unsigned
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
`capgotod`
,
`CapGoaledatta`
)
PRIMARY
KEY
(
`capgotod`
,
`CapGoaledatta`
)
)
ENGINE
=
ndbcluster
DEFAULT
CHARSET
=
latin1
;
)
ENGINE
=
ndbcluster
DEFAULT
CHARSET
=
latin1
ROW_FORMAT
=
FIXED
;
INSERT
INTO
`t3_c`
VALUES
(
5
,
3
),(
2
,
4
),(
5
,
4
),(
1
,
3
);
INSERT
INTO
`t3_c`
VALUES
(
5
,
3
),(
2
,
4
),(
5
,
4
),(
1
,
3
);
# Bug #27775 - mediumint auto inc not restored correctly
# Bug #27775 - mediumint auto inc not restored correctly
...
@@ -164,11 +166,19 @@ create table t8 engine=myisam as select * from t8_c;
...
@@ -164,11 +166,19 @@ create table t8 engine=myisam as select * from t8_c;
create
table
t9
engine
=
myisam
as
select
*
from
t9_c
;
create
table
t9
engine
=
myisam
as
select
*
from
t9_c
;
create
table
t10
engine
=
myisam
as
select
*
from
t10_c
;
create
table
t10
engine
=
myisam
as
select
*
from
t10_c
;
# check that force varpart is preserved by ndb_restore
# t3_c has ROW_FORMAT=FIXED i.e. ForceVarPart=0
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t3_c
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t2_c
|
grep
ForceVarPart
--
source
include
/
ndb_backup
.
inc
--
source
include
/
ndb_backup
.
inc
drop
table
t1_c
,
t2_c
,
t3_c
,
t4_c
,
t5_c
,
t6_c
,
t7_c
,
t8_c
,
t9_c
,
t10_c
;
drop
table
t1_c
,
t2_c
,
t3_c
,
t4_c
,
t5_c
,
t6_c
,
t7_c
,
t8_c
,
t9_c
,
t10_c
;
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
$the_backup_id
-
n
1
-
m
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
$the_backup_id
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
$the_backup_id
-
n
1
-
m
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
$the_backup_id
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
$the_backup_id
-
n
2
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
$the_backup_id
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
$the_backup_id
-
n
2
-
r
--
print
--
print_meta
$NDB_BACKUP_DIR
/
BACKUP
/
BACKUP
-
$the_backup_id
>>
$NDB_TOOLS_OUTPUT
# check that force varpart is preserved by ndb_restore
# t3_c has ROW_FORMAT=FIXED i.e. ForceVarPart=0
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t3_c
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
test
t2_c
|
grep
ForceVarPart
# random output order??
# random output order??
#show tables;
#show tables;
...
...
mysql-test/t/ndb_restore_compat.test
View file @
598a6028
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
DROP
DATABASE
IF
EXISTS
BANK
;
DROP
DATABASE
IF
EXISTS
BANK
;
--
enable_warnings
--
enable_warnings
CREATE
DATABASE
BANK
default
charset
=
latin1
default
collate
=
latin1_bin
;
CREATE
DATABASE
BANK
default
charset
=
latin1
default
collate
=
latin1_bin
;
USE
BANK
;
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
1
-
p
1
-
m
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup51
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
1
-
p
1
-
m
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup51
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
e
-
b
1
-
n
2
-
p
1
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup51
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
e
-
b
1
-
n
2
-
p
1
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup51
>>
$NDB_TOOLS_OUTPUT
USE
BANK
;
SHOW
TABLES
;
SHOW
TABLES
;
SELECT
*
FROM
GL
ORDER
BY
TIME
,
ACCOUNT_TYPE
;
SELECT
*
FROM
GL
ORDER
BY
TIME
,
ACCOUNT_TYPE
;
SELECT
*
FROM
ACCOUNT
ORDER
BY
ACCOUNT_ID
;
SELECT
*
FROM
ACCOUNT
ORDER
BY
ACCOUNT_ID
;
...
@@ -23,6 +23,13 @@ SELECT COUNT(*) FROM TRANSACTION;
...
@@ -23,6 +23,13 @@ SELECT COUNT(*) FROM TRANSACTION;
SELECT
*
FROM
SYSTEM_VALUES
ORDER
BY
SYSTEM_VALUES_ID
;
SELECT
*
FROM
SYSTEM_VALUES
ORDER
BY
SYSTEM_VALUES_ID
;
SELECT
*
FROM
mysql
.
ndb_apply_status
WHERE
server_id
=
0
;
SELECT
*
FROM
mysql
.
ndb_apply_status
WHERE
server_id
=
0
;
# Check that force varpart is set by ndb_restore
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
GL
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
ACCOUNT
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
TRANSACTION
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
SYSTEM_VALUES
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
ACCOUNT_TYPE
|
grep
ForceVarPart
#
#
# verify restore of 5.0 backup
# verify restore of 5.0 backup
# here we must use the already created tables as restoring the old
# here we must use the already created tables as restoring the old
...
@@ -33,8 +40,19 @@ TRUNCATE ACCOUNT;
...
@@ -33,8 +40,19 @@ TRUNCATE ACCOUNT;
TRUNCATE
TRANSACTION
;
TRUNCATE
TRANSACTION
;
TRUNCATE
SYSTEM_VALUES
;
TRUNCATE
SYSTEM_VALUES
;
TRUNCATE
ACCOUNT_TYPE
;
TRUNCATE
ACCOUNT_TYPE
;
# Check that force varpart is not changed by truncate
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
GL
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
ACCOUNT
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
TRANSACTION
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
SYSTEM_VALUES
|
grep
ForceVarPart
--
exec
$NDB_TOOLS_DIR
/
ndb_desc
--
no
-
defaults
-
d
BANK
ACCOUNT_TYPE
|
grep
ForceVarPart
# Restore data
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
1
-
p
1
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup50
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
b
1
-
n
1
-
p
1
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup50
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
e
-
b
1
-
n
2
-
p
1
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup50
>>
$NDB_TOOLS_OUTPUT
--
exec
$NDB_TOOLS_DIR
/
ndb_restore
--
no
-
defaults
-
e
-
b
1
-
n
2
-
p
1
-
r
$MYSQL_TEST_DIR
/
std_data
/
ndb_backup50
>>
$NDB_TOOLS_OUTPUT
# Check data
SELECT
*
FROM
GL
ORDER
BY
TIME
,
ACCOUNT_TYPE
;
SELECT
*
FROM
GL
ORDER
BY
TIME
,
ACCOUNT_TYPE
;
SELECT
*
FROM
ACCOUNT
ORDER
BY
ACCOUNT_ID
;
SELECT
*
FROM
ACCOUNT
ORDER
BY
ACCOUNT_ID
;
SELECT
COUNT
(
*
)
FROM
TRANSACTION
;
SELECT
COUNT
(
*
)
FROM
TRANSACTION
;
...
...
storage/ndb/tools/restore/consumer_restore.cpp
View file @
598a6028
...
@@ -869,6 +869,22 @@ BackupRestore::table(const TableS & table){
...
@@ -869,6 +869,22 @@ BackupRestore::table(const TableS & table){
copy
.
setFragmentData
((
const
void
*
)
ng_array
,
no_parts
<<
1
);
copy
.
setFragmentData
((
const
void
*
)
ng_array
,
no_parts
<<
1
);
}
}
/**
* Force of varpart was introduced in 5.1.18, telco 6.1.7 and 6.2.1
* Since default from mysqld is to add force of varpart (disable with
* ROW_FORMAT=FIXED) we force varpart onto tables when they are restored
* from backups taken with older versions. This will be wrong if
* ROW_FORMAT=FIXED was used on original table, however the likelyhood of
* this is low, since ROW_FORMAT= was a NOOP in older versions.
*/
if
(
table
.
getBackupVersion
()
<
MAKE_VERSION
(
5
,
1
,
18
))
copy
.
setForceVarPart
(
true
);
else
if
(
getMajor
(
table
.
getBackupVersion
())
==
6
&&
(
table
.
getBackupVersion
()
<
MAKE_VERSION
(
6
,
1
,
7
)
||
table
.
getBackupVersion
()
==
MAKE_VERSION
(
6
,
2
,
0
)))
copy
.
setForceVarPart
(
true
);
/*
/*
update min and max rows to reflect the table, this to
update min and max rows to reflect the table, this to
ensure that memory is allocated properly in the ndb kernel
ensure that memory is allocated properly in the ndb kernel
...
...
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