Date: 2022-08-08
Tag: 2.10.1

## Overview

Notable changes are:

* Interactive transactions are now possible in remote binary consoles.
* Improved the string representation of datetime intervals.

2.10.1 is the 2-nd [stable][release_policy] version of the 2.10 release
series. It introduces 17 improvements and resolves 52 bugs since
2.10.0.

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/dev_guide/release_management/#release-policy
[issues]: https://github.com/tarantool/tarantool/issues

## Compatibility

Tarantool 2.x is backward compatible with Tarantool 1.10.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 2.x series.

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

## Functionality added or changed

### Core

* **[Breaking change]** Conflicted transactions now throw the
  `Transaction has been aborted by conflict` error on any CRUD operations
  until they are either rolled back (which will return no error) or committed
  (which will return the same error) (gh-7240).
* Read-view transactions now become conflicted on attempts to perform DML
  statements immediately. Previously, this was detected only on the transaction
  preparation stage, that is, when calling `box.commit` (gh-7240).
* Interactive transactions are now possible in remote binary consoles (gh-7413).
* It is now possible to omit `space` in declarations of foreign keys that
  refer to the same space (gh-7200).

### Datetime

* Improved the string representation of datetime intervals.
  Now nanoseconds aren't converted and attached to seconds;
  the intervals are displayed "as is". Example:

  ```lua
  local ival = date.interval.new{year = 12345, hour = 48, min = 3, sec = 1,
                                 nsec = 12345678}
  print(tostring(ival))
  ```
  Before:

  ```
  '+12345 years, 48 hours, 3 minutes, 1.012345678 seconds'
  ```
  Now:

  ```
  '+12345 years, 48 hours, 3 minutes, 1 seconds, 12345678 nanoseconds'
  ```

### Decimal

* Added C module API for decimals (gh-7228).
* Added Lua/C accessors for decimals into the module API (gh-7228).

### Tuple

* Added the `box_tuple_field_by_path()` function into the module API. It allow the
  access to tuple fields from C code using a JSON path (gh-7228).

### Build

* Fedora 30, 31,32, and 33 are no longer supported.
* Ubuntu 20.10 (Groovy Gorilla) and 21.04 (Hirsute Hippo) are no longer supported.
* Updated libcurl to version 7.84.0.
* Updated OpenSSL used for static builds to version 1.1.1q.
* Ubuntu 21.10 (Impish Indri) is no longer supported.
* Updated Ncurses used for static builds to version 6.3-20220716 .
* Updated Readline used for static builds to version 8.0p1.
* Updated libyaml to the version with fixed stack overflows.
* Updated zstd to version 1.5.2.
* Updated zlib used for static builds to version 1.2.12.

## Bugs fixed

### Core

* Improved validation of incoming tuples. Now tuples coming over the network
 can't contain malformed decimals, uuids, or datetime values (gh-6857).
* Fixed a bug in the net.box connector because of which a client could fail to
  close its connection when receiving a shutdown request from the server. This
  could lead to the server hanging on exit (gh-7225).
* Fixed a crash and possible undefined behaviour when using `scalar` and `number` indexes
  over fields containing both decimals and double `Inf` or `NaN`.

  For vinyl spaces, the above conditions could lead to wrong ordering of
  indexed values. To fix the issue, recreate the indexes on such
  spaces following this [guide](https://github.com/tarantool/tarantool/wiki/Fix-wrong-order-of-decimals-and-doubles-in-indices) (gh-6377).
* Fixed a bug because of which a net.box connection was not properly terminated
  when the process had a child (for example, started with `popen`) sharing the
  connection socket fd. The bug could lead to a server hanging on exit while
  executing the graceful shutdown protocol (gh-7256).
* Removed an assertion on `fiber_wakeup()` calls with dead fibers
  in debug builds. Such behavior was inconsistent with release builds,
  in which the same calls were allowed (gh-5843).
* Fixed the `exclude_null` index option not working for multikey and JSON indexes (gh-5861).
* Fixed the performance degradation of fiber backtrace collection
  after the backtrace rework (gh-7207).
* Fixed a hang when a synchronous request was issued from a net.box `on_connect`
  or `on_schema_reload` trigger. Now an error is raised instead (gh-5358).
* Fixed a crash that could happen on x86 systems without the
  `RDTSCP` instruction (gh-5869).
* Fixed a bug that allowed to access indexed fields of nested tuples with `[*]`
  in Lua (gh-5226).
* Fixed the behavior of `space_object:fselect()` on binary data (gh-7040).
* Fixed Tarantool not being able to recover from old snapshots when
  `box.cfg.work_dir` and `box.cfg.memtx_dir` were both set (gh-7232).
* Fixed Tarantool terminations on error messages with invalid UTF-8
  sequences (gh-6781 and gh-6934).
* Fixed a bug when the "Transaction is active at return from function" error
  was overwriting expression evaluation errors in case the expression begins a transaction (gh-7288).
* Added type checking for options in net.box's remote queries and
  connect method. Now graceful errors are thrown in case of incorrect
  options (gh-6063, gh-6530).
* Fixed `space_object:format()` and `space_object.foreign_key` returning
  incorrect numbers of foreign key fields (gh-7350).
* Fixed the foreign key check on `space_object:truncate()` calls (gh-7309).
* Fixed a crash when `box.stat.net.thread[i]` is called with invalid `i`
  values (gh-7196).
* Fixed a low-probability stack overflow bug in the qsort implementation.

### Memtx

* Fixed the ability to perform read-only operations in conflicting transactions
  in memtx, which led to spurious results (gh-7238).
* Fixed false assertion on repeatable `replace` with the memtx transaction
  manager enabled (gh-7214).
* Fixed false transaction conflict on repeatable `insert`/`upsert`
  with the memtx transaction manager enabled (gh-7217).
* Fixed dirty reads in the 'GT' iterator of HASH indexes (gh-7477).
* Fixed phantom reads in reverse iterators (gh-7409).
* Fixed `select` with `LE` iterator in **memtx** **TREE** index returning
  deleted tuple (gh-7432).
* Fixed incorrect handling of corner cases gap tracking in transaction
  manager (gh-7375).
* Fixed a bug in the memtx hash index implementation that could lead to
  uncommitted data written to a snapshot file (gh-7539).

### Vinyl

* Fixed a bug in the vinyl upsert squashing optimization that could lead to
  a segmentation fault error (gh-5080).
* Fixed a bug in the vinyl garbage collector. It could skip stale tuples stored
  in a secondary index if upsert operations were used on the space before the index
  was created (gh-3638).
* Fixed a bug in the vinyl read iterator that could result in a significant
  performance degradation of range select requests in the presence of an intensive
  write workload (gh-5700).
* Explicitly disabled the hot standby mode for vinyl. Now an attempt to enable
  the hot standby mode in case the master instance has vinyl spaces results in
  an error. Before this change, the behavior was undefined (gh-6565).

### Replication

* Added the logging of the error reason on a replica in case when
  the master didn't send a greeting message (gh-7204).
* Fixed replication being stuck occasionally for no obvious reasons.
* Fixed a possible split-brain when the old synchro queue owner might finalize the
  transactions in the presence of the new owner (gh-5295).
* Improved the detection of possible split-brain situations, for example, when
  multiple leaders were working independently due to manually lowered quorum.
  Once a node discovers that it received some foreign data, it immediately
  stops replication from such a node with an ER_SPLIT_BRAIN error (gh-5295).
* Fixed a false positive split-brain error after `box.ctl.demote()` (gh-7286).
* Fixed a bug when followers with `box.cfg.election_mode` turned on did not notice
  the leader hang due to a long request, such as a `select{}` from a large
  space or a `pairs` iteration without yields between loop cycles (gh-7512).

### LuaJIT

Backported patches from vanilla LuaJIT trunk (gh-6548 and gh-7230). In the scope of this
activity, the following issues have been resolved:

* Fixed emitting for fuse load of constant in GC64 mode (gh-4095, gh-4199, gh-4614).
* Now initialization of zero-filled struct is compiled (gh-4630, gh-5885).
* Actually implemented `maxirconst` option for tuning JIT compiler.
* Fixed JIT stack of Lua slots overflow during recording for metamethod calls.
* Fixed bytecode dump unpatching for JLOOP in up-recursion compiled functions.
* Fixed FOLD rule for strength reduction of widening in cdata indexing.
* Fixed `string.char()` recording without arguments.
* Fixed `print()` behaviour with the reloaded default metatable for numbers.
* `tonumber("-0")` now saves the sign of number for conversion.
* `tonumber()` now give predictable results for negative non-base-10 numbers.
* Fixed write barrier for `debug.setupvalue()` and `lua_setupvalue()`.
* Fixed conflict between 64 bit lightuserdata and ITERN key for ARM64.
* Fixed emitting assembly for HREFK on ARM64.
* Fixed pass-by-value struct in FFI calls on ARM64.
* `jit.p` now flushes and closes output file after run, not at program exit.
* Fixed `jit.p` profiler interaction with GC finalizers.
* Fixed the case for partial recording of vararg function body with the fixed
  number of result values in with `LJ_GC64` (i.e. `LJ_FR2` enabled) (gh-7172).
* Added `/proc/self/exe` symlink resolution to the symtab module to obtain the
  .symtab section for the Tarantool executable.
* Introduced stack sandwich support to sysprof's parser (gh-7244).
* Disabled proto and trace information dumpers in sysprof's default mode.
  Attempts to use them lead to a segmentation fault due to an uninitialized buffer
  (gh-7264).
* Fixed handling of errors during trace snapshot restore.

### Lua

* The `fiber_obj:info()` now correctly handles its options (gh-7210).
* Fixed a bug when Ctrl+C doesn't discard the multiline input (gh-7109).

### SQL

* Fixed the creation of ephemeral space format in `ORDER BY` (gh-7043).
* The result type of arithmetic operations between two unsigned values is now
  `INTEGER` (gh-7295).
* Fixed a bug with the `ANY` type in the ephemeral space format in `ORDER BY` (gh-7043).
* Truncation of a space no longer corrupts prepared statements (gh-7358).

### Datetime

* Fixed a bug when `date:set{hour=nil,min=XXX}`
  did not retain the original `hour` value. (gh-7298).
* Introduced the validation of incoming data at the moment
  messagepack is converted to datetime (gh-6723).

### HTTP client

* Enabled the automatic detection of system CA certificates in the runtime (gh-7372).
  It was disabled in 2.10.0, which led to the inability to use HTTPS without
  the `verify_peer = false` option.

### Build

* Fixed a build failure with gcc if libpbf is installed. (gh-7292)
* Fixed the static build on Mac OS 11 and newer (gh-7459).
