- Oct 09, 2019
-
-
Serge Petrenko authored
A successfully fetched remote instance ballot isn't updated during bootstrap procedure. This leads to a case when different instances choose different masters as their bootstrap leaders. Imagine such a situation. You start instance A without replication set up. Instance A successfully bootstraps. You also have instances B and C both with replication set up to {A, B, C} and replication_connect_quorum set to 3 You first start instance B. It doesn't proceed to choosing a leader until one of the events happens: either the replication_connect_timeout runs out, or instance C is up and starts listening on its port. B has established connection to A and fetched its ballot, with some vclock, say, {1: 1}. B retries connection to C every replication_timeout seconds. Then you start instance C. Instance C succeeds in connecting to A and B right away and bootstraps from instance A. Instance A registers C in its _cluster table. This registration is replicated to instance C. Meanwhile, instance C is trying to sync with quorum instances (which is 3), and stays in orphan mode. Now replication_timeout on instance B finally runs out. It retries a previously unsuccessful connection to C and succeeds. C sends its ballot to B with vclock = {1: 2, 2:0} (in our example), since it has already incremented it after _cluster registration. B sees that C has a greater vclock than A, and chooses to bootstrap from C instead of A. C is orphan and rejects B's attempt to join. B dies. To fix such ungentlemanlike behaviour of C, we should at least include loading status in ballot and prefer fully bootstrapped instances to the ones still syncing with other replicas. We also need to use a separate flag instead of ballot's already existent is_ro, since we still want to prefer loading instances over the ones explicitly configured to be read-only. Closes #4527 (cherry picked from commit dc1e4009)
-
Kirill Yukhin authored
(cherry picked from commit 8749b3e1)
-
Cyrill Gorcunov authored
During rework of the console lua mode series the declaration of variable has been lost and this cause test case for remote unix console connection to fail. Fixes issue from c358398c Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit df821d0f)
-
- Oct 04, 2019
-
-
Cyrill Gorcunov authored
To be consistent in naming scheme, for example we already have parse_operators. Part-of #3834 Reviewed-by:
Konstantin Osipov <kostja.osipov@gmail.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit af9ef211)
-
Cyrill Gorcunov authored
The other modules would be able to find out which eos marker is currently active. For example when reading replies from remote server via text based console protocol. @TarantoolBot document Title: > require('console').eos() Returns a string with currently active end of string marker. Part-of #3834 Reviewed-by:
Konstantin Osipov <kostja.osipov@gmail.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit 9d83b5f6)
-
Cyrill Gorcunov authored
If we change output mode on remote machine via text-based session node a (server) ------ require('console').listen('unix/:/tmp/X.sock') ... node b (client) ------ require('console').connect('unix/:/tmp/X.sock') connected to unix/:/tmp/X.sock ... unix/:/tmp/X.sock> \set output lua the client get stuck forever, it is because the text wire protocol waits for yaml eos terminator which of course never hit the peer, because lua mode uses own one. Thus to fix this problem we have to preprocess the text we're passing to the server, just like we do in local console. So we reuse command parsing code and remember current output terminator in text_connection_mt instance. Another problem is that named default output mode. There could be a mixed environment where server operates in default lua mode but client connects with yaml mode. To break a tie we yield "\set output" command with current output mode when establishing a connection. Since the output format is per-session bound this doesn't affect any other connections on a server. Part-of #3834 Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit c358398c)
-
Cyrill Gorcunov authored
We will need to parse and verify "\set" commands in remote console text-wire protocol thus to not duplicate the code lets factor helper out for reuse sake. Part-of #3834 Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit 96dbc49d)
-
Cyrill Gorcunov authored
This will help us to distinguish end of string/stream in text protocols (such as remote console connection). Note that we start printing ";" terminator for every lua output. Actually current yaml output does the same but inside console.c module. And since lua output is yet a new feature in stabilization phase we're safe to make such changes without breaking api. Part-of #3834 Reviewed-by:
Konstantin Osipov <kostja.osipov@gmail.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit d67808fa)
-
Cyrill Gorcunov authored
This allows lua to not create them every call since they are constant speeding up processing a bit. Part-of #3834 Reviewed-by:
Konstantin Osipov <kostja.osipov@gmail.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit 840a7646)
-
Cyrill Gorcunov authored
Sole symbols (such as box.NULL) are not processed by serpent "custom" symbols feature, since they are not in table. Thus we should process them separately. Without it we have > require('console').set_default_output("lua,block") > ; > box.NULL > "cdata<void %*>: NULL"; instead of > box.NULL > box.NULL; as it should be. Part-of #3834 Reviewed-by:
Konstantin Osipov <kostja.osipov@gmail.com> Signed-off-by:
Cyrill Gorcunov <gorcunov@gmail.com> (cherry picked from commit 6847367f)
-
Cyrill Gorcunov authored
fiber_stack_destroy() doesn't depend on cord() helper but rather accepts slab cache pointer in arguments, lets make the same in fiber_stack_create() helper, otherwise it looks quite imbalanced. Signed-off-by:
Kirill Yukhin <kyukhin@tarantool.org> (cherry picked from commit fa6d78b397d375d4c18875ac72b3798b2e06a1e8)
-
Cyrill Gorcunov authored
The mprotect() syscall may fail due to heavy memory pressure (say there is no enough resources to split VMAs and etc). In this case we must not proceed without guard page but refuse to create a new fiber. Closes #4541 Signed-off-by:
Kirill Yukhin <kyukhin@tarantool.org> (cherry picked from commit e58dfe07189134297ea956eb70cd7d96e20a6c6e)
-
Cyrill Gorcunov authored
This will allow us to call it from inside fiber_stack_create as we need to clean up resources on error. Part-of #4541 Signed-off-by:
Kirill Yukhin <kyukhin@tarantool.org> (cherry picked from commit 8f1251d3611aa30d5bb6098716e965fd8dc08551)
-
- Oct 01, 2019
-
-
Roman Khabibov authored
(cherry picked from commit 0b9de586)
-
Roman Khabibov authored
Count lines in the json parsing structure. It is needed to print the number of line and column where a mistake was made. Closes #3316 (cherry picked from commit 9f9bd3eb2d064129ff6b1a764140ebef242d7ff7) (cherry picked from commit 53d43160)
-
Vladislav Shpilevoy authored
Code to run main script (passed via command line args, or interactive console) has a footer where it notifies systemd, logs a happened error, and panics. Before the patch that code was unreachable in case of any exception in a main script, because panic happened earlier. Now a happened exception is correctly carried to the footer with proper error processing. A first and obvious solution was replace all panics with diag_set and use fiber_join on the script runner fiber. But appeared, that the fiber running a main script can't be joined. This is because normally it exits via os.exit() which never returns and therefore its caller never dies = can't be joined. The patch solves this problem by passing main fiber diag to the script runner by pointer, eliminating fiber_join necessity. Closes #4382 (cherry picked from commit 157a2d88)
-
- Sep 25, 2019
-
-
Vladislav Shpilevoy authored
Closes #4434 Follow-up #4366 @TarantoolBot document Title: json/msgpack.cfg.encode_deep_as_nil option Tarantool has several so called serializers to convert data between Lua and another format: YAML, JSON, msgpack. YAML is a crazy serializer without depth restrictions. But for JSON, msgpack, and msgpackffi a user could set encode_max_depth option. That option led to crop of a table when it had too many nested levels. Sometimes such behaviour is undesirable. Now an error is raised instead of data corruption: t = nil for i = 1, 100 do t = {t} end msgpack.encode(t) -- Here an exception is thrown. To disable it and return the old behaviour back here is a new option: <serializer>.cfg({encode_deep_as_nil = true}) Option encode_deep_as_nil works for JSON, msgpack, and msgpackffi modules, and is false by default. It means, that now if some existing users have cropping, even intentional, they will get the exception. (cherry picked from commit d7a8942a)
-
Vladislav Shpilevoy authored
Tuple is a C library exposed to Lua. In Lua to translate Lua objects into tuples and back luaL_serializer structure is used. In Tarantool we have several global serializers, one of which is for msgpack. Tuples store data in msgpack, and in theory should have used that global msgpack serializer. But in fact the tuple module had its own private serializer because of tuples encoding specifics such as never encode sparse arrays as maps. This patch makes tuple Lua module use global msgpack serializer always. But how does tuple handle sparse arrays now? In fact, the tuple module still has its own serializer, but it is updated each time when the msgpack serializer is changed. Part of #4434 (cherry picked from commit 676369b1)
-
Vladislav Shpilevoy authored
Msgpack Lua module is not a simple set of functions. It is a global serializer object used by plenty of other Lua and C modules. Msgpack as a serializer can be configured, and in theory its configuration updates should affect all other modules. For example, a user could change encode_max_depth: require('msgpack').cfg({encode_max_depth = <new_value>}) And that would make tuple:update() accept tables with <new_value> depth without a crop. But in fact msgpack configuration didn't affect some places, such as this one. And all the others who use msgpackffi. This patch fixes it, for encode_max_depth option. Other options are still ignored. Part of #4434 (cherry picked from commit 4bb253f7)
-
Vladislav Shpilevoy authored
There are some objects called serializers - msgpack, cjson, yaml, maybe more. They are global objects affecting both Lua and C modules. A serializer have settings which can be updated. But before the patch an update changed only C structure of the serializer. It made impossible to use settings of the serializers from Lua. Now any update of any serializer is reflected both in its C and Lua structures. Part of #4434 (cherry picked from commit fe4a8047)
-
- Sep 20, 2019
-
-
Alexander Turenko authored
The submodule was on 7.65.3 version. This update closes two security problems: https://curl.haxx.se/docs/CVE-2019-5482.html https://curl.haxx.se/docs/CVE-2019-5481.html See also curl-7.66.0 release notes: https://curl.haxx.se/changes.html#7_66_0 Fixes #4502. (cherry picked from commit 4c2d1eff)
-
- Sep 19, 2019
-
-
Alexander V. Tikhonov authored
Found that the curl failed to build on FreeBSD with errors: gmake[2]: Entering directory '/home/vagrant/tarantool/third_party/curl/src' CCLD curl /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `SSLv23_client_method' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `CONF_modules_free' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `ERR_free_strings' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `sk_value' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `ENGINE_cleanup' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `SSL_library_init' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `EVP_MD_CTX_destroy' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `sk_pop_free' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `SSLeay' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `SSL_get_ex_new_index' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `OPENSSL_add_all_algorithms_noconf' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `SSL_COMP_free_compression_methods' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `EVP_MD_CTX_create' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `EVP_cleanup' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `sk_num' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `sk_pop' /usr/local/bin/ld: ../lib/.libs/libcurl.so: undefined reference to `SSL_load_error_strings' collect2: error: ld returned 1 exit status gmake[2]: *** [Makefile:921: curl] Error 1 Found root cause of the issue at the `./configure <...>` output: | checking for OpenSSL headers version... 1.0.2 - 0x1000214fL | checking for OpenSSL library version... 1.1.1 | configure: WARNING: OpenSSL headers and library versions do not match. It is seen that the Tarantool bootstrap installed pkg 'openssl' of the version '1.0.2', while the currently default FreeBSD 'openssl' version was '1.1.1'. Anyway we don't need any special openssl version installed against default one, so the fix is just to remove the openssl package from bootstrap installation. Also found that some installing packages are not needed too, removed it from FreeBSD bootstrap. Additionally added libiconv library into bootstrap which is needed as workaround to avoid of the issue described in: https://github.com/tarantool/tarantool/issues/3791 Closed #4490 (cherry picked from commit 1f2338bd)
-
- Sep 17, 2019
-
-
Mergen Imeev authored
Since ARRAY and MAP cannot be converted to SCALAR type, this operation should throw an error. But when the error is raised in SQL, it is displayed in unreadable form. The reason for this is that the given array or map is not correctly converted to a string. This patch fixes the problem by converting ARRAY or MAP to their string representation. For example: box.execute('CREATE TABLE t1(i INT PRIMARY KEY, a SCALAR);') format = {} format[1] = {type = 'integer', name = 'I'} format[2] = {type = 'array', name = 'A'} s = box.schema.space.create('T2', {format=format}) i = s:create_index('ii') s:insert({1, {1,2,3}}) box.execute('INSERT INTO t1 SELECT * FROM t2;') Should return: - error: 'Type mismatch: can not convert [1, 2, 3] to scalar' Follow-up #4189 (cherry picked from commit 736cdd81)
-
Mergen Imeev authored
Function mem_apply_type() implements implicit type conversion. As a rule, tuple to be inserted to the space is exposed to this conversion which is invoked during execution of OP_MakeRecord opcode (which in turn forms tuple). This function was not adjusted to operate on ARRAY, MAP and ANY field types since they are poorly supported in current SQL implementation. Hence, when tuple to be inserted in space having mentioned field types reaches this function, it results in error. Note that we can't set ARRAY or MAP types in SQL, but such situation may appear during UPDATE operation on space created via Lua interface. This problem is solved by extending implicit type conversions with obvious casts: array field can be casted to array, map to map and any to any. Closes #4189 (cherry picked from commit de79b714)
-
- Sep 16, 2019
-
-
Oleg Babin authored
If the rock was packed with luarocks then the time in it is set to zeros and this is not the case with the unix format can be removed when date given is added to zipwriter_open_new_file_in_zip (luarocks/luarocks#1056) Closes #4481 (cherry picked from commit 3658cb00)
-
Nikita Pettik authored
It was forgotten to swap old and new mask (holding fields involved into foreign key relation) during space alteration (lists of object representing FK metadata are swapped successfully). Since mask is vital and depending on its value different byte-codes implementing SQL query can be produced, this mistake resulted in assertion fault in debug build and wrong constraint check in release build. Let's fix this bug and swap masks as well as foreign key lists. Closes #4495 (cherry picked from commit 33236ecc)
-
- Sep 13, 2019
-
-
Alexander Turenko authored
This commit does not change a user visible behaviour. It refactors pwd module to explicitly divide code that fetches data from passwd / group databases from code that performs deserialization of the data to Lua tables. The idea of splitting of those actions appears when it was observed that a call of getpw() / getgr() leads to problems on some systems when it is invoked during passwd / group database traveral. Now it is more obvious that we don't call getpw() during passwd traversal and getgr() during group traveral. Follows up #4428 and #4447. (cherry picked from commit 6c5d3f06)
-
Kirill Shcherbatov authored
LTO build fails on warning message: In file included from /tarantool/src/lib/core/diag.h:33:0, from /tarantool/src/box/engine.h:36, from /tarantool/src/box/memtx_engine.h:40, from /tarantool/src/box/memtx_engine.c:31: /tarantool/src/box/memtx_engine.c: In function 'metmx_tuple_chunk_delete': /tarantool/src/trivia/util.h:201:49: error: initialization from incompatible pointer type [-Werror] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ /tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro 'container_of' container_of((typeof(tuple_chunk->data) *)data, ^ /tarantool/src/trivia/util.h:201:49: error: (near initialization for 'tuple_chunk') [-Werror] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ /tarantool/src/box/memtx_engine.c:1115:3: note: in expansion of macro 'container_of' container_of((typeof(tuple_chunk->data) *)data, Closes #4438 (cherry picked from commit 97012004)
-
- Sep 12, 2019
-
-
Mergen Imeev authored
This patch provides a test suite that allows us to make sure that the SQL BOOLEAN type works as intended. Part of #4228 (cherry picked from commit 7cf84a54)
-
Serge Petrenko authored
In a configuration with several read-only and read-write instances, if replication_connect_quorum is not greater than the amount of read-only instances and replication_connect_timeout happens to be small enough for some read-only instances to form a quorum and exceed the timeout before any of the read-write instaces start, all these read-only instances will choose themselves a read-only bootstrap leader. This 'leader' will successfully bootstrap itself, but will fail to register any of the other instances in _cluster table, since it isn't writeable. As a result, some of the read-only instances will just die unable to bootstrap from a read-only bootstrap leader, and when the read-write instances are finally up, they'll see a single read-only instance which managed to bootstrap itself and now gets a REPLICASET_UUID_MISMATCH error, since no read-write instance will choose it as bootstrap leader, and will rather bootstrap from one of its read-write mates. The described situation is clearly not what user has hoped for, so throw an error, when a read-only instance tries to initiate the bootstrap. The error will give the user a cue that he should increase replication_connect_timeout. Closes #4321 @TarantoolBot document Title: replication: forbid to bootstrap read-only masters. It is no longer possible to bootstrap a read-only instance in an emply data directory as a master. You will see the following error trying to do so: ``` ER_BOOTSTRAP_READONLY: Trying to bootstrap a local read-only instance as master ``` Now if you have a fresh instance, which has `read_only=true` in an initial `box.cfg` call, you need to set up replication from an instance which is either read-write, or has your local instance's uuid in its `_cluster` table. In case you have multiple read-only and read-write instances with replication set up, and you still see the aforementioned error message, this means that none of your read-write instances managed to start listening on their port before read_only instances have exceeded the `replication_connect_timeout`. In this case you should raise `replication_connect_timeout` to a greater value. (cherry picked from commit 037bd58c)
-
- Sep 11, 2019
-
-
Igor Munkin authored
* All test chunks related to luajit were moved from tarantool source tree to the luajit repo * Adjusted CMakeLists via creating a symlink to luajit test directory to fix out-of-source tests Closed #4478 (cherry picked from commit 43575303)
-
Kirill Yukhin authored
-
- Sep 10, 2019
-
-
Vladislav Shpilevoy authored
rows_per_wal does not allow to properly limit size of WAL logs. A user would need to estimate size of each WAL row to do that. Now WAL supports option wal_max_size allowing to limit WAL size much more precise. Part of #3762 (cherry picked from commit c7a382af)
-
- Sep 09, 2019
-
-
Kirill Shcherbatov authored
The json.encode() used to cause a segfault in case of recursive table: tbl = {} tbl[1] = tbl json.encode(tbl) Library doesn't test whether given object on Lua stack parsed earlier, because it performs a lightweight in-depth traverse of Lua stack. However it must stop when encode_max_depth is reached (by design). Tarantool's lua_cjson implementation has a bug introduced during porting original library: it doesn't handle some corner cases: entering into a map correctly increases a current depth, while entering into an array didn't. This patch adopts author's approach to check encode_max_depth limit. Thanks to handling this constraint correctly the segfault no longer occurs. Closes #4366 (cherry picked from commit d2641e66e65ab57317b8e70bb7115517ec81238e)
-
- Sep 02, 2019
-
-
Alexander V. Tikhonov authored
The test sql-tap/gh-3083-ephemeral-unref-tuples.test.lua took too long runtime and failed to finish in timeout limit of 2 minutes when it runs near the end of the running queue: No output during 120 seconds. Will abort after 120 seconds without output. List of workers not reporting the status: - 012_sql-tap [sql-tap/gh-3083-ephemeral-unref-tuples.test.lua, vinyl] at var/012_sql-tap/gh-3083-ephemeral-unref-tuples.result:0 Test hung! Result content mismatch: [File does not exists: sql-tap/gh-3083-ephemeral-unref-tuples.result] [Main process] No output from workers. It seems that we hang. Send SIGKILL to workers; exiting... Due to suggestion from Konstantin Osipov at gh-3845: https://github.com/tarantool/tarantool/issues/3845#issue-385735959 The following tests: gh-3083-ephemeral-unref-tuples.test.lua gh-3332-tuple-format-leak.test.lua where set to run only on memtx configuration. Also the test: gh-3083-ephemeral-unref-tuples.test.lua was removed from the test-run 'fragile' option flaky list. Closed #4128 (cherry picked from commit 40c94af7)
-
- Aug 29, 2019
-
-
Cyrill Gorcunov authored
We know that madvise(MADV_DONTDUMP) is present on linux based platforms only (macos doesn't support it at all, freebsd requires MADV_NOCORE or similar which is unsupported by now) thus we should not print a warning on other systems to not spam users. Fixes #4464 (cherry picked from commit 51d8e4c3)
-
Alexander V. Tikhonov authored
Added "fragile" option to the flaky tests that are not intended to be run in parallel with others. Option set at the suite.ini file at the appropriate suites with comments including the issue that stores the fail. (cherry picked from commit 165f8ee6)
-
Alexander V. Tikhonov authored
Removed the jobs that is interesting to check on gitlab-ci instead of travis-ci: - osx 13 "Sierra" - all LTO jobs - ASAN job Part of #4410 (cherry picked from commit 05477787)
-
Georgy Kirichenko authored
This is a followup for 7691154a (cherry picked from commit ff14626d)
-