[SERVER-82156] Inconsistency between FLE insert and FLE update responses for retriedStmtIds Created: 12/Oct/23  Updated: 07/Nov/23  Resolved: 30/Oct/23

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

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
Problem/Incident
Related
related to SERVER-80160 Retryable timeseries insert doesn't r... Backlog
Assigned Teams:
Server Security
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.1, v7.0
Steps To Reproduce:

Hello, I found the following that I think is inconsistent:

const dbName = "testDB";
const collName = "testColl";
const namespace = `${dbName}.${collName}`;
const primary = replTest.getPrimary();
const session = primary.startSession();
let testDB = session.getDatabase(dbName);
testDB.dropDatabase();
let client = new EncryptedClient(testDB.getMongo(), dbName);
assert.commandWorked(client.createEncryptionCollection(collName, {
    validator: {$jsonSchema: {required: ["x"]}},
    encryptedFields: {
        "fields": [
            {"path": "x", "bsonType": "string", "queries": {"queryType": "equality"}},
            {"path": "y", "bsonType": "string"},
        ]
    }
}));
 
for (let i = 0; i < 2; ++i) {
    let res = assert.commandWorked(this.testDB.runCommand(
    {
      insert: collName,
      documents: [{_id: 3, x: "0"}],
      writeConcern: {w: "majority"},
      lsid: session.getSessionId()
      txnNumber: NumberLong(10)
    });
    print(tojson(res));
} 
 
for (let i = 0; i < 2; ++i) {
    let res = assert.commandWorked(this.testDB.runCommand(
    {
    update: collName,
    updates: [{q: {_id: 1}, u: {$set: {"a.$[i].b": 7, x: "2"}}, arrayFilters: [{"i.b": 6}]}],
    writeConcern: {w: "majority"},
    lsid: session.getSessionId()
    txnNumber: NumberLong(11)
    });
    print(tojson(res));
}

For the retry of the insert, the response is

{
    "n" : 1,
    "electionId" : ObjectId("7fffffff0000000000000001"),
    "opTime" : {
        "ts" : Timestamp(1697145867, 1),
        "t" : NumberLong(1)
    },
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1697145868, 9),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    },
    "operationTime" : Timestamp(1697145868, 9)
} 

But for update, there is a retriedStmtIds field:

{
    "n" : 1,
    "electionId" : ObjectId("7fffffff0000000000000001"),
    "opTime" : {
        "ts" : Timestamp(1697145867, 1),
        "t" : NumberLong(1)
    },
    "retriedStmtIds" : [
        2
    ],
    "nModified" : 1,
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1697145869, 6),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    },
    "operationTime" : Timestamp(1697145869, 6)
} 

Sprint: Security 2023-11-13
Participants:
Linked BF Score: 164

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

Author:

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

Message: SERVER-82156 Fix retriedStmtIds field not appearing in some queryable encrypted retryable write responses

(cherry picked from commit deeb68db5e298b972d66a3e66fcc929c15999a4a)
Branch: v7.0
https://github.com/mongodb/mongo/commit/d3d6dba0e29f94aa045a73578a50227ebb4184d0

Comment by Githook User [ 30/Oct/23 ]

Author:

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

Message: SERVER-82156 Fix retriedStmtIds field not appearing in some queryable encrypted retryable write responses
Branch: master
https://github.com/mongodb/mongo/commit/deeb68db5e298b972d66a3e66fcc929c15999a4a

Comment by Githook User [ 24/Oct/23 ]

Author:

{'name': 'Liubov Molchanova', 'email': 'liubov.molchanova@mongodb.com', 'username': 'liubov-molchanova'}

Message: Revert "SERVER-82156 Fix retriedStmtIds field not appearing in some queryable encrypted retryable write responses"

This reverts commit 10b82ca1dbacd0dbec1d0ad229a774ad21601ee7.
Branch: master
https://github.com/mongodb/mongo/commit/81d584538f824f86a96351093ec73991d0448e8a

Comment by Githook User [ 23/Oct/23 ]

Author:

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

Message: SERVER-82156 Fix retriedStmtIds field not appearing in some queryable encrypted retryable write responses
Branch: master
https://github.com/mongodb/mongo/commit/10b82ca1dbacd0dbec1d0ad229a774ad21601ee7

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