-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.5.1, 1.5.2, 1.5.3
-
Component/s: Connections
-
Environment:go1.16.4
windows
linux
From my understanding of reading the Go driver code documentation and mongo docs client drivers should, by default, be set to use causal consistency:
I've noticed in the Go(lang) driver, when creating a new client or creating a new session, both read concern and write concern are set to empty, but CausalConsistency/Consistent is set to true by default.
According to the go driver docs:
New Client:
New Session:
The `session.ClientSession.Consistent` property by default is set to true.
So should the driver by default, be setting the "best practice" causal consistency preferences?
OR when calling `client.StartSession(options.Session().SetCausalConsistency(true))` should this be setting default majority read and write concerns?
Current implementation of `mongo/options/sessionoptions.go#ln51`
// SetCausalConsistency sets the value for the CausalConsistency field. func (s *SessionOptions) SetCausalConsistency(b bool) *SessionOptions { s.CausalConsistency = &b return s }
Suggested Implementation?
// SetCausalConsistency sets the value for the CausalConsistency field. func (s *SessionOptions) SetCausalConsistency(b bool) *SessionOptions { s.CausalConsistency = &b s.DefaultReadConcern = readconcern.Majority() s.DefaultWriteConcern = writeconcern.New(writeconcern.WMajority()) return s }
- related to
-
DRIVERS-1798 Add read/write concern options on a session
- Backlog