# 3.1.0

Date: 2024-04-16
Tag: 3.1.0

## Overview

3.1.0 is the first [stable][release_policy] version of the 3.1 release
series. It introduces 28 improvements and resolves 2 bugs since
3.0.2.

The "stable" label means that we have all planned features implemented and we
see no high-impact issues. However, if you encounter an issue, feel free to
[report it][issues] on GitHub.

[release_policy]: https://www.tarantool.io/en/doc/latest/release/policy/
[issues]: https://github.com/tarantool/tarantool/issues

## Compatibility

Tarantool 3.x is backward compatible with Tarantool 2.11.x in the binary data
layout, client-server protocol, and replication protocol.

Please [upgrade][upgrade] using the `box.schema.upgrade()` procedure to unlock
all the new features of the 3.x series.

[upgrade]: https://www.tarantool.io/en/doc/latest/book/admin/upgrades/

## Functionality added or changed

### Core

* Introduced fixed-size numeric field types: `uint8`, `int8`, `uint16`, `int16`,
  `uint32`, `int32`, `uint64`, `int64`, `float32`, `float64` (gh-9548).
* Now it is possible to set IPROTO request handler callbacks by using the new
  Lua module `trigger`, for example:
  ```lua
  local trigger = require('trigger')
  trigger.set('box.iproto.override.select', 'my_select', my_select_handler)
  ```
  The method works before the initial `box.cfg{}` call. Also, the method allows
  setting multiple handlers for a single request type (gh-8138).
* `box.iproto.override()` was switched to the universal trigger registry. As a
  side effect, now this function does not raise an error when a wrong request
  type is passed. All such errors are logged with `CRITICAL` level (gh-8138).
* Added a new flag `tarantool.build.test_build` that shows whether a build
  flag `TEST_BUILD` is set.
* Hide redundant fields from `box.error.unpack()` if
  the `box_error_unpack_type_and_code` compat option is set to 'new'.
  The default behaviour is 'old' (gh-9101).
* Sped up the creation of large sparse tuples by up to 3.5x in a synthetic test.
* Error details are now available as error payload fields (gh-9108).
* Added the `name` field to an error object (gh-9875).
* Added a `trigger` option to `box.schema.func.create`. This option allows creating
  persistent triggers (gh-8663).

### Lua

* Now it is possible to add custom payload fields to `box.error` (gh-9104).
* Added a `message` argument to the table constructor of `box.error.new`
  (gh-9102).
* Added a `prev` argument to the table constructor of `box.error.new` (gh-9103).
* Now it is possible to access a payload field of an error's cause directly
  from the error (gh-9106).
* Increased the verbosity of `box.error`s serialization and added a new
  `box_error_serialize_verbose` option to `compat` to retain old behaviour
  (gh-9105).
* Added autocompletion (including payload fields) to `box.error` (gh-9107).
* Added the `level` argument to `box.error` and `box.error.new` to specify
  the stack frame used for setting the error location (gh-9792).
* Added key validation and comparison functions to the `key_def` module
  (gh-9863).
* Added a `tnt_election_leader_idle` metric to built-in `metrics`.

#### Http client

* Added the `http_version` option to the `request()`, `post()`,
  `get()` and other request functions from the `http.client` module (gh-9806).

### Config

* Added new `config.etcd` options `watchers.reconnect_timeout` and
  `watchers.reconnect_max_attempts` (ghe-647).
* Introduced the `sharding.rebalancer_mode` option (gh-9657).
* Introduced the `sharding.weight` configuration option, which reflects
  the relative amount of data that a replicaset can store (gh-9775).
* `config:info()` can now display source metadata from the last successful
  load along with source metadata from the very last load attempt (gh-9780).
* Introduced the `labels` configuration option. The labels are maps with
  string keys that are merged to instance level (gh-9809).
* Added the `config:instances()` method and the `instance` option to
  `config:get()` (gh-9680).
* Introduced the `instance_uri()` method for the `config` module (gh-9842).

### Experimental

* Introduced the `experimental.connpool` module and the
  `connect()` function of this module (gh-9842).
* Introduced the `filter()` function in the `experimental.connpool`
  module (gh-9842).
* Introduced the `call()` function in the `experimental.connpool`
  module (gh-9842).
* Introduced the `mode` option for the `filter()` and `call()` functions
  in the `experimental.connpool` module (gh-9930).

## Bugs fixed

### Core

* Provided old and new tuples in `box.error.TUPLE_FOUND` (gh-6166).
* An attempt to execute a DDL, DML, DQL, DCL or TCL query within
  a transactional trigger (`on_commit` or `on_rollback`) now fails
  with a specific error (gh-9186, gh-7331).

For the list of other bugs fixed you can refer to the [3.0.2 release notes][previous_release],
since most of the bugs are backported to the previous version.

[previous_release]: https://github.com/tarantool/tarantool/releases/tag/3.0.2

## Tools

* `tarantoolctl` has been removed. Systemd, sysvinit and logrotate
  scripts based on it were also removed. All this functionality is covered by the `tt` utility.
  `tarantoolctl` is no longer available in official deb and rpm packages. This change will only
  affect the absence of tarantoolctl in future releases of tarball archives.
  (gh-9443).
* Added the `--human-readable` option for the `misc.memprof` parser to print
  sizes like 1KiB, 234MiB, 2GiB, etc.
  Made the errors from the profilers more user-friendly (gh-9217).
