- Oct 25, 2021
-
-
mechanik20051988 authored
Same as for local transactions, timeout for iproto transactions was implemented. If timeout is not specified in client request it's sets to box.cfg.txn_timeout, which specified on server side. Closes #6177 @TarantoolBot document Title: ability to set timeout for iproto transactions was implemented A new `IPROTO_TIMEOUT 0x56` key has been added. Currently it is used to set a timeout for transactions over iproto streams. It is stored in the body of 'IPROTO_BEGIN' request. If user want's to specify timeout using netbox (3s for example), he should use 'stream:begin({timeout = 3}).
-
mechanik20051988 authored
Client code errors or manual mistakes can create transactions that are never closed. Such transaction will work as a memory leak. Implement timeout for transactions after which they are rolled back. Part of #6177 @TarantoolBot document Title: ability to set timeout for transactions was implemented Previously transactions are never closed until commit or rollback. Timeout for transactions was implemented after which they are rolled back. For these purpose, in `box.begin` the optional table parameter was added. For example if user want to start transaction with timeout 3s, he should use `box.begin({timeout = 3})`. Also was implement new configuration option `box.cfg.txn_timeout` which determines timeout for transactions, for which the timeout was not explicitly set. By default this option is set to infinity (TIMEOUT_INFINITY = 365 * 100 * 86400). Also in C API was added new function to set timeout for transaction - 'box_txn_set_timeout'.
-
mechanik20051988 authored
Previously, if a yield occurs for a transaction that does not support it, we roll back all its statements, but still process its new statements (they will roll back with each yield). Also, the transaction will be rolled back when a commit is attempted. Now we stop processing any new statements right after first yield, if transaction doesn't support it. This is done so that when we implement timeout for transactions, the rollback of the transaction at its expiration and at yield has the same behavior. Part of #6177
-
mechanik20051988 authored
We are going to implement timeout for transaction, after which it will be rolled back. The timeout starts counting from the moment of the first yield. Previously `txn_on_yield` trigger installed only in case when engine does not support yields for transactions. Now it is installed when transaction is created, but if transaction supports yields it doesn't do anything. In the following patches, we will use this trigger to start the transaction timeout countdown. Part of #6177
-
- Oct 22, 2021
-
-
AnastasMIPT authored
New function box.txn_id(), which returns the id of the current transaction if called within a transaction, nil otherwise. Closes #6396 @TarantoolBot document Title: new function box.txn_id() New function in module box: box.txn_id(), which returns the id of the current transaction if called within a transaction, nil otherwise.
-
- Oct 21, 2021
-
-
Vladimir Davydov authored
The session can be closed while kharon is travelling between tx and iproto. If this happens, kharon shouldn't go back to iproto when it returns to tx, even if there are pending pushes, because the connection is going to be freed soon. Thanks to @Gerold103 for the simple fix. Closes #6520
-
- Oct 20, 2021
-
-
Mergen Imeev authored
This patch removes the DECIMAL truncation in LIMIT and OFFSET, because according to the implicit casting rules, DECIMAL with digits after the decimal point cannot be implicitly cast to INTEGER. Closes #6485
-
Mergen Imeev authored
This patch fixes an assertion when casting DECIMAL value less than 0 and greater than -1 to INTEGER. Part of #6485
-
Mergen Imeev authored
In case the DECIMAL value is implicitly cast to INTEGER during a search using an index, it was possible that DECIMAL would be truncated, which is not correct according to the implicit cast rules. This patch removes this truncation. Part of #6485
-
mechanik20051988 authored
In case user enters invalid listen address, tarantool closes previous listen socket, but bind on invalid address fails also, so tarantool becames blind - no listening socket at all. This patch fixed this behaviour, now tarantool still listen old listen address. Closes #6092
-
mechanik20051988 authored
There was access to previously freed memory in case when `cbus_call` is interrupted: `cbus_call_msg` in iproto allocates on stack, and if `cbus_call` failed due to fiber cancelation or wake up, `cbus_call_msg` memory is released. But function called through cbus is still work in iproto thread and there will be an attempt to access this memory when this function in iproto thread finished it's work. This patch rework this behaviour, now before `cbus_call` we reset FIBER_IS_CANCELLABLE flag, to prevent fiber cancellation or it's wake up. Closes #6480
-
- Oct 14, 2021
-
-
Timur Safin authored
For the purposes of format support in datetime we need to modify standard strftime() implementation so it will be accepting %f flag we want to use for displaying of fractional part of seconds. Used Olson' strftime() implementation, simplified their code and header file, and adapted to work with our `struct datetime` data structure. We store timezone information there, seconds since epoch, and nanoseconds, thus we modified a way how those have being retrieved in the original implementation. We have also added missing `%f` and width modifiers support. ``` tarantool> T:format('%d') --- - '14' ... tarantool> T:format('%3d') --- - 3d ... tarantool> T:format('%3f') --- - 371 ... tarantool> T:format() --- - 2021-09-14T12:10:30.371895+0300 ... tarantool> T:format('%FT%T.%f%z') --- - 2021-09-14T12:10:30.371895+0300 ... ``` Created detailed strftime formats test to cover all of known format flags. Part of #5941
-
Timur Safin authored
Introduce a new builtin Tarantool module `datetime.lua` for timestamp and interval types support. New third_party module - c-dt ----------------------------- * Integrated chansen/c-dt parser as 3rd party module to the Tarantool cmake build process; * We use tarantool/c-dt instead of original chansen/c-dt to have an easier cmake build integration, as we have added some changes, which provide cmake support, and allow to rename symbols if necessary (this symbol renaming is similar to that we see with xxhash or icu). New built-in module `datetime` ------------------------------ * created a new Tarantool built-in module `datetime`, which uses `struct datetime` data structure for keeping timestamp values; * Lua module uses a number of `dt_*` functions from `c-dt` library, but they were renamed to `tnt_dt_*` at the moment of exporting from executable - to avoid possible name clashes with external libraries. * At the moment we libc `strftime` for formatting of datetime values according to flags passed, i.e. `date:format('%FT%T%z')` will return something like '1970-01-01T00:00:00+0000', but `date:format('%A %d, %B %Y')` will return 'Thursday 01, January 1970' * if there is no format provided then we use default `tnt_datetime_to_string()` function, which converts datetime to their default ISO-8601 output format, i.e. `tostring(date)` will return string like "1970-01-01T00:00:00Z" * There are a number of simplified interfaces - totable() for exporting table with attributes names as provided by `os.date('*t')` - set() method provides unified interface to set values using the set of attributes as defined above in totable() Example, ``` local dt = datetime.new { nsec = 123456789, sec = 19, min = 29, hour = 18, day = 20, month = 8, year = 2021, tzoffset = 180 } local t = dt:totable() --[[ { sec = 19, min = 29, wday = 6, day = 20, nsec = 123456789, isdst = false, yday = 232, tzoffset = 180, month = 8, year = 2021, hour = 18 } --]] dt:format() -- 2021-08-21T14:53:34.032Z dt:format('%Y-%m-%dT%H:%M:%S') -- 2021-08-21T14:53:34 dt:set { usec = 123456, sec = 19, min = 29, hour = 18, day = 20, month = 8, year = 2021, tzoffset = 180, } dt:set { timestamp = 1629476485.124, tzoffset = 180, } ``` Coverage is File Hits Missed Coverage ----------------------------------------- builtin/datetime.lua 299 23 92.86% ----------------------------------------- Total 299 23 92.86% Part of #5941 @TarantoolBot document Title: Introduced a new `datetime` module for timestamp and interval support Create `datetime` module for timestamp and interval types support. It allows to create date and timestamp values using either object interface, or via parsing of string values conforming to iso-8601 standard. One may manipulate (modify, subtract or add) timestamp and interval values. Please refer to https://hackmd.io/@Mons/S1Vfc_axK#Datetime-in-Tarantool for a more detailed description of module API.
-
- Oct 12, 2021
-
-
AnastasMIPT authored
Fixes incorrect handling of variable number of arguments in box.func:call(). Closes #6405
-
- Oct 07, 2021
-
-
Nikita Pettik authored
There was a bug that led to dirty read after space alter. For the simplicity sake imagine following setup: -- space 's' is empty tx1:begin() tx1('s:replace{2}') s:alter({format = format}) s:select{} Last select returns tuple {2}, however transaction tx1 hasn't been committed. This happens due to the fact that during alter operation we create new space, swap all unchanged parts of old space and then delete old space. During removal of old space we also clean-up all stories related to it. In turn story destruction may make dirty tuple clean in case it remains in the index. In the previous implementation there was no removal of uncommitted tuples from corresponding indexes. So let's rollback all changes happened to the space right in time of alter. It is legal since DDL operation anyway aborts ALL other transactions. Closes #6318 Closes #6263
-
Vladimir Davydov authored
Since all decoding functions except xrow_decode_header() decode a packet body, let's pass an xrow_header object to xrow_on_decode_error() instead of raw pointers to msgpack data. This will simplify packet body decoding functions a bit while in xrow_decode_header() we can use dump_row_hex() directly without hurting readability. While we are at it, make dump_row_hex() static, because it's not used outside its compilation unit.
-
Vladimir Davydov authored
xrow_header_has_key() isn't used anywhere. The purpose of iproto_dml_body_has_key() is unclear - we use it to skip unknown DML keys, but we would skip them anyway in the switch-case down the code path, like we do while decoding other requests. The only useful thing it does is implicitly checks that the key has type MP_UINT, but we can do that explicitly instead.
-
Vladimir Davydov authored
xrow_header_decode() checks that the packet body is a valid msgpack and there's no outstanding data beyond the packet end so we don't need to redo this checks while decoding the body (e.g. in xrow_decode_dml()).
-
- Oct 05, 2021
-
-
Mergen Imeev authored
Prior to this patch, an assertion was thrown if a tuple with an invalid id was inserted into the _priv system space. This bug appeared only in the debug build. Closes #6295
-
EvgenyMekhanik authored
Fixed error in implementation of `ev_io_closing`: this function is called to do same work as `fd_kill` and should call it after checking fd (in `coio_close` we pass invalid event value, that leads to assertion in new libev version).
-
- Oct 02, 2021
-
-
mechanik20051988 authored
Implement ability to pass timeout to 'fiber:join' function. If timeout expired, join fails with 'timed out' error. Closes #6203 @TarantoolBot document Title: ability to set timeout for 'fiber:join' function was implemented Implement ability to pass timeout to 'fiber:join' function. If timeout expired, join fails with 'timed out' error.
-
- Sep 30, 2021
-
-
mechanik20051988 authored
Add new metrics `REQUESTS_IN_PROGRESS` and `REQUESTS_IN_STREAM_QUEUE` to `box.stat.net`, which contain detailed statistics for iproto requests. These metrics contains same counters as other metrics in `box.stat.net`: current, rps and total. Part of #6293 @TarantoolBot document Title: detailed iproto requests statistics was implemented Add new metrics `REQUESTS_IN_PROGRESS` and `REQUESTS_IN_STREAM_QUEUE` to `box.stat.net`, which contain detailed statistics for iproto requests. These metrics contains same counters as other metrics in `box.stat.net`: current, rps and total. ``` -- statistics for requests currently being processed in tx thread. REQUESTS_IN_PROGRESS: current: -- count of requests currently being processed in the tx thread rps: -- count of requests processed by the tx thread per second total: -- total count of requests processed by tx thread -- statistics for requests placed in queues of streams. REQUESTS_IN_STREAM_QUEUE: current: -- count of requests currently waiting in queues of streams rps: -- count of requests placed in streams queues per second total: -- total count of requests, which was placed in queues of streams for all time ```
-
EvgenyMekhanik authored
In next patch new rmean for iproto thread statistic, that collected in tx thread will be implemented. We need rename IPROTO_LAST constant to make next patch more clear.
-
mechanik20051988 authored
-
mechanik20051988 authored
There was several different function to get iproto statistic, one function for one metric. Since we wan't to add some new metrics it will be better to implement one function for getting all iproto statistic not add several new functions.
-
mechanik20051988 authored
Currently first element in queue of pending requests in stream is a request which was pushed to tx thread for processing. In this patch special pointer to this request (stream->current) was implemented and queue of pending requests now really contains only pending requests.
-
- Sep 28, 2021
-
-
Vladimir Davydov authored
It never returns NULL anymore, because it uses xmalloc for memory allocations.
-
Vladimir Davydov authored
It never returns NULL anymore, because it uses xmalloc for memory allocations.
-
Vladimir Davydov authored
An mhash is used for allocating system objects. Failing to grow it is likely to render the Tarantool instance unusuable so better fail early. Checks of mh(new) and mh(put) return value will be removed in follow-up patches.
-
Vladimir Davydov authored
We want to use the xmalloc helper throughout the code, not only in the core lib. Move its definition to trivia/util.h and use fprintf+exit instead of say/panic in order not to create circular dependencies.
-
- Sep 27, 2021
-
-
Vladimir Davydov authored
No need to pass them around when we can embed them in netbox_transport. This is a step towards rewriting the netbox state machine in C. Part of #6291
-
Vladimir Davydov authored
There's no need to optimize out fiber.wakeup: - we already have C function calls on the code path; - fiber.wakeup is pretty cheap to be called unconditionally. This is a preparation for moving send/recv buffers to C.
-
Vladimir Davydov authored
Let's recycle buffers in the same place where we reset the transport: when switching the state to 'closed', 'error', or 'error_reconnect'. This is a preparation for moving send/recv buffers to C.
-
Vladimir Davydov authored
In future we will store watchers in this struct. Besides, we can already move send/recv buffers there. So 'registry' is not an appropriate name. Let's rename it to 'transport' - the name which is already used in net.box for a net.box connection implementation object.
-
Vladimir Davydov authored
It stores a socket, not a net.box connection. Let's rename it to sock to avoid confusion.
-
Leonid Vasiliev authored
Exporting symbols of a third party library is not a best practice, as we know from [1]. Let's wrap the msgpack symbols that need to be exported with the "tnt_" prefix. While working on the patch, it was decided to export the msgpack symbols that are used in "msgpuckffi.lua". In test shared libraries where the symbols "mp_***_{decimal,uuid}" are used, they are replaced to exported "tnt_mp_***_{decimal,uuid}", because in the case of linking with "libcore.a" the "libcore.a" needs to be rebuild with the "-fPIC" flag, that seems as overkill for tests. 1. https://github.com/tarantool/memcached/issues/59 Closes #5932
-
- Sep 23, 2021
-
-
Andrey Saranchin authored
If we insert a tuple in space with an index that is being built in background, new tuple will or will not be inserted into new index depending on the result of lexicographical comparison with tuple which was inserted into new index last. The problem is hash index is unordered, so background build will not work properly if primary key is HASH index. To avoid this, disable building index in background if primary index is hash. Closes #5977
-
- Sep 22, 2021
-
-
Vladimir Davydov authored
For deferred DELETE statements to be recovered after restart, we write them to a special 'blackhole' system space, _vinyl_deferred_delete, which doesn't store any data, but is logged in the WAL, as a normal space. In the on_replace trigger installed for this space, we insert deferred DELETE statements into the memory (L0) level of the LSM tree corresponding to the space for which the statement was generated. We also wait for L0 quota in the trigger. The problem is a space can be dropped while we are waiting for quota, in which case the trigger function will crash once it resumes execution. To fix this, let's wait for quota before we write the information about the deferred DELETE statement to the _vinyl_deferred_delete space and check if the LSM tree was dropped after yield. This way, everything will work as expected even if a new space is created with the same id, because we don't yield after checking quota. Closes #6448
-
Vladimir Davydov authored
Will come in handy for testing #6448. @TarantoolBot document Title: Document box.stat.vinyl().regulator.blocked_writers The new stat counter shows the number of fibers that are blocked waiting for Vinyl level0 memory quota.
-
- Sep 17, 2021
-
-
Vladimir Davydov authored
The struct is empty.
-