Skip to content

Change redis worker task pickup algo to respect FIFO shared resources#7623

Merged
gerrod3 merged 2 commits intopulp:mainfrom
gerrod3:redis-task-pickup
Apr 22, 2026
Merged

Change redis worker task pickup algo to respect FIFO shared resources#7623
gerrod3 merged 2 commits intopulp:mainfrom
gerrod3:redis-task-pickup

Conversation

@gerrod3
Copy link
Copy Markdown
Contributor

@gerrod3 gerrod3 commented Apr 22, 2026

When the redis task worker is fetching tasks, it is checking waiting tasks in creation order that have app_lock=null. Then for each task it tries to acquire the resource (and task) locks on the task from redis. If it succeeds then it proceeds to switch the the task's app_lock=self.app_status and return the task, with the goal being that the redis checks will make this final update call only happen on one worker, reducing database row contention. Now the redis check only sees currently taken resource locks from running tasks, it has no idea about tasks that are waiting ahead of the task we are checking. So the redis worker needs to create a list of taken resources ahead of the current checked task to prevent out of order execution.

Another thing to note is that the block_resource_list that redis returns is opportunistic so it will return as soon as it finds a blocked resource. It doesn't always check every resource that was blocked.

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

dkliban
dkliban previously approved these changes Apr 22, 2026
pedro-psb and others added 2 commits April 22, 2026 13:36
A finalizer task (exclusive resource lock) can start before sibling tasks
(shared resource lock) have completed if they are blocked on a separate
exclusive resource. In the Redis worker, this bypasses FIFO ordering because
the sibling's shared resource is never added to blocked_shared when the
blocking reason is its exclusive resource.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gerrod3 gerrod3 merged commit 6b2927e into pulp:main Apr 22, 2026
13 of 14 checks passed
@gerrod3 gerrod3 deleted the redis-task-pickup branch April 22, 2026 18:59
@pedro-psb pedro-psb mentioned this pull request Apr 22, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants