Skip to content
Snippets Groups Projects
user avatar
Magomed Kostoev authored
Sequences can only be attached to integer fields of a space. The
corresponding check is done in both schema.lua and alter.cc. The
problem is that in order to make the index alter transactional,
we have to perform the `_index` space tuple replace before the
existed sequence is unattached from the space (because the index
alter may be yielding). And the check existing in the alter.cc
won't allow us to do that in some cases.

Since the check already exists in `box.schema.index.alter`, it's
decided to drop it from the `_index` `on_replace` trigger.

The downside of the solution is that uncareful manual altering the
index can silently put the space into an inconsistent condition:
the next insert into the space can either fail or silently succeed
whereas it's not supposed operation for the space. Example:

```lua
box.cfg{}
s = box.schema.space.create('s')
pk = s:create_index('pk', {parts = {{1, 'unsigned'}}, sequence = true})

-- Manual altering the index without dropping the sequence.
box.space._index:update({s.id, pk.id}, {{'=', 6, {{0, 'string'}}}})

-- This will fail: passed integer (from sequence) in string field.
s:insert({box.NULL})

-- Manual altering the index without dropping the sequence again.
box.space._index:update({s.id, pk.id}, {{'=', 6, {{0, 'scalar'}}}})

-- This will succeed: passed integer (from sequence) in scalar field.
-- Though it shouldn't have been done at all: one should not pass
-- NULL in the field which is indexed by the primary key.
s:insert({box.NULL})
```

NO_DOC=no visible changes
NO_TEST=no visible changes
NO_CHANGELOG=no visible changes
f2ee0cd1
History

Tarantool

Actions Status Code Coverage OSS Fuzz Telegram GitHub Discussions Stack Overflow

Tarantool is an in-memory computing platform consisting of a database and an application server.

It is distributed under BSD 2-Clause terms.

Key features of the application server:

Key features of the database:

  • MessagePack data format and MessagePack based client-server protocol.
  • Two data engines: 100% in-memory with complete WAL-based persistence and an own implementation of LSM-tree, to use with large data sets.
  • Multiple index types: HASH, TREE, RTREE, BITSET.
  • Document oriented JSON path indexes.
  • Asynchronous master-master replication.
  • Synchronous quorum-based replication.
  • RAFT-based automatic leader election for the single-leader configuration.
  • Authentication and access control.
  • ANSI SQL, including views, joins, referential and check constraints.
  • Connectors for many programming languages.
  • The database is a C extension of the application server and can be turned off.

Supported platforms are Linux (x86_64, aarch64), Mac OS X (x86_64, M1), FreeBSD (x86_64).

Tarantool is ideal for data-enriched components of scalable Web architecture: queue servers, caches, stateful Web applications.

To download and install Tarantool as a binary package for your OS or using Docker, please see the download instructions.

To build Tarantool from source, see detailed instructions in the Tarantool documentation.

To find modules, connectors and tools for Tarantool, check out our Awesome Tarantool list.

Please report bugs to our issue tracker. We also warmly welcome your feedback on the discussions page and questions on Stack Overflow.

We accept contributions via pull requests. Check out our contributing guide.

Thank you for your interest in Tarantool!