Skip to content
Snippets Groups Projects
  1. Dec 25, 2019
    • Nikita Pettik's avatar
      sql: refactor resulting set metadata · c017c5fa
      Nikita Pettik authored
      Move names and types of resulting set to a separate structure. Simplify
      their storage by introducing separate members for name and type
      (previously names and types were stored in one char * array). It will
      allow us to add new metadata properties with ease.
      
      Needed for #4407
      c017c5fa
  2. Dec 24, 2019
    • Nikita Pettik's avatar
      sql: allow nil to be returned from UDF · 1b39cbcf
      Nikita Pettik authored
      Any user defined function features assumed type of returned value
      (if it is not set explicitly during UDF creation, then it is ANY).
      After function's invocation in SQL, type of returned value is checked to
      be compatible with mentioned type of returned value specified in
      function's definition. It is done by means of
      field_mp_plain_type_is_compatible(). This functions accepts
      'is_nullable' arguments which indicates whether value can be nullable or
      not. For some reason 'is_nullable' is set to 'false' in our particular
      case. Hence, nils can't be returned from UDF for SCALAR types.
      
      Since there's no reason why nils can't be returned from UDFs,
      let's fix this unfortunate bug.
      1b39cbcf
    • Chris Sosnin's avatar
      sql: drop only generated sequence in DROP TABLE · a1155c8b
      Chris Sosnin authored
      It is possible to create a sequence manually, and give it to a newly
      created index as a source of unique identifiers. Such sequences are not
      owned by a space, and therefore shouldn't be deleted when the space is
      dropped. They are not dropped when space:drop() in Lua is called, but
      were dropped in SQL 'DROP TABLE' before this patch. Now Lua and SQL are
      consistent in that case.
      a1155c8b
    • Nikita Pettik's avatar
      sql: fix empty-body warning · 1d95fc04
      Nikita Pettik authored
      GCC features warning diagnostics which allows to detect wrong ; right
      after 'if' operator:
      
      if (X == Y); {
          ...
      }
      
      In this case despite evaluation of 'if' argument expression, statements
      after it will be always executed.
      
      According to our codestyle, we neglect bracers around 'if' body in case
      it consists of single statement and fits into one line. On the other
      hand, in SQL debug macros like VdbeComment() are defined as empty, so
      statements like:
      
      if (X)
          VdbeComment();
      
      turn into
      
      if (X) ;
      
      in release builds. As a result, we get 'false' warning (which is
      compilation error in -Werror mode). To fix it let's make VdbeComment()
      macros be non-empty in release mode and expand them into (void) 0.
      1d95fc04
    • Chris Sosnin's avatar
      sql: remove grants associated with the table · d2ea6e41
      Chris Sosnin authored
      Dropping table with sql removes everything associated with it but
      grants, which is inconsistent. Generating code for it fixes this bug.
      
      Closes #4546
      d2ea6e41
  3. Dec 23, 2019
    • Ilya Kosarev's avatar
      httpc: handle bad Content-Encoding with curl-7.67.0+ · e3432636
      Ilya Kosarev authored
      
      libcurl-7.66.0 and older returns CURLE_WRITE_ERROR when a server
      responds with unknown or unsupported Content-Encoding (see [1] and [2]).
      This was fixed in future libcurl-7.67.0 and proper
      CURLE_BAD_CONTENT_ENCODING code will be returned in this case.
      
      We should process the code in the same way as we do for
      CURLE_WRITE_ERROR.
      
      [1]: curl/curl#4310
      [2]: curl/curl#4449
      
      Closes #4579
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      e3432636
    • Ilya Kosarev's avatar
      httpc: add curl accept_encoding option · 48caaff9
      Ilya Kosarev authored
      CURLOPT_ACCEPT_ENCODING libcurl option is now supported. This option
      enables automatic decompression of HTTP responses.
      
      See https://curl.haxx.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html
      
      
      
      Closes #4232
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      
      @TarantoolBot document
      Title: httpc: add curl accept_encoding option
      
      Update the documentation for client_object:request() parameters to
      reflect new accept_encoding option.
      
      It enables automatic decompression of HTTP responses by setting the
      contents of the Accept-Encoding header sent in a HTTP request and
      enabling decoding of a response when a Content-Encoding header is
      received.
      
      This is a request, not an order; the server may or may not do it.
      Servers might respond with Content-Encoding even without getting an
      Accept-Encoding in the request. Servers might respond with a different
      Content-Encoding than what was asked for in the request.
      
      @param accept_encoding specifies what encoding you'd like. This param
      can be an empty string which means Accept-Encoding header will contain
      all built-in supported encodings. This param can be comma-separated list
      of accepted encodings, like: "br, gzip, deflate".
      
      Bundled libcurl supports "identity", meaning non-compressed, "deflate"
      which requests the server to compress its response using the zlib
      algorithm and "gzip" which requests the gzip algorithm. System libcurl
      also possibly supports "br" which is brotli.
      
      See https://curl.haxx.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html
      48caaff9
    • Ilya Kosarev's avatar
      httpc: fix assertion fail after curl write error · 728d08a6
      Ilya Kosarev authored
      
      After executing curl request we need to process curl_request code. It
      might be CURLE_WRITE_ERROR. We had special case for it, which assumed
      diagnostic message being set and contained corresponding assert, though
      it is incorrect. Better way is to handle it as any other non-standard
      event.
      
      It was discovered while adding accept_encoding option. In case of
      unknown encoding curl_request code is currently set to CURLE_WRITE_ERROR
      and therefore we come to an assert assuming we have some diagnostics
      set. However, it is not being set and it is totally fine. This means we
      are failing on assert and it is not correct behavior.
      
      Prerequisites: #4232
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      728d08a6
  4. Dec 19, 2019
    • Mergen Imeev's avatar
      lua/serializer: encode Lua number -2^63 as integer · 06aeb768
      Mergen Imeev authored
      This patch fixes a bug that appeared after commit
      3a13be1d ('lua: fix lua_tofield()
      for 2**64 value') .
      
      Due to this bug, -2^63 was serialized as double, although it
      should be serialized as integer.
      
      Closes #4672
      06aeb768
    • Vladislav Shpilevoy's avatar
      tuple: enable isolated JSON updates · 940133ae
      Vladislav Shpilevoy authored
      Isolated tuple update is an update by JSON path, which hasn't a
      common prefix with any other JSON update operation in the same
      set. For example, these JSON update operations are isolated:
      
          {'=', '[1][2][3]', 100},
          {'+', '[2].b.c', 200}
      
      Their JSON paths has no a common prefix. But these operations are
      not isolated:
      
          {'=', '[1][2][3]', 100},
          {'+', '[1].b.c', 200}
      
      They have a common prefix '[1]'.
      
      Isolated updates are a first part of fully functional JSON
      updates. Their feature is that their implementation is relatively
      simple and lightweight - an isolated JSON update does not store
      each part of the JSON path as a separate object. Isolated update
      stores just string with JSON and pointer to the MessagePack
      object to update.
      
      Such isolated updates are called 'bar update'. They are a basic
      brick of more complex JSON updates.
      
      Part of #1261
      940133ae
    • Oleg Babin's avatar
      httpc: consider "verbose" option correctly · 72613bb0
      Oleg Babin authored
      Before this patch if user passed {verbose = false}
      to http client it was considered as "true"
      
      This patch fixes such behaviour and takes into account
      user's value
      72613bb0
  5. Dec 17, 2019
    • Nikita Pettik's avatar
      sql: fix possible null dereference in sql_expr_coll() · 4c13972f
      Nikita Pettik authored
      Some built-in functions can accept different number of arguments.
      Check of argument count for such functions takes place right before
      its execution. So it is possible that expression-list representing
      arguments for built-in function is NULL. On the other hand, in
      sql_expr_coll() (which returns collation of expression) it is assumed
      that if function features SQL_FUNC_DERIVEDCOLL flag (it implies that
      resulting collation depends on collation of arguments) then it has at
      least one argument. The last assumption is wrong considering for example
      SUBSTR() function: it may have 1 or 2 arguments, so check of argument
      count doesn't occur during compilation. Hence, if it is required to
      calculate collation for SUBSTR() function and there's no arguments,
      Tarantool crashes due to null-dereference.
      This patch fixes this bug with one additional check in sql_expr_coll().
      4c13972f
    • Ilya Kosarev's avatar
      gitignore: add .idea path · afa692e5
      Ilya Kosarev authored
      
      JetBrains IDEs use .idea folder to store configuration files.
      To provide more comfort for it's users .idea folder should be ignored.
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      afa692e5
  6. Dec 16, 2019
    • Chris Sosnin's avatar
      build: GCC warning on strncpy · 49fa68a7
      Chris Sosnin authored
      As long as we are sure, that strlen(sd_unix_path) < sizeof(sa.sun_path)
      we can assume that there is always enough space and the path will be
      null-terminated. Thus, copy 1 byte less to get rid of the warning.
      
      Closes #4515
      49fa68a7
  7. Dec 11, 2019
    • Vladislav Shpilevoy's avatar
      test: update box/errinj.test.lua result file · eddc8cc0
      Vladislav Shpilevoy authored
      The test started failing after my commit:
      ca07088c
      (func: fix not unloading of unused modules), because I forgot to
      update the result file.
      
      Follow up #4648
      eddc8cc0
    • Mergen Imeev's avatar
      sql: allow to convert big real values to integer · 3abf3e7d
      Mergen Imeev authored
      This patch fixes a bug that prevented the conversion of real
      values that are greater than INT64_MAX and less than UINT64_MAX to
      INTEGER and UNSIGNED.
      
      Closes #4526
      3abf3e7d
    • Mergen Imeev's avatar
      sql: refactor sqlVdbeMemIntegerify() function · 65e9f9a1
      Mergen Imeev authored
      The sqlVdbeMemIntegerify() function accepts the is_forced flag as
      one of the arguments. But this flag is actually useless, because
      regardless of whether it is TRUE or FALSE, the function will do
      the same. This patch removes the is_forced argument from the
      function. There will be no test, since the result of the function
      has not changed.
      
      Part of #4526
      65e9f9a1
  8. Dec 10, 2019
    • Olga Arkhangelskaia's avatar
      lib: fix comment in coio_task.h · e6933207
      Olga Arkhangelskaia authored
      According to code coio_call does not take a timeout as an argument,
      however it was mentioned in the comment and usage example. This lead to
      error in documentation. The patch fixes it.
      
      Closes #4663
      e6933207
    • 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
    • Kirill Yukhin's avatar
      decNumber: bump new version · 2125b626
      Kirill Yukhin authored
      New commit fixes build on XCode 11.
      2125b626
    • Serge Petrenko's avatar
      backtrace: fix out of bounds access on backtrace printing · 2066f297
      Serge Petrenko authored
      snrpintf always null-terminates the passed string, and it also returns
      the number of bytes that "would have been written if there was enough
      space", so not only we don't have to null-terminate the string, but even
      more so we shouldn't do it erroneously. The only case when a string
      should be null-terminated manually is when the print cycle doesn't run
      at all, so move the termination before the cycle.
      
      Closes #4636
      2066f297
    • Serge Petrenko's avatar
      clear terminal state on panic · c6d4f010
      Serge Petrenko authored
      The tarantool_free() call in the end of main() works all the time except
      when we exit due to a panic. We need to clear terminal state in this
      case also, so return to using atexit() to clear readline state.
      
      Closes #4466
      c6d4f010
    • 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
  9. Dec 06, 2019
    • Alexander V. Tikhonov's avatar
      build: fix unit tests build with -lrt on CentOS 6 · 960e9c0c
      Alexander V. Tikhonov authored
      After the commit 77fa45bd
      ('lua: add fiber.top() listing fiber cpu consumption')
      the unit tests builds failed like:
      
      /opt/rh/devtoolset-6/root/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/ld:
        ../../src/lib/core/libcore.a(fiber.c.o): undefined reference to symbol
        'clock_gettime@@GLIBC_2.2.5'
      //lib64/librt.so.1: error adding symbols: DSO missing from command line
      collect2: error: ld returned 1 exit status
      test/unit/CMakeFiles/cbus.test.dir/build.make:108: recipe for target
        'test/unit/cbus.test' failed
      make[2]: *** [test/unit/cbus.test] Error 1
      
      Found that fiber.cc is using now clock_gettime(), which requires -lrt
      with glibc. To fix it added librt dependency for core library for glibc.
      Due to glibc requires for -lrt for clock_gettime() only for some
      versions, check 'man clock_gettime.2':
        'Link with -lrt (only for glibc versions before 2.17).'
      the check whether is able to use clock_gettime() w/o librt library is
      added.
      
      Close #4639
      
      (cherry picked from commit 99b0ef771135eab66ef3758371b1b5431e21cbff)
      960e9c0c
    • Chris Sosnin's avatar
      app: increase max recursion depth for encoding/decoding · bf20a7ce
      Chris Sosnin authored
      It was requested to be raised from 32 to 128
      
      Closes #4670
      bf20a7ce
  10. Dec 05, 2019
    • Vladislav Shpilevoy's avatar
      test: fix flaky box/gh-4627-session-use-after-free · 9643fdc7
      Vladislav Shpilevoy authored
      The problem was in that the test uses the global trigger
      box.session.on_disconnect() to set a global variable by one
      connection. But test-run can do multiple connects/reconnects to
      the same instance. That led to multiple invocations of
      box.session.on_disconnect(), which could override the global
      variable in unexpected ways and moments.
      
      The patch makes only one session execute that trigger.
      
      Probably related to https://github.com/tarantool/test-run/issues/46
      
      
      Follow up #4627
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      9643fdc7
    • Kirill Yukhin's avatar
      luajit: bump new a new version · e12930d0
      Kirill Yukhin authored
      List of changes
           - fold: keep type of emitted CONV in sync with its mode
           - test: adjust the test name related to PAIRSMM flag
      e12930d0
    • Olga Arkhangelskaia's avatar
      build: enables LUAJIT_ENABLE_PAIRSMM by default · 2110213c
      Olga Arkhangelskaia authored
      Turns on LUAJIT_ENABLE_PAIRSMM flag for tarantool build.
      Now __pairs/__ipairs metamethods are available.
      
      Closes #4650
      2110213c
    • Alexander V. Tikhonov's avatar
      build: add Fedora 31 into CI / CD · 9e09b07c
      Alexander V. Tikhonov authored
      Added build + test jobs in GitLab-CI and build + test + deploy jobs on
      Travis-CI for Fedora 31.
      
      Updated testing dependencies in the RPM spec to follow the new Python 2
      package naming scheme that was introduced in Fedora 31: it uses
      python2-' prefix rather then 'python-'.
      
      Fedora 31 does not provide python2-gevent and python2-greenlet packages,
      so they were pushed to https://packagecloud.io/packpack/backports
      repository. This repository is enabled in our build image
      (packpack/packpack:fedora-31) by default. Those dependencies are build-time,
      so nothing was changed for a user. The source RPM packages were gathered
      from https://rpms.remirepo.net/rpmphp/
      
      .
      
      Closes #4612
      
      Reviewed-by: default avatarAlexander Turenko <alexander.turenko@tarantool.org>
      9e09b07c
    • Alexander Turenko's avatar
      test: update test-run · 5fccf003
      Alexander Turenko authored
      Strengthen test_run:cmd() against temporary connection failures (#193).
      
      We recently added 'replication/box_set_replication_stress' test that may
      exceed file descriptor limit. When test_run:cmd() function executes a
      command ('switch master' in the case), it tries to create a new socket
      and connect it to test-run's inspector, but it may fail to do so in the
      case, because of the file descriptor limit.
      
      The sockets that the test produces are closed in background, so if we'll
      keep trying to create and connect a socket we'll succeed once. This is
      exactly that the test-run's patch doing: it fails test_run:cmd()
      function only if a socket cannot be connected during 100 seconds.
      
      I guess that the reason why sockets are not closed immediately is that
      relays wait until replicas will close its side of a socket and only then
      closes its side. Didn't investigate it deeper, to be honest.
      5fccf003
  11. Dec 03, 2019
    • Maria's avatar
      json: fix stack-use-after-scope in json_decode() · 6508ddb7
      Maria authored
      Inside json_decode() struct luaL_serializer is allocated on stack, but
      json context stores pointer to it:
      
         998	static int json_decode(lua_State *l)
         999	{
        ...
        1007	    if (lua_gettop(l) == 2) {
        1008	        struct luaL_serializer user_cfg = *luaL_checkserializer(l);
        1009	        luaL_serializer_parse_options(l, &user_cfg);
        1010	        lua_pop(l, 1);
        1011	        json.cfg = &user_cfg;
        1012      }
      
      Later (for instance in json_decode_descend()), it can be dereferenced
      which in turn results in stack-use-after-scope (object turns into
      garbage right after scope is ended). To fix it let's simply avoid
      allocating and copying luaL_serializer on stack and instead use pointer
      to it.
      
      Bug is found by ASAN: test app-tap/json.test.lua fails with enabled
      ASAN. Current fix allows to pass all tests.
      
      Thanks to @Korablev77 for the initial investigation.
      
      Closes #4637
      6508ddb7
  12. Dec 02, 2019
    • Alexander Turenko's avatar
      Revert "test: update test-run" · 4acdeeda
      Alexander Turenko authored
      This reverts commit a0b196dd.
      
      This commit was pushed occasionally and points to a draft commit in
      test-run repository. See also
      https://github.com/tarantool/test-run/issues/195
      4acdeeda
    • 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
    • Ilya Kosarev's avatar
      replication: fix appliers pruning · 36ff3c89
      Ilya Kosarev authored
      During pruning of appliers some anon replicas might connect
      from replicaset_follow called in another fiber. Therefore we need to
      prune appliers of anon replicas first and, moreover, prune them one by
      one instead of iterating them, as far as any of them might connect
      while we are stopping the other one and it will break iteration.
      
      Part of #4586
      Closes #4643
      36ff3c89
    • Ilya Kosarev's avatar
      test: update test-run · a0b196dd
      Ilya Kosarev authored
      Stabilize tcp_connect in test_run:cmd() (tarantool/test-run#193)
      a0b196dd
  13. Nov 27, 2019
Loading