-
Notifications
You must be signed in to change notification settings - Fork 919
GODRIVER-3704 Fix search index failure on empty "Options". #2247
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
Conversation
🧪 Performance ResultsCommit SHA: 0508d4bThere were no significant changes to the performance to report for version 693370dd89f67600071024af. For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
API Change ReportNo changes found! |
1c96085 to
ee65456
Compare
ee65456 to
86957b1
Compare
| assume-test-secrets-ec2-role: | ||
| - command: ec2.assume_role | ||
| params: | ||
| role_arn: ${aws_test_secrets_role} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of L175
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where search index creation failed when SearchIndexModel.Options is nil. The fix ensures that the document element is always started before checking for optional fields.
Key changes:
- Moved
AppendDocumentElementStartcall outside theOptions != nilcheck to ensure proper BSON document construction - Added integration test to verify search index creation with empty options
- Standardized environment variable naming from
TEST_INDEX_URItoSEARCH_INDEX_URI
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
mongo/search_index_view.go |
Fixed bug by moving AppendDocumentElementStart before the Options != nil check, ensuring proper BSON document structure regardless of Options value |
internal/integration/search_index_test.go |
Added new integration test to verify search index creation with empty Options |
internal/integration/search_index_prose_test.go |
Updated environment variable name from TEST_INDEX_URI to SEARCH_INDEX_URI for consistency |
Taskfile.yml |
Updated test runner to execute both TestSearchIndex and TestSearchIndexProse tests |
.evergreen/config.yml |
Updated environment variable naming to SEARCH_INDEX_URI and removed duplicate assume-test-secrets-ec2-role function definition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
58bc4c2 to
1373cf2
Compare
|
|
||
| evg-test-search-index: | ||
| # Use the long timeout to wait for the responses from the server. | ||
| - go test ./internal/integration -run TestSearchIndexProse -v -timeout {{.LONG_TEST_TIMEOUT}}s >> test.suite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[blocking] We should define TestSearchIndexProse explicitly rather than relying on regex. Also note that the prose tests are being skipped since TEST_SEARCH_INDEX no longer is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestSearchIndexProse need to be manually triggered under test-search-index because it's time consuming.
| working_dir: src/go.mongodb.org/mongo-driver | ||
| shell: bash | ||
| script: |- | ||
| echo "SEARCH_INDEX_URI: ${MONGODB_URI}" > atlas-expansion.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[blocking] The EG changes seem to be trying to avoid using TEST_SEARCH_INDEX: "${MONGODB_URI}". If that's the case, we should keep the existing behavior for simplicity and roll TestSearchIndex into TestSearchIndexProse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that TestSearchIndexProse passes under the current TEST_SEARCH_INDEX paradigm, given the example you shared. So why do we need to add the SEARCH_INDEX_URI changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "go.mongodb.org/mongo-driver/v2/x/bsonx/bsoncore" | ||
| ) | ||
|
|
||
| func TestSearchIndex(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Blocking] We should roll this test into TestSearchIndexProse and open a DRIVERS ticket to extend the Search Index Management Helpers prose tests to include this gap case:
#### Case 9: Drivers use server default for unspecified name (`default`) and type (`search`)
| opts := options.Client().ApplyURI(uri).SetTimeout(timeout) | ||
| mt := mtest.New(t, mtest.NewOptions().ClientOptions(opts).MinServerVersion("7.0").Topologies(mtest.ReplicaSet)) | ||
|
|
||
| mt.Run("search indexes with empty option", func(mt *mtest.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[blocking] The prose test should ensure that not specifying the name and type when creating a search index will result in the name being "default" and the type being "search". See this test for example: https://github.com/prestonvasquez/go-playground/blob/827f1733956815d63bf6de702384c59c89a868f1/mgd_search_index_test.go#L17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Good point! Filed a DRIVERS ticket and a PR.
d3ab891 to
5b8e7cc
Compare
|
@qingyang-hu Should this PR be targeting release/2.4? |
5b8e7cc to
a2fb993
Compare
| working_dir: src/go.mongodb.org/mongo-driver | ||
| shell: bash | ||
| script: |- | ||
| echo "SEARCH_INDEX_URI: ${MONGODB_URI}" > atlas-expansion.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that TestSearchIndexProse passes under the current TEST_SEARCH_INDEX paradigm, given the example you shared. So why do we need to add the SEARCH_INDEX_URI changes?
| require.Equal(mt, "default", indexName) | ||
|
|
||
| var doc bson.Raw | ||
| for doc == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will run for the 10 minute default testing timeout. Suggest defining a context with a timeout to pass to view.List(). I'm not sure what a good value would be. Perhaps 1 minute?
prestonvasquez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
GODRIVER-3704
Summary
Background & Motivation