Skip to content

tx limiter: fix quota leak if Begin() errors or if the tx killer runs#6731

Merged
systay merged 1 commit intovitessio:masterfrom
dweitzman:fix_tx_limiter
Oct 7, 2020
Merged

tx limiter: fix quota leak if Begin() errors or if the tx killer runs#6731
systay merged 1 commit intovitessio:masterfrom
dweitzman:fix_tx_limiter

Conversation

@dweitzman
Copy link
Copy Markdown
Collaborator

The transaction limiter reduces a caller ID's quota within the transaction
pool to some fraction of the overall pool size. We've found it useful for
tightening the blast radius when a single client starts to have long
transactions for whatever reason.

We noticed in a development enviornment that the tx limiter was preventing
any new transactions for a particular caller ID even though no transactions
for that user were already in progress.

I'm not too familiar with this code, although it seems a bit brittle. In this PR
I've tried to make sure that if there's an error grabbing a connection from the
connection pool or if a connection is killed by the transaction killer, tx limiter
quota is restored.

I'd love for anyone who is to take a close look at this.

It seems possible that killed transactions were also previously not logged, and
this might fix that too?...

See #6727

Signed-off-by: David Weitzman dweitzman@pinterest.com

@dweitzman
Copy link
Copy Markdown
Collaborator Author

I'll look into the unit test race failure

The transaction limiter reduces a caller ID's quota within the transaction
pool to some fraction of the overall pool size. We've found it useful for
tightening the blast radius when a single client starts to have long
transactions for whatever reason.

We noticed in a development enviornment that the tx limiter was preventing
any new transactions for a particular caller ID even though no transactions
for that user were already in progress.

I'm not too familiar with this code, although it seems a bit brittle. In this PR
I've tried to make sure that if there's an error grabbing a connection from the
connection pool or if a connection is killed by the transaction killer, tx limiter
quota is restored.

I'd love for anyone who is to take a close look at this.

It seems possible that killed transactions were also previously not logged, and
this might fix that too?...

See vitessio#6727

Signed-off-by: David Weitzman <dweitzman@pinterest.com>
@dweitzman
Copy link
Copy Markdown
Collaborator Author

Fixed the race. The fake transaction limiter needed to use a mutex when saving/reading logs of the requests made to it.

@harshit-gangal harshit-gangal modified the milestone: v8.0 Oct 6, 2020
@systay systay merged commit 58f8fbb into vitessio:master Oct 7, 2020
@askdba askdba added this to the v8.0 milestone Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants