Skip to content
Snippets Groups Projects
  1. Dec 11, 2019
  2. Dec 10, 2019
    • Vladislav Shpilevoy's avatar
      func: fix not unloading of unused modules · ca07088c
      Vladislav Shpilevoy authored
      C functions are loaded from .so/.dylib dynamic libraries. A
      library is loaded when any function from there is called first
      time. And was supposed to be unloaded, when all its functions are
      dropped from the schema (box.schema.func.drop()), and none of them
      is still in a call. But the unloading part was broken.
      
      In fact, box.schema.func.drop() never unloaded anything. Moreover,
      when functions from the module were added again without a restart,
      it led to a second mmap of the same module. And so on, the same
      library could be loaded any number of times.
      
      The problem was in a useless flag in struct module preventing its
      unloading even when it is totally unused. It is dropped.
      
      Closes #4648
      ca07088c
    • Vladislav Shpilevoy's avatar
      errinj: provide 'get' method in Lua · c3c6d3fc
      Vladislav Shpilevoy authored
      Error injections are used to simulate an error. They are
      represented as a flag, or a number, and are used in Lua tests. But
      they don't have any feedback. That makes impossible to use the
      injections to check that something has happened. Something very
      needed to be checked, and impossible to check in a different way.
      
      More certainly, the patch is motivated by a necessity to count
      loaded dynamic libraries to ensure, that they are loaded and
      unloaded when expected. This is impossible to do in a platform
      independent way. But an error injection as a debug-only counter
      would solve the problem.
      
      Needed for #4648
      c3c6d3fc
    • Vladislav Shpilevoy's avatar
      Fix build on Mac with gcc and XCode 11 · 16c40444
      Vladislav Shpilevoy authored
      There is a bug in XCode 11 which makes some standard C headers
      not self sufficient when compile with gcc. At least <stdlib.h> and
      <algorithm> are affected. When they are included first,
      compilation fails with creepy errors like this:
      
          In file included
          from /Applications/Xcode.app/Contents/Developer/
              Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
              sys/wait.h:110,
          from /Applications/Xcode.app/Contents/Developer/
              Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
              stdlib.h:66,
          from tarantool/third_party/zstd/lib/common/zstd_common.c:16:
              /Applications/Xcode.app/Content/Developer/
              Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
              sys/resource.h:
          In function 'getiopolicy_np': /Applications/Xcode.app/Contents/Developer/
              Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
              sys/resource.h:447:34: error:
                  expected declaration specifiers before '__OSX_AVAILABLE_STARTING'
                  447 | int     getiopolicy_np(int, int)
                  __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
      
      The patch workarounds the bug by deleting the buggy header
      includes where possible, and by changing include order in other
      cases.
      
      Also there was a second compilation problem. This was about
      different definitions of the same standard functions: via extern
      "C" and without. It looked like this:
      
          In file included from tarantool/src/trivia/util.h:36,
          from tarantool/src/tt_pthread.h:35,
          from tarantool/src/lib/core/fiber.h:38,
          from tarantool/src/lib/core/coio.h:33,
          from tarantool/src/lib/core/coio.cc:31:
          /usr/local/Cellar/gcc/9.2.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.2.0
          include-fixed/stdio.h:222:7: error: conflicting declaration of
          'char* ctermid(char*)' with 'C' linkage
            222 | char *ctermid(char *);
                |       ^~~~~~~
      
          In file included from /Applications/Xcode.app/Contents/Developer/Platforms/
          MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:525,
          from tarantool/src/lib/core/fiber.h:37,
          from tarantool/src/lib/core/coio.h:33,
          from tarantool/src/lib/core/coio.cc:31:
          /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
          Developer/SDKs/MacOSX.sdk/usr/include/_ctermid.h:26:10: note: previous
          declaration with 'C++' linkage
            26 | char    *ctermid(char *);
               |          ^~~~~~~
      
      This bug is workarounded by deletion of the conflicting includes,
      because anyway they appeared to be not needed.
      
      Closes #4580
      
      Conflicts:
      	third_party/decNumber
      16c40444
    • Chris Sosnin's avatar
      box: remove unicode_ci for functions · f88f9731
      Chris Sosnin authored
      Unicode_ci collation breaks the general
      rule for objects naming, so we remove it
      in version 2.3.1
      
      Closes #4561
      f88f9731
  3. Dec 05, 2019
  4. Dec 02, 2019
    • Ilya Kosarev's avatar
      test: stabilize quorum test conditions · f6775e86
      Ilya Kosarev authored
      There were some pass conditions in quorum test which could take some
      time to be satisfied. Now they are wrapped using test_run:wait_cond to
      make the test stable.
      
      Closes #4586
      f6775e86
    • Ilya Kosarev's avatar
      replication: make anon replicas iteration safe · 6f038f4b
      Ilya Kosarev authored
      In replicaset_follow we iterate anon replicas list: list of replicas
      that haven't received an UUID. In case of successful connect replica
      link is being removed from anon list. If it happens immediately,
      without yield in applier, iteration breaks. Now it is fixed by
      rlist_foreach_entry_safe instead of common rlist_foreach_entry.
      Relevant test case is added.
      
      Part of #4586
      Closes #4576
      Closes #4440
      6f038f4b
  5. Nov 26, 2019
    • Vladislav Shpilevoy's avatar
      iproto: don't destroy a session during disconnect · 6da9d395
      Vladislav Shpilevoy authored
      Binary session disconnect trigger yield could lead to use after
      free of the session object. That happened because iproto thread
      sent two requests to TX thread at disconnect:
      
          - Close the session and run its on disconnect triggers;
      
          - If all requests are handled, destroy the session.
      
      When a connection is idle, all requests are handled, so both these
      requests are sent. If the first one yielded in TX thread, the
      second one arrived and destroyed the session right under the feet
      of the first one.
      
      This can be solved in two ways - in TX thread, and in iproto
      thread.
      
      Iproto thread solution (which is chosen in the patch): just don't
      send destroy request until disconnect returns back to iproto
      thread.
      
      TX thread solution (alternative): add a flag which says whether
      disconnect is processed by TX. When destroy request arrives, it
      checks the flag. If disconnect is not done, the destroy request
      waits on a condition variable until it is.
      
      The iproto is a bit tricker to implement, but it looks more
      correct.
      
      Closes #4627
      6da9d395
  6. Nov 21, 2019
    • Vladislav Shpilevoy's avatar
      replication: use empty password by default · 6c01ca48
      Vladislav Shpilevoy authored
      Replication's applier encoded an auth request with exactly the
      same parameters as extracted by the URI parser. I.e. when no
      password was specified, the parser returned it as NULL, and it was
      not encoded. The relay, received such an auth request, complained
      that IPROTO_TUPLE field is not specified (this is password).
      
      Such an error confuses - a user didn't do anything illegal, he
      just used URI like 'login@host:port', without a password after the
      login.
      
      The patch makes the applier use an empty string as a default
      password.
      
      An alternative was to force a user always set a password even if
      it is an empty string, like that: 'login:@host:port'. And if a
      password was not found in an auth request, then reject it with a
      password mismatch error. But in that case a URI of kind
      'login@host:port' becomes useless - it can never pass. In
      addition, netbox already uses an empty string as a default
      password. So the only way to make it consistent, and don't break
      anything - repeat netbox logic for replication URIs.
      
      Closes #4605
      
      Conflicts:
      	test/replication/suite.cfg
      6c01ca48
    • Vladislav Shpilevoy's avatar
      replication: show errno in replication info · 691715b5
      Vladislav Shpilevoy authored
      Box.info.replication shows applier/relay's latest error message.
      But it didn't include errno description for system errors, even
      though it was included in the logs. Now box.info shows the errno
      description as well, when possible.
      
      Closes #4402
      
      Conflicts:
      	test/replication/suite.cfg
      691715b5
    • Vladislav Shpilevoy's avatar
      error: move errno into an error object · 22bbb34f
      Vladislav Shpilevoy authored
      The only error type having an errno as a part of it was
      SystemError (and its descendants SocketError, TimedOut, OOM, ...).
      That was used in logs (SystemError::log() method), and exposed to
      Lua (if type was SystemError, an error object had 'errno' field).
      
      But actually errno might be useful not only there. For example,
      box.info.replication exposes the latest error message of
      applier/relay as 'message' field of 'upstream/downstream' fields,
      lacking errno description.
      
      Before the patch it was impossible to obtain an errno code from C,
      because it was necessary to check whether an error has SystemError
      type, cast to SystemError class, and call SystemError::get_errno()
      method.
      
      Now errno is available as a part of struct error object (available
      from C), and is not 0 for system errors.
      
      Part of #4402
      22bbb34f
    • Vladislav Shpilevoy's avatar
      access: fix invalid error type for not found user · 3a8adccf
      Vladislav Shpilevoy authored
      Box.session.su() raised 'SystemError' when a user was not found
      due to a too long user name. That was obviously wrong, because
      SystemError is always something related to libraries (standard,
      curl, etc), and it has an errno code.
      
      Now a ClientError is raised.
      3a8adccf
    • Serge Petrenko's avatar
      app/fiber: wait till a full event loop iteration ends · 7990d1fa
      Serge Petrenko authored
      fiber.top() fills in statistics every event loop iteration,
      so if it was just enabled, fiber.top() returns zero in fiber cpu
      usage statistics because total time consumed by the main thread was
      not yet accounted for.
      Same stands for viewing top() results for a freshly created fiber:
      its metrics will be zero since it hasn't lived a full ev loop iteration
      yet.
      Fix this by delaying the test till top() results are meaningful and add
      minor refactoring.
      
      Follow-up #2694
      7990d1fa
  7. Nov 15, 2019
  8. Nov 14, 2019
    • Alexander Turenko's avatar
      app/argparse: expect no value for a boolean option · e47f2c91
      Alexander Turenko authored
      
      Before commit 03f85d4c ('app: fix
      boolean handling in argparse module') the module does not expect a value
      after a 'boolean' argument. However there was the problem: a 'boolean'
      argument can be passed only at end of an argument list, otherwise it
      wrongly consumes a next argument and gives a confusing error message.
      
      The mentioned commit fixes this behaviour in the following way: it still
      allows to pass a 'boolean' argument at end of the list w/o a value, but
      requires a value ('true', 'false', '1', '0') if a 'boolean' argument is
      not at the end to be provided using {'--foo=true'} or {'--foo', 'true'}
      syntax.
      
      Here this behaviour is changed: a 'boolean' argument does not assume an
      explicitly passed value despite its position in an argument list. If a
      'boolean' argument appears in the list, then argparse.parse() returns
      `true` for its value (a list of `true` values in case of 'boolean+'
      argument), otherwise it will not be added to the result.
      
      This change also makes the behaviour of long (--foo) and short (-f)
      'boolean' options consistent.
      
      The motivation of the change is simple: it is easier and more natural to
      type, say, `tarantoolctl cat --show-system 00000000000000000000.snap`
      then `tarantoolctl cat --show-system true 00000000000000000000.snap`.
      
      This commit adds several new test cases, but it does not mean that we
      guarantee that the module behaviour will not be changed around some
      corner cases, say, handling of 'boolean+' arguments. This is internal
      module.
      
      Follows up #4076.
      Reviewed-by: default avatarVladislav Shpilevoy <v.shpilevoy@tarantool.org>
      Unverified
      e47f2c91
  9. Nov 12, 2019
    • Vladislav Shpilevoy's avatar
      access: forbid to drop admin's universe access · 2de398ff
      Vladislav Shpilevoy authored
      Bootstrap and recovery work on behalf of admin. Without the
      universe access they are not able to even fill system spaces with
      data.
      
      It is better to forbid this ability until someone made their
      cluster unrecoverable.
      2de398ff
    • Vladislav Shpilevoy's avatar
      replication: don't drop admin super privileges · 95237ac8
      Vladislav Shpilevoy authored
      The admin user has universal privileges before bootstrap or
      recovery are done. That allows to, for example, bootstrap from a
      remote master, because to do that the admin should be able to
      insert into system spaces, such as _priv.
      
      But after the patch on online credentials update was implemented
      (#2763, 48d00b0e) the admin could
      loose its universal access if, for example, a role was granted to
      him before universal access was recovered.
      
      That happened by two reasons:
      
          - Any change in access rights, even in granted roles, led to
            rebuild of universal access;
      
          - Any change in access rights updated the universal access in
            all existing sessions, thanks to #2763.
      
      What happened: two tarantools were started. One of them master,
      granted 'replication' role to admin. Second node, slave, tried to
      bootstrap from the master. The slave created an admin session and
      started loading data. After it loaded 'grant replication role to
      admin' command, this nullified admin universal access everywhere,
      including this session. Next rows could not be applied.
      
      Closes #4606
      95237ac8
  10. Nov 11, 2019
  11. Nov 09, 2019
    • Serge Petrenko's avatar
      lua: add fiber.top() listing fiber cpu consumption · 77fa45bd
      Serge Petrenko authored
      Implement a new function in Lua fiber library: top(). It returns a table
      containing fiber cpu usage stats. The table has two entries:
      "cpu_misses" and "cpu". "cpu" itself is a table listing all the alive
      fibers and their cpu consumtion.
      The patch relies on CPU timestamp counter to measure each fiber's time
      share.
      
      Closes #2694
      
      @TarantoolBot document
      Title: fiber: new function `fiber.top()`
      
      `fiber.top()` returns a table of all alive fibers and lists their cpu
      consumption. Let's take a look at the example:
      ```
      tarantool> fiber.top()
      ---
      - cpu:
          107/lua:
            instant: 30.967324490456
            time: 0.351821993
            average: 25.582738345233
          104/lua:
            instant: 9.6473633128437
            time: 0.110869897
            average: 7.9693406131877
          101/on_shutdown:
            instant: 0
            time: 0
            average: 0
          103/lua:
            instant: 9.8026528631511
            time: 0.112641118
            average: 18.138387232255
          106/lua:
            instant: 20.071174377224
            time: 0.226901357
            average: 17.077908441831
          102/interactive:
            instant: 0
            time: 9.6858e-05
            average: 0
          105/lua:
            instant: 9.2461986412164
            time: 0.10657528
            average: 7.7068458630827
          1/sched:
            instant: 20.265286315108
            time: 0.237095335
            average: 23.141537169257
        cpu_misses: 0
      ...
      
      ```
      The two entries in a table returned by `fiber.top()` are
      `cpu_misses` and `cpu`.
      
      `cpu` itself is a table whose keys are strings containing fiber ids and
      names.
      The three metrics available for each fiber are:
      1) instant (per cent),
      which indicates the share of time fiber was executing during the
      previous event loop iteration
      2) average (per cent), which is calculated as an exponential moving
      average of `instant` values over all previous event loop iterations.
      3) time (seconds), which estimates how much cpu time each fiber spent
      processing during its lifetime.
      
      More info on `cpu_misses` field returned by `fiber.top()`:
      `cpu_misses` indicates the amount of times tx thread detected it was
      rescheduled on a different cpu core during the last event loop
      iteration.
      fiber.top() uses cpu timestamp counter to measure each fiber's execution
      time. However, each cpu core may have its own counter value (you can
      only rely on counter deltas if both measurements were taken on the same
      core, otherwise the delta may even get negative).
      When tx thread is rescheduled to a different cpu core, tarantool just
      assumes cpu delta was zero for the latest measurement. This loweres
      precision of our computations, so the bigger `cpu misses` value the
      lower the precision of fiber.top() results.
      
      Fiber.top() doesn't work on arm architecture at the moment.
      
      Please note, that enabling fiber.top() slows down fiber switching by
      about 15 per cent, so it is disabled by default.
      To enable it you need to issue `fiber.top_enable()`.
      You can disable it back after you finished debugging  using
      `fiber.top_disable()`.
      "Time" entry is also added to each fibers output in fiber.info()
      (it duplicates "time" entry from fiber.top().cpu per fiber).
      Note, that "time" is only counted while fiber.top is enabled.
      77fa45bd
    • Vladislav Shpilevoy's avatar
      tuple: rework updates to improve code extendibility · 8f7d9b8b
      Vladislav Shpilevoy authored
      Before the patch update was implemented as a set of operations
      applicable for arrays only. It was ok until field names and JSON
      paths appearance, because tuple is an array on the top level.
      
      But now there are four reasons to allow more complex updates of
      tuple field internals by JSON paths:
      
        - tuple field access by JSON path is allowed so for consistency
          JSON paths should be allowed in updates as well;
      
        - JSON indexes are supported. JSON update should be able to
          change an indexed field without rewriting half of a tuple, and
          its full replacement;
      
        - Tarantool is going to support documents in storage so JSON
          path updates is one more step forward;
      
        - JSON updates are going to be faster and more compact in WAL
          than get + in-memory Lua/connector update + replace (or update
          of a whole tuple field).
      
      The patch reworks the current update code in such a way, that now
      update is not just an array of operations, applied to tuple's top
      level fields. Now it is a tree, just like tuples are.
      
      The concept is to build a tree of xrow_update_field objects. Each
      updates a part of a tuple. Leafs in the tree contain update
      operations, specified by a user, as xrow_update_op objects.
      
      To make the code support and understanding simpler, the patch
      splits update implementation into several independent
      files-modules for each type of an updated field. One file
      describes how to update an array field, another file - how to
      update a map field, etc. This commit introduces only array. Just
      because it was already supported before the patch. Next commits
      will introduce more types one by one.
      
      Besides, the patch makes some minor changes, not separable from
      this commit:
      
        - The big comment about xrow updates in xrow_update.c is
          updated. Now it describes the tree-idea presented above;
      
        - Comments were properly aligned by 66 symbols in all the moved
          or changed code. Not affected code is kept as is so as not to
          increase the diff even more;
      
        - Added missing comments to moved or changed structures and
          their attributes such as struct xrow_update,
          struct xrow_update_op_meta, struct xrow_update_op.
      
        - Struct xrow_update_field was significantly reworked. Now it is
          not just a couple of pointers at tuple's top level array. From
          now it stores type of the updated field, range of its source
          data in the original tuple, and a subtree of other update
          fields applied to the original data.
      
        - Added missing comments to some functions which I moved and
          decided worth commenting alongside, such as
          xrow_update_op_adjust_field_no(), xrow_update_alloc().
      
        - Functions xrow_update_op_do_f, xrow_update_op_read_arg_f,
          xrow_update_op_store_f are separated from struct xrow_update,
          so as they could be called on any updated field in the tree.
          From this moment they are methods of struct xrow_update_op.
          They take an op as a first argument (like 'this' in C++), and
          are applied to a given struct xrow_update_field.
      
      Another notable, but not separable, change is a new naming schema
      for the methods of struct xrow_update_field and struct
      xrow_update_op. This is motivated by the fact that struct
      xrow_update_field now has a type, and might be not a terminal.
      
      There are now two groups of functions. Generic functions working
      with struct xrow_update_field of any type:
      
          xrow_update_field_sizeof
          xrow_update_field_store
          xrow_update_op_do_field_<operation>
      
      And typed functions:
      
          xrow_update_<type>_sizeof
          xrow_update_<type>_store
          xrow_update_op_do_<type>_<operation>
      
      Where
          operation = insert/delete/set/arith ...
               type = array/map/bar/scalar ...
      
      Common functions are used when type of a field to update is not
      known in advance. For example, when an operation is applied to one
      of fields of an array, it is not known what a type this field has:
      another array, scalar, not changed field, map, etc. Common
      functions do nothing more than just a switch by field type to
      choose a more specific function.
      
      Typed functions work with a specific type. They may change the
      given field (add a new array element, replace it with a new value,
      ...), or may forward an operation deeper in case they see that its
      JSON path is not fully passed yet.
      
      Part of #1261
      8f7d9b8b
    • Vladislav Shpilevoy's avatar
      tuple: rename tuple_update_* to xrow_update_* · 2f57b077
      Vladislav Shpilevoy authored
      That patch finishes transformation of tuple_update public API to
      xrow_update.
      
      Part of #1261
      2f57b077
    • Vladislav Shpilevoy's avatar
      tuple: rename tuple_update.c/h to xrow_update.c/h · 28c8d999
      Vladislav Shpilevoy authored
      Tuple_update is a too general name for the updates implemented
      in these files. Indeed, a tuple can be updated from Lua, from
      SQL, from update microlanguage. Xrow_update is a more specific
      name, which is already widely used in tuple_update.c.
      
      Part of #1261
      28c8d999
  12. Nov 08, 2019
  13. Nov 07, 2019
    • Vladislav Shpilevoy's avatar
      sql: make type string case lower everywhere · ee60d31d
      Vladislav Shpilevoy authored
      Type was displayed in error messages, was returned in
      meta headers, and a type string is a result of
      typeof() SQL function.
      
      Typeof() always returns lower case type string; meta
      contained upper case type; error messages contained
      both.
      
      It was necessary to choose one case for everything,
      and the lower one was chosen. It allows not to break
      typeof() function which actually might be used by
      someone.
      ee60d31d
  14. Nov 05, 2019
    • Vladislav Shpilevoy's avatar
      netbox: don't fire on_connect() at schema update · d56d869a
      Vladislav Shpilevoy authored
      There was a bug that netbox at any schema update called
      on_connect() triggers. This was due to overcomplicated logic of
      handling of changes in the netbox state machine. On_connect() was
      fired each time the machine entered 'active' state, even if its
      previous states were 'active' and then 'fetch_schema'. The latter
      state can be entered many times without reconnects.
      
      Another bug was about on_disconnect() - it could be fired even if
      the connection never entered active state. For example, if its
      first 'fetch_schema' has failed.
      
      Now there is an explicit flag showing the machine connect state.
      The triggers are fired only when it is changed, on 'active' and on
      any error states. Intermediate states (fetch_schema, auth) do not
      matter anymore.
      
      Thanks @mtrempoltsev for the initial investigation and a draft
      fix.
      
      Closes #4593
      d56d869a
  15. Nov 01, 2019
  16. Oct 30, 2019
    • Vladislav Shpilevoy's avatar
      sql: implicit boolean cast to text returns uppercase · c2be8458
      Vladislav Shpilevoy authored
      Explicit cast uses uppercase, and the patch makes the
      implicit cast the same.
      
      Upper case is the standard according to SQL standard
      2011, cast specification 6.13, general rules 11.e:
      
          General rules
      
          11) If TD is variable-length character string or
              large object character string, then let MLTD
              be the maximum length in characters of TD.
      
              e) If SD (source type) is boolean, then Case:
      
                  i)   If SV is True and MLTD is not less
                       than 4, then TV is 'TRUE'.
      
                  ii)  If SV is False and MLTD is not less
                       than 5, then TV is 'FALSE'.
      
                  iii) Otherwise, an exception condition is
                       raised: data exception — invalid
                       character value for cast.
      
      Part of #4462
      c2be8458
    • Vladislav Shpilevoy's avatar
      sql: LENGTH function accepts boolean · 86b0f21d
      Vladislav Shpilevoy authored
      Before the patch LENGTH didn't take boolean argument
      into account. Now it does and treats like any other
      non-string argument - stringify and calculate length.
      
      It is worth mentioning, that in future LENGTH will
      discard any non-string argument, see #3929.
      
      Part of #4462
      86b0f21d
    • Vladislav Shpilevoy's avatar
      app: fix error messages for not specified parameters in argparse · c214d086
      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
      c214d086
    • Vladislav Shpilevoy's avatar
      app: fix boolean handling in argparse module · 03f85d4c
      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
      03f85d4c
    • Vladislav Shpilevoy's avatar
      access: update credentials without reconnect · 48d00b0e
      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)
      48d00b0e
  17. Oct 28, 2019
    • 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
      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
Loading