-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
The decision to allow bulk OP_INSERT operations is determined when mongoc_bulk_operation_insert_with_opts() calls _mongoc_write_command_init_insert() to initialize a new insert command. The last argument (allow_bulk_op_insert) is determined by the acknowledgement, or lack thereof, of the mongoc_bulk_operation_t's current write concern.
Since PHPC constructs a mongoc_bulk_operation_t via mongoc_bulk_operation_new(), many fields are left initialized (e.g. database/collection name, write concern). These values are not set on the bulk write until it is executed with executeBulkWrite(). Therefore, insert commands will never permit bulk OP_INSERTs. The mongoc_bulk_operation_t definition is not public to PHPC so we cannot retroactively change the allow_bulk_op_insert at execution time (short of libmongoc adding some new public API to allow us to do so).
That said, there may be an alternative solution. Since libmongoc dropped support for MongoDB 2.6 in CDRIVER-2510, legacy opcodes should no longer be used for anything except unacknowledged writes in server versions prior to 3.6. With server versions 3.6+, libmongoc 1.10+ will route unacknowledged writes through OP_MSG (CDRIVER-2366). Given this, it may be safe for _mongoc_write_command_insert_legacy() to always enable allow_bulk_op_insert.
- depends on
-
CDRIVER-3035 Always allow bulk OP_INSERTs to accommodate unacknowledged write concerns
- Closed
- links to