-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
ALL
-
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
0
Problem
Currently, the server returns this error:
write exception: write errors: [Must run update to shard key field in a multi-statement transaction or with retryWrites: true.]
even if a user performs a shard key update outside a txn with $_internalApplyOplogUpdate with retryWrites enabled. A normal updateOne() command (ex: executed by the Go driver) does not encounter the error in the same circumstances.
mihai.andrei@mongodb.com notes:
I think this is a bug in DocumentSourceInternalApplyOplogUpdate. In particular, when performing an update, we populate the value of _allowShardKeyUpdatesWithoutFullShardKeyInQuery and obtain it from an UpdateRequest. It's not clear whether we actually have an UpdateRequest set up in DocumentSourceInternalApplyOplogUpdate that could supply this information.
This seems to affect 8.0. It could affect other versions too.
Impact
Fixing this bug ensures that shard key updates performed with $_internalApplyOplogUpdate can be run outside txns. This impacts C2C because mongosync relies on this operator. C2C is trying to stop using txns to boost performance.