-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Shard precreation service #2878
Conversation
c607278
to
9f38248
Compare
1bc10eb
to
049c84d
Compare
I think this should just be part of the current |
I'm not sure @jwilder -- they are different things. One is about enforcing retention, the other is about optimizing the system to prevent shard creation on writes, with possibly lots of action on the consensus system. Apart from the fact that they both manipulate shard groups, they don't have much in else in common, right? |
Apart from the conceptual difference (in my mind) one could turn off shard precreation and the system would work perfectly fine (apart from the impact on write performance at certain times). But disable retention and the system will eat up more and more disk. Also, retention is a feature, our customers are aware of. This particular service is an implementation detail, albeit an important one. I do consider them quite separate. |
e1c17f9
to
6155078
Compare
Ready for merging. |
They both are features and issues related to retention policies though. A shard pre-creator doesn't makes sense on it's own without a retention policy which is why I think it belongs with a retention policy related package. Shard groups and shards are implementation details of retention policies. This pre-creation could be a separate service, but I don't think it needs to be since the current It's up to you but I don't think this structure makes sense. Moving it to |
|
||
for { | ||
select { | ||
case <-time.After(s.checkInterval): |
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.
Should this be a time.Ticker
?
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.
It could be, and that would be fine, but we don't need that fine a control over when shard precreation runs. A small jitter is a not big deal, since iterations of this loop only happen on the order of minutes. It seems in this case the less code is nicer.
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.
Happy to change this, don't feel strongly about it in this case.
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.
No strong opinion on it. Just noted that it's slightly different than how the other services do this so might raise questions as to why in the future.
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.
OK, good enough. I think this terse form gives the system exactly what it needs so will leave it for now.
6155078
to
0e64196
Compare
Thanks @jwilder -- good points. Unless I get push back from other members of the team, I'm going to go with the existing structure however, since I prefer decomposing the system like this. Of course, if it doesn't work, that is a different issue but I think we both agree both approaches work and are understandable. |
0e64196
to
4355e9d
Compare
} | ||
}) | ||
return numCreated, nil | ||
} |
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.
I think this should be moved into meta.Store.Precreate()
and the service should just call that.
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.
That's fair, and will help with future consolidation if we go there. Let me make that change.
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.
Actually, thinking about it a bit more, I think that might be going to a bit too far. I like the idea of using a simpler name, and moving the function into the meta
package, but I'm going to keep it focused on shard creation for now. I've done some of the coding, and it doesn't feel right to generalize it to that extent -- not yet anyway.
I don't have a strong opinion about consolidation although if we keep it in a separate package then I'd suggest just making it If we have other types of data that need to be precreated (besides shard groups) then those can get lumped in there later. |
Thanks for the feedback @jwilder and @benbjohnson -- |
Initial commit includes basic configuration control.
78067c6
to
5798d99
Compare
Final changes made. No logic changes, just naming and pushed shard creation logic into the store. While the service remains dedicated to shards, I still prefer a shorter name for the service, so went that change. I plan to merge this today, so any final feedback is welcome. |
lgtm |
See file
notes.md
for full a full description.Fixes #2735