James,
page number 22357 is corrupt. InnoDB Hot Backup notices these checksum errors, and refuses to do the backup. Sometimes it happens that an unused (i.e., freed) page in an ibdata file becomes corrupt. Then it would be nice to have some tool to reset the checksums on that page, so that mysqld or ibbackup would not complain of the page.
I wrote now a little C program innodb_page_checksum_reset.c that can be used for this :). The program code is below. It will reset page 22357 in ibdata1. I can send a Linux binary, if you do not have a working C compiler.
To compile in Linux:
gcc -o reset innodb_page_checksum_reset.c
Regards,
Heikki
--------------------------------------------
/* This program is for resetting the lsn and checksum fields of an InnoDB
page, so that ibbackup and mysqld will not complain of corruption. NOTE that
this program does NOT fix the corruption, though! Read the instructions below
VERY carefully.
Copyright 2005 Innobase Oy. This program is released under the GNU GPL license version 2. */
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h>
int main(void) { off_t page_number; int file; off_t offs; off_t ret_offset; ssize_t ret; char* file_name; char buf[8];
/* page_number is the number of the page in the ibdata file that you
want to reset. Note that if you have several ibdata files, you have to
calculate the page number in the particular ibdata file, and NOT use
the global tablespace page number. InnoDB page size is 16 kB. */
file_name = "ibdata1"; page_number = 22357;
offs = page_number * 16 * 1024;
memset(buf, '\0', 8);
file = open(file_name, O_RDWR);
if (file == -1) {
printf("Cannot open %s\n", file_name);
exit(1); }
/* Reset FIL_PAGE_SPACE_OR_CHKSUM */
ret_offset = lseek(file, offs, SEEK_SET);
if (ret_offset < 0) { printf("Error in lseek 1\n");
exit(1); }
ret = write(file, buf, (ssize_t)4);
if (ret != 4) { printf("Error in write 1\n");
exit(1); }
/* Read FIL_PAGE_LSN */
ret_offset = lseek(file, offs + 16, SEEK_SET);
if (ret_offset < 0) { printf("Error in lseek 2\n");
exit(1); }
ret = read(file, buf, (ssize_t)8);
if (ret != 8) { printf("Error in read\n");
exit(1); }
/* Reset FIL_PAGE_END_LSN_OLD_CHKSUM */
ret_offset = lseek(file, offs + 16 * 1024 - 8, SEEK_SET);
if (ret_offset < 0) { printf("Error in lseek 3\n");
exit(1); }
ret = write(file, buf, (ssize_t)8);
if (ret != 8) { printf("Error in write 2\n");
exit(1); }
close(file);
printf("lsn and checksum fields of page %lu in file %s reset\n", (ulong)page_number, file_name); return(0); }
----- Original Message ----- From: "James Green" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.myodbc
Sent: Friday, February 18, 2005 5:53 PM
Subject: InnoDB: Problem with innobackup
Hi,
On running the hot backup tool we receive:
ibbackup: Re-reading page at offset 0 366297088 in /var/lib/mysql/data/ibdata1
ibbackup: Re-reading page at offset 0 366297088 in /var/lib/mysql/data/ibdata1
050218 15:18:01 InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex
eeaefd1a0000575500007b3500006932000000017183e16e45bf0000000000000000000[garbage
continues]
....
(.(."u:.%.1./.7u.E.e8.'%.e.c9]q...;InnoDB: End of page dump
050218 15:18:01 InnoDB: Page checksum 4004445466,
prior-to-4.0.14-form checksum 3154721000
InnoDB: stored checksum 4004445466, prior-to-4.0.14-form stored
checksum 2825075037
InnoDB: Page lsn 1 1904468334, low 4 bytes of lsn at page end 1904466222
InnoDB: Page number (if stored to page already) 22357,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be an index page where index id is 0 162
ibbackup: Error: page at offset 0 366297088 in
/var/lib/mysql/data/ibdata1 seems corrupt!
innobackup: Error: ibbackup child process has died at innobackup.pl line 332.
We have gone through (via a script) and every table in every database (all by 'mysql' is InnoDB) returns 'OK' using 'check table'.
We did suffer a hardware failure which required a table to be dropped and rebuilt, however that was resolved and everything appears to be operating fine now. Except we want the hot backup to work and it clearly doesn't.
Looking for options. We have mysqldumps but clearly restoration will be very slow. The server is Debian Linux (stable) with MySQL-4.1.9 from the mysql.com binary tarball.
Help! Many thanks!
James
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]