- Jun 13, 2019
-
-
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
-
Alexander Turenko authored
This is the regression from a7c855e5 (net.box: fetch '_vcollation' sysview into the module). The result file was corrupted, because the test sometimes produces incorrect result in the test case for on_connect / on_disconnect triggers. This issue is tracked by #4273. Follow up #3941.
-
- Jun 06, 2019
-
-
Roman Khabibov authored
Fetch "_vcollation" sysview to show collation name instead collation id. Closes #3941
-
Roman Khabibov authored
Add "_vcollation" sysview to read it from net.box. This sysview is always readable, except when a user doesn't have "public" role. Needed for #3941 @TarantoolBot document Title: box.space._vcollation _vcollation is a system space that represents a virtual view. The structure of its tuples is identical to that of _collation. Tuples of this sysview is always readable, except when the user doesn't have "public" role.
-
Mergen Imeev authored
Follow-up #4196
-
Nikita Pettik authored
It is legacy flag and isn't used anymore.
-
Mergen Imeev authored
Before this patch, the existence of space was checked for the CREATE TABLE or CREATE VIEW statements during the parsing. If the space already exists, an error has been set and cleanup is performed. But, if the statement contained 'IF NOT EXIST', the cleanup was performed, but the error was not set. Meanwhile, create_foreign_key() assumes that if create_table_def->new_space is NULL, then we are dealing with ALTER TABLE statement. This in turn false, since ctd->new_space is nullified also in case of already existing table. This causes an assertion or a segmentation fault when creating a foreign key during space creation. This patch moves this check to VDBE. Parsing now is always processed till the end as in case space doesn’t exist. Closes #4196
-
Vladimir Davydov authored
After compacting runs, we first mark them as dropped (VY_LOG_DROP_RUN), then try to delete their files unless they are needed for recovery from the checkpoint, and finally mark them as not needed in the vylog (VY_LOG_FORGET_RUN). There's a potential race sitting here: the problem is the garbage collector might kick in after files are dropped, but before they are marked as not needed. If this happens, there will be runs that have two VY_LOG_FORGET_RUN records, which will break recovery: Run XX is forgotten, but not registered The following patches make the race more likely to happen so let's eliminate it by making the garbage collector the only one who can mark runs as not needed (i.e. write VY_LOG_FORGET_RUN record). There will be no warnings, because the garbage collector silently ignores ENOENT errors, see vy_gc(). Another good thing about this patch is that now we never yield inside a vylog transaction, which makes it easier to remove the vylog latch blocking implementation of transactional DDL.
-
Kirill Shcherbatov authored
Closes #3691 @TarantoolBot document Title: check constraint for Lua space The check constraint is a type of integrity constraint which specifies a requirement that must be met by tuple before it is inserted into space. The constraint result must be predictable. Expression in check constraint must be <boolean value expression> I.e. return boolean result. Now it is possible to create ck constraints only for empty space having format. Constraint expression is a string that defines relations between top-level tuple fields. Take into account that all names are converted to an uppercase before resolve(like SQL does), use \" sign for names of fields that were created not with SQL. The check constraints are fired on insertion to the Lua space together with Lua space triggers. The execution order of ck constraints checks and space triggers follows their creation sequence. Note: this patch changes the CK constraints execution order for SQL. Previously check of CK constraints integrity was fired before tuple is formed; meanwhile now they are implemented as NoSQL before replace triggers, which are fired right before tuple insertion. In turn, type casts are performed earlier than msgpack serialization. You should be careful with functions that use field types in your check constrains (like typeof()). Consider following situation: ``` box.execute("CREATE TABLE t2(id INT primary key, x INTEGER CHECK (x > 1));") box.execute("INSERT INTO t2 VALUES(3, 1.1)") ``` the last operation would fail because 1.1 is silently cast to integer 1 which is not greater than 1. To create a new CK constraint for a space, use space:create_check_constraint method. All space constraints are shown in space.ck_constraint table. To drop ck constraint, use :drop method. Example: ``` s1 = box.schema.create_space('test1') pk = s1:create_index('pk') ck = s1:create_check_constraint('physics', 'X < Y') s1:insert({2, 1}) -- fail ck:drop() ```
-
Kirill Shcherbatov authored
To perform ck constraints tests before insert or update space operation, we use precompiled VDBE machine associated with each ck constraint, that is executed in on_replace trigger. Each ck constraint VDBE code consists of 1) prologue code that maps new(or updated) tuple via binding, 2) ck constraint code generated by CK constraint AST. In case of ck constraint error the tuple insert/replace operation is aborted and ck constraint error is handled as diag message. Needed for #3691
-
Kirill Shcherbatov authored
This patch introduces a new system space to persist check constraints. The format of the new system space is _ck_constraint (space id = 364) [<space id> UINT, <constraint name> STR, <is_deferred>BOOL, <language>STR, <code>STR] A CK constraint is local for a space, so every pair <space id, CK name> is unique (it is also the PK in the _ck_constraint space). After insertion into this space, a new instance describing check constraint is created. Check constraint holds an exspression AST. While space features some check constraints, it isn't allowed to be dropped. The :drop() space method firstly deletes all check constraints and then removes an entry from the _space. Because the space alter, the index alter and the space truncate operations cause space recreation process, a new RebuildCkConstrains object is introduced. This alter object compiles a new ck constraint object, replaces and removes an existent instances atomically (but if the assembly of some ck constraint object fails, nothing is changed). In fact, in scope of this patch we don't really need to recreate a ck_constraint object in such situations (it is enough to patch space_def pointer in AST tree like we did it before, but we are going to recompile a VDBE that represents ck constraint in further patches, and that operation is not safe). The main motivation for these changes is an ability to support ADD CHECK CONSTRAINT operation in the future. CK constraints are easier to manage as self-sustained objects: such change is managed with atomic insertion(unlike the current architecture). Finally, the xfer optimization is disabled now if some space have ck constraints. In following patches this xfer optimisation becomes impossible, so there is no reason to rewrite this code now. Needed for #3691
-
Kirill Shcherbatov authored
Refactored OP_Column instruction with a new vdbe_field_ref class. The vdbe_field_ref is a reusable object that speeds-up field access for given tuple or tuple data. Introduced OP_Fetch opcode that uses vdbe_field_ref given as a first argument. This opcode makes possible to perform binding of a new tuple to an existent VDBE without decoding it's fields. Needed for #3691
-
Kirill Shcherbatov authored
This preparatory refactoring is necessary to simplify the process of introducing a new OP_Fetch statement in the next patch. - got rid of useless sMem local variable - got rid of useless payloadSize in VdbeCursor structure Needed for #3691
-
Kirill Shcherbatov authored
A new sql_bind_ptr routine allows to bing a generic pointer to VDBE variable. This change is required to pass a tuple_fetcher representing a new tuple to the check constraint VDBE. Needed for #3961
-
Kirill Shcherbatov authored
The sql_flags is a parser parameter that describes how to parse the SQL request, determines general behaviour: like whether foreign keys are handled as deferred or not etc. But now this information is taken from the global user session object. When we need to run the parser with some other parameters, it is necessary to change global session object, which may lead to unpredictable consequences in general case. Introduced a new parser and vdbe field sql_flags which is responsible for SQL parsing results. Needed for #3691
-