-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EpochTable and integrate with existing code #1332
Conversation
One thing I noticed while working on integrating the metadata structures is that one needs to pay a bit of attention to the fact that one might have received an update for the |
8ceda18
to
03de4a7
Compare
What's the risk in this? In my mind, the PartitionTable needs to be on a single shared register, but epoch metadata don't actually even need to be (we can have a single metadata key per partition-id). Additionally, EpochMetadata don't need to be automatically synchronized, unless I'm missing something. |
No concrete risk atm. Just something to be aware of (more of a note to myself). I did include the |
let shutdown = cancellation_watcher(); | ||
tokio::pin!(shutdown); | ||
|
||
let mut partition_processor_manager = PartitionProcessorManager::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
03de4a7
to
837b350
Compare
837b350
to
5ce6935
Compare
Thanks for the review @AhmedSoliman. I've pushed an update to address your comments. |
5ce6935
to
60d9b95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
} | ||
|
||
pub fn epoch(&self) -> LeaderEpoch { | ||
// todo think about aligning Version and LeaderEpoch types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make use of types/src/logs.rs (trait SequenceNumber) instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, this could also be a solution. The conversion Version -> u32 -> u64 -> LeaderEpoch
is not super nice but also not incorrect at the moment.
60d9b95
to
7b029ae
Compare
Thanks a lot for the review @AhmedSoliman. I've addressed your comments. Merging this PR once GHA gives green light. |
9f86e92
to
b18b29e
Compare
This fixes restatedev#1323.
Let Bifrost obtain the number of partitions from the available partition table.
The PartitionProcessorManager is responsible for managing the lifecycle of PartitionProcessors. The set of partition processors can be modified by providing a PartitionProcessorPlan that contains actions how to change the running set of PartitionProcessors. At the moment only starting partition processors is supported.
This commit changes the APIs for obtaining the PartitionTable metadata to optional to underline the contract that a PartitionTable might not be loaded.
b18b29e
to
f133a78
Compare
This PR introduces the
EpochTable
which is used to record the latest leader epoch for a givenPartitionId
and the node assignment. TheEpochTable
is updated by the cluster controller upon attachment of a new node. The last attaching node will get all leaderships assigned. Moreover, this PR updates theWorker
to react toEpochTable
andPartitionTable
changes which require to run a different set of partition processors or make a different set of partition processors leaders. Last but not least, this PR updates the metadata update logic which now also supports sending epoch and partition table updates.This fixes #1323