Skip to content

Add constraint so that no duplicate records for druid's workflow steps are possible #221

@tallenaz

Description

@tallenaz

For example: see https://jirasul.stanford.edu/jira/browse/SDRO-282

TL;DR, two druids were stuck in the accessionWF, meaning that their status was "Accessioned" but they were still active in the workflow, with some steps showing a waiting status.

Trying to set the status of waiting steps to completed didn't work -- the steps remained in waiting.

Looking at the objects in the workflow database revealed that the objects had at least one, sometimes two records for each completed step. We were able to remediate the objects by deleting the duplicate completed steps, and the remaining waiting steps for the object, then re-indexing them. At that point, the objects had an "Accessioned" status and showed they had completed the workflow.

This is how we discovered and remediated the objects:

> WorkflowStep.where(druid: 'druid:yp120fy0284', workflow: 'accessionWF', status: 'completed', process: 'content-metadata').count
 => 1 
> WorkflowStep.where(druid: 'druid:yp120fy0284', workflow: 'accessionWF', status: 'completed', process: 'start-accession').count
 => 2 
> WorkflowStep.where(druid: 'druid:yp120fy0284', workflow: 'accessionWF', status: 'waiting').count
 => 10
> WorkflowStep.where(druid: 'druid:yp120fy0284', workflow: 'accessionWF', status: 'completed', process: 'start-accession').first.destroy
> WorkflowStep.where(druid: 'druid:yp120fy0284', workflow: 'accessionWF', status: 'waiting').each { |wfs| wfs.destroy }

Presumably this would be a harder position to get into if the workflow service were unable to generate "duplicates" like these, whether duplicate records for a step at a given status, or across different statuses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions