'gallery2/g2_CacheMap' is marked as crashed and should be repaired when using LOCK TABLES


Joined: 2006-07-14
Posts: 8
Posted: Fri, 2007-12-28 00:25

Can someone help me fixen this problem. I tried to dump all databases with mysql dump but that doesn't work. I'm getting this error: 'gallery2/g2_CacheMap' is marked as crashed and should be repaired when using LOCK TABLES
The gallery is also offline and saying that there is a database error. With debugging on it's hanging on the same db table as mysqldump.

mysql error: [145: Table 'gallery2/g2_CacheMap' is marked as crashed and should be repaired] in EXECUTE("SELECT g_value FROM g2_CacheMap WHERE g_key='numbersandletters' AND g_type='template' AND g_userId=6 AND g_timestamp >1198800044 AND g_isEmpty=0")

What can i do to repair this without any data loss??

Gallery version = 2.2.3 core
PHP version = 5.2.2 apache2handler
Webserver = Apache
Database = mysql 5.0.37, lock.system=flock
Toolkits = ArchiveUpload, Exif, Ffmpeg, Getid3, ImageMagick, NetPBM, SquareThumb, Thumbnail, Gd, LinkItemToolkit
Acceleration = partial/900, partial/900
Operating system = Linux #1 SMP Fri Jul 27 18:10:34 EDT 2007 i686
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070725 Firefox/
Rows in GalleryAccessMap table = 55
Rows in GalleryAccessSubscriberMap table = 4078
Rows in GalleryUser table = 16
Rows in GalleryItem table = 4074
Rows in GalleryAlbumItem table = 61
Rows in GalleryCacheMap table = 1


Joined: 2006-07-14
Posts: 8
Posted: Fri, 2007-12-28 00:52

It's working again, i share my solution for those who are having the same problem.

Stage 1: Checking your tables
Run myisamchk *.MYI or myisamchk -e *.MYI if you have more time. Use the -s (silent) option to suppress unnecessary information.
If the mysqld server is stopped, you should use the --update-state option to tell myisamchk to mark the table as “checked.”
You have to repair only those tables for which myisamchk announces an error. For such tables, proceed to Stage 2.
If you get unexpected errors when checking (such as out of memory errors), or if myisamchk crashes, go to Stage 3.

Stage 2: Easy safe repair
First, try myisamchk -r -q tbl_name (-r -q means “quick recovery mode”). This attempts to repair the index file without touching the data file. If the data file contains everything that it should and the delete links point at the correct locations within the data file, this should work, and the table is fixed.
source: Website

scaturan's picture

Joined: 2004-09-12
Posts: 1153
Posted: Mon, 2008-02-18 02:01

thanks for the tip! had a similar error with g2_Entity



Joined: 2006-12-03
Posts: 8
Posted: Thu, 2009-02-19 20:45

I tried this and received myisamchk: error: 22 Is this supposed to be run from a commend prompt?