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

User-provided write concern is not honored when committing distributed transactions using 2PC

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Replication
    • ALL
    • Hide
      let st = ShardingTest({shards: 2, rs: {nodes: 3}});
      
      assert.commandWorked(st.s.adminCommand({shardCollection: 'test.foo', key: {x: 'hashed'}}));
      
      db.getMongo().setWriteConcern({w: 3})
      let session = db.getMongo().startSession();
      let sessionColl = session.getDatabase('test')['foo'];
      session.startTransaction();
      sessionColl.insertMany([{x: 1}, {x: 3}]);
      session.commitTransaction();
      
      // Check logs. See that commitTransaction on the participants was sent with w:'majority' instead of w:3
      
      st.stop();
      
      Show
      let st = ShardingTest({shards: 2, rs: {nodes: 3}}); assert.commandWorked(st.s.adminCommand({shardCollection: 'test.foo', key: {x: 'hashed'}})); db.getMongo().setWriteConcern({w: 3}) let session = db.getMongo().startSession(); let sessionColl = session.getDatabase('test')['foo']; session.startTransaction(); sessionColl.insertMany([{x: 1}, {x: 3}]); session.commitTransaction(); // Check logs. See that commitTransaction on the participants was sent with w:'majority' instead of w:3 st.stop();
    • Repl 2024-08-05

      When distributed transactions commit using two phase commit, user-provided write concerns stronger than w:'majority' are not honored: The TransactionCoordinator unconditionally attaches w:'majority' when sending the commit command to the participant shards.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: