[SERVER-82984] FLE2 with upsert: true can have upsertedDocuments.size() == 1 and updateReply.getNModified() == 1 at the same time Created: 08/Nov/23  Updated: 27/Nov/23  Resolved: 13/Nov/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0, 7.2.0-rc2, 7.0.5

Type: Bug Priority: Major - P3
Reporter: Frederic Vitzikam Assignee: Erwin Pe
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Assigned Teams:
Server Security
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.2, v7.0
Sprint: Security 2023-11-13, Security 2023-11-27
Participants:
Linked BF Score: 0

 Description   

sean.zimmerman@mongodb.com found that the following 2 lines looked like a bug:

https://github.com/10gen/mongo-enterprise-modules/blob/master/jstests/fle2/bulk_write_update.js#L162 and https://github.com/10gen/mongo-enterprise-modules/blob/master/jstests/fle2/bulk_write_update.js#L176

I confirmed that this is not from BulkWrite but from processFLEUpdate.

erwin.pe@mongodb.com pointed to the code here and double checked that on a normal upsert this case would be nModified = 0 and n = 1. So nModified should be set here only if lastErrorObject.updatedExisting == true.



 Comments   
Comment by Githook User [ 16/Nov/23 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-82984 Fix nModified value for queryable encrypted upserts

(cherry picked from commit d0c3d8916ee8a0bf5aa151cba1413cc442e30adf)
Branch: v7.2
https://github.com/mongodb/mongo/commit/72e7ec8e6bd64d470c3c545160a12b3103b0fd58

Comment by Githook User [ 16/Nov/23 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-82984 Fix nModified value for queryable encrypted upserts

(cherry picked from commit d0c3d8916ee8a0bf5aa151cba1413cc442e30adf)
Branch: v7.0
https://github.com/mongodb/mongo/commit/1130b4b3a9590476a77757347d1100470b4e854e

Comment by Githook User [ 13/Nov/23 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-82984 Fix nModified value for queryable encrypted upserts
Branch: master
https://github.com/mongodb/mongo/commit/d0c3d8916ee8a0bf5aa151cba1413cc442e30adf

Generated at Thu Feb 08 06:50:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.