- Apr 29, 2019
-
-
Alexander Turenko authored
When libcurl is built with --enable-threaded-resolver (which is default) and the version of the library is 7.60 or above, libcurl calls a timer callback with exponentially increasing timeout_ms value during DNS resolving. This behaviour was introduced in curl-7_59_0-36-g67636222f (see [1], [2]). During first ten milliseconds the library sets a timer to a passed time divided by three (see Curl_resolver_getsock()). It is possible that passed time is zero during at least several thousands of iterations. Before this commit we didn't set a libev timer in curl_multi_timer_cb() when a timeout_ms value is zero, but call curl_multi_process() immediately. Libcurl however can call curl_multi_timer_cb() again and here we're going into a recursion that stops only when timeous_ms becomes positive. Often we generate several thousands of stack frames within this recursion and exceed 512KiB of a fiber stack size. The fix is easy: set a libev timer to call curl_multi_process() even when a timeout_ms value is zero. The reason why we did the call to curl_multi_process() immediately is the unclear wording in the CURLMOPT_TIMERFUNCTION option documentation. This documentation page was fixed in curl-7_64_0-88-g47e540df8 (see [3], [4], [5]). There is also the related change in curl-7_60_0-121-g3ef67c686 (see [6], [7]): after this commit libcurl calls a timer callback with zero timeout_ms during a first three milliseconds of asynchronous DNS resolving. Fixes #4179. [1]: https://github.com/curl/curl/pull/2419 [2]: https://github.com/curl/curl/commit/67636222f42b7db146b963deb577a981b4fcdfa2 [3]: https://github.com/curl/curl/issues/3537 [4]: https://github.com/curl/curl/pull/3601 [5]: https://github.com/curl/curl/commit/47e540df8f32c8f7298ab1bc96b0087b5738c257 [6]: https://github.com/curl/curl/pull/2685 [7]: https://github.com/curl/curl/commit/3ef67c6861c9d6236a4339d3446a444767598a58
-
Alexander Turenko authored
It is important to have testing jobs that build the project with both -Werror and -O2 to keep the code clean. -O2 is needed, because some compiler warnings are available only after extra analyzing passes that are disabled with lesser optimization levels. The first attempt to add -Werror for release testing jobs was made in da505ee7 ('Add -Werror for CI (1.10 part)'), but it mistakely doesn't enable -O2 for RelWithDebInfoWError build. It is possible to fix it in this way: | --- a/cmake/compiler.cmake | +++ b/cmake/compiler.cmake | @@ -113,10 +113,14 @@ set (CMAKE_C_FLAGS_DEBUG | "${CMAKE_C_FLAGS_DEBUG} ${CC_DEBUG_OPT} -O0") | set (CMAKE_C_FLAGS_RELWITHDEBINFO | "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CC_DEBUG_OPT} -O2") | +set (CMAKE_C_FLAGS_RELWITHDEBINFOWERROR | + "${CMAKE_C_FLAGS_RELWITHDEBINFOWERROR} ${CC_DEBUG_OPT} -O2") | set (CMAKE_CXX_FLAGS_DEBUG | "${CMAKE_CXX_FLAGS_DEBUG} ${CC_DEBUG_OPT} -O0") | set (CMAKE_CXX_FLAGS_RELWITHDEBINFO | "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CC_DEBUG_OPT} -O2") | +set (CMAKE_CXX_FLAGS_RELWITHDEBINFOWERROR | + "${CMAKE_CXX_FLAGS_RELWITHDEBINFOWERROR} ${CC_DEBUG_OPT} -O2") | | unset(CC_DEBUG_OPT) However I think that a build type (and so `tarantool --version`) should not show whether -Werror was passed or not. So I have added ENABLE_WERROR CMake option for that. It can be set like so: | cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON Enabled the option in testing Travis-CI jobs with the RelWithDebInfo build type. Deploy jobs don't include it as before. Fixed all -Wmaybe-uninitialized and -Wunused-result warnings. A few notes about the fixes: * net.box does not validate received data in general, so I don't add a check for autoincrement IDs too. Set the ID to INT64_MIN, because this value is less probably will appear here in a normal case and so is the best one to signal a user that something probably going wrongly. * xrow_decode_*() functions could read uninitialized data from row->body[0].iov_base in xrow_on_decode_err() when printing a hex code for a row. It could be possible when the received msgpack was empty (row->bodycnt == 0), but there were expected keys (key_map != 0). * getcwd() is marked with __attribute__((__warn_unused_result__)) in glibc, but the buffer filled by this call is not used anywhere and so just removed. * Vinyl -Wmaybe-uninitialized warnings are false positive ones. Added comments and quotes into .travis.yml to ease reading. Removed "test" word from the CentOS 6 job name, because we don't run tests on this distro (disabled in the RPM spec). Fixes #4178.
-
Cyrill Gorcunov authored
eio library provides a portable version of sendfile syscall which works a way more efficient than explicit copying file by 4K chunks.
-
- Apr 26, 2019
-
-
Vladislav Shpilevoy authored
The same problem that occured with struct swim_member, has happened with struct swim - it contains a huge structure right in the middle, struct swim_task. It consumes 1.5Kb and obviously splits the most accessible struct swim attributes into multiple cache lines. This patch moves struct swim_task to the bottom as well as other members, related to dissemination component.
-
Kirill Shcherbatov authored
The bindings mechanism was not updated in scope of BOOLEAN static type patch. Fixed.
-
- Apr 25, 2019
-
-
Vladislav Shpilevoy authored
Struct swim_member describes attributes of one remote member of a SWIM cluster. It is relatively often accessed. And it has two huge structures - struct swim_packet ping/ack_task. Each is 1500 bytes. When these tasks are in the middle of the structure, they split and spoil cache lines. This patch moves the whole failure detection attribute family to the bottom of the structure, and moves these two tasks to the end of layout.
-
Vladislav Shpilevoy authored
Suspicion component is a way how SWIM protects from false-positive failure detections. When the network is slow, or a SWIM node does not manage to process messages in time because of being overloaded, other nodes will not receive ACKs in time, but it is too soon to declare the member dead. The nodes will mark the member as suspected, and will ping it indirectly, via other members. It 1) gives the suspected member more time to respond on ACKs, 2) protects from the case when it is a network problem on particular channels. Part of #3234
-
Vladislav Shpilevoy authored
Before the patch SWIM packets were being sent quite straightforward from one instance to another with transparent routing on Internet Level of TCP/IP. But the SWIM paper describes last yet not implemented component - suspicion mechanism. So as not to overload this message with suspicion details it is enough to say that it makes possible sending a packet through an intermediate SWIM instance, not directly. This commit extends the SWIM protocol with a new transport-level section named 'routing'. It allows to send indirect SWIM messages transparently via packet forwarding implemented fully inside transportation component, in swim_io.c. Part of #3234
-
Vladislav Shpilevoy authored
Struct swim_task is an asynchronous task generated by the SWIM core and scheduled to be sent when a next EV_WRITE event appears. It has a callback 'complete' called when the task finally sent its packet into the network. In this callback a next SWIM round step can be scheduled, or set a deadline for a ping. Usually it requires to know to which member the packet was sent. For this UUID is required, but swim_task operates by inet addresses only. At this moment UUID necessity can be bypassed via container_of or via some queues, but it is not so once suspicion component is introduced. The patch adds sender's UUID to struct swim_task. Part of #3234
-
Vladislav Shpilevoy authored
SIO provides a function sio_strfaddr() to obtain string representation of an arbitrary struct sockaddr. Call of this function usually looks bulky because it requires explicit cast to const struct sockaddr *, and expects the address size in the second paremeter. SWIM uses only AF_INET addresses and always casts them to const struct sockaddr * + passes sizeof(struct sockaddr_in) to each invocation of sio_strfaddr(). This patch wraps sio_strfaddr() with a function making these preparations. Part of #3234
-
Vladislav Shpilevoy authored
Sometimes it is wanted to format multiple addresses and call sio_strfaddr() multiple times, but it uses one static thread local buffer, and next calls overwrite results of previous ones. On the contrary, tt_static_buf() is not a single buffer per thread - it is 4 buffers. Now sio_strfaddr() uses it and it is possible to call it 4 times without rewriting old results. Also, this update makes .bss section a bit smaller - -1 static buffer of size 1025, and +16 bytes for tt_static buffers. Total: -1009 bytes.
-
Vladislav Shpilevoy authored
It appeared that tt_uuid lib provides the same function: tt_uuid_str().
-
Vladislav Shpilevoy authored
The filter is going to be used to test the SWIM suspicion component. The destination filter will break certain network channels, and the suspicion component shall withstand that. Part of #3234
-
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
-