Skip to content

Commit 1f632a3

Browse files
What's new in 3.1 (#4116)
1 parent f213d68 commit 1f632a3

File tree

2 files changed

+308
-0
lines changed

2 files changed

+308
-0
lines changed

doc/release/3.1.0.rst

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
Tarantool 3.1
2+
=============
3+
4+
Planned release date: April 2024
5+
6+
Releases on GitHub: not released yet
7+
8+
The 3.1 release of Tarantool continues the development of a new cluster configuration approach introduced in the :ref:`3.0 version <3-0-new_declarative_configuration>` and adds the following main product features and improvements for the Community and Enterprise editions:
9+
10+
* **Community Edition (CE)**
11+
12+
* Improved developer experience for handling errors using the ``box.error`` module.
13+
* Introduced fixed-size numeric field types: ``uint8``, ``int8``, ``uint16``, and more.
14+
* Added RPC functionality for accessing custom roles from the configuration.
15+
* Made the ``tt`` utility used to manage instances fully compatible with the latest Tarantool version.
16+
17+
* **Enterprise Edition (EE)**
18+
19+
* Introduced an external coordinator for automatic and manual failover.
20+
* Improved the stability of work with the centralized configuration stored in etcd.
21+
22+
23+
.. _3-1-features-for-developers:
24+
25+
Developing applications
26+
-----------------------
27+
28+
.. _3-1-error-handling:
29+
30+
Error handling
31+
~~~~~~~~~~~~~~
32+
33+
This release improves the developer experience for handling errors using the :ref:`box.error <box-error-submodule>` module.
34+
Below are listed the most notable features and changes.
35+
36+
37+
.. _3-1-error_payload_fields:
38+
39+
Error payload fields
40+
********************
41+
42+
With the 3.1 release, you can add a custom payload to an error.
43+
The payload is passed as key-value pairs where a key is a string and a value is any Lua object.
44+
In the example below, the ``description`` key is used to keep the custom payload.
45+
46+
.. code-block:: lua
47+
48+
custom_error = box.error.new({ type = 'CustomInternalError',
49+
message = 'Internal server error',
50+
description = 'Some error details' -- payload
51+
})
52+
53+
A payload field value can be accessed using the dot syntax:
54+
55+
.. code-block:: tarantoolsession
56+
57+
tarantool> custom_error.description
58+
---
59+
- Some error details
60+
...
61+
62+
63+
64+
65+
66+
.. _3-1-error_stack:
67+
68+
Error stacks
69+
************
70+
71+
The 3.1 release simplifies creating error chains.
72+
In the earlier versions, you need to set an error cause using the :ref:`set_prev(error_object) <box_error-set_prev>` method, for example:
73+
74+
.. code-block:: lua
75+
76+
local ok, err = pcall(my_func)
77+
if not ok then
78+
local err2 = box.error.new{type = "MyAppError", message = "my_func failed"}
79+
err2:set_prev(err)
80+
err2:raise()
81+
end
82+
83+
Using this approach, you need to construct a new error without raising it, then set its cause using ``set_prev()``, and only then raise it.
84+
Starting with the 3.1 version, you can use a new ``prev`` argument when constructing an error:
85+
86+
.. code-block:: lua
87+
88+
local ok, err = pcall(my_func)
89+
if not ok then
90+
box.error{type = "MyAppError", message = "my_func failed", prev = err}
91+
end
92+
93+
94+
.. _3-1-error_serialization:
95+
96+
Error serialization improvements
97+
********************************
98+
99+
The 3.1 release allows you to increase the verbosity of error serialization.
100+
Before the 3.1 release, a serialized error representation included only an error message:
101+
102+
.. code-block:: tarantoolsession
103+
104+
tarantool> box.error.new({ type = 'CustomInternalError', message = 'Internal server error'})
105+
---
106+
- Internal server error
107+
...
108+
109+
110+
Starting with the 3.1 version, a serialized error also includes other fields that might be useful for analyzing errors:
111+
112+
.. code-block:: lua
113+
114+
tarantool> box.error.new({ type = 'CustomInternalError', message = 'Internal server error'})
115+
---
116+
- code: 0
117+
base_type: CustomError
118+
type: CustomInternalError
119+
custom_type: CustomInternalError
120+
message: Internal server error
121+
trace:
122+
- file: '[C]'
123+
line: 4294967295
124+
...
125+
126+
Logging an error using a built-in :ref:`logging module <log-module>` prints an error message followed by a tab space (``\t``) and all the payload fields serialized as a JSON map, for example:
127+
128+
.. code-block:: none
129+
130+
main/104/app.lua/tarantool I> Internal server error {"code":0,"base_type":"CustomError","type":"CustomInternalError", ... }
131+
132+
Given that this change may change the behavior of existing code, a new ``box_error_serialize_verbose`` :ref:`compat <compat-module>` option is introduced.
133+
To try out an increased verbosity of error serialization, set this option to ``new``:
134+
135+
.. code-block:: tarantoolsession
136+
137+
tarantool> require('compat').box_error_serialize_verbose = 'new'
138+
---
139+
...
140+
141+
142+
.. _3-1-fixed_size_numeric_types:
143+
144+
Fixed-size numeric types
145+
~~~~~~~~~~~~~~~~~~~~~~~~
146+
147+
The 3.1 release introduces fixed-size numeric :ref:`types <index-box_data-types>` that might be useful to store data unencoded in an array for effective scanning.
148+
The following numeric types are added:
149+
150+
* ``uint8``: an integer in a range ``[0 .. 255]``.
151+
* ``int8``: an integer in a range ``[-128 .. 127]``.
152+
* ``uint16``: an integer in a range ``[0 .. 65,535]``.
153+
* ``int16``: an integer in a range ``[-32,768 .. 32,767]``.
154+
* ``uint32``: an integer in a range ``[0 .. 4,294,967,295]``.
155+
* ``int32``: an integer in a range ``[-2,147,483,648 .. 2,147,483,647]``.
156+
* ``uint64``: an integer in a range ``[0 .. 18,446,744,073,709,551,615]``.
157+
* ``int64``: an integer in a range ``[-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807]``.
158+
* ``float32``: a 32-bit floating point number.
159+
* ``float64``: a 64-bit floating point number.
160+
161+
162+
163+
.. _3-1-accessing_configuration:
164+
165+
Accessing configuration of other cluster members
166+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167+
168+
In Tarantool 3.0, the :ref:`config <config-module>` module provides the ability to work with a current instance's configuration only.
169+
Starting with the 3.1 version, you can get all the instances that constitute a cluster and obtain the configuration of any instance of this cluster.
170+
171+
The ``config:instances()`` function lists all instances of the cluster:
172+
173+
.. code-block:: tarantoolsession
174+
175+
sharded_cluster:router-a-001> require('config'):instances()
176+
---
177+
- storage-a-001:
178+
group_name: storages
179+
instance_name: storage-a-001
180+
replicaset_name: storage-a
181+
storage-b-002:
182+
group_name: storages
183+
instance_name: storage-b-002
184+
replicaset_name: storage-b
185+
router-a-001:
186+
group_name: routers
187+
instance_name: router-a-001
188+
replicaset_name: router-a
189+
storage-a-002:
190+
group_name: storages
191+
instance_name: storage-a-002
192+
replicaset_name: storage-a
193+
storage-b-001:
194+
group_name: storages
195+
instance_name: storage-b-001
196+
replicaset_name: storage-b
197+
...
198+
199+
To get the specified configuration value for a certain instance, pass an instance name as an argument to ``config:get()``:
200+
201+
.. code-block:: tarantoolsession
202+
203+
sharded_cluster:router-a-001> require('config'):get('iproto', {instance = 'storage-b-001'})
204+
---
205+
- readahead: 16320
206+
net_msg_max: 768
207+
listen:
208+
- uri: 127.0.0.1:3304
209+
threads: 1
210+
advertise:
211+
peer:
212+
login: replicator
213+
client: null
214+
sharding:
215+
login: storage
216+
...
217+
218+
219+
220+
.. _3-1-administration-and-maintenance:
221+
222+
Administration and maintenance
223+
------------------------------
224+
225+
.. _3-1-failover_coordinator:
226+
227+
Failover coordinator (EE)
228+
~~~~~~~~~~~~~~~~~~~~~~~~~
229+
230+
Tarantool Enterprise Edition 3.1 introduces an external failover coordinator that monitors a Tarantool cluster and performs automatic leadership change if a current replica set leader is inaccessible.
231+
232+
A failover coordinator requires the :ref:`replication.failover <configuration_reference_replication_failover>` configuration option to be set to ``supervised``:
233+
234+
.. code-block:: yaml
235+
236+
replication:
237+
failover: supervised
238+
239+
# ...
240+
241+
To start a failover coordinator, execute the ``tarantool`` command with the ``failover`` option and pass a path to a :ref:`YAML configuration file <configuration_overview>`:
242+
243+
.. code-block:: console
244+
245+
$ tarantool --failover --config /path/to/config
246+
247+
A failover coordinator connects to all the instances, polls them for their status, and controls that each replica set with ``replication.failover`` set to ``supervised`` has only one writable instance.
248+
249+
Optionally, you can configure failover timeouts and other parameters in the ``failover`` section at the :ref:`global level <configuration_scopes>`:
250+
251+
.. code-block:: yaml
252+
253+
failover:
254+
call_timeout: 1
255+
lease_interval: 15
256+
renew_interval: 5
257+
stateboard:
258+
renew_interval: 1
259+
keepalive_interval: 5
260+
261+
262+
.. _3-1-sharding:
263+
264+
Sharding
265+
~~~~~~~~
266+
267+
The 3.1 release includes new :ref:`sharding <configuration_reference_sharding>` options that provide additional flexibility for configuring a sharded cluster.
268+
A new ``sharding.weight`` specifies the relative amount of data that a replica set can store.
269+
In the example below, the ``storage-a`` replica set can store twice as much data as ``storage-b``:
270+
271+
.. code-block:: yaml
272+
273+
# ...
274+
replicasets:
275+
storage-a:
276+
sharding:
277+
weight: 2
278+
# ...
279+
storage-b:
280+
sharding:
281+
weight: 1
282+
# ...
283+
284+
285+
286+
The ``sharding.rebalancer_mode`` option configures whether a rebalancer is selected manually or automatically.
287+
This option can have one of three values:
288+
289+
* ``auto`` (default): if there are no replica sets with the ``rebalancer`` sharding role (:ref:`sharding.roles <configuration_reference_sharding_roles>`), a replica set with the rebalancer will be selected automatically among all replica sets.
290+
* ``manual``: one of the replica sets should have the ``rebalancer`` sharding role. The rebalancer will be in this replica set.
291+
* ``off``: rebalancing is turned off regardless of whether a replica set with the ``rebalancer`` sharding role exists or not.
292+
293+
294+
.. _3-1-compatibility_tt:
295+
296+
Compatibility with the tt utility
297+
---------------------------------
298+
299+
With this release, the ``tarantoolctl`` utility used to administer Tarantool instances is completely removed from Tarantool packages.
300+
The latest version of the :ref:`tt utility <tt-cli>` is fully compatible with Tarantool 3.1 and covers all the required functionality:
301+
302+
* Setting up a development environment: initializing the environment and installing different Tarantool versions.
303+
* Various capabilities for developing cluster applications: creating applications from templates, managing modules, and building and packaging applications.
304+
* Managing cluster instances: starting and stopping instances, connecting to remote instances for administration, and so on.
305+
* Importing and exporting data (Enterprise Edition only).
306+
307+
Learn how to migrate from ``tarantoolctl`` to ``tt`` in the :ref:`tarantoolctl-migration-to-tt` section.

doc/release/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ For information about earlier versions, see :doc:`eol_versions`.
101101
.. toctree::
102102
:maxdepth: 1
103103

104+
3.1.0
104105
3.0.0
105106
2.11.0
106107
eol_versions

0 commit comments

Comments
 (0)