-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
97750: colexec: fix incorrect accounting when resetting datum-backed vectors r=yuzefovich a=yuzefovich This commit reverts a couple of other commits: - "colexec: fix a "fake" memory accounting leak for intra-query period" (72e83fe) - "colexec: deeply reset datum-backed vectors in ResetInternalBatch" (cb93c30) since they introduced incorrect memory accounting for the datum-backed vectors. Those two commits together solved another issue where we would keep no-longer-needed datums live for longer than necessary (until they are overwritten in the datum-backed vector) by eagerly nil-ing them out when resetting the whole batch. This required introducing some careful adjustment to the memory accounting in order to keep the accounting up to date. However, that logic turned out to be faulty; in particular, it became possible to register the allocations of the datum-backed vectors with one account but then attempt to release some of those allocations from another. If those releases happen enough times, it'd put the account in debt which would trigger an internal error (or a crash in test builds). Such a scenario can occur because we have a couple of utility operators that append a vector to a batch owned by another operator. When that other operator resets its batch, the appended-by-utility-operator vector is also reset, and the memory usage of the freed datum would be deregistered from the wrong account. Tracking precisely which vector is owned by the owner of the batch vs appended by another operator can be cumbersome and error-prone, so this commit instead of introducing this tracking removes the resetting behavior of the datum-backed vectors. This should be bullet-proof while only increasing slightly the amount of time references to datums are kept live. Fixes: #97603. Release note (bug fix): CockroachDB could previously encounter an internal error "no bytes in account to release ..." in rare cases and this is now fixed. The bug was introduced in 22.1. Co-authored-by: Yahor Yuzefovich <[email protected]>
- Loading branch information
Showing
15 changed files
with
141 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.