From a2bb17ba96ecf6f2f0427d1533691c33fb1cd98f Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Tue, 8 Aug 2023 18:26:05 +0200 Subject: [PATCH 01/33] 1571 --- source/retryable-writes/retryable-writes.rst | 18 +++++++++++------- source/server-selection/server-selection.rst | 6 ++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/source/retryable-writes/retryable-writes.rst b/source/retryable-writes/retryable-writes.rst index bd6aafdbfa..2da72ca42a 100644 --- a/source/retryable-writes/retryable-writes.rst +++ b/source/retryable-writes/retryable-writes.rst @@ -395,11 +395,12 @@ of the following conditions is reached: <../client-side-operations-timeout/client-side-operations-timeout.rst#retryability>`__. - CSOT is not enabled and one retry was attempted. -For each retry attempt, drivers MUST select a writable server. If the driver -cannot select a server for a retry attempt or the selected server does not -support retryable writes, retrying is not possible and drivers MUST raise the -retryable error from the previous attempt. In both cases, the caller is able -to infer that an attempt was made. +For each retry attempt, drivers MUST select a writable server. Server on wich +the operation failed should be provided to the server selection mechanism as +a de-prioritized server. If the drivercannot select a server for a retry attempt +or the selected server does not support retryable writes, retrying is not +possible and drivers MUST raise the retryable error from the previous attempt. +In both cases, the caller is able to infer that an attempt was made. If a retry attempt also fails, drivers MUST update their topology according to the SDAM spec (see: `Error Handling`_). If an error would not allow the caller @@ -492,11 +493,14 @@ The above rules are implemented in the following pseudo-code: } } - /* If we cannot select a writable server, do not proceed with retrying and + /* + * We try to select another + * If we cannot select a writable server, do not proceed with retrying and * throw the previous error. The caller can then infer that an attempt was * made and failed. */ try { - server = selectServer("writable"); + deprioritizedServers = [ server ]; + server = selectServer("writable", deprioritizedServers); } catch (Exception ignoredError) { throw previousError; } diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index 8a22dbbf0b..74ec684a00 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -846,7 +846,8 @@ For multi-threaded clients, the server selection algorithm is as follows: 3. Find suitable servers by topology type and operation type 4. Filter the suitable servers by calling the optional, application-provided server - selector. + selector. The selector may be provided with a list of de-prioritized servers; + these servers should be selected only if there are no other suitable servers. 5. If there are any suitable servers, filter them according to `Filtering suitable servers based on the latency window`_ and continue to the next step; @@ -918,7 +919,8 @@ as follows: 6. Find suitable servers by topology type and operation type 7. Filter the suitable servers by calling the optional, application-provided - server selector. + server selector. The selector may be provided with a list of de-prioritized servers; + these servers should be selected only if there are no other suitable servers. 8. If there are any suitable servers, filter them according to `Filtering suitable servers based on the latency window`_ and return one at random from From 188e692de02b2d037c136ce62f67a9288c6c09ec Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 11 Aug 2023 18:01:42 +0200 Subject: [PATCH 02/33] 1571 --- source/retryable-reads/retryable-reads.rst | 21 +++++++--- source/retryable-reads/tests/README.rst | 44 ++++++++++++++++++++ source/retryable-writes/retryable-writes.rst | 7 ++-- source/server-selection/server-selection.rst | 14 ++++--- 4 files changed, 72 insertions(+), 14 deletions(-) diff --git a/source/retryable-reads/retryable-reads.rst b/source/retryable-reads/retryable-reads.rst index 9d8eabb8cd..42f7046c94 100644 --- a/source/retryable-reads/retryable-reads.rst +++ b/source/retryable-reads/retryable-reads.rst @@ -268,10 +268,11 @@ selecting a server for a retry attempt. 3a. Selecting the server for retry '''''''''''''''''''''''''''''''''' -If the driver cannot select a server for a retry attempt or the newly selected -server does not support retryable reads, retrying is not possible and drivers -MUST raise the previous retryable error. In both cases, the caller is able to -infer that an attempt was made. +Server on wich the operation failed MUST be provided to the server selection +mechanism as a de-prioritized server. If the driver cannot select a server for +a retry attempt or the newly selected server does not support retryable reads, +retrying is not possible and drivers MUST raise the previous retryable error. +In both cases, the caller is able to infer that an attempt was made. 3b. Sending an equivalent command for a retry attempt ''''''''''''''''''''''''''''''''''''''''''''''''''''''' @@ -357,9 +358,17 @@ and reflects the flow described above. */ function executeRetryableRead(command, session) { Exception previousError = null; + Server previousServer = null; while true { try { - server = selectServer(); + if (previousServer == null) { + server = selectServer(); + } else { + // If a previous attempt was made, deprioritize the previous server + // where the command failed. + deprioritizedServers = [ previousServer ]; + server = selectServer(deprioritizedServers); + } } catch (ServerSelectionException exception) { if (previousError == null) { // If this is the first attempt, propagate the exception. @@ -416,9 +425,11 @@ and reflects the flow described above. } catch (NetworkException networkError) { updateTopologyDescriptionForNetworkError(server, networkError); previousError = networkError; + previousServer = server; } catch (NotWritablePrimaryException notPrimaryError) { updateTopologyDescriptionForNotWritablePrimaryError(server, notPrimaryError); previousError = notPrimaryError; + previousServer = server; } catch (DriverException error) { if ( previousError != null ) { throw previousError; diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 59e09e69b8..6eef4acb1c 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -232,6 +232,50 @@ This test requires MongoDB 4.2.9+ for ``blockConnection`` support in the failpoi 9. Disable the failpoint. +Retrying Reads on a Different Mongos Tests +========================================== + +These tests will be used to ensure drivers properly retry reads on a different +mongos. They MUST be executed against a sharded cluster that has at least two +mongos instances. + +Retryable Reads Are Retried on a Different Mongos if One Available +------------------------------------------------------------------ + +1. Ensure that a test is run against a sharded cluster that has at least two + mongos-es. If there are more than two mongos-es in the cluster, pick two to + test against. + +2. Create a client per mongos using the direct connection, and configure fail + points on each of the picked mongos-es, so that each mongos raises + a retryable error once. + +3. Create a client that connects to the cluster, providing the two selected + mongos-es as seeds. + +4. Enable command monitoring, and execute a read command that is + supposed to fail on both mongos-es. + +5. Asserts that there were failed command events from each mongos. + + +Retryable Reads Are Retried on the Same Mongos if No Other Available +-------------------------------------------------------------------- + +1. Ensure that a test is run against a sharded cluster. If there are multiple + mongos-es in the cluster, pick one to test against. + +2. Create a client that connects to the mongos using the direct connection, + and configure a fail poins so that the mongos raises a retryable error once. + +3. Create a client that connects to the cluster, providing the selected + mongos as seeds. + +4. Enable command monitoring, and execute a read command that is + supposed to fail. + +5. Asserts that there was a failed command and a successful command event. + Changelog ========= diff --git a/source/retryable-writes/retryable-writes.rst b/source/retryable-writes/retryable-writes.rst index 2da72ca42a..9e23fea89c 100644 --- a/source/retryable-writes/retryable-writes.rst +++ b/source/retryable-writes/retryable-writes.rst @@ -396,8 +396,8 @@ of the following conditions is reached: - CSOT is not enabled and one retry was attempted. For each retry attempt, drivers MUST select a writable server. Server on wich -the operation failed should be provided to the server selection mechanism as -a de-prioritized server. If the drivercannot select a server for a retry attempt +the operation failed MUST be provided to the server selection mechanism as +a de-prioritized server. If the driver cannot select a server for a retry attempt or the selected server does not support retryable writes, retrying is not possible and drivers MUST raise the retryable error from the previous attempt. In both cases, the caller is able to infer that an attempt was made. @@ -494,7 +494,8 @@ The above rules are implemented in the following pseudo-code: } /* - * We try to select another + * We try to select server that is not the one that failed by passing the + * failed server as a deprioritized server. * If we cannot select a writable server, do not proceed with retrying and * throw the previous error. The caller can then infer that an attempt was * made and failed. */ diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index 74ec684a00..bfd628d2c8 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -843,11 +843,12 @@ For multi-threaded clients, the server selection algorithm is as follows: 2. If the topology wire version is invalid, raise an error and log a `"Server selection failed" message`_. -3. Find suitable servers by topology type and operation type +3. Find suitable servers by topology type and operation type. In the case of + sharded clusters, a list of de-prioritized servers may be provided; + these servers should be selected only if there are no other suitable servers. 4. Filter the suitable servers by calling the optional, application-provided server - selector. The selector may be provided with a list of de-prioritized servers; - these servers should be selected only if there are no other suitable servers. + selector. 5. If there are any suitable servers, filter them according to `Filtering suitable servers based on the latency window`_ and continue to the next step; @@ -916,11 +917,12 @@ as follows: 5. If the topology wire version is invalid, raise an error and log a `"Server selection failed" message`_. -6. Find suitable servers by topology type and operation type +6. Find suitable servers by topology type and operation type. In the case of + sharded clusters, a list of de-prioritized servers may be provided; + these servers should be selected only if there are no other suitable servers. 7. Filter the suitable servers by calling the optional, application-provided - server selector. The selector may be provided with a list of de-prioritized servers; - these servers should be selected only if there are no other suitable servers. + server selector. 8. If there are any suitable servers, filter them according to `Filtering suitable servers based on the latency window`_ and return one at random from From d72723ad90bb947470d341925d41d05e0cbf74f0 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 16 Aug 2023 15:21:53 +0200 Subject: [PATCH 03/33] Add prose test for writes --- source/retryable-reads/tests/README.rst | 26 +++++++++++++++--------- source/retryable-writes/tests/README.rst | 26 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 6eef4acb1c..1c570268e2 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -232,32 +232,36 @@ This test requires MongoDB 4.2.9+ for ``blockConnection`` support in the failpoi 9. Disable the failpoint. -Retrying Reads on a Different Mongos Tests -========================================== +Retrying Reads in a Sharded Cluster +=================================== These tests will be used to ensure drivers properly retry reads on a different -mongos. They MUST be executed against a sharded cluster that has at least two -mongos instances. +mongos. Retryable Reads Are Retried on a Different Mongos if One Available ------------------------------------------------------------------ +This test MUST be executed against a sharded cluster that has at least two +mongos instances. + 1. Ensure that a test is run against a sharded cluster that has at least two mongos-es. If there are more than two mongos-es in the cluster, pick two to test against. 2. Create a client per mongos using the direct connection, and configure fail - points on each of the picked mongos-es, so that each mongos raises + points on each of the picked mongos-es, so that each mongos raises a retryable error once. -3. Create a client that connects to the cluster, providing the two selected - mongos-es as seeds. +3. Create a client with ``retryReads=true`` that connects to the cluster, + providing the two selected mongos-es as seeds. 4. Enable command monitoring, and execute a read command that is supposed to fail on both mongos-es. 5. Asserts that there were failed command events from each mongos. +6. Disable the fail points. + Retryable Reads Are Retried on the Same Mongos if No Other Available -------------------------------------------------------------------- @@ -266,16 +270,18 @@ Retryable Reads Are Retried on the Same Mongos if No Other Available mongos-es in the cluster, pick one to test against. 2. Create a client that connects to the mongos using the direct connection, - and configure a fail poins so that the mongos raises a retryable error once. + and configure a fail point so that the mongos raises a retryable error once. -3. Create a client that connects to the cluster, providing the selected - mongos as seeds. +3. Create a client with ``retryReads=true`` that connects to the cluster, + providing the selected mongos as the seed. 4. Enable command monitoring, and execute a read command that is supposed to fail. 5. Asserts that there was a failed command and a successful command event. +6. Disable the fail point. + Changelog ========= diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index 5ddfb6a2d0..b958f536f6 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -456,6 +456,32 @@ and sharded clusters. mode: "off", }) +#. Test that in a sharded cluster writes are retried on a different mongos if + one available + + This test MUST be executed against a sharded cluster that has at least two + mongos instances. + + 1. Ensure that a test is run against a sharded cluster that has at least two + mongos-es. If there are more than two mongos-es in the cluster, pick two to + test against. + + 2. Create a client per mongos using the direct connection, and configure fail + points on each of the picked mongos-es, so that each mongos raises + a retryable error once. + + 3. Create a client with ``retryWrites=true`` that connects to the cluster, + providing the two selected mongos-es as seeds. + + 4. Enable command monitoring, and execute a write command that is + supposed to fail on both mongos-es. + + 5. Asserts that there were failed command events from each mongos. + + 6. Disable the fail points. + +#. Test that in a sharded cluster on the same mongos if no other available + Changelog ========= From 1de68eb322644b15ee4dcdc2ec5de10d1ffe379c Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 16 Aug 2023 15:22:23 +0200 Subject: [PATCH 04/33] Update source/retryable-reads/retryable-reads.rst Co-authored-by: Alex Bevilacqua --- source/retryable-reads/retryable-reads.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/retryable-reads.rst b/source/retryable-reads/retryable-reads.rst index 42f7046c94..55a670e41c 100644 --- a/source/retryable-reads/retryable-reads.rst +++ b/source/retryable-reads/retryable-reads.rst @@ -268,7 +268,7 @@ selecting a server for a retry attempt. 3a. Selecting the server for retry '''''''''''''''''''''''''''''''''' -Server on wich the operation failed MUST be provided to the server selection +Server on which the operation failed MUST be provided to the server selection mechanism as a de-prioritized server. If the driver cannot select a server for a retry attempt or the newly selected server does not support retryable reads, retrying is not possible and drivers MUST raise the previous retryable error. From 568f414dfb794594dbf6b05e35de5ca768c52a04 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 16 Aug 2023 15:22:30 +0200 Subject: [PATCH 05/33] Update source/retryable-writes/retryable-writes.rst Co-authored-by: Alex Bevilacqua --- source/retryable-writes/retryable-writes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/retryable-writes.rst b/source/retryable-writes/retryable-writes.rst index 9e23fea89c..229f955a8f 100644 --- a/source/retryable-writes/retryable-writes.rst +++ b/source/retryable-writes/retryable-writes.rst @@ -395,7 +395,7 @@ of the following conditions is reached: <../client-side-operations-timeout/client-side-operations-timeout.rst#retryability>`__. - CSOT is not enabled and one retry was attempted. -For each retry attempt, drivers MUST select a writable server. Server on wich +For each retry attempt, drivers MUST select a writable server. Server on which the operation failed MUST be provided to the server selection mechanism as a de-prioritized server. If the driver cannot select a server for a retry attempt or the selected server does not support retryable writes, retrying is not From 82e65f73b020587e724db38fa3e910a573193bd6 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 16 Aug 2023 16:35:24 +0200 Subject: [PATCH 06/33] Fix formatting --- source/retryable-writes/tests/README.rst | 42 +++++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index b958f536f6..6ab353cebe 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -462,26 +462,44 @@ and sharded clusters. This test MUST be executed against a sharded cluster that has at least two mongos instances. - 1. Ensure that a test is run against a sharded cluster that has at least two - mongos-es. If there are more than two mongos-es in the cluster, pick two to - test against. + 1. Ensure that a test is run against a sharded cluster that has at least two + mongos-es. If there are more than two mongos-es in the cluster, pick two to + test against. - 2. Create a client per mongos using the direct connection, and configure fail - points on each of the picked mongos-es, so that each mongos raises - a retryable error once. + 2. Create a client per mongos using the direct connection, and configure fail + points on each of the picked mongos-es, so that each mongos raises + a retryable error once. - 3. Create a client with ``retryWrites=true`` that connects to the cluster, - providing the two selected mongos-es as seeds. + 3. Create a client with ``retryWrites=true`` that connects to the cluster, + providing the two selected mongos-es as seeds. - 4. Enable command monitoring, and execute a write command that is - supposed to fail on both mongos-es. + 4. Enable command monitoring, and execute a write command that is + supposed to fail on both mongos-es. - 5. Asserts that there were failed command events from each mongos. + 5. Asserts that there were failed command events from each mongos. - 6. Disable the fail points. + 6. Disable the fail points. #. Test that in a sharded cluster on the same mongos if no other available + This test MUST be executed against a sharded cluster + + 1. Ensure that a test is run against a sharded cluster. If there are multiple + mongos-es in the cluster, pick one to test against. + + 2. Create a client that connects to the mongos using the direct connection, + and configure a fail point so that the mongos raises a retryable error once. + + 3. Create a client with ``retryWrites=true`` that connects to the cluster, + providing the selected mongos as the seed. + + 4. Enable command monitoring, and execute a write command that is + supposed to fail. + + 5. Asserts that there was a failed command and a successful command event. + + 6. Disable the fail point. + Changelog ========= From c5a40849fb388fcac247cf76ea9fc4fc219c2e53 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:25:16 +0200 Subject: [PATCH 07/33] Update source/retryable-reads/retryable-reads.rst Co-authored-by: Preston Vasquez --- source/retryable-reads/retryable-reads.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/retryable-reads/retryable-reads.rst b/source/retryable-reads/retryable-reads.rst index 55a670e41c..974292088f 100644 --- a/source/retryable-reads/retryable-reads.rst +++ b/source/retryable-reads/retryable-reads.rst @@ -268,8 +268,8 @@ selecting a server for a retry attempt. 3a. Selecting the server for retry '''''''''''''''''''''''''''''''''' -Server on which the operation failed MUST be provided to the server selection -mechanism as a de-prioritized server. If the driver cannot select a server for +The server on which the operation failed MUST be provided to the server selection +mechanism as a deprioritized server. If the driver cannot select a server for a retry attempt or the newly selected server does not support retryable reads, retrying is not possible and drivers MUST raise the previous retryable error. In both cases, the caller is able to infer that an attempt was made. From a7a4928d7661eccff385953a3f408c7d49f1927c Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:25:27 +0200 Subject: [PATCH 08/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 1c570268e2..71dd9b3680 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -245,7 +245,7 @@ This test MUST be executed against a sharded cluster that has at least two mongos instances. 1. Ensure that a test is run against a sharded cluster that has at least two - mongos-es. If there are more than two mongos-es in the cluster, pick two to + mongoses. If there are more than two mongoses in the cluster, pick two to test against. 2. Create a client per mongos using the direct connection, and configure fail From fc6d7722b17d3d2b463b64d7a593a31c3b0251c7 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:26:39 +0200 Subject: [PATCH 09/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 71dd9b3680..109930c2cb 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -249,7 +249,7 @@ mongos instances. test against. 2. Create a client per mongos using the direct connection, and configure fail - points on each of the picked mongos-es, so that each mongos raises + points on each of the picked mongoses, so that each mongos raises a retryable error once. 3. Create a client with ``retryReads=true`` that connects to the cluster, From 1fd6891d41991ec82e39e9e395a2cf73af327fe0 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:26:59 +0200 Subject: [PATCH 10/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 109930c2cb..5c89adac6f 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -253,7 +253,7 @@ mongos instances. a retryable error once. 3. Create a client with ``retryReads=true`` that connects to the cluster, - providing the two selected mongos-es as seeds. + providing the two selected mongoses as seeds. 4. Enable command monitoring, and execute a read command that is supposed to fail on both mongos-es. From ecf593c46c7eef3b4c41637ccbf01c189f475d64 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:07 +0200 Subject: [PATCH 11/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 5c89adac6f..087e3c6ab2 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -256,7 +256,7 @@ mongos instances. providing the two selected mongoses as seeds. 4. Enable command monitoring, and execute a read command that is - supposed to fail on both mongos-es. + supposed to fail on both mongoses. 5. Asserts that there were failed command events from each mongos. From b9f690715fc802e0dbb8035d4c33e2d4189899c6 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:13 +0200 Subject: [PATCH 12/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 087e3c6ab2..cc8aa3ebb1 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -267,7 +267,7 @@ Retryable Reads Are Retried on the Same Mongos if No Other Available -------------------------------------------------------------------- 1. Ensure that a test is run against a sharded cluster. If there are multiple - mongos-es in the cluster, pick one to test against. + mongoses in the cluster, pick one to test against. 2. Create a client that connects to the mongos using the direct connection, and configure a fail point so that the mongos raises a retryable error once. From f4b9259cd19226aa5f6066c5f2952d08dccc0164 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:23 +0200 Subject: [PATCH 13/33] Update source/server-selection/server-selection.rst Co-authored-by: Preston Vasquez --- source/server-selection/server-selection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index bfd628d2c8..d6830d869b 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -918,7 +918,7 @@ as follows: `"Server selection failed" message`_. 6. Find suitable servers by topology type and operation type. In the case of - sharded clusters, a list of de-prioritized servers may be provided; + sharded clusters, a list of deprioritized servers may be provided; these servers should be selected only if there are no other suitable servers. 7. Filter the suitable servers by calling the optional, application-provided From ae1c88fe96c7460f524b0f01a8ea355e2a08c040 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:29 +0200 Subject: [PATCH 14/33] Update source/server-selection/server-selection.rst Co-authored-by: Preston Vasquez --- source/server-selection/server-selection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index d6830d869b..b4963ca5c9 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -844,7 +844,7 @@ For multi-threaded clients, the server selection algorithm is as follows: `"Server selection failed" message`_. 3. Find suitable servers by topology type and operation type. In the case of - sharded clusters, a list of de-prioritized servers may be provided; + sharded clusters, a list of deprioritized servers may be provided; these servers should be selected only if there are no other suitable servers. 4. Filter the suitable servers by calling the optional, application-provided server From 80b4ff740c020de60e7300d4983fee60e3057e43 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:37 +0200 Subject: [PATCH 15/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index 6ab353cebe..f64a011c55 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -485,7 +485,7 @@ and sharded clusters. This test MUST be executed against a sharded cluster 1. Ensure that a test is run against a sharded cluster. If there are multiple - mongos-es in the cluster, pick one to test against. + mongoses in the cluster, pick one to test against. 2. Create a client that connects to the mongos using the direct connection, and configure a fail point so that the mongos raises a retryable error once. From ac09b71abc985876690087bf96c8e0e0867d6e0b Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:46 +0200 Subject: [PATCH 16/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index f64a011c55..d042393540 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -474,7 +474,7 @@ and sharded clusters. providing the two selected mongos-es as seeds. 4. Enable command monitoring, and execute a write command that is - supposed to fail on both mongos-es. + supposed to fail on both mongoses. 5. Asserts that there were failed command events from each mongos. From d3ed1432cafa810aa85cc1d7bea2d7fee745888e Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:27:52 +0200 Subject: [PATCH 17/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index d042393540..61660e8edd 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -471,7 +471,7 @@ and sharded clusters. a retryable error once. 3. Create a client with ``retryWrites=true`` that connects to the cluster, - providing the two selected mongos-es as seeds. + providing the two selected mongoses as seeds. 4. Enable command monitoring, and execute a write command that is supposed to fail on both mongoses. From 88171110a13eb335cdd8dca4cf0aca62ce029224 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:28:10 +0200 Subject: [PATCH 18/33] Update source/retryable-writes/retryable-writes.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/retryable-writes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/retryable-writes.rst b/source/retryable-writes/retryable-writes.rst index 229f955a8f..7ad1297334 100644 --- a/source/retryable-writes/retryable-writes.rst +++ b/source/retryable-writes/retryable-writes.rst @@ -397,7 +397,7 @@ of the following conditions is reached: For each retry attempt, drivers MUST select a writable server. Server on which the operation failed MUST be provided to the server selection mechanism as -a de-prioritized server. If the driver cannot select a server for a retry attempt +a deprioritized server. If the driver cannot select a server for a retry attempt or the selected server does not support retryable writes, retrying is not possible and drivers MUST raise the retryable error from the previous attempt. In both cases, the caller is able to infer that an attempt was made. From 28b5fb9895e8dea69f2d3cc7b3027b9a243c1089 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:28:19 +0200 Subject: [PATCH 19/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index 61660e8edd..8245b5e5f5 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -463,7 +463,7 @@ and sharded clusters. mongos instances. 1. Ensure that a test is run against a sharded cluster that has at least two - mongos-es. If there are more than two mongos-es in the cluster, pick two to + mongoses. If there are more than two mongoses in the cluster, pick two to test against. 2. Create a client per mongos using the direct connection, and configure fail From 17861557d88800f1b7976d467127ef9c4cb60a6f Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 17 Aug 2023 10:28:24 +0200 Subject: [PATCH 20/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index 8245b5e5f5..f5cf018abe 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -467,7 +467,7 @@ and sharded clusters. test against. 2. Create a client per mongos using the direct connection, and configure fail - points on each of the picked mongos-es, so that each mongos raises + points on each of the picked mongoses, so that each mongos raises a retryable error once. 3. Create a client with ``retryWrites=true`` that connects to the cluster, From 49fe6491ca589ebe6c85b5eef6eb6bcb15b65997 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Mon, 21 Aug 2023 12:05:11 +0200 Subject: [PATCH 21/33] Cleanup; improve prose tests --- source/retryable-reads/retryable-reads.rst | 9 ++- source/retryable-reads/tests/README.rst | 34 ++++++++-- source/retryable-writes/retryable-writes.rst | 11 +++- source/retryable-writes/tests/README.rst | 68 +++++++++++++------- source/server-selection/server-selection.rst | 1 + 5 files changed, 89 insertions(+), 34 deletions(-) diff --git a/source/retryable-reads/retryable-reads.rst b/source/retryable-reads/retryable-reads.rst index 974292088f..0828000e88 100644 --- a/source/retryable-reads/retryable-reads.rst +++ b/source/retryable-reads/retryable-reads.rst @@ -268,8 +268,10 @@ selecting a server for a retry attempt. 3a. Selecting the server for retry '''''''''''''''''''''''''''''''''' -The server on which the operation failed MUST be provided to the server selection -mechanism as a deprioritized server. If the driver cannot select a server for +In sharded topology, the server on which the operation failed MUST be provided +to the server selection mechanism as a deprioritized server. + +If the driver cannot select a server for a retry attempt or the newly selected server does not support retryable reads, retrying is not possible and drivers MUST raise the previous retryable error. In both cases, the caller is able to infer that an attempt was made. @@ -690,6 +692,9 @@ degraded performance can simply disable ``retryableReads``. Changelog ========= +:2023-08-??: Require that in a sharded topology the server on which the + operation failed MUST be provided to the server selection + mechanism as a deprioritized server. :2022-11-09: CLAM must apply both events and log messages. :2022-10-18: When CSOT is enabled multiple retry attempts may occur. :2022-10-05: Remove spec front matter, move footnote, and reformat changelog. diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index cc8aa3ebb1..236ec6dd3b 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -248,14 +248,23 @@ mongos instances. mongoses. If there are more than two mongoses in the cluster, pick two to test against. -2. Create a client per mongos using the direct connection, and configure fail - points on each of the picked mongoses, so that each mongos raises - a retryable error once. +2. Create a client per mongos using the direct connection, and configure the + following fail points on each mongos:: + + { + configureFailPoint: "failCommand", + mode: { times: 1 }, + data: { + failCommands: ["find"], + errorCode: 6, + closeConnection: true + } + } 3. Create a client with ``retryReads=true`` that connects to the cluster, providing the two selected mongoses as seeds. -4. Enable command monitoring, and execute a read command that is +4. Enable command monitoring, and execute ``find`` command that is supposed to fail on both mongoses. 5. Asserts that there were failed command events from each mongos. @@ -270,13 +279,22 @@ Retryable Reads Are Retried on the Same Mongos if No Other Available mongoses in the cluster, pick one to test against. 2. Create a client that connects to the mongos using the direct connection, - and configure a fail point so that the mongos raises a retryable error once. + and configure the following fail point on the mongos:: + + { + configureFailPoint: "failCommand", + mode: { times: 1 }, + data: { + failCommands: ["find"], + errorCode: 6, + closeConnection: true + } + } 3. Create a client with ``retryReads=true`` that connects to the cluster, providing the selected mongos as the seed. -4. Enable command monitoring, and execute a read command that is - supposed to fail. +4. Enable command monitoring, and execute ``find`` command. 5. Asserts that there was a failed command and a successful command event. @@ -286,6 +304,8 @@ Retryable Reads Are Retried on the Same Mongos if No Other Available Changelog ========= +:2023-08-??: Add prose tests for retrying in a sharded cluster. + :2022-04-22: Clarifications to ``serverless`` and ``useMultipleMongoses``. :2022-01-10: Create legacy and unified subdirectories for new unified tests diff --git a/source/retryable-writes/retryable-writes.rst b/source/retryable-writes/retryable-writes.rst index 7ad1297334..321c4b0c11 100644 --- a/source/retryable-writes/retryable-writes.rst +++ b/source/retryable-writes/retryable-writes.rst @@ -395,9 +395,11 @@ of the following conditions is reached: <../client-side-operations-timeout/client-side-operations-timeout.rst#retryability>`__. - CSOT is not enabled and one retry was attempted. -For each retry attempt, drivers MUST select a writable server. Server on which -the operation failed MUST be provided to the server selection mechanism as -a deprioritized server. If the driver cannot select a server for a retry attempt +For each retry attempt, drivers MUST select a writable server. In sharded +topology, the server on which the operation failed MUST be provided to +the server selection mechanism as a deprioritized server. + +If the driver cannot select a server for a retry attempt or the selected server does not support retryable writes, retrying is not possible and drivers MUST raise the retryable error from the previous attempt. In both cases, the caller is able to infer that an attempt was made. @@ -827,6 +829,9 @@ inconsistent with the server and potentially confusing to developers. Changelog ========= +:2023-08-??: Require that in a sharded topology the server on which the + operation failed MUST be provided to the server selection + mechanism as a deprioritized server. :2022-11-17: Add logic for persisting "currentError" as "previousError" on first retry attempt, avoiding raising "null" errors. :2022-11-09: CLAM must apply both events and log messages. diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index f5cf018abe..32c2f3cef3 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -462,47 +462,70 @@ and sharded clusters. This test MUST be executed against a sharded cluster that has at least two mongos instances. - 1. Ensure that a test is run against a sharded cluster that has at least two - mongoses. If there are more than two mongoses in the cluster, pick two to - test against. + 1. Ensure that a test is run against a sharded cluster that has at least two + mongoses. If there are more than two mongoses in the cluster, pick two to + test against. - 2. Create a client per mongos using the direct connection, and configure fail - points on each of the picked mongoses, so that each mongos raises - a retryable error once. + 2. Create a client per mongos using the direct connection, and configure the + following fail point on each mongos:: - 3. Create a client with ``retryWrites=true`` that connects to the cluster, - providing the two selected mongoses as seeds. + { + configureFailPoint: "failCommand", + mode: { times: 1 }, + data: { + failCommands: ["insert"], + errorCode: 6, + errorLabels: ["RetryableWriteError"], + closeConnection: true + } + } - 4. Enable command monitoring, and execute a write command that is - supposed to fail on both mongoses. + 3. Create a client with ``retryWrites=true`` that connects to the cluster, + providing the two selected mongoses as seeds. - 5. Asserts that there were failed command events from each mongos. + 4. Enable command monitoring, and execute a write command that is + supposed to fail on both mongoses. - 6. Disable the fail points. + 5. Asserts that there were failed command events from each mongos. + + 6. Disable the fail points. #. Test that in a sharded cluster on the same mongos if no other available This test MUST be executed against a sharded cluster - 1. Ensure that a test is run against a sharded cluster. If there are multiple - mongoses in the cluster, pick one to test against. + 1. Ensure that a test is run against a sharded cluster. If there are multiple + mongoses in the cluster, pick one to test against. + + 2. Create a client that connects to the mongos using the direct connection, + and configure the following fail point on the mongos:: - 2. Create a client that connects to the mongos using the direct connection, - and configure a fail point so that the mongos raises a retryable error once. + { + configureFailPoint: "failCommand", + mode: { times: 1 }, + data: { + failCommands: ["insert"], + errorCode: 6, + errorLabels: ["RetryableWriteError"], + closeConnection: true + } + } - 3. Create a client with ``retryWrites=true`` that connects to the cluster, - providing the selected mongos as the seed. + 3. Create a client with ``retryWrites=true`` that connects to the cluster, + providing the selected mongos as the seed. - 4. Enable command monitoring, and execute a write command that is - supposed to fail. + 4. Enable command monitoring, and execute a write command that is + supposed to fail. - 5. Asserts that there was a failed command and a successful command event. + 5. Asserts that there was a failed command and a successful command event. - 6. Disable the fail point. + 6. Disable the fail point. Changelog ========= +:2023-08-??: Add prose tests for retrying in a sharded cluster. + :2022-08-30: Add prose test verifying correct error handling for errors with the NoWritesPerformed label, which is to return the original error. @@ -529,3 +552,4 @@ Changelog which are now expressed within ``runOn`` elements. Add test-level ``useMultipleMongoses`` field. +`` diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index b4963ca5c9..85e6b9a2d4 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -2074,3 +2074,4 @@ Changelog :2022-01-19: Require that timeouts be applied per the client-side operations timeout spec :2022-10-05: Remove spec front matter, move footnote, and reformat changelog. :2022-11-09: Add log messages and tests. +:2023-08-??: Add list of deprioritized servers for sharded cluster topology. From 4a98a1395da5313022014c0b489d87d6fe65fbe7 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Mon, 21 Aug 2023 15:51:14 +0200 Subject: [PATCH 22/33] Clarify that deprioritized servers are only for sharded --- source/retryable-reads/retryable-reads.rst | 4 ++-- source/retryable-writes/retryable-writes.rst | 6 +++--- source/server-selection/server-selection.rst | 12 ++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source/retryable-reads/retryable-reads.rst b/source/retryable-reads/retryable-reads.rst index 0828000e88..49838e3690 100644 --- a/source/retryable-reads/retryable-reads.rst +++ b/source/retryable-reads/retryable-reads.rst @@ -268,7 +268,7 @@ selecting a server for a retry attempt. 3a. Selecting the server for retry '''''''''''''''''''''''''''''''''' -In sharded topology, the server on which the operation failed MUST be provided +In sharded cluster, the server on which the operation failed MUST be provided to the server selection mechanism as a deprioritized server. If the driver cannot select a server for @@ -692,7 +692,7 @@ degraded performance can simply disable ``retryableReads``. Changelog ========= -:2023-08-??: Require that in a sharded topology the server on which the +:2023-08-??: Require that in a sharded cluster the server on which the operation failed MUST be provided to the server selection mechanism as a deprioritized server. :2022-11-09: CLAM must apply both events and log messages. diff --git a/source/retryable-writes/retryable-writes.rst b/source/retryable-writes/retryable-writes.rst index 321c4b0c11..ea0ddabcbb 100644 --- a/source/retryable-writes/retryable-writes.rst +++ b/source/retryable-writes/retryable-writes.rst @@ -395,8 +395,8 @@ of the following conditions is reached: <../client-side-operations-timeout/client-side-operations-timeout.rst#retryability>`__. - CSOT is not enabled and one retry was attempted. -For each retry attempt, drivers MUST select a writable server. In sharded -topology, the server on which the operation failed MUST be provided to +For each retry attempt, drivers MUST select a writable server. In a sharded +cluster, the server on which the operation failed MUST be provided to the server selection mechanism as a deprioritized server. If the driver cannot select a server for a retry attempt @@ -829,7 +829,7 @@ inconsistent with the server and potentially confusing to developers. Changelog ========= -:2023-08-??: Require that in a sharded topology the server on which the +:2023-08-??: Require that in a sharded cluster the server on which the operation failed MUST be provided to the server selection mechanism as a deprioritized server. :2022-11-17: Add logic for persisting "currentError" as "previousError" on first diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index 85e6b9a2d4..2c8658b154 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -843,9 +843,11 @@ For multi-threaded clients, the server selection algorithm is as follows: 2. If the topology wire version is invalid, raise an error and log a `"Server selection failed" message`_. -3. Find suitable servers by topology type and operation type. In the case of - sharded clusters, a list of deprioritized servers may be provided; +3. Find suitable servers by topology type and operation type. If a list of + deprioritized servers is provided, and the topology is sharded cluster, these servers should be selected only if there are no other suitable servers. + The server selection algorithm MUST ignore the deprioritized servers if the + topology is not sharded cluster. 4. Filter the suitable servers by calling the optional, application-provided server selector. @@ -917,9 +919,11 @@ as follows: 5. If the topology wire version is invalid, raise an error and log a `"Server selection failed" message`_. -6. Find suitable servers by topology type and operation type. In the case of - sharded clusters, a list of deprioritized servers may be provided; +6. Find suitable servers by topology type and operation type. If a list of + deprioritized servers is provided, and the topology is sharded cluster, these servers should be selected only if there are no other suitable servers. + The server selection algorithm MUST ignore the deprioritized servers if the + topology is not sharded cluster. 7. Filter the suitable servers by calling the optional, application-provided server selector. From 4ab24d477d9bcbdb1b357a10c487a62e71f0b1fe Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 23 Aug 2023 06:28:01 +0200 Subject: [PATCH 23/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Preston Vasquez --- source/retryable-writes/tests/README.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index 32c2f3cef3..ffbe6f92e8 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -552,4 +552,3 @@ Changelog which are now expressed within ``runOn`` elements. Add test-level ``useMultipleMongoses`` field. -`` From fa36e20b245ea7e1a39a6890756f5d1226a046d8 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:50:05 +0200 Subject: [PATCH 24/33] Update source/retryable-reads/retryable-reads.rst Co-authored-by: Alex Bevilacqua --- source/retryable-reads/retryable-reads.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/retryable-reads.rst b/source/retryable-reads/retryable-reads.rst index f1705aeb4b..be8a26a62f 100644 --- a/source/retryable-reads/retryable-reads.rst +++ b/source/retryable-reads/retryable-reads.rst @@ -268,7 +268,7 @@ selecting a server for a retry attempt. 3a. Selecting the server for retry '''''''''''''''''''''''''''''''''' -In sharded cluster, the server on which the operation failed MUST be provided +In a sharded cluster, the server on which the operation failed MUST be provided to the server selection mechanism as a deprioritized server. If the driver cannot select a server for From 2698799ee8267136146c61bd349b4d8ea3715d26 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:50:18 +0200 Subject: [PATCH 25/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Alex Bevilacqua --- source/retryable-reads/tests/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 236ec6dd3b..c5d26710d0 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -238,8 +238,8 @@ Retrying Reads in a Sharded Cluster These tests will be used to ensure drivers properly retry reads on a different mongos. -Retryable Reads Are Retried on a Different Mongos if One Available ------------------------------------------------------------------- +Retryable Reads Are Retried on a Different mongos if One is Available +--------------------------------------------------------------------- This test MUST be executed against a sharded cluster that has at least two mongos instances. From 8289eb3da85db972d9ed1c3a3a7499f380b2edcf Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:50:27 +0200 Subject: [PATCH 26/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Alex Bevilacqua --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index c5d26710d0..f3105c257d 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -264,7 +264,7 @@ mongos instances. 3. Create a client with ``retryReads=true`` that connects to the cluster, providing the two selected mongoses as seeds. -4. Enable command monitoring, and execute ``find`` command that is +4. Enable command monitoring, and execute a ``find`` command that is supposed to fail on both mongoses. 5. Asserts that there were failed command events from each mongos. From 254051d3e0eb9339d1ef0f8af68a10af4c0f38b2 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:50:35 +0200 Subject: [PATCH 27/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Alex Bevilacqua --- source/retryable-reads/tests/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index f3105c257d..6adc9b9c6f 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -272,8 +272,8 @@ mongos instances. 6. Disable the fail points. -Retryable Reads Are Retried on the Same Mongos if No Other Available --------------------------------------------------------------------- +Retryable Reads Are Retried on the Same mongos if No Others are Available +------------------------------------------------------------------------- 1. Ensure that a test is run against a sharded cluster. If there are multiple mongoses in the cluster, pick one to test against. From d9ed819c9466e1bde23881519f89cfc9e30ff0c5 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:51:40 +0200 Subject: [PATCH 28/33] Update source/retryable-reads/tests/README.rst Co-authored-by: Alex Bevilacqua --- source/retryable-reads/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-reads/tests/README.rst b/source/retryable-reads/tests/README.rst index 6adc9b9c6f..4f45feb506 100644 --- a/source/retryable-reads/tests/README.rst +++ b/source/retryable-reads/tests/README.rst @@ -294,7 +294,7 @@ Retryable Reads Are Retried on the Same mongos if No Others are Available 3. Create a client with ``retryReads=true`` that connects to the cluster, providing the selected mongos as the seed. -4. Enable command monitoring, and execute ``find`` command. +4. Enable command monitoring, and execute a ``find`` command. 5. Asserts that there was a failed command and a successful command event. From aa2edbfaa145099bb3e8dadfcf7727ebf6103518 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:51:49 +0200 Subject: [PATCH 29/33] Update source/server-selection/server-selection.rst Co-authored-by: Alex Bevilacqua --- source/server-selection/server-selection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index 2c8658b154..696063843f 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -923,7 +923,7 @@ as follows: deprioritized servers is provided, and the topology is sharded cluster, these servers should be selected only if there are no other suitable servers. The server selection algorithm MUST ignore the deprioritized servers if the - topology is not sharded cluster. + topology is not a sharded cluster. 7. Filter the suitable servers by calling the optional, application-provided server selector. From 1cb24ec0e1615b6b64e3ca36c5511ab526f1d5c0 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:51:58 +0200 Subject: [PATCH 30/33] Update source/server-selection/server-selection.rst Co-authored-by: Alex Bevilacqua --- source/server-selection/server-selection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index 696063843f..be1b6c8811 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -844,7 +844,7 @@ For multi-threaded clients, the server selection algorithm is as follows: `"Server selection failed" message`_. 3. Find suitable servers by topology type and operation type. If a list of - deprioritized servers is provided, and the topology is sharded cluster, + deprioritized servers is provided, and the topology is a sharded cluster, these servers should be selected only if there are no other suitable servers. The server selection algorithm MUST ignore the deprioritized servers if the topology is not sharded cluster. From 348affb2f6204edf5e4046633e55df73254e0ac3 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:52:09 +0200 Subject: [PATCH 31/33] Update source/retryable-writes/tests/README.rst Co-authored-by: Alex Bevilacqua --- source/retryable-writes/tests/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/retryable-writes/tests/README.rst b/source/retryable-writes/tests/README.rst index ffbe6f92e8..2f6cd75c42 100644 --- a/source/retryable-writes/tests/README.rst +++ b/source/retryable-writes/tests/README.rst @@ -490,7 +490,7 @@ and sharded clusters. 6. Disable the fail points. -#. Test that in a sharded cluster on the same mongos if no other available +#. Test that in a sharded cluster on the same mongos if no other is available This test MUST be executed against a sharded cluster From 186cfd1f9c9b884d7867348b47dec3f9175f17b1 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:52:18 +0200 Subject: [PATCH 32/33] Update source/server-selection/server-selection.rst Co-authored-by: Alex Bevilacqua --- source/server-selection/server-selection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index be1b6c8811..51521d6716 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -847,7 +847,7 @@ For multi-threaded clients, the server selection algorithm is as follows: deprioritized servers is provided, and the topology is a sharded cluster, these servers should be selected only if there are no other suitable servers. The server selection algorithm MUST ignore the deprioritized servers if the - topology is not sharded cluster. + topology is not a sharded cluster. 4. Filter the suitable servers by calling the optional, application-provided server selector. From df8e5b4057ad78739ea73228c4a7b68090dc3b84 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Fri, 25 Aug 2023 15:52:25 +0200 Subject: [PATCH 33/33] Update source/server-selection/server-selection.rst Co-authored-by: Alex Bevilacqua --- source/server-selection/server-selection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/server-selection/server-selection.rst b/source/server-selection/server-selection.rst index 51521d6716..f13f15b170 100644 --- a/source/server-selection/server-selection.rst +++ b/source/server-selection/server-selection.rst @@ -920,7 +920,7 @@ as follows: `"Server selection failed" message`_. 6. Find suitable servers by topology type and operation type. If a list of - deprioritized servers is provided, and the topology is sharded cluster, + deprioritized servers is provided, and the topology is a sharded cluster, these servers should be selected only if there are no other suitable servers. The server selection algorithm MUST ignore the deprioritized servers if the topology is not a sharded cluster.