-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support KeyRange in --clusters_to_watch
flag
#17604
Support KeyRange in --clusters_to_watch
flag
#17604
Conversation
…exact shard values Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Manan Gupta <[email protected]>
// Refresh shards to watch. | ||
eg.Go(func() error { | ||
updateShardsToWatch() | ||
return 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.
We don't need this anymore, because we don't store the explicit shard names for the keyspaces that we want to watch in the entirety. Instead we just store a complete key range and that doesn't change during the course of running of a VTOrc instance.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17604 +/- ##
==========================================
+ Coverage 67.65% 67.68% +0.02%
==========================================
Files 1586 1586
Lines 255647 255655 +8
==========================================
+ Hits 172954 173033 +79
+ Misses 82693 82622 -71 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Manan Gupta <[email protected]>
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.
LGTM, thanks @GuptaManan100 🚀
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.
LGTM! I just have the one noted concern. Let me know if I'm missing or misunderstanding something. Either way, I'll come back to this quickly and we can get it merged. ❤️
Signed-off-by: Manan Gupta <[email protected]>
@mattlord I talked to @deepthi and she said that we only support In this light, the way the function is implemented (and corresponding tests verify this), is that if a users gives us something like Do you think it's worth adding the logic to continue to support arbitrary shard names? I can do that too, by basically creating another map from keyspace to shard names (like we had before), in addition to what we have, and store the shards that aren't range based in them, and continue to run equality checks for them. I personally, don't think we should add support for constructs that we've deprecated (I've added a catch-all to still watch all the shards), but I don't have strong opinions. |
That is exactly what the
But your usage of
I'm not suggesting we support arbitrary shard names, I'm suggesting that we do not allow it. 🙂 I'm not suggesting that we support shard names, I'm saying that currently we do support them because the input validator that you're using —
Yes, I know. I'm suggesting that the code should match your intentions here and do input validation and alert the user to this problematic usage (they can always just specify the keyspace name by itself).
IMO Does this make sense? I don't feel too strongly about it, so I'm OK with you making the final call. |
@GuptaManan100 why I think this discussion is worth having and why IMO we should do proper input validation is this... let's say that I have two shards: |
Yes, I see what you mean. You're right, I'll make the change ❤️ |
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
I've made both the changes @mattlord! You can take a look again! Thank you! |
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.
Thanks, @GuptaManan100 ! I like it 🙂
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
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.
Nice improvement! A few small things to fix, mostly wording and naming.
Signed-off-by: Manan Gupta <[email protected]>
Description
This PR addresses the feature request #17537.
Now
clusters_to_watch
flag accepts key ranges. The format for input is still the same, and therefore backward compatible.Internally Vitess now treats the input as key ranges instead of explicit shard names.
This allows the users to not restart VTOrc in case of a reshard. For example, if a VTOrc is configured to watch
ks/-80
, then it would watch all the shards that fall under the KeyRange-80
. If a reshard is run and,-80
is split into new shards-40
, and40-80
, the VTOrc instance will automatically start watching the new shard without needing a restart.As part of this change, I have restructured the
shardsToWatch
map to store key ranges instead of strings. I've also made it so that we don't need to update the shards information by insteading storing in the map that we are watching all the shards using a complete key range.Related Issue(s)
--clusters_to_watch
#17537Checklist
Deployment Notes