Skip to content

Commit 5280049

Browse files
DOCSP-15190 Allow user to select read preference (#137)
* DOCSP-15190 Allow user to select read preference * DOCSP-15190 updates for review feedback
1 parent 76ff996 commit 5280049

File tree

5 files changed

+151
-36
lines changed

5 files changed

+151
-36
lines changed

source/includes/atlas-config-format.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
"name" : "<string>",
55
"provider": "<string>",
66
"clusterName": "<string>",
7-
"projectId": "<string>"
7+
"projectId": "<string>",
8+
"readPreference": {
9+
"mode": "<string>",
10+
"tagSets": [
11+
[{"name": "<string>", "value": "<string>"},...],
12+
...
13+
],
14+
"maxStalenessSeconds": <int>
15+
}
816
}
917
],
1018
"databases" : [

source/includes/atlas-stores-config-format.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
"name" : "<string>",
44
"provider" : "<string>",
55
"clusterName" : "<string>",
6-
"projectId": "<string>"
6+
"projectId": "<string>",
7+
"readPreference": {
8+
"mode": "<string>",
9+
"tagSets": [
10+
[{"name": "<string>", "value": "<string>"},...],
11+
...
12+
],
13+
"maxStalenessSeconds": <int>
14+
}
715
}
816
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- ``primary`` - to route all read requests to the replica set
2+
:manual:`primary </reference/glossary/#term-primary>`
3+
- ``primaryPreferred`` - to route all read requests the replica set
4+
:manual:`primary </reference/glossary/#term-primary>` and to
5+
:manual:`secondary </reference/glossary/#term-secondary>` members
6+
only if ``primary`` is unavailable
7+
- ``secondary`` - to route all read requests to the :manual:`secondary
8+
</reference/glossary/#term-secondary>` members of the replica set
9+
- ``secondaryPreferred`` - to route all read requests to the
10+
:manual:`secondary </reference/glossary/#term-secondary>` members of
11+
the replica set and the :manual:`primary
12+
</reference/glossary/#term-primary>` on sharded clusters only if
13+
``secondary`` members are unavailable
14+
- ``nearest`` - to route all read requests to random eligible replica
15+
set member, irrespective of whether that member is a :manual:`primary
16+
</reference/glossary/#term-primary>` or :manual:`secondary
17+
</reference/glossary/#term-secondary>`
18+

source/reference/cli/stores/create-store.txt

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Syntax
6060

6161
.. code-block:: sh
6262

63-
db.runCommand({ createStore: <store-name>, provider: <storage-provider>, clusterName: <cluster-name>, projectId: <project-id> })
63+
db.runCommand({ createStore: <store-name>, provider: <storage-provider>, clusterName: <cluster-name>, projectId: <project-id>, readPreference: {mode: <read-preference-mode>, tagSets: [[{name: <name>, value: <value>},...],...], maxStalenessSeconds: <number-of-seconds>} })
6464

6565
.. tab:: HTTP Configuration
6666
:tabid: http
@@ -76,7 +76,7 @@ Parameters
7676

7777
.. list-table::
7878
:header-rows: 1
79-
:widths: 10 10 70 10
79+
:widths: 27 10 53 10
8080

8181
* - Parameter
8282
- Type
@@ -107,33 +107,34 @@ Parameters
107107
:tabid: s3
108108

109109
.. list-table::
110-
:widths: 10 10 70 10
110+
:widths: 27 10 53 10
111111

112112
* - ``region``
113113
- string
114-
- Region in which the ``bucket`` is hosted. For a list of valid
115-
region names, see :atlas:`Amazon Web
114+
- Region in which the ``bucket`` is hosted. For a list of
115+
valid region names, see :atlas:`Amazon Web
116116
Services (AWS) </reference/amazon-aws/#amazon-aws>`.
117117
- yes
118118

119119
* - ``bucket``
120120
- string
121-
- Name of the bucket in which data is stored. Must exactly match the
122-
name of an |s3| bucket which {+data-lake-short+} can access given
123-
the configured |aws| |iam| credentials.
121+
- Name of the bucket in which data is stored. Must exactly
122+
match the name of an |s3| bucket which {+data-lake-short+}
123+
can access given the configured |aws| |iam| credentials.
124124
- yes
125125

126126
* - ``additionalStorageClasses``
127127
- array of strings
128128
- Array of |aws| |s3| `storage classes
129-
<https://aws.amazon.com/s3/storage-classes/>`__. {+adl+} will
130-
include the files in these storage classes in the query results.
131-
Valid values are:
129+
<https://aws.amazon.com/s3/storage-classes/>`__. {+adl+}
130+
will include the files in these storage classes in the
131+
query results. Valid values are:
132132

133-
- ``INTELLIGENT_TIERING`` to include files in the `Intelligent
134-
Tiering <https://aws.amazon.com/s3/storage-classes/#Unknown_or_changing_access>`__
133+
- ``INTELLIGENT_TIERING`` to include files in the
134+
`Intelligent Tiering <https://aws.amazon.com/s3/storage-classes/#Unknown_or_changing_access>`__
135135
storage class.
136-
- ``STANDARD_IA`` to include files in the `Standard-Infrequent Access
136+
- ``STANDARD_IA`` to include files in the
137+
`Standard-Infrequent Access
137138
<https://aws.amazon.com/s3/storage-classes/#Infrequent_access>`__
138139
storage class.
139140

@@ -147,20 +148,21 @@ Parameters
147148

148149
* - ``delimiter``
149150
- string
150-
- Character used to separate path segments in the {+data-lake-store+}.
151-
If ommitted, defaults to ``"/"``.
151+
- Character used to separate path segments in the
152+
{+data-lake-store+}. If ommitted, defaults to ``"/"``.
152153
- no
153154

154155
* - ``prefix``
155156
- string
156-
- Value prepended to the ``path``. If ommitted, defaults to ``""``.
157+
- Value prepended to the ``path``. If ommitted, defaults to
158+
``""``.
157159
- no
158160

159161
.. tab:: Atlas Configuration
160162
:tabid: atlas
161163

162164
.. list-table::
163-
:widths: 10 10 70 10
165+
:widths: 27 10 53 10
164166

165167
* - ``clusterName``
166168
- string
@@ -169,15 +171,51 @@ Parameters
169171

170172
* - ``projectId``
171173
- string
172-
- Unique identifier of the project that contains the |service|
173-
cluster.
174+
- Unique identifier of the project that contains the
175+
|service| cluster.
174176
- yes
175177

178+
* - ``readPreference``
179+
- document
180+
- Cluster :manual:`read preference
181+
</core/read-preference/>`, which describes how to route
182+
read requests to the cluster.
183+
- no
184+
185+
* - ``readPreference.mode``
186+
- string
187+
- :manual:`Read preference mode
188+
</core/read-preference/#read-preference-modes>` that
189+
specifies which replica set member to route the read
190+
requests to. Value can be one of the following:
191+
192+
.. include:: /includes/fact-read-preference-modes.rst
193+
- no
194+
195+
* - ``readPreference.tagSets``
196+
- array of strings
197+
- Arrays of :manual:`tag sets </core/read-preference-tags/>`
198+
or tag specification documents that contain name and value
199+
pairs for the replica set member. If specified, {+adl+}
200+
routes read requests to replica set member or members that
201+
are associated with the specified tags. To learn more, see
202+
:manual:`Read Preference Tag Sets
203+
</manual/core/read-preference-tags/>`.
204+
- no
205+
206+
* - ``readPreference.maxStalenessSeconds``
207+
- int
208+
- Maximum replication lag, or “staleness”, for reads from
209+
secondaries. To learn more about ``maxStalenessSeconds``,
210+
see :manual:`Read Preference maxStalenessSeconds
211+
</core/read-preference-staleness/>`.
212+
- no
213+
176214
.. tab:: HTTP Configuration
177215
:tabid: http
178216

179217
.. list-table::
180-
:widths: 10 10 70 10
218+
:widths: 27 10 53 10
181219

182220
* - ``allowInsecure``
183221
- boolean
@@ -187,18 +225,19 @@ Parameters
187225
* - ``urls``
188226
- array of strings or an empty array
189227
- One or more publicly accessible |url|\s. You
190-
can't specify |url|\s that require authentication. If empty or omitted, the :ref:`storageGenerateConfig
191-
<datalake-storagegenconfig>` command will not generate any virtual
192-
{+adl+} databases or collections that reference the
193-
{+data-lake-store+}.
228+
can't specify |url|\s that require authentication. If
229+
empty or omitted, the :ref:`storageGenerateConfig
230+
<datalake-storagegenconfig>` command will not generate any
231+
virtual {+adl+} databases or collections that reference
232+
the {+data-lake-store+}.
194233
- no
195234

196235
* - ``defaultFormat``
197236
- string
198237
- .. include:: /includes/extracts/cli-param-default-format.rst
199238

200-
If included, the specified format only applies to the |url|\s in
201-
the store.
239+
If included, the specified format only applies to the
240+
|url|\s in the store.
202241
- no
203242

204243
.. _dl-create-store-cmd-output:
@@ -243,7 +282,12 @@ fails, see :ref:`dl-create-store-cmd-errors` for recommended solutions.
243282
"name" : "<store-name>",
244283
"provider" : "<storage-provider>",
245284
"clusterName" : "<cluster-name>",
246-
"projectId" : "<project-id>"
285+
"projectId" : "<project-id>",
286+
"readPreference" : {
287+
"mode" : "<read-preference-mode>",
288+
"tagSets" : [[{"name": "<name>", "value": "<value>"},...],...],
289+
"maxStalenessSeconds" : <number-of-seconds>
290+
}
247291
}
248292
}
249293

@@ -312,7 +356,7 @@ The following example uses the ``createStore`` command to create a new
312356
.. code-block:: json
313357

314358
use sample
315-
db.runCommand({ createStore: "myStore", provider: "atlas", clusterName: "myTestCluster", projectId: "<project-id>" })
359+
db.runCommand({ createStore: "myStore", provider: "atlas", clusterName: "myTestCluster", projectId: "<project-id>", "readPreference": {"mode": "secondary", "tagSets": [[{"name": "provider", "value": "AWS" }, {"name": "region", "value": "US_EAST_1"}]], "maxStalenessSeconds": 120} })
316360

317361
The previous command prints the following:
318362

@@ -325,7 +369,12 @@ The following example uses the ``createStore`` command to create a new
325369
"name" : "myStore",
326370
"provider" : "atlas",
327371
"clusterName" : "myTestCluster",
328-
"projectId" : "<project-id>"
372+
"projectId" : "<project-id>",
373+
"readPreference" : {
374+
"mode" : "secondary",
375+
"tagSets": [[{"name": "provider", "value": "AWS" }, {"name": "region", "value": "US_EAST_1"}]],
376+
"maxStalenessSeconds" : 120
377+
}
329378
}
330379
}
331380

source/reference/format/data-lake-configuration.txt

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,16 +544,48 @@ The {+data-lake-short+} configuration has the following format:
544544

545545
.. datalakeconf:: stores.[n].clusterName
546546

547-
Name of the |service| cluster on which the store is based.
548-
Note that the cluster must be a M10 or higher cluster and must
549-
exist in the same project as your {+dl+}. The ``source`` field
550-
on the data partition is the name of the |service| cluster.
547+
Name of the |service| cluster on which the store is based. The
548+
cluster must exist in the same project as your {+dl+}. The
549+
``source`` field on the data partition is the name of the
550+
|service| cluster.
551551

552552
.. datalakeconf:: stores.[n].projectId
553553

554554
Unique identifier of the project that contains the |service|
555555
cluster on which the store is based.
556556

557+
.. datalakeconf:: stores.[n].readPreference
558+
559+
*Optional.* Cluster :manual:`read preference
560+
</core/read-preference/>`, which describes how to route read
561+
requests to the cluster.
562+
563+
.. datalakeconf:: stores.[n].readPreference.mode
564+
565+
*Optional.* :manual:`Read preference mode
566+
</core/read-preference/#read-preference-modes>` that specifies
567+
which replica set member to route the read requests to. Value
568+
can be one of the following:
569+
570+
.. include:: /includes/fact-read-preference-modes.rst
571+
572+
.. datalakeconf:: stores.[n].readPreference.tagSets
573+
574+
*Optional.* Arrays of :manual:`tag sets
575+
</core/read-preference-tags/>` or tag specification documents
576+
that contain name and value pairs for the replica set member.
577+
If specified, {+adl+} routes read requests to replica set
578+
member or members that are associated with the specified tags.
579+
To learn more, :manual:`Read Preference Tag Sets
580+
</core/read-preference-tags/>`.
581+
582+
.. datalakeconf:: stores.[n].readPreference.maxStalenessSeconds
583+
584+
*Optional.* Maximum replication lag, or “staleness”, for reads
585+
from secondaries. To learn more about ``maxStalenessSeconds``,
586+
see :manual:`Read Preference maxStalenessSeconds
587+
</core/read-preference-staleness/>`.
588+
557589
.. tab:: HTTP
558590
:tabid: http
559591

0 commit comments

Comments
 (0)