-
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
Use proper zstd decoder pool for binlog event compression handling #17042
Conversation
Signed-off-by: Matt Lord <[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: Matt Lord <[email protected]>
9cc4662
to
c8725fe
Compare
Signed-off-by: Matt Lord <[email protected]>
c8725fe
to
f2e6ad1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17042 +/- ##
=======================================
Coverage 67.15% 67.15%
=======================================
Files 1571 1571
Lines 251836 251876 +40
=======================================
+ Hits 169110 169146 +36
- Misses 82726 82730 +4 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
go/mysql/binlog_event_compression.go
Outdated
} | ||
return d | ||
}, | ||
panic(fmt.Errorf("failed to create stateless decoder: %v", err)) |
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 we panic here and prevent the process from launching? Option is for the decompress()
to return an error if statefulDecoderPool
failed to initialize.
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 better to panic, I think, as this is only allocated once at init() time. If we can't initialize it, we won't be able to run properly. The way the code was previously, it would just continually log errors w/o being able to do much. This should only ever fail if you're very low on memory (ENOMEM). This isn't the decoder pool here, it's the global shared stateless decoder used for smaller payloads.
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.
Only for compressed payloads, right? Is it documented that this failure can only happen for ENOMEM
. In case there is some other issue with zstd
preventing the executable from launching seems excessive and risky.
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.
Yeah, that's true.... maybe I'll just go back to logging like I was before then. It also has the benefit of limiting the changes.
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 went ahead and got rid of the panic and init(): e7191f0
No reason for us NOT to try initializing it again the next time we retry...
Signed-off-by: Matt Lord <[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.
I will let you decide on the panic.
Otherwise lgtm.
Signed-off-by: Matt Lord <[email protected]>
And do it as a JiT allocation Signed-off-by: Matt Lord <[email protected]>
…17042) Signed-off-by: Matt Lord <[email protected]>
…ion handling (#17042) (#17045) Signed-off-by: Matt Lord <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Description
This is a follow-up to #16328. There we added usage of
sync.Pool
, however when putting the object back in the pool we used the wrong pool. Instead of using thestatelessDocoderPool
we were using anothersync.Pool
instance that also existed in the package:readersPool
.This caused the
statelessDocoderPool
to NOT be used, but worse than that it could cause a panic when thereadersPool
was used here IF--mysql-server-pool-conn-read-buffers
was set (defaults to false): https://github.com/planetscale/vitess/blob/4522a0ad8930f3556627ec1ebbe69103f3b0fc01/go/mysql/conn.go#L290-L292We should backport this to v21 as that's the first release that contains #16328.
Related Issue(s)
Checklist