Skip to content
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

sql: clear (rather than emptying) bound account #71280

Merged
merged 1 commit into from
Oct 7, 2021

Conversation

stevendanna
Copy link
Collaborator

@stevendanna stevendanna commented Oct 7, 2021

Empty() leaves some number of bytes in the bound account as
reserved. When we abandon a Container, those "reserved" bytes were
never released back to the parent. I believe we currently abandon one
Container at the end of each explicit transaction.

Fixes #71262
Fixes #71263
Fixes #71264
Fixes #65279

We may want to provide two different methods. One that calls Empty() and one that
calls Clear() in case there are users of this who really need to keep their reserved bytes.

Release note: None

Empty() leaves some number of bytes in the bound account as
reserved. When we abandon a Container, those "reserved" bytes were
never released back to the parent. I believe we currently abandon one
Container at the end of each explicit transaction.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@stevendanna stevendanna requested a review from Azhng October 7, 2021 13:52
@@ -636,7 +636,7 @@ func (s *Container) freeLocked(ctx context.Context) {
atomic.AddInt64(s.atomic.uniqueStmtFingerprintCount, int64(-len(s.mu.stmts)))
atomic.AddInt64(s.atomic.uniqueTxnFingerprintCount, int64(-len(s.mu.txns)))

s.mu.acc.Empty(ctx)
s.mu.acc.Clear(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow. That's a good one.

Copy link
Contributor

@Azhng Azhng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch! :lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @miretskiy and @stevendanna)

@Azhng
Copy link
Contributor

Azhng commented Oct 7, 2021

Though I think #65279 is probably unrelated since it's from way back in May, the offending PR was merged last night

@stevendanna
Copy link
Collaborator Author

Though I think #65279 is probably unrelated since it's from way back in May, the offending PR was merged last night

Unfortunately, the way the reporting works, the new failure because of the memory pressure just got added as a comment to the previous issue.

@Azhng
Copy link
Contributor

Azhng commented Oct 7, 2021

Ah, that was unfortunate 😢

@stevendanna
Copy link
Collaborator Author

bors r=[Azhng,miretskiy]

@craig
Copy link
Contributor

craig bot commented Oct 7, 2021

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants