Last modified: 2014-01-18 20:58:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T55034, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 53034 - Property value changed after page move without redirect
Property value changed after page move without redirect
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
master
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-19 13:19 UTC by Alexey Demakov
Modified: 2014-01-18 20:58 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Recorded actions for Selenium IDE, no checks (2.98 KB, text/html)
2013-08-19 13:19 UTC, Alexey Demakov
Details
Database queries log with backtraces (16.65 KB, text/plain)
2013-08-19 13:20 UTC, Alexey Demakov
Details

Description Alexey Demakov 2013-08-19 13:19:25 UTC
Created attachment 13125 [details]
Recorded actions for Selenium IDE, no checks

If there is a subobject with property pointing to some page, sometimes when page is moved (without redirect), semantic data of that object's property (incorrectly) updated to point at new page.

I've found two related problems in source code.

Versions:
MediaWiki 	1.21.1 (56e8075)
Semantic MediaWiki (Version 1.9 alpha) 	(69e25c6)

I use this test case:

1. Create page '1' with text '1'
2. Create page 'S' with text {{#subobject:|Type=T|Property=1}}
3. Create page 'Q' with text {{#ask: [[Type::T]]|?Property|format=table}}
4. Check that 'S' is shown in query result table and Property=1
5. Move '1' to 'One' without redirect
6. Check that 'S' is shown at page 'Q' in query result table and Property=1
7. Create page '1' again with text '2'
8. Move '1' to 'Two' without redirect
9. Check that 'S' is shown at page 'Q' in query result table and Property=Two
but should be Property=1

Analysis:
1. wikipage '1' created, s_id=51

2. Add semantic info about subobject with two properties:
DatabaseBase::query: INSERT  INTO `smw_di_wikipage` (s_id,p_id,o_id) VALUES ('53','55','51'),('53','56','57') 

Add hash about this data:
DatabaseBase::query: UPDATE  `smw_object_ids` SET smw_proptable_hash = 'a:1:{s:15:\"smw_di_wikipage\";s:32:\"c43e412734de47975c15442da48c01ca\";}' WHERE smw_id = '53'

Hash is md5 of this serialized array:
smw_di_wikipage data: a:2:{i:0;a:3:{s:4:"s_id";i:53;s:4:"p_id";i:55;s:4:"o_id";s:2:"51";}i:1;a:3:{s:4:"s_id";i:53;s:4:"p_id";i:56;s:4:"o_id";i:57;}}

5. wikipage 'One' created, s_id=60
Move semantic info from '1' to 'One':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET s_id = '60' WHERE s_id = '51'
Change references from '1' to 'One':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET o_id = '60' WHERE o_id = '51'

BUG: hash is not updated!

It's located somewhere near
SMW_SQLStore3_Writers.php line 711 calls SMWSQLStore3->changeSMWPageID()
SMW_SQLStore3.php line 315 calls SMWSQLStore3Writers->changeTitle()

Refresh semantic data of page 'S' (in update job):
Serialized array:
smw_di_wikipage data: a:2:{i:0;a:3:{s:4:"s_id";s:2:"53";s:4:"p_id";s:2:"55";s:4:"o_id";s:2:"51";}i:1;a:3:{s:4:"s_id";s:2:"53";s:4:"p_id";s:2:"56";s:4:"o_id";s:2:"57";}}

md5 hash: 8ddbfffecc91e9fd86703ef843e2b7a2

BUG: the array describes the same data but hash differs because keys are strings, not integers as before. 
I hate dynamic typing!

But because hashes are different we write correct info:
DatabaseBase::query: DELETE FROM `wiki_smw_di_wikipage` WHERE (s_id='53' AND ((p_id = '55' AND o_id = '60')))
DatabaseBase::query: INSERT  INTO `wiki_smw_di_wikipage` (s_id,p_id,o_id) VALUES ('53','55','51')
DatabaseBase::query: UPDATE  `wiki_smw_object_ids` SET smw_proptable_hash = 'a:1:{s:15:\"smw_di_wikipage\";s:32:\"8ddbfffecc91e9fd86703ef843e2b7a2\";}' WHERE smw_id = '53'

7. wikipage '1' created, s_id=51

8. wikipage 'Two' created, s_id=61
Move semantic info from '1' to 'Two':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET s_id = '61' WHERE s_id = '51'
Change references from '1' to 'One':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET o_id = '61' WHERE o_id = '51'

BUG: hash is not updated!

Update job doesn't write correct info because at this time hashes are equal (bug is not compensated as before) and we see Property=Two in query result table.
Comment 1 Alexey Demakov 2013-08-19 13:20:34 UTC
Created attachment 13126 [details]
Database queries log with backtraces
Comment 2 MWJames 2013-08-19 13:27:52 UTC
Really nice report.

Could you verify if the issue is the same for the current git master (42027864)?
Comment 3 MWJames 2013-08-19 13:29:44 UTC
I mean Change-Id: I7bde4773fc75247da20156bc0308c184df395c73
Comment 4 Gerrit Notification Bot 2013-08-19 14:30:21 UTC
Change 79790 had a related patch set uploaded by Mwjames:
(Bug 53034) Handling redirects ($redirid == 0)

https://gerrit.wikimedia.org/r/79790
Comment 5 MWJames 2013-08-19 14:32:47 UTC
You could be so kind to run your tests against the above patch.
Comment 6 Alexey Demakov 2013-08-19 14:47:59 UTC
Confirmed at:

MediaWiki 	1.22alpha (178c785) 10:02, 19 August 2013
Semantic MediaWiki (Version 1.9 alpha) 	(4202786) 21:40, 18 August 2013
Comment 7 Alexey Demakov 2013-08-19 14:57:58 UTC
Patch 79790 doesn't fix the problem.
Comment 8 Gerrit Notification Bot 2013-09-20 22:48:42 UTC
Change 79790 abandoned by Mwjames:
(Bug 53034) Handling redirects ($redirid == 0)

https://gerrit.wikimedia.org/r/79790
Comment 9 Jeroen De Dauw 2013-09-20 23:16:45 UTC
@Alexey are you running Selenium against SMW? If so, I'd be interested in hearing how, and if you are also using the tests in SemanticMediaWiki/tests/selenium.
Comment 10 Alexey Demakov 2014-01-18 18:36:17 UTC
@Jeroen De Dauw, I used Selenium only to automate my test case mentioned above.
Comment 11 Alexey Demakov 2014-01-18 20:58:18 UTC
MediaWiki 	   1.22.1                (721b9e0) 22:03, 14 January 2014
Semantic MediaWiki (Version 1.9 alpha-3) (9a55761) 19:21, 22 October 2013

I've run my test successfully.
Also I've made code review and debugging to make sure that corresponding changes were made. So I can confirm that bug is fixed and can be closed.

However, the problem with types of page ids still exists, I filled new bug #60213.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links