Author: vicente.aguilar
Description:
On some of our wikis, when #asking (or #showing, or browsing with the Semantic Drilldown extension) the properties of some articles, we get all the values twice. The same values, which should be impossible. E.g. imagine we had a Property:Version and {{#set:Version=1.0}}, if we {{#show:Page|?Version}} we'd get "1.0, 1.0".
When this starts happening for a given article, it'll happen all the time for that article. So it doesn't happen at run time randomly for any article: at some point it "activates" for some articles, and once it starts happening for a particular article it's there to stay. OTOH the values only appear once on the factbox at the bottom of the page, they're only duplicated on semantic queries and drilldown.
After digging on the logs and using the debug bar I found out that the SQL queries run on a wiki without the duplicated values issue and on one with it are the same, the problem comes in the results of this particular query:
SELECT p.smw_title as prop,o_blob AS v0,o_hash AS v1 FROM smw_di_blob INNER JOIN smw_object_ids AS p ON p_id=p.smw_id WHERE s_id='337192'
On the wiki with the problem I get something like this:
+--------------+------+-----------+
prop | v0 | v1 |
+--------------+------+-----------+
Property 1 | NULL | Value 1 |
Property 1 | NULL | Value 1 |
Property 2 | NULL | Value 2 |
Property 2 | NULL | Value 2 |
Property 3 | NULL | Value 3 |
Property 3 | NULL | Value 3 |
+--------------+------+-----------+
I checked further and it comes down to the smw_di_blob table, all the dupped values are there. I managed to "hide" this issue by forcing "$usedistinct = true" on SMW_SQLStore3_Readers.php line 285, but of course this is merely hiding the symptom instead of fixing the issue.
That's when asking and showing properties. Besides when asking for some conditions even if we're not asking for a particular property (just articles matching the condition), sometimes we're getting the same articles in the result twice. I think it's because of dupes on smw_object_ids but I'm not sure.
When this happens it doesn't happen for all the queries run, just for some of them. A full refresh (SMW_refreshData -ftpv, then another -v) usually fixes the issue, but not always. And even sometimes, a full refresh may fix SOME of the issues, but not all of them.
Version: master
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=48706