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

chore: Use index on unlockAll query called when changing OM routing methods #32860

Merged
merged 5 commits into from
Aug 1, 2024

Conversation

KevLehman
Copy link
Contributor

@KevLehman KevLehman commented Jul 22, 2024

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.

findNextAndLock also 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:
image

Before:
image

Copy link
Contributor

dionisio-bot bot commented Jul 22, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Jul 22, 2024

⚠️ No Changeset found

Latest commit: b31933f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.96%. Comparing base (a663078) to head (b31933f).

Additional details and impacted files

Impacted file tree graph

@@           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           
Flag Coverage Δ
unit 72.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@KevLehman KevLehman marked this pull request as ready for review July 22, 2024 17:34
@KevLehman KevLehman requested a review from a team as a code owner July 22, 2024 17:34
@ricardogarim ricardogarim self-requested a review July 25, 2024 11:50
@KevLehman KevLehman added this to the 6.12 milestone Jul 29, 2024
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Jul 30, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 30, 2024
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Jul 31, 2024
@KevLehman KevLehman added the stat: ready to merge PR tested and approved waiting for merge label Aug 1, 2024
@kodiakhq kodiakhq bot merged commit dd42703 into develop Aug 1, 2024
50 checks passed
@kodiakhq kodiakhq bot deleted the chore/better-index-unlockall branch August 1, 2024 05:35
gabriellsh added a commit that referenced this pull request Aug 5, 2024
…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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants