-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
changefeedccl: Cleanup resources when closing file #106795
Conversation
Ensure resources acquired by cloud storage files are released when the sink is closed. As of cockroachdb#88635, cloud storage uses faster implementation of gzip compression algorithm (along with zstd). This new implementation is sufficiently different from the standard gzip implementation in that it requires the compression codec to be closed, even when the caller is terminating. Failure to do so results in the memory as well as the goroutine leakage. This resource leakage may become sufficiently noticable if the changefeed experiences many repeated errors. This PR modifies Close() call to make sure that the underlying compression codecs are also closed (Note: we rely on the high level logic in distSQL to ensure that the processor gets orderly shut down, and the shutdown code calls Close() method; However, there is still exists a possiblity that the shutdown might not be orderly, and in those cases resource leakage may still occur. This possiblity will need to be revisited in the follow on PR). Fixes cockroachdb#106774 Release note (enterprise change): Fix an issue where the changefeeds emitting to cloud sink with compression may experience resource leakage (memory and go routines) when experiencing transient errors.
Proactively close compression codecs if an error occurs when writing to cloud storage file. While we always call Close on the sink object, this PR ensures that even if this doesn't happen, the resources used by compression code are released as soon as an error (during write) occurs. Informs cockroachdb#106774 Release note: None
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @dt and @HonoreDB)
bors r+ |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 8d0a804 to blathers/backport-release-22.1-106795: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.1.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
22.1 didn't have this functionality; so ignore backport failure |
Ensure resources acquired by cloud storage files are released when the sink is closed.
As of #88635, cloud storage uses faster implementation of gzip compression algorithm (along with zstd). This new implementation is sufficiently different from the standard gzip implementation in that it requires the compression codec to be closed, even when the caller is terminating. Failure to do so results in the memory as well as the goroutine leakage.
This resource leakage may become sufficiently noticable if the changefeed experiences many repeated errors.
This PR modifies Close() call to make sure that the underlying compression codecs are also closed (Note: we rely on the high level logic in distSQL to ensure that the processor gets orderly shut down, and the shutdown code calls Close() method; However, there is still exists a possiblity that the shutdown might not be orderly, and in those cases resource leakage may still occur. This possiblity will need to be revisited in the follow on PR).
Fixes #106774
Release note (enterprise change): Fix an issue where the changefeeds emitting to cloud sink with compression may experience resource leakage (memory and go routines) when experiencing transient errors.