Topic on Project:Support desk

Search error creating custom namespaces

10
Sokote zaman (talkcontribs)

4I've made some custom namespaces and it all works fine.

At the end of the job the updateSearchIndex.php script will give an error

Thanks for the help

Thanks

MediaWiki 1.34(a40bf67)
PHP 7.3.24 (cgi-fcgi)
MariaDB 10.3.18-MariaDB
ICU 64.2
Lua 5.1.5
php rebuild.php
MarkAHershberger (talkcontribs)

Did you try running update.php?

Sokote zaman (talkcontribs)
MarkAHershberger (talkcontribs)

Since I'm not proficient with all this, I had to do some searching and came across this. It looks like a lock was put in place (not on temp_rev_comment, though) and were not unlocked before we got to this query.

If you could enable debug logging, we should be able to find out what code performed locks before this. Could you try this and paste the last few SQL queries from the log file?

ClageLG (talkcontribs)

Hi @MarkAHershberger,

we have exactly the same problem with updateSearchIndex.php resulting in Error: 1100 Table 'temp_rev_comment' was not locked with LOCK TABLES.

The debug output of updateSearchIndex.php is:

[SQLBagOStuff] MainObjectStash using store ReplicatedBagOStuff
[objectcache] MainWANObjectCache using store EmptyBagOStuff
IP: 127.0.0.1
Start command line script maintenance/updateSearchIndex.php
[localisation] LocalisationCache: using store LCStoreDB
[DBQuery] Wikimedia\Rdbms\DatabaseMysqlBase::open [0s] localhost: SET group_concat_max_len = 262144, sql_mode = ''
[DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: request info {
    "IPAddress": "127.0.0.1",
    "UserAgent": false,
    "ChronologyProtection": false,
    "ChronologyPositionIndex": 0,
    "ChronologyClientId": false
}
[DBConnection] Wikimedia\Rdbms\LoadBalancer::lazyLoadReplicationPositions: executed chronology callback.
[DBConnection] Wikimedia\Rdbms\LoadBalancer::getLocalConnection: connected to database 0 at 'localhost'.
[DBQuery] Wikimedia\Rdbms\DatabaseMysqlBase::serverIsReadOnly [0s] localhost: SELECT @@GLOBAL.read_only AS Value
[DBQuery] LCStoreDB::get [0s] localhost: SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'deps'  LIMIT 1  
[DBQuery] LCStoreDB::get [0s] localhost: SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'list'  LIMIT 1  
[DBQuery] LCStoreDB::get [0s] localhost: SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'preload'  LIMIT 1  
[DBQuery] LCStoreDB::get [0s] localhost: SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'preload'  LIMIT 1  
[DBQuery] LCStoreDB::get [0s] localhost: SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'fallbackSequence'  LIMIT 1  
[session] SessionManager using store SqlBagOStuff
Unstubbing $wgParser on call of $wgParser::setFunctionHook from require_once
ParserFactory: using preprocessor: Preprocessor_Hash
[DBQuery] LCStoreDB::get [0s] localhost: SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'magicWords'  LIMIT 1  
[DBQuery] UpdateSearchIndex::doUpdateSearchIndex [0.001s] localhost: SELECT rc_cur_id FROM `recentchanges`
			JOIN `page` ON rc_cur_id=page_id AND rc_this_oldid=page_latest
			WHERE rc_type != 3 AND rc_timestamp BETWEEN '20200503135011' AND '20200504135011'
[DBQuery] Maintenance-searchIndexLock [0s] localhost: LOCK TABLES `searchindex` WRITE,`page` READ,`revision` READ,`text` READ,`interwiki` READ,`l10n_cache` READ,`user` READ,`page_restrictions` READ
[DBQuery] MediaWiki\Revision\RevisionStore::fetchRevisionRowFromConds [0s] localhost: SELECT  rev_id,rev_page,rev_timestamp,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,comment_rev_comment.comment_text AS `rev_comment_text`,comment_rev_comment.comment_data AS `rev_comment_data`,comment_rev_comment.comment_id AS `rev_comment_cid`,actor_rev_user.actor_user AS `rev_user`,actor_rev_user.actor_name AS `rev_user_text`,temp_rev_user.revactor_actor AS `rev_actor`,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name  FROM `revision` JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) JOIN `revision_actor_temp` `temp_rev_user` ON ((temp_rev_user.revactor_rev = rev_id)) JOIN `actor` `actor_rev_user` ON ((actor_rev_user.actor_id = temp_rev_user.revactor_actor)) JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((actor_rev_user.actor_user != 0) AND (user_id = actor_rev_user.actor_user))   WHERE rev_page = '330' AND page_id = '330' AND (rev_id=page_latest)  LIMIT 1  
[DBQuery] MediaWiki\Revision\RevisionStore::fetchRevisionRowFromConds	localhost	1100	Table 'temp_rev_comment' was not locked with LOCK TABLES (localhost)	SELECT  rev_id,rev_page,rev_timestamp,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,comment_rev_comment.comment_text AS `rev_comment_text`,comment_rev_comment.comment_data AS `rev_comment_data`,comment_rev_comment.comment_id AS `rev_comment_cid`,actor_rev_user.actor_user AS `rev_user`,actor_rev_user.actor_name AS `rev_user_text`,temp_rev_user.revactor_actor AS `rev_actor`,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name  FROM `revision` JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) JOIN `revision_actor_temp` `temp_rev_user` ON ((temp_rev_user.revactor_rev = rev_id)) JOIN `actor` `actor_rev_user` ON ((actor_rev_user.actor_id = temp_rev_user.revactor_actor)) JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((actor_rev_user.actor_user != 0) AND (user_id = actor_rev_user.actor_user))   WHERE rev_page = '330' AND page_id = '330' AND (rev_id=page_latest)  LIMIT 1
Function: MediaWiki\Revision\RevisionStore::fetchRevisionRowFromConds
Error: 1100 Table 'temp_rev_comment' was not locked with LOCK TABLES (localhost)

#0 /var/www/html/mediawiki-1.34.0/includes/libs/rdbms/database/Database.php(1574): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /var/www/html/mediawiki-1.34.0/includes/libs/rdbms/database/Database.php(1152): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /var/www/html/mediawiki-1.34.0/includes/libs/rdbms/database/Database.php(1807): Wikimedia\Rdbms\Database->query(string, string)
#3 /var/www/html/mediawiki-1.34.0/includes/libs/rdbms/database/Database.php(1899): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#4 /var/www/html/mediawiki-1.34.0/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->selectRow(array, array, array, string, array, array)
#5 /var/www/html/mediawiki-1.34.0/includes/libs/rdbms/database/DBConnRef.php(333): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /var/www/html/mediawiki-1.34.0/includes/Revision/RevisionStore.php(2589): Wikimedia\Rdbms\DBConnRef->selectRow(array, array, array, string, array, array)
#7 /var/www/html/mediawiki-1.34.0/includes/Revision/RevisionStore.php(2536): MediaWiki\Revision\RevisionStore->fetchRevisionRowFromConds(Wikimedia\Rdbms\MaintainableDBConnRef, array, integer)
#8 /var/www/html/mediawiki-1.34.0/includes/Revision/RevisionStore.php(2416): MediaWiki\Revision\RevisionStore->loadRevisionFromConds(Wikimedia\Rdbms\MaintainableDBConnRef, array)
#9 /var/www/html/mediawiki-1.34.0/includes/Revision.php(262): MediaWiki\Revision\RevisionStore->loadRevisionFromPageId(Wikimedia\Rdbms\MaintainableDBConnRef, string, integer)
#10 /var/www/html/mediawiki-1.34.0/maintenance/Maintenance.php(1547): Revision::loadFromPageId(Wikimedia\Rdbms\MaintainableDBConnRef, string)
#11 /var/www/html/mediawiki-1.34.0/maintenance/updateSearchIndex.php(121): Maintenance->updateSearchIndexForPage(Wikimedia\Rdbms\MaintainableDBConnRef, string)
#12 /var/www/html/mediawiki-1.34.0/maintenance/Maintenance.php(1528): UpdateSearchIndex->searchIndexUpdateCallback(Wikimedia\Rdbms\MaintainableDBConnRef, stdClass)
#13 /var/www/html/mediawiki-1.34.0/maintenance/updateSearchIndex.php(115): Maintenance->updateSearchIndex(integer, array, Wikimedia\Rdbms\MaintainableDBConnRef, Wikimedia\Rdbms\ResultWrapper)
#14 /var/www/html/mediawiki-1.34.0/maintenance/updateSearchIndex.php(81): UpdateSearchIndex->doUpdateSearchIndex(string, string, integer)
#15 /var/www/html/mediawiki-1.34.0/maintenance/doMaintenance.php(99): UpdateSearchIndex->execute()
#16 /var/www/html/mediawiki-1.34.0/maintenance/updateSearchIndex.php(126): require_once(string)
#17 {main}
[DBConnection] Wikimedia\Rdbms\LoadBalancer::__destruct: closing connection to database 'localhost'.

Any idea?

Sorry there where two important lines missing in the debug output that are written to the shell only.

The problem is Error: 1100 Table 'temp_rev_comment' was not locked with LOCK TABLES in function MediaWiki\Revision\RevisionStore::fetchRevisionRowFromConds.

Software Version
MediaWiki 1.34.0
PHP 7.2.24-0ubuntu0.18.04.4 (fpm-fcgi)
MariaDB 10.1.44-MariaDB-0ubuntu0.18.04.1
ICU 60.2
Lua 5.1.5
Elasticsearch 6.5.4
Immewnity (talkcontribs)

Same issue here - temp_rev_comment is causing problems.

Product Version
MediaWiki 1.34.0
PHP 7.4.1 (apache2handler)
MySQL 5.7.29-0ubuntu0.16.04.1
ICU 64.2
ClageLG (talkcontribs)

Tying to find the problem I extracted the SQL from debug out:

SET group_concat_max_len = 262144, sql_mode = ''
SELECT @@GLOBAL.read_only AS Value
SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'deps'  LIMIT 1
SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'list'  LIMIT 1
SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'preload'  LIMIT 1
SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'preload'  LIMIT 1
SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'fallbackSequence'  LIMIT 1
SELECT  lc_value  FROM `l10n_cache`    WHERE lc_lang = 'de-formal' AND lc_key = 'magicWords'  LIMIT 1
SELECT rc_cur_id FROM `recentchanges` JOIN `page` ON rc_cur_id=page_id AND rc_this_oldid=page_latest WHERE rc_type != 3 AND rc_timestamp BETWEEN '20200503135011' AND '20200504135011'

LOCK TABLES `searchindex` WRITE,`page` READ,`revision` READ,`text` READ,`interwiki` READ,`l10n_cache` READ,`user` READ,`page_restrictions` READ

SELECT  rev_id,rev_page,rev_timestamp,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,comment_rev_comment.comment_text AS `rev_comment_text`,comment_rev_comment.comment_data AS `rev_comment_data`,comment_rev_comment.comment_id AS `rev_comment_cid`,actor_rev_user.actor_user AS `rev_user`,actor_rev_user.actor_name AS `rev_user_text`,temp_rev_user.revactor_actor AS `rev_actor`,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name  FROM `revision` JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) JOIN `revision_actor_temp` `temp_rev_user` ON ((temp_rev_user.revactor_rev = rev_id)) JOIN `actor` `actor_rev_user` ON ((actor_rev_user.actor_id = temp_rev_user.revactor_actor)) JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((actor_rev_user.actor_user != 0) AND (user_id = actor_rev_user.actor_user))   WHERE rev_page = '330' AND page_id = '330' AND (rev_id=page_latest)  LIMIT 1

The last request is causing Error: 1100 Table 'temp_rev_comment' was not locked with LOCK TABLES in function MediaWiki\Revision\RevisionStore::fetchRevisionRowFromConds.

Like the thread opener we added a custom namespace too.

ClageLG (talkcontribs)
Reply to "Search error creating custom namespaces"