Skip to content
Snippets Groups Projects
  1. Feb 13, 2019
    • Mergen Imeev's avatar
      sql: add column name to SQL change counter · 0959062a
      Mergen Imeev authored
      Currently, if the count_changes pragma is enabled, the INSERT,
      REPLACE and UPDATE statements will return the number of changes at
      execution time. This patch sets an INTEGER type for this result.
      
      Follow up #3832
      Needed from #3505
      0959062a
  2. Mar 29, 2019
    • Vladislav Shpilevoy's avatar
      swim: follow-ups for SWIM anti-entropy · 5f494092
      Vladislav Shpilevoy authored
      * fix some obvious errors in swim test utils;
      
      * fix a bug with NULL URI garbage on recfg;
      
      * fix typos in a comment and in a log message in swim.c;
      
      * do not start any timers in swim_cfg. Indeed, round timer should
        start only when at least one new member is added except self,
        and it is already done in swim_new_member;
      
      * log not only round begin, but each round step - it helps in
        debug, but does not affect production anyway because the logs
        are verbose;
      
      * in SWIM's event loop log new watch value instead of the old
        one - turned out, that new is more useful for debug;
      
      * log 'process <name> component' inside swim_process_<name>()
        functions. It is needed for failure detection, where a log of
        kind 'process failure detection' says nothing - much better to
        say 'process ping from', or 'process ack';
      
      * in swim tests instead of swim_cluster_wait_...(max_steps) use
        swim_cluster_wait_...(timeout). Step count restriction appeared
        to be useful for anti-entropy being equal to number of round
        steps, but it is not so once failure detection appears. Replies
        for failure detection requests does not depend on SWIM
        heartbeat and affect step count in a not trivial way - it makes
        test writing, debugging and supporting much harder.
      
      Follow-up for 03b9a6e9
      5f494092
  3. Mar 28, 2019
    • Vladimir Davydov's avatar
      Revert "test: skip ddl test for vinyl on travis" · cedb2983
      Vladimir Davydov authored
      This reverts commit c2de45c4.
      
      Not needed anymore as the DDL bug it was supposed to work around has
      been finally fixed.
      
      Follow-up #3420
      cedb2983
    • Vladimir Davydov's avatar
      vinyl: abort affected transactions when space is removed from cache · d3e12369
      Vladimir Davydov authored
      A DDL operation creates a new struct space container, moving unaffected
      indexes from the old container, then destroying it. The problem is there
      may be a DML request for this space, which was passed the old container
      in the argument list and then yielded on disk read. When it resumes, it
      may try to dereference the old space container, which may have already
      been destroyed. This will most certainly result in a crash.
      
      To address this problem, we introduce a new space callback, invalidate,
      which is called for the old space on space_cache_replace(). In case of
      vinyl, this callback aborts all transactions involving the space. To
      prevent a DML request from dereferencing a destroyed space, we also make
      the iterator code check the current transaction state after each yield
      and return an error if it was aborted. This should make any DML request
      bail out early without dereferencing the space anymore.
      
      Closes #3420
      d3e12369
    • Vladimir Davydov's avatar
      vinyl: simplify read iterator restoration behavior · 0621ea44
      Vladimir Davydov authored
      The 'restore' method, which is implemented by txw, cache, and memory
      sources, restores an iterator position after a yield in case the source
      has changed. It is passed the last key and it is supposed to position
      the iterator to the statement following the last key provided it had to
      reposition the iterator at all. For all kinds of sources, it first
      checks the source version and bails out early if it hasn't changed since
      the last time the iterator was used. If it has changed, it either looks
      up the statement following the given last key or tries to advance the
      iterator statement by statement (in case of a cache iterator, to avoid
      extra cache lookups).
      
      Currently, the method returns 1 if the iterator position has actually
      changed as a result of the call, 0 otherwise. That is, it returns 0 even
      if the version has changed and it had to perform a full lookup, but
      landed on the same statement. This is confusing, because in this case
      the caller has to check if it has to advance the iterator even though it
      doesn't need to, as the iterator is already positioned at the next key -
      see vy_read_iterator_scan_* family of functions.
      
      Let's simplify the restoration rules - make the 'restore' method return
      1 if it had to restore the iterator position irrespective of whether the
      position has actually changed or not. This means that in case the method
      returns 1, the caller knows that the iterator is already positioned
      properly and doesn't need to be advanced. If it returns 0, it means that
      the iterator is positioned at the same statement as before and we need
      to check if we need to advance it. This simplifies the iterator code by
      removing position checking, which would turn real nasty once multikey
      indexes are introduced. Note, comments to 'restore' methods already
      conform to this behavior (they weren't quite correct before this patch).
      
      There's a catch though - vy_read_iterator_restore_mem relies on the old
      behavior to skip the cache source in case the current key gets updated
      during yield. However, it's easy to fix that without introducing any
      extra overhead - we just need to check if the cache source is at the
      front of the iterator and clear its history if it is. BTW it turned out
      that this behavior wasn't covered by tests - when I removed the line
      invalidating the cache source from vy_read_iterator_restore_mem, all
      tests passed as usual. So while we are at it, let's also add a test case
      covering this piece of code.
      0621ea44
    • Vladimir Davydov's avatar
      vinyl: fail aborted transactions early · e50c8535
      Vladimir Davydov authored
      We abort transactions when switching to read-only mode, building a new
      index, or reverting a statement after a failed WAL write. It's no use
      to allow an aborted transaction to proceed as usual until commit - we
      should fail it as early as we can to avoid wasting resources. Currently,
      we do it in a rather abrupt way - by an assertion :-) This patch makes
      any DML/DQL operation fail gracefully instead.
      
      Closes #4070
      e50c8535
    • Vladimir Davydov's avatar
      vinyl: drop useless vy_read_view->is_aborted flag · 172f363f
      Vladimir Davydov authored
      It is supposed to abort an iterator that read a statement reverted after
      a failed WAL write. However, we will abort such an iterator anyway - see
      vy_tx_abort_readers(). So let's drop the useless flag.
      
      It turned out that we never tested such a case (try grepping "read view
      is aborted" error). So let's also add a functional test for it.
      172f363f
    • Vladimir Davydov's avatar
      vinyl: fix tx memory accounting when read intervals are merged · 546b227e
      Vladimir Davydov authored
      When a few read intervals are merged, we must fix up tx memory stats.
      
      Closes #4071
      546b227e
    • Ivan Koptelov's avatar
      sql: set explicit default collation's strength · af74255a
      Ivan Koptelov authored
      Before the patch, collations with no strength set used
      tertiary strength. But it was not easy to understand it,
      because box.space._collation:select{} would return
      ... [1, 'unicode', 1, 'ICU', '', {}] ... for such collations.
      After the patch default value is set explicitly, so
      user would observe : ... [1, 'unicode', 1, 'ICU', '',
      {strength='tertiary'}] ...
      
      Closes #3573
      
      @TarantoolBot document
      Title: default collation strength is explicit tertiary now
      Before the patch we already have tertiary strength is default
      strength for collations, but it was implicit:
      [1, 'unicode', 1, 'ICU', '', {}]
      After the patch it's just become explicit:
      1, 'unicode', 1, 'ICU', '', {'strength' = 'tertiary'}]
      
      Also please fix this https://tarantool.io/en/doc/2.1/book/box/data_model/#collations
      There is line saying: "unicode collation observes all weights,
      from L1 to Ln (identical)" It was not true and now this fact
      would just become obvious.
      af74255a
    • lenkis's avatar
      Fix text in built-in tutorial · 9eb66ae7
      lenkis authored
      Unverified
      9eb66ae7
    • lenkis's avatar
    • lenkis's avatar
      Update URLs to online documentation in built-in tutorial · 261efaa7
      lenkis authored
      Fixes #3362.
      Unverified
      261efaa7
    • Georgy Kirichenko's avatar
      Raise an error if remote transaction produces non-local changes · 94468210
      Georgy Kirichenko authored
      Disallow changes for non-local spaces during replication stream
      applying. As we do not support distributed transaction yet we could not
      provide a transactional replication for such side effects if there are
      not NOPed.
      
      Needed for: #2798
      Follow up for: 27283deb
      94468210
    • Alexander Turenko's avatar
      lua: make box.stat.net.CONNECTIONS a table · 68f43fa7
      Alexander Turenko authored
      The primary reason of this change is to keep compatibility of 1.10
      release series with tarantool/stat-0.3.1, which expects that each
      box.stat.net.<...> and box.stat.net().<...> item is a table.
      
      This commit changes CONNECTIONS metric to be a table with 'current'
      field, which in turn contains current number of connections.
      
      Fixes #4039.
      
      @TarantoolBot document
      Title: box.stat.net.CONNECTIONS becomes a table
      
      The format of box.stat.net.CONNECTIONS and box.stat.net().CONNECTIONS is
      changed in order to keep all items being tables, because
      tarantool/stat-0.3.1 expects them to be tables (see [1] for more
      information).
      
      Example of box.stat.net() **before** this commit:
      
      ```
      tarantool> box.stat.net()
      ---
      - SENT:
          total: 0
          rps: 0
        CONNECTIONS: 0
        RECEIVED:
          total: 0
          rps: 0
      ...
      ```
      
      And after:
      
      ```
      tarantool> box.stat.net()
      ---
      - SENT:
          total: 0
          rps: 0
        CONNECTIONS:
          current: 0
        RECEIVED:
          total: 0
          rps: 0
      ...
      ```
      
      Look at the comment to lbox_stat_net_call() (see the linked commit) for
      meaning of total/rps/current fields.
      
      [1]: https://github.com/tarantool/tarantool/issues/4039
      68f43fa7
    • Kirill Shcherbatov's avatar
      tests: fix flaky hints test · a3bce424
      Kirill Shcherbatov authored
      We must use long long unsigned numbers on ffi types build to
      avoid precision lost.
      
      Follow-up
              f5721edc test: check hints corner cases
      
      Closes #4080
      a3bce424
    • Alexander Turenko's avatar
      test: fix test for optional SQL_BIND in iproto · f6520860
      Alexander Turenko authored
      Added necessary cleanup, because the test fails when both memtx and
      vinyl configurations are run on the same test-run worker.
      
      Aside of that disabled the test on vinyl, because it is engine-agnostic
      and only checks iproto.
      
      This is the fix for the commit 7676b2b1 ('sql: make SQL_BIND optional in
      an iproto request').
      
      Follows up #4077.
      Unverified
      f6520860
  4. Mar 27, 2019
  5. Mar 26, 2019
    • Mergen Imeev's avatar
      sql: remove sqlErrorMsg() · 4e486f3f
      Mergen Imeev authored
      This patch completely replaces sqlErrorMsg() with diag_set() and
      removes sqlErrorMsg().
      
      Closes #3965
      Closes #3036
      4e486f3f
    • Mergen Imeev's avatar
      sql: rework semantic errors · 287d94bb
      Mergen Imeev authored
      This patch reworks some of SQL semantic errors.
      
      Part of #3965
      287d94bb
    • Alexander Turenko's avatar
      Fix tarantoolctl cat/play premature stop with --to · 70a8342f
      Alexander Turenko authored
      Stop a file processing loop only when it is guaranteed that we will not
      find a record that match user-provided filters later in this file. If
      --replica R is provided one time and we're meet a record from R with a
      LSN equal or above of a --to value, we'll stop the loop. Otherwise (no
      --replica, several --replica arguments) a file will be read until an end
      even if --to is provided.
      
      Fixes #3827.
      70a8342f
    • Alexander Turenko's avatar
      Unify tarantoolctl cat/play xlog filtering code · 092bc7ed
      Alexander Turenko authored
      Exposed this unified code (filter_xlog() function) and wrote a unit
      test.
      
      Allow to run app-tap/tarantoolctl.test.lua w/o test-run.
      
      Needed for #3827.
      092bc7ed
    • Roman Khabibov's avatar
      say: fix assertion in log_format when called for boot or syslog logger · 6bcff2b5
      Roman Khabibov authored
      It's OK to use json format with the boot logger. As for syslog, let's
      add a check to Lua's log_format() so that it fails gracefully rather
      than raising an assertion.
      
      Closes #3946
      6bcff2b5
    • Georgy Kirichenko's avatar
      Abort vinyl index creation in case of truncation rollback · 297d51e8
      Georgy Kirichenko authored
      Abort a new index creation if truncate couldn't be finished because of
      rollback or an error. Without this vinyl fails because of internal
      scheduler assertion.
      
      Needed for: 2798
      297d51e8
    • Kirill Shcherbatov's avatar
      test: check hints corner cases · f5721edc
      Kirill Shcherbatov authored
      We must to enshure that hints don't broke tuple comparison.
      As different field_types use different routines to calculate hint,
      we must to ensure that the calculated values are compatible with
      each other.
      
      Also tested the corner cases for large double numbers, due to the
      fact that there may be additional difficulties in hint construction.
      
      Follow-up
          9fba29ab memtx: introduce tuple compare hint
      f5721edc
    • Kirill Shcherbatov's avatar
      box: allow box.session{.exists, .fd} without args · b4b45513
      Kirill Shcherbatov authored
      Allow to call box.session.exists() and box.session.fd() without
      any arguments. In such case, current session is used.
      The box.session.peer() already support such feature, so we need
      it to be consistent.
      
      Closes #4021
      b4b45513
    • Serge Petrenko's avatar
      test: fix long_row_timeout.test.lua failure in parallel mode · 17acae1f
      Serge Petrenko authored
      The test used to write big rows (20 mb in size), so when run in parallel
      mode, it put high load on the disk and processor, which made appliers
      time out multiple times during read, and caused the test to fail
      occasionally.
      So, instead of writing huge rows in test, introduce a new error
      injection restricting sio from reading more than a couple of bytes per
      request. This ensures that the test is still relevant and makes it a lot
      more lightweight.
      
      Closes #4062
      17acae1f
    • Kirill Shcherbatov's avatar
      box: fix Tarantool upgrade from 2.1.0 to 2.1.1 · 26978b0b
      Kirill Shcherbatov authored
      Tarantool could not start from the snapshot created by version
      2.1.0 because the new version 2.1.1 does not support the
      index.opts.sql index opt and stops the execution.
      Introduced a special state OPT_DEF_LEGACY macro to ignore legacy
      options and introduced migration code in upgrade.lua.
      26978b0b
    • Mergen Imeev's avatar
      sql: ban ANALYZE statement · 6c32309e
      Mergen Imeev authored
      At this point, an ANALYZE statement can lead to many problems. It
      was decided to temporarily ban this statement.
      
      Closes #4069
      6c32309e
    • Vladislav Shpilevoy's avatar
      swim: fix build on FreeBSD · 88892f13
      Vladislav Shpilevoy authored
      Close #4050
      88892f13
  6. 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
    • 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
  7. Mar 20, 2019
    • 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
  8. Mar 19, 2019
    • 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 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
    • 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
Loading