- Apr 02, 2024
-
-
Georgiy Lebedev authored
Currently, the connection state is updated after calling triggers. However, the triggers can, in turn, cause a new state change. The state will be updated the state in the wrong order, and the original state change will overwrite the state change from the trigger. To fix this, let's update the connection state before calling any triggers. Closes #9827 NO_DOC=<bugfix>
-
Georgiy Lebedev authored
For the `on_connect` trigger, if the trigger execution fails and an exception happens, the connection is terminated and its state changes to 'error'. It allows the following filtering semantic: the client checked some condition from the trigger and decided that the connection does not suite him — the exception is thrown to indicate that the connection should be terminated. Currently, the `on_schema_reload` trigger behaves the same way. However, filtering a connection from the `on_schema_reload` trigger or waiting for a schema update does not seem has neither a reasonable semantic, nor a valid use case. Let's make the `on_schema_reload` trigger behave the same way as the `on_disconnect` trigger, i.e, log the exception, but otherwise ignore it. Closes #9679 @TarantoolBot document Title: `on_schema_reload` trigger of `net.box` connections behaviour update Product: Tarantool Since: 3.1 Root documents: https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#lua-function.conn.on_schema_reload When an error is thrown from the `on_schema_reload` trigger, it now behaves the same way as the `on_disconnect` trigger [^1]: > If the trigger function causes an error, the error is logged but otherwise is ignored. [^1]: https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#lua-function.conn.on_disconnect
-
Georgiy Lebedev authored
According to the documentation [1]: > If the trigger function causes an error, the error is logged but otherwise is ignored. However, currently, the `on_disconnect` trigger behaves the same way as the `on_connect` trigger, i.e., the connection is terminated and its state changes to 'error'. Let's fix this inconsistency and log errors from the `on_disconnect` trigger, but otherwise ignore them. Closes #9677 Closes #9797 NO_DOC=<bugfix> 1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#lua-function.conn.on_disconnect
-
Alexander Turenko authored
These options configure how often a state information is updated by the failover coordinator in a remote state storage and how fast a transient state is expired. The new options are named as follows. * `failover.stateboard.renew_interval` * `failover.stateboard.keepalive_interval` Part of https://github.com/tarantool/tarantool-ee/issues/564 NO_DOC=to be added separately NO_CHANGELOG=Enterprise Edition feature, no new behavior in the Community Edition
-
- Mar 29, 2024
-
-
Yaroslav Lobankov authored
It has been decided to drop required devx team review for tests. NO_DOC=codeowners NO_TEST=codeowners NO_CHANGELOG=codeowners
-
- Mar 28, 2024
-
-
Yaroslav Lobankov authored
This patch changes iproto listen URI setting in default-config.yaml from `localhost:3301` to `0.0.0.0:3301`. Without this change, it's impossible to start container and use a popular way for port publishing: $ docker run -p 3301:3301 --rm -d tarantool/tarantool $ tt connect 127.0.0.1:3301 Connecting to the instance... failed to run interactive console: failed to create new console: failed to connect: failed to get protocol:failed to read Tarantool greeting: EOF NO_DOC=docker NO_TEST=docker NO_CHANGELOG=docker
-
Alexander Turenko authored
It is recommended for modern Tarantool based applications to use a startup flow with `config.yaml` instead of starting of a Lua script. Adjusted container/application/instance names to be consistent across examples. * container: `app-instance-001` * application: `app` * instance: `instance-001` NO_DOC=it is a documentation change itself NO_CHANGELOG=no code is changed NO_TEST=see NO_CHANGELOG
-
Andrey Saranchin authored
Header "unit.h" contains `ok` and `is` macros used to check test cases. The problem is such simple names can be used in C++ STL library headers (it's OK because such short names can be hidden in a namespace), so when including, for example, header "vector" after "unit.h", build can fail because function declaration or definition in the C++ header will turn into a macro invocation. I faced this problem building Tarantool on MacOS with SDK of 14.4 version. NO_TEST=fix build NO_CHANGELOG=fix build NO_DOC=fix build
-
Yaroslav Lobankov authored
This patch adds the Docker image build routine as a part of the release pipeline. A word about image tags. For example, if a release tag is 3.1.0, the resulting Docker image will be pushed to Docker Hub with the following tags: 3.1.0, 3.1, 3. If a release tag is 3.1.0-alpha1, the resulting Docker image will be pushed to Docker Hub with one tag: 3.1.0-alpha1. Same for 3.1.0-beta1 or 3.1.0-rc1 tag. Closes #9596 NO_DOC=cd NO_TEST=cd NO_CHANGELOG=cd
-
Yaroslav Lobankov authored
This patch brings a base toolset for building official Docker images for Tarantool 3.0+ version. Toolset components: 1. Dockerfile for building Docker images (based on Ubuntu 22.04) 2. Docker entrypoint script (docker-entrypoint.sh) 3. Default Tarantool config (default-config.yaml) 4. Auxiliary tools for checking Tarantool instance status and connecting to admin console 5. Example of a basic Tarantool cluster that can be started via Docker Compose (a tool for running multi-container applications) Part of #9596 NO_DOC=docker NO_TEST=docker NO_CHANGELOG=docker
-
Georgiy Lebedev authored
Currently, the code which tries to retrieve the __autocomplete metamethod for cdata (cf644abd) is not exception safe: an exception can be thrown from the __index metamethod. In order to make it exception-safe and not overcomplicate the code, let's add a Lua wrapper for table indexation, so we can call it from C using `lua_pcall`. Closes #9828 NO_CHANGELOG=<not released> NO_DOC=<bugfix>
-
- Mar 27, 2024
-
-
Andrey Saranchin authored
Currently, exclude_null option doesn't affect functional indexes at all. It seems that we just forgot to check if tuple should be inserted to the index - the patch simply adds missing check in replace and build_next methods of functional memtx_tree index. Closes #9732 NO_DOC=bugfix
-
Georgiy Lebedev authored
In order to prevent the garbage collection of the discarded connection, asynchronous requests must reference the connection object. We must reference the connection object rather than the transport object, because our garbage collection hook is attached to the former. Closes #9629 NO_DOC=<bugfix>
-
Vladimir Davydov authored
Closes #9863 @TarantoolBot document Title: Document key validation and comparison `key_def` module functions The following new functions were introduced to the `key_def` Lua module: - `key_def:validate_key(key)`: validates a key against a key definition object. Raises an exception if the key doesn't match. Returns nothing on success. See also `box_key_def_validate_key` C API function. - `key_def:validate_full_key(key)`: validates a full key against a key definition object. Raises an exception if the key doesn't match. Returns nothing on success. See also `box_key_def_validate_full_key` C API function. - `key_def:validate_tuple(tuple)`: validates a tuple against a key definition object. Raises an exception if the tuple doesn't match. Returns nothing on success. See also `box_key_def_validate_tuple` C API function. - `key_def:compare_keys(key_a, key_b)`: compares two keys according to a key definition object. Raises an exception if any of the given key doesn't match the key definition. On success, returns a value <0 if `key_a` parts are less than `key_b` parts, 0 if equal, >0 if greater.
-
Alexander Turenko authored
Most of times the instances are already in the `'running'` status after `cluster:start()`. However, sometimes an instance is not connected yet to a majority of peers of its replicaset and has the `'orphan'` status. A test unlikely assumes this situation, because it is rare. Let's wait for the `'running'` status by default to stay on the safe side. The new option `wait_until_running` (default is `true`) allows to opt out from this behavior. It is set to `false` if `wait_until_ready` is `false`. This change improves stability of `config-luatest/anonymous_replica_test.lua`. Note: `wait_until_ready` waits until `config:info().status` will be `'ready'` or `'check_warnings'` for all the instances of the cluster. Next, `wait_until_running` on a replicaset bootstrap waits until all the instances successfully connect to a majority of peers (see the `replication.bootstrap_strategy` option for details). NO_DOC=testing helper change NO_CHANGELOG=see NO_DOC NO_TEST=no code is added to tarantool itself
-
Alexander Turenko authored
The option was handled incorrectly in some cases. Before this commit the behavior was the following. | Code | Waits? | Is it correct? | | ----------------------------------------- | ------ | -------------- | | cluster:start() | Yes | Yes | | cluster:start({wait_until_ready = true}) | Yes | Yes | | cluster:start({wait_until_ready = false}) | No | Yes | | cluster:start({}) | No | !! No !! | Now it is the following. | Code | Waits? | Is it correct? | | ----------------------------------------- | ------ | -------------- | | cluster:start() | Yes | Yes | | cluster:start({wait_until_ready = true}) | Yes | Yes | | cluster:start({wait_until_ready = false}) | No | Yes | | cluster:start({}) | Yes | !! Yes !! | There are no tests affected by this problem, but it worth to fix it just in case. NO_DOC=testing helper change NO_CHANGELOG=see NO_DOC NO_TEST=no code is added to tarantool itself
-
- Mar 26, 2024
-
-
Maxim Kokryashkin authored
This patch adds necessary cmake configurations for the <evread.lua> module, so it can be used later to implement human-readable error reporting in profile parsers. Part of #9217 NO_DOC=LuaJIT submodule NO_TEST=covered by the LuaJIT tests NO_CHANGELOG=build
-
Andrey Saranchin authored
Current func_adapter implementation has several drawbacks. Firstly, the interface has 21 virtual method (except for virtual destructor) which means you need to implement all these methods if you need a new func_adapter. Secondly, if you need to pass arguments from Lua to func_adapter, you need to iterate over Lua stack and push the value to func_adapter with appropriate type. We have internal interface for calling persistent functions - port. Let's use it for triggers too. It will allow to easily implement new func_adapter since it will have only call method and virtual destructor. Also, it will allow to easily call any func_adapter from Lua using port_lua - now module trigger relies on the fact that there are only Lua triggers. This change reduces code complexity as well - since we are using port_c for triggers, that allows to be dumped several times, we can create helper `event_run_triggers` which incapsulates work with `event_trigger_iterator` and simply calls all the triggers from the event passing the same port with arguments. Since func_adapter is used mostly for triggers, let's make both ports arguments optional - many triggers have no arguments and almost all triggers ignore returned values. Along the way, fix a possible crash when iterator passed to transactional trigger is saved and used after the trigger is over. NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
The method allows to represent port contents as a list of port_c_entry. It is handy to easily iterate over the port contents since port_c_entry is actually a list of variants of supported by Tarantool types. It is needed to easily process values returned from triggers. Returned entries mustn't be destroyed since they don't own any resources. Their lifetime is similar to the MsgPack obtained by port_get_msgpack - it may be returned directly from the port, or it can be allocated on fiber()->gc, so the caller is responsible for cleaning the region up. NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
We are going to use port_c for user-defined triggers, so we need to add an ability to store iterator in port_c. Also, this port already allows to be dumped several times - we should keep this invariant to call chains of triggers using only one port. Therefore, this commit populates port_c with new type called `iterable`. An iterable object is an object that can create iterators - an iterator is created on each dump. We decided that such approach is more convenient than copying an iterator in initial state on each dump. Iterable object and created iterator have no destructor and any invalidation logic, so author of pushed object must think about iterator invalidation by himself. What's about destructors, user of port_c must ensure that the object is alive as long as the port can be dumped. When port_c is not needed anymore, the object can be deleted by caller. Created iterator has no destructor because we think that iterator shouldn't own any resources - its state is allocated when the iterable object is dumped, and the release of the state lies on the side that dumped the object. Rationale: if you dump iterable object to Lua, the iterator is most likely to be freed only when Lua VM will run out of memory (GC will be called then), so Tarantool resources will be occupied for a long time. Let's try to avoid such situation. NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
We are going to use ports for triggers. The problem is there is no port implementation that meets all requirements to be used to pass arguments to triggers from C, so let's extend existing port_c. This port is already allows to be dumped several times - let's keep this invariant to call chains of triggers using only one port. Let's store trivial types directly, not packed in MsgPack. Then, we won't need to make a second mempool allocation to store them and we won't need to decode them to read. It's worth noting that port_c has two MsgPack types now - MP and MP_OBJECT. The first now is a MsgPack packet that will be unpacked on dump if it's possible. For example, we can pass a field of tuple, which is a MsgPack packet, to field constraint, and it will be unpacked when it will be dumped to Lua, so the constraint argument will have a Lua value, not MsgPack. On the other hand, we want to dump MsgPack as a MsgPack object sometimes. For instance, we use MsgPack object to pass request header and body to iproto override handlers and space recovery triggers. NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
Methods `get_msgpack` and `dump_msgpack` generally do the same things except for some details (array header, type of destination buffer), so let's factor out their core part into a separate function - it doesn't make much sense right now, but we are going to populate port_c with new types, and these two functions would become very similar without this refactoring. Along the way, let's panic in these methods when we are out of memory - it's the approach we are taking right now in Tarantool. Corresponding error injection is dropped as well. NO_TEST=refactoring NO_CHANGELOG=refactoring NO_DOC=refactoring
-
Andrey Saranchin authored
For easier maintenance, let's panic when there is no memory for allocation needed to add a value to port - that's the approach we're taking right now in Tarantool and we don't need to check return code of `port_c_add*()` functions because they became non-failing. Functions from C API still return int (which is always zero actually) for backward compatibility. NO_TEST=no behavior changes NO_CHANGELOG=no behavior changes NO_DOC=no behavior changes
-
Andrey Saranchin authored
Since we have a special mp_ctx type for mp_object, incapsulating tuple formats and key translation, let's replace iproto_key_translation with iproto_mp_ctx. NO_TEST=no behavior changes NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
We are going to populate port_c with mp_object, which requires mp_ctx. However, we want to have an ability to dump one port_c instance several times, so we need to add virtual copy to mp_ctx. It would be fair to say that copy constructor must accept `src` as a constant object, but this approach is inconvinient in C, and such method would be embarrassing to use in our code. So `src` is not constant in copy constructor. Method copy of mp_box_ctx is not implemented because it's not trivial, it probably will require reference counting in tuple_format_map. Anyway, it is not needed now, so that's not a problem. Also, mp_ctx_move required dst to be default initialized. However, since it provides semantics of move constructor, we shouldn't expect dst to be initialized at all, since constructor is used to construct an uninitialized object. So let's drop this requirement along the way. NO_TEST=trivial NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
Since fiber lua state can be used for internal purposes, we cannot truncate it, so we need an abitily to create port_lua with lower index boundary. The patch populates the port with field bottom - dump will start from this index at Lua stack. Also, the patch modifies port_lua destructor - all unused values are popped from lua stack now to prevent Lua stack overflow. NO_CHANGELOG=internal NO_DOC=internal
-
Andrey Saranchin authored
Since we are going to pass arguments to triggers with ports, we need to move all functions that fire triggers to box because ports are implemented there. Making functions that run triggers external (similar to cord_on_yield) leads to more circular dependencies and problems with linker - I didn't cope with box and box_error circular dependency, so let's use core triggers as callbacks to avoid this problem. NO_TEST=no behavior changes NO_CHANGELOG=no behavior changes NO_DOC=no behavior changes
-
Andrey Saranchin authored
Since we are going to rewrite func_adapter to use ports for arguments and return values, submodule port must be initialized before `box.cfg{}` because triggers are allowed to be used before database configuration. So let's init and free port submodule in `box_init` and `box_free` functions instead of `box_storage_init` and `box_storage_free` - `box_storage` is initialized on `box.cfg{}` call. NO_TEST=no behavior changes NO_CHANGELOG=no behavior changes NO_DOC=no behvior changes
-
Nikolay Shirokovskiy authored
We are going keep existing format messages for most of existing error codes as mentioned in more details in the previous commit. But sometimes we want error constructor argument to be formatted and to be added to payload differently. One example is `ER_TUPLE_FOUND` we want tuples to be formatted as string as before in formatted string but want to add them as `TUPLE`. For this purpose let's use "" payload field name. In this case error constructor argument will be used for formatted string but will not be added to the error payload. Follow up #9109 NO_CHANGELOG=internal NO_DOC=internal
-
Nikolay Shirokovskiy authored
We are going keep existing format messages for most of existing error codes. This way we will keep all the details in the error messages until `compat.BOX_ERROR_SERIALIZE_VERBOSE` is switched to 'new' so details will not disappear from logs/console output. Also we won't need to change existing Tarantool and integration tests. Follow up #9109 NO_CHANGELOG=internal NO_DOC=internal
-
Alexander Turenko authored
This commit increases a time to wait of the process termination. It may take longer than 5 seconds, when tarantool is built with an address sanitizer. The address sanitizer generates a report at the process termination and it is not always a fast thing. NO_DOC=test fix NO_CHANGELOG=see NO_DOC
-
- Mar 25, 2024
-
-
Mergen Imeev authored
Closes #9643 @TarantoolBot document Title: config: changes in `credentials` section Now the privileges that were not granted by the configuration, as well as privileges that were not granted solely by the configuration, are not revoked on reload. Privileges that have been granted only by the config module will still be revoked if they are removed from the `credentials` section on reload.
-
Mergen Imeev authored
Currently, if we try to run Tarantool 3.0 with config using old snapshot, we may get a SCHEMA_NEEDS_UPGRADE error because granting and revoking privileges are DDL operations. This leads to a situation where loading Tarantool to perform an upgrade becomes quite problematic. To avoid the issue, this patch causes 'credentials.lua' to issue a warning instead of an error in case of the SCHEMA_NEEDS_UPGRADE error during granting and revoking privileges. Note that it was still possible to startup and perform the upgrade by removing the 'credentials' section from the config or without using config. This is only a part of the solution, the issue will be fixed in #9849. Part of #9849 Needed for #9643 NO_DOC=will be added later NO_CHANGELOG=will be added later
-
- Mar 23, 2024
-
-
Gleb Kashkin authored
Before this patch, Tarantool, when started with empty configuration file, used to fail with a non verbose error: ``` $ ./src/tarantool -n instance-001 -c single.yaml LuajitError: [cluster_config] Unexpected data type for a record: "nil" fatal error, exiting the event loop ``` Now Tarantool instance can be set up with configuration from remote configuration sources available in Tarantool Enterprise Edition and run with empty config file. When there is no configuration provided for the instance an according error is thrown. Closes #9845 NO_DOC=bugfix
-
- Mar 22, 2024
-
-
Vladimir Davydov authored
Currently, the error location (file, line) is always retrieved from the current stack frame. The new argument `level` allows to change this. It has the same semantics as the `level` argument of the built-in Lua function `error`. Closes #9792 @TarantoolBot document Title: Document `level` argument of `box.error` and `box.error.new` Now, when used with a table argument, `box.error` and `box.error.new` also accept an optional second argument called `level`. It has the same meaning as the `level` argument of the built-in Lua function `error`: it specifies how to get the error location. With level 1 (the default), the error location is where `box.error` / `box.error.new` was called. Level 2 points the error to where the function that called `box.error` / `box.error.new` was called; and so on. Passing level 0 avoids addition of location information to the error. Example of using `level` with `box.error`: ```lua local json = require('json') local function inner(level) box.error({message = 'test'}, level) -- line:4 end local function outer(level) inner(level) -- line:8 end local ok, err ok, err = pcall(outer) print(json.encode(err.trace)) -- prints line:4 ok, err = pcall(outer, 1) print(json.encode(err.trace)) -- prints line:4 ok, err = pcall(outer, 2) print(json.encode(err.trace)) -- prints line:8 ok, err = pcall(outer, 0) print(json.encode(err.trace)) -- prints empty table ``` Example of using `level` with `box.error.new`: ```lua local json = require('json') local function inner(level) local err = box.error.new({message = 'test'}, level) -- line:4 return err end local function outer(level) local err = inner(level) -- line:9 return err end local err err = outer() print(json.encode(err.trace)) -- prints line:4 err = outer(1) print(json.encode(err.trace)) -- prints line:4 err = outer(2) print(json.encode(err.trace)) -- prints line:9 ok, err = pcall(outer, 0) print(json.encode(err.trace)) -- prints empty table ``` It is also possible to specify `level` when using `box.error` to re-raise an error created earlier with `box.error.new`, for example: ```lua local json = require('json') local err0 = box.error.new{message = 'test'} -- line:3 local function raise(err, level) box.error(err, level) -- line:6 end ok, err = pcall(raise, err0) print(json.encode(err.trace)) -- prints line:3 ok, err = pcall(raise, err0, 1) print(json.encode(err.trace)) -- prints line:6 ok, err = pcall(raise, err0, 0) print(json.encode(err.trace)) -- prints empty table ```
-
- Mar 20, 2024
-
-
Nikolay Shirokovskiy authored
Follow-up #9109 NO_CHANGELOG=internal NO_DOC=internal
-
Mergen Imeev authored
This patch adds a new option '_origin' to the 'box.schema.user.grant()', 'box.schema.role.grant()', 'box.schema.user.revoke()' and 'box.schema.role.revoke()' functions. This is a private option that allows to differentiate privileges based on their origin. If this option is not provided an empty string is used by default. Privileges that were granted using 'grant()' can be revoked using 'revoke()' with the same '_origin'. The motivation for this change is to avoid actually revoking a privilege granted by two actors if one actor revokes it. Needed for #9643 NO_DOC=internal NO_CHANGELOG=internal
-
Mergen Imeev authored
This patch reduces the number of tests in the in2.test.lua test file. This patch also reduces the number of inserted values. This shouldn't affect the test since it's not really an original Tarantool test, but it will reduce the execution time of this test. Currently this test often fails due to a timeout. NO_DOC=test NO_CHANGELOG=test
-
Mergen Imeev authored
Prior to this patch, the OP_SetDiag opcode accepted an error code and error description, which already included the description from the error code. But this makes #9108 more difficult, so now the accepted error description does not include the description from the error code. Note that this change is possible because all accepted error codes use exactly one argument. Additionally, this patch removes p4 from the OP_Halt opcode in one place, since OP_Halt only uses p1 and p2 and does not use p4. Moreover, the address specified in p4 may not be available by the time OP_Halt is executed. Needed for #9108 NO_DOC=internal NO_TEST=internal NO_CHANGELOG=internal
-
Sergey Kaplun authored
* test: set dependencies in BuildTestCLib macro * Add 'cc' file type for saving bytecode. * Fix C file generation in jit.bcsave. * Throw any errors before stack changes in trace stitching. * Fix recording of __concat metamethod. * Check frame size limit before returning to a lower frame. * build: purge sysprof.collapse module * build: fix tool components handling * memprof: refactor `heap_chunk` data structure * memprof: remove unused arguments * memprof: introduce the `--human-readable` option * profilers: introduce event reader module * ci: extend tarantool integration testing Part of #9595 Part of #5994 Follows up #8700 Needed for #9217 NO_DOC=LuaJIT submodule bump NO_TEST=LuaJIT submodule bump
-