Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changefeedccl: Cleanup resources when closing file
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.
- Loading branch information