Skip to content

Adjust service chain ownership when reassigning services between workers#5435

Merged
bart-linera merged 7 commits intolinera-io:mainfrom
bart-linera:controller-chain-ownership
Feb 19, 2026
Merged

Adjust service chain ownership when reassigning services between workers#5435
bart-linera merged 7 commits intolinera-io:mainfrom
bart-linera:controller-chain-ownership

Conversation

@bart-linera
Copy link
Copy Markdown
Contributor

@bart-linera bart-linera commented Feb 12, 2026

Motivation

If a service is reassign from worker A to worker B by the controller application, worker A should cease to be the owner of the service's chain, and worker B should become an owner.

Proposal

Upon reassignment, when telling worker A to stop running the service, worker A will add worker B as an owner and notify the main controller chain.

The main controller will then tell worker B to take over, telling it at which height on the service chain it became an owner. Worker B then waits until it synchronizes the service chain until that height, and when it's ready, it starts listening to the chain in FullChain mode and removes worker A as an owner.

Test Plan

test_controller was extended to reassign a service from one worker to another, and then check if the second worker properly handles a task request.

Release Plan

  • These changes should be backported to the latest testnet branch, then
    • be released in a new SDK,

Links

added_at: BlockHeight,
},
// -- Messages sent from the workers to the controller chain --
HandoffStarted {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to have a (mermaid?) diagram with all the messages? I understand we have 5 chains in 3 locations :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, does it work if chains have several workers? (I believe the data structures allow it)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I tried to avoid assuming a single worker per service, since as you're saying, data structures allow multiple workers, but I also wasn't trying very hard to make it work in that case because of a comment in the controller that we should only use one worker per service for now. I actually believe this should work even with multiple workers, but I haven't tested it.

Copy link
Copy Markdown
Contributor

@ma2bd ma2bd Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking because in the case of a single worker per chain, it seems like we could remove HandoffStarted and have worker A directly send Start to worker B. But of course, it's interesting to be future-proof.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess even with multiple workers, the controller could include the list of new workers to be notified after the owners are added in the Stop message 🤔

Copy link
Copy Markdown
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Added a couple of questions

bart-linera and others added 4 commits February 13, 2026 10:33
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Start and Stop messages now carry handoff-related fields. Update the
service assignment, service removal, and messages table to match the code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ma2bd
Copy link
Copy Markdown
Contributor

ma2bd commented Feb 16, 2026

Please next time link the PR to the github issue in the proper way

@bart-linera
Copy link
Copy Markdown
Contributor Author

Ah, right, sorry!

Copy link
Copy Markdown
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed some variations on the idea but this could also be experimented on a different PR

@bart-linera bart-linera added this pull request to the merge queue Feb 19, 2026
Merged via the queue into linera-io:main with commit e6cae5a Feb 19, 2026
54 of 55 checks passed
@bart-linera bart-linera deleted the controller-chain-ownership branch February 19, 2026 15:39
bart-linera added a commit that referenced this pull request Feb 25, 2026
…tween workers (#5435) (#5506)

## Motivation

If a service is reassign from worker A to worker B by the controller
application, worker A should cease to be the owner of the service's
chain, and worker B should become an owner.

## Proposal

Upon reassignment, when telling worker A to stop running the service,
worker A will add worker B as an owner and notify the main controller
chain.

The main controller will then tell worker B to take over, telling it at
which height on the service chain it became an owner. Worker B then
waits until it synchronizes the service chain until that height, and
when it's ready, it starts listening to the chain in FullChain mode and
removes worker A as an owner.

## Test Plan

`test_controller` was extended to reassign a service from one worker to
another, and then check if the second worker properly handles a task
request.

## Release Plan

- These changes should be released in a new SDK

## Links

- Backported PR: #5435 
- [reviewer
checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
ndr-ds added a commit that referenced this pull request Feb 27, 2026
ndr-ds added a commit that referenced this pull request Feb 27, 2026
…vices between workers (#5435) (#5506)" (#5539)

## Motivation

Temporarily revert to unblock pm-infra.

## Proposal

Reverts 636dfe0 ("Adjust service chain ownership when reassigning
services between
workers").

## Test Plan

CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have the controller app update chain owners when a chain moves to another worker

2 participants