Skip to content

Commit d841ea7

Browse files
p7novandreyaksenov
andauthored
Add compat configuration options reference (#4352)
Resolves #3937 Co-authored-by: Andrey Aksenov <38073144+andreyaksenov@users.noreply.github.com>
1 parent b0ef2dd commit d841ea7

9 files changed

+329
-4
lines changed

doc/book/box/limitations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Limitations
6262

6363
**Number of spaces**
6464

65-
The theoretical maximum is 2147483647 (``box.schema.SPACE_MAX``)
65+
The theoretical maximum is 2147483646 (``box.schema.SPACE_MAX``)
6666
but the practical maximum is around 65,000.
6767

6868
.. _limitations_number_of_connections:

doc/reference/configuration/configuration_reference.rst

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,302 @@ audit_log.syslog.*
392392
| Default: box.NULL
393393
| Environment variable: TT_AUDIT_LOG_SYSLOG_SERVER
394394
395+
.. _configuration_reference_compat:
396+
397+
compat
398+
------
399+
400+
The ``compat`` section defines values of the :ref:`compat <compat-module>` module options.
401+
402+
.. NOTE::
403+
404+
``compat`` can be defined in any :ref:`scope <configuration_scopes>`.
405+
406+
* :ref:`compat.binary_data_decoding <configuration_reference_compat_binary_decoding>`
407+
* :ref:`compat.box_cfg_replication_sync_timeout <configuration_reference_compat_replication_timeout>`
408+
* :ref:`compat.box_error_serialize_verbose <configuration_reference_compat_error_serialize>`
409+
* :ref:`compat.box_error_unpack_type_and_code <configuration_reference_compat_error_unpack>`
410+
* :ref:`compat.box_info_cluster_meaning <configuration_reference_compat_yaml_pretty>`
411+
* :ref:`compat.box_session_push_deprecation <configuration_reference_compat_session_push>`
412+
* :ref:`compat.box_space_execute_priv <configuration_reference_compat_space_execute>`
413+
* :ref:`compat.box_space_max <configuration_reference_compat_space_max>`
414+
* :ref:`compat.box_tuple_extension <configuration_reference_compat_tuple_extension>`
415+
* :ref:`compat.box_tuple_new_vararg <configuration_reference_compat_tuple_new>`
416+
* :ref:`compat.c_func_iproto_multireturn <configuration_reference_compat_iproto_multireturn>`
417+
* :ref:`compat.fiber_channel_close_mode <configuration_reference_compat_fiber_channel>`
418+
* :ref:`compat.fiber_slice_default <configuration_reference_compat_cluster_meaning>`
419+
* :ref:`compat.json_escape_forward_slash <configuration_reference_compat_json_escape>`
420+
* :ref:`compat.sql_priv <configuration_reference_compat_sql_priv>`
421+
* :ref:`compat.sql_seq_scan_default <configuration_reference_compat_sql_scan>`
422+
* :ref:`compat.yaml_pretty_multiline <configuration_reference_compat_yaml_pretty>`
423+
424+
425+
.. _configuration_reference_compat_binary_decoding:
426+
427+
.. confval:: compat.binary_data_decoding
428+
429+
Define how to store binary data fields in Lua after decoding:
430+
431+
- ``new``: as varbinary objects
432+
- ``old``: as plain strings
433+
434+
|
435+
| Type: string
436+
| Possible values: 'new', 'old'
437+
| Default: 'new'
438+
| Environment variable: TT_COMPAT_BINARY_DATA_DECODING
439+
440+
.. _configuration_reference_compat_replication_timeout:
441+
442+
.. confval:: compat.box_cfg_replication_sync_timeout
443+
444+
Set a default replication sync timeout:
445+
446+
- ``new``: 0
447+
- ``old``: 300 seconds
448+
449+
.. important::
450+
451+
This value is set during the initial ``box.cfg{}`` call and cannot be changed later.
452+
453+
See also: :ref:`compat-option-replication-timeout`
454+
455+
|
456+
| Type: string
457+
| Possible values: 'new', 'old'
458+
| Default: 'new'
459+
| Environment variable: TT_COMPAT_BOX_CFG_REPLICATION_SYNC_TIMEOUT
460+
461+
.. _configuration_reference_compat_error_serialize:
462+
463+
.. confval:: compat.box_error_serialize_verbose
464+
465+
**Since:** :doc:`3.1.0 </release/3.1.0>`
466+
467+
Set the verbosity of :ref:`error objects <box_error-error_object>` serialization:
468+
469+
- ``new``: serialize the error message together with other potentially useful fields
470+
- ``old``: serialize only the error message
471+
472+
|
473+
| Type: string
474+
| Possible values: 'new', 'old'
475+
| Default: 'old'
476+
| Environment variable: TT_COMPAT_BOX_ERROR_SERIALIZE_VERBOSE
477+
478+
.. _configuration_reference_compat_error_unpack:
479+
480+
.. confval:: compat.box_error_unpack_type_and_code
481+
482+
**Since:** :doc:`3.1.0 </release/3.1.0>`
483+
484+
Whether to show error fields in ``box.error.unpack()``:
485+
486+
- ``new``: do not show ``base_type`` and ``custom_type`` fields; do not show
487+
the ``code`` field if it is 0. Note that ``base_type`` is still accessible for an error object.
488+
- ``old``: show all fields
489+
490+
|
491+
| Type: string
492+
| Possible values: 'new', 'old'
493+
| Default: 'old'
494+
| Environment variable: TT_COMPAT_BOX_ERROR_UNPACK_TYPE_AND_CODE
495+
496+
.. _configuration_reference_compat_cluster_meaning:
497+
498+
.. confval:: compat.box_info_cluster_meaning
499+
500+
Define the behavior of ``box.info.cluster``:
501+
502+
- ``new``: show the entire cluster
503+
- ``old:``: show the current replica set
504+
505+
|
506+
| Type: string
507+
| Possible values: 'new', 'old'
508+
| Default: 'new'
509+
| Environment variable: TT_COMPAT_BOX_INFO_CLUSTER_MEANING
510+
511+
512+
.. _configuration_reference_compat_session_push:
513+
514+
.. confval:: compat.box_session_push_deprecation
515+
516+
Whether to raise errors on attempts to call the deprecated function ``box.session.push``:
517+
518+
- ``new``: raise an error
519+
- ``old``: do not raise an error
520+
521+
522+
|
523+
| Type: string
524+
| Possible values: 'new', 'old'
525+
| Default: 'old'
526+
| Environment variable: TT_COMPAT_BOX_SESSION_PUSH_DEPRECATION
527+
528+
.. _configuration_reference_compat_space_execute:
529+
530+
.. confval:: compat.box_space_execute_priv
531+
532+
Whether the ``execute`` privilege can be granted on spaces:
533+
534+
- ``new``: an error is raised
535+
- ``old``: the privilege can be granted with no actual effect
536+
537+
|
538+
| Type: string
539+
| Possible values: 'new', 'old'
540+
| Default: 'new'
541+
| Environment variable: TT_COMPAT_BOX_SPACE_EXECUTE_PRIV
542+
543+
.. _configuration_reference_compat_space_max:
544+
545+
.. confval:: compat.box_space_max
546+
547+
Set the maximum space identifier (``box.schema.SPACE_MAX``):
548+
549+
- ``new``: 2147483646
550+
- ``old``: 2147483647
551+
552+
The limit was decremented because the old max value is used as an error indicator in the ``box`` C API.
553+
554+
|
555+
| Type: string
556+
| Possible values: 'new', 'old'
557+
| Default: 'new'
558+
| Environment variable: TT_COMPAT_BOX_SPACE_MAX
559+
560+
.. _configuration_reference_compat_tuple_extension:
561+
562+
.. confval:: compat.box_tuple_extension
563+
564+
Controls ``IPROTO_FEATURE_CALL_RET_TUPLE_EXTENSION`` and
565+
``IPROTO_FEATURE_CALL_ARG_TUPLE_EXTENSION`` feature bits that
566+
define tuple encoding in iproto ``call`` and ``eval`` requests.
567+
568+
- ``new``: tuples with formats are encoded as ``MP_TUPLE``
569+
- ``old``: tuples with formats are encoded as ``MP_ARRAY``
570+
571+
|
572+
| Type: string
573+
| Possible values: 'new', 'old'
574+
| Default: 'new'
575+
| Environment variable: TT_COMPAT_BOX_TUPLE_EXTENSION
576+
577+
.. _configuration_reference_compat_tuple_new:
578+
579+
.. confval:: compat.box_tuple_new_vararg
580+
581+
Controls how ``box.tuple.new`` interprets an argument list:
582+
583+
- ``new``: as a value with a tuple format
584+
- ``old``: as an array of tuple fields
585+
586+
|
587+
| Type: string
588+
| Possible values: 'new', 'old'
589+
| Default: 'new'
590+
| Environment variable: TT_COMPAT_BOX_TUPLE_NEW_VARARG
591+
592+
593+
.. _configuration_reference_compat_iproto_multireturn:
594+
595+
.. confval:: compat.c_func_iproto_multireturn
596+
597+
Controls wrapping of multiple results of a stored C function when returning them via iproto:
598+
599+
- ``new``: return without wrapping (consistently with a local call via ``box.func``)
600+
- ``old``: wrap results into a MessagePack array
601+
602+
|
603+
| Type: string
604+
| Possible values: 'new', 'old'
605+
| Default: 'new'
606+
| Environment variable: TT_COMPAT_C_FUNC_IPROTO_MULTIRETURN
607+
608+
.. _configuration_reference_compat_fiber_channel:
609+
610+
.. confval:: compat.fiber_channel_close_mode
611+
612+
Define the behavior of fiber channels after closing:
613+
614+
- ``new``: mark the channel read-only
615+
- ``old``: destroy the channel object
616+
617+
See also: :ref:`compat-option-fiber-channel`
618+
619+
|
620+
| Type: string
621+
| Possible values: 'new', 'old'
622+
| Default: 'new'
623+
| Environment variable: TT_COMPAT_FIBER_CHANNEL_CLOSE_MODE
624+
625+
.. _configuration_reference_compat_json_escape:
626+
627+
.. confval:: compat.json_escape_forward_slash
628+
629+
Whether to escape the forward slash symbol '/' using a backslash in a ``json.encode()`` result:
630+
631+
- ``new``: do not escape the forward slash
632+
- ``old``: escape the forward slash
633+
634+
See also: :ref:`compat-option-json-slash`
635+
636+
|
637+
| Type: string
638+
| Possible values: 'new', 'old'
639+
| Default: 'new'
640+
| Environment variable: TT_COMPAT_JSON_ESCAPE_FORWARD_SLASH
641+
642+
.. _configuration_reference_compat_sql_priv:
643+
644+
.. confval:: compat.sql_priv
645+
646+
Whether to enable access checks for SQL requests over iproto:
647+
648+
- ``new``: check the user's access permissions
649+
- ``old``: allow any user to execute SQL over iproto
650+
651+
|
652+
| Type: string
653+
| Possible values: 'new', 'old'
654+
| Default: 'new'
655+
| Environment variable: TT_COMPAT_SQL_PRIV
656+
657+
.. _configuration_reference_compat_sql_scan:
658+
659+
.. confval:: compat.sql_seq_scan_default
660+
661+
Controls the default value of the ``sql_seq_scan`` session setting:
662+
663+
- ``new``: false
664+
- ``old``: true
665+
666+
See also: :ref:`compat-option-sql-scan`
667+
668+
|
669+
| Type: string
670+
| Possible values: 'new', 'old'
671+
| Default: 'new'
672+
| Environment variable: TT_COMPAT_SQL_SEQ_SCAN_DEFAULT
673+
674+
.. _configuration_reference_compat_yaml_pretty:
675+
676+
.. confval:: compat.yaml_pretty_multiline
677+
678+
Whether to encode in block scalar style all multiline strings or ones containing the ``\n\n`` substring:
679+
680+
- ``new``: all multiline strings
681+
- ``old``: only strings containing the ``\n\n`` substring
682+
683+
See also: :ref:`compat-option-lyaml`
684+
685+
|
686+
| Type: string
687+
| Possible values: 'new', 'old'
688+
| Default: 'new'
689+
| Environment variable: TT_COMPAT_YAML_PRETTY_MULTILINE
690+
395691
.. _configuration_reference_config:
396692

397693
config

doc/reference/reference_lua/compat.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
Module compat
44
=============
55

6-
Module ``compat`` is introduced since version 2.11.0-rc.
7-
8-
96
The usual way to handle compatibility problems is to introduce an option for a new behavior and leave the old one by default.
107
It is not always the perfect way.
118

@@ -44,6 +41,26 @@ If you want to explicitly secure every behavior in ``compat``, you can do it man
4441
You should place this commands at the beginning of code in your ``init.lua`` file. In this way, you are guaranteed to get the same behavior on any other Tarantool version.
4542
See a :doc:`tutorial on using compat <./compat/compat_tutorial>` for more examples.
4643

44+
Configuration options
45+
---------------------
46+
47+
Another way to handle compatibility issues is setting the ``compat.*`` :ref:`configuration options <configuration_reference_compat>`.
48+
Similarly to the ``compat`` Lua module options, the configuration options can have
49+
values ``new`` and ``old``. The set of configuration options matches the set of
50+
options available in the ``compat`` module.
51+
52+
Below is an example fragment of a YAML configuration file:
53+
54+
.. code-block:: yaml
55+
56+
compat:
57+
box_space_max: 'new'
58+
sql_seq_scan_default: 'old'
59+
fiber_slice_default: 'old'
60+
binary_data_decoding: 'new'
61+
62+
Learn more in the :ref:`configuration_reference`.
63+
4764
Options
4865
-------
4966

doc/reference/reference_lua/compat/box_cfg_replication_sync_timeout.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Default value for replication_sync_timeout
44
==========================================
55

6+
Option: ``box_cfg_replication_sync_timeout``
7+
68
Having a non-zero :ref:`replication_sync_timeout <cfg_replication-replication_sync_timeout>` gives a user the false assumption that the ``box.cfg{replication = ...}`` call returns only when the configured node is synced with all the other nodes.
79
This is mostly true for the big ``replication_sync_timeout`` values, but it is not 100% guaranteed.
810
In other words, a user still has to check if the node is synced, or the sync just timed out.

doc/reference/reference_lua/compat/fiber_channel_close_mode.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Fiber channel close mode
44
========================
55

6+
Option: ``fiber_channel_close_mode``
7+
68
Before the change, there was an unexpected behavior when using ``channel:close()`` because it closed the channel entirely and discarded all unread events.
79

810
Old and new behavior

doc/reference/reference_lua/compat/fiber_slice_default.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Default value for max fiber slice
44
=================================
55

6+
Option: ``fiber_slice_default``
7+
68
The max fiber slice specifies the max fiber execution time without yield before a warning is logged or an error is raised.
79
It is set with the :ref:`fiber.set_max_slice() <fiber-set_max_slice>` function.
810
The new ``compat`` option – ``fiber_slice_default`` – controls the default value of the max fiber slice.

doc/reference/reference_lua/compat/json_escape_forward_slash.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
JSON encode escape forward slash
44
================================
55

6+
Option: ``json_escape_forward_slash``
7+
68
For some reason, in the upstream ``lua_cjson``, the '/' sign is escaped.
79
But according to the ``rfc4627`` standard, it is unnecessary and questionably compatible with other implementations.
810

doc/reference/reference_lua/compat/sql_seq_scan_default.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Default value for sql_seq_scan session setting
44
==============================================
55

6+
Option: ``sql_seq_scan_default``
7+
68
The default value for the ``sql_seq_scan`` session setting will be set to false starting with Tarantool 3.0.
79
To be able to return the behavior to the old default, a new ``compat`` option is introduced.
810

0 commit comments

Comments
 (0)