Skip to content
Snippets Groups Projects
  1. Mar 25, 2019
  2. Mar 22, 2019
  3. Mar 21, 2019
    • Vladimir Davydov's avatar
      vinyl: fix recovery after aborted index creation · 38fc0bbe
      Vladimir Davydov authored
      There's a bug in the code building index hash on recovery: we replace
      a dropped index with any newer index, even incomplete one. Apparently,
      this is wrong, because a dropped index may have been dropped during
      final recovery and hence is still needed for initial recovery. If we
      replace it with an incomplete index in the index hash, initial recovery
      will fail with
      
        ER_INVALID_VYLOG_FILE: Invalid VYLOG file: LSM tree 512/1 not found
      
      (see vy_lsm_recover()).
      
      Fix this problem by checking create_lsn of the index that is going to
      replace a dropped one - if it's negative, we must link it to the dropped
      index via vy_lsm_recovery_info->prepared instead of inserting it into
      the hash directly.
      
      Closes #4066
      38fc0bbe
    • Georgy Kirichenko's avatar
      SIGHUP causes a log rotation instead of termination · c9f36fb9
      Georgy Kirichenko authored
      Perform a log rotation instead of a termination according to
      the documentation. Fix regression caused by 9f99bc62
      
      Follow up for: 9f99bc62
      Closes: #4063
      c9f36fb9
    • Kirill Shcherbatov's avatar
      box: fix format of tuple produced with frommap() · 9e2a905c
      Kirill Shcherbatov authored
      Previously, all tuples created with frommap() used default format
      table_format_runtime, and therefore the created data tuples were
      not checked for the ability to be inserted into the target space.
      
      Moreover frommap(...):tomap(...) procedures sequence also did not
      work because tomap(..) routine assumes that the tuple has format
      with field names.
      
      Closes #4045
      9e2a905c
  4. Mar 20, 2019
    • Kirill Shcherbatov's avatar
      memtx: introduce tuple compare hint · 9fba29ab
      Kirill Shcherbatov authored
      Implement functions for retrieving tuple hints for a particular
      key_def. Hint is an integer that can be used for tuple comparison
      optimization: if a hint of one tuple is less than a hint of another
      then the first tuple is definitely less than the second; only if
      hints are equal tuple_compare must be called for getting comparison
      result. Hints are calculated using only the first part of key_def.
      
      @locker:
       - Rework key_def_set_hint_func.
       - Refactor functions calculating hints.
       - Drop has_collation template argument (we don't use templates
         for collations anywhere else).
       - Add part_count argument to key_hint (it's conventional to pass
         part_count along with decoded key).
       - Improve comments, rename a few functions, and cleanup code.
      
      Close #3961
      9fba29ab
    • Vladimir Davydov's avatar
      memtx_tree: refactor key_def/cmp_def selector · b5800101
      Vladimir Davydov authored
       - Fold key_def/cmp_def selection logic (memtx_tree_index_cmp_def).
         There are only a couple places that use it so it isn't going to
         hurt readability.
       - Add memtx_tree_cmp_def helper that returns the definition currently
         used by a memtx tree. In contrast to removed memtx_tree_index_cmp_def
         this one doesn't check index_def. Instead it returns memtx_tree arg.
         We will use it to compute key/tuple hints.
    • Nikita Pettik's avatar
      sql: fix recovery of VIEW space · 2425fde7
      Nikita Pettik authored
      During creation of VIEW space, string containing its definition (i.e.
      "SELECT ...") is parsed to fetch names of referenced spaces. By those
      names real struct space objects are found using schema_find_id().
      This function processes lookup in _space using its secondary index.
      On the other hand, secondary indexes of _space are unavailable during
      this stage of recovery, so this lookup fails and whole recovery process
      aborts.
      
      It is worth mentioning that now we can fetch space directly from
      in-memory cache using its name (originally, when view reference counter
      was introduced, we couldn't do this due to absence of name-cache). So,
      to fix this issue, let's use space_by_name() instead of schema_find_id()
      
      Closes #3814
      2425fde7
    • Nikita Pettik's avatar
      sql: make spaces without PK illegal in queries · de6fb197
      Nikita Pettik authored
      Our SQL codebase was inherited from SQLite, where each table must have
      at least one index - primary (if no explicit PK declared, one based on
      rowid is implicitly created). In Tarantool spaces can exists without
      indexes. The only existing restriction is that they can't contain any
      data. Hence, even very basic queries fail with assertion/seagfault if
      they are applied to spaces with no indexes. Situation when space turns
      out to remain without PK is quite common due to the absence of
      transactional DDL: for instance, space drop procedure consists of
      several steps including dropping all indexes; space itself is dropped at
      the very end. Thus, if a sequence of queries is interrupted by drop
      space procedure and one is not finished, the rest of queries will
      operate on space with no indexes.
      
      As a solution to this problem (at least temporary) now we disallow
      query processing involving spaces without PK except for views.
      
      Closes #3780
      de6fb197
  5. Mar 19, 2019
    • Vladimir Davydov's avatar
      tuple_compare: rename *_compare_with_hint to *_compare_with_type · 139482e0
      Vladimir Davydov authored
      We're planning to introduce tuple comparison hints soon. Let's rename
      those helper function so as not to mix them.
      139482e0
    • Vladimir Davydov's avatar
      tuple_compare: cleanup key_def virtual func setter · 829c811c
      Vladimir Davydov authored
      Over time key_def virtual func setter code has turned into a complete
      mess: now it's an incomprehensible mix of if-else blocks, linear array
      search, and devious array indexing. What is worse, it's duplicated by
      tuple_compare_create and tuple_compare_with_key_create. Adding yet
      another parameter to key_def templates, which is needed to implement
      multi-key indexes, is literally impossible.
      
      This patch attempts to alleviate the situation by splitting code paths
      for pre-compiled, plain, and json indexes plus merging tuple_compare and
      tuple_compare_with_key setters.
      829c811c
    • Mergen Imeev's avatar
      sql: rework three errors of "unsupported" type · c8e4b9ed
      Mergen Imeev authored
      Three errors of "unsupported" type were reworked in this patch.
      
      Part of ...3965
      c8e4b9ed
    • Mergen Imeev's avatar
      sql: remove field nErr from struct Parse · 9cafd70b
      Mergen Imeev authored
      At the moment, the only purpose of the field nErr of struct Parse
      is to show whether the field is_aborted of the same struct is true
      or false. Let's remove it.
      
      Part of ...3965
      9cafd70b
    • Nikita Pettik's avatar
      sql: bind BLOB value as BLOB not as STRING · 4007436a
      Nikita Pettik authored
      It is obvious that BLOB (that is value encoded in msgpack with MP_BIN
      format) values must be bound as BLOBs, not as strings. Unfortunately,
      they were bound as strings, which lead to wrong resulting type
      calculations after execution of SQL statement.
      4007436a
    • Mergen Imeev's avatar
      sql: replace rc with is_aborted status in struct Parse · 71c6e823
      Mergen Imeev authored
      Currently, field representing return code in struct Parse can take
      only two values: SQL_OK (successfully finished parsing) and
      SQL_TARANTOOL_ERROR (in case of any errors occurred). Therefore,
      it can be replaced with a boolean field. Patch provides
      straightforward refactoring.
      
      Part of #3965
      71c6e823
    • Mergen Imeev's avatar
      sql: remove argument pzErrMsg from sqlRunParser() · effbfeb0
      Mergen Imeev authored
      This argument has practically no functionality, but deleting it
      allows us to replace the rc field of the Parse structure with a
      new bool field.
      
      Part of #3965
      effbfeb0
    • Alexander Turenko's avatar
      travis: add Fedora 28 and 29 · 67dcbf28
      Alexander Turenko authored
      Fixes #4027.
      67dcbf28
    • Alexander Turenko's avatar
      lua: remove digest.sha() and digest.sha_hex() · 390693a1
      Alexander Turenko authored
      SHA-0 is considered weak for years and was removed in OpenSSL since
      1.1.0.
      
      These Lua functions did not work since 15ed10e4, but give 'Digest
      method "sha" is not supported' error for any input. Removed them to
      don't confuse a user with a Tab completion.
      
      Follow up #1722.
      Fixes #4028.
      390693a1
    • Ivan Koptelov's avatar
      sql: forbid diff. sorting orders in ORDER BY + LIMIT · aa4a2de6
      Ivan Koptelov authored
      Without multi-directional iterators (to be introduced in #3309)
      ORDER BY + LIMIT with different specified ordered leads to wrong
      result. So for now (till #3309 is resolved) different sort
      orders are forbidden in ORDER BY + LIMIT.
      
      Close #4038
      
      @TarantoolBot document
      Title: different sorting orders in ORDER BY are forbidden now
      The error will be raised if different sorting orders are
      encountered.
      aa4a2de6
    • Mergen Imeev's avatar
      sql: set SQL parser errors via diag_set() · 3abd5926
      Mergen Imeev authored
      After this patch all SQL parser errors will be set via diag_set().
      They were saved in field zErrMsg of struct Parse before this
      patch.
      
      Part of #3965
      3abd5926
  6. Mar 18, 2019
    • Alexander Turenko's avatar
      test: update test-run · be7d940f
      Alexander Turenko authored
      Fixed _func system space clean when pretest_clean is set to True in
      suite.ini.
      be7d940f
    • Vladimir Davydov's avatar
      xrow: fix request_str crash on long requests · 9e054f18
      Vladimir Davydov authored
      If tt_static_buf is too small to store the request string, 'pos' will
      become greater than 'end', leading to snprintf(pos, end - pos) crash, as
      it doesn't allow the buffer size to be negative. Use SNPRINT instead.
      9e054f18
    • Cyrill Gorcunov's avatar
      lib/core/fiber: Fix compilation if !HAVE_MADV_DONTNEED · a6374289
      Cyrill Gorcunov authored
      Fixes commit 553dc562 ("lib/core/fiber: Relax stack memory usage on
      recycle").
      a6374289
    • Vladimir Davydov's avatar
      lib/core/fiber: Log madvise and mprotect errors · f0047404
      Vladimir Davydov authored
      So that we notice in case anything goes wrong.
      f0047404
    • Cyrill Gorcunov's avatar
      lib/core/fiber: Relax stack memory usage on recycle · 553dc562
      Cyrill Gorcunov authored
      We want to detect a situation where task in fiber is too eager for
      stack memory and relax rss usage in such case. For this sake upon
      stack creation we put 8 marks near 64K bound (such params allows us
      to fill ~1/4 of a page, which seem reasonable but we might change
      this params with time).
      
      Once stack get recycled we investigate the marks and if they were
      overwritten we drop all pages behind to relax memory usage (if OS
      supports madvise syscall).
      
      Another important moment is that we're marking the whole stack
      as not present thus if fiber never stepped over 64K limit the
      marks will be in tact and it means the fibers are light ones
      there won't be much #pf in future.
      
      Later we plan to implement an intelligent fiber scheduling
      considering how many memory fibers consume in average.
      
      @locker:
       - fix watermark page alignment for grow-up stack
       - improve MADV_DONTNEED check
       - clean up code and elaborate comments
       - add test case to unit/fiber
       - fix unit/guard test
      
      Follow-up #3418
      553dc562
    • Cyrill Gorcunov's avatar
      lib/core/fiber: Increase default stack size · 82f4b4a3
      Cyrill Gorcunov authored
      The default 64K stack size used for years become too small
      for modern distors (Fedora 29 and etc) where third party libraries
      (such as ncurses) started to use 64K for own buffers and we get
      SIGSGV early without reaching interactive console phase.
      
      Thus we increase default size up to 512K which should fit
      for common case. Later we will make this value configurable
      to address arbitrary stack sizes without a need to rebuild
      the whole code.
      
      Closes #3418
      82f4b4a3
  7. Mar 15, 2019
    • Vladimir Davydov's avatar
      test: don't leave open read views after vinyl/errinj_tx · 0c7a3e39
      Vladimir Davydov authored
      See commit 65061cb4 ("test: don't leave open read views after
      vinyl/iterator") for more details.
      
      Follow-up #3862
      0c7a3e39
    • Vladimir Davydov's avatar
      test: fix vinyl/errinj failure · 61756cce
      Vladimir Davydov authored
      The patch fixes the following test failure:
      
       | --- vinyl/errinj.result Fri Mar 15 19:19:19 2019
       | +++ vinyl/errinj.reject Fri Mar 15 19:21:37 2019
       | @@ -854,7 +854,8 @@
       |  ...
       |  ret
       |  ---
       | -- - [3, 3]
       | +- - [2, 2]
       | +  - [3, 3]
       |  ...
       |  s:drop()
       |  ---
      
      The error occurrs, because the test doesn't make sure that a read from
      the scondary index actually occurs and the fiber does stall on a read
      from the primary index. Use index stats to assure that.
      
      Closes #3863
      61756cce
    • Alexander V. Tikhonov's avatar
      travis-ci: fix OS X Mojave 10.14 build · eb964471
      Alexander V. Tikhonov authored
      Fixed Mojave Mac build with setting MACOSX_DEPLOYMENT_TARGET environment
      variable for LuaJIT's Makefile. This variable specifies the minimum
      version of OS X on which the target binaries are to be deployed.
      
      The reason why we need to set MACOSX_DEPLOYMENT_TARGET to at least 10.6
      is that 10.4 SDK (which is set by default in LuaJIT's Makefile) is not
      longer included in Mac OS X Mojave 10.14.
      
      See also https://github.com/LuaJIT/LuaJIT/issues/484
      
      We already set -Wl,-macosx_version_min,10.6 (-macosx_version_min and
      MACOSX_DEPLOYMENT_TARGET are synonymous), but it affects only a linker.
      We possibly should remove -macosx_version_min, because it superseded by
      MACOSX_DEPLOYMENT_TARGET, but it should be done with verification that
      the original problem really fixed by the new way to set a deployment
      target. This is not part of this patch.
      
      Removed virtualenv usage in CI for OS X (so pip just installs packages
      into a system), because OS X Mojave 10.14 does not offer virtualenv by
      default.
      
      Fixed #3797
      eb964471
    • Vladimir Davydov's avatar
      test: fix vinyl/deferred_delete failure · 5433435d
      Vladimir Davydov authored
      The patch fixes the following test failure:
      
       | --- vinyl/deferred_delete.result        Fri Mar 15 18:17:05 2019
       | +++ vinyl/deferred_delete.reject        Fri Mar 15 18:18:18 2019
       | @@ -577,7 +577,7 @@
       |  ...
       |  sk:stat().rows -- ditto
       |  ---
       | -- 5
       | +- 25
       |  ...
       |  s:drop()
       |  ---
      
      The failure was introduced by commit 6dd0d2fb ("vinyl: do not apply
      run_count_per_level to the last level"). Due to the commit compaction of
      the secondary index may happen before compaction of the primary index,
      in which case deferred DELETE statements won't make it to the secondary
      index in time against the test expectation. Fix this by making the first
      run big enough to prevent major compaction from kicking in.
      
      Follow-up #3657
      Closes #4047
      5433435d
    • Nikita Pettik's avatar
      sql: make LIKE accept only TEXT arguments · d902cd11
      Nikita Pettik authored
      According to ANSI[1] specification, LIKE arguments must be of
      string-like type (VARCHAR, CHAR, TEXT etc). If one of arguments is NULL,
      then the result of LIKE function is NULL as well. This patch makes LIKE
      follow these rules.
      
      ANSI 2013 Part 2: Foundation; Chapter 8.5 <like predicate>
      
      Closes #3954
      d902cd11
    • Nikita Pettik's avatar
      sql: remove sql_like_count global counter · 24741360
      Nikita Pettik authored
      We don't rely on this debug facility anymore, so let's remove it.
      24741360
    • Nikita Pettik's avatar
      sql: remove SQL_LIKE_DOESNT_MATCH_BLOBS · fd1888d4
      Nikita Pettik authored
      We are going to always throw an error if value of BLOB type gets to LIKE
      arguments, so code under is macro is not needed anymore.
      
      Part of #3954
      fd1888d4
    • Vladimir Davydov's avatar
      vinyl: reset dump watermark after updating memory limit · b15773fa
      Vladimir Davydov authored
      The watermark is updated every second anyway, however not updating it
      when the limit is reset results in vinyl/quota test failure:
      
       | --- vinyl/quota.result  Thu Mar 14 16:03:54 2019
       | +++ vinyl/quota.reject  Fri Mar 15 16:32:44 2019
       | @@ -146,7 +146,7 @@
       |  for i = 1, count do s:replace{i, pad} end -- does not trigger dump
       |  ---
       |  ...
       | -box.stat.vinyl().memory.level0 > count * pad:len()
       | +box.stat.vinyl().memory.level0 > count * pad:len() or box.stat.vinyl()
       |  ---
       |  - true
       |  ...
      
      Closes #3864
      b15773fa
    • Mergen Imeev's avatar
      sql: rework syntax errors · b7eed190
      Mergen Imeev authored
      This patch reworks SQL syntax errors. After this patch, these
      error will be set as Tarantool errors.
      
      Part of #3965
      b7eed190
    • Kirill Yukhin's avatar
      Update luajit submodule · be0506db
      Kirill Yukhin authored
      Fixed GC issue.
      be0506db
    • Vladimir Davydov's avatar
      test: don't leave open read views after vinyl/iterator · 65061cb4
      Vladimir Davydov authored
      An open iterator may disrupt the following test run, because it may
      prevent dump/compaction from purging stale rows. In particular,
      iterators left by vinyl/iterator result in the following test failure:
      
       | --- vinyl/deferred_delete.result        Mon Feb 11 19:14:01 2019
       | +++ vinyl/deferred_delete.reject        Fri Mar 15 16:21:11 2019
       | @@ -155,7 +155,7 @@
       |  ...
       |  pk:stat().rows -- 5 new REPLACEs
       |  ---
       | -- 5
       | +- 10
       |  ...
       |  i1:stat().rows -- 10 old REPLACE + 5 new REPLACEs + 10 deferred DELETEs
       |  ---
      
      Fix this by calling the Lua garbage collector to delete all dangling
      iterators in the end of vinyl/iterator test.
      
      Closes #3862
      65061cb4
  8. Mar 14, 2019
    • Serge Petrenko's avatar
      evio: fix timeout calculations · 2c0d418b
      Serge Petrenko authored
      The function evio_timeout_update() failed to update the starting time
      point, which lead to timeouts happening much faster than they should if
      there were consecutive calls to the function.
      This lead, for example, to applier timing out while reading a several
      megabyte-size row in 0.2 seconds even if replication_timeout was set to
      15 seconds.
      
      Closes #4042
      2c0d418b
  9. Mar 13, 2019
    • Alexander Turenko's avatar
      test: update test-run · 9d50d571
      Alexander Turenko authored
      Run a unit test from a var directory. It is needed to, say, allow a test
      to write a log file to a gitignored directory.
      
      The only behaviour change observed on tarantool's tests is that
      unit/swim.test and unit/swim_proto.test write a log.txt file to a test
      var directory ./test/xxx_unit instead of ./test.
      9d50d571
Loading