-
Notifications
You must be signed in to change notification settings - Fork 67
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 PartitionInstanceLifecycler #483
Conversation
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
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 job! (My comments are just tiny suggestions).
actorChan chan func() | ||
|
||
// Whether the partitions should be created on startup if it doesn't exist yet. | ||
createPartitionOnStartup *atomic.Bool |
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.
nit: Why does this need to be atomic.Bool
? I would expect that this flag can only be set before the service is started, and don't expect this to be changed concurrently. (Can this flag be part of config?)
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.
Can this flag be part of config?
Following current mimir logic, this flag is currently set after the lifecycler is created (and before it's started). That's why I've created a setter.
Why does this need to be atomic.Bool?
Not being part of config, I think we should make it safe even if it's not expected to be changed after lifecycler is started.
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.
After seeing Mimir PR, I understand this choice, but I still think making this part of config would make it clear that this isn't settable after creation of lifecycler.
|
||
// CreatePartitionOnStartup returns whether the lifecycle creates the partition on startup | ||
// if it doesn't exist. | ||
func (l *PartitionInstanceLifecycler) CreatePartitionOnStartup() bool { |
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.
Curious why do we need this "getter", if the flag can only be set before starting lifecycler.
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.
There's just a getter for any setter. I don't see it a big concern.
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
…here was a running error Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Thanks @pstibrany for your review. I've either replied or addressed comments. Could you take another look, please? |
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.
Thank you for addressing my feedback.
What this PR does:
This is another PR to add another piece of the experimental partitions ring support we're working on. In this PR I'm adding
ring.PartitionInstanceLifecycler
which is similar toring.Lifecycler
/ring.BasicLifecycler
but for partitions ring.Contrary to
ring.BasicLifecycler
,ring.PartitionInstanceLifecycler
doesn't support hooks: reason is not that hooks are a bad thing and shouldn't be supported (actually it turned out to be a flexible design) but it's just because we don't need hooks right now, so I preferred to keep code simpler and focused on the actual use case we have.Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]