Skip to content
Snippets Groups Projects
  1. Jul 05, 2019
    • Alexander V. Tikhonov's avatar
      travis-ci: freeze curl version on 7.65.0 on OS X · 2e880af0
      Alexander V. Tikhonov authored
      Homebrew now contains curl-7.65.1 which affected by curl/curl#3995 (this
      problem leads to segfaults). The next version is not released yet. The
      current commit downgrades the curl version to 7.65.0.
      
      Close #4288
      2e880af0
    • Serge Petrenko's avatar
      lua/trigger: cleanup lua stack after trigger run · febacc4b
      Serge Petrenko authored
      This patch adds a stack cleanup after a trigger is run and its return
      values, if any, have been read.
      
      This problem was found in a case when on_schema_init trigger set an
      on_replace trigger on a space, and the trigger ran during recovery.
      This lead to Lua stack overflows for the aforementioned reasons.
      
      Closes #4275
      febacc4b
    • Vladimir Davydov's avatar
      Replace schema lock with fine-grained locking · e5c4ce75
      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.
      e5c4ce75
    • Vladimir Davydov's avatar
      vinyl: don't yield while logging index creation · d9fc5dc1
      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.
      d9fc5dc1
    • Vladimir Davydov's avatar
      Don't take schema lock for checkpointing · 94de0a08
      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.
      94de0a08
  2. Jul 04, 2019
    • Alexander V. Tikhonov's avatar
      Enable GitLab CI testing · ce623a23
      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
      ce623a23
    • Vladimir Davydov's avatar
      test: make vinyl/replica_rejoin more stable · 1a3d4fd8
      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().
      1a3d4fd8
    • Vladimir Davydov's avatar
      Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY · 3d5da41c
      Vladimir Davydov authored
      Timeout injections are unstable and difficult to use. Injecting a delay
      is much more convenient.
      3d5da41c
    • Vladimir Davydov's avatar
      Add ERROR_INJECT_YIELD and ERROR_INJECT_SLEEP helpers · ef25d66e
      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.
      ef25d66e
    • Vladimir Davydov's avatar
      ddl: don't use txn_last_stmt on _cluster commit/rollback · 92321d4c
      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.
      92321d4c
    • Vladimir Davydov's avatar
      ddl: don't use txn_last_stmt on _ck_constraint commit/rollback · 80eaa94d
      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.
      80eaa94d
    • Vladimir Davydov's avatar
      ddl: don't use txn_last_stmt on _trigger commit/rollback · ef5dfaf4
      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.
      ef5dfaf4
    • Vladimir Davydov's avatar
      ddl: don't use txn_last_stmt on _collation commit/rollback · ff2575e9
      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.
      ff2575e9
    • Vladimir Davydov's avatar
      ddl: restore sequence value if drop is rolled back · f4306238
      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.
      f4306238
    • Vladimir Davydov's avatar
      ddl: fix _space_sequence rollback · 644c20b2
      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.
      644c20b2
    • Vladimir Davydov's avatar
      ddl: synchronize sequence cache with actual data state · 4be73c92
      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.
      4be73c92
    • Vladimir Davydov's avatar
      ddl: synchronize func cache with actual data state · 01972ca1
      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.
      01972ca1
    • Vladimir Davydov's avatar
      ddl: synchronize user cache with actual data state · 9c1839ff
      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").
      9c1839ff
    • Vladimir Davydov's avatar
      ddl: unreference view on space drop synchronously · 37f837e1
      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.
      37f837e1
    • Serge Petrenko's avatar
      test: fix box/on_shutdown flakiness · 5046069b
      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
      5046069b
  3. Jul 03, 2019
    • Alexander Turenko's avatar
      test: update test-run · 1df9c3d2
      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.
      1df9c3d2
    • Kirill Shcherbatov's avatar
      box: introduce VARBINARY field type · 59de57d2
      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"}})
      59de57d2
  4. Jul 01, 2019
  5. Jun 28, 2019
    • Vladislav Shpilevoy's avatar
      swim: default generation is timestamp · b6b72013
      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
      b6b72013
    • Vladislav Shpilevoy's avatar
      swim: fix inability to set generation only · ea1e9192
      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
      ea1e9192
    • Vladislav Shpilevoy's avatar
      swim: fix a dangerous yield in ffi.gc · 98f29645
      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
      98f29645
    • Vladislav Shpilevoy's avatar
      swim: fix a leak when a trigger is installed · eb403598
      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
      eb403598
    • Mergen Imeev's avatar
      sql: allow to use vectors as left value of IN operator · 7418c373
      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
      7418c373
    • Georgy Kirichenko's avatar
      test: fix flaky test · 3f5806ab
      Georgy Kirichenko authored
      This test fails sporadically
      3f5806ab
  6. Jun 27, 2019
  7. Jun 25, 2019
    • Georgy Kirichenko's avatar
      applier: apply transaction in parallel · 8c84932a
      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
      8c84932a
    • Georgy Kirichenko's avatar
      txn: introduce asynchronous txn commit · 18ea440a
      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
      18ea440a
    • Georgy Kirichenko's avatar
      wal: introduce a journal entry finalization callback · a16ff869
      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
      a16ff869
    • Georgy Kirichenko's avatar
      txn: get rid of fiber_gc from txn_rollback · 68404cfd
      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
      68404cfd
    • Georgy Kirichenko's avatar
      txn: get rid of autocommit from a txn structure · e070cc4d
      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
      e070cc4d
    • Georgy Kirichenko's avatar
      txn: unref statement at txn_free · 399e2b65
      Georgy Kirichenko authored
      Refactoring: put txn statement unref code into transaction free function.
      399e2b65
    • Stanislav Zudin's avatar
      ddl: No replication for temp and local spaces · 564ba89a
      Stanislav Zudin authored
      Do not spread the space:truncate() to replicas if the
      affected space is local or temporary.
      
      Closes #4263
      564ba89a
    • Konstantin Osipov's avatar
      Revert "box: introduce Lua persistent functions" · a758bced
      Konstantin Osipov authored
      This reverts commit 4e3470ce.
      
      The RFC did not pass review yet.
      a758bced
  8. Jun 24, 2019
    • Vladislav Shpilevoy's avatar
      test: fix unit/crypto test flakiness · ad1ec950
      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
      ad1ec950
Loading