-
Notifications
You must be signed in to change notification settings - Fork 897
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
GODRIVER-3043 Use default write/read concerns in the index search commands. #1563
Conversation
df5fd92
to
bf1d085
Compare
API Change Report./x/mongo/driver/operationincompatible changes(*CreateSearchIndexes).WriteConcern: removed |
4319b32
to
23575bd
Compare
23575bd
to
c9dd01f
Compare
Makefile
Outdated
@@ -158,7 +158,7 @@ evg-test-load-balancers: | |||
|
|||
.PHONY: evg-test-search-index | |||
evg-test-search-index: | |||
go test ./mongo/integration -run TestSearchIndexProse -v -timeout $(TEST_TIMEOUT)s >> test.suite | |||
go test ./mongo/integration -run TestSearchIndexProse -v -timeout 3600s >> 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.
Can you add a comment explaining why we have to hardcode a timeout. Also, we could avoid a magic string using shell inline:
evg-test-search-index:
go test ./mongo/integration -run TestSearchIndexProse -v -timeout $(shell echo "$$(( $(TEST_TIMEOUT) * 2))")s >> test.suite
view := mt.Coll.SearchIndexes() | ||
|
||
definition := bson.D{{"mappings", bson.D{{"dynamic", false}}}} | ||
searchName := "test-search-index6" |
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.
searchName := "test-search-index6" | |
const searchName = "test-search-index-case6'" |
Suggest constantizing and using the name specified in the prose test: "test-search-index-case6'"
Database: csi.database, | ||
Deployment: csi.deployment, | ||
Selector: csi.selector, | ||
ServerAPI: csi.serverAPI, | ||
Timeout: csi.timeout, |
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's peculiar all this data was missing from the operation. Was it just missed in the original implementation?
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.
I think it will be better to align with the implementation in "create_indexes.go".
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.
IIUC, the search index management server commands actually manage resources on an Apache Lucene cluster (and maybe some database configuration), so it's possible some of the previously omitted info was unnecessary. However, it's not clear what the impact of adding or removing those fields is.
I generally agree that passing the same info as CreateIndexes
seems like a good idea, but should we test for that? Or if the info was truly unnecessary, should we continue to omit it?
Edit: To clarify, we shouldn't block merging the PR, but we should try to figure out whether we're missing test coverage for this type of behavior change that could be hiding other omissions.
require.Equal(mt, searchName, index, "unmatched name") | ||
var doc bson.Raw | ||
for doc == nil { | ||
cursor, err := view.List(ctx, opts) |
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.
Why not exhaust the cursor?
var doc bson.Raw
for cursor.Next(ctx) {
name := cursor.Current.Lookup("name").StringValue()
queryable := cursor.Current.Lookup("queryable").Boolean()
if name == searchName && queryable {
doc = cursor.Current
break
}
}
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.
I break on negative cursor.Next
to reduce the deep nesting block and simplify the exiting of the recurring List
calls.
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.
I mention doing this because this is what CXX does: https://github.com/kevinAlbs/mongo-cxx-driver/blob/fff7c2c71438f9f62c6b1a6ca5dee20f1c1749ac/src/mongocxx/test/search_index_view.cpp#L19
I think the current implementation is fine, though. IIUC in case 6 there would only ever be one doc on the cursor for view.List
. Is that correct?
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.
Correct.
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!
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.
Looks good! 👍
…mands. (mongodb#1563) (cherry picked from commit b1cd906)
GODRIVER-3043
GODRIVER-3122
Summary
Background & Motivation
The unified tests for GODRIVER-3043 have been added in GODRIVER-3074.