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

EVA-2178 Fail when DB constraint is violated #69

Conversation

andresfsilva
Copy link
Contributor

@andresfsilva andresfsilva commented Nov 9, 2021

based on PR #62

}
entityManager.flush();
Copy link
Member

@sundarvenkata-EBI sundarvenkata-EBI Nov 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this might be a herculean task due to the concurrency requirements but did you check if it is possible to write a test that fails without the flush statement here but succeeds with it? If this is outside the scope of this PR, suggest creating a new JIRA ticket to check the viability of the timer latch code in PR#62 to test this.

Copy link
Member

@sundarvenkata-EBI sundarvenkata-EBI Nov 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the scope of this PR to honor database constraint violations, we succeed here on the Postgres side by potentially flushing reserved blocks. But on the Mongo side, we still have the insidious save-watermark-after-mongo-save scenario which can lead to overlapping allocations even when we run accession for multiple species sequentially with the same instance ID (see scenario below). I am not sure if recoverState during accession initialization fully fixes this (but this scenario should be relatively easy to simulate).

Scenario:

Step 1: species 1 -> instance-1 -> available block(100-200) -> allocation requested for 10 records -> mongo save for 10 records (partial failure for some reason with 5 written) -xx-> watermark NOT updated for the 5 saved records in the block

Step 2: We fail to check results carefully for the above species (although unlikely if we chain the clustering executions in Nextflow) and proceed with Species 2

species 2 -> instance-1 -> available block(100-200 since no watermark update happened previously) -> allocation requested for 10 records -> mongo save for 10 records (fully succeeds with possible overlap of 5 accessions with species 1) -> watermark updated for 10 saved accessions in the block -> available block (110-200)

@andresfsilva andresfsilva force-pushed the feature/EVA-2178-block-allocation-failure branch from 82e6c05 to 910759b Compare November 24, 2021 20:11
@andresfsilva andresfsilva merged commit 6b13caf into EBIvariation:master Nov 24, 2021
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