Skip to content

Serialize AnalysisNwbfile.cleanup and make trigger ownership explicit #1663

Description

@edeno

Follow-up to #1574.

AnalysisNwbfile.cleanup() currently documents a single-cleanup-process
contract. Trigger creation/removal is not owned by a run: overlapping runs can
adopt and remove one another's triggers, a partial acquisition can leave
inserts blocked, and registry changes can strand triggers.

Acceptance criteria

  • Serialize cleanup with a MySQL advisory lock or equivalent database-wide
    lease.
  • Reject or explicitly recover from pre-existing/stale cleanup triggers.
  • Have trigger acquisition return the exact triggers created by this run.
  • Roll back only those owned triggers after partial acquisition failure.
  • Drop only owned triggers during normal release.
  • Preserve the original cleanup exception while making release failures loud.
  • Add DB-backed tests for overlap, pre-existing triggers, partial acquisition,
    registry changes, and stale recovery instructions.

This issue covers cleanup-run ownership, not the separate writer-registration
race.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions