5470 Marko Mäkelä 2013-04-18
WL#6045: Simplify the innochecksum function read_file().
modified:
extra/innochecksum.cc
5469 Marko Mäkelä 2013-04-18
WL#6045: Properly rename innochecksum -d to -#, and adjust tests.
modified:
extra/innochecksum.cc
mysql-test/suite/innodb/r/innodb-wl6045-linux.result
mysql-test/suite/innodb/r/innodb-wl6045.result
=== modified file 'extra/innochecksum.cc'
--- a/extra/innochecksum.cc revid:anil.toshniwal@stripped-ge0ise3u3s1e4xs0
+++ b/extra/innochecksum.cc revid:marko.makela@stripped
@@ -287,23 +287,22 @@ open_file(
@retval no. of bytes read.
*/
ulong read_file(
- byte** buf,
+ byte* buf,
bool partial_page_read,
ulong physical_page_size,
- FILE** fil_in)
+ FILE* fil_in)
{
ulong bytes = 0;
- if (partial_page_read) {
- bytes = fread(*buf + UNIV_PAGE_SIZE_MIN, 1,
- physical_page_size - UNIV_PAGE_SIZE_MIN,
- *fil_in);
- bytes += UNIV_PAGE_SIZE_MIN;
+ DBUG_ASSERT(physical_page_size >= UNIV_PAGE_SIZE_MIN);
- } else {
- bytes = fread(*buf, 1, physical_page_size, *fil_in);
+ if (partial_page_read) {
+ buf += UNIV_PAGE_SIZE_MIN;
+ physical_page_size -= UNIV_PAGE_SIZE_MIN;
+ bytes = UNIV_PAGE_SIZE_MIN;
}
- return bytes;
+
+ return bytes + fread(buf, 1, physical_page_size, fil_in);
}
/*****************************************************************//*
@@ -854,69 +853,70 @@ innochecksum_get_one_option(
char *argument __attribute__((unused)))
{
switch (optid) {
- case 'd':
- dbug_setting = argument ? argument :
- IF_WIN("d:O,innochecksum.trace",
- "d:o,/tmp/innochecksum.trace");
- DBUG_PUSH(dbug_setting);
- break;
- case 'e':
- use_end_page = TRUE;
- break;
- case 'p':
- end_page = start_page = do_page;
- use_end_page = TRUE;
- do_one_page = TRUE;
- break;
- case 'V':
- print_version();
- exit(0);
- break;
- case 'C':
- strict_verify = TRUE;
- switch ((srv_checksum_algorithm_t) strict_check) {
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- case SRV_CHECKSUM_ALGORITHM_CRC32:
- srv_checksum_algorithm =
- SRV_CHECKSUM_ALGORITHM_STRICT_CRC32;
- break;
-
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- srv_checksum_algorithm =
- SRV_CHECKSUM_ALGORITHM_STRICT_INNODB;
- break;
+ case '#':
+ dbug_setting = argument
+ ? argument
+ : IF_WIN("d:O,innochecksum.trace",
+ "d:o,/tmp/innochecksum.trace");
+ DBUG_PUSH(dbug_setting);
+ break;
+ case 'e':
+ use_end_page = TRUE;
+ break;
+ case 'p':
+ end_page = start_page = do_page;
+ use_end_page = TRUE;
+ do_one_page = TRUE;
+ break;
+ case 'V':
+ print_version();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'C':
+ strict_verify = TRUE;
+ switch ((srv_checksum_algorithm_t) strict_check) {
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
- case SRV_CHECKSUM_ALGORITHM_NONE:
- srv_checksum_algorithm =
- SRV_CHECKSUM_ALGORITHM_STRICT_NONE;
- break;
- default :
- return (TRUE);
- }
- break;
- case 'n':
- no_check = TRUE;
- break;
- case 'a':
- case 'S':
- break;
- case 'w':
- do_write = TRUE;
+ case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
+ srv_checksum_algorithm =
+ SRV_CHECKSUM_ALGORITHM_STRICT_CRC32;
break;
- case 'D':
- page_type_dump = TRUE;
+
+ case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ srv_checksum_algorithm =
+ SRV_CHECKSUM_ALGORITHM_STRICT_INNODB;
break;
- case 'I':
- case '?':
- usage();
- exit(FALSE);
+
+ case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ case SRV_CHECKSUM_ALGORITHM_NONE:
+ srv_checksum_algorithm =
+ SRV_CHECKSUM_ALGORITHM_STRICT_NONE;
break;
+ default:
+ return(TRUE);
+ }
+ break;
+ case 'n':
+ no_check = TRUE;
+ break;
+ case 'a':
+ case 'S':
+ break;
+ case 'w':
+ do_write = TRUE;
+ break;
+ case 'D':
+ page_type_dump = TRUE;
+ break;
+ case 'I':
+ case '?':
+ usage();
+ exit(EXIT_SUCCESS);
+ break;
}
- return (FALSE);
+ return(FALSE);
}
static
@@ -1185,10 +1185,10 @@ int main(
(fseeko() on stdin doesn't work). So
read only the remaining part of page,
if partial_page_read is enable. */
- bytes = read_file(&buf,
+ bytes = read_file(buf,
partial_page_read,
physical_page_size,
- &fil_in);
+ fil_in);
partial_page_read = 0;
count++;
@@ -1223,8 +1223,8 @@ int main(
lastt = 0;
while (!feof(fil_in)) {
- bytes = read_file(&buf, partial_page_read,
- physical_page_size,&fil_in);
+ bytes = read_file(buf, partial_page_read,
+ physical_page_size, fil_in);
partial_page_read = 0;
if (!bytes && feof(fil_in)) {
=== modified file 'mysql-test/suite/innodb/r/innodb-wl6045-linux.result'
--- a/mysql-test/suite/innodb/r/innodb-wl6045-linux.result revid:anil.toshniwal@stripped
+++ b/mysql-test/suite/innodb/r/innodb-wl6045-linux.result revid:marko.makela@stripped
@@ -105,7 +105,7 @@ page-type-dump (No de
# Index page
# Undo log page
# Inode page
- # INSERT buffer free list page
+ # Insert buffer free list page
# Freshly allocated page
# Insert buffer bitmap
# System page
=== modified file 'mysql-test/suite/innodb/r/innodb-wl6045.result'
--- a/mysql-test/suite/innodb/r/innodb-wl6045.result revid:anil.toshniwal@stripped57-ge0ise3u3s1e4xs0
+++ b/mysql-test/suite/innodb/r/innodb-wl6045.result revid:marko.makela@stripped713-g3fo5ffvfqueo06h
@@ -433,7 +433,7 @@ See REFMAN for usage hints.
-I, --info Synonym for --help.
-V, --version Displays version information and exits.
-v, --verbose Verbose (prints progress every 5 seconds).
- -d, --debug[=name] Output debug log. See
+ -#, --debug[=name] Output debug log. See
REFMAN
-c, --count Print the count of pages in the file and exits.
-s, --start-page=# Start on this page number (0 based).
No bundle (reason: useless for push emails).
Thread |
---|
• bzr push into mysql-trunk branch (marko.makela:5468 to 5470) WL#6045 | marko.makela | 20 May |