- Jun 20, 2019
-
-
Georgy Kirichenko authored
Get rid of duplicated fiber on stop logic. Prerequisites: #1254
-
Vladimir Davydov authored
To apply replicated rows in parallel, we need to be able to complete transactions asynchronously, from the tx_prio callback. We can't yield there so we must ensure that on_commit/on_rollback triggers don't yield. The only place where we may yield in a completion trigger is vinyl DDL, which submits vylog records and waits for them to complete. Actually, there's no reason to wait for vylog write to complete, as we can handle missing records on recovery. So this patch reworks vylog to make vy_log_tx_try_commit() and hence on_commit/on_rollback triggers using it non-yielding. To achieve that, we need to: - Use vy_log.latch only to sync log rotation vs writes. Don't protect vylog buffer with it. This makes vy_log_tx_begin() non-yielding. - Use a separate list and buffer for storing vylog records of each transaction. We used to share them among transactions, but without vy_log.latch we can't sync access to them anymore. Since vylog transactions are rare events, this should be fine. - Make vy_log_tx_try_commit() append the transaction to the list of pending transactions and wake up a background fiber to flush all pending transactions. This way it doesn't need to yield. Closes #4218
-
Maria Khaydich authored
Receive function behaved inconsistently for the cases where first we use an integer as a pattern as to tell the function a specific number of elements we want to read, and then perform another receive call using '*a' as a pattern. The latter should have denoted that we want to get all there is to get, but instead it was possible to get only a part of data and also in non-sequential order. Closes #4118
-
- Jun 19, 2019
-
-
Vladislav Shpilevoy authored
URI reconfiguration causes incarnation increment in order to forcefully rewrite old value on remote instances. But that update was not delivered to a user via triggers. The patch fixes that.
-
Alexander Turenko authored
Add 'decimal' to a built-in modules list to preserve package.loaded.decimal when pretest_clean is set in suite.ini. Needed for #692.
-
- Jun 18, 2019
-
-
Alexander Turenko authored
Built-in modules are bundled into tarantool in the following way. A lua file from src/lua or src/box/lua is stored as a string literal in a C file, then built and linked into tarantool. During startup tarantool calls luaL_loadbuffer() on this string. When a Lua source is converted to a C literal, proper escaping is performed. However there is one case, which was not covered: trigraphs. The patch adds escaping of question mark symbols to avoid matching ??X sequences as trigraphs by C preprocessor. The most simple way to check that it works is to apply the following patch: | diff --git a/src/lua/string.lua b/src/lua/string.lua | index 6e12c59ae..2da2dbf4d 100644 | --- a/src/lua/string.lua | +++ b/src/lua/string.lua | @@ -425,3 +425,6 @@ string.fromhex = string_fromhex | string.strip = string_strip | string.lstrip = string_lstrip | string.rstrip = string_rstrip | +string.foo = function() | + return '??(' | +end And call the function like so: | ./src/tarantool -e 'print(string.foo()) os.exit()' If it printfs `??(`, then everything is okay. If it prints `[`, then `??(` was preprocessed as the trigraph. We hit this problem when tried to bundle luarocks-3: it contains "^(.-)(%??)$" regexp, where `??)` was interpreted as `]`. Debug build or a build with -DENABLE_WERROR reports an error in the case, but usual RelWithDebInfo build passes (with -Wtrigraphs warnings) and can show this unexpected behaviour. Fixes #4291.
-
Vladimir Davydov authored
vy_tx_handle_deferred_delete() expects (righteously) that in case a deferred DELETE overwrites a statement in a secondary index write set and the overwritten statement wasn't skipped on commit (i.e. doesn't have txv->is_overwritten flag set), both the old and the new statement must be REPLACEs (see the comment to the corresponding assertions for more details). The problem is we don't set is_overwritten flag in case a statement doesn't have any effect (txv->is_nop is set), even if it was, in fact, overwritten in the primary index write set (see vy_tx_prepare). As a result, we get an assertion failure when we delete such statement in the same transaction, e.g. s = box.schema.space.create('test', {engine = 'vinyl'}) s:create_index('pk', {parts = {1, 'unsigned'}}) s:create_index('sk', {parts = {2, 'unsigned'}}) s:replace{1, 1, 1} box.begin() s:update(1, {{'+', 3, 1}}) -- adds no-op REPLACE to sk write set s:delete(1) -- produces deferred DELETE for sk box.commit() results in vy_tx_handle_deferred_delete: Assertion `vy_stmt_type(stmt) == IPROTO_REPLACE' failed. Fix this by making sure we set is_overwritten for all overwritten statements in a secondary index write set. Closes #4294
-
- Jun 17, 2019
-
-
Serge Petrenko authored
The test used to fail occasionally with a following error: ``` [001] box/net.box.test.lua [ fail ] [001] [001] Test failed! Result content mismatch: [001] —- box/net.box.result Thu Jun 13 06:16:34 2019 [001] +++ box/net.box.reject Fri Jun 14 04:50:55 2019 [001] @@ -3774,23 +3774,23 @@ [001] ... [001] test_run:grep_log('default', 'Got a corrupted row.*') [001] —- [001] — 'Got a corrupted row:' [001] +- null [001] ... [001] test_run:grep_log('default', '00000000:.*') [001] —- [001] — '00000000: A3 02 D6 5A E4 D9 E7 68 A1 53 8D 53 60 5F 20 3F ' [001] +- null [001] ... [001] test_run:grep_log('default', '00000010:.*') [001] —- [001] — '00000010: D8 E2 D6 E2 A3 02 D6 5A E4 D9 E7 68 A1 53 8D 53 ' [001] +- null [001] ... [001] test_run:grep_log('default', '00000020:.*') [001] —- [001] — '00000020: 60 5F 20 3F D8 E2 D6 E2 A3 02 D6 5A E4 D9 E7 68 ' [001] +- null [001] ... [001] test_run:grep_log('default', '00000030:.*') [001] —- [001] — '00000030: A1 53 8D 53 60 5F 20 3F D8 E2 D6 E2 ' [001] +- null [001] ... [001] test_run:grep_log('default', '00000040:.*') [001] —- ``` This happened because we used `grep_log` right after `socket:write`, which should cause the expected log messages. Change to `wait_log`. Follow-up #4273
-
- Jun 16, 2019
-
-
Daniil Kotelnikov authored
* Added a new command `test` that is new feature of luarocks 3.x. * Added a new command `make_manifest` that is command from luarocks-admin. * Added a new command `help` for getting help of internal luarocks commands.
-
Daniil Kotelnikov authored
Also refined arguments descriptions of existing tarantoolctl rocks commands.
-
Daniil Kotelnikov authored
Made tarantoolctl compatible with luarocks-3.x. Fixes #4052.
-
- Jun 14, 2019
-
-
Ilya Konyukhov authored
**Intro**: By default, Lua uses package.path/cpath to load dependencies when user calls `require("something")`. It also allows to add custom loaders to extend its functionality. Tarantool transforms default behavior by injecting some custom loaders into `package.loaders`. Firstly, it allows to load modules from CWD. Secondly, it looks for rocks modules starting from CWD and traversing up to root "/" directory. This "start from CWD" behaviour is hardcoded and not customizable. **Problem**: Let say we have a lua app with all dependencies under myapp directory. If you start your application like this, you won't be able to load any of them unless you specify myapp in every require call: ```bash tarantool myapp/init.lua ``` To allow user scripts require dependencies relatively, user has to first determine appropriate directory path relatively to scripts file and then patch package.path/cpath with both modules and rocks paths. **Solution**: Introduce the notion of a search root which is used as base for rocks and module loaders. Let user easily set this path to control how application dependencies are loaded. There is 2 new functions introduced in this patch: - package.setsearchroot(path) is used to set new search root to look dependency from - package.searchroot() returns search root currently setup. If no search root was setup, `fio.cwd()` is returned. @TarantoolBot document Title: Document new package.setsearchroot and package.searchroot functions What this patch does: `package.setsearchroot(path)` function sets search root which is used as root directory to load dependencies from: - path must be a string (relative or absolute). It will be expanded to absolute path and set as a search root; - if no path specified, it sets current file directory as a search root (using debug.sourcedir); - if path is box.NULL, that searchroot will be reset, so default behaviour will apply (CWD). With that said everything a user now has to do is to just put this line of code: ```lua package.setsearchroot() ``` at the top of project init file "myapp/init.lua" which is placed in the project root and start an app by simply calling: ```bash $ tarantool myapp/init.lua ``` This will set search root to the absolute path of `myapp` directory, so all dependencies will be looked relative to that directory.
-
Alexander Turenko authored
Run collectgarbage() between tests to ensure that there are no dangling iterators and so on. Such objects can affect statistic counters that may be important for a test. Fixes #4287.
-
- Jun 13, 2019
-
-
Serge Petrenko authored
Iproto already listens for requests during recovery, so yielding at this point of time allows such early requests, which arrived during recovery, be processed while data is in unfinished state. This caused box/net.box test failures, and is potentially harmful. Besides, there is no need to yield during recovery. Closes #4273
-
Serge Petrenko authored
Add fixed-point decimal type to tarantool core. Adapt decNumber floating-point decimal library for the purpose, write a small wrapper and add unit tests. A new decimal type is an alias for decNumber numbers from the decNumber library. Arithmetic operations (+, -, *, /) and some mathematic functions (ln, log10, exp, pow, sqrt) are available together with methods to pack and unpack decimal to and from its packed representation (useful for serialization). We introduce a single context for all the arithmetic operations on decimals, which enforces both number precision and scale to be in range [0, 38]. NaNs and Infinities are restricted. Part of #692
-
Mergen Imeev authored
After this patch, all errors in VDBE will be set using diag_set(). Closes #4074
-
Mergen Imeev authored
After this patch, all errors in the SQL functions will be set using diag_set(). Part of #4074
-
Mergen Imeev authored
This patch replaces SQL error SQL_MISMATCH by Tarantool error ER_SQL_TYPE_MISMATCH.
-
Mergen Imeev authored
Since the interrupt system is no longer used in SQL, the SQL_INTERRUPT error is out of date and should be removed. Also this patch removes currently unused progress callback system.
-
Mergen Imeev authored
Currently, in OP_Halt, you can get a SQL error other than SQL_TARANTOOL_ERROR, for example, the SQL_CONSTRAINT error. After this patch, all errors going through OP_Halt will have SQL error code SQL_TARANTOOL_ERROR and have diag set. Part of #4074
-
Mergen Imeev authored
The ER_SQL error code is very similar to the ER_SQL_EXECUTE error code: they have almost identical description and usage. To avoid misunderstandings, it is better to remove one of them. The ER_SQL error code has a slightly more vague description, so it was decided to remove it.
-
Mergen Imeev authored
The error codes SQL_TARANTOOL_DELETE_FAIL, SQL_TARANTOOL_ITERATOR_FAIL and SQL_TARANTOOL_INSERT_FAIL have practically no functions, but their use can lead to incorrect behavior. This patch replaces them with SQL_TARANTOOL_ERROR. This will simplify the work with errors.
-
Mergen Imeev authored
Currently, the mayAbort field is working with SQL error SQL_CONSTRAINT. Since we want to replace SQL_CONSTRAINT with a Tarantool error, we need to change the way the mayAbort field works or delete it. Since this field is used only for make an assertion in debug mode, it is better to simply remove it.
-
Alexander V. Tikhonov authored
Fixed test replication/misc to be able to run it on hosts under high load. Changed downstream check to use test_run:wait_downstream() function, to wait for certain box.info.replication values to fix the error: [050] replication/misc.test.lua [ fail ] [050] [050] Test failed! Result content mismatch: [050] --- replication/misc.result Thu Jun 6 06:46:54 2019 [050] +++ replication/misc.reject Fri Jun 7 05:55:00 2019 [050] @@ -622,7 +622,7 @@ [050] ... [050] box.info.replication[2].downstream.status [050] --- [050] -- stopped [050] +- follow [050] ... [050] test_run:cmd("stop server replica") [050] --- Closes #4277
-
Alexander V. Tikhonov authored
Added to cmake environment CMAKE_DL_LIBS (The name of the library that has dlopen and dlclose in it, usually -ldl) to openssl build to add DL library, to fix the following fails: Linking CXX executable crypto.test /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup': dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen' dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym' dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose' /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func': dso_dlfcn.c:(.text+0x334): undefined reference to `dlsym' dso_dlfcn.c:(.text+0x3f2): undefined reference to `dlerror' /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load': dso_dlfcn.c:(.text+0x459): undefined reference to `dlopen' dso_dlfcn.c:(.text+0x4c9): undefined reference to `dlclose' dso_dlfcn.c:(.text+0x502): undefined reference to `dlerror' /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr': dso_dlfcn.c:(.text+0x5a1): undefined reference to `dladdr' dso_dlfcn.c:(.text+0x601): undefined reference to `dlerror' /usr/local/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload': dso_dlfcn.c:(.text+0x662): undefined reference to `dlclose' collect2: error: ld returned 1 exit status make[2]: *** [test/unit/crypto.test] Error 1 make[1]: *** [test/unit/CMakeFiles/crypto.test.dir/all] Error 2 Closes #4245
-
Stanislav Zudin authored
Removes the following unused macros: SQL_OMIT_AUTOINCREMENT SQL_OMIT_CONFLICT_CLAUSE SQL_OMIT_PRAGMA SQL_PRINTF_PRECISION_LIMIT SQL_OMIT_COMPOUND_SELECT SQL_POWERSAFE_OVERWRITE SQL_OMIT_PROGRESS_CALLBACK SQL_OMIT_AUTORESET SQL_OMIT_DECLTYPE SQL_ENABLE_COLUMN_METADATA SQL_TRACE_SIZE_LIMIT SQL_OMIT_LIKE_OPTIMIZATION SQL_OMIT_OR_OPTIMIZATION SQL_OMIT_BETWEEN_OPTIMIZATION SQL_EXPLAIN_ESTIMATED_ROWS SQL_ENABLE_COLUMN_USED_MASK SQL_DISABLE_DIRSYNC SQL_DEBUG_SORTER_THREADS SQL_DEFAULT_WORKER_THREADS SQL_LIMIT_WORKER_THREADS SQL_MAX_WORKER_THREADS SQL_ENABLE_MEMORY_MANAGEMENT SQL_ENABLE_UNKNOWN_SQL_FUNCTION SQL_SUBSTR_COMPATIBILITY SQL_ENABLE_STMT_SCANSTATUS Removed the remains of multithreading in the VDBE sorting tools. Updates tests. Closes #3978
-
- Jun 11, 2019
-
-
Georgy Kirichenko authored
As alter schema triggers lifecycle is bound with a transaction so corresponding structures should be placed onto a txn memory region instead of a fiber gc space. Prerequisites: #1254
-
Georgy Kirichenko authored
We tend to synchronize cached data with the actual data changes: apply while on_replace and undo while on_rollback.
-
Georgy Kirichenko authored
Fire transaction trigger after a transaction finalization. This allows to not to view the transaction dismissed changes in case of rollback. Fixes: #4276
-
- Jun 09, 2019
-
-
Vladislav Shpilevoy authored
SWIM as a monitoring module is hard to use without an ability to subscribe on events. Otherwise a user should have polled a SWIM member table for updates - it would be too inefficient. This commit exposes an ability to set Lua triggers. Closes #4250 @TarantoolBot document Title: SWIM: swim:on_member_event Now a user can set triggers on member table updates. There is a function for that, which can be used in one of several ways: ```Lua swim:on_member_event(new_trigger[, ctx]) ``` Add a new trigger on member table update. The function `new_trigger` will be called on each new member appearance, an existing member drop, and update. It should take 3 arguments: first is an updated SWIM member, second is an events object, third is `ctx` passed as is. Events object has methods to help a user to determine what event has happened. ```Lua local function on_event(member, event, ctx) if event:is_new() then ... elseif event:is_drop() then ... end if event:is_update() then -- All next conditions can be -- true simultaneously. if event:is_new_status() then ... end if event:is_new_uri() then ... end if event:is_new_incarnation() then ... end if event:is_new_payload() then ... end end end s:on_member_event(on_event, ctx) ``` Note, that multiple events can happen simultaneously. A user should be ready to that. Additionally, 'new' and 'drop' never happen together. But they can happen with 'update', easily. Especially if there are lots of events, and triggers work too slow. Then a member can be added and updated after a while, but still does not reach a trigger. A remarkable case is 'new' + 'new payload'. This case does not correlate with triggers speed. The thing is that payload absence and payload of size 0 are not the same. And sometimes is happens, that a member is added without a payload. For example, a ping was received - pings do not carry payload. In such a case the missed payload is received later eventually. If that matters for a user's application, it should be ready to that: 'new' does not mean, that the member already has a payload, and payload size says nothing about its presence or absence. Second usage case: ```Lua swim:on_member_event(nil, old_trigger) ``` Drop an old trigger. Third usage case: ```Lua swim:on_member_event(new_trigger, old_trigger[, ctx]) ``` Replace an existing trigger in-place, with keeping its position in the trigger list. Fourth usage case: ```Lua swim:on_member_event() ``` Get a list of triggers. When drop or replace a trigger, a user should be attentive - the following code does not work: ```Lua tr = function() ... end -- Add a trigger. s:on_member_event(tr) ... -- Drop a trigger. s:on_member_event(nil, tr) ``` The last line, if be precise. This is because SWIM wraps user triggers with an internal closure for parameters preprocessing. To drop a trigger a user should save result of the first on_member_event() call. This code works: ```Lua tr = function() ... end -- Add a trigger. tr_id = s:on_member_event(tr) ... -- Drop a trigger. s:on_member_event(nil, tr_id) ``` The triggers are executed one by one in a separate fiber. And they can yield. These two facts mean that if one trigger sleeps too long - other triggers wait. It does not block SWIM from doing its routine operations, but block other triggers. The last point to remember is that if a member was added and dropped before its appearance has reached a trigger, then such a member does not fire triggers at all. A user will not notice that easy rider member.
-
Vladislav Shpilevoy authored
These function are going to yield in scope of #4250, because swim:new() will start a fiber, while swim:delete() cancels and gives it a control. Needed for #4250
-
Vladislav Shpilevoy authored
SWIM is asynchronous by design. It means, that there are two ways of getting updates of a member table and individual members: polling and triggers. Polling is terrible - this is why libev with select(), poll(), epoll(), kevent() have appeared. The only acceptable solution is triggers. This commit allows to set triggers on member updates. Part of #4250
-
Vladislav Shpilevoy authored
It is a miracle, but somehow it worked until I changed a couple of places. Here objects stored in an rlist are freed, but not deleted from the list. The list is reused after that.
-
Vladislav Shpilevoy authored
The SWIM unit tests code with the fake events and time does lots of forbidden things: it manually invokes pending watcher callbacks; manages global time without a kernel; puts not existing descriptors into the loop. These foul blows open the gates to the full control over IO events, descriptors, virtual time. Hundreds of virtual seconds pass in milliseconds in reality, it makes SWIM unit tests fast despite complex logic. All these actions does not affect the loop until yield. On yield a scheduler fiber wakes up and 1) infinitely generates EV_READ on not existing descriptors because a kernel considers them closed; 2) manual pending callbacks invocation asserts, because it is not allowed for non-scheduler fibers. To avoid these problems a new isolated loop is created, not visible for the scheduler. Here the fake events library can rack and ruin whatever it wants. Needed for #4250
-
- Jun 08, 2019
-
-
Vladislav Shpilevoy authored
When a member is deleted, pointer at its struct tt_uuid becomes invalid. This commit makes member:uuid() create a new tt_uuid object, cached for subsequent calls.
-
- Jun 07, 2019
-
-
Alexander V. Tikhonov authored
Travis-ci failed on brew install python2 due to it was already installed on OSX 10.13 Sierra, so it needs to be installed without fails on its exists. Follow up #4254
-
Mergen Imeev authored
Up to this point, the is_temporary flag has been set for surrogate space definitions used to transfer meta-information during compilation stage of DML queries (CREATE TABLE/INDEX etc). At some point, it became possible to use spaces created in Lua in SQL statements. Since it is allowed to create temporary spaces in Lua, not all temporary spaces in SQL are surrogate wrappers. To separate real temporary spaces (i.e. which came from space cache) from surrogate ones, is_ephemeral flag is now set in such spaces instead of is_temporary. Note that there can't be mess between these flags since ephemeral spaces can exist only during execution of VDBE bytecode. Also note that flag is required only for debugging facilities. Close #4139
-
Alexander V. Tikhonov authored
Fixed swim headers in addition to commit: 88892f13 ('swim: fix build on FreeBSD') Included unistd.h header to fix the following errors: In file included from src/lib/swim/swim_transport_udp.c:31: src/lib/swim/swim_transport.h:61:1: error: unknown type name 'ssize_t'; did you mean 'size_t'? ssize_t ^~~~~~~ size_t /usr/include/netinet6/in6.h:698:18: note: 'size_t' declared here typedef __size_t size_t; ^ In file included from src/lib/swim/swim_transport_udp.c:31: src/lib/swim/swim_transport.h:66:1: error: unknown type name 'ssize_t'; did you mean 'size_t'? ssize_t ^~~~~~~ size_t /usr/include/netinet6/in6.h:698:18: note: 'size_t' declared here typedef __size_t size_t; Closes #4050
-
avtikhon authored
Enabled use_unix_sockets_iproto option to use unix sockets iproto provides the new way to handle the problem with 'Address already in use' error. It lets test-run appoint unix sockets for LISTEN environment variable values. Before this change the TcpPortDispatcher was used to eliminate the race condition when two workers trying to use the same port: the idea was that each worker used its own ports range. Really these ports could race with client ports (from, say, net.box or replication), which typically didn't use bind() and so bound to a random available port (despite any dispatched ranges) and could produce 'Address already in use' error. Closes: #4008
-
Alexander V. Tikhonov authored
Removed skip flag file to switch on the testing of the http_client test. Enabled http_client test on OSX, fixed missing of the python2 symlink. Removed the subtest on '595 error return' from 'error' suite, due to it may hang forever. To enable test on travis-ci reverted commit: 1d7285c4 ('Disable flaky http_client.test.lua') Closes #4254
-