Last modified: 2014-01-18 20:58:55 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.
Created attachment 13126 [details] Database queries log with backtraces
Really nice report. Could you verify if the issue is the same for the current git master (42027864)?
I mean Change-Id: I7bde4773fc75247da20156bc0308c184df395c73
Change 79790 had a related patch set uploaded by Mwjames: (Bug 53034) Handling redirects ($redirid == 0) https://gerrit.wikimedia.org/r/79790
You could be so kind to run your tests against the above patch.
Confirmed at: MediaWiki 1.22alpha (178c785) 10:02, 19 August 2013 Semantic MediaWiki (Version 1.9 alpha) (4202786) 21:40, 18 August 2013
Patch 79790 doesn't fix the problem.
Change 79790 abandoned by Mwjames: (Bug 53034) Handling redirects ($redirid == 0) https://gerrit.wikimedia.org/r/79790
@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.
@Jeroen De Dauw, I used Selenium only to automate my test case mentioned above.
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.