Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3035

Always allow bulk OP_INSERTs to accommodate unacknowledged write concerns

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.16.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • None
    • Environment:
      MongoDB 3.4 and earlier

      Original description: mongoc_collection_insert_many() does not batch legacy inserts for unacknowledged write concerns

      While investigating PHPC-1351 and other places where allow_bulk_op_insert was set, I came across the three collection-level insert methods. mongoc_collection_insert_bulk() (since deprecated) always allows bulk inserts when calling _mongoc_write_command_init_insert(), but mongoc_collection_insert_one() and mongoc_collection_insert_many() never allow bulk inserts. This isn't a problem for the insert-one case, but it appears that mongoc_collection_insert_many() may not batch inserts for unacknowledged write concerns when connected to MongoDB versions before 3.6.

      I quickly tested this by modifying example-command-monitoring.c to connect to a MongoDB 3.4 server using w=0. Running the example file shows that three insert commands are issued when I would expect two.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: