Topic on Talk:MediaWiki 1.31

Issue on moving page - IncompleteRevisionException: sha1 field must not be !

6
141.77.225.60 (talkcontribs)

Dears,

we have another issue on MW 1.31.

If we try to move a page because of new page title ( URL etc ) it comes up with an error.


[ec0a0b42a6fd1b427e59fddf] /wiki/index.php?title=Spezial:Verschieben&action=submit MediaWiki\Storage\IncompleteRevisionException from line 308 of D:\wiki\htdocs\wiki\includes\Storage\RevisionStore.php: sha1 field must not be ''!

Backtrace:

#0 D:\wiki\htdocs\wiki\includes\Storage\RevisionStore.php(352): MediaWiki\Storage\RevisionStore->failOnEmpty(string, string)

#1 D:\wiki\htdocs\wiki\includes\Revision.php(1123): MediaWiki\Storage\RevisionStore->insertRevisionOn(MediaWiki\Storage\MutableRevisionRecord, Wikimedia\Rdbms\DatabaseMysqli)

#2 D:\wiki\htdocs\wiki\includes\MovePage.php(538): Revision->insertOn(Wikimedia\Rdbms\DatabaseMysqli)

#3 D:\wiki\htdocs\wiki\includes\MovePage.php(271): MovePage->moveToInternal(User, Title, string, boolean, array)

#4 D:\wiki\htdocs\wiki\includes\specials\SpecialMovepage.php(595): MovePage->move(User, string, boolean)

#5 D:\wiki\htdocs\wiki\includes\specials\SpecialMovepage.php(128): MovePageForm->doSubmit()

#6 D:\wiki\htdocs\wiki\includes\specialpage\SpecialPage.php(522): MovePageForm->execute(NULL)

#7 D:\wiki\htdocs\wiki\includes\specialpage\SpecialPageFactory.php(568): SpecialPage->run(NULL)

#8 D:\wiki\htdocs\wiki\includes\MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)

#9 D:\wiki\htdocs\wiki\includes\MediaWiki.php(861): MediaWiki->performRequest()

#10 D:\wiki\htdocs\wiki\includes\MediaWiki.php(524): MediaWiki->main()

#11 D:\wiki\htdocs\wiki\index.php(42): MediaWiki->run()

#12 {main}


Thanks for help and solution to fix the problem.

Kind regards

Kghbln (talkcontribs)
141.77.225.60 (talkcontribs)

Hello I know but I actually did following


c:\php\php.exe d:\wiki\maintenance\populateRevisionSha1.php --force


without any success - nothing changed. Still the same problem/error message


thank you for further help

141.77.225.60 (talkcontribs)

Any news ? Any support on this issue ?

would be much appreciated.


thank you - kind regards

Tweety mza (talkcontribs)

I activated the debug to obtain more detail I found the following lines:

[DBQuery] wiki SELECT / * MediaWiki \ Revision \ RevisionStore :: newNullRevision * / page_latest FROM page WHERE page_id = '567' LIMIT 1 FOR UPDATE

[DBQuery] wiki SELECT / * MediaWiki \ Revision \ RevisionStore :: fetchRevisionRowFromConds * / rev_id, rev_page, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1, rev_comment AS rev_comment_text, NULL AS` rev_comment_data`, NULL AS rev_comment_cid , rev_user, rev_user_text, NULL AS rev_actor, page_namespace, page_title, page_id, page_latest, page_is_redirect, page_len, user_name FROM` revision` INNER JOIN page ON ((page_id = rev_page)) LEFT JOIN` user` ON ((rev_user ! = 0) AND (user_id = rev_user)) WHERE rev_id = '18294' LIMIT 1

[DBQuery] wiki SELECT / * MediaWiki \ Revision \ RevisionStore :: loadSlotRecords * / slot_revision_id, slot_content_id, slot_origin, slot_role_id, content_size, content_sha1, content_address, content_model FROM slots INNER JOIN` content` ON ((slot_content_id = content_id)) WHERE slot_revision_id = '18294'

[DBQuery] wiki SELECT / * Wikimedia \ Rdbms \ Database :: ping * / 1 AS ping

[DBQuery] wiki ROLLBACK / * MWExceptionHandler :: rollbackMasterChangesAndLog * /

[exception] [84ce4d9d5080cde5574a7aee] /wiki/index.php?title=Special:MoverP%C3%A1gina&action=submit MediaWiki \ Revision \ IncompleteRevisionException from line 420 of / var / www / html / php72 / wiki / includes / Revision / RevisionStore. php: sha1 field must not be ''!

I checked in the database the table content with the following sentence:

SELECT * FROM wiki.content WHERE content_sha1 = '' OR content_sha1 = null;

And I found some records match the search filter.

I researched about the field and found

On the page Manual:Content_table you will find the description of the table and column:

content_sha1 -> Nominal hash of the content object (not necessarily of the serialized blob)

On the page "https://www.mediawiki.org/wiki/Multi-Content_Revisions/Database_Schema#content" gives a little more information:

Needed to re-calculate rev_sha1 for new revisions. Note: Should be nullable in case we want to switch to on-the-fly calculation to save space.

On the page Schema_Migration it says that for revision and file it should eventually be calculated from the blob if it is NULL.

Being an article, I did a test in which I copied the rev_sha1 into content_sha1 and the page transfer worked.

The steps I followed would be:

  1. Get from debug the rev_id and the content_id. The sentence from which I obtained it is similar to the one I obtained with the debug: SELECT slot_revision_id, slot_content_id, slot_origin, slot_role_id, content_size, content_sha1, content_address, content_model, content_id FROM slotsINNER JOIN` content` ON ((slot_content_id = content_id )) WHERE slot_revision_id = '<rev_id>';
  2. Get the rev_sha1 with the statement: SELECT * FROM wiki.revision WHERE rev_id = '<rev_id>';
  3. Copy the rev_sha1 to content_sha1: UPDATE wiki.content SET content_sha1 = '<rev_sha1>' WHERE content_id = '<content_id>';

What is between <> are values ​​that must be replaced.

Since I have several records of the content table with null value in content_sha1, you should see how to create a statement in which you review all the records, to obtain a global solution. I did not find an official solution yet, so I do not know if there is a php script that solves the problem, nor am I sure it is the correct solution.

I should do other tests to be sure. As soon as I can I do them and if I can create the global sentence I add it to the thread.

Schachi-md (talkcontribs)

the last entry is a long time ago. But I found a solution for version 1.33. I think it works also under version 1.31. You can use it without previously debug.

UPDATE

content AS con

LEFT JOIN slots AS slo ON slo.slot_content_id = con.content_id

LEFT JOIN revision AS rev ON rev.rev_id = slo.slot_revision_id

SET

  con.content_sha1 = rev.rev_sha1

WHERE

  con.content_sha1 = '' OR con.content_sha1 IS NULL

Reply to "Issue on moving page - IncompleteRevisionException: sha1 field must not be !"