Skip to content

repo depot: add generation numbers for the desired TUF repo state #7399

@iliana

Description

@iliana

Currently the TUF artifact replication task checks the desired state of tasks in the database, then does a bunch of work. If an operator uploads or deletes a TUF repo from the system while a task is running, undesirable operations might take place.

It's unclear how real this risk is; see discussion at #7129 (comment). But without writing some sort of proof that undesirable operation will not occur, we should assume it will.

The planned solution here is to add a single-row table to store a generation number for the current state of the tuf_repo table. When a repository is added or removed, the generation number will be incremented. These steps then change:

  • Sled Agent stores a generation number on the "update" dataset on the M.2 devices, where artifacts are stored.
  • Before Nexus fetches the artifact list from the database, it fetches the generation number from the database.
  • Sled Agent includes the highest generation number it's aware of in "list artifacts" responses. If this generation number is higher than the one Nexus is aware of, task execution terminates early. (Unclear if this step is necessary.)
  • Put/copy/delete requests include the generation number Nexus is aware of. During each request Sled Agent checks the generation numbers on disk; if any are higher than the one provided by Nexus, it responds with 409 Conflict. If the number provided by Nexus is higher, that generation number is written to disk.

Metadata

Metadata

Assignees

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