@@ -310,33 +310,33 @@ Router public API
310
310
Consistency means:
311
311
312
312
* 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.
314
314
315
315
The function can be helpful if you need to access:
316
316
317
317
* all the data in the cluster
318
318
319
319
* 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 .
321
321
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.
323
323
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 )
325
325
:param argument_list: an array of the function's arguments
326
326
:param options:
327
327
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.
329
329
330
330
``timeout `` is the only supported option.
331
331
332
332
.. important ::
333
333
334
334
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.
336
336
337
337
:Return:
338
338
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).
340
340
341
341
.. code-block :: lua
342
342
@@ -345,17 +345,17 @@ Router public API
345
345
If the function returns ``nil `` or ``box.NULL `` from one of the storages,
346
346
it will not be present in the resulting map.
347
347
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.
351
351
Handling the result looks like this:
352
352
353
353
.. code-block :: lua
354
354
355
355
res, err, uuid = vshard.router.map_callrw(...)
356
356
if not res then
357
357
-- Error.
358
- -- 'err' - error object. 'uuid' - optional UUID of replicaset
358
+ -- 'err' - error object. 'uuid' - optional UUID of replica set
359
359
-- where the error happened.
360
360
...
361
361
else
@@ -367,10 +367,11 @@ Router public API
367
367
368
368
Map-Reduce in vshard can be divided into three stages: Ref, Map, and Reduce.
369
369
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.
371
372
Keep in mind that consistency is incompatible with rebalancing (it breaks data consistency).
372
373
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,
374
375
so it is impossible to call a function on them to access all the data
375
376
without :ref: `vshard.storage.bucket_ref() <storage_api-bucket_ref >`.
376
377
It makes the Ref stage intricate, as it should work together with the rebalancer to ensure
@@ -382,17 +383,21 @@ Router public API
382
383
Storage ref pins the entire instance with all its buckets, not just a single bucket (like bucket ref).
383
384
384
385
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 ``.
388
393
389
394
**Reduce **. The Reduce stage is not performed by vshard.
390
395
It is what the user's code does with the results of ``map_callrw() ``.
391
396
392
397
.. note ::
393
398
394
399
``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.
396
401
397
402
.. _router_api-route :
398
403
0 commit comments