[JAVA-5030] BulkOperations UpdateOne with list of Query and Update throws WriteConflict Error Created: 16/Jun/23  Updated: 16/Jun/23  Resolved: 16/Jun/23

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: JayaprakashNarayanan Ramanathan Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

While doing BulkOperations update, mongoDB throws WriteConflict error

BulkOperations bulkOperations = mongoTemplate.bulkOps(BulkOperations.BulkMode.ORDERED, CollectionConstants.COLLECTION_NAME_EQD_FIXING_AUDIT);
bulkOperations.updateOne(queryUpdates);
bulkOperations.execute();

Note: Here queryUpdates are List<Pair<Query, Update>>. Query object has ObjectId of the documents and all the 30k Query has unique ObjectId

Error:

Could not commit Mongo transaction for session [ClientSessionImpl@d9d19bd id = {"id": {"$binary":

{"base64": "vNL284T+Smeq2jcthOulSA==", "subType": "04"}

}}, causallyConsistent = true, txActive = false, txNumber = 11, error = d != java.lang.Boolean].; nested exception is com.mongodb.MongoCommandException: Command failed with error 112 (WriteConflict): 'WiredTigerRecordStore::insertRecord :: caused by :: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.' on server x01btsypdb1a.vsi.uat.dbs.com:27017. The full response is {"errorLabels": ["TransientTransactionError"], "ok": 0.0, "errmsg": "WiredTigerRecordStore::insertRecord :: caused by :: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction.", "code": 112, "codeName": "WriteConflict", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1686888951, "i": 22173}}, "signature": {"hash": {"$binary": {"base64": "sIYH92YWxYoaLCjcH8CyjZiHV08=", "subType": "00"}}, "keyId": 7189425660345974791}}, "operationTime": {"$timestamp":

{"t": 1686888951, "i": 1}

}}

 



 Comments   
Comment by Jeffrey Yemin [ 16/Jun/23 ]

Hi javajpn@gmail.com, it looks like you also asked for help on this in the community forum: https://www.mongodb.com/community/forums/t/writeconflict-error-while-doing-bulkoperations-update-using-spring-mongodb/231466. That is a more appropriate place to get free support, as the JAVA project is about reporting bugs or requesting features in the Java driver.

Other resources you can try, depending on your situation:

  • Our MongoDB support portal, located at support.mongodb.com
  • If you are an Atlas customer, you can also: Click the in-app chat icon in the lower right corner to chat with a MongoDB Support representative OR Click Support in the left-hand navigation to view Developer Resources.
Comment by PM Bot [ 16/Jun/23 ]

Hi javajpn@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon.

Generated at Thu Feb 08 09:03:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.