rmap-project / rmap

RMap Project is an Alfred P. Sloan Foundation-funded initiative undertaken by the Data Conservancy, Portico, and IEEE. The goal of RMap is to make it possible to capture and preserve the many-to-many complex relationships among the distributed components of a scholarly work.
https://rmap-project.atlassian.net/wiki
Apache License 2.0
7 stars 6 forks source link

Ensure DiSCO deletions are handled correctly by indexer #176

Open karenhanson opened 6 years ago

karenhanson commented 6 years ago

Deletion and tombstone Events against a DiSCO only affect the target DiSCO version. Other versions in the lineage maintain their current status. DiscosSolrOperations.deleteDocumentsForLineage(String lineageUri) appears to delete all DiSCOs in a lineage when a DiSCO deletion occurs, To match RMap's behavior, it should only act on the DiSCO version that is the target of the deletion or tombstone Event. Here is an example to illustrate how statuses can change within a lineage:

//create discoV1
discoV1 (active)
//update discoV1
discoV1 (inactive)
discoV2 (active)
//update discoV2
discoV1 (inactive)
discoV2 (inactive)
discoV3 (active)
//update discoV2 
Cant update, the most recent version is discoV3
//tombstone discoV2
discoV1 (inactive)
discoV2 (tombstoned - but content in triplestore)
discoV3 (active)
//hard delete discoV3
discoV1 (inactive)
discoV2 (tombstoned - but content in triplestore)
discoV3 (deleted - content not in triplestore)
emetsger commented 6 years ago

@karenhanson can this be closed?

IIRC, there is no support for "hard deletes" anywhere in RMap, so at the moment the indexer doesn't need to support them. If hard delete support needs to be tracked, maybe we can add an issue for that separately?

emetsger commented 6 years ago

Ah @karenhanson I see hard-delete is a function of the admin tool. Let me see if I can easily update the indexer to accommodate.

emetsger commented 6 years ago

@karenhanson ok, it looks like the code should accommodate hard-deletes: the indexer treats them the same as tombstones (the documents for the deleted disco are removed from the index).

What is missing is an integration test for hard-delete.

Is there a way I can simulate a hard-delete using the API or UI in an integration test?

karenhanson commented 6 years ago

@emetsger This test simulates delete: https://github.com/rmap-project/rmap/blob/be5a42462152a1343657c7be84fca61b8e28b138/webapp/src/test/java/info/rmapproject/webapp/controllers/AdminToolControllerTest.java#L233-L252 This is the method that actually does the deletion work - it creates an Admin Agent in RMap if one doesn't already exist and then uses that Agent to delete the DiSCO: https://github.com/rmap-project/rmap/blob/be5a42462152a1343657c7be84fca61b8e28b138/webapp/src/main/java/info/rmapproject/webapp/service/RMapUpdateServiceImpl.java#L64-L70 The description provided goes into RMapEvent.description