Project

Profile

Help

Issue #8305

Deleting a remote used as source for live content corrupts ContentArtifact records

Added by dalley about 2 months ago. Updated about 1 month ago.

Status:
NEW
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

  • Create a repository and on_demand remote, and sync them.
  • Delete the remote

The deletion of the Remote deletes the RemoteArtifacts, leaving behind ContentArtifact attached to neither Artifacts nor Remotes, making them effectively corrupted and unpublishable.

# create repository, remote
remote = remote_api.create(gen_file_remote(policy='on_demand'))
repo = repo_api.create(gen_repo())

# sync the repository
repository_sync_data = RepositorySyncURL(remote=remote.pulp_href)
sync_response = repo_api.sync(repo.pulp_href, repository_sync_data)
task = monitor_task(sync_response.task)

# delete the remote
monitor_task(remote_api.delete(remote.pulp_href).task)

# ^---- problem occurs here, now RemoteArtifacts deleted, now ContentArtifact is broken

publish_response = publications_api.create({"repository_version": task.created_resources[0]})
monitor_task(publish_response.task)  # boom publish failure

This is more pernicious because content units can move throughout repositories, and if the remote is ever deleted, every repo can be broken at once with no safeguards.

reproduce_publish_error.py (1.28 KB) reproduce_publish_error.py dalley, 02/25/2021 08:58 PM

History

#1 Updated by dalley about 2 months ago

We should probably introduce an actual constraint that enforces this, so it blows up immediately if it ever occurs.

#2 Updated by dalley about 2 months ago

  • File reproduce_publish_error.py reproduce_publish_error.py added
  • File deleted (reproduce_publish_error.py)
  • Subject changed from Some sequences of events can result in invalid ContentArtifact records to Deleting a remote used as source for live content corrupts ContentArtifact records
  • Description updated (diff)

#3 Updated by dalley about 2 months ago

  • Priority changed from Normal to High

#4 Updated by dalley about 2 months ago

  • Description updated (diff)

#5 Updated by dalley about 1 month ago

Recreating the remote and re-syncing does fix the content artifacts, but if you don't notice the problem immediately, or if you copied the content around between repos, it would be practically impossible to know how to resolve the issue.

There's some discussion on solutions here: https://hackmd.io/_3gsUVdyQwy50Nc5pMXN-g

#6 Updated by fao89 about 1 month ago

  • Triaged changed from No to Yes

#7 Updated by mdellweg about 1 month ago

Idea to solve the problem: Add a force flag to the DELETE call. If force is not specified, and the remote is referenced by either a repository or a remote artifact, the call will fail.

#8 Updated by dalley about 1 month ago

  • Priority changed from High to Normal

Please register to edit this issue

Also available in: Atom PDF