Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
distsqlrun: release buckets from hash aggregator eagerly
This commit makes hash aggregator release the memory under buckets eagerly (once we're done with the bucket) so that it is returned to the system. This can matter a lot when we have large number of buckets (on the order of 100k). Previously, this would happen only on the flow shutdown, once we're losing the references to `hashAggregator` processor. But it was problematic - we "released" the associated memory from the memory accounting, yet we were holding the references still. With this commit we will reduce the memory footprint and we'll be a lot closer to what our memory accounting thinks we're using. Release note (bug fix): Previously, CockroachDB was incorrectly releasing memory used by hash aggregation (we were releasing the correct amount from the internal memory accounting system but, by mistake, were keeping the references to the actual memory for some time which prohibited the memory to be garbage collected). This could lead to a crash (which was more likely when hash aggregation had store on the order of 100k of groups) and is now fixed.
- Loading branch information