Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Bug 59204) Properties do not unset on page deletion #71

Merged
merged 11 commits into from
Jan 4, 2014
Merged

Conversation

mwjames
Copy link
Contributor

@mwjames mwjames commented Jan 3, 2014

Clean-up of related subjects to a property has to be done before store data
are modified which means that either run UpdateDispatcherJob before the
deleteSubject() in "online" mode or put both UpdateDispatcherJob and deleteSubject()
in a DeferredSubjectRemovalJob to ensure synchronize execution.

https://bugzilla.wikimedia.org/show_bug.cgi?id=59204

Clean-up of related subjects to a property has to be done before store data
are modified which means that either run UpdateDispatcherJob before the
deleteSubject() in "online" mode or put both UpdateDispatcherJob and deleteSubject()
in a DeferredSubjectRemovalJob to ensure synchronize execution.
@mwjames
Copy link
Contributor Author

mwjames commented Jan 3, 2014

Tests are failing because of SQLite, unittest_unittest_smw_fpt_mdat

SMW\Test\MwDatabaseSQLStoreIntegrationTest::testAfterPageCreation_StoreHasDataToRefreshWithoutJobs with data set #0 (0, 'withInterWiki', 'foo')
DBQueryError: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT * FROM unittest_unittest_smw_fpt_mdat WHERE s_id='4' LIMIT 1
Function: SMW::getProperties
Error: 1 no such table: unittest_unittest_smw_fpt_mdat

$db->tableName( $proptable->getName() ) returns unittest_unittest on SQLite
which causes test to fail.

https://s3.amazonaws.com/archive.travis-ci.org/jobs/16315316/log.txt
@mwjames
Copy link
Contributor Author

mwjames commented Jan 3, 2014

Running a var_dump check reveals that for "$from unittest_smw_fpt_mdat getName smw_fpt_mdat"

$db->select( $from, '*', $where, 'SMW::getProperties', array( 'LIMIT' => 1 ) ); returns with

Query: SELECT * FROM unittest_unittest_smw_fpt_mdat WHERE s_id='4' LIMIT 1 on SQLite

which of course fails with "Error: 1 no such table: unittest_unittest_smw_fpt_mdat" because of unittest_unittest_smw_fpt_mdat

https://s3.amazonaws.com/archive.travis-ci.org/jobs/16318048/log.txt

This method really should be its own class. Also not sure why this
just happened for sqlite. Perhaps the affected branch of the if is
just generally broken and another bug that is sqlite specific caused
it to be executed for sqlite?
Fix double prefixing issue in SMWSQLStore3Readers::getProperties
@JeroenDeDauw
Copy link
Member

Looks like I fixed the issue you ran into. Not sure about the original bug though. Feel free to merge if you think all is fine.

mwjames and others added 5 commits January 3, 2014 21:44
Clean-up of related subjects to a property has to be done before store data
are modified which means that either run UpdateDispatcherJob before the
deleteSubject() in "online" mode or put both UpdateDispatcherJob and deleteSubject()
in a DeferredSubjectRemovalJob to ensure synchronize execution.
$db->tableName( $proptable->getName() ) returns unittest_unittest on SQLite
which causes test to fail.

https://s3.amazonaws.com/archive.travis-ci.org/jobs/16315316/log.txt
This method really should be its own class. Also not sure why this
just happened for sqlite. Perhaps the affected branch of the if is
just generally broken and another bug that is sqlite specific caused
it to be executed for sqlite?
@mwjames
Copy link
Contributor Author

mwjames commented Jan 3, 2014

Thanks for the sqlite fix.

I'll want to have a feedback first from the bug reporter before merging this and I want to extend the test coverage after I got a feedback.

@ghost ghost assigned JeroenDeDauw Jan 3, 2014
@mwjames
Copy link
Contributor Author

mwjames commented Jan 4, 2014

Well I knew from the start that this has do go into a Job but I didn't want to waste my time in the first place if it wouldn't solve the issue reported, now that it seems that the issue was actually resolved I just made sure that the legacy behavior continues to work as before and for those who want a proper update of related entities can adopt the settings.

When the clean-up is initiated, it should preferably done as DeferredJob otherwise the chance that one runs into a runtime error is probable because finding the appropriate data before store->deleteSubject() can be expensive (we don't have any revision information about stored entity data therefore this has to be done synchronously).

@mwjames
Copy link
Contributor Author

mwjames commented Jan 4, 2014

OK, in this case I will tag this with 1.9.0.1

@JeroenDeDauw
Copy link
Member

Would have been nice to have #76 and this merged before 1.9 rel announce, in which case we could have linked it to 1.9.0.1. I'm however not comfortable with tagging 1.9.0.1 right after this gets merged without it first being tried by several users. Not a real issue though.

@JeroenDeDauw
Copy link
Member

Would be great if you could merge #76 into this PR btw, as currently it is not updating the rel notes, which is fixed by 76.

CRAP: 14
CC: 100%

The removal of a subject from the Store is being moved into a
`DeleteSubjectJob` and if necessary can be scheduled as `DeferredJob`
(enables to run deletion as background job).

Prior SMW 1.9, the subject deletion did not initiate any clean-up of
possible associate subjects, the
`smwgDeleteSubjectWithAssociatesRefresh` setting will allow to refresh
entities that are connected to a deleted subject.

A subject may be connected to a large group of associates, it is therefore
advisable that `smwgDeleteSubjectAsDeferredJob` is set TRUE in order to
avoid any performance issues (or runtime errors) during the deletion process.

In case the deletion is executed as `DeferredJob` it is suggested that
the JobQueue is being run repeatedly within a narrow time frame to avoid
an increased backlog.

### Legacy (default) setting
$GLOBALS['smwgOnDeleteAction'] = array(
	'smwgDeleteSubjectAsDeferredJob' => false,
	'smwgDeleteSubjectWithAssociatesRefresh' => false
);
@mwjames
Copy link
Contributor Author

mwjames commented Jan 4, 2014

After this is merged, I'll have/add another MwJobWithSQLStoreIntegrationTest which runs a test against an actual JobQueue for DeleteSubjectJob.

@JeroenDeDauw
Copy link
Member

Fantastic. Done with review. Looks good, merging.

@JeroenDeDauw JeroenDeDauw reopened this Jan 4, 2014
JeroenDeDauw added a commit that referenced this pull request Jan 4, 2014
(Bug 59204) Properties do not unset on page deletion
@JeroenDeDauw JeroenDeDauw merged commit 233200a into master Jan 4, 2014
@JeroenDeDauw JeroenDeDauw deleted the bug branch January 4, 2014 22:39
@mwjames
Copy link
Contributor Author

mwjames commented Jan 4, 2014

Just a heads up, when this is merged scrutinizer-ci will drop to 7.6 which is not caused by this change rather being related to "The rating algorithm used for inspecting the base and head index was different. This might result in rating changes which are unrelated to your code changes!".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants