Skip to content

An import that fails between creating a page and creating a version leaves an empty page record #192

Open
@Mr0grog

Description

@Mr0grog

If an import results in the creation of a new page record, but fails when creating the actual version of that page (because of invalid data), the empty page record gets left lying around afterward. While we think it’s OK for the DB to have pages with no versions, it’s not really desirable, and we shouldn’t wind up in that situation accidentally like this.

The import versions job needs to be careful to roll back the creation of a page if the version failed.

I can think of a couple straightforward ways of doing this:

  • Wrap the page + version creation together in a single transaction. Not sure on the overhead of this.
  • Keep a list of pages that were created by the job and, when cleaning up at the end, remove any that have no versions.

We also need a test for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions