-
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
vttablet: fast and reliable state transitions #7011
Conversation
The previous query kill waited for mysql to return an error after initiating the kill. Sometimes, mysql can take a long time to kill queries. In this new code, we proactively close the client side connection. This will cause the execute to return immediately. We also return a custom non-connection error that will prevent the Exec function from unnecessarily retrying the query. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
The underlying dbConn has an ID function which is the mysql conn ID. We need to expose that in StatefulConnection with the same meaning. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Add support for /livequeryz to replace /streamqueryz Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Also separate out oltp and olap into different query lists because they have different kill rules. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Also renamed the var to olapql to align with oltpql. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
TxEngine state transitions don't get called concurrently. Removed all the synchronization logic. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
We're going to split oltp into transactional and non-transactional. This will lead to three URL paths for each query list. It's better to group them into a single URL, and add a type for each query list. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Separate out oltp into two separate qls so we can do faster transitions. With this change, a transition from REPLICA to MASTER will be immediate because we kill all currently running stateful queries. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Needed for extracting no-transactional stateful connections. Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
gotBytes, _ := yaml2.Marshal(config) | ||
log.Infof("Config:\n%s", gotBytes) |
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.
is this adding for debugging or want to publish this on startup?
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's good to publish this on startup. VTTablet does the same thing. It's useful for knowing what the default values are for each flag. But it doesn't spam the output because it shows up only if you -alsologtostderr
.
Fixes #6982
Robust query kill
errno 2013
which clients can interpret as a killed connection.StatefulConnection: ID -> ReservedID
The StatefulConnection had its own ID function that was hiding the underlying ID from dbConn. It has been renamed so that a StatefulConnection can be given to the QueryList for killing connections on demand.
Multiple Query Lists
TransactionShutdownSeconds -> ShutdownSeconds
This variable has been renamed to reflect the new meaning. The old flag continues to exist for backward compatibility and sets the same underlying variable.
timer.SleepContext
This has become a common pattern. So, I created this wrapper. We can later change other places to leverage this new function.
StateManager handles the grace period
TxEngine simplified
The TxEngine had a race condition where it was possible for a
Begin
to slip through after shutdown has been initiated. The code was also too complex because it was trying to handle some unnecessary concurrency. There is no need for concurrency because the state manager enforces synchronization of calls. The refactored code is much simpler and avoids the Begin race.pools.Numbered.GetByFilter
It was necessary for the tx pool to extract just the non-transactional connections from the stateful pool so that they are released first. I added a new GetByFilter function that can be used to get specific connections as defined by the filter func.
StatefulConnectionPool shutdown modes
TxEngine shuts down in two phases
Query timeout
If a query is executed in a transaction, its time out is now the minimum of the query timeout and the transaction timeout.