Commit b2fa874e authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28181 The innochecksum -w option was inadvertently removed

In commit 7a4fbb55 (MDEV-25105)
the innochecksum option --write (-w) was removed altogether.
It should have been made a Boolean option, so that old data files
may be converted to a format that is compatible with
innodb_checksum_algorithm=strict_crc32 by executing the following:

innochecksum -n -w ibdata* */*.ibd

It would be better to use an older-version innochecksum
for such a conversion, so that page checksums will be validated
before updating the checksum.

It never was possible for innochecksum to convert files to the
innodb_checksum_algorithm=full_crc32 format that is the default
for new InnoDB data files.
parent 8f8ba758
......@@ -1194,6 +1194,8 @@ static struct my_option innochecksum_options[] = {
{"allow-mismatches", 'a', "Maximum checksum mismatch allowed.",
&allow_mismatches, &allow_mismatches, 0,
GET_ULL, REQUIRED_ARG, 0, 0, ULLONG_MAX, 0, 1, 0},
{"write", 'w', "Rewrite the checksum.",
&do_write, &do_write, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"page-type-summary", 'S', "Display a count of each page type "
"in a tablespace.", &page_type_summary, &page_type_summary, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
......
......@@ -14,7 +14,8 @@ FOUND 1 /Error: --no-check must be associated with --write option./ in my_restar
FOUND 1 /unknown variable 'strict-check=innodb'/ in my_restart.err
[7]: check the innochecksum with short form strict-check & no-check , an error is expected
FOUND 1 /unknown option '-C'/ in my_restart.err
FOUND 1 /unknown variable 'write=crc32'/ in my_restart.err
FOUND 1 /ignoring option '--write' due to invalid value 'crc32'/ in my_restart.err
FOUND 1 /Error: --no-check must be associated with --write option/ in my_restart.err
# restart
SELECT * FROM tab1;
c1 c2
......
......@@ -27,6 +27,7 @@ end-page 0
page 0
no-check FALSE
allow-mismatches 0
write FALSE
page-type-summary FALSE
page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
per-page-details FALSE
......@@ -54,6 +55,7 @@ See https://mariadb.com/kb/en/library/innochecksum/ for usage hints.
-n, --no-check Ignore the checksum verification.
-a, --allow-mismatches=#
Maximum checksum mismatch allowed.
-w, --write Rewrite the checksum.
-S, --page-type-summary
Display a count of each page type in a tablespace.
-D, --page-type-dump=name
......@@ -75,6 +77,7 @@ end-page 0
page 0
no-check FALSE
allow-mismatches 0
write FALSE
page-type-summary FALSE
page-type-dump (No default value)
per-page-details FALSE
......
......@@ -133,6 +133,7 @@ end-page 0
page 0
no-check FALSE
allow-mismatches 0
write FALSE
page-type-summary FALSE
page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
per-page-details FALSE
......
......@@ -57,9 +57,15 @@ let SEARCH_PATTERN= unknown option '-C';
--error 1
--exec $INNOCHECKSUM --no-check --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
let SEARCH_PATTERN= unknown variable 'write=crc32';
--let SEARCH_PATTERN= ignoring option '--write' due to invalid value 'crc32'
--source include/search_pattern_in_file.inc
--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
--exec $INNOCHECKSUM --no-check --write $MYSQLD_DATADIR/test/tab1.ibd
--source include/start_mysqld.inc
SELECT * FROM tab1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment