Weird database error
|
MarcG
Joined: 2005-05-05
Posts: 3 |
Posted: Thu, 2005-05-05 14:37
|
|
We found your Gallery2 and it really seems powerfull, however we are experiencing a weird database error Quote:
Gallery version = 2.0-beta-2+ core 0.9.15 We also enabled debug mode of the gallery and now we got the following notices on several places on a page: Notice: iconv() [function.iconv]: Wrong charset, conversion from `1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C' to `UTF-8' is not allowed in .\gregoire-tilkens.com\gallery2\modules\core\classes\GalleryPhpVm.class on line 58 Any ideas/suggestions would be appreciated. Error (ERROR_STORAGE_FAILURE) : in .\gregoire-tilkens.com\gallery2\modules\core\classes\GalleryStorage\DatabaseStorage.class at line 1164 (MySqlDatabaseStorage::error) in .\gregoire-tilkens.com\gallery2\modules\core\classes\GalleryStorage.class at line 220 (MySqlDatabaseStorage::search) in .\gregoire-tilkens.com\gallery2\modules\core\classes\Gallery.class at line 216 (GalleryStorage::search) in .\gregoire-tilkens.com\gallery2\modules\imageblock\classes\ImageBlockHelper.class at line 406 (Gallery::search) in .\gregoire-tilkens.com\gallery2\modules\imageblock\classes\ImageBlockHelper.class at line 325 (ImageBlockModule::_isCached) in .\gregoire-tilkens.com\gallery2\modules\imageblock\classes\ImageBlockHelper.class at line 193 (ImageBlockModule::fetchViewableData) in .\gregoire-tilkens.com\gallery2\modules\imageblock\classes\ImageBlockHelper.class at line 86 (ImageBlockModule::_addBlock) in .\gregoire-tilkens.com\gallery2\modules\imageblock\module.inc at line 123 (ImageBlockModule::loadImageBlocks) in .\gregoire-tilkens.com\gallery2\modules\core\classes\GalleryLayout.class at line 936 (ImageBlockModule::loadSystemContent) in .\gregoire-tilkens.com\gallery2\layouts\matrix\layout.inc at line 64 (MatrixLayout::loadCommonTemplateData) in .\gregoire-tilkens.com\gallery2\modules\core\classes\GalleryLayout.class at line 500 (MatrixLayout::loadAlbumTemplate) in .\gregoire-tilkens.com\gallery2\modules\core\ShowItem.inc at line 206 (MatrixLayout::loadTemplate) in .\gregoire-tilkens.com\gallery2\modules\core\classes\GalleryView.class at line 214 (ShowItemView::loadTemplate) in .\gregoire-tilkens.com\gallery2\main.php at line 293 (ShowItemView::doLoadTemplate) in .\gregoire-tilkens.com\gallery2\main.php at line 79 in .\gregoire-tilkens.com\gallery2\main.php at line 70 file_exists(.\data\gt_data\cache\module/_all/0/0/GalleryFactoryHelper_loadRegistry.inc)
fopen(.\data\gt_data\cache\module/_all/0/0/GalleryFactoryHelper_loadRegistry.inc,
rb, 0)
fread(Resource id #28, 4096)
fread(Resource id #28, 4096)
fread(Resource id #28, 4096)
fclose(Resource id #28)
Unimplemented: GalleryUrlGenerator
file_exists(.\data\gt_data\sessions\099dbd7c0c97175cc1cb5f8965b917d9)
fopen(.\data\gt_data\sessions\099dbd7c0c97175cc1cb5f8965b917d9,
rb, 0)
feof(Resource id #32)
fread(Resource id #32, 4096)
feof(Resource id #32)
fclose(Resource id #32)
file_exists(.\data\gt_data\cache\module/core/0/0/0.inc)
fopen(.\data\gt_data\cache\module/core/0/0/0.inc,
rb, 0)
fread(Resource id #35, 4096)
fclose(Resource id #35)
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../modules/core/module.inc)
file_exists(.\data\gt_data\\versions.dat)
file(.\data\gt_data\\versions.dat, )
[1115302540] can't guarantee 5 -- extending!
file_exists(.\data\gt_data\cache\entity/0/0/5.inc)
fopen(.\data\gt_data\cache\entity/0/0/5.inc,
rb, 0)
fread(Resource id #40, 4096)
fclose(Resource id #40)
file_exists(.\data\gt_data\cache\module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc)
fopen(.\data\gt_data\cache\module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc,
rb, 0)
fread(Resource id #46, 4096)
fread(Resource id #46, 4096)
fread(Resource id #46, 4096)
fclose(Resource id #46)
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes/../../../modules/core/ShowItem.inc)
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes/../../../modules/core/ShowItem.inc)
file_exists(.\data\gt_data\cache\entity/0/0/7.inc)
fopen(.\data\gt_data\cache\entity/0/0/7.inc,
rb, 0)
fread(Resource id #53, 4096)
fclose(Resource id #53)
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../layouts/matrix/layout.inc)
file_exists(.\data\gt_data\cache\layout/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc)
fopen(.\data\gt_data\cache\layout/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc,
rb, 0)
fread(Resource id #66, 4096)
fclose(Resource id #66)
file_exists(.\data\gt_data\cache\layout/matrix/0/0/0.inc)
fopen(.\data\gt_data\cache\layout/matrix/0/0/0.inc,
rb, 0)
fread(Resource id #67, 4096)
fclose(Resource id #67)
file_exists(.\data\gt_data\cache\layout/matrix/0/0/7.inc)
fopen(.\data\gt_data\cache\layout/matrix/0/0/7.inc,
rb, 0)
fread(Resource id #68, 4096)
fclose(Resource id #68)
file_exists(./layouts/local/matrix)
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_Group.g_id,
gt2_Group.g_groupName
FROM
gt2_UserGroupMap, gt2_Group
WHERE
gt2_Group.g_id = gt2_UserGroupMap.g_groupId
AND
gt2_UserGroupMap.g_userId = 5
ORDER BY
gt2_Group.g_groupName
LIMIT 18446744073709551615
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_PermissionSetMap.g_module,
gt2_PermissionSetMap.g_permission,
gt2_PermissionSetMap.g_description,
gt2_PermissionSetMap.g_bits,
gt2_PermissionSetMap.g_flags
FROM
gt2_PermissionSetMap
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT DISTINCT
gt2_AccessMap.g_accessListId
FROM
gt2_AccessMap
WHERE
(gt2_AccessMap.g_userId = 5
OR
gt2_AccessMap.g_groupId IN (4))
AND
gt2_AccessMap.g_permission & 1 = 1
--------------------------------------------------------------------------------
Array
(
[limit] => Array
(
[count] => 12
[offset] => 0
)
)
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_ChildEntity.g_id , gt2_ItemAttributesMap.g_orderWeight
FROM
gt2_ChildEntity, gt2_Item, gt2_AccessSubscriberMap,
gt2_ItemAttributesMap
WHERE
gt2_ChildEntity.g_parentId = 7
AND
gt2_ChildEntity.g_id = gt2_Item.g_id
AND
gt2_AccessSubscriberMap.g_itemId = gt2_ChildEntity.g_id
AND
gt2_AccessSubscriberMap.g_accessListId IN (27, 30)
AND gt2_ItemAttributesMap.g_itemId = gt2_ChildEntity.g_id ORDER BY
gt2_ItemAttributesMap.g_orderWeight LIMIT 12
--------------------------------------------------------------------------------
file_exists(.\data\gt_data\cache\entity/0/2/29.inc)
fopen(.\data\gt_data\cache\entity/0/2/29.inc,
rb, 0)
fread(Resource id #79, 4096)
fclose(Resource id #79)
file_exists(.\data\gt_data\cache\entity/0/3/39.inc)
fopen(.\data\gt_data\cache\entity/0/3/39.inc,
rb, 0)
fread(Resource id #80, 4096)
fclose(Resource id #80)
file_exists(.\data\gt_data\cache\entity/0/4/42.inc)
fopen(.\data\gt_data\cache\entity/0/4/42.inc,
rb, 0)
fread(Resource id #81, 4096)
fclose(Resource id #81)
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_AccessSubscriberMap.g_itemId,
BIT_OR(gt2_AccessMap.g_permission)
FROM
gt2_AccessMap, gt2_AccessSubscriberMap
WHERE
gt2_AccessSubscriberMap.g_itemId IN (29, 39, 42)
AND
gt2_AccessSubscriberMap.g_accessListId =
gt2_AccessMap.g_accessListId
AND
(gt2_AccessMap.g_userId = 5
OR
gt2_AccessMap.g_groupId IN (4))
GROUP BY
gt2_AccessSubscriberMap.g_itemId
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_ChildEntity.g_parentId,
COUNT(gt2_ChildEntity.g_id)
FROM
gt2_ChildEntity, gt2_AccessSubscriberMap
WHERE
gt2_ChildEntity.g_parentId IN (7, 29, 39, 42)
AND
gt2_AccessSubscriberMap.g_itemId = gt2_ChildEntity.g_id
AND
gt2_AccessSubscriberMap.g_accessListId IN (27, 30)
GROUP BY
gt2_ChildEntity.g_parentId
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_AccessSubscriberMap.g_itemId,
BIT_OR(gt2_AccessMap.g_permission)
FROM
gt2_AccessMap, gt2_AccessSubscriberMap
WHERE
gt2_AccessSubscriberMap.g_itemId IN (29, 39, 42)
AND
gt2_AccessSubscriberMap.g_accessListId =
gt2_AccessMap.g_accessListId
AND
(gt2_AccessMap.g_userId = 5
OR
gt2_AccessMap.g_groupId IN (4))
GROUP BY
gt2_AccessSubscriberMap.g_itemId
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_ItemAttributesMap.g_parentSequence
FROM
gt2_ItemAttributesMap
WHERE
gt2_ItemAttributesMap.g_itemId = 7
--------------------------------------------------------------------------------
file_exists(.\data\gt_data\cache\entity/0/0/6.inc)
fopen(.\data\gt_data\cache\entity/0/0/6.inc,
rb, 0)
fread(Resource id #89, 4096)
fclose(Resource id #89)
file_exists(.\data\gt_data\cache\entity/0/1/16.inc)
fopen(.\data\gt_data\cache\entity/0/1/16.inc,
rb, 0)
fread(Resource id #90, 4096)
fclose(Resource id #90)
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_ItemAttributesMap.g_itemId,
gt2_ItemAttributesMap.g_viewCount
FROM
gt2_ItemAttributesMap
WHERE
gt2_ItemAttributesMap.g_itemId IN (7, 29, 39, 42)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_DescendentCountsMap.g_itemId,
gt2_DescendentCountsMap.g_descendentCount
FROM
gt2_DescendentCountsMap
WHERE
gt2_DescendentCountsMap.g_userId = 5
AND
gt2_DescendentCountsMap.g_itemId IN (7, 29, 39, 42)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
iam0.g_itemId,
COUNT(iam1.g_itemId)
FROM
gt2_ItemAttributesMap AS iam0,
gt2_ItemAttributesMap AS iam1,
gt2_AccessSubscriberMap
WHERE
iam0.g_itemId IN (7, 29)
AND
iam1.g_parentSequence LIKE CONCAT(iam0.g_parentSequence,
iam0.g_itemId, '/%')
AND
iam1.g_itemId = gt2_AccessSubscriberMap.g_itemId
AND
gt2_AccessSubscriberMap.g_accessListId IN (27, 30)
GROUP BY
iam0.g_itemId
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql): INSERT INTO gt2_DescendentCountsMap (g_userId, g_itemId,
g_descendentCount) VALUES (5, 7, '12')
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql): INSERT INTO gt2_DescendentCountsMap (g_userId, g_itemId,
g_descendentCount) VALUES (5, 29, '4')
--------------------------------------------------------------------------------
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../modules/albumselect/module.inc)
file_exists(.\data\gt_data\cache\module/albumselect/0/0/0.inc)
fopen(.\data\gt_data\cache\module/albumselect/0/0/0.inc,
rb, 0)
fread(Resource id #97, 4096)
fclose(Resource id #97)
file_exists(.\data\gt_data\cache\module/albumselect/0/0/5.dat)
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_AlbumItem.g_id,
gt2_ItemAttributesMap.g_parentSequence,
gt2_ItemAttributesMap.g_orderWeight
FROM
gt2_AlbumItem, gt2_ItemAttributesMap, gt2_AccessSubscriberMap
WHERE
gt2_AlbumItem.g_id = gt2_ItemAttributesMap.g_itemId
AND
gt2_ItemAttributesMap.g_parentSequence LIKE '7/%'
AND
gt2_AlbumItem.g_id = gt2_AccessSubscriberMap.g_itemId
AND
gt2_AccessSubscriberMap.g_accessListId IN (27, 30)
ORDER BY
gt2_ItemAttributesMap.g_parentSequence,
gt2_ItemAttributesMap.g_orderWeight
--------------------------------------------------------------------------------
file_exists(.\data\gt_data\cache\entity/0/3/31.inc)
fopen(.\data\gt_data\cache\entity/0/3/31.inc,
rb, 0)
fread(Resource id #100, 4096)
fclose(Resource id #100)
file_exists(.\data\gt_data\cache\entity/0/4/40.inc)
fopen(.\data\gt_data\cache\entity/0/4/40.inc,
rb, 0)
fread(Resource id #101, 4096)
fclose(Resource id #101)
file_exists(.\data\gt_data\cache\entity/0/4/41.inc)
fopen(.\data\gt_data\cache\entity/0/4/41.inc,
rb, 0)
fread(Resource id #102, 4096)
fclose(Resource id #102)
file_exists(.\data\gt_data\cache\module/albumselect/0/0)
is_dir(.\data\gt_data\cache\module/albumselect/0/0)
file_exists(.\data\gt_data\cache\module/albumselect/0/0/5.dat)
rename(.\data\gt_data\cache\module/albumselect/0/0\5.d671.tmp,
.\data\gt_data\cache\module/albumselect/0/0/5.dat)
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../modules/comment/module.inc)
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_AccessSubscriberMap.g_itemId,
BIT_OR(gt2_AccessMap.g_permission)
FROM
gt2_AccessMap, gt2_AccessSubscriberMap
WHERE
gt2_AccessSubscriberMap.g_itemId IN (7)
AND
gt2_AccessSubscriberMap.g_accessListId =
gt2_AccessMap.g_accessListId
AND
(gt2_AccessMap.g_userId = 5
OR
gt2_AccessMap.g_groupId IN (4))
GROUP BY
gt2_AccessSubscriberMap.g_itemId
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_ChildEntity.g_parentId,
COUNT(gt2_Comment.g_id)
FROM
gt2_Comment, gt2_ChildEntity
WHERE
gt2_ChildEntity.g_parentId IN (29, 39, 42)
AND
gt2_ChildEntity.g_id = gt2_Comment.g_id
GROUP BY
gt2_ChildEntity.g_parentId
--------------------------------------------------------------------------------
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../modules/customfield/module.inc)
file_exists(.\data\gt_data\cache\module/customfield/0/2/29.inc)
fopen(.\data\gt_data\cache\module/customfield/0/2/29.inc,
rb, 0)
fread(Resource id #111, 4096)
fclose(Resource id #111)
file_exists(.\data\gt_data\cache\module/customfield/0/0/0.inc)
fopen(.\data\gt_data\cache\module/customfield/0/0/0.inc,
rb, 0)
fread(Resource id #112, 4096)
fclose(Resource id #112)
--------------------------------------------------------------------------------
(mysql): SELECT gt2_CustomFieldMap.g_field, gt2_CustomFieldMap.g_value
FROM gt2_CustomFieldMap WHERE gt2_CustomFieldMap.g_itemId = 29
--------------------------------------------------------------------------------
file_exists(.\data\gt_data\cache\module/customfield/0/3/39.inc)
fopen(.\data\gt_data\cache\module/customfield/0/3/39.inc,
rb, 0)
fread(Resource id #114, 4096)
fclose(Resource id #114)
--------------------------------------------------------------------------------
(mysql): SELECT gt2_CustomFieldMap.g_field, gt2_CustomFieldMap.g_value
FROM gt2_CustomFieldMap WHERE gt2_CustomFieldMap.g_itemId = 39
--------------------------------------------------------------------------------
file_exists(.\data\gt_data\cache\module/customfield/0/4/42.inc)
fopen(.\data\gt_data\cache\module/customfield/0/4/42.inc,
rb, 0)
fread(Resource id #116, 4096)
fclose(Resource id #116)
--------------------------------------------------------------------------------
(mysql): SELECT gt2_CustomFieldMap.g_field, gt2_CustomFieldMap.g_value
FROM gt2_CustomFieldMap WHERE gt2_CustomFieldMap.g_itemId = 42
--------------------------------------------------------------------------------
file_exists(.\data\gt_data\cache\module/customfield/0/0/7.inc)
fopen(.\data\gt_data\cache\module/customfield/0/0/7.inc,
rb, 0)
fread(Resource id #119, 4096)
fclose(Resource id #119)
--------------------------------------------------------------------------------
(mysql): SELECT gt2_CustomFieldMap.g_field, gt2_CustomFieldMap.g_value
FROM gt2_CustomFieldMap WHERE gt2_CustomFieldMap.g_itemId = 7
--------------------------------------------------------------------------------
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../modules/exif/module.inc)
file_exists(.\gregoire-tilkens.com\gallery2\modules\core\classes\helpers/../../../../modules/imageblock/module.inc)
file_exists(.\data\gt_data\cache\module/imageblock/0/0/0.inc)
fopen(.\data\gt_data\cache\module/imageblock/0/0/0.inc,
rb, 0)
fread(Resource id #125, 4096)
fclose(Resource id #125)
mysql error: [1016: Can't open file: 'gt2_imageblockcachemap.MYI'. (errno:
144)] in EXECUTE("SELECT COUNT(*) FROM gt2_ImageBlockCacheMap WHERE
gt2_ImageBlockCacheMap.g_userId = 5")
--------------------------------------------------------------------------------
(mysql): SELECT COUNT(*) FROM gt2_ImageBlockCacheMap WHERE
gt2_ImageBlockCacheMap.g_userId = 5
--------------------------------------------------------------------------------
1016: Can't open file: 'gt2_imageblockcachemap.MYI'. (errno: 144)
ADODB_mysql._Execute(SELECT COUNT(*) FROM
gt2_ImageBlockCacheMap WHERE gt2_ImageBlock...) % line 818, file: adodb.inc.php
ADODB_mysql.Execute(SELECT COUNT(*) FROM
gt2_ImageBlockCacheMap WHERE gt2_ImageBlock..., Array[1]) % line 1156, file: DatabaseStorage.class
MySqlDatabaseStorage.search(SELECT COUNT(*) FROM
[ImageBlockCacheMap] WHERE [ImageBlockCache..., Array[1],
Array[0]) % line 220, file: GalleryStorage.class
GalleryStorage.search(SELECT COUNT(*) FROM
[ImageBlockCacheMap] WHERE [ImageBlockCache..., Array[1],
Array[0]) % line 216, file: Gallery.class
Gallery.search(SELECT
COUNT(*) FROM [ImageBlockCacheMap] WHERE [ImageBlockCache...,
Array[1]) % line 406, file: ImageBlockHelper.class
--------------------------------------------------------------------------------
(mysql):
SELECT
gt2_UserGroupMap.g_userId
FROM
gt2_UserGroupMap
WHERE
gt2_UserGroupMap.g_userId = 5
AND
gt2_UserGroupMap.g_groupId = '3'
LIMIT 1
--------------------------------------------------------------------------------
realpath(.\gregoire-tilkens.com\gallery2\modules\core\classes/../../../)
Damn, we posted this in the wrong forum, please move this to the G2 support forum |
|
| Login or register to post comments |

Posts: 314
could you please conirm that the server is running on Windows... if you are, it looks like a dup of a known problem that's discussed here - http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=29744
Posts: 32356
already tried to deactivate AND uninstall the imageblock module in G2? when it is uninstalled, make sure that the g2_imageblock* tables don't exist anymore.
then install & activate the imageblock module again.
do you still get the error now?
mysql error: [1016: Can't open file: 'gt2_imageblockcachemap.MYI'. (errno: 144)] in EXECUTE("SELECT COUNT(*) FROM gt2_ImageBlockCacheMap WHERE gt2_ImageBlockCacheMap.g_userId = 5") -------------------------------------------------------------------------------- (mysql): SELECT COUNT(*) FROM gt2_ImageBlockCacheMap WHERE gt2_ImageBlockCacheMap.g_userId = 5 -------------------------------------------------------------------------------- 1016: Can't open file: 'gt2_imageblockcachemap.MYI'. (errno: 144)Posts: 3
I just tried it, but I got the same error after adding a new item
Posts: 3
I have temporarily disabled all imageblocks and the problem didn't occur yet, so it certainly has something to do with those image blocks.
Posts: 6019
That looks like a corrupt database in mysql to me. Check your mysql error logs for more information.
Virshu and I fixed the other bug with iconv; get a new nightly build and that problem should go away.
Posts: 3
I'm seeing the same exact problem. I set up a fresh Gallery 2-beta 3 with no problems (great setup interface btw) and then had no problems uploading my first set of files. Then I decided to add one more and I got the same errors as above. I played around with the source for a while and I'm suspecting the caching mechanism is somehow corrupting the g2_imageblockcachemap table in the database. I repaired the table and then my gallery worked fine again until the next time I uploaded a picture. Then it went right back to the same problem.
I'll attach a picture of the output of the table repair operation.
Posts: 32356
if this was an inherent bug in the imageblock caching code, wouldn't more people experience this problem? wouldn't it be more probable if your filesystem / mysql has problems / tends to corrupt tables?
but would you then only get corruptions in the same table again and again? maybe the mysql files of this table are slightly corrupted. tried uninstalling (not only deactivating) the image block module? this should remove the associated mysql files.
then install the module again.
if the problem persists, it would be great if you could isolate the problem. if it's over your head (admittedly G2 isn't that easy to learn), please file a bug on http://sf.net/projects/gallery, please add [G2] in the bug title and add the link to this forum thread in the bug description.
Posts: 3
1. I completely removed the image block module.
2. I verified that the table was removed from the database.
3. I successfully added a picture.
4. I reinstalled the image block module.
5. I added another picture and was right back to the same error.
It seems odd to me that it's always the same table, i.e. I've never had any other tables from any other programs get corrupted.
I'll keep trying to isolate the problem further.
Posts: 3
Okay, I think that I've tracked down the problem more, or less.
After adding a new picture with ImageBlock installed, Gallery deletes the ImageBlock Cache Map with the SQL statement (in DatabaseStorage.class):
'DELETE FROM g2_ImageBlockCacheMap'
After a lot of investigation, I found this page:
http://dev.mysql.com/doc/mysql/en/news-4-0-16.html
(Moderator edit: current link is http://dev.mysql.com/doc/refman/4.1/en/news-4-0-16.html)
which is a changelog for MySQL 4.0.16 (I'm running 4.0.15-max-debug) that references this error:
So what I tried was changing the SQL statement in DatabaseStorage.class to:
'TRUNCATE TABLE g2_ImageBlockCacheMap'
When I ran that, it worked just fine. Of course I have no idea if that is a suitable fix for the problem, but hopefully it will help someone more familiar with Gallery and SQL to deal with the issue.
Posts: 32356
nice investigation.
sure this is a good fix for the mysql bug, use another statement.
but the question is whether this should be fixed in G2, since it's not a G2 bug and it only happens for a very specific mysql version / OS combination.
maybe other g2 issues are related to the same mysql bug though.
replacing the delete from tbl_name; with truncate statements seems to be fine.
could you please file a bug on http://sf.net/projects/gallery/, add a link to this thread, to the mysql bug and add your suggested fix?
thanks!
Posts: 32356
ok, i looked just a little bit into the differences between "truncate table tbl_name" and "delete from tbl_name".
and it seems there are a series of issues.
of course truncate table tbl_name works in all ANSI SQL compliant DBMS.
pro's:
it's faster than the "Delete from table tbl_name" statement, because it's a special command to delete the whole table contents, indexes, .. at once.
con's:
- in oracle: for some reason i think to remember that truncate table is non-transactional in oracle, but i can't find any reference with google, so this might be wrong
- in MS SQL (and we want to support it sooner or later):
__prior to MS SQL 7.0, you couldn't roll back a truncate table statement. baaad.
__it doesn't work if the table has foreign keys, because it doesn't delete each row separately (and sooner or later, we want to add foreign keys)
__you have to be the table owner to execute truncate table, the delete privilege isn't enough
We could start by just replacing the delete from table tbl_name with truncate table tbl_name for mysql. that's easy in g2.
If we do it, then I guess it's would be shortly after G 2.0, and not before. Changing it now would change something in the core of G2 just for a very tiny percentage of our users (users affected by this mysql bug). On the other hand it could possibly introduce a new bug, which would be very bad so shortly before G 2.0.