chore: Use index on unlockAll query called when changing OM routing methods#32860
chore: Use index on unlockAll query called when changing OM routing methods#32860kodiakhq[bot] merged 5 commits intodevelopfrom
unlockAll query called when changing OM routing methods#32860Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #32860 +/- ##
========================================
Coverage 54.96% 54.96%
========================================
Files 2595 2595
Lines 55992 55992
Branches 11592 11592
========================================
Hits 30778 30778
Misses 22569 22569
Partials 2645 2645
Flags with carried forward coverage won't be shown. Click here to find out more. |
…ove/threadMetrics * 'develop' of github.com:RocketChat/Rocket.Chat: (22 commits) chore: saveAnalyticsData with accumulator (#32961) regression: fix dispatchInquiryPosition not being fired on room creation (#32972) chore: create `orm` for specific cases (#32948) chore: create `afterOmnichannelSaveMessage` (#32970) fix: `Menu` onPointerUp event behavior (#32968) Release 6.11.0-rc.2 feat: add `Advanced settings` on create Team and Channel (#32867) Revert "fix: Login services button colors" (#32955) chore: Use index on `unlockAll` query called when changing OM routing methods (#32860) chore: Exclude Storybook stories from the build of `@rocket.chat/ui-composer` (#32944) chore: Remove `ui-kit` from `yarn fuselage` script (#32942) Release 6.10.2 fix: Client crashing on firefox private window (#32950) fix: Apps-Engine patch (#32935) test: Remove mockDate and fix unit tests (#32947) (#32949) fix: validate `bhType` before registering it (#32931) test: Remove mockDate and fix unit tests (#32947) Bump 6.10.2 Release 6.11.0-rc.1 regression: notify user properly on logout (#32920) ...
Proposed changes (including videos or screenshots)
When using $or queries in mongo, all the individual conditions inside the $or should be covered by an individual index.
This query had 2 conditions but there was an index for one of them so mongo ignored the index and used a FTS instead.
Removing one of the conditions in the $or, and thus removing the need for an $or fixed the problem.
findNextAndLockalso updated to use a better index when suitable. But since this query always returns 1 document, the perf change is not noticeable.Issue(s)
https://rocketchat.atlassian.net/browse/CORE-548
Steps to test or reproduce
Further comments
Ref: https://www.mongodb.com/docs/manual/reference/operator/query/or/
Small colleciton: (2K records) (no diff on time because of small set, but notice how without index it falls back to collscan)

After:
Before:
