GODRIVER-3043 Use default write/read concerns in the index search commands.#1563
GODRIVER-3043 Use default write/read concerns in the index search commands.#1563qingyang-hu merged 4 commits intomongodb:v1from
Conversation
df5fd92 to
bf1d085
Compare
API Change Report./x/mongo/driver/operationincompatible changes(*CreateSearchIndexes).WriteConcern: removed |
4319b32 to
23575bd
Compare
23575bd to
c9dd01f
Compare
| .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.
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.
| 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'"
| Deployment: csi.deployment, | ||
| Selector: csi.selector, | ||
| ServerAPI: csi.serverAPI, | ||
| Timeout: csi.timeout, |
There was a problem hiding this comment.
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.
I think it will be better to align with the implementation in "create_indexes.go".
There was a problem hiding this comment.
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.
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.
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.
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?
…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.