[SERVER-46913] Disable majority read concern in change stream failed Created: 17/Mar/20  Updated: 27/Oct/23  Resolved: 19/Mar/20

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 4.2.3
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: vinllen chen Assignee: Backlog - Triage Team
Resolution: Community Answered Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Backwards Compatibility: Fully Compatible
Participants:

 Description   

In thisĀ change stream post, the read concern majority option can be disabled in v4.2. So I try to use "read concern=local" to build the change stream in golang but failed:

(InvalidOptions) $changeStream cannot run with a readConcern other than 'majority', or in a multi-document transaction. Current readConcern: { readConcern: { level: "local" } }

Here is the mongodb source code in document_source_change_stream.h

        void assertSupportsReadConcern(const repl::ReadConcernArgs& readConcern) const {
            // Only "majority" is allowed for change streams.
            uassert(ErrorCodes::InvalidOptions,
                    str::stream() << "$changeStream cannot run with a readConcern other than "
                                  << "'majority', or in a multi-document transaction. Current "
                                     "readConcern: "
                                  << readConcern.toString(),
                    !readConcern.hasLevel() ||
                        readConcern.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern);
        }

It looks like the majority read concern is not disabled.



 Comments   
Comment by vinllen chen [ 19/Mar/20 ]

Thanks, got it, this issue can be closed.

Comment by William Schultz (Inactive) [ 17/Mar/20 ]

In v4.2, If you are running with enableMajorityReadConcern:false on the server side, then you can still use readConcern "majority" on the client side with change streams specifically.

Comment by vinllen chen [ 17/Mar/20 ]

I think I made a mistake, it means the majority option can be disabled on the server-side, not the client-side.

Generated at Thu Feb 08 05:12:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.