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

Inserting large number of documents (100k) into sharded collection fails with BSONObjectTooLarge after leader election

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.20, 4.4.21
    • Component/s: None

      Inserting large number of documents (100k) into sharded collection fails with BSONObjectTooLarge after leader election:

      batch op errors occurred, full error: {'writeErrors': [{'index': 0, 'code': 10334, 'codeName': 'BSONObjectTooLarge', 'errmsg': 'Write results unavailable from localhost:20508 :: caused by :: BSONObj size: 20437898 (0x137DB8A) is invalid. Size must be between 0 and 16793600(16MB) First element: n: 0', 'op': {'_id': ObjectId('644fd4c873ed9f40e707f8be'), 'x': 0}}, ..., {'index': 99999, 'code': 10334, 'codeName': 'BSONObjectTooLarge', 'errmsg': '', 'op': {'_id': ObjectId('644fd4c973ed9f40e7097f5d'), 'x': 99999}}], 'writeConcernErrors': [], 'nInserted': 0, 'nUpserted': 0, 'nMatched': 0, 'nModified': 0, 'nRemoved': 0, 'upserted': []}  

      Rerunning the same insert immediately after will succeed.

       

      This happens for both pymongo and the go-driver.

      Additional note: under certain circumstances, running `db.adminCommand(

      { flushRouterConfig: "test.apricot" }

      )` would avoid this error as well. I think doing so after a leader election works, but flushing before a leader election does not.

        1. logs.zip
          72 kB
        2. repro.py
          0.4 kB

            Assignee:
            backlog-server-cluster-scalability [DO NOT USE] Backlog - Cluster Scalability
            Reporter:
            craven.huynh@mongodb.com Craven Huynh
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: