Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger] AddSKIP LOCKED to the query that retrieves messages#52639

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

hgraca
Copy link

QA
Branch?7.1
Bug fix?no
New feature?yes
Deprecations?no
Issues-
LicenseMIT

The currentSELECT ... FOR UPDATE retrieves rows, using the index to find and lock the retrieved rows.
This means that when we have more than one consumer, while one consumer is locking those rows, the whole index is locked thus other queries (consumers) will be put on hold.
While with a small table this might not be noticeable, as the table grows the meddling with the index becomes slower and the other consumers have to wait more time, eventually making the MQ inoperable.

TheSKIP LOCKED addition will allow other consumers to query the table and get messages immediately, ignoring the rows that other consumers are locking.

valtzu and eugeniocaroccicastoredc reacted with hooray emoji
@carsonbotcarsonbot added this to the7.1 milestoneNov 17, 2023
@hgracahgracaforce-pushed themessenger/add_skip_locked branch 7 times, most recently from88fce4e to1314061CompareNovember 18, 2023 11:08
@hgracahgraca marked this pull request as draftNovember 18, 2023 11:10
@hgracahgracaforce-pushed themessenger/add_skip_locked branch from1314061 toa36c205CompareNovember 18, 2023 11:40
@hgracahgraca marked this pull request as ready for reviewNovember 18, 2023 12:24
new OraclePlatform(),
'SELECT w.id AS "id", w.body AS "body", w.headers AS "headers", w.queue_name AS "queue_name", w.created_at AS "created_at", w.available_at AS "available_at", w.delivered_at AS "delivered_at" FROM messenger_messages w WHERE w.id IN (SELECT a.id FROM (SELECT m.id FROM messenger_messages m WHERE (m.queue_name = ?) AND (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) ORDER BY available_at ASC) a WHERE ROWNUM <= 1) FOR UPDATE',
];
} elseif (class_exists(MySQL57Platform::class)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Oracle?

Copy link
Author

Choose a reason for hiding this comment

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

No, this was already there, it's a way to know if we are using DBAL 4 or not.
Since MySQL57Platform is deprecated, it will not be included in DBAL4 anymore.
I guess we could/should put this in a method with a meaningful name...
I can do that if/when I have time, otherwise, I think it's fine to leave it as is since it was already like this.

OskarStark and xabbuh reacted with thumbs up emoji
@carsonbotcarsonbot changed the titleAdd "SKIP LOCKED" to the query that retrieves messages[Messenger] Add "SKIP LOCKED" to the query that retrieves messagesNov 20, 2023
@OskarStarkOskarStark changed the title[Messenger] Add "SKIP LOCKED" to the query that retrieves messages[Messenger] AddSKIP LOCKED to the query that retrieves messagesNov 20, 2023
@nicolas-grekas
Copy link
Member

Thank you@hgraca.

hgraca reacted with heart emoji

@nicolas-grekasnicolas-grekas merged commit06a85e0 intosymfony:7.1Nov 21, 2023
@hgraca
Copy link
Author

You are most welcome@nicolas-grekas! Thank you for Symfony! :)

Btw, do you think you can help me getthis other PR merged as well?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@OskarStarkOskarStarkOskarStark left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.1
Development

Successfully merging this pull request may close these issues.

4 participants
@hgraca@nicolas-grekas@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp