Page MenuHomePhabricator

Handle item deletion in secondary storage
Closed, ResolvedPublic

Description

When items are created or changed they are added to the secondary storage. When they are deleted, their data needs to be cleaned up afterwards.


Version: unspecified
Severity: enhancement
Whiteboard: storypoints: 5

Details

Reference
bz36428

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 12:26 AM
bzimport set Reference to bz36428.
bzimport added a subscriber: Unknown Object (MLST).

Note ContentHandler::getSecondaryUpdatesForDeletion

As a consequence of this undeletion of history does not work as the recreation of sitelinks leads to duplicate links in secondary storage.

Deleted items, then tried an undelete, and then got a failed assertion, possibly because the undeleted content isn't any longer a supported format? Could be a new bug and not related to secondary storage, even if it is triggered by it.

Warning: assert():
Assertion failed in /home/john/Workspace/core/includes/Revision.php on line 908 Call Stack: 0.0000 636320

  1. {main}() /home/john/Workspace/core/index.php:0 0.0072 3098752
  2. MediaWiki->run() /home/john/Workspace/core/index.php:58 0.0072 3098752
  3. MediaWiki->main() /home/john/Workspace/core/includes/Wiki.php:502 0.0127 4111328
  4. MediaWiki->performRequest() /home/john/Workspace/core/includes/Wiki.php:592 0.0130 4112040
  5. MediaWiki->initializeArticle() /home/john/Workspace/core/includes/Wiki.php:267 0.0133 4148616
  6. Article->isRedirect() /home/john/Workspace/core/includes/Wiki.php:364 0.0133 4149008
  7. Article->__call() /home/john/Workspace/core/includes/Article.php:0 0.0133 4149640
  8. call_user_func_array() /home/john/Workspace/core/includes/Article.php:1868 0.0133 4150008
  9. WikiPage->isRedirect() /home/john/Workspace/core/includes/Article.php:0 0.0133 4150088
  10. WikiPage->getContent() /home/john/Workspace/core/includes/WikiPage.php:374 0.0148 4161712
  11. Revision->getContent() /home/john/Workspace/core/includes/WikiPage.php:493 0.0148 4161792
  12. Revision->getContentInternal() /home/john/Workspace/core/includes/Revision.php:839 0.0148 4161792
  13. Revision->getContentHandler() /home/john/Workspace/core/includes/Revision.php:867 0.0148 4161952
  14. assert() /home/john/Workspace/core/includes/Revision.php:908

Format application/x-wikitext is not supported for content model wikitext

Backtrace:

#0 /home/john/Workspace/core/includes/ContentHandler.php(788): ContentHandler->checkFormat('application/x-w...')
#1 /home/john/Workspace/core/includes/Revision.php(876): WikitextContentHandler->unserializeContent(''''LOKE'''??Con...', 'application/x-w...')
#2 /home/john/Workspace/core/includes/Revision.php(839): Revision->getContentInternal()
#3 /home/john/Workspace/core/includes/WikiPage.php(493): Revision->getContent(1)
#4 /home/john/Workspace/core/includes/WikiPage.php(374): WikiPage->getContent()
#5 [internal function]: WikiPage->isRedirect()
#6 /home/john/Workspace/core/includes/Article.php(1868): call_user_func_array(Array, Array)
#7 /home/john/Workspace/core/includes/Wiki.php(364): Article->__call('isRedirect', Array)
#8 /home/john/Workspace/core/includes/Wiki.php(364): Article->isRedirect()
#9 /home/john/Workspace/core/includes/Wiki.php(267): MediaWiki->initializeArticle()
#10 /home/john/Workspace/core/includes/Wiki.php(592): MediaWiki->performRequest()
#11 /home/john/Workspace/core/includes/Wiki.php(502): MediaWiki->main()
#12 /home/john/Workspace/core/index.php(58): MediaWiki->run()
#13 {main}

Line 908 is the assertion in the following code (From Revision.php)

/**

  • @return ContentHandler */

public function getContentHandler() {
if ( !$this->mContentHandler ) {

		$model = $this->getContentModelName();
		$this->mContentHandler = ContentHandler::getForModelName( model );
		assert( $this->mContentHandler->isSupportedFormat( $this->getContentFormat() ) );

}
return $this->mContentHandler;
}

@John: yes, you are correct. After some discussion on wikitech-l, I changed the mime type for wikitext from application/x-wikitext to text/x-wiki.

Note that there is another related change imminent: in the future, content model and content format will be stored as integer ids in the database. This is a performance improvement requested by Asher. I'll write to the list about it.

Right. One situation where this can happen is this:

  • a user creates a page using a special content model provided by some extension.
  • the page gets deleted
  • the extension is disabled
  • then the user tries to undelete the page.

In this case, mediawiki doesn't know how to unserialize or display the page's content. Undeletion should and does fail. We could look into showing a nicer error page, but I think the case is so rare that that isn't necessary.

Verified in Wikidata demo time for sprint 8