- Apr 25, 2019
-
-
Vladislav Shpilevoy authored
Swim test packet filters are supposed to filter out packets matching certain criteria or with a probability. They were implemented as a filter-function and userdata passed into the former on each invocation. Usually it was allocated on heap and needed deletion. But it appeared that much simpler is to store the filters inside struct swim_node, pass it as userdata, and get rid of userdata destructors and dynamic allocations. The patch is motivated by necessity to add one new filter, which anyway will need struct swim_node as userdata.
-
Vladislav Shpilevoy authored
There are two different structures - public struct swim_member exposed by SWIM API, and struct swim_node defined and used inside tests. Before this patch swim_cluster_node() was returning struct swim_member, just historically. But more and more places appear where it is wanted to safely take struct swim_node, not swim_member, with an appropriate assertion on an invalid index. This patch renames swim_cluster_node() to swim_cluster_member(), and introduces new swim_cluster_node() returning swim_node.
-
Alexander Turenko authored
Fixes #4174.
-
Kirill Shcherbatov authored
Tarantool SQL used to return 'number' type in request metadata for arithmetic operations even when only 'integer's were used. This also fixes query planner optimisation bug: SELECT a FROM t1 WHERE a+0 IN (SELECT a FROM t1); used to open a new ephemeral table with OpenTEphemeral when it is not required (introduced by 2b22b913). Closes #4103
-
Kirill Shcherbatov authored
When access is performed using VIEW, access rights should be checked against table[s] which it is referencing, not against VIEW itself. Added a test case to verify this behaviour. Closes #4104
-
Kirill Shcherbatov authored
The tap:is_deeply call used to return inconsistent result processing an empty tuple and tuple that has no values: is_deeply({a = box.NULL}, {}) == true is_deeply({}, {a = box.NULL}) == false Fixed to return true by default in such case. You may also set tap.strict = true to change this behaviour. @TarantoolBot document Title: tap test new flag 'strict' In some scenarios it is convenient to distinguish box.NULL and nil in tap:is(), tap:isnt(), tap:is_deeply() tests. For example, {result='Success'} and {result='Success', error=None} are different HTTP responses. You may set t.strict = true to behave such way. Example: t = require('tap').test('123') t.strict = true t:is_deeply({a = box.NULL}, {}) -- false Closes #4125
-
Nikita Pettik authored
VDBE object is used in struct sql_txn to add new autoincrement ids in sequence_next(). List of these ids is returned later as a query execution result. sql_txn is created once SQL statement is executed inside transaction and exists till commit or rollback. After its creation it contains pointer to current VDBE. Each VDBE is freed after statement is executed. Hence, after first SQL statement within transaction is executed, sql_txn will point to freed memory (dangling pointer). This leads to crash in the next processed statement. Fix to this bug is simple: we must re-assign pointer to VDBE in sql_txn before VDBE execution. Closes #4157
-
Nikita Pettik authored
<search condition> is a predicate used as a part of WHERE and JOIN clauses. ANSI SQL states that <search condition> must accept only boolean arguments. In our SQL it is implemented as bytecode instruction OP_If which in turn carries out logic of conditional jump. Hence this patch makes this opcode accept only boolean values. Closes #3723
-
Nikita Pettik authored
According to ANSI, LIKE predicate should return boolean result. This patch changes type of return value of LIKE predicate. Part of #3723
-
Nikita Pettik authored
This patch make following predicates accept and return only values of type boolean: IN, EXISTS, OR, AND, NOT, BETWEEN, IS (NULL). In terms of approach, it is enough to patch opcodes implementing these predicates. Part of #3723
-
Nikita Pettik authored
According to ANSI SQL result of comparison predicates must be BOOLEAN. Before introduction of BOOLEAN type they returned 0 and 1. Now we can change those values to false and true respectively. Part of #3723
-
Nikita Pettik authored
In most cases we don't assign and store type of node of expression AST (except for constant literals). To determine type of node we use sql_expr_type() function, which implements logic of quite simple recursive tree traversal. Before this patch we set type of node after code generation in sqlExprCodeTarget() without any traversal. This approach is way worse even then sql_expr_type(). So, to improve accuracy of type determination, let's always call that method and remove type assignment in sqlExprCodeTarget(). Closes #4126
-
Nikita Pettik authored
This patch introduces basic facilities to operate on boolean type: boolean literals "true" and "false" where true > false; alias to null - unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to insert and select boolean values from table; OR and AND predicates accept boolean arguments; CAST operation involving boolean type; comparison between boolean values (including VDBE sorter routines). Part of #3648
-
Nikita Pettik authored
It is not used (since we dispatch call of sql_bind_*type*() in sql_bind_column()), so can be removed.
-
Nikita Pettik authored
This patch provides straightforward refactoring replacing enum sql_type with enum mp_type. Note that we use msgpack format instead of field_type since it is more suitable when dealing with NULLs.
-
Nikita Pettik authored
It is obvious that we can't add string with number except the case when string is a number literal in quotes (aka '123' or '0.5'). Before this patch values which can't be converted to numbers were just skipped. Now error is raised. This patch also removes sql_value_numeric_type() function since it is not used anymore: instead we invoke mem_apply_numeric_type().
-
Nikita Pettik authored
Fix codestyle according to Tarantool guideline; remove unused argument from signature; make function non-static - we are going to use it in aggregate function sum() (src/box/sql/func.c) to attempt at converting string values to numbers.
-
- Apr 24, 2019
-
-
Alexander Turenko authored
Redirects can work improperly with libcurl-7.30 and older. CentOS 7 provides libcurl-7.29, so app-tap/http_client.test.lua fails on the corresponding test case in CI. We need to disable the test case until #4180 will be resolved. While we are here fixed httpd.py to write a response at once, not char-by-char (the typo from daf1ced8). See gevent/pywsgy.py::process_result(). Related to #4119 and #4180.
-
- Apr 23, 2019
-
-
Шипицын Анатолий authored
While we are here also added forgotten option descriptions to httpc.lua. @TarantoolBot document Title: httpc: new 'follow_location' option When the option is set to `true` (which is default) and a response has 3xx code the http client will automatically issue another request to a location that a server sends in 'Location' header. If the new response is 3xx again, the http.client will issue a next request and so on in a loop until a non-3xx response will be received. This last response will be returned as a result. Setting this option to `false` allows to disable this behaviour. In this case the http client will return a 3xx response itself. See https://curl.haxx.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html
-
Kirill Shcherbatov authored
Previously Tarantool used to raise the confusing error message in case of invalid usage of the httpc module. Fixed to follow the current module API. Closes #4136
-
Kirill Shcherbatov authored
The tuple:update() used to work incorrectly in case of empty tuple produced with box.tuple.new{} because update_create_rope unconditionally initialized a new rope with [tuple_data, mp_next(tuple_data)] field that might not exists. Closes #4041
-
Vladislav Shpilevoy authored
There was a variable used as a counter from 0 to uint32_t space_def->field_count. Obviously it can't be < 0, but there was a check for that. Drop it. The check was revealed during SQL BOOLEAN review, where one of patches gets rid of some explicit Expr.type assignments.
-
Roman Khabibov authored
According to the ANSI standard, ltrim, rtrim and trim should be merged into one unified TRIM() function. The specialization of trimming (left, right or both and trimming characters) determined in arguments of this function. Closes #3879 @TarantoolBot document Title: TRIM() function Modify signature of SQL function TRIM(). This function removes characters included in <trim character> (binary) string from <trim source> (binary) string until encounter a character that doesn't belong to <trim character>. Removal occurs on the side, specified by <trim specification>. Now, syntax is following: TRIM([ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>). <trim specification> can be one of the following keywords: LEADING, TRAILING and BOTH. <trim character> is the set of trimming characters. <trim source> is the string, that will be trimmed. If FROM is specified, then: 1) Either <trim specification> or <trim character> or both shall be specified. 2) If <trim specification> is not specified, then BOTH is implicit. 3) If <trim character> is not specified, then ' ' is implicit.
-
Mergen Imeev authored
This patch removes part of unused functions and macros from main.c. This will facilitate the work of removing SQL error/status codes. Needed for #4074
-
- Apr 19, 2019
-
-
Kirill Yukhin authored
The patch sets format for spaces with sysview engine. This is done due to following reasons: 1. Since an SQL view looks into underneath space's format, set it for spaces with sysview engine. Before the patch, spaces with sysview enginge didn't have its own tuples and hence didn't need to have a format. 2. To use sysview engine to deal with SQL views. This will allow to use sysview machinery to query SQL views from Lua land. Closes #4111
-
- Apr 18, 2019
-
-
Vladislav Shpilevoy authored
Update_addr and update_payload need to increment member's incarnation when it is self. For that they used a special parameter incarnation_inc set in 1 for self and in 0 for others. It was used to encapsulate incarnation update + event scheduling on member attribute updates, but on the other hand it broke another encapsulation level - there should not be exceptions for 'self' in these functions. This patch makes incarnation increment explicit in the places where 'self' is updated.
-
Vladislav Shpilevoy authored
Payload is arbitrary user data disseminated over the cluster along with other member attributes. Part of #3234
-
Vladislav Shpilevoy authored
TTL is time-to-live and it slightly confuses when is said about a member's attribute. Status_ttl looks like after this value gets 0 the status is deleted or is no longer valid. TTD is more precise definition for these counters and is expanded as time-to-disseminate.
-
Vladislav Shpilevoy authored
Before the patch there were 2 cases when an unchanged packet was rebuilt partially on each send: - cached round message's meta section was rebuilt on each EV_WRITE event in swim_scheduler_on_output() function; - broadcast message's meta section was rebuilt too even though its content does not depend on a broadcast interface. The third case appears with indirect pings patch which aggravates meta building business by routing and packet forwarding. When a packet needs to be forwarded farther, its meta is built in a special manner preserving the route before EV_WRITE appears, and on_output should not touch that meta. This patch adds a check preventing unnecessary meta rebuilds. Besides, the check and the meta building code are moved into a dedicated function out of swim_scheduler_on_output() - it allows to completely split logic of packing a message and sending it. Separated logic helps a lot when indirect pings are introduced. Part of #3234
-
Vladislav Shpilevoy authored
SWIM works in rounds, each split in steps. On step SWIM sends a round message. The message is not changed between steps of one round usually, and is cached so as not to rebuild it without necessity. But when something changes in one member's attributes, or in the member table, the message is invalidated to be rebuilt on a next step. Invalidation resets the cached packet. But it leads to a bug, when a round message is already scheduled to be sent, however is not actually sent and invalidated in fly. Such a message on a next EV_WRITE event will be sent as an empty packet, which obviously makes no sense. On the other hand it would be harmful to cancel the invalidated packet if it is in fly, because during frequent changes the instance will not send anything. There are no a test case, because empty packets does not break anything, but still they are useless. And, as it is said above, such invalidation would prevent sending any round messages when there are lots of updates. Follow up for cf0ddeb8 (swim: keep encoded round message cached)
-
Vladislav Shpilevoy authored
At this moment there are two binary structures in the SWIM protocol carrying an address: swim_member_passport and swim_meta_header_bin - one address in each. This code duplication was not formidable enough to stimulate creation of a separate address structure. But forthcoming indirect messages protocol extensions will add 2 new cases of encoding a binary address. It triggered this patch to reduce code duplication. Part of #3234
-
Vladislav Shpilevoy authored
There are several places where it is necessary to check if a sockaddr_in is nullified, and to compare a couple of addresses. Some of them are in swim_proto.c, and more are coming in indirect SWIM messages patch. The patch moves the checkers into swim_proto.h so as to be usable from anywhere in SWIM. Also minor renames are made alongside. 'sockaddr_in' is too long to use in each related function's name, and is replaced with 'inaddr' by analogue with the standard library. Part of #3234
-
Vladimir Davydov authored
If a tarantool instance exits while checkpointing is in progress, the memtx checkpoint thread, which writes the snap file, can access already freed data resulting in a crash. Let's fix this the same way we did for relay and vinyl threads - simply cancel the thread forcefully and wait for it to terminate. Closes #4170
-
Vladimir Davydov authored
- Add REQUESTS.current to report the number of requests currently in flight, because it's useful for understanding whether we need to increase box.cfg.net_msg_max. - Add REQUESTS.{rps,total}, because knowing the number of requests processed per second can come in handy for performance analysis. - Add CONNECTIONS.{rps,total} that show the number of connections opened per second and total. Those are not really necessary, but without them the output looks kinda lopsided. Closes #4150 @TarantoolBot document Title: Document new box.stat.net fields Here's the list of the new fields: - `CONNECTIONS.rps` - number of connections opened per second recently (for the last 5 seconds). - `CONNECTIONS.total` - total number of connections opened so far. - `REQUESTS.current` - number of requests in flight (this is what's limited by `box.cfg.net_msg_max`). - `REQUESTS.rps` - number of requests processed per second recently (for the last 5 seconds). - `REQUESTS.total` - total number of requests processed so far. `CONNECTIONS.rps`, `CONNECTIONS.total`, `REQUESTS.rps`, `REQUESTS.total` are reset by `box.stat.reset()`. Example of the new output: ``` --- - SENT: total: 5344924 rps: 840212 CONNECTIONS: current: 60 rps: 148 total: 949 REQUESTS: current: 17 rps: 1936 total: 12139 RECEIVED: total: 240882 rps: 38428 ... ```
-
- Apr 17, 2019
-
-
Konstantin Osipov authored
There can be a lot of small files with vinyl.
-
Konstantin Osipov authored
increment min range size to 128MB to reduce the amount of open files per process in a typical install.
-
d.sharonov authored
Fixes #4165
-
- Apr 16, 2019
-
-
Vladimir Davydov authored
In contrast to vinyl_iterator, vinyl_index_get doesn't take a reference to the LSM tree while reading from it. As a result, if the LSM tree is dropped in the meantime, vinyl_index_get will crash. Fix this issue by surrounding vy_get with vy_lsm_ref/unref. Closes #4109
-
Vladimir Davydov authored
To propagate changes applied to a space while a new index is being built, we install an on_replace trigger. In case the on_replace trigger callback fails, we abort the DDL operation. The problem is the trigger may yield, e.g. to check the unique constraint of the new index. This opens a time window for the DDL operation to complete and clear the trigger. If this happens, the trigger will try to access the outdated build context and crash: | #0 0x558f29cdfbc7 in print_backtrace+9 | #1 0x558f29bd37db in _ZL12sig_fatal_cbiP9siginfo_tPv+1e7 | #2 0x7fe24e4ab0e0 in __restore_rt+0 | #3 0x558f29bfe036 in error_unref+1a | #4 0x558f29bfe0d1 in diag_clear+27 | #5 0x558f29bfe133 in diag_move+1c | #6 0x558f29c0a4e2 in vy_build_on_replace+236 | #7 0x558f29cf3554 in trigger_run+7a | #8 0x558f29c7b494 in txn_commit_stmt+125 | #9 0x558f29c7e22c in box_process_rw+ec | #10 0x558f29c81743 in box_process1+8b | #11 0x558f29c81d5c in box_upsert+c4 | #12 0x558f29caf110 in lbox_upsert+131 | #13 0x558f29cfed97 in lj_BC_FUNCC+34 | #14 0x558f29d104a4 in lua_pcall+34 | #15 0x558f29cc7b09 in luaT_call+29 | #16 0x558f29cc1de5 in lua_fiber_run_f+74 | #17 0x558f29bd30d8 in _ZL16fiber_cxx_invokePFiP13__va_list_tagES0_+1e | #18 0x558f29cdca33 in fiber_loop+41 | #19 0x558f29e4e8cd in coro_init+4c To fix this issue, let's recall that when a DDL operation completes, all pending transactions that affect the altered space are aborted by the space_invalidate callback. So to avoid the crash, we just need to bail out early from the on_replace trigger callback if we detect that the current transaction has been aborted. Closes #4152
-
Cyrill Gorcunov authored
We use sizeof as a function in most of the overall code, fix this nit.
-