Skip to content

Remove write and read concern from Atlas Search Index commands.#1241

Merged
vbabanin merged 9 commits into
mongodb:masterfrom
vbabanin:JAVA-5233
Nov 7, 2023
Merged

Remove write and read concern from Atlas Search Index commands.#1241
vbabanin merged 9 commits into
mongodb:masterfrom
vbabanin:JAVA-5233

Conversation

@vbabanin

@vbabanin vbabanin commented Nov 2, 2023

Copy link
Copy Markdown
Member

@vbabanin vbabanin requested a review from stIncMale November 2, 2023 04:55
@vbabanin

vbabanin commented Nov 2, 2023

Copy link
Copy Markdown
Member Author

Evergreen task: test-atlas-search-index-helpers

@jyemin jyemin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Small change request, but LGTM

@vbabanin vbabanin self-assigned this Nov 2, 2023

@stIncMale stIncMale left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The task test-atlas-search-index-helpers fails with

AtlasSearchIndexManagementProseTest > Case 1: Driver can successfully create and list search indexes FAILED
[2023/11/03 21:24:40.234]     com.mongodb.MongoCommandException: Command failed with error 72 (InvalidOptions): 'Command aggregate does not support { readConcern: { level: "majority" ...

Weirdly, this test failure is reported as SYSTEM FAILED.

@vbabanin

vbabanin commented Nov 7, 2023

Copy link
Copy Markdown
Member Author

The task test-atlas-search-index-helpers fails with

AtlasSearchIndexManagementProseTest > Case 1: Driver can successfully create and list search indexes FAILED
[2023/11/03 21:24:40.234]     com.mongodb.MongoCommandException: Command failed with error 72 (InvalidOptions): 'Command aggregate does not support { readConcern: { level: "majority" ...

Weirdly, this test failure is reported as SYSTEM FAILED.

Fixed. Evergreen task: test-atlas-search-index-helpers

@vbabanin vbabanin requested review from jyemin and stIncMale and removed request for stIncMale November 7, 2023 01:50
@vbabanin

vbabanin commented Nov 7, 2023

Copy link
Copy Markdown
Member Author

Added a new change to use the default read concern for Atlas Search Commands, which means it won't be added to commands. Would you mind giving it another look, @jyemin?

notNull("resultClass", resultClass);
return new ListSearchIndexesPublisherImpl<>(mongoOperationPublisher.withDocumentClass(resultClass));

return new ListSearchIndexesPublisherImpl<>(mongoOperationPublisher

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not clear on why, in driver-sync's MongoCollectionImpl, read concern seems to have been removed, while here it seems like we're adding it. Can you clarify the intent?

@jyemin jyemin removed the request for review from stIncMale November 7, 2023 14:05
@vbabanin vbabanin changed the title Remove write concern from Atlas Search Index commands. Remove write and read concern from Atlas Search Index commands. Nov 7, 2023
@vbabanin vbabanin merged commit 275dbc0 into mongodb:master Nov 7, 2023
@vbabanin vbabanin deleted the JAVA-5233 branch November 7, 2023 19:21
vbabanin added a commit to vbabanin/mongo-java-driver that referenced this pull request Nov 7, 2023
the server will return an error. */
if (isSearchIndexCommand(event)) {
BsonDocument command = event.getCommand();
assertFalse(command.containsKey("writeConcern"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I realized that I had noticed this earlier and then neglected to comment on it: asserting like this in any event listener is likely a no-op since the driver (I think) swallows exceptions thrown by listeners and in any case it may throw on a different thread for reactive tests.

You need to instead set some state in the listener and then assert on that state in the main test code. There are examples of this in many places in the driver.

Since this PR is already merged, you'll have to address it in a follow-up PR.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(This is a good example of where writing a failing test first, TDD style, can catch errors in the test itself)

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