Skip to content

messager: avoid taking locks if there's no work to do#4745

Merged
sougou merged 1 commit intovitessio:masterfrom
tinyspeck:messager-avoid-needless-locks
Mar 31, 2019
Merged

messager: avoid taking locks if there's no work to do#4745
sougou merged 1 commit intovitessio:masterfrom
tinyspeck:messager-avoid-needless-locks

Conversation

@demmer
Copy link
Copy Markdown
Member

@demmer demmer commented Mar 22, 2019

In reviewing #4739 I noticed that the txpool calls into the messager engine on every committed transaction with the list of new messages / changed messages.

For all cases in which the transaction did not actually change a messages table, the two lists are empty, but the messager engine still takes internal locks to process these empty lists.

It seems like this could cause unnecessary lock contention, so add an initial short-circuit check in case both lists are empty.

Signed-off-by: Michael Demmer <mdemmer@slack-corp.com>
@demmer demmer requested a review from sougou as a code owner March 22, 2019 15:58
@sougou sougou merged commit 3ece871 into vitessio:master Mar 31, 2019
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.

2 participants