-
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
Make transaction mode a dynamic configuration #17419
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Manan Gupta <[email protected]>
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]>
Signed-off-by: Manan Gupta <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17419 +/- ##
==========================================
- Coverage 67.63% 67.63% -0.01%
==========================================
Files 1581 1584 +3
Lines 253860 254060 +200
==========================================
+ Hits 171708 171825 +117
- Misses 82152 82235 +83 ☔ View full report in Codecov by Sentry. |
type StaticConfig struct { | ||
OnlineDDLEnabled bool | ||
DirectDDLEnabled bool | ||
TxMode vtgatepb.TransactionMode | ||
} | ||
|
||
func (s *StaticConfig) OnlineEnabled() 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: add a comment to explain the purpose of this struct
@@ -531,7 +531,7 @@ func TestScatterConnSingleDB(t *testing.T) { | |||
assert.Contains(t, errors[0].Error(), want) | |||
|
|||
// TransactionMode_MULTI in txconn. Should not fail. | |||
sc.txConn.mode = vtgatepb.TransactionMode_MULTI | |||
sc.txConn.txMode = &StaticConfig{TxMode: vtgatepb.TransactionMode_MULTI} |
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.
@GuptaManan100 It looks like the default for StaticConfig
for the DDL settings is different from the default in Vitess, should that always be true by default? We could achieve that by using an initializer function for it instead of a direct struct initialization?
|
||
type dynamicViperConfig struct { | ||
onlineDDL viperutil.Value[bool] | ||
directDDL viperutil.Value[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.
@GuptaManan100 I think it's still good to have a local reference here? That makes it easier to test also in the future? We could still provide a function like we have today with NewDynamicViperConfig
to bind the variables I guess, but it feels a bit more clean to explicitly have it?
Description
This PR makes the changes to allow for transaction mode to be a dynamic configuration.
We already have all the viper changes in place for us to be able to do this. Tests for the same have also been added. I also refactored a little bit of how we create dynamic configs introduced in #17328. The changes allow for us to only instantiate a single dynamic config instance and pass it around everywhere.
While trying to add a
/debug/config
endpoint to vtgate, I found out that one already exists and it already shows the config values there!I also found out that we already log changes in configurations too!
Related Issue(s)
Checklist
Deployment Notes