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

MONGOID-5601 Atlas Search Index Management #5723

Merged
merged 13 commits into from
Sep 27, 2023

Conversation

jamis
Copy link
Contributor

@jamis jamis commented Sep 18, 2023

Adds helpers for declaring, creating, and removing atlas search indexes for Mongoid document models.

yield

sleep step
raise Timeout::Error, 'wait took too long' if Mongo::Utils.monotonic_time - start > max
Copy link
Contributor

@johnnyshields johnnyshields Sep 19, 2023

Choose a reason for hiding this comment

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

(EDIT: I just realized this function is a spec helper. However, I'll leave the comment below as I still think it's useful re: indexes in general)

A few points re: timeout. Firstly, we should agree that large collections (100M+ docs) are the canonical use case for search indexes.

  1. Indexing large collections takes a long time. Since this is done via a Rake task, it would be great if Mongoid could indicate the index building progress. (Atlas UI does this--you can see the % completion of index--so there is presumably some way Mongoid could as well.
  2. If you set socket_timeout in your Mongoid.yml--which also is a best practice--your index building here is going to timeout after 30 seconds. Index building should skip socket timeout entirely, since it happens in background anyway.

@jamis jamis marked this pull request as draft September 20, 2023 14:56
@jamis jamis requested a review from comandeo September 22, 2023 22:10
@jamis jamis marked this pull request as ready for review September 22, 2023 22:10
lib/mongoid/search_indexable.rb Show resolved Hide resolved
@jamis jamis merged commit 34f7a91 into mongodb:master Sep 27, 2023
16 of 17 checks passed
@jamis jamis deleted the 5601-atlas-search-index-management branch September 27, 2023 21:24
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.

3 participants