Skip to content

Commit

Permalink
DRIVERS-2761 do not apply readConcern or writeConcern to search i…
Browse files Browse the repository at this point in the history
…ndex commands (#1474)

* require not applying read and write concern

* add prose test with non-default read/write concern

* unit test each search index management command

* update changelog

* Add empty line. Remove double spaces.

* fix sphinx warning: "Title underline too short"

---------

Co-authored-by: Jérôme Tamarelle <[email protected]>
  • Loading branch information
kevinAlbs and GromNaN authored Dec 12, 2023
1 parent ec0f26b commit 0b47194
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Unacknowledged/Acknowledged Writes
A non-default write concern MUST be included in the published command. The default write concern is not required to be included.

Succeeded or Failed
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^

Commands that executed on the server and return a status of ``{ ok: 1.0 }`` are considered
successful commands and MUST generate a ``CommandSucceededEvent`` and "command succeeded" log message.
Expand Down
9 changes: 7 additions & 2 deletions source/index-management/index-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ Where are read concern and write concern?
These commands internally proxy the search index management commands to a separate process that runs alongside an Atlas cluster. As such, read concern and
write concern are not relevant for the search index management commands.
Drivers MUST NOT apply a read concern or write concern to the commands. Atlas search index management commands return an error if a ``readConcern`` or ``writeConcern`` field is present in the command.
Consistency with Existing APIs
------------------------------
Expand Down Expand Up @@ -1135,5 +1137,8 @@ Changelog
:2022-10-05: Remove spec front matter and reformat changelog.
:2023-05-10: Merge index enumeration and index management specs and get rid of references
to legacy server versions.
:2023-05-18: Add the search index management API.
:2023-07-27: Add search index management clarifications.
:2023-05-18: Add the search index management API.
:2023-07-27: Add search index management clarifications.
:2023-11-08: Clarify that ``readConcern`` and ``writeConcern`` must not be
applied to search index managment commands.
23 changes: 23 additions & 0 deletions source/index-management/tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,26 @@ Case 5: ``dropSearchIndex`` suppresses namespace not found errors

#. Create a driver-side collection object for a randomly generated collection name. Do not create this collection on the server.
#. Run a ``dropSearchIndex`` command and assert that no error is thrown.

Case 6: Driver can successfully create and list search indexes with non-default readConcern and writeConcern
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``).
#. Apply a write concern ``WriteConcern(w=1)`` and a read concern with ``ReadConcern(level="majority")`` to ``coll0``.
#. Create a new search index on ``coll0`` with the ``createSearchIndex`` helper. Use the following definition:

.. code:: typescript
{
name: 'test-search-index-case6',
definition: {
mappings: { dynamic: false }
}
}
#. Assert that the command returns the name of the index: ``"test-search-index-case6"``.
#. Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied and store the value in a variable ``index``:

- An index with the ``name`` of ``test-search-index-case6`` is present and the index has a field ``queryable`` with a value of ``true``.

#. Assert that ``index`` has a property ``latestDefinition`` whose value is ``{ 'mappings': { 'dynamic': false } }``
252 changes: 252 additions & 0 deletions source/index-management/tests/searchIndexIgnoresReadWriteConcern.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b47194

Please sign in to comment.