From 046cae8ce18ec76f5af2809886549469bb62eeab Mon Sep 17 00:00:00 2001 From: Patience Daur Date: Fri, 5 Aug 2022 15:26:20 +0300 Subject: [PATCH 1/6] Provide links to Lua and LuaJIT data types Resolves #1318 --- doc/reference/reference_lua/box_null.rst | 4 +++- .../ru/LC_MESSAGES/reference/reference_lua/box_null.po | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/reference/reference_lua/box_null.rst b/doc/reference/reference_lua/box_null.rst index 2db2aa3b39..2c744a1a02 100644 --- a/doc/reference/reference_lua/box_null.rst +++ b/doc/reference/reference_lua/box_null.rst @@ -6,6 +6,8 @@ There are some major problems with using Lua **nil** values in tables. For example: you can't correctly assess the length of a table that is not a sequence. +(Learn more about data types in `Lua `__ +and `LuaJIT `__.) **Example:** @@ -45,7 +47,7 @@ without a value. Using box.NULL ~~~~~~~~~~~~~~ -``box.NULL`` is a value of the cdata type representing a NULL pointer. +``box.NULL`` is a value of the `cdata `__ type representing a NULL pointer. It is similar to ``msgpack.NULL``, ``json.NULL`` and ``yaml.NULL``. So it is some not **nil** value, even if it is a pointer to NULL. diff --git a/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po b/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po index d3afb9f1fa..bcd16af0eb 100644 --- a/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po +++ b/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po @@ -5,11 +5,14 @@ msgstr "Константа `box.NULL`" msgid "" "There are some major problems with using Lua **nil** values in tables. For " "example: you can't correctly assess the length of a table that is not a " -"sequence." +"sequence. (Learn more about data types in `Lua `__ " +"and `LuaJIT `__.)" msgstr "" "Имеется целый ряд серьезных проблем при использовании значения **nil** из " "Lua в таблицах. Например: вы не можете корректно оценить длину таблицы, не " -"являющейся последовательностью." +"являющейся последовательностью. (Узнайте больше о типах данных в `Lua " +"`__ " +"и `LuaJIT `__.)" msgid "**Example:**" msgstr "**Пример:**" @@ -63,7 +66,7 @@ msgid "Using box.NULL" msgstr "Использование box.NULL" msgid "" -"``box.NULL`` is a value of the cdata type representing a NULL pointer. It is" +"``box.NULL`` is a value of the `cdata `__ type representing a NULL pointer. It is" " similar to ``msgpack.NULL``, ``json.NULL`` and ``yaml.NULL``. So it is some" " not **nil** value, even if it is a pointer to NULL." msgstr "" From 51607ac77893b697d8b9bdb1f5c0ff8953cb2d5e Mon Sep 17 00:00:00 2001 From: Patience Daur Date: Fri, 5 Aug 2022 15:28:02 +0300 Subject: [PATCH 2/6] Replace wrong link to Lua 5.2 with correct to Lua 5.1 Resolves #1321 --- doc/reference/reference_lua/box_null.rst | 2 +- locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/reference/reference_lua/box_null.rst b/doc/reference/reference_lua/box_null.rst index 2c744a1a02..01e35e7168 100644 --- a/doc/reference/reference_lua/box_null.rst +++ b/doc/reference/reference_lua/box_null.rst @@ -37,7 +37,7 @@ the end of the table differently. This is due to undefined behavior. Trying to find the length for sparse arrays in LuaJIT leads to another scenario of - `undefined behavior `_. + `undefined behavior `_. To avoid this problem, use Tarantool's ``box.NULL`` constant instead of **nil**. ``box.NULL`` is a placeholder for a **nil** value in tables to preserve a key diff --git a/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po b/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po index bcd16af0eb..bc9fd409df 100644 --- a/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po +++ b/locale/ru/LC_MESSAGES/reference/reference_lua/box_null.po @@ -46,7 +46,7 @@ msgstr "" msgid "" "Trying to find the length for sparse arrays in LuaJIT leads to another " "scenario of `undefined behavior " -"`_." +"`_." msgstr "" "Попытка найти длину для разреженного массива в LuaJIT приводит к другому " "случаю `неопределённого поведения " From 2797faf61a2b0f2ca4ee1ddc7b913b7482dd90ab Mon Sep 17 00:00:00 2001 From: Patience Daur Date: Fri, 5 Aug 2022 15:32:32 +0300 Subject: [PATCH 3/6] Provide a more relevant link to Lua table manual Resolves #1785 --- doc/reference/reference_lua/table.rst | 2 +- locale/ru/LC_MESSAGES/reference/reference_lua/table.po | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/reference/reference_lua/table.rst b/doc/reference/reference_lua/table.rst index 56d525be8a..9083f0987a 100644 --- a/doc/reference/reference_lua/table.rst +++ b/doc/reference/reference_lua/table.rst @@ -7,7 +7,7 @@ .. module:: table The :code:`table` module has everything in the -`standard Lua table library `_, +`standard Lua table library `_, and some Tarantool extensions. You can see this by saying "table": you will see this list of functions: diff --git a/locale/ru/LC_MESSAGES/reference/reference_lua/table.po b/locale/ru/LC_MESSAGES/reference/reference_lua/table.po index a9a9ceaf73..f8d10300e3 100644 --- a/locale/ru/LC_MESSAGES/reference/reference_lua/table.po +++ b/locale/ru/LC_MESSAGES/reference/reference_lua/table.po @@ -4,10 +4,10 @@ msgstr "Модуль `table`" msgid "" "The :code:`table` module has everything in the `standard Lua table library " -"`_, and some Tarantool extensions." +"`_, and some Tarantool extensions." msgstr "" "Модуль :code:`table` включает в себя всё из `стандартной библиотеки для " -"работы с таблицами в Lua `_, а также " +"работы с таблицами в Lua `_, а также " "некоторые расширения специально для Tarantool." msgid "" From 782bdff2e89e32d4fd77ec1e0e98eb17a85aba79 Mon Sep 17 00:00:00 2001 From: Patience Daur Date: Fri, 5 Aug 2022 16:07:12 +0300 Subject: [PATCH 4/6] Add msgpack.NULL to data types table Resolves #927 --- doc/book/box/data_model.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/book/box/data_model.rst b/doc/book/box/data_model.rst index 4569a1ed40..de634e7010 100644 --- a/doc/book/box/data_model.rst +++ b/doc/book/box/data_model.rst @@ -182,6 +182,10 @@ Lua versus MsgPack - ext (for Tarantool ``uuid``) - `cdata`_ - ``12a34b5c-de67-8f90-123g-h4567ab8901`` + * - scalar + - msgpack.NULL + - `cdata`_ + - :ref:`box.NULL ` * - compound - map - `table`_ (with string keys) From eadd9ffedc44192f9760e5cfcf96098a3eeabcad Mon Sep 17 00:00:00 2001 From: Patience Daur Date: Fri, 5 Aug 2022 16:31:38 +0300 Subject: [PATCH 5/6] Add a sharded space example Resolves #2474 --- doc/book/box/data_model.rst | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/doc/book/box/data_model.rst b/doc/book/box/data_model.rst index de634e7010..b2884aeff7 100644 --- a/doc/book/box/data_model.rst +++ b/doc/book/box/data_model.rst @@ -1211,21 +1211,28 @@ in the YAML format in a declarative way. The schema would look something like this: -.. code:: yaml +.. code-block:: yaml spaces: - users: - engine: memtx - is_local: false - temporary: false - format: - - {name: user_id, type: uuid, is_nullable: false} - - {name: fullname, type: string, is_nullable: false} - indexes: - - name: user_id - unique: true - parts: [{path: user_id, type: uuid, is_nullable: false}] - type: HASH + users: + engine: memtx + is_local: false + temporary: false + format: + - {name: user_id, type: uuid, is_nullable: false} + - {name: fullname, type: string, is_nullable: false} + - {name: bucket_id, type: unsigned, is_nullable: false} + indexes: + - name: user_id + unique: true + parts: [{path: user_id, type: uuid, is_nullable: false}] + type: HASH + - name: bucket_id + unique: false + parts: [{path: bucket_id, type: unsigned, is_nullable: false}] + type: TREE + sharding_key: [user_id] + sharding_func: test_module.sharding_func This alternative is simpler to use, and you do not have to dive deep into Lua. From 2939d75e1f22462047529cab0e0415048f685e0a Mon Sep 17 00:00:00 2001 From: Patience Daur Date: Fri, 5 Aug 2022 16:49:02 +0300 Subject: [PATCH 6/6] Clarify box.cfg.listen value type Resolves #2855 --- doc/reference/configuration/cfg_basic.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/reference/configuration/cfg_basic.rst b/doc/reference/configuration/cfg_basic.rst index ea57dc3f4d..ca90a63eae 100644 --- a/doc/reference/configuration/cfg_basic.rst +++ b/doc/reference/configuration/cfg_basic.rst @@ -84,7 +84,8 @@ A replica also binds to this port, and accepts connections, but these connections can only serve reads until the replica becomes a master. - Starting from version 2.10.0, you can specify :ref:`several URIs `. + Starting from version 2.10.0, you can specify :ref:`several URIs `, + and the port number is always stored as an integer value. | Type: integer or string | Default: null