Skip to content

Add description of vshard.enable/disable() #3025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions doc/reference/reference_rock/vshard/vshard_router.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Router API
| | * :ref:`vshard.router.discovery_set() <router_api-discovery_set>` |
| | * :ref:`vshard.router.info() <router_api-info>` |
| | * :ref:`vshard.router.buckets_info() <router_api-buckets_info>` |
| | * :ref:`vshard.router.enable() <router_api-enable>` |
| | * :ref:`vshard.router.disable() <router_api-disable>` |
| | * :ref:`replicaset_object:call() <router_api-replicaset_call>` |
| | * :ref:`replicaset_object:callro() <router_api-replicaset_callro>` |
| | * :ref:`replicaset_object:callrw() <router_api-replicaset_callrw>` |
Expand Down Expand Up @@ -768,6 +770,46 @@ Router public API
status: available_rw
...

.. _router_api-enable:

.. function:: vshard.router.enable()

Manually allow access to the router API, revert
:ref:`vshard.router.disable() <router_api-disable>`.

.. note::

``vshard.router.enable()`` cannot be used for enabling a router
API that was automatically disabled due to a running configuration
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, vshard.router.cfg is a configuration process only for the static router. But vshard supports multiple routers in a single instance. These ones can be created via vhard.router.new. During configuration every router is blocked on its own, and blocking API of the one uncofigured instance doesn't affect others.

If we want to specify functions, used for configuration, explicitly, we should mention both of them. Another solution can be just stay on 'running configuration process'.

process.

.. _router_api-disable:

.. function:: vshard.router.disable()

Manually restrict access to the router API. When the API is disabled,
all its methods throw a Lua error, except
:ref:`vshard.router.cfg() <router_api-cfg>`,
:ref:`vshard.router.new() <router_api-new>`,
:ref:`vshard.router.enable() <router_api-enable>` and
:ref:`vshard.router.disable() <router_api-disable>`.
The error object's name attribute is ``ROUTER_IS_DISABLED``.

The router is enabled by default. However, it is automatically and
forcefully disabled until the configuration is finished, as accessing the
router's methods at that time is not safe.

Manual disabling can be used, for example, if some preparatory work needs
to be done after calling :ref:`vshard.router.cfg() <router_api-cfg>` but
before the router's methods are available. It will look like this:

.. code-block:: lua

vshard.router.disable()
vshard.router.cfg(...)
-- Some preparatory work here ...
vshard.router.enable()
-- vshard.router's methods are available now

.. class:: replicaset_object

Expand Down