Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-82156

Inconsistency between FLE insert and FLE update responses for retriedStmtIds

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0, 7.0.4
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Server Security
    • Fully Compatible
    • ALL
    • v7.1, v7.0
    • Hide

      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)
      } 
      Show
      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) }
    • Security 2023-11-13
    • 164

          Assignee:
          erwin.pe@mongodb.com Erwin Pe
          Reporter:
          frederic.vitzikam@mongodb.com Frederic Vitzikam
          Votes:
          0 Vote for this issue
          Watchers:
          4 Start watching this issue

            Created:
            Updated:
            Resolved: