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

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

Merged
merged 9 commits into from Nov 7, 2023

Conversation

vbabanin
Copy link
Member

@vbabanin vbabanin commented Nov 2, 2023

@vbabanin
Copy link
Member Author

vbabanin commented Nov 2, 2023

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

Copy link
Contributor

@jyemin jyemin left a comment

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
Copy link
Member

@stIncMale stIncMale left a comment

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
Copy link
Member Author

vbabanin commented Nov 7, 2023

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
Copy link
Member Author

vbabanin commented Nov 7, 2023

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?

@@ -694,7 +694,9 @@ public ListSearchIndexesPublisher<Document> listSearchIndexes() {
@Override
public <TResult> ListSearchIndexesPublisher<TResult> listSearchIndexes(final Class<TResult> resultClass) {
notNull("resultClass", resultClass);
return new ListSearchIndexesPublisherImpl<>(mongoOperationPublisher.withDocumentClass(resultClass));

return new ListSearchIndexesPublisherImpl<>(mongoOperationPublisher
Copy link
Contributor

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
58 checks passed
@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
Contributor

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
Contributor

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
3 participants