Skip to content
Snippets Groups Projects
  1. Oct 28, 2019
    • Vladislav Shpilevoy's avatar
      rope: fix rope name template · 7fbaf728
      Vladislav Shpilevoy authored
      Rope is a library to define a custom rope data
      structure with specified type of a stored value, and
      some rope functions such as split, alloc.
      
      It is possible to choose a unique name for a defined
      rope structure. It was implemented as
      
          #define rope_api(x) rope_##rope_name##_##x
          #define rope rope_##rope_name
      
      But with such rope_api definition it was always
      expanded to `rope_rope_name_<x value>`. So rope_name
      was basically a constant 'rope_name' regardless what
      was defined under it.
      
      The patch fixes it and makes name generation just like
      bps_tree.h.
      
      Additionally, the name template is changed a bit, now
      it is
      
          <rope_name>_ + rope + _<method>
      
      instead of
      
          <rope> + _<rope_name>_ + <method>
      
      It just appeared to look better. For example, consider
      rope name 'xrow_update' and method 'size':
      
          new: xrow_update_rope_size()
          old: rope_xrow_update_size()
      
      The second name would be generated by the old template
      and looks wrong. The new name not only looks better,
      but also conforms with our code style.
      7fbaf728
    • Kirill Yukhin's avatar
      Fix on_msgpack_serializer_update signature · ba58c433
      Kirill Yukhin authored
      Now errors are returned using errcode in triggers
      and this functions wasn't updated to do so.
      It doesn't throw, so it set to return 0 unconditionally.
      ba58c433
    • Kirill Yukhin's avatar
      Update README.md · d9f3952e
      Kirill Yukhin authored
      Unverified
      d9f3952e
    • Alexander Turenko's avatar
      build: pass path to toolchain for luajit and curl · 1eead75e
      Alexander Turenko authored
      This allows to overcome problems when CMake chooses one toolchain to
      build tarantool, but a library (libluajit.a or libcurl.a) is built using
      another (incompatible) toolchain.
      
      Fixes #4587.
      1eead75e
    • Alexander Turenko's avatar
      build: fix OpenSSL linking problems on FreeBSD · ea5929db
      Alexander Turenko authored
      FreeBSD has OpenSSL as part of the base system: libraries are located in
      /usr/lib, headers are in /usr/include. However a user may install the
      library into /usr/local/{lib,include} from ports / pkg. In this case
      tarantool did choose /usr/local version, while libcurl will pick up a
      base system library. This is fixed by passing --with-ssl option with an
      argument (/usr/local or /usr if custom -DOPENSSL_ROOT_DIR=<...> is not
      passed).
      
      Now the behaviour is the following. If -DOPENSSL_ROOT_DIR=<...> is
      passed, then try to use OpenSSL from it. Otherwise find the library in
      /usr/local and then in /usr. This is right as for tarantool's crypto
      module as well as for libcurl submodule.
      
      There is a flaw here: a user is unable to choose a base system library
      if a ports / pkg version of OpenSSL is installed. The reason here is
      that tarantool's crypto module depends on other libraries and
      -I/usr/local/include may be added to build options. I have no good
      solution for that, so `cmake . -DOPENSSL_ROOT_DIR=/usr` will give a
      warning on FreeBSD and `gmake` likely will fail if libraries are of
      different versions (see cmake/os.cmake comments for more information).
      See also a [discussion][1] in FreeBSD community about all those /usr and
      /usr/local problems.
      
      There were two other problems that may fail tarantool build on FreeBSD:
      they are fixed in this commit and described below.
      
      First, libcurl's configure script chooses GCC by default if it exists
      (say, installed from ports / pkg). It is unexpected behaviour when
      tarantool sources itself are built with clang. Now it is fixed by
      passing a compiler explicitly to the libcurl's configure script: the
      library will use base system clang by default or one that a user pass to
      tarantool's cmake.
      
      Side note: GCC has /usr/local/include in its default headers search
      paths; libcurl's configure script chooses GCC as a compiler and OpenSSL
      from a base system by default (when CC and --with-ssl=<...> are not set)
      that leads to OpenSSL header / library mismatch. It is the primary
      reason of the build fail that was fixed in
      1f2338bd ('build: FreeBSD packages
      installation'). It is not much relevant anymore, because we don't try to
      link with a base system OpenSSL if /usr/local one exists (however if it
      is asked explicitly with -DOPENSSL_ROOT_DIR=<...> we'll do, but will
      give a warning). Anyway, it is important to know such details if we'll
      change build scripts in a future.
      
      Second, backtraces are not supported on FreeBSD, but were enabled if
      libunwind headers is found. This leads to an error on cmake stage,
      because of inability to find a right library (this is a bug). Now we
      disable backtraces on FreeBSD by default even if libunwind is found. See
      
      When CC is passed to libcurl's configure script, the new problem opens
      on Mac OS. CMake chooses XCode toolchain by default (at least on a
      particular system where I tried it), which requires -isysroot=<SDK_PATH>
      option to be passed to a preprocessor and a compiler in order to find
      system headers. See [2] for more information.
      
      [1]: https://wiki.freebsd.org/WarnerLosh/UsrLocal
      [2]: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035623
      
      Follows up #4490.
      ea5929db
    • Ilya Kosarev's avatar
      refactoring: remove exceptions from schema_find_grants · 372bb274
      Ilya Kosarev authored
      schema_find_grants is used in some triggers therefore it has to be
      cleared from exceptions. Now it doesn't throw any more.
      It's usages are updated.
      
      Part of #4247
      372bb274
    • Ilya Kosarev's avatar
      refactoring: clear privilege managing triggers from exceptions · 977fca29
      Ilya Kosarev authored
      modify_priv, revoke_priv & on_replace_dd_priv triggers are
      cleared from exceptions. A list of functions: priv_def_check,
      priv_def_create_from_tuple, user_grant_priv, user_reload_privs,
      rebuild_effective_grants, grant_revoke, role_check, role_grant,
      role_revoke, priv_grant, access_check_ddl & txn_alter_trigger_new
      were also refactored to achieve it. Their usages are updated.
      user_find_xc is removed as far as it is not needed anymore.
      
      Part of #4247
      977fca29
    • Ilya Kosarev's avatar
      refactoring: remove exceptions from replica_check_id · 2465cb0d
      Ilya Kosarev authored
      replica_check_id is used in on_replace_dd_cluster trigger
      therefore it has to be cleared from exceptions. Now it doesn't
      throw any more. It's usages are updated.
      
      Part of #4247
      2465cb0d
    • Ilya Kosarev's avatar
      refactoring: remove diag_raise and tnt_raise from triggers · 85215391
      Ilya Kosarev authored
      `tnt_raise` and `diag_raise` are now properly replaced with
      `diag_set` and `return -1` in alter.cc triggers.
      
      Part of #4247
      85215391
    • Ilya Kosarev's avatar
      refactoring: wrap incorrigibly throwing calls in try..catch block · e70f114e
      Ilya Kosarev authored
      Some functions called from triggers won't be cleared from
      exceptions within this patchset. They are wrapped in try..catch
      blocks.
      
      Part of #4247
      e70f114e
    • Ilya Kosarev's avatar
      refactoring: change trigger function signature to return an int · b8419953
      Ilya Kosarev authored
      Trigger function returning type is changed from void to int and
      any non-zero value means the trigger was processed with an error.
      A trigger can still raise an error - there is no more refactoring
      except obvious `diag_raise();' --> `return -1;' replacement.
      
      Prerequisites: #4247
      b8419953
    • Mergen Imeev's avatar
      tests: simplify test box/access_mist.test.lua · d61d468a
      Mergen Imeev authored
      Currently, the test shows all the data contained in the spaces
      _func, _user and _space. This was added 6 years ago and is no
      longer needed. In addition, this is inconvenient, as some data
      changes every time bootstrap.snap is created. Due to this, we must
      update the test result file every time we generate bootstrap.snap.
      This patch removes the display of this data from the test.
      d61d468a
    • Vladislav Shpilevoy's avatar
      replication: auto reconnect if password is invalid · aa2e2c56
      Vladislav Shpilevoy authored
      Before the patch there was a race in replication
      password configuration. It was possible that a replica
      connects to a master with a custom password before
      that password is actually set. The replica treated the
      error as critical and exited.
      
      But in fact it is not critical. Replica even can
      withstand absence of a user and keeps reconnecting.
      Wrong password situation arises from the same problem
      of non atomic configuration and is fixed the same -
      keep reconnect attempts if the password was wrong.
      
      Closes #4550
      aa2e2c56
    • Vladislav Shpilevoy's avatar
      key_def: key_def.new() accept both 'field' and 'fieldno' · 39918baf
      Vladislav Shpilevoy authored
      Closes #4519
      
      @TarantoolBot document
      Title: key_def.new() accept both 'field' and 'fieldno'
      
      Before the patch key_def.new() took an index part
      array as it is returned in <index_object>.parts: each
      part should include 'type', 'fieldno', and what else
      .parts element contains.
      
      But it was not possible to create a key_def from an
      index definition - the array passed to
      <space_object>.create_index() 'parts' argument. Because
      key_def.new() didn't recognize 'field' option. That
      might be useful, when a key_def is needed on a remote
      client, where a space object and its indexes do not
      exist. And it would be strange to force a user to
      create them just so as he would be able to access
      
          <net_box connection>.space.<space_name>.
              index.<index_name>.parts
      
      As well as it would be crutchy to make a user manually
      replace 'field' with 'fieldno' in its index definition
      just to create a key_def.
      
      Additionally, an ability to pass an index definition
      to a key_def constructor makes the API more symmetric.
      
      Note, that it still is not 100% symmetric, because a
      user can't pass field names to the key_def
      constructor. A space is needed for that anyway.
      39918baf
    • Vladislav Shpilevoy's avatar
      replication: use strict order for replication settings · 00c6c437
      Vladislav Shpilevoy authored
      The previous patch introduced a way to set box.cfg options
      in a strict order, even on a reconfiguration. It was used to set
      listen before replication.
      The same order problem existed for replication settings. A user
      could do
      
          box.cfg{
              replication_connect_quorum = 0,
              replication = {...}
          }
      
      and expect, that due to quorum 0 the cfg() will return
      immediately. But actually the behaviour was undefined - due to
      arbitrary order of keys in a Lua table, replication could be
      applied before quorum.
      
      The patch makes all replication settings be applied before
      replication.
      
      Follow up #4433
      Part of #3760
      00c6c437
    • Vladislav Shpilevoy's avatar
      box: raise an error on nil replicaset and instance uuid · a8ebd334
      Vladislav Shpilevoy authored
      Before the patch the nil UUID was ignored and a new random one
      was generated. This was because internally box treats nil UUID
      as its absence.
      
      Now a user will see an explicit message that nil UUID is a
      reserved value.
      
      Closes #4282
      a8ebd334
  2. Oct 24, 2019
    • Alexander V. Tikhonov's avatar
      travis-ci/gitlab-ci: add ubuntu 19.10 · c6cd2e62
      Alexander V. Tikhonov authored
      
      Added Ubuntu 19.10 Eoan Ermine into CI.
      
      Close #4583
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      Unverified
      c6cd2e62
    • Oleg Babin's avatar
      build: fix static build condition about testing · 8c85dbc7
      Oleg Babin authored
      
      Before this patch RUN_TESTS condition in Dockerfile.staticbuild was
      ignored and always was true.
      
      However adding of brackets solves only part of problem. If RUN_TESTS is
      empty `sh -c` returns 1 and build fails.
      
      However if we run tests we should fail build if tests are not passed.
      Ternary logic was rewritten to fair if-else.
      
      This patch fixes it and allows build tarantool statically without
      running tests.
      
      @Totktonada: Fixed .gitlab.mk to pass RUN_TESTS environment variable to
      docker build arguments.
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      Unverified
      8c85dbc7
    • Nikita Pettik's avatar
      sql: fix off-by-one error in QP · bb905d1d
      Nikita Pettik authored
      In scope of 8fac6972 it was fixed misbehavior while passing floating
      point values to integer iterator. Unfortunately, that patch introduced
      off-by-one error. Number of constraints (equalities and inequalities)
      can not be greater than number of key parts (obviously, each constraint
      can be tested against at most one index part). Inequality constraint can
      involve only field representing last key part. To get it number of
      constraints was used as index. However, since array is 0-based, the last
      key part should be calculated as parts[eq_numb - 1]. Before this patch
      it was parts[eq_numb].
      
      Closes #4558
      bb905d1d
    • Ilya Kosarev's avatar
      replication: cancel replica joining thread at exit · 12244ad9
      Ilya Kosarev authored
      If a tarantool instance exits while joining replica is in progress,
      the replica joining thread can access already freed data resulting
      in a crash. Let's fix this the same way we did for checkpoint thread
      - simply cancel the thread forcefully and wait for it to terminate.
      
      Closes #4528
      12244ad9
  3. Oct 23, 2019
  4. Oct 21, 2019
  5. Oct 20, 2019
    • Nikita Pettik's avatar
      sql: remove expmask from prepared statement · 8aa685fb
      Nikita Pettik authored
      expmask indicated necessity to recompile statement after parameter was
      bound: it might turn out that parameter can affect query plan. However,
      part of this mechanism has been removed long ago as a SQLite's legacy.
      In its current state expmask is likely to be useless and assertions
      involving it are obviously unsuitable. This patch completely removes
      expmask and related routines.
      
      Closes #4566
      8aa685fb
  6. Oct 17, 2019
  7. Oct 16, 2019
    • Kirill Shcherbatov's avatar
      sql: use name instead of function pointer for UDF · de9a7b1a
      Kirill Shcherbatov authored
      This patch changes OP_Function parameters convention: now a
      function's name is passed instead of pointer to the function
      object. This allows to normally handle the situation, when UDF
      has been deleted to the moment of the VDBE code execution.
      In particular case this may happen with CK constraints that
      refers to a deleted persistent function.
      
      Closes #4176
      de9a7b1a
    • Kirill Shcherbatov's avatar
      sql: add an ability to disable CK constraints · c4781f93
      Kirill Shcherbatov authored
      Closes #4244
      
      @TarantoolBot document
      Title: an ability to disable CK constraints
      
      Now it is possible to disable and enable ck constraints.
      All ck constraints are enabled by default when Tarantool is
      configured. Ck constraints checks are not performed during
      standard recovery, but performed during force_recovery -
      all conflicting tuples are skipped in case of ck_constraint
      conflict.
      
      To change CK constraint "is_enabled" state, call
      -- in LUA
      ck_obj:enable(new_state in {true, false})
      -- in SQL
      ALTER TABLE {TABLE_NAME} {EN, DIS}ABLE CHECK CONSTRAINT {CK_NAME};
      
      Example:
      box.space.T6.ck_constraint.ck_unnamed_T6_1:enable(false)
      box.space.T6.ck_constraint.ck_unnamed_T6_1
      - space_id: 512
        is_enabled: false
        name: ck_unnamed_T6_1
        expr: a < 10
      box.space.T6:insert({11})
      -- passed
      box.execute("ALTER TABLE t6 ENABLE CHECK CONSTRAINT \"ck_unnamed_T6_1\"")
      box.space.T6:insert({12})
      - error: 'Check constraint failed ''ck_unnamed_T6_1'': a < 10'
      c4781f93
    • Kirill Shcherbatov's avatar
      box: add an ability to disable CK constraints · 9a058bb2
      Kirill Shcherbatov authored
      Now it is possible to disable and enable ck constraints in LUA.
      This option is persistent. All ck constraints are constructed
      in enabled state when Tarantool is configured. This ability
      may be usefulwhen processed data is verified and constraints
      validation is not required. For instance, during casual recovery
      process there's no need to provide any checks since data is
      assumed to be consistent.
      
      Persisting is_enabled flag is an important feature.
      If the option is not stored the following scenario is
      possible:
      - the option is turned off
      - data is changed so that a constraint is violated
      - the system is restarted while the option state is lost
      - there is no way (even in theory) to discover it and find that
        data is incorrect.
      
      Part of #4244
      9a058bb2
  8. Oct 15, 2019
    • Alexander Turenko's avatar
      test: update test-run · 18864835
      Alexander Turenko authored
      test_run:wait_upstream() and test_run:wait_downstream() now wait until
      an upstream / a downstream appears. This prevents an attempt to index a
      nil value when one of those functions are called before a record about a
      peer appears in box.info.replication. It was observed on
      replication/show_error_on_disconnect test after commit
      c6bea65f ('replication: recfg with 0
      quorum returns immediately').
      
      Fixes #4563.
      Unverified
      18864835
    • Kirill Shcherbatov's avatar
      sql: remove redundant pointer in TriggerStep · a50be270
      Kirill Shcherbatov authored
      The trigger pointer in the sql_trigger structure is a dead code
      now, so it could be deleted.
      
      Needed for #4343
      a50be270
Loading