Skip to content

Commit 1578869

Browse files
committed
Update map_callrw
1 parent 705e32f commit 1578869

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

doc/reference/reference_rock/vshard/vshard-router.rst

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -310,33 +310,33 @@ Router public API
310310
Consistency means:
311311

312312
* All the data was accessible.
313-
* The data didn't migrate between physical storages during the map requests execution.
313+
* The data was not migrated between physical storages during the map requests execution.
314314

315315
The function can be helpful if you need to access:
316316

317317
* all the data in the cluster
318318

319319
* a vast number of buckets scattered over the instances
320-
whose individual :ref:`vshard.router.call() <router_api-call>` would take too long.
320+
in case their individual :ref:`vshard.router.call() <router_api-call>` takes up too much time.
321321

322-
The function is called on the master node of each replicaset with the given arguments.
322+
The function is called on the master node of each replica set with the given arguments.
323323

324-
:param function_name: a function to call on the storages (masters of all replicasets)
324+
:param function_name: a function to call on the storages (masters of all replica sets)
325325
:param argument_list: an array of the function's arguments
326326
:param options:
327327

328-
* ``timeout``—a request timeout, in seconds. The timeout is for the entire request, including all its stages.
328+
* ``timeout``—a request timeout, in seconds. The timeout is for the entire ``map_callrw()``, including all its stages.
329329

330330
``timeout`` is the only supported option.
331331

332332
.. important::
333333

334334
Do not use big timeout (longer than 1 minute, for instance). The router tries to block the bucket moves
335-
for the given timeout on all storages. On failure, the block remains for the entire timeout.
335+
to another storage for the given timeout on all storages. On failure, the block remains for the entire timeout.
336336

337337
:Return:
338338

339-
* On success: a map with replicaset UUIDs (keys) and results of the ``function_name`` (values).
339+
* On success: a map with replica set UUIDs (keys) and results of the ``function_name`` (values).
340340

341341
.. code-block:: lua
342342
@@ -345,17 +345,17 @@ Router public API
345345
If the function returns ``nil`` or ``box.NULL`` from one of the storages,
346346
it will not be present in the resulting map.
347347

348-
* On failure: ``nil``, error object, and optional replicaset UUID where the error occurred.
349-
UUID won't be returned if the error is not about a concrete replicaset.
350-
For instance, the method fails if not all buckets were found, even if all replicasets were scanned successfully.
348+
* On failure: ``nil``, error object, and optional replica set UUID where the error occurred.
349+
UUID will not be returned if the error is not related to a particular replica set.
350+
For instance, the method fails if not all buckets were found, even if all replica sets were scanned successfully.
351351
Handling the result looks like this:
352352

353353
.. code-block:: lua
354354
355355
res, err, uuid = vshard.router.map_callrw(...)
356356
if not res then
357357
-- Error.
358-
-- 'err' - error object. 'uuid' - optional UUID of replicaset
358+
-- 'err' - error object. 'uuid' - optional UUID of replica set
359359
-- where the error happened.
360360
...
361361
else
@@ -367,10 +367,11 @@ Router public API
367367
368368
Map-Reduce in vshard can be divided into three stages: Ref, Map, and Reduce.
369369

370-
**Ref**. The Ref stage ensures data consistency while executing the user's function (``function_name``) on all nodes.
370+
**Ref and Map**. ``map_callrw()`` combines both the Ref and the Map stages.
371+
The Ref stage ensure data consistency while executing the user's function (``function_name``) on all nodes.
371372
Keep in mind that consistency is incompatible with rebalancing (it breaks data consistency).
372373
Map-reduce and rebalancing are mutually exclusive, they compete for the cluster time.
373-
Any bucket move would make the sender and receiver nodes inconsistent,
374+
Any bucket move makes the sender and receiver nodes inconsistent,
374375
so it is impossible to call a function on them to access all the data
375376
without :ref:`vshard.storage.bucket_ref() <storage_api-bucket_ref>`.
376377
It makes the Ref stage intricate, as it should work together with the rebalancer to ensure
@@ -382,17 +383,21 @@ Router public API
382383
Storage ref pins the entire instance with all its buckets, not just a single bucket (like bucket ref).
383384

384385
The scheduler shares storage time between bucket moves and storage refs fairly.
385-
The definition of fairness depends on how long and frequent the moves and refs are.
386-
It can be configured using storage options ``sched_move_quota`` and ``sched_ref_quota``.
387-
Keep in mind that the scheduler configuration may affect map-reduce requests if used a lot during rebalancing.
386+
The distribution depends on how long and frequent the moves and refs are.
387+
It can be configured using the storage options ``sched_move_quota`` and ``sched_ref_quota``.
388+
Keep in mind that the scheduler configuration may affect map-reduce requests if used during rebalancing.
389+
390+
During the Map stage, ``map_callrw()`` sends map requests one by one to many servers.
391+
On success, the function returns a map. The map is a set of "key—value" pairs.
392+
The keys are replica set UUIDs, and the values are the results of the user's function—``function_name``.
388393

389394
**Reduce**. The Reduce stage is not performed by vshard.
390395
It is what the user's code does with the results of ``map_callrw()``.
391396

392397
.. note::
393398

394399
``map_callrw()`` works only on masters.
395-
Therefore, you can't use it if at least one replicaset has its master node down.
400+
Therefore, you can't use it if at least one replica set has its master node down.
396401

397402
.. _router_api-route:
398403

0 commit comments

Comments
 (0)