- Jul 05, 2019
-
-
Vladimir Davydov authored
Now, as we don't need to take the schema lock for checkpointing, it is only used to synchronize concurrent space modifications (drop, truncate, alter). Actually, a global lock is a way too heavy means to achieve this goal, because we only care about forbidding concurrent modifications of the same space while concurrent modifications of different spaces should work just fine. So this patch replaces the global schema lock with per space locking. A space lock is held while alter_space_do() is in progress so as to make sure that while AlterSpaceOp::prepare() is performing a potentially yielding operation, such as building a new index, the space struct doesn't get freed from under our feet. Note, the lock is released right after index build is complete, before the transaction is committed to WAL, so if the transaction is non-yielding it can modify the space again in the next statement (this is impossible now, but will be done in the scope of the transactional DDL feature). If alter_space_do() sees that the space is already locked it bails out and throws an error. This should be fine, because long-lasting operation involving schema change, such as building an index, are rare and only performed under the supervision of the user so throwing an error rather than waiting seems to be adequate. Removal of the schema lock allows us to remove latch_steal() helper and on_begin_stmt txn trigger altogether, as they were introduced solely to support locking. This is a prerequisite for transactional DDL, because it's unclear how to preserve the global schema lock while allowing to combine several DDL statements in the same transaction.
-
Vladimir Davydov authored
Currently, we always log a vinyl index creation in the vylog file synchronously, i.e. wait for the write to complete successfully. This makes any index creation a yielding operation, even if the target space is empty. To implement transactional DDL for non-yielding statements, we need to eliminate yields in this case. We can do that by simply using vy_log_try_commit() instead of vy_log_commit() for logging index creation, because we can handle a missing VY_LOG_PREPARE_INDEX record during recovery - the code was left since before commit dd0827ba ("vinyl: log new index before WAL write on DDL") which split index creation into PREPARE and COMMIT stages so all we need to do is slightly modify the test. The reason why I'm doing this now, in the series removing the schema lock, is that removal of the schema lock without making space truncation non-yielding (remember space truncation basically drops and recreates all indexes) may result in a failure while executing space.truncate() from concurrent fibers, which is rather unexpected. In particular, this is checked by engine/truncate.test.lua. So to prevent the test failure once the schema lock is removed (see the next patch), let's make empty index creation non-yielding right now.
-
Vladimir Davydov authored
Memtx checkpointing proceeds as follows: first we open iterators over primary indexes of all spaces and save them to a list, then we start a thread that uses the iterators to dump space contents to a snap file. To avoid accessing a freed tuple, we put the small allocator to the delayed free mode. However, this doesn't prevent an index from being dropped so we also take the schema lock to lock out any DDL operation that can potentially destroy a space or an index. Note, vinyl doesn't need this lock, because it implements index reference counting under the hood. Actually, we don't really need to take a lock - instead we can simply postpone index destruction until checkpointing is complete, similarly to how we postpone destruction of individual tuples. We even have all the infrastructure for this - it's delayed garbage collection. So this patch tweaks it a bit to delay the actual index destruction to be done after checkpointing is complete. This is a step forward towards removal of the schema lock, which stands in the way of transactional DDL.
-
- Jul 04, 2019
-
-
Alexander V. Tikhonov authored
Implemented GitLab CI testing process additionally to existing Travis CI. The new testing process is added to run tests faster. It requires to control a load of machines to avoid flaky fails on timeouts. GitLab CI allows us to run testing on our machines. Created 2 stages for testing and deploying packages. The testing stage contains the following jobs that are run for all branches: * Debian 9 (Stretch): release/debug gcc. * Debian 10 (Buster): release clang8 + lto. * OSX 14 (Mojave): release. * FreeBSD 12: release gcc. And the following jobs that are run of long-term branches (release branches: for now it is 1.10, 2.1 and master): * OSX 13 (Sierra): release clang. * OSX 14 (Mojave): release clang + lto. The deployment stage contains the same jobs as we have in Travis CI. They however just build tarballs and packages: don't push them to S3 and packagecloud. In order to run full testing on a short-term branch one can name it with '-full-ci' suffix. The additional manual work is needed when dependencies are changed in .travis.mk file ('deps_debian' or 'deps_buster_clang_8' goals): | make GITLAB_USER=foo -f .gitlab.mk docker_bootstrap This command pushes docker images into GitLab Registry and then they are used in testing. Pre-built images speed up testing. Fixes #4156
-
Vladimir Davydov authored
The test checks that files left after rebootstrap are removed by the garbage collector. It does that by printing file names to the result file. This is inherently unstable, because should timing change, and we can easily get an extra dump or compaction resulting in a different set of files and hence test failure. Let's rewrite the test so that it checks that files are actually removed using fio.path.exists().
-
Vladimir Davydov authored
Timeout injections are unstable and difficult to use. Injecting a delay is much more convenient.
-
Vladimir Davydov authored
ERROR_INJECT_YIELD yields the current fiber execution by calling fiber_sleep(0.001) while the given error injection is set. ERROR_INJECT_SLEEP suspends the current thread execution by calling usleep(1000) while the given error injection is set.
-
Vladimir Davydov authored
When we implement transactional DDL, txn_last_stmt won't necessarily point to the right statement on commit or rollback so we must avoid using it. Note, replicas are still registered/unregisterd in the on_commit trigger, but that's okay, as we don't really need _cluster space to be in sync with the replica set.
-
Vladimir Davydov authored
When we implement transactional DDL, txn_last_stmt won't necessarily point to the right statement on commit or rollback so we must avoid using it. While we are at it, let's also make sure that changes are propagated to Lua on replace, not on commit, by moving on_alter_space trigger invocation appropriately.
-
Vladimir Davydov authored
When we implement transactional DDL, txn_last_stmt won't necessarily point to the right statement on commit or rollback so we must avoid using it.
-
Vladimir Davydov authored
When we implement transactional DDL, txn_last_stmt won't necessarily point to the right statement on commit or rollback so we must avoid using it.
-
Vladimir Davydov authored
A sequence isn't supposed to roll back to the old value if the transaction it was used in is aborted for some reason. However, if a sequence is dropped, we do want to restore the original value on rollback so that we don't lose it on an unsuccessful attempt to drop the sequence.
-
Vladimir Davydov authored
_space_sequence changes are not rolled back properly. Fix it keeping in mind that our ultimate goal is to implement transactional DDL, which implies that all changes to the schema should be done synchronously, i.e. on_replace, not on_commit.
-
Vladimir Davydov authored
To implement transactional DDL, we must make sure that in-memory schema is updated synchronously with system space updates, i.e. on_replace, not on_commit. Note, to do this in case of the sequence cache, we have to rework the way sequences are exported to Lua - make on_alter_sequence similar to how on_alter_space and on_alter_func triggers are implemented.
-
Vladimir Davydov authored
To implement transactional DDL, we must make sure that in-memory schema is updated synchronously with system space updates, i.e. on_replace, not on_commit.
-
Vladimir Davydov authored
To implement transactional DDL, we must make sure that in-memory schema is updated synchronously with system space updates, i.e. on_replace, not on_commit. See also commit 22bedebe ("ddl: synchronize privileges cache with actual data state").
-
Vladimir Davydov authored
Do it on_replace rather than on_commit. This is required to implement transactional DDL. Note, this is the only place where on_replace_dd_space() postpones schema update until after commit. Other than that, space updates are already transactional DDL friendly.
-
Serge Petrenko authored
Replace prints that indicate on_shutdown trigger execution with log.warn, which is more reliable. This eliminates occasional test failures. Also instead of waiting for the server to start and executing grep_log, wait for the desired log entries to appear with wait_log. Closes #4134
-
- Jul 03, 2019
-
-
Alexander Turenko authored
Fixed app/strict.test.lua fail after a test that sets 'a' global variable. It was due to the way how 'strict' module tracks declared global variables and was fixed in pretest_clean.lua test-run's module.
-
Kirill Shcherbatov authored
A new VARBINARY field type would be useful for SQL type system. Closes #4201 Needed for #4206 @TarantoolBot document Title: new varbinary field type Introduced a new field type varbinary to represent mp_bin values. The new type varbinary may be used in format or index definition. Example: s = box.schema.space.create('withdata') s:format({{"b", "varbinary"}}) pk = s:create_index('pk', {parts = {1, "varbinary"}})
-
- Jul 01, 2019
-
-
Vladimir Davydov authored
Fixes commit abf5ef4f ("box: export registered functions in box.func folder").
-
Alexander Turenko authored
* Implement SQL driver (#4123). * Support line carrying with backslash. * Support new result file format (for new tests). See the link below for a full description of the new features. https://github.com/tarantool/test-run/commit/a04b5b096c607172ce4fc86a84e3531c9f3a7304 Fixes #4123.
-
- Jun 28, 2019
-
-
Vladislav Shpilevoy authored
Generation is supposed to be a persistent counter to distinguish between different installations of the same SWIM instance. By default it was set to 0, which was quite unsafe. Kostja proposed an easy and bright solution - generation could be set to timestamp by default. In such a case on each restart it is almost 100% will be different. Follow up #4280
-
Vladislav Shpilevoy authored
swim.new() is declared as allowed to be called before swim:cfg(). But in fact swim.new({generation = ...}) didn't work because after generation extraction the empty config {} was passed to swim:cfg() and led to an error. The patch allows to call swim.new() with generation only, as well as without parameters at all. Follow up #4280
-
Vladislav Shpilevoy authored
FFI can't survive yields. A yield in ffi.C.func() leads to a crash; yield in ffi.gc is not documented as allowed. Yield in any GC function leads to garbage collector stuck until the yield is finished. This patch makes SWIM GC callback non-yielding. Now yielding swim_delete() is called in a separate fiber created in GC callback, but started at the end of event loop only. Follow up #3234
-
Vladislav Shpilevoy authored
SWIM wraps user triggers to prepare arguments. The wrapper function kept a reference to SWIM object, and prevented its automatic deletion at GC. The patch makes this reference weak. Follow up #4250
-
Mergen Imeev authored
In SQL, it is allowed to use vector expressions, that is, an operation that uses vectors as operands. For instance, vector comparison: SELECT (1,2,3) < (1,2,4); Accidentally, routines handling IN operator contained a bug: in cases where we used a vector as the left value in the IN operator, we received an assertion in debug build or a segmentation fault in release. This was due to some legacy code in which it was assumed that the left value of the IN operator can have only one column in case it is a vector. Let's fix this by allowing vectors of the other sizes as the left value of the IN operator and providing check which verifies that both sides of IN operator have the same dimension. Closes #4204
-
Georgy Kirichenko authored
This test fails sporadically
-
- Jun 27, 2019
-
-
Mergen Imeev authored
This patch optimizes some netbox requests that were slowed down in commit 665fc3a1. Follow-up #2978
-
- Jun 25, 2019
-
-
Georgy Kirichenko authored
Applier use asynchronous transaction to batch journal writes. All appliers share the replicaset.applier.tx_vclock which means the vclock applied but not necessarily written to a journal. Appliers use a trigger to coordinate in case of failure - when a transaction is going to be rolled back. Closes: #1254
-
Georgy Kirichenko authored
This commit implements asynchronous transaction processing using txn_write. The method prepares a transaction and sends it to an journal without an yield until the transaction was finished. The transaction status could be controlled via on_commit/on_rollback triggers. In order to support asynchronous transaction journal_write method turned to an asynchronous one and now a transaction engine controls journal status using journal entry finalization callback. Prerequisites: #1254
-
Georgy Kirichenko authored
Finalize a transaction thorough a journal entry callback. So transaction processing doesn't rely on fiber schedule. Also allow to steal locked latch ownership for fiber which isn't owner of the latch. This is required to process transaction triggers asynchronously. Prerequisites: #1254
-
Georgy Kirichenko authored
Refactoring: don't touch a fiber gc storage on a transaction rollback explicitly. This relaxes dependencies between fiber and transaction life cycles. Prerequisites: #1254
-
Georgy Kirichenko authored
Move transaction auto start and auto commit behavior to the box level. From now a transaction won't start and commit automatically without txn_begin/txn_commit invocations. This is a part of a bigger transaction refactoring in order to implement detachable transactions and a parallel applier. Prerequisites: #1254
-
Georgy Kirichenko authored
Refactoring: put txn statement unref code into transaction free function.
-
Stanislav Zudin authored
Do not spread the space:truncate() to replicas if the affected space is local or temporary. Closes #4263
-
Konstantin Osipov authored
This reverts commit 4e3470ce. The RFC did not pass review yet.
-
- Jun 24, 2019
-
-
Vladislav Shpilevoy authored
One of subtests was checking if crypto_decode returns an error when fails to decode. But due to randomness of the test sometimes it happened, that initial vector of encrypted data somehow didn't lead to an error. Decryption was not correct, but only in terms of result, not in terms of decryption algorithm. -1 was not returned, and diag was not set. This patch checks all the cases. Closes #4306
-
Kirill Shcherbatov authored
Closes #4182 Needed for #1260 @TarantoolBot document Title: Persistent Lua functions Now Tarantool supports 'persistent' Lua functions. Such functions are stored in snapshot and are available after restart. To create a persistent Lua function, specify a function body in box.schema.func.create call: e.g. body = "function(a, b) return a + b end" A Lua persistent function may be 'sandboxed'. The 'sandboxed' function is executed in isolated environment: a. only limited set of Lua functions and modules are available: -assert -error -pairs -ipairs -next -pcall -xpcall -type -print -select -string -tonumber -tostring -unpack -math -utf8; b. global variables are forbidden Finally, the new 'is_deterministic' flag allows to mark a registered function as deterministic, i.e. the function that can produce only one result for a given list of parameters. The new box.schema.func.create interface is: box.schema.func.create('funcname', <setuid = true|FALSE>, <if_not_exists = true|FALSE>, <language = LUA|c>, <body = string ('')>, <is_deterministic = true|FALSE>, <is_sandboxed = true|FALSE>, <comment = string ('')>) Example: lua_code = [[function(a, b) return a + b end]] box.schema.func.create('sum', {body = lua_code, is_deterministic = true, is_sandboxed = true}) box.func.sum --- - is_sandboxed: true is_deterministic: true id: 2 setuid: false body: function(a, b) return a + b end name: sum language: LUA ... box.func.sum:call({1, 3}) --- - 4 ...
-
Kirill Shcherbatov authored
The box_lua_find routine used to work with an empty stack only. It is unacceptable in following patches because this helper need to be reused in following patches for environment table construction. Needed for #4182, #1260
-