- Jun 29, 2018
-
-
Kirill Shcherbatov authored
As we would like to lookup triggers by space_id in future on space deletion to delete associated _trigger tuples we need to introduce new field space_id as secondary key. Part of #3273.
-
Kirill Shcherbatov authored
As error codes were not sorted, changing any of error constants significantly change test case output. This cause unnecessary changes on each such commit.
-
Kirill Shcherbatov authored
As we are going to port triggers to server, we need an instrument to release allocated memory in alter.cc. Part of #3273.
-
Kirill Shcherbatov authored
-
AKhatskevich authored
`sql_current_time` is exported only in debug mode and used to check builtin datetime sql functions behavior in specific time moments. Extra changes: * table-14.1 test is deleted, as it does not test anything. It was testing ddl inside of a transaction. This case is checked by 14.2 by now. Closes #2646
-
Kirill Yukhin authored
Make RANDOMBLOB(0) return NULL, it was returning random blob of length 1 before. Allow rounding to more than 30 digits. Part of #2347
-
Kirill Yukhin authored
If we ever will have extensions support, it will be impemented in different way. Remove this legacy code. Closes #2183
-
Kirill Yukhin authored
Removed legacy functions: sqlite_version, sqlite_sourceid, sqlite_log. Added version built-in function which returns Tarantool's version. Closes #2184
-
- Jun 28, 2018
-
-
Kirill Yukhin authored
Update expander of SELECT statement to search for space if corresponding table wasn't found in table hash. Create dummy table if so and fill def field only. Also fix a leak in VIEW creation. Part of #3369
-
- Jun 27, 2018
-
-
Vladimir Davydov authored
-
- Jun 26, 2018
-
-
Vladimir Davydov authored
If a source is used on a read iteration (i.e. the key at which it is positioned is the next best match or, in terms of the read iterator implementation, its front_id matches the read iterator front_id), its history is cleaned up, see vy_read_iterator_apply_history(). This breaks the logic behind vy_read_src_is_behind(), which assumes that the history always points to the last used key. As a result, a source may be mistakenly skipped, as illustrated below: Fiber 1 Fiber 2 ------- ------- 1. Opens read iterator. 2. Advances it to the next key. The returned key was read from a mem or run (not from cache). The source's history is emptied. Adds a chain containing the key read by fiber 1 to the cache. 3. Continues iteration, reads next few keys from the cache until the chain ends. The source used at step 2 is skipped. 4. Calls vy_read_src_is_behind() on the source used at step 2 and skipped at step 3. It returns false, because its history is empty, thus skipping keys stored in it. Fix this bug by moving the code that checks whether a source iterator needs to be advanced from vy_read_src_is_behind() to source iterator 'skip' method, because there we always know the last key returned by the iterator. Basically, this returns the code we had before commit b4d57284 ("vinyl: consolidate skip optimization checks in read iterator"). Closes #3477
-
Georgy Kirichenko authored
Allow define access privileges for all spaces, functions and sequences. Read and write privileges are supported for spaces, execute privilege for sequences. Privilege granting and revoking might be done through old api without object identification: box.schema.user.grant("guest", "read", "space") Prerequisite #945
-
Vladislav Shpilevoy authored
-
Konstantin Osipov authored
Use constants, rename methods, invert acl-object compatibility matrix. In scope of gh-945.
-
imarkov authored
Introduce constraints on object_type-privilege pairs. These constraints limit senseless grants/revokes, i.e., sequence - execute, all space related privileges(insert, delete, update), function - alter, all space related privileges, role - all privileges except create, drop, alter, execute Prerequisite #945
-
Kirill Shcherbatov authored
Resolves #3472.
-
- Jun 25, 2018
-
-
Konstantin Osipov authored
-
Vladimir Davydov authored
If called on a unix socket, bind(2) creates a new file, see unix(7). When we stop a unix tcp server, we should remove that file. Currently, we do it from the tcp server fiber, after the server loop is broken, which happens when the socket is closed, see tcp_server_loop(). This opens a time window for another tcp server to reuse the same path: main fiber tcp server loop ---------- --------------- -- Start a tcp server. s = socket.tcp_server('unix/', sock_path, ...) -- Stop the server. s:close() socket_readable? => no, break loop -- Start a new tcp server. Use the same path as before. -- This function succeeds, because the socket is closed -- so tcp_server_bind_addr() will clean up by itself. s = socket.tcp_server('unix/', sock_path, ...) tcp_server_bind tcp_server_bind_addr socket_bind => EADDRINUSE tcp_connect => ECONNREFUSED -- Remove dead unix socket. fio.unlink(addr.port) socket_bind => success -- Deletes unix socket used -- by the new server. fio.unlink(addr.port) In particular, the race results in sporadic failures of app-tap/console test, which restarts a tcp server using the same file path. To fix this issue, let's close the socket after removing the socket file. This is absolutely legit on any UNIX system, and this eliminates the race shown above, because a new server that tries to bind on the same path as the one already used by a dying server will not receive ECONNREFUSED until the socket fd is closed and hence the file is removed. A note about the app-tap/console test. After this patch is applied, socket.close() takes a little longer for unix tcp server, because it yields twice, once for removing the socket file and once for closing the socket file descriptor. As a result, on_disconnect() trigger left from the previous test case has time to run after session.type() check. Actually, those triggers have already been tested and we should have cleared them before proceeding to the next test case. So instead of adding two new on_disconnect checks to the test plan, let's clear the triggers before session.type() test case and remove 3 on_connect and 5 on_auth checks from the test plan. Closes #3168
-
Konstantin Osipov authored
-
Vladislav Shpilevoy authored
Consider this packet: msgpack = require('msgpack') data = msgpack.encode(18400000000000000000)..'aaaaaaa' Tarantool interprets 18400000000000000000 as size of a coming iproto request, and tries with no any checks to allocate buffer of such size. It calculates needed capacity like this: capacity = start_value; while (capacity < size) capacity *= 2; Here it is possible that on i-th iteration 'capacity' < 'size', but 'capacity * 2' overflows 64 bits and becomes < 'size' again, so this loop never ends and occupies 100% CPU. Strictly speaking overflow has undefined behavior. On the original system it led to nullifying 'capacity'. Such size is improbable as a real packet gabarits, but can appear as a result of parsing of some invalid packet, first bytes of which accidentally appears to be valid MessagePack uint. This is how the bug emerged on the real system. Lets restrict the maximal packet size to 2GB. Closes #3464
-
- Jun 24, 2018
-
-
Mergen Imeev authored
Due to limitation of reference counters for tuple being only 65535 it was possible to reach this limitation. This patch increases capacity of reference counters to 4 billions. Closes #3224
-
- Jun 22, 2018
-
-
Vladislav Shpilevoy authored
-
- Jun 21, 2018
-
-
Kirill Shcherbatov authored
Deleted BTREE_BULKLOAD and OPFLAG_BULKCSR as they become useless since btree.c was dropped as a part of #2419. Removed SQLITE_ENABLE_CURSOR_HINTS sections as this code has never been in use. Start use OPFLAG_SEEKEQ instead of equal BTREE_SEEK_EQ as this macro name has no sense since no btree present in SQL. Resolves #3121.
-
- Jun 19, 2018
-
-
Nikita Pettik authored
-
Nikita Pettik authored
In Tarantool VIEWs are always enabled, so there is no need for such ifdef guards. This patch simply removes them.
-
Nikita Pettik authored
This patch significantly reworks VIEW mechanisms. Firstly, names resolution for VIEW now occurs during its creation. In other words, we can't run following code, since name T1 doesn't exist at the moment of V1 creation: CREATE VIEW v1 AS SELECT * FROM t1; CREATE TABLE t1(id PRIMARY KEY); Now, table t1 must be created before view. As a result, no circularly defined views are allowed. Moreover, it means that space representing view is created with appropriate field names, types, collations etc. Also, introduced view reference counter for each space. It is incremented for each space participating in select statement. For instace: CREATE VIEW v1 AS SELECT * FROM (SELECT * FROM t1, t2); In this case, view reference counter is increased for spaces T1 and T2. Similarly, such counter is decremented for all dependent spaces when VIEW is dropped. To support such behavior, auxiliary on_commit triggers are added. However, it is still not enough, since before dropping space itself, we must drop secondary indexes, clear _sequence space etc. Such changes can't be rollbacked (due to the lack of transactional DDL), so before executing DROP routine, special opcode OP_CheckViewReferences checks view reference counter for space to be dropped. Finally, we don't hold struct Select in struct Table or anywhere else anymore. Instead, 'CREATE VIEW AS SELECT ...' string is stored in def->opts.sql. At compilation time of query on view (such as 'SELECT * FROM v1;') this string is parsed once and loaded into struct Select, which in turn is used as before. Fixed tests where view was created prior to referenced table. Closes #3429, #3368, #3300
-
Nikita Pettik authored
Structure of VDBE prologue: 0: OP_Init 0 N (address to start) 0 --| |-> 1: ... | | ... | | N: OP_Transaction <------------ | N+1: (Constant expressions to be saved in registers) | ... |-- M: OP_Goto 0 1 0 However, last opcode in VDBE program (i.e. OP_Goto) is generated always, despite the existence of OP_Transaction or constant expressions. Thus, VDBE program for queries like <SELECT * FROM table;> features redundant jump. Such useless jump wastes exectuion time (although it is executed once) and may affect jump prediction. This patch adds conditional branch for generating jump opcode finishing VDBE program: it is appended only if we need to start transaction or code constrant expressions. Closes #3231
-
Nikita Pettik authored
-
- Jun 15, 2018
-
-
Kirill Shcherbatov authored
Part of #3273.
-
Kirill Shcherbatov authored
Part of #3273.
-
Kirill Shcherbatov authored
This patch fixes several memory leaks. One of them appeared during introducing space_def in struct Table. Name of table wasn’t released in case of successful returning from function sqlite3StartTable(). The second one is about leak of parser error message, when the parser is used out of sqlite3RunParser. The patch frees the message in parser destructor now. If a one want to use the message after parser destruction, then just take it off from parser.zErrMsg and nullify.
-
Kirill Shcherbatov authored
As we are going to call parser on box.cfg() to recreate triggers from SQL, we should initialize Schema as it used in sqlite3BeginTrigger. Part of #3273.
-
- Jun 14, 2018
-
-
Vladislav Shpilevoy authored
-
Vladislav Shpilevoy authored
Before the patch box.session.sync() is global for the session and is updated on each new iproto request. When the connection is multiplexed, box.session.sync() can be changed with no finishing a current request, if a new one arrives. The patch makes box.session.push() local for the request, protecting it from multiplexing mess. Box.session.sync() after the patch can be safely used inside a request. Closes #3450 @TarantoolBot document Title: box.session.sync() became request local Box.session.sync() was global for a session, so it was unusable when the connection behind the session is multiplexed. Now box.session.sync() is request local and can be safely used inside the request processor.
-
Vladislav Shpilevoy authored
Replace it with more specific structures and pointers in order to prepare to add `net` storage. This allows to make the code working with fiber storage simpler, remove useless wrappers and casts, and in the next patch - remove broken session.sync and add fiber sync. Note that under no circumstances fiber.h is allowed to include application-specific headers like session.h or txn.h. One only is allowed to announce a struct and add opaque pointer to it.
-
Vladimir Davydov authored
-
Vladimir Davydov authored
Since tuples stored in temporary spaces are never written to disk, we can always delete them immediately, even when a snapshot is in progress. Closes #3432
-
Vladimir Davydov authored
-
Kirill Yukhin authored
This patch implements support of SQL's DELETE statemets which a accompanied by point WHERE point constraints. This patch doesn't support any kinds of nested selects or JOINs. Part of #3235
-
Kirill Yukhin authored
Legacy SQL FE was able to create indexes w/ expressions. Tarantool will employ diofferenct scheme to implement functional indexes, thus code handling it in SQL FE is dead and redundant. Remove it. Part of #3235
-