Skip to content
Snippets Groups Projects
  1. Nov 05, 2019
  2. Nov 01, 2019
  3. Oct 31, 2019
    • Vladislav Shpilevoy's avatar
      access: fix use-after-free of struct credentials · 430cb629
      Vladislav Shpilevoy authored
      Func_delete() called credentials_destroy() after
      func->vtab->destroy(). But appeared, that vtab->destroy() is
      actually delete, and it frees the func object. Now the func's
      owner credentials are destroyed before the function is freed.
      
      Closes #4597
      Follow up #2763
      
      (cherry picked from commit 330ea240)
      430cb629
  4. Oct 30, 2019
    • Vladislav Shpilevoy's avatar
      app: fix error messages for not specified parameters in argparse · 091ab9d4
      Vladislav Shpilevoy authored
      Argparse module stores unspecified parameter values as boolean
      true. It led to a problem, that a command line '--value' with
      'value' defined as a number or a string, showed a strange error
      message:
      
          Expected number/string, got "true"
      
      Even though a user didn't pass any value. Now it shows 'nothing'
      instead of '"true"'. That is clearer.
      
      Follow up #4076
      
      (cherry picked from commit c214d086)
      091ab9d4
    • Vladislav Shpilevoy's avatar
      app: fix boolean handling in argparse module · 77ba8a4d
      Vladislav Shpilevoy authored
      There was a complaint that tarantoolctl --show-system option is
      very hard to use. It incorrectly parsed passed values, and
      provided strange errors.
      
          tarantoolctl cat --show-system true
          Bad input for parameter "show-system". Expected boolean, got "true"
      
          tarantoolctl cat --show-system 1
          Bad input for parameter "show-system". Expected boolean, got "1"
      
          tarantoolctl cat --show-system=true
          Bad input for parameter "show-system". Expected boolean, got "true"
      
      First of all, appeared that the complaining people didn't read
      documentation in 'tarantoolctl --help'. It explicitly says, that
      '--show-system' should go after a file name, and does not have a value.
      
      Secondly, even having taken the documentation into account, the
      errors indeed look ridiculous. 'Expected boolean, got "true"'
      looks especially weird.
      
      The problem appeared to be with argparse module, how it parses
      boolean parameters, and how stores parameter values not specified
      in a command line.
      
      All parameters were parsed into a dictionary: parameter name ->
      value. If a name is alone (no value), then it is boolean true.
      Otherwise it was always a string value. An attempt to specify
      an explicit parameter value 'true' led to storing string 'true'
      in that dictionary.
      
      Consequential check for boolean parameters was trivial:
      type(value) == 'boolean', which was obviously wrong, and didn't
      pass for 'true' string, but passed for an empty value.
      
      Closes #4076
      
      (cherry picked from commit 03f85d4c)
      77ba8a4d
    • Vladislav Shpilevoy's avatar
      access: update credentials without reconnect · b53bd593
      Vladislav Shpilevoy authored
      Credentials is a cache of user universal privileges. And that
      cache can become outdated in case user privs were changed after
      creation of the cache.
      
      The patch makes user update all its credentials caches with new
      privileges, via a list of all creds.
      
      That solves a couple of real life problems:
      
      - If a user managed to connect after box.cfg started listening
      port, but before access was granted, then he needed a reconnect;
      
      - Even if access was granted, a user may connect after box.cfg
      listen, but before access *is recovered* from _priv space. It
      was not possible to fix without a reconnect. And this problem
      affected replication.
      
      Closes #2763
      Part of #4535
      Part of #4536
      
      @TarantoolBot document
      Title: User privileges update affects existing sessions and objects
      Previously if user privileges were updated (via
      `box.schema.user.grant/revoke`), it was not reflected in already
      existing sessions and objects like functions. Now it is.
      
      For example:
      ```
              box.cfg{listen = 3313}
              box.schema.user.create('test_user', {password = '1'})
              function test1() return 'success' end
      
              c = require('net.box').connect(box.cfg.listen, {
                      user = 'test_user', password = '1'
              })
              -- Error, no access for this connection.
              c:call('test1')
      
              box.schema.user.grant('test_user', 'execute', 'universe')
              -- Now works, even though access was granted after
              -- connection.
              c:call('test1')
      ```
      
      A similar thing happens now with `box.session.su` and functions
      created via `box.schema.func.create` with `setuid` flag.
      
      In other words, now user privileges update is reflected
      everywhere immediately.
      
      (cherry picked from commit 06dbcec597f14fae6b3a7fa2361f2ac513099662)
      (cherry picked from commit 2b599c0efa9ae265fb7464af6abae3f6a192e30e)
      b53bd593
    • Vladislav Shpilevoy's avatar
      access: rework struct credentials API · 65083314
      Vladislav Shpilevoy authored
      Struct credentials is a cache of user's universal privileges. It
      is static and is never changed after creation. That is a problem.
      If a user privileges are updated, it is not reflected in his
      existing credentials caches.
      
      This patch reworks credentials API so as now this struct is not
      just a container for several numbers. It is an object with
      standard methods like create(), destroy(). A credentials object
      still is not updated together with its source user, but now at
      least the API allows to fix that.
      
      Next patch will link all struct credentials of a user into a list
      via which the user will be able to keep the credentials up to
      date.
      
      Part of #2763
      
      (cherry picked from commit a8c3ebdbfc97b72832ebc5d87b681a310cce9589)
      (cherry picked from commit 6b15dce614cfc3b14a12b66819737263a5089eaf)
      65083314
  5. Oct 28, 2019
    • Alexander Turenko's avatar
      test: update test-run · a1bfd1b7
      Alexander Turenko authored
      Added --exclude option (#54).
      
      (cherry picked from commit c17c10a4)
      Unverified
      a1bfd1b7
    • Alexander Turenko's avatar
      build: pass path to toolchain for luajit and curl · 8fdd19fb
      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.
      
      (cherry picked from commit 1eead75e)
      8fdd19fb
    • Alexander Turenko's avatar
      build: fix OpenSSL linking problems on FreeBSD · 2360401c
      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.
      
      (cherry picked from commit ea5929db)
      2360401c
    • Vladislav Shpilevoy's avatar
      replication: auto reconnect if password is invalid · 86e5514d
      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
      
      (cherry picked from commit aa2e2c56)
      86e5514d
    • Vladislav Shpilevoy's avatar
      replication: use strict order for replication settings · c17a28fd
      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
      
      (cherry picked from commit 00c6c437)
      c17a28fd
    • Vladislav Shpilevoy's avatar
      box: raise an error on nil replicaset and instance uuid · ff7d8f86
      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
      
      (cherry picked from commit a8ebd334)
      ff7d8f86
  6. Oct 24, 2019
  7. Oct 23, 2019
  8. Oct 21, 2019
  9. Oct 17, 2019
  10. Oct 15, 2019
    • Alexander Turenko's avatar
      test: update test-run · af7a8aba
      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.
      
      (cherry picked from commit 18864835)
      Unverified
      af7a8aba
  11. Oct 12, 2019
    • Vladislav Shpilevoy's avatar
      replication: recfg with 0 quorum returns immediately · cb4d0fcd
      Vladislav Shpilevoy authored
      Replication quorum 0 not only affects orphan status, but also,
      according to documentation, makes box.cfg() return immediately
      regardless of whether connections to upstreams are established.
      
      It was not so before the patch. What is worse, even with non 0
      quorum the instance was blocked on reconfiguration for connect
      timeout seconds, if at least one node is not connected.
      
      Now quorum is respected on reconfiguration. On a bootstrap it is
      still impossible to return earlier than
      replication_connect_timeout, because nodes need to choose some
      cluster settings. Too early start would make it impossible -
      cluster's participants will just start and choose different
      cluster UUIDs.
      
      Closes #3760
      
      (cherry picked from commit c6bea65f)
      cb4d0fcd
  12. Oct 09, 2019
    • Serge Petrenko's avatar
      replication: add is_orphan field to ballot · 17958322
      Serge Petrenko authored
      A successfully fetched remote instance ballot isn't updated during
      bootstrap procedure. This leads to a case when different instances
      choose different masters as their bootstrap leaders.
      
      Imagine such a situation.
      You start instance A without replication set up. Instance A successfully
      bootstraps.
      You also have instances B and C both with replication set up to {A, B,
      C} and replication_connect_quorum set to 3
      You first start instance B. It doesn't proceed to choosing a leader
      until one of the events happens: either the replication_connect_timeout
      runs out, or instance C is up and starts listening on its port.
      B has established connection to A and fetched its ballot, with some
      vclock, say, {1: 1}.
      B retries connection to C every replication_timeout seconds.
      Then you start instance C. Instance C succeeds in connecting to A and B
      right away and bootstraps from instance A. Instance A registers C in its
      _cluster table. This registration is replicated to instance C.
      Meanwhile, instance C is trying to sync with quorum instances (which is
      3), and stays in orphan mode.
      Now replication_timeout on instance B finally runs out. It retries a
      previously unsuccessful connection to C and succeeds. C sends its ballot
      to B with vclock = {1: 2, 2:0} (in our example), since it has already
      incremented it after _cluster registration.
      B sees that C has a greater vclock than A, and chooses to bootstrap from
      C instead of A. C is orphan and rejects B's attempt to join. B dies.
      
      To fix such ungentlemanlike behaviour of C, we should at least include
      loading status in ballot and prefer fully bootstrapped instances to the
      ones still syncing with other replicas.
      We also need to use a separate flag instead of ballot's already existent
      is_ro, since we still want to prefer loading instances over the ones
      explicitly configured to be read-only.
      
      Closes #4527
      
      (cherry picked from commit dc1e4009)
      17958322
    • Kirill Yukhin's avatar
      luajit: freeBSD/x64: avoid changing resource limits, if not needed · e321e679
      Kirill Yukhin authored
      (cherry picked from commit 8749b3e1)
      e321e679
    • Cyrill Gorcunov's avatar
      box/console: Fix missing variable declaration · 9357d13f
      Cyrill Gorcunov authored
      
      During rework of the console lua mode series
      the declaration of variable has been lost and
      this cause test case for remote unix console
      connection to fail.
      
      Fixes issue from c358398c
      
      Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
      (cherry picked from commit df821d0f)
      9357d13f
  13. Oct 04, 2019
Loading