Skip to content

Commit 8cb2ff8

Browse files
authored
Feedback fixes: net.box and vshard (#3491)
Resolves #3399, #2680, #2459, #2405, #2262, #2273, #2483 * Add fetch_schema, reorder functions * Remove console param of net.box.connect * Fix translation or reconnect_after * Remove conn.timeout() from reference * Fix vshard bucket parameters * Fix mertics description and link
1 parent 8111e2f commit 8cb2ff8

File tree

4 files changed

+71
-93
lines changed

4 files changed

+71
-93
lines changed

doc/book/admin/server_introspection.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ To check the boot log, on systems with ``systemd``, say:
107107
Jan 21 21:17:47 localhost.localdomain tarantoolctl[5969]: /usr/bin/tarantoolctl: Starting instance...
108108
Jan 21 21:17:47 localhost.localdomain systemd[1]: Started Tarantool Database Server
109109
110-
For more details, use the reports provided by functions in the following submodules:
110+
For more specific checks, use the reports provided by functions in the following submodules:
111111

112112
* :doc:`/reference/reference_lua/box_cfg` (check and specify all
113113
configuration parameters for the Tarantool server)
@@ -121,10 +121,10 @@ For more details, use the reports provided by functions in the following submodu
121121
* :doc:`/reference/reference_lua/box_stat` (introspect Tarantool
122122
request and network statistics)
123123

124-
You can also try `prometheus <https://github.com/tarantool/metrics/tree/master/metrics/plugins/prometheus>`_,
125-
a plugin that makes it easy to collect metrics (e.g. memory usage or number
126-
of requests) from Tarantool applications and databases and expose them via the
127-
Prometheus protocol.
124+
Finally, there is the `metrics <https://github.com/tarantool/metrics>`_
125+
library, which enables collecting metrics (such as memory usage or number
126+
of requests) from Tarantool applications and expose them via various
127+
protocols, including Prometheus. Check :ref:`Monitoring <monitoring>` for more details.
128128

129129
**Example**
130130

doc/reference/reference_lua/net_box.rst

Lines changed: 56 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -160,29 +160,21 @@ Below is a list of all ``net.box`` functions.
160160

161161
.. function:: connect(URI [, {option[s]}])
162162

163-
The names ``connect()`` and ``new()`` are synonyms: ``connect()`` is
164-
preferred; ``new()`` is retained for backward compatibility. For more
165-
information, see the description of ``net_box.new()`` below.
166-
167-
.. _net_box-new:
168-
169-
.. function:: new(URI [, {option[s]}])
170-
171163
Create a new connection. The connection is established on demand, at the
172164
time of the first request. It can be re-established automatically after a
173165
disconnect (see ``reconnect_after`` option below).
174166
The returned ``conn`` object supports methods for making remote requests,
175167
such as select, update or delete.
176-
168+
177169
:param string URI: the :ref:`URI <index-uri>` of the target for the connection
178170
:param options: the supported options are shown below:
179-
180-
* ``user/password``: two options to connect to a remote host other than through
181-
:ref:`URI <index-uri>`. For example, instead of ``connect('username:userpassword@localhost:3301')``
171+
172+
* ``user/password``: two options to connect to a remote host other than through
173+
:ref:`URI <index-uri>`. For example, instead of ``connect('username:userpassword@localhost:3301')``
182174
you can write ``connect('localhost:3301', {user = 'username', password='userpassword'})``.
183175

184-
* ``wait_connected``: a connection timeout. By default, the connection is blocked until the connection
185-
is established, but if you specify ``wait_connected=false``, the connection returns immediately.
176+
* ``wait_connected``: a connection timeout. By default, the connection is blocked until the connection
177+
is established, but if you specify ``wait_connected=false``, the connection returns immediately.
186178
If you specify this timeout, it will wait before returning (``wait_connected=1.5`` makes it wait at most 1.5 seconds).
187179

188180
.. NOTE::
@@ -191,43 +183,44 @@ Below is a list of all ``net.box`` functions.
191183
The wait completes once the connection is established or is closed explicitly.
192184

193185

194-
* ``reconnect_after``: a number of seconds to wait before reconnecting.
195-
The default value, as with the other ``connect`` options, is ``nil``. If ``reconnect_after``
196-
is greater than zero, then a ``net.box`` instance will attempt to reconnect if a connection
197-
is lost or a connection attempt fails. This makes transient network failures transparent to the application.
198-
Reconnection happens automatically in the background, so requests that initially fail due to connection drops
199-
fail, are transparently retried. The number of retries is unlimited, connection retries are made after
200-
any specified interval (for example, ``reconnect_after=5`` means that reconnect attempts are made every 5 seconds).
201-
When a connection is explicitly closed or when the Lua garbage collector removes it, then reconnect attempts stop.
202-
186+
* ``reconnect_after``: a number of seconds to wait before reconnecting.
187+
The default value, as with the other ``connect`` options, is ``nil``. If ``reconnect_after``
188+
is greater than zero, then a ``net.box`` instance will attempt to reconnect if a connection
189+
is lost or a connection attempt fails. This makes transient network failures transparent to the application.
190+
Reconnection happens automatically in the background, so requests that initially fail due to connection drops
191+
fail, are transparently retried. The number of retries is unlimited, connection retries are made after
192+
any specified interval (for example, ``reconnect_after=5`` means that reconnect attempts are made every 5 seconds).
193+
When a connection is explicitly closed or when the Lua garbage collector removes it, then reconnect attempts stop.
203194

204-
* ``call_16``: [since 1.7.2] a new binary protocol command for CALL in ``net.box`` connections by default.
205-
The new CALL is not backward compatible with previous versions. It no longer restricts a function to
206-
returning an array of tuples and allows returning an arbitrary MsgPack/JSON result,
207-
including scalars, nil and void (nothing). The old CALL is left intact for backward compatibility.
208-
It will not be present in the next major release. All programming language drivers will gradually be switched
209-
to the new CALL. To connect to a Tarantool instance that uses the old CALL, specify ``call_16=true``.
210195

211-
* ``console``: an option to use different connection support methods (as if instances of different
212-
classes are returned). With ``console = true``, you can use the ``conn`` methods ``close()``,
213-
``is_connected()``, ``wait_state()``, ``eval()`` (in this case both binary and Lua console
214-
network protocols are supported).
215-
With ``console = false`` (default), you can also use ``conn`` database methods (in this case only the
216-
binary protocol is supported). Deprecation note: ``console = true`` is deprecated, users should use
217-
:ref:`console.connect() <console-connect>` instead.
196+
* ``call_16``: [since 1.7.2] a new binary protocol command for CALL in ``net.box`` connections by default.
197+
The new CALL is not backward compatible with previous versions. It no longer restricts a function to
198+
returning an array of tuples and allows returning an arbitrary MsgPack/JSON result,
199+
including scalars, nil and void (nothing). The old CALL is left intact for backward compatibility.
200+
It will not be present in the next major release. All programming language drivers will gradually be switched
201+
to the new CALL. To connect to a Tarantool instance that uses the old CALL, specify ``call_16=true``.
218202

219203
* ``connect_timeout``: a number of seconds to wait before returning "error: Connection timed out".
220204

221-
* ``required_protocol_version``: a minimum version of the :ref:`IPROTO protocol <box_protocol-id>`
222-
supported by the server. If the version of the :ref:`IPROTO protocol <box_protocol-id>` supported
223-
by the server is lower than specified, the connection will fail with an error message.
224-
With ``required_protocol_version = 1``, all connections fail where the :ref:`IPROTO protocol <box_protocol-id>`
225-
version is lower than ``1``.
205+
* ``fetch_schema``: a boolean option that controls fetching schema changes from the server. Default: ``true``.
206+
If you don't operate with remote spaces, for example, run only ``call`` or ``eval``, set ``fetch_schema`` to
207+
``false`` to avoid fetching schema changes which is not needed in this case.
208+
209+
.. important::
210+
211+
In connections with ``fetch_schema == false``, remote spaces are unavailable
212+
and the :ref:`on_schema_reload <net_box-on_schema_reload>` triggers don't work.
226213

227-
* ``required_protocol_features``: specified :ref:`IPROTO protocol features <box_protocol-id>` supported by the server.
228-
You can specify one or more ``net.box`` features from the table below. If the server does not
229-
support the specified features, the connection will fail with an error message.
230-
With ``required_protocol_features = {'transactions'}``, all connections fail where the
214+
* ``required_protocol_version``: a minimum version of the :ref:`IPROTO protocol <box_protocol-id>`
215+
supported by the server. If the version of the :ref:`IPROTO protocol <box_protocol-id>` supported
216+
by the server is lower than specified, the connection will fail with an error message.
217+
With ``required_protocol_version = 1``, all connections fail where the :ref:`IPROTO protocol <box_protocol-id>`
218+
version is lower than ``1``.
219+
220+
* ``required_protocol_features``: specified :ref:`IPROTO protocol features <box_protocol-id>` supported by the server.
221+
You can specify one or more ``net.box`` features from the table below. If the server does not
222+
support the specified features, the connection will fail with an error message.
223+
With ``required_protocol_features = {'transactions'}``, all connections fail where the
231224
server has ``transactions: false``.
232225

233226
.. container:: table
@@ -240,26 +233,26 @@ Below is a list of all ``net.box`` functions.
240233
- Use
241234
- IPROTO feature ID
242235
- IPROTO versions supporting the feature
243-
* - ``streams``
236+
* - ``streams``
244237
- Requires streams support on the server
245-
- IPROTO_FEATURE_STREAMS
238+
- IPROTO_FEATURE_STREAMS
246239
- 1 and newer
247240
* - ``transactions``
248241
- Requires transactions support on the server
249-
- IPROTO_FEATURE_TRANSACTIONS
242+
- IPROTO_FEATURE_TRANSACTIONS
250243
- 1 and newer
251244
* - ``error_extension``
252245
- Requires support for :ref:`MP_ERROR <msgpack_ext-error>` MsgPack extension on the server
253-
- IPROTO_FEATURE_ERROR_EXTENSION
246+
- IPROTO_FEATURE_ERROR_EXTENSION
254247
- 2 and newer
255248
* - ``watchers``
256249
- Requires remote :ref:`watchers <conn-watch>` support on the server
257-
- IPROTO_FEATURE_WATCHERS
258-
- 3 and newer
259-
250+
- IPROTO_FEATURE_WATCHERS
251+
- 3 and newer
252+
260253
To learn more about IPROTO features, see :ref:`IPROTO_ID <box_protocol-id>`
261254
and the :ref:`IPROTO_FEATURES <internals-iproto-keys-features>` key.
262-
255+
263256
:return: conn object
264257
:rtype: userdata
265258

@@ -268,12 +261,19 @@ Below is a list of all ``net.box`` functions.
268261
.. code-block:: lua
269262
270263
net_box = require('net.box')
271-
264+
272265
conn = net_box.connect('localhost:3301')
273266
conn = net_box.connect('127.0.0.1:3302', {wait_connected = false})
274267
conn = net_box.connect('127.0.0.1:3303', {reconnect_after = 5, call_16 = true})
275268
conn = net_box.connect('127.0.0.1:3304', {required_protocol_version = 4, required_protocol_features = {'transactions', 'streams'}, })
276269
270+
.. _net_box-new:
271+
272+
.. function:: new(URI [, {option[s]}])
273+
274+
``new()`` is a synonym for ``connect()``. It is retained for backward compatibility.
275+
For more information, see the description of :ref:`net_box.connect() <net_box-connect>`.
276+
277277
.. _net_box-self:
278278

279279
.. class:: self
@@ -562,13 +562,13 @@ Below is a list of all ``net.box`` functions.
562562
The method has the same syntax as the :doc:`box.watch() </reference/reference_lua/box_events/broadcast>`
563563
function, which is used for subscribing to events locally.
564564

565-
Watchers survive reconnection (see the ``reconnect_after`` connection :ref:`option <net_box-new>`).
565+
Watchers survive reconnection (see the ``reconnect_after`` connection :ref:`option <net_box-connect>`).
566566
All registered watchers are automatically resubscribed when the
567567
connection is reestablished.
568568

569569
If a remote host supports watchers, the ``watchers`` key will be set in the
570570
connection ``peer_protocol_features``.
571-
For details, check the :ref:`net.box features table <net_box-new>`.
571+
For details, check the :ref:`net.box features table <net_box-connect>`.
572572

573573
.. note::
574574

@@ -603,28 +603,6 @@ Below is a list of all ``net.box`` functions.
603603
604604
w:unregister()
605605
606-
.. _conn-timeout:
607-
608-
.. method:: timeout(timeout)
609-
610-
``timeout(...)`` is a wrapper which sets a timeout for the request that
611-
follows it. Since version 1.7.4 this method is deprecated -- it is better
612-
to pass a timeout value for a method's ``{options}`` parameter.
613-
614-
**Example:**
615-
616-
.. code-block:: lua
617-
618-
conn:timeout(0.5).space.tester:update({1}, {{'=', 2, 15}})
619-
620-
Although ``timeout(...)`` is deprecated, all
621-
remote calls support its use. Using a wrapper object makes
622-
the remote connection API compatible with the local one, removing the need
623-
for a separate ``timeout`` argument, which the local version would ignore. Once
624-
a request is sent, it cannot be revoked from the remote server even if a
625-
timeout expires: the timeout expiration only aborts the wait for the remote
626-
server response, not the request itself.
627-
628606
.. _net_box-is_async:
629607

630608
.. method:: request(... {is_async=...})

doc/reference/reference_rock/vshard/vshard_router.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -710,19 +710,19 @@ Router public API
710710

711711
Bucket parameters:
712712

713-
* ``available_ro``the number of buckets known to the ``router`` and available for read requests
714-
* ``available_rw``the number of buckets known to the ``router`` and available for read and write requests
715-
* ``unavailable``—the number of buckets known to the ``router`` but unavailable for any requests
716-
* ``unreachable``—the number of buckets whose replica sets are not known to the ``router``
713+
* ``available_ro`` -- the number of buckets known to the ``router`` and available for read requests
714+
* ``available_rw`` -- the number of buckets known to the ``router`` and available for read and write requests
715+
* ``unreachable`` -- the number of buckets known to the ``router`` but unavailable for any requests
716+
* ``unknown`` -- the number of buckets whose replica sets are not known to the ``router``
717717

718718
Service parameters:
719719

720-
* ``name`` service name. Possible values: ``discovery``, ``failover``, ``master_search``.
721-
* ``status`` service status. Possible values: ``ok``, ``error``.
722-
* ``error`` error message that appears on the ``error`` status.
723-
* ``activity`` service state. It shows what the service is currently doing
720+
* ``name`` -- service name. Possible values: ``discovery``, ``failover``, ``master_search``.
721+
* ``status`` -- service status. Possible values: ``ok``, ``error``.
722+
* ``error`` -- error message that appears on the ``error`` status.
723+
* ``activity`` -- service state. It shows what the service is currently doing
724724
(for example, ``updating replicas``).
725-
* ``status_idx`` incrementing counter of the status changes.
725+
* ``status_idx`` -- incrementing counter of the status changes.
726726
The ``ok`` status is updated on every successful iteration of the service.
727727
The ``error`` status is updated only when it is fixed.
728728

locale/ru/LC_MESSAGES/reference/reference_lua/net_box.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ msgid ""
355355
msgstr ""
356356
"`reconnect_after`: ``net.box`` автоматически подключается повторно в случае "
357357
"разрыва соединения или провала попытки подключения. В таком случае "
358-
"неустойчивые сетевые отказы становятся очевидными. Повторное подключение "
358+
"точечные сетевые проблемы не влияют на работу приложения. Повторное подключение "
359359
"выполняется автоматически в фоновом режиме, поэтому запросы/обращения, не "
360360
"выполненные по причине потери соединения, явным образом выполняются "
361361
"повторно. Количество повторов не ограничено, попытки подключения выполняются"

0 commit comments

Comments
 (0)