Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1324

Can't insert 16 MiB documents

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.1.2
    • Affects Version/s: 1.1.1
    • Component/s: Wire Protocol
    • None

      Here is a gist of the program I used to attempt to insert a 16 MiB document: https://gist.github.com/tfogo/fea1a80c565f7e97f7464c6b0c39640f

      Running this results in this output:

      ERROR: an inserted document is too large 

      This error is due to this line:

      https://github.com/mongodb/mongo-go-driver/blob/1aaf676c48ebb378f02f7d93509d5f229c0cede2/x/mongo/driver/batches.go#L11

      This line is reducing the space available for documents in a message. The comment implies this is to make space for commands. But messages can be larger than 16 MiB (48 MB by default) so I believe it's incorrect to reserve space for commands that should be used for documents.

      I tested reducing reservedCommandBufferBytes to 0. This allows all documents up to 16 MiB in size to be inserted. However, trying to insert a document that is exactly 16 MiB causes another error:

      ERROR: (Location40414) BSON field 'insert.documents' is missing but a required field 

      This error comes from the server. It looks like the OP_MSG sent to the server could be malformed.

            Assignee:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Reporter:
            tim.fogarty@mongodb.com Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: