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
fd37344f
Commit
fd37344f
authored
Dec 14, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
67e3d1ee
5fefcb0a
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
180 additions
and
1314 deletions
+180
-1314
extra/mariabackup/fil_cur.cc
extra/mariabackup/fil_cur.cc
+49
-21
mysql-test/suite/innodb/r/innochecksum.result
mysql-test/suite/innodb/r/innochecksum.result
+0
-5
mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
+0
-91
mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
+0
-160
mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
+0
-227
mysql-test/suite/innodb/t/innochecksum.test
mysql-test/suite/innodb/t/innochecksum.test
+0
-32
mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
+0
-3
mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
+0
-243
mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
+0
-3
mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
+0
-118
mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
+0
-1
mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
+0
-406
mysql-test/suite/mariabackup/encrypted_page_corruption.opt
mysql-test/suite/mariabackup/encrypted_page_corruption.opt
+6
-0
mysql-test/suite/mariabackup/encrypted_page_corruption.result
...l-test/suite/mariabackup/encrypted_page_corruption.result
+8
-0
mysql-test/suite/mariabackup/encrypted_page_corruption.test
mysql-test/suite/mariabackup/encrypted_page_corruption.test
+51
-0
sql/sql_class.cc
sql/sql_class.cc
+3
-2
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
tests/mysql_client_test.c
tests/mysql_client_test.c
+61
-1
No files found.
extra/mariabackup/fil_cur.cc
View file @
fd37344f
...
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
...
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <trx0sys.h>
#include <trx0sys.h>
#include "fil_cur.h"
#include "fil_cur.h"
#include "fil0crypt.h"
#include "common.h"
#include "common.h"
#include "read_filt.h"
#include "read_filt.h"
#include "xtrabackup.h"
#include "xtrabackup.h"
...
@@ -230,7 +231,7 @@ xb_fil_cur_open(
...
@@ -230,7 +231,7 @@ xb_fil_cur_open(
posix_fadvise
(
cursor
->
file
,
0
,
0
,
POSIX_FADV_SEQUENTIAL
);
posix_fadvise
(
cursor
->
file
,
0
,
0
,
POSIX_FADV_SEQUENTIAL
);
const
page_size_t
page_size
(
cursor
->
node
->
space
->
flags
);
const
page_size_t
page_size
(
node
->
space
->
flags
);
cursor
->
page_size
=
page_size
;
cursor
->
page_size
=
page_size
;
/* Allocate read buffer */
/* Allocate read buffer */
...
@@ -246,6 +247,19 @@ xb_fil_cur_open(
...
@@ -246,6 +247,19 @@ xb_fil_cur_open(
cursor
->
buf_page_no
=
0
;
cursor
->
buf_page_no
=
0
;
cursor
->
thread_n
=
thread_n
;
cursor
->
thread_n
=
thread_n
;
if
(
!
node
->
space
->
crypt_data
&&
os_file_read
(
IORequestRead
,
node
->
handle
,
cursor
->
buf
,
0
,
page_size
.
physical
()))
{
mutex_enter
(
&
fil_system
.
mutex
);
if
(
!
node
->
space
->
crypt_data
)
{
node
->
space
->
crypt_data
=
fil_space_read_crypt_data
(
page_size
,
cursor
->
buf
);
}
mutex_exit
(
&
fil_system
.
mutex
);
}
cursor
->
space_size
=
(
ulint
)(
cursor
->
statinfo
.
st_size
cursor
->
space_size
=
(
ulint
)(
cursor
->
statinfo
.
st_size
/
page_size
.
physical
());
/
page_size
.
physical
());
...
@@ -267,7 +281,6 @@ xb_fil_cur_read(
...
@@ -267,7 +281,6 @@ xb_fil_cur_read(
/*============*/
/*============*/
xb_fil_cur_t
*
cursor
)
/*!< in/out: source file cursor */
xb_fil_cur_t
*
cursor
)
/*!< in/out: source file cursor */
{
{
ibool
success
;
byte
*
page
;
byte
*
page
;
ulint
i
;
ulint
i
;
ulint
npages
;
ulint
npages
;
...
@@ -275,6 +288,8 @@ xb_fil_cur_read(
...
@@ -275,6 +288,8 @@ xb_fil_cur_read(
xb_fil_cur_result_t
ret
;
xb_fil_cur_result_t
ret
;
ib_int64_t
offset
;
ib_int64_t
offset
;
ib_int64_t
to_read
;
ib_int64_t
to_read
;
byte
tmp_frame
[
UNIV_PAGE_SIZE_MAX
];
byte
tmp_page
[
UNIV_PAGE_SIZE_MAX
];
const
ulint
page_size
=
cursor
->
page_size
.
physical
();
const
ulint
page_size
=
cursor
->
page_size
.
physical
();
xb_ad
(
!
cursor
->
is_system
()
||
page_size
==
srv_page_size
);
xb_ad
(
!
cursor
->
is_system
()
||
page_size
==
srv_page_size
);
...
@@ -317,6 +332,12 @@ xb_fil_cur_read(
...
@@ -317,6 +332,12 @@ xb_fil_cur_read(
retry_count
=
10
;
retry_count
=
10
;
ret
=
XB_FIL_CUR_SUCCESS
;
ret
=
XB_FIL_CUR_SUCCESS
;
fil_space_t
*
space
=
fil_space_acquire_for_io
(
cursor
->
space_id
);
if
(
!
space
)
{
return
XB_FIL_CUR_ERROR
;
}
read_retry:
read_retry:
xtrabackup_io_throttling
();
xtrabackup_io_throttling
();
...
@@ -325,19 +346,11 @@ xb_fil_cur_read(
...
@@ -325,19 +346,11 @@ xb_fil_cur_read(
cursor
->
buf_offset
=
offset
;
cursor
->
buf_offset
=
offset
;
cursor
->
buf_page_no
=
(
ulint
)(
offset
/
cursor
->
page_size
.
physical
());
cursor
->
buf_page_no
=
(
ulint
)(
offset
/
cursor
->
page_size
.
physical
());
fil_space_t
*
space
=
fil_space_get
(
cursor
->
space_id
);
if
(
!
os_file_read
(
IORequestRead
,
cursor
->
file
,
cursor
->
buf
,
offset
,
(
ulint
)
to_read
))
{
if
(
!
space
)
{
ret
=
XB_FIL_CUR_ERROR
;
return
(
XB_FIL_CUR_ERROR
);
goto
func_exit
;
}
success
=
os_file_read
(
IORequestRead
,
cursor
->
file
,
cursor
->
buf
,
offset
,
(
ulint
)
to_read
);
if
(
!
success
)
{
return
(
XB_FIL_CUR_ERROR
);
}
}
/* check pages for corruption and re-read if necessary. i.e. in case of
/* check pages for corruption and re-read if necessary. i.e. in case of
partially written pages */
partially written pages */
for
(
page
=
cursor
->
buf
,
i
=
0
;
i
<
npages
;
for
(
page
=
cursor
->
buf
,
i
=
0
;
i
<
npages
;
...
@@ -348,11 +361,26 @@ xb_fil_cur_read(
...
@@ -348,11 +361,26 @@ xb_fil_cur_read(
page_no
>=
FSP_EXTENT_SIZE
&&
page_no
>=
FSP_EXTENT_SIZE
&&
page_no
<
FSP_EXTENT_SIZE
*
3
)
{
page_no
<
FSP_EXTENT_SIZE
*
3
)
{
/* We ignore the doublewrite buffer pages */
/* We ignore the doublewrite buffer pages */
}
else
if
(
!
fil_space_verify_crypt_checksum
(
}
else
if
(
fil_space_verify_crypt_checksum
(
page
,
cursor
->
page_size
,
space
->
id
,
page_no
)
page
,
cursor
->
page_size
,
&&
buf_page_is_corrupted
(
true
,
page
,
space
->
id
,
page_no
))
{
ut_ad
(
mach_read_from_4
(
page
+
FIL_PAGE_SPACE_ID
)
==
space
->
id
);
bool
decrypted
=
false
;
memcpy
(
tmp_page
,
page
,
page_size
);
if
(
!
fil_space_decrypt
(
space
,
tmp_frame
,
tmp_page
,
&
decrypted
)
||
buf_page_is_corrupted
(
true
,
tmp_page
,
cursor
->
page_size
,
cursor
->
page_size
,
space
))
{
space
))
{
goto
corrupted
;
}
}
else
if
(
buf_page_is_corrupted
(
true
,
page
,
cursor
->
page_size
,
space
))
{
corrupted:
retry_count
--
;
retry_count
--
;
if
(
retry_count
==
0
)
{
if
(
retry_count
==
0
)
{
msg
(
"[%02u] mariabackup: "
msg
(
"[%02u] mariabackup: "
...
@@ -372,7 +400,6 @@ xb_fil_cur_read(
...
@@ -372,7 +400,6 @@ xb_fil_cur_read(
}
}
os_thread_sleep
(
100000
);
os_thread_sleep
(
100000
);
goto
read_retry
;
goto
read_retry
;
}
}
cursor
->
buf_read
+=
page_size
;
cursor
->
buf_read
+=
page_size
;
...
@@ -380,7 +407,8 @@ xb_fil_cur_read(
...
@@ -380,7 +407,8 @@ xb_fil_cur_read(
}
}
posix_fadvise
(
cursor
->
file
,
offset
,
to_read
,
POSIX_FADV_DONTNEED
);
posix_fadvise
(
cursor
->
file
,
offset
,
to_read
,
POSIX_FADV_DONTNEED
);
func_exit:
space
->
release_for_io
();
return
(
ret
);
return
(
ret
);
}
}
...
...
mysql-test/suite/innodb/r/innochecksum.result
deleted
100644 → 0
View file @
67e3d1ee
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES ('corrupt me');
INSERT INTO t1 (b) VALUES ('corrupt me');
# Run innochecksum on t1
DROP TABLE t1;
mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
deleted
100644 → 0
View file @
67e3d1ee
# Set the environmental variables
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab1(c2(10));
INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
insert into t1 values(1,"i");
insert into t1 values(2,"am");
insert into t1 values(3,"compressed table");
# Shutdown the Server
# Server Default checksum = innodb
[1b]: check the innochecksum without --strict-check
[2]: check the innochecksum with full form --strict-check=crc32
[3]: check the innochecksum with short form -C crc32
[4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
FOUND 1 /Error: --no-check must be associated with --write option./ in my_restart.err
[5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
FOUND 1 /Error: --no-check must be associated with --write option./ in my_restart.err
[6]: check the innochecksum with full form strict-check & no-check , an error is expected
FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
[7]: check the innochecksum with short form strict-check & no-check , an error is expected
FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
[8]: check the innochecksum with short & full form combination
# strict-check & no-check, an error is expected
FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
[9]: check the innochecksum with full form --strict-check=innodb
[10]: check the innochecksum with full form --strict-check=none
# when server Default checksum=crc32
[11]: check the innochecksum with short form -C innodb
# when server Default checksum=crc32
[12]: check the innochecksum with short form -C none
# when server Default checksum=crc32
[13]: check strict-check with invalid values
FOUND 1 /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'crc\' to \'strict-check\'/ in my_restart.err
FOUND 1 /Error while setting value \'no\' to \'strict-check\'/ in my_restart.err
[14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
# Also check the long form of write option.
[14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
# Also check the long form of write option.
# start the server with innodb_checksum_algorithm=InnoDB
INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
SELECT c1,c2 FROM tab1 order by c1,c2;
c1 c2
1 Innochecksum InnoDB1
2 Innochecksum CRC32
# Stop the server
[15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
# Also check the short form of write option.
# Start the server with checksum algorithm=none
INSERT INTO tab1 VALUES(3, 'Innochecksum None');
SELECT c1,c2 FROM tab1 order by c1,c2;
c1 c2
1 Innochecksum InnoDB1
2 Innochecksum CRC32
3 Innochecksum None
DROP TABLE t1;
# Stop the server
[16]: rewrite into new checksum=crc32 with innochecksum
# Restart the DB server with innodb_checksum_algorithm=crc32
SELECT * FROM tab1;
c1 c2
1 Innochecksum InnoDB1
2 Innochecksum CRC32
3 Innochecksum None
DELETE FROM tab1 where c1=3;
SELECT c1,c2 FROM tab1 order by c1,c2;
c1 c2
1 Innochecksum InnoDB1
2 Innochecksum CRC32
# Stop server
[17]: rewrite into new checksum=InnoDB
# Restart the DB server with innodb_checksum_algorithm=InnoDB
DELETE FROM tab1 where c1=2;
SELECT * FROM tab1;
c1 c2
1 Innochecksum InnoDB1
# Stop server
[18]:check Innochecksum with invalid write options
FOUND 1 /Error while setting value \'strict_crc32\' to \'write\'/ in my_restart.err
FOUND 1 /Error while setting value \'strict_innodb\' to \'write\'/ in my_restart.err
FOUND 1 /Error while setting value \'crc23\' to \'write\'/ in my_restart.err
DROP TABLE tab1;
mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
deleted
100644 → 0
View file @
67e3d1ee
SET GLOBAL innodb_compression_level=0;
SELECT @@innodb_compression_level;
@@innodb_compression_level
0
CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
INSERT INTO t1 SELECT * from t1;
# stop the server
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
verbose TRUE
debug FALSE
count FALSE
start-page 0
end-page 0
page 0
strict-check crc32
no-check FALSE
allow-mismatches 0
write crc32
page-type-summary FALSE
page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
per-page-details FALSE
log (No default value)
leaf FALSE
merge 0
[1]:# check the both short and long options for "help"
[2]:# Run the innochecksum when file isn't provided.
# It will print the innochecksum usage similar to --help option.
innochecksum Ver #.#.#
Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
InnoDB offline file checksum utility.
Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]>
-?, --help Displays this help and exits.
-I, --info Synonym for --help.
-V, --version Displays version information and exits.
-v, --verbose Verbose (prints progress every 5 seconds).
-c, --count Print the count of pages in the file and exits.
-s, --start-page=# Start on this page number (0 based).
-e, --end-page=# End at this page number (0 based).
-p, --page=# Check only this page (0 based).
-C, --strict-check=name
Specify the strict checksum algorithm by the user.. One
of: crc32, crc32, innodb, innodb, none, none
-n, --no-check Ignore the checksum verification.
-a, --allow-mismatches=#
Maximum checksum mismatch allowed.
-w, --write=name Rewrite the checksum algorithm by the user.. One of:
crc32, crc32, innodb, innodb, none, none
-S, --page-type-summary
Display a count of each page type in a tablespace.
-D, --page-type-dump=name
Dump the page type info for each page in a tablespace.
-i, --per-page-details
Print out per-page detail information.
-l, --log=name log output.
-f, --leaf Examine leaf index pages
-m, --merge=# leaf page count if merge given number of consecutive
pages
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
verbose FALSE
count FALSE
start-page 0
end-page 0
page 0
strict-check crc32
no-check FALSE
allow-mismatches 0
write crc32
page-type-summary FALSE
page-type-dump (No default value)
per-page-details FALSE
log (No default value)
leaf FALSE
merge 0
[3]:# check the both short and long options for "count" and exit
Number of pages:#
Number of pages:#
[4]:# Print the version of innochecksum and exit
innochecksum Ver #.#.## Restart the DB server
DROP TABLE t1;
[5]:# Check the innochecksum for compressed table t1 with different key_block_size
# Test for KEY_BLOCK_SIZE=1
===> Testing size=1
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
insert into t1 values(1,"I");
insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED");
select * from t1;
id msg
1 I
2 AM
3 COMPRESSED
drop table t1;
# Test for KEY_BLOCK_SIZE=2
===> Testing size=2
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
insert into t1 values(1,"I");
insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED");
select * from t1;
id msg
1 I
2 AM
3 COMPRESSED
drop table t1;
# Test for for KEY_BLOCK_SIZE=4
===> Testing size=4
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
insert into t1 values(1,"I");
insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED");
select * from t1;
id msg
1 I
2 AM
3 COMPRESSED
drop table t1;
set innodb_strict_mode=off;
# Test for for KEY_BLOCK_SIZE=8
===> Testing size=8
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
insert into t1 values(1,"I");
insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED");
select * from t1;
id msg
1 I
2 AM
3 COMPRESSED
drop table t1;
set innodb_strict_mode=off;
# Test for KEY_BLOCK_SIZE=16
===> Testing size=16
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
insert into t1 values(1,"I");
insert into t1 values(2,"AM");
insert into t1 values(3,"COMPRESSED");
select * from t1;
id msg
1 I
2 AM
3 COMPRESSED
drop table t1;
# Test[5] completed
mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
deleted
100644 → 0
View file @
67e3d1ee
# Set the environmental variables
call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*");
[1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
linestring_key GEOMETRY NOT NULL,
linestring_nokey GEOMETRY NOT NULL)
ENGINE=InnoDB ;
INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (1, ST_GeomFromText('POINT(10 10) '), ST_GeomFromText('POINT(10 10) '));
CREATE INDEX linestring_index ON tab1(linestring_nokey(5));
ALTER TABLE tab1 ADD KEY (linestring_key(5));
# create a compressed table
CREATE TABLE tab2(col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 longtext,
col_4 longtext,col_5 longtext,
col_6 longtext , col_7 int )
engine = innodb row_format=compressed key_block_size=4;
CREATE INDEX idx1 ON tab2(col_3(10));
CREATE INDEX idx2 ON tab2(col_4(10));
CREATE INDEX idx3 ON tab2(col_5(10));
SET @col_1 = repeat('a', 5);
SET @col_2 = repeat('b', 20);
SET @col_3 = repeat('c', 100);
SET @col_4 = repeat('d', 100);
SET @col_5 = repeat('e', 100);
SET @col_6 = repeat('f', 100);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,5);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,4);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,3);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,2);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,1);
SELECT * FROM tab2 ORDER BY col_7;
# stop the server
[1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1
: start the server with innodb_checksum_algorithm=strict_innodb
INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'));
SET @col_1 = repeat('a', 5);
SET @col_2 = repeat('b', 20);
SET @col_3 = repeat('c', 100);
SET @col_4 = repeat('d', 100);
SET @col_5 = repeat('e', 100);
SET @col_6 = repeat('f', 100);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,6);
SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
FROM tab1 ORDER BY pk;
SELECT * FROM tab2 ORDER BY col_7;
# stop the server
[1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1
# start the server with innodb_checksum_algorithm=strict_crc32
INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'),
ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'));
SET @col_1 = repeat('g', 5);
SET @col_2 = repeat('h', 20);
SET @col_3 = repeat('i', 100);
SET @col_4 = repeat('j', 100);
SET @col_5 = repeat('k', 100);
SET @col_6 = repeat('l', 100);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,7);
SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
FROM tab1 ORDER BY pk;
SELECT * FROM tab2 ORDER BY col_7;
# stop the server
[1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1
INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '));
SET @col_1 = repeat('m', 5);
SET @col_2 = repeat('n', 20);
SET @col_3 = repeat('o', 100);
SET @col_4 = repeat('p', 100);
SET @col_5 = repeat('q', 100);
SET @col_6 = repeat('r', 100);
INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,8);
SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
FROM tab1 ORDER BY pk;
SELECT * FROM tab2 ORDER BY col_7;
# stop the server
[2]: Check the page type summary with shortform for tab1.ibd
File::tab#.ibd
================PAGE TYPE SUMMARY==============
#PAGE_COUNT PAGE_TYPE
===============================================
# Index page
# Undo log page
# Inode page
# Insert buffer free list page
# Freshly allocated page
# Insert buffer bitmap
# System page
# Transaction system page
# File Space Header
# Extent descriptor page
# BLOB page
# Compressed BLOB page
# Page compressed page
# Page compressed encrypted page
# Other type of page
===============================================
Additional information:
Undo page type: # insert, # update, # other
Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
index_id #pages #leaf_pages #recs_per_page #bytes_per_page
# # # # #
# # # # #
# # # # #
index_id page_data_bytes_histgram(empty,...,oversized)
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
[3]: Check the page type summary with longform for tab1.ibd
File::tab#.ibd
================PAGE TYPE SUMMARY==============
#PAGE_COUNT PAGE_TYPE
===============================================
# Index page
# Undo log page
# Inode page
# Insert buffer free list page
# Freshly allocated page
# Insert buffer bitmap
# System page
# Transaction system page
# File Space Header
# Extent descriptor page
# BLOB page
# Compressed BLOB page
# Page compressed page
# Page compressed encrypted page
# Other type of page
===============================================
Additional information:
Undo page type: # insert, # update, # other
Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
index_id #pages #leaf_pages #recs_per_page #bytes_per_page
# # # # #
# # # # #
# # # # #
index_id page_data_bytes_histgram(empty,...,oversized)
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
[4]: Page type dump for with longform for tab1.ibd
# Print the contents stored in dump.txt
Filename::tab#.ibd
==============================================================================
PAGE_NO | PAGE_TYPE | EXTRA INFO
==============================================================================
#::# | File Space Header | -
#::# | Insert Buffer Bitmap | -
#::# | Inode page | -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Freshly allocated page | -
# Variables used by page type dump for ibdata1
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
verbose TRUE
count FALSE
start-page 0
end-page 0
page 0
strict-check crc32
no-check FALSE
allow-mismatches 0
write crc32
page-type-summary FALSE
page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
per-page-details FALSE
log (No default value)
leaf FALSE
merge 0
[5]: Page type dump for with shortform for tab1.ibd
Filename::tab#.ibd
==============================================================================
PAGE_NO | PAGE_TYPE | EXTRA INFO
==============================================================================
#::# | File Space Header | -
#::# | Insert Buffer Bitmap | -
#::# | Inode page | -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Freshly allocated page | -
[6]: check the valid lower bound values for option
# allow-mismatches,page,start-page,end-page
[9]: check the both short and long options "page" and "start-page" when
# seek value is larger than file size.
FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
[34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page.
# innochecksum will fail with error code: 1
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
DROP TABLE tab1,tab2;
mysql-test/suite/innodb/t/innochecksum.test
deleted
100644 → 0
View file @
67e3d1ee
#
# Test innochecksum
#
--
source
include
/
have_innodb
.
inc
# Embedded server test does not support restarting
--
source
include
/
not_embedded
.
inc
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
,
b
TEXT
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
(
b
)
VALUES
(
'corrupt me'
);
--
disable_query_log
--
let
$i
=
1000
while
(
$i
)
{
INSERT
INTO
t1
(
b
)
VALUES
(
REPEAT
(
'abcdefghijklmnopqrstuvwxyz'
,
100
));
dec
$i
;
}
--
enable_query_log
INSERT
INTO
t1
(
b
)
VALUES
(
'corrupt me'
);
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
--
source
include
/
shutdown_mysqld
.
inc
--
echo
# Run innochecksum on t1
--
disable_result_log
--
exec
$INNOCHECKSUM
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
--
enable_result_log
--
source
include
/
start_mysqld
.
inc
DROP
TABLE
t1
;
mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
deleted
100644 → 0
View file @
67e3d1ee
--skip-innodb-doublewrite
--innodb-file-per-table
--innodb_checksum_algorithm=crc32
mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
deleted
100644 → 0
View file @
67e3d1ee
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
--
source
include
/
innodb_page_size_small
.
inc
--
source
include
/
no_valgrind_without_big
.
inc
# Embedded server does not support crashing.
--
source
include
/
not_embedded
.
inc
# Avoid CrashReporter popup on Mac.
--
source
include
/
not_crashrep
.
inc
--
echo
# Set the environmental variables
let
MYSQLD_BASEDIR
=
`SELECT @@basedir`
;
let
MYSQLD_DATADIR
=
`SELECT @@datadir`
;
let
SEARCH_FILE
=
$MYSQLTEST_VARDIR
/
log
/
my_restart
.
err
;
call
mtr
.
add_suppression
(
"InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts"
);
call
mtr
.
add_suppression
(
"InnoDB: Warning: database page corruption or a failed"
);
CREATE
TABLE
tab1
(
c1
INT
PRIMARY
KEY
,
c2
VARCHAR
(
20
))
ENGINE
=
InnoDB
;
CREATE
INDEX
idx1
ON
tab1
(
c2
(
10
));
INSERT
INTO
tab1
VALUES
(
1
,
'Innochecksum InnoDB1'
);
CREATE
TABLE
t1
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
msg
VARCHAR
(
255
))
ENGINE
=
INNODB
ROW_FORMAT
=
COMPRESSED
KEY_BLOCK_SIZE
=
4
;
insert
into
t1
values
(
1
,
"i"
);
insert
into
t1
values
(
2
,
"am"
);
insert
into
t1
values
(
3
,
"compressed table"
);
--
echo
# Shutdown the Server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
# Server Default checksum = innodb
#
# Not repeatable with --parallel= >1
#
#--echo [1a]: check the innochecksum when file doesn't exists
#--error 1
#--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/aa.ibd 2> $SEARCH_FILE
#let SEARCH_PATTERN= Error: $MYSQLD_DATADIR/test/aa.ibd cannot be found;
#--source include/search_pattern_in_file.inc
--
echo
[
1
b
]
:
check
the
innochecksum
without
--
strict
-
check
--
exec
$INNOCHECKSUM
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
echo
[
2
]
:
check
the
innochecksum
with
full
form
--
strict
-
check
=
crc32
--
exec
$INNOCHECKSUM
--
strict
-
check
=
crc32
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
echo
[
3
]
:
check
the
innochecksum
with
short
form
-
C
crc32
--
exec
$INNOCHECKSUM
-
C
crc32
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
echo
[
4
]
:
check
the
innochecksum
with
--
no
-
check
ignores
algorithm
check
,
warning
is
expected
--
error
1
--
exec
$INNOCHECKSUM
--
no
-
check
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
--
no
-
check
must
be
associated
with
--
write
option
.
;
--
source
include
/
search_pattern_in_file
.
inc
--
echo
[
5
]
:
check
the
innochecksum
with
short
form
--
no
-
check
ignores
algorithm
check
,
warning
is
expected
--
error
1
--
exec
$INNOCHECKSUM
-
n
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
--
no
-
check
must
be
associated
with
--
write
option
.
;
--
source
include
/
search_pattern_in_file
.
inc
--
echo
[
6
]
:
check
the
innochecksum
with
full
form
strict
-
check
&
no
-
check
,
an
error
is
expected
--
error
1
--
exec
$INNOCHECKSUM
--
strict
-
check
=
innodb
--
no
-
check
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
--
strict
-
check
option
cannot
be
used
together
with
--
no
-
check
option
.
;
--
source
include
/
search_pattern_in_file
.
inc
--
echo
[
7
]
:
check
the
innochecksum
with
short
form
strict
-
check
&
no
-
check
,
an
error
is
expected
--
error
1
--
exec
$INNOCHECKSUM
-
C
innodb
-
n
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
--
strict
-
check
option
cannot
be
used
together
with
--
no
-
check
option
.
;
--
source
include
/
search_pattern_in_file
.
inc
--
echo
[
8
]
:
check
the
innochecksum
with
short
&
full
form
combination
--
echo
# strict-check & no-check, an error is expected
--
error
1
--
exec
$INNOCHECKSUM
--
strict
-
check
=
innodb
-
n
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
--
strict
-
check
option
cannot
be
used
together
with
--
no
-
check
option
.
;
--
source
include
/
search_pattern_in_file
.
inc
--
echo
[
9
]
:
check
the
innochecksum
with
full
form
--
strict
-
check
=
innodb
# Server Default checksum = crc32
--
error
1
--
exec
$INNOCHECKSUM
--
strict
-
check
=
innodb
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
--
echo
[
10
]
:
check
the
innochecksum
with
full
form
--
strict
-
check
=
none
--
echo
# when server Default checksum=crc32
--
error
1
--
exec
$INNOCHECKSUM
--
strict
-
check
=
none
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
--
echo
[
11
]
:
check
the
innochecksum
with
short
form
-
C
innodb
--
echo
# when server Default checksum=crc32
--
error
1
--
exec
$INNOCHECKSUM
-
C
innodb
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
--
echo
[
12
]
:
check
the
innochecksum
with
short
form
-
C
none
--
echo
# when server Default checksum=crc32
--
error
1
--
exec
$INNOCHECKSUM
-
C
none
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
--
echo
[
13
]
:
check
strict
-
check
with
invalid
values
--
error
1
--
exec
$INNOCHECKSUM
--
strict
-
check
=
strict_innodb
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
while
setting
value
\
'strict_innodb\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM -C strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM --strict-check=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM -C strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM --strict-check=strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM -C strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM --strict-check=InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM -C InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2>$SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM --strict-check=crc $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'crc\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--error 1
--exec $INNOCHECKSUM --strict-check=no $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= Error while setting value \'no\' to \'strict-check\';
--source include/search_pattern_in_file.inc
--echo [14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
--echo # Also check the long form of write option.
--exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/t1.ibd
# Rewrite done, verify with --strict-check=crc32
--exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/t1.ibd
--echo [14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
--echo # Also check the long form of write option.
--exec $INNOCHECKSUM --no-check --write=innodb $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=crc32 --write=innodb $MYSQLD_DATADIR/test/t1.ibd
# Rewrite done, verify with --strict-check=innodb
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd
--echo # start the server with innodb_checksum_algorithm=InnoDB
--let $restart_parameters= --innodb_checksum_algorithm=innodb
--source include/start_mysqld.inc
INSERT INTO tab1 VALUES(2, '
Innochecksum
CRC32
');
SELECT c1,c2 FROM tab1 order by c1,c2;
--echo # Stop the server
--source include/shutdown_mysqld.inc
--echo [15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
--echo # Also check the short form of write option.
--exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/t1.ibd
# Rewrite done, verify with --strict-check=none
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/t1.ibd
--echo # Start the server with checksum algorithm=none
--let $restart_parameters= --innodb_checksum_algorithm=none
--source include/start_mysqld.inc
INSERT INTO tab1 VALUES(3, '
Innochecksum
None
'
);
SELECT
c1
,
c2
FROM
tab1
order
by
c1
,
c2
;
DROP
TABLE
t1
;
--
echo
# Stop the server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
16
]
:
rewrite
into
new
checksum
=
crc32
with
innochecksum
--
exec
$INNOCHECKSUM
--
no
-
check
--
write
=
crc32
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
echo
# Restart the DB server with innodb_checksum_algorithm=crc32
--
let
$restart_parameters
=
--
innodb_checksum_algorithm
=
crc32
--
source
include
/
start_mysqld
.
inc
SELECT
*
FROM
tab1
;
DELETE
FROM
tab1
where
c1
=
3
;
SELECT
c1
,
c2
FROM
tab1
order
by
c1
,
c2
;
--
echo
# Stop server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
17
]
:
rewrite
into
new
checksum
=
InnoDB
--
exec
$INNOCHECKSUM
--
no
-
check
--
write
=
InnoDB
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
echo
# Restart the DB server with innodb_checksum_algorithm=InnoDB
--
let
$restart_parameters
=
--
innodb_checksum_algorithm
=
innodb
--
source
include
/
start_mysqld
.
inc
DELETE
FROM
tab1
where
c1
=
2
;
SELECT
*
FROM
tab1
;
--
echo
# Stop server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
18
]
:
check
Innochecksum
with
invalid
write
options
--
error
1
--
exec
$INNOCHECKSUM
--
no
-
check
--
write
=
strict_crc32
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
while
setting
value
\'
strict_crc32
\'
to
\'
write
\'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
--
no
-
check
--
write
=
strict_innodb
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
while
setting
value
\'
strict_innodb
\'
to
\'
write
\'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
--
no
-
check
--
write
=
crc23
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
while
setting
value
\'
crc23
\'
to
\'
write
\'
;
--
source
include
/
search_pattern_in_file
.
inc
--
remove_file
$SEARCH_FILE
# Cleanup
--
let
$restart_parameters
=
--
source
include
/
start_mysqld
.
inc
DROP
TABLE
tab1
;
mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
deleted
100644 → 0
View file @
67e3d1ee
--skip-innodb-doublewrite
--innodb-file-per-table
--innodb-change-buffering=none
mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
deleted
100644 → 0
View file @
67e3d1ee
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
--
source
include
/
innodb_page_size_small
.
inc
--
source
include
/
have_debug
.
inc
--
source
include
/
no_valgrind_without_big
.
inc
# Avoid CrashReporter popup on Mac.
--
source
include
/
not_crashrep
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
big_test
.
inc
--
disable_query_log
# This warning occurs due to small buffer pool size(i.e. 8MB). It doesn't occur
# with --mysqld=--innodb_buffer_pool_size=10MB
call
mtr
.
add_suppression
(
"
\\
[Warning
\\
] InnoDB: Difficult to find free blocks in the buffer pool.*"
);
--
enable_query_log
let
MYSQLD_BASEDIR
=
`SELECT @@basedir`
;
let
MYSQLD_DATADIR
=
`SELECT @@datadir`
;
let
SEARCH_FILE
=
$MYSQLTEST_VARDIR
/
log
/
my_restart
.
err
;
SET
GLOBAL
innodb_compression_level
=
0
;
SELECT
@@
innodb_compression_level
;
CREATE
TABLE
t1
(
j
LONGBLOB
)
ENGINE
=
InnoDB
ROW_FORMAT
=
COMPRESSED
KEY_BLOCK_SIZE
=
1
;
INSERT
INTO
t1
VALUES
(
repeat
(
'abcdefghijklmnopqrstuvwxyz'
,
200
));
let
$i
=
10
;
while
(
$i
>
0
)
{
INSERT
INTO
t1
SELECT
*
from
t1
;
dec
$i
;
}
--
echo
# stop the server
--
source
include
/
shutdown_mysqld
.
inc
# Page_type_dump for t1
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
exec
$INNOCHECKSUM
-
v
--
page
-
type
-
dump
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
--
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
--
echo
[
1
]
:
# check the both short and long options for "help"
--
exec
$INNOCHECKSUM
--
help
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
>
$MYSQLTEST_VARDIR
/
tmp
/
help_output_long
.
txt
--
exec
$INNOCHECKSUM
-
I
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
>
$MYSQLTEST_VARDIR
/
tmp
/
help_output_short
.
txt
--
diff_files
$MYSQLTEST_VARDIR
/
tmp
/
help_output_long
.
txt
$MYSQLTEST_VARDIR
/
tmp
/
help_output_short
.
txt
--
echo
[
2
]
:
# Run the innochecksum when file isn't provided.
--
echo
# It will print the innochecksum usage similar to --help option.
--
error
1
--
exec
$INNOCHECKSUM
>
$MYSQLTEST_VARDIR
/
tmp
/
usage
.
txt
--
diff_files
$MYSQLTEST_VARDIR
/
tmp
/
help_output_long
.
txt
$MYSQLTEST_VARDIR
/
tmp
/
usage
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
usage
.
txt
perl
;
use
strict
;
use
warnings
;
use
File
::Copy
;
my
$dir
=
$ENV
{
'MYSQLTEST_VARDIR'
};
my
$file
=
'help_output_long.txt'
;
# open file in write mode
open
IN_FILE
,
"<"
,
"
$dir
/tmp/
$file
"
or
die
$
!
;
open
OUT_FILE
,
">"
,
"
$dir
/tmp/tmpfile"
or
die
$
!
;
while
(
<
IN_FILE
>
)
{
unless
(
$_
=~
/^
debug
.*
$
/
||
$_
=~
/
\
-
#, \-\-debug.*$/ || $_=~ /http:.*html/) {
$_
=~
s
/^
\S
*
innochecksum
.+
Ver
.+
[
0
-
9
]
*
\
.
[
0
-
9
]
*
\
.
[
0
-
9
]
*.+
$
/
innochecksum
Ver
#.#.#/g;
$_
=~
s
/
(
Copyright\s
\
(
c
\
))
\s
([
0
-
9
]
*
),
\s
([
0
-
9
]
*
)(
.*
)
/
$
1
YEAR
,
YEAR
$
4
/
g
;
$_
=~
s
/
Usage
:.*
\
[
-
c
/
Usage
:
innochecksum
[
-
c
/
g
;
print
OUT_FILE
$_
;
}
}
close
(
IN_FILE
);
close
(
OUT_FILE
);
# move the new content from tmp file to the orginal file.
move
(
"
$dir
/tmp/tmpfile"
,
"
$dir
/tmp/
$file
"
);
EOF
--
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
help_output_long
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
help_output_long
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
help_output_short
.
txt
--
echo
[
3
]
:
# check the both short and long options for "count" and exit
--
replace_regex
/
[
0
-
9
]
+/
#/
--
exec
$INNOCHECKSUM
--
count
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
--
replace_regex
/
[
0
-
9
]
+/
#/
--
exec
$INNOCHECKSUM
-
c
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
--
echo
[
4
]
:
# Print the version of innochecksum and exit
--
replace_regex
/.*
innochecksum
.*
Ver
.*
[
0
-
9
]
*.
[
0
-
9
]
*.
[
0
-
9
]
*.*/
innochecksum
Ver
#.#.#/
--
exec
$INNOCHECKSUM
-
V
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
--
echo
# Restart the DB server
--
source
include
/
start_mysqld
.
inc
DROP
TABLE
t1
;
--
echo
[
5
]
:
# Check the innochecksum for compressed table t1 with different key_block_size
--
echo
# Test for KEY_BLOCK_SIZE=1
--
let
$size
=
1
--
source
../
include
/
innodb
-
wl6045
.
inc
--
echo
# Test for KEY_BLOCK_SIZE=2
--
let
$size
=
2
--
source
../
include
/
innodb
-
wl6045
.
inc
--
echo
# Test for for KEY_BLOCK_SIZE=4
--
let
$size
=
4
--
source
../
include
/
innodb
-
wl6045
.
inc
set
innodb_strict_mode
=
off
;
--
echo
# Test for for KEY_BLOCK_SIZE=8
--
let
$size
=
8
--
source
../
include
/
innodb
-
wl6045
.
inc
set
innodb_strict_mode
=
off
;
--
echo
# Test for KEY_BLOCK_SIZE=16
--
let
$size
=
16
--
source
../
include
/
innodb
-
wl6045
.
inc
--
echo
# Test[5] completed
mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
deleted
100644 → 0
View file @
67e3d1ee
--innodb-file-per-table
mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
deleted
100644 → 0
View file @
67e3d1ee
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
--
source
include
/
innodb_page_size_small
.
inc
--
source
include
/
no_valgrind_without_big
.
inc
# Embedded server does not support crashing.
--
source
include
/
not_embedded
.
inc
# Avoid CrashReporter popup on Mac.
--
source
include
/
not_crashrep
.
inc
--
echo
# Set the environmental variables
let
MYSQLD_BASEDIR
=
`SELECT @@basedir`
;
let
MYSQLD_DATADIR
=
`SELECT @@datadir`
;
let
SEARCH_FILE
=
$MYSQLTEST_VARDIR
/
log
/
my_restart
.
err
;
call
mtr
.
add_suppression
(
"InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts"
);
call
mtr
.
add_suppression
(
"InnoDB: innodb_checksum_algorithm is set to.*"
);
--
echo
[
1
]
:
Further
Test
are
for
rewrite
checksum
(
innodb
|
crc32
|
none
)
for
all
ibd
file
&
start
the
server
.
CREATE
TABLE
tab1
(
pk
INTEGER
NOT
NULL
PRIMARY
KEY
,
linestring_key
GEOMETRY
NOT
NULL
,
linestring_nokey
GEOMETRY
NOT
NULL
)
ENGINE
=
InnoDB
;
INSERT
INTO
tab1
(
pk
,
linestring_key
,
linestring_nokey
)
VALUES
(
1
,
ST_GeomFromText
(
'POINT(10 10) '
),
ST_GeomFromText
(
'POINT(10 10) '
));
CREATE
INDEX
linestring_index
ON
tab1
(
linestring_nokey
(
5
));
ALTER
TABLE
tab1
ADD
KEY
(
linestring_key
(
5
));
--
echo
# create a compressed table
CREATE
TABLE
tab2
(
col_1
CHAR
(
255
)
,
col_2
VARCHAR
(
255
),
col_3
longtext
,
col_4
longtext
,
col_5
longtext
,
col_6
longtext
,
col_7
int
)
engine
=
innodb
row_format
=
compressed
key_block_size
=
4
;
CREATE
INDEX
idx1
ON
tab2
(
col_3
(
10
));
CREATE
INDEX
idx2
ON
tab2
(
col_4
(
10
));
CREATE
INDEX
idx3
ON
tab2
(
col_5
(
10
));
# load the with repeat function
SET
@
col_1
=
repeat
(
'a'
,
5
);
SET
@
col_2
=
repeat
(
'b'
,
20
);
SET
@
col_3
=
repeat
(
'c'
,
100
);
SET
@
col_4
=
repeat
(
'd'
,
100
);
SET
@
col_5
=
repeat
(
'e'
,
100
);
SET
@
col_6
=
repeat
(
'f'
,
100
);
# insert 5 records
let
$i
=
5
;
while
(
$i
)
{
eval
INSERT
INTO
tab2
(
col_1
,
col_2
,
col_3
,
col_4
,
col_5
,
col_6
,
col_7
)
VALUES
(
@
col_1
,
@
col_2
,
@
col_3
,
@
col_4
,
@
cl_5
,
@
col_6
,
$i
);
dec
$i
;
}
--
disable_result_log
SELECT
*
FROM
tab2
ORDER
BY
col_7
;
--
echo
# stop the server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
1
(
a
)]
:
Rewrite
into
new
checksum
=
InnoDB
for
all
*.
ibd
file
and
ibdata1
--
exec
$INNOCHECKSUM
--
write
=
InnoDB
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
--
write
=
InnoDB
$MYSQLD_DATADIR
/
test
/
tab2
.
ibd
--
exec
$INNOCHECKSUM
--
write
=
InnoDB
$MYSQLD_DATADIR
/
ibdata1
perl
;
foreach
(
glob
(
"
$ENV
{
MYSQLD_DATADIR
}
/*/*.ibd"
))
{
system
(
"
$ENV
{
INNOCHECKSUM
}
--no-check --write=InnoDB
$_
"
)
}
EOF
--
echo
:
start
the
server
with
innodb_checksum_algorithm
=
strict_innodb
--
let
$restart_parameters
=
--
innodb_checksum_algorithm
=
strict_innodb
--
source
include
/
start_mysqld
.
inc
INSERT
INTO
tab1
(
pk
,
linestring_key
,
linestring_nokey
)
VALUES
(
2
,
ST_GeomFromText
(
'LINESTRING(10 10,20 20,30 30)'
),
ST_GeomFromText
(
'LINESTRING(10 10,20 20,30 30)'
));
# load the with repeat function
SET
@
col_1
=
repeat
(
'a'
,
5
);
SET
@
col_2
=
repeat
(
'b'
,
20
);
SET
@
col_3
=
repeat
(
'c'
,
100
);
SET
@
col_4
=
repeat
(
'd'
,
100
);
SET
@
col_5
=
repeat
(
'e'
,
100
);
SET
@
col_6
=
repeat
(
'f'
,
100
);
# check the table status is GOOD with DML
let
$i
=
6
;
eval
INSERT
INTO
tab2
(
col_1
,
col_2
,
col_3
,
col_4
,
col_5
,
col_6
,
col_7
)
VALUES
(
@
col_1
,
@
col_2
,
@
col_3
,
@
col_4
,
@
cl_5
,
@
col_6
,
$i
);
--
disable_result_log
SELECT
pk
,
ST_AsText
(
linestring_key
),
ST_AsText
(
linestring_nokey
)
FROM
tab1
ORDER
BY
pk
;
--
disable_result_log
SELECT
*
FROM
tab2
ORDER
BY
col_7
;
--
echo
# stop the server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
1
(
b
)]
:
Rewrite
into
new
checksum
=
crc32
for
all
*.
ibd
file
and
ibdata1
--
exec
$INNOCHECKSUM
--
write
=
CRC32
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
--
write
=
CRC32
$MYSQLD_DATADIR
/
test
/
tab2
.
ibd
--
exec
$INNOCHECKSUM
--
write
=
CRC32
$MYSQLD_DATADIR
/
ibdata1
perl
;
foreach
(
glob
(
"
$ENV
{
MYSQLD_DATADIR
}
/*/*.ibd"
))
{
system
(
"
$ENV
{
INNOCHECKSUM
}
--no-check --write=crc32
$_
"
)
}
EOF
--
echo
# start the server with innodb_checksum_algorithm=strict_crc32
--
let
$restart_parameters
=
--
innodb_checksum_algorithm
=
strict_crc32
--
source
include
/
start_mysqld
.
inc
# check the table status is GOOD with DML
INSERT
INTO
tab1
(
pk
,
linestring_key
,
linestring_nokey
)
VALUES
(
3
,
ST_GeomFromText
(
'POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'
),
ST_GeomFromText
(
'POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'
));
# load the with repeat function
SET
@
col_1
=
repeat
(
'g'
,
5
);
SET
@
col_2
=
repeat
(
'h'
,
20
);
SET
@
col_3
=
repeat
(
'i'
,
100
);
SET
@
col_4
=
repeat
(
'j'
,
100
);
SET
@
col_5
=
repeat
(
'k'
,
100
);
SET
@
col_6
=
repeat
(
'l'
,
100
);
# check the table status is GOOD with DML
let
$i
=
7
;
eval
INSERT
INTO
tab2
(
col_1
,
col_2
,
col_3
,
col_4
,
col_5
,
col_6
,
col_7
)
VALUES
(
@
col_1
,
@
col_2
,
@
col_3
,
@
col_4
,
@
cl_5
,
@
col_6
,
$i
);
# check the records from table
--
disable_result_log
SELECT
pk
,
ST_AsText
(
linestring_key
),
ST_AsText
(
linestring_nokey
)
FROM
tab1
ORDER
BY
pk
;
--
disable_result_log
SELECT
*
FROM
tab2
ORDER
BY
col_7
;
--
echo
# stop the server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
1
(
c
)]
:
Rewrite
into
new
checksum
=
none
for
all
*.
ibd
file
and
ibdata1
--
exec
$INNOCHECKSUM
--
write
=
none
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
--
write
=
none
$MYSQLD_DATADIR
/
test
/
tab2
.
ibd
--
exec
$INNOCHECKSUM
--
write
=
none
$MYSQLD_DATADIR
/
ibdata1
perl
;
foreach
(
glob
(
"
$ENV
{
MYSQLD_DATADIR
}
/undo*"
))
{
system
(
"
$ENV
{
INNOCHECKSUM
}
--no-check --write=NONE
$_
"
)
}
foreach
(
glob
(
"
$ENV
{
MYSQLD_DATADIR
}
/*/*.ibd"
))
{
system
(
"
$ENV
{
INNOCHECKSUM
}
--no-check --write=NONE
$_
"
)
}
EOF
--
let
$restart_parameters
=
--
innodb_checksum_algorithm
=
strict_none
--
source
include
/
start_mysqld
.
inc
--
let
$restart_parameters
=
# check the table status is GOOD with DML
INSERT
INTO
tab1
(
pk
,
linestring_key
,
linestring_nokey
)
VALUES
(
4
,
ST_GeomFromText
(
'MULTIPOINT(0 0,5 5,10 10,20 20) '
),
ST_GeomFromText
(
'MULTIPOINT(0 0,5 5,10 10,20 20) '
));
# load the with repeat function
SET
@
col_1
=
repeat
(
'm'
,
5
);
SET
@
col_2
=
repeat
(
'n'
,
20
);
SET
@
col_3
=
repeat
(
'o'
,
100
);
SET
@
col_4
=
repeat
(
'p'
,
100
);
SET
@
col_5
=
repeat
(
'q'
,
100
);
SET
@
col_6
=
repeat
(
'r'
,
100
);
# check the table status is GOOD with DML
let
$i
=
8
;
eval
INSERT
INTO
tab2
(
col_1
,
col_2
,
col_3
,
col_4
,
col_5
,
col_6
,
col_7
)
VALUES
(
@
col_1
,
@
col_2
,
@
col_3
,
@
col_4
,
@
cl_5
,
@
col_6
,
$i
);
# check the records from table
--
disable_result_log
SELECT
pk
,
ST_AsText
(
linestring_key
),
ST_AsText
(
linestring_nokey
)
FROM
tab1
ORDER
BY
pk
;
--
disable_result_log
SELECT
*
FROM
tab2
ORDER
BY
col_7
;
--
enable_result_log
--
echo
# stop the server
--
source
include
/
shutdown_mysqld
.
inc
--
echo
[
2
]
:
Check
the
page
type
summary
with
shortform
for
tab1
.
ibd
--
replace_regex
/
File
.*.
ibd
/
File
::
tab1
.
ibd
/
/
[
0
-
9
]
+/
#/
--
exec
$INNOCHECKSUM
-
S
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$MYSQLTEST_VARDIR
/
tmp
/
page_summary_short
.
txt
--
echo
[
3
]
:
Check
the
page
type
summary
with
longform
for
tab1
.
ibd
--
replace_regex
/
File
.*.
ibd
/
File
::
tab1
.
ibd
/
/
[
0
-
9
]
+/
#/
--
exec
$INNOCHECKSUM
--
page
-
type
-
summary
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$MYSQLTEST_VARDIR
/
tmp
/
page_summary_long
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
page_summary_short
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
page_summary_long
.
txt
--
echo
[
4
]
:
Page
type
dump
for
with
longform
for
tab1
.
ibd
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
exec
$INNOCHECKSUM
--
page
-
type
-
dump
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
perl
;
use
strict
;
use
warnings
;
use
File
::Copy
;
my
$dir
=
$ENV
{
'MYSQLTEST_VARDIR'
};
opendir
(
DIR
,
$dir
)
or
die
$
!
;
my
$file
=
'dump.txt'
;
# open file in write mode
open
IN_FILE
,
"<"
,
"
$dir
/tmp/
$file
"
or
die
$
!
;
open
OUT_FILE
,
">"
,
"
$dir
/tmp/innochecksum_3_tempfile"
or
die
$
!
;
while
(
<
IN_FILE
>
)
{
# Replace the intergers to # and complete file path to file name only.
$_
=~
s
/
Filename
.+/
Filename
::
tab1
.
ibd
/
g
;
$_
=~
s
/
\d
+/
#/g;
print
OUT_FILE
$_
;
}
close
(
IN_FILE
);
close
(
OUT_FILE
);
# move the new content from tmp file to the orginal file.
move
(
"
$dir
/tmp/innochecksum_3_tempfile"
,
"
$dir
/tmp/
$file
"
);
closedir
(
DIR
);
EOF
--
echo
# Print the contents stored in dump.txt
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
;
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
--
echo
# Variables used by page type dump for ibdata1
--
exec
$INNOCHECKSUM
-
v
--
page
-
type
-
dump
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
$MYSQLD_DATADIR
/
ibdata1
>
$MYSQLTEST_VARDIR
/
tmp
/
page_verbose_summary
.
txt
--
file_exists
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
perl
;
use
strict
;
use
warnings
;
use
File
::Copy
;
my
$dir
=
$ENV
{
'MYSQLTEST_VARDIR'
};
opendir
(
DIR
,
$dir
)
or
die
$
!
;
my
$file
=
'page_verbose_summary.txt'
;
# open file in write mode
open
IN_FILE
,
"<"
,
"
$dir
/tmp/
$file
"
or
die
$
!
;
open
OUT_FILE
,
">"
,
"
$dir
/tmp/innochecksum_3_tempfile"
or
die
$
!
;
while
(
<
IN_FILE
>
)
{
# Replace complete file path to file name only.
$_
=~
s
/
$dir
/
MYSQLTEST_VARDIR
/
;
# Remove debug option, which is not in all builds
next
if
(
/
debug
/
);
print
OUT_FILE
$_
;
}
close
(
IN_FILE
);
close
(
OUT_FILE
);
# move the new content from tmp file to the orginal file.
move
(
"
$dir
/tmp/innochecksum_3_tempfile"
,
"
$dir
/tmp/
$file
"
);
closedir
(
DIR
);
EOF
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
page_verbose_summary
.
txt
;
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
page_verbose_summary
.
txt
--
echo
[
5
]
:
Page
type
dump
for
with
shortform
for
tab1
.
ibd
--
exec
$INNOCHECKSUM
-
D
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
perl
;
use
strict
;
use
warnings
;
use
File
::Copy
;
my
$dir
=
$ENV
{
'MYSQLTEST_VARDIR'
};
opendir
(
DIR
,
$dir
)
or
die
$
!
;
my
$file
=
'dump.txt'
;
# open file in write mode
open
IN_FILE
,
"<"
,
"
$dir
/tmp/
$file
"
or
die
$
!
;
open
OUT_FILE
,
">"
,
"
$dir
/tmp/innochecksum_3_tempfile"
or
die
$
!
;
while
(
<
IN_FILE
>
)
{
# Replace the intergers to # and complete file path to file name only.
$_
=~
s
/
Filename
.+/
Filename
::
tab1
.
ibd
/
g
;
$_
=~
s
/
\d
+/
#/g;
print
OUT_FILE
$_
;
}
close
(
IN_FILE
);
close
(
OUT_FILE
);
# move the new content from tmp file to the orginal file.
move
(
"
$dir
/tmp/innochecksum_3_tempfile"
,
"
$dir
/tmp/
$file
"
);
closedir
(
DIR
);
EOF
# Print the contents stored in dump.txt
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
;
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
dump
.
txt
--
echo
[
6
]
:
check
the
valid
lower
bound
values
for
option
--
echo
# allow-mismatches,page,start-page,end-page
--
exec
$INNOCHECKSUM
--
allow
-
mismatches
=
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
-
a
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
--
page
=
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
-
p
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
--
start
-
page
=
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
-
s
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
--
end
-
page
=
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
--
exec
$INNOCHECKSUM
-
e
0
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
#
# These produce now errors
#
#--echo [7]: check the negative values for option
#--echo # allow-mismatches,page,start-page,end-page.
#--echo # They will reset to zero for negative values.
#--echo # check the invalid lower bound values
#--exec $INNOCHECKSUM --allow-mismatches=-1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -a -1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM --page=-1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -p -1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM --start-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -s -1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM --end-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -e -1 $MYSQLD_DATADIR/test/tab1.ibd
#
#--echo [8]: check the valid upper bound values for
#--echo # both short and long options "allow-mismatches" and "end-page"
#
#--exec $INNOCHECKSUM --allow-mismatches=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -a 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM --end-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
#--exec $INNOCHECKSUM -e 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
--
echo
[
9
]
:
check
the
both
short
and
long
options
"page"
and
"start-page"
when
--
echo
# seek value is larger than file size.
--
error
1
--
exec
$INNOCHECKSUM
--
page
=
18446744073709551615
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
Unable
to
seek
to
necessary
offset
:
Invalid
argument
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
-
p
18446744073709551615
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
Unable
to
seek
to
necessary
offset
:
Invalid
argument
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
--
start
-
page
=
18446744073709551615
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
Unable
to
seek
to
necessary
offset
:
Invalid
argument
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
-
s
18446744073709551615
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Error
:
Unable
to
seek
to
necessary
offset
:
Invalid
argument
;
--
source
include
/
search_pattern_in_file
.
inc
--
echo
[
34
]
:
check
the
invalid
upper
bound
values
for
options
,
allow
-
mismatches
,
end
-
page
,
start
-
page
and
page
.
--
echo
# innochecksum will fail with error code: 1
--
error
1
--
exec
$INNOCHECKSUM
--
allow
-
mismatches
=
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
-
a
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
--
end
-
page
=
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
-
e
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
--
page
=
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
-
p
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
--
start
-
page
=
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
error
1
--
exec
$INNOCHECKSUM
-
s
18446744073709551616
$MYSQLD_DATADIR
/
test
/
tab1
.
ibd
2
>
$SEARCH_FILE
let
SEARCH_PATTERN
=
Incorrect
unsigned
integer
value
:
'18446744073709551616'
;
--
source
include
/
search_pattern_in_file
.
inc
--
remove_file
$SEARCH_FILE
# Cleanup
--
source
include
/
start_mysqld
.
inc
DROP
TABLE
tab1
,
tab2
;
mysql-test/suite/mariabackup/encrypted_page_corruption.opt
0 → 100644
View file @
fd37344f
--innodb-encrypt-log=ON
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--loose-file-key-management
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc
--loose-file-key-management-encryption-algorithm=aes_cbc
mysql-test/suite/mariabackup/encrypted_page_corruption.result
0 → 100644
View file @
fd37344f
call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
insert into t1 select repeat('a',100);
# Corrupt the table
# xtrabackup backup
FOUND 1 /Database page corruption detected/ in backup.log
drop table t1;
mysql-test/suite/mariabackup/encrypted_page_corruption.test
0 → 100644
View file @
fd37344f
--
source
include
/
have_file_key_management
.
inc
call
mtr
.
add_suppression
(
"
\\
[ERROR
\\
] InnoDB: The page .* in file .* cannot be decrypted."
);
call
mtr
.
add_suppression
(
"
\\
[ERROR
\\
] InnoDB: Table `test`
\\
.`t1` has an unreadable root page"
);
CREATE
TABLE
t1
(
c
VARCHAR
(
128
))
ENGINE
INNODB
,
encrypted
=
yes
;
insert
into
t1
select
repeat
(
'a'
,
100
);
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
let
t1_IBD
=
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
;
--
source
include
/
shutdown_mysqld
.
inc
--
echo
# Corrupt the table
perl
;
use
strict
;
use
warnings
;
use
Fcntl
qw(:DEFAULT :seek)
;
my
$ibd_file
=
$ENV
{
't1_IBD'
};
my
$chunk
;
my
$len
;
sysopen
IBD_FILE
,
$ibd_file
,
O_RDWR
||
die
"Unable to open
$ibd_file
"
;
sysseek
IBD_FILE
,
16384
*
3
,
SEEK_CUR
;
$chunk
=
'\xAA\xAA\xAA\xAA'
;
syswrite
IBD_FILE
,
$chunk
,
4
;
close
IBD_FILE
;
EOF
--
source
include
/
start_mysqld
.
inc
echo
# xtrabackup backup;
let
$targetdir
=
$MYSQLTEST_VARDIR
/
tmp
/
backup
;
let
$backuplog
=
$MYSQLTEST_VARDIR
/
tmp
/
backup
.
log
;
--
disable_result_log
--
error
1
exec
$XTRABACKUP
--
defaults
-
file
=
$MYSQLTEST_VARDIR
/
my
.
cnf
--
backup
--
target
-
dir
=
$targetdir
>
$backuplog
;
--
enable_result_log
--
let
SEARCH_PATTERN
=
Database
page
corruption
detected
--
let
SEARCH_FILE
=
$backuplog
--
source
include
/
search_pattern_in_file
.
inc
remove_file
$backuplog
;
drop
table
t1
;
rmdir
$targetdir
;
sql/sql_class.cc
View file @
fd37344f
/*
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 201
7
, MariaDB Corporation.
Copyright (c) 2008, 201
8
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -4801,7 +4801,8 @@ extern "C" int thd_slave_thread(const MYSQL_THD thd)
...
@@ -4801,7 +4801,8 @@ extern "C" int thd_slave_thread(const MYSQL_THD thd)
extern
"C"
int
thd_rpl_stmt_based
(
const
MYSQL_THD
thd
)
extern
"C"
int
thd_rpl_stmt_based
(
const
MYSQL_THD
thd
)
{
{
return
!
thd
->
is_current_stmt_binlog_format_row
()
&&
return
thd
&&
!
thd
->
is_current_stmt_binlog_format_row
()
&&
!
thd
->
is_current_stmt_binlog_disabled
();
!
thd
->
is_current_stmt_binlog_disabled
();
}
}
...
...
sql/sql_parse.cc
View file @
fd37344f
...
@@ -603,7 +603,8 @@ void init_update_queries(void)
...
@@ -603,7 +603,8 @@ void init_update_queries(void)
sql_command_flags
[
SQLCOM_DELETE
]
=
CF_CHANGES_DATA
|
CF_REEXECUTION_FRAGILE
|
sql_command_flags
[
SQLCOM_DELETE
]
=
CF_CHANGES_DATA
|
CF_REEXECUTION_FRAGILE
|
CF_CAN_GENERATE_ROW_EVENTS
|
CF_CAN_GENERATE_ROW_EVENTS
|
CF_OPTIMIZER_TRACE
|
CF_OPTIMIZER_TRACE
|
CF_CAN_BE_EXPLAINED
;
CF_CAN_BE_EXPLAINED
|
CF_SP_BULK_SAFE
;
sql_command_flags
[
SQLCOM_DELETE_MULTI
]
=
CF_CHANGES_DATA
|
CF_REEXECUTION_FRAGILE
|
sql_command_flags
[
SQLCOM_DELETE_MULTI
]
=
CF_CHANGES_DATA
|
CF_REEXECUTION_FRAGILE
|
CF_CAN_GENERATE_ROW_EVENTS
|
CF_CAN_GENERATE_ROW_EVENTS
|
CF_OPTIMIZER_TRACE
|
CF_OPTIMIZER_TRACE
|
...
...
tests/mysql_client_test.c
View file @
fd37344f
...
@@ -20305,8 +20305,67 @@ static void test_bulk_autoinc()
...
@@ -20305,8 +20305,67 @@ static void test_bulk_autoinc()
myquery
(
rc
);
myquery
(
rc
);
}
}
#endif
static
void
test_bulk_delete
()
{
int
rc
;
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
1
];
MYSQL_ROW
row
;
char
indicator
[]
=
{
0
,
0
,
0
};
my_bool
error
[
1
];
int
i
,
id
[]
=
{
1
,
2
,
4
},
count
=
sizeof
(
id
)
/
sizeof
(
id
[
0
]);
MYSQL_RES
*
result
;
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t1 (id int not null primary key)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"INSERT INTO t1 VALUES (1),(2),(3),(4)"
);
myquery
(
rc
);
verify_affected_rows
(
4
);
stmt
=
mysql_stmt_init
(
mysql
);
rc
=
mysql_stmt_prepare
(
stmt
,
"DELETE FROM t1 where id=?"
,
-
1
);
check_execute
(
stmt
,
rc
);
memset
(
bind
,
0
,
sizeof
(
bind
));
bind
[
0
].
buffer_type
=
MYSQL_TYPE_LONG
;
bind
[
0
].
buffer
=
(
void
*
)
id
;
bind
[
0
].
buffer_length
=
0
;
bind
[
0
].
is_null
=
NULL
;
bind
[
0
].
length
=
NULL
;
bind
[
0
].
error
=
error
;
bind
[
0
].
u
.
indicator
=
indicator
;
mysql_stmt_attr_set
(
stmt
,
STMT_ATTR_ARRAY_SIZE
,
(
void
*
)
&
count
);
rc
=
mysql_stmt_bind_param
(
stmt
,
bind
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
verify_affected_rows
(
3
);
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"SELECT id FROM t1"
);
myquery
(
rc
);
result
=
mysql_store_result
(
mysql
);
mytest
(
result
);
i
=
0
;
while
((
row
=
mysql_fetch_row
(
result
)))
{
i
++
;
DIE_IF
(
atoi
(
row
[
0
])
!=
3
);
}
DIE_IF
(
i
!=
1
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE t1"
);
myquery
(
rc
);
}
#endif
static
void
print_metadata
(
MYSQL_RES
*
rs_metadata
,
int
num_fields
)
static
void
print_metadata
(
MYSQL_RES
*
rs_metadata
,
int
num_fields
)
{
{
...
@@ -20915,6 +20974,7 @@ static struct my_tests_st my_tests[]= {
...
@@ -20915,6 +20974,7 @@ static struct my_tests_st my_tests[]= {
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
{
"test_proxy_header"
,
test_proxy_header
},
{
"test_proxy_header"
,
test_proxy_header
},
{
"test_bulk_autoinc"
,
test_bulk_autoinc
},
{
"test_bulk_autoinc"
,
test_bulk_autoinc
},
{
"test_bulk_delete"
,
test_bulk_delete
},
#endif
#endif
{
"test_explain_meta"
,
test_explain_meta
},
{
"test_explain_meta"
,
test_explain_meta
},
{
0
,
0
}
{
0
,
0
}
...
...
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