Skip to content
Snippets Groups Projects
  1. Feb 27, 2019
    • Mergen Imeev's avatar
      sql: remove SQL_*_BKPT macros · d223eb4c
      Mergen Imeev authored
      Macros SQL_*_BKPT were used in debug mode to log errors that
      occurred during the execution of VDBE. They are not used now.
      This patch removes them.
      
      Part of #3965
      d223eb4c
    • Mergen Imeev's avatar
      sql: remove test gh-3733-pragma.test.lua · 828b8b36
      Mergen Imeev authored
      @TarantoolBot document
      Title: changes in EXPLAIN and PRAGMA
      
      The most important change is that the column names for
      the result of the "EXPLAIN ...", "EXPLAIN QUERY PLAN ..."
      and "PRAGMA ..." commands are now defined.
      Example:
      box.cfg{listen = 3302}
      cn = require('net.box').connect(box.cfg.listen)
      cn:execute('EXPLAIN SELECT 1;')
      
      In addition, the 'case_sensitive_like', 'parser_trace' and
      'sql_default_engine' pragmas now return their values if
      they are executed without arguments. For the first two
      pragmas, this value is their state, and for the latter,
      the default engine currently set in SQL.
      Example:
      box.sql.execute('PRAGMA case_sensitive_like;')
      
      And the last change is that now the execution of the
      “PRAGMA” command without determining which pragma to
      execute returns status for all flag-type pragmas.
      Flag-type pragmas are pragmas that have TRUE or FALSE as
      status.
      Example:
      box.sql.execute('PRAGMA;')
      828b8b36
    • Mergen Imeev's avatar
      sql: set column types for EXPLAIN and PRAGMA · 617dda85
      Mergen Imeev authored
      Currently, EXPLAIN and PRAGMA do not set the column types for the
      result. This is incorrect, since any returned row must have a
      column type. This patch defines the types for these columns.
      
      Closes #3832
      617dda85
    • Mergen Imeev's avatar
      sql: get results of PRAGMA statement as result set · 1328a88d
      Mergen Imeev authored
      Currently box.sql.execute ('PRAGMA') returns nothing, but prints
      list of pragmas and their statuses to stdout. Such strategy is
      considered to be wrong since output of this command would be
      unavailable for users who redirect stdout, use net box connection
      etc. This patch makes the command to return result as the rest of
      SQL commands. The result contains only FLAG-type pragmas and their
      statuses.
      1328a88d
    • Mergen Imeev's avatar
      sql: fix "PRAGMA case_sensitive_like" result · 3c97df13
      Mergen Imeev authored
      Currently PRAGMA case_sensitive_like returns nothing. This seems
      wrong, since other similar pragmas return their status. Fixed in
      the current patch.
      3c97df13
    • Mergen Imeev's avatar
      sql: Show currently set sql_default_engine · 87d2163e
      Mergen Imeev authored
      After this patch, "PRAGMA sql_default_engine" called without
      arguments will return currently set sql_default_engine.
      87d2163e
    • Mergen Imeev's avatar
      sql: fix "PRAGMA parser_trace" result · b67cf078
      Mergen Imeev authored
      Currently PRAGMA parser_trace returns an empty table. This seems
      wrong, since other similar pragmas return their status. Fixed in
      the current patch.
      b67cf078
    • Mergen Imeev's avatar
      sql: remove unused macros from pragma.c and pragma.h · 13a5889b
      Mergen Imeev authored
      Some macros in pragma.c and pragma.h are obsolete because the
      values they are checking are no longer used or their usage makes
      no sense. Let's remove them.
      13a5889b
  2. Feb 26, 2019
    • Vladislav Shpilevoy's avatar
      Move 'core' and 'uuid' libs to src/lib · 3f5f59bb
      Vladislav Shpilevoy authored
      For the same reason why 'uri' was moved to src/lib - SWIM needs
      core and uuid, and SWIM will live in src/lib.
      
      This commit follows 'uri' relocation as a separate one because
      'uri' relocation required some changes in the files, moved by
      this commit.
      
      Needed for #3234
      3f5f59bb
    • Vladislav Shpilevoy's avatar
      Move 'http_parser' to src/lib · 63db1372
      Vladislav Shpilevoy authored
      Http_parser in fact does not depend on anything, even on the core.
      As a rule, such basic libraries are stored in src/lib.
      
      The patch is not necessary for anything, but it is a right thing
      to do, while some activity is happening there.
      63db1372
    • Vladislav Shpilevoy's avatar
      Remove dead dependency of http_parser on httpc · 8f695fc4
      Vladislav Shpilevoy authored
      Http_parser is a standalone library, which in fact does not
      require httpc. And because of that it is going to be moved into
      lib/http_parser.
      8f695fc4
    • Vladislav Shpilevoy's avatar
      Move 'uri' lib to src/lib/ · d735b6bf
      Vladislav Shpilevoy authored
      URI and core libraries are going to be used by SWIM, stored in
      src/lib. But src/lib can not depend on src/. This patch pushes
      URI library down to src/lib - the lowest level of source
      dependencies.
      
      Needed for #3234
      d735b6bf
  3. Feb 25, 2019
    • Kirill Shcherbatov's avatar
      memtx: introduce universal iterator_pool · f21edaed
      Kirill Shcherbatov authored
      Memtx uses separate mempools for iterators of different types.
      Due to the fact that there will be more iterators of different
      sizes in a series of upcoming changes, let's always allocate the
      iterator of the largest size.
      No changes have been made to the rtree iterators pool because the
      size of these structures is significantly larger.
      
      Needed for #3961
      f21edaed
    • Vladimir Davydov's avatar
      iproto: don't attempt to close socket if it was not open · 37b88314
      Vladimir Davydov authored
      This can't entail any consequences, because socket fd is set to -1 in
      this case, but this just looks a bit messy. Let's clean it up.
      
      Follow-up commit 305dbcf6 ("iproto: close socket explicitly before
      wal_dir at exit").
      37b88314
    • Nikita Pettik's avatar
      sql: re-enable ORDER BY field filter optimization · a7bbd70b
      Nikita Pettik authored
      When we replaced SQLite's ephemeral spaces with our ones, one
      optimization concerning ORDER BY clause was disabled. It allows to
      reduce number of fields in format of ephemeral space or sorter table.
      To illustrate how it works, consider example:
      
      CREATE TABLE t (id INT PRIMARY KEY, b INT);
      SELECT * FROM t ORDER BY b;
      
      To sort entries from t, ephemeral space with format [b, id, b] is
      created. One can see, that such format contains duplicate of b column.
      To avoid such situation, SQLite provides optimization which removes
      duplicates. Meanwhile, it doesn't change already set format of ephemeral
      (or sorter) space (and SQLite tolerates that format difference). That's
      why it was turned off. However, such optimization turns out to be not
      optional but required: some column values shouldn't be computed twice.
      For instance:
      
      SELECT random() AS x FROM t ORDER BY x;
      
      Without filtering fields from ephemeral space format, it would be like:
      [random(), random()]. In other words, results would be sorted by first
      call to random() function, but resulting set would consist of values
      given by second call of random(). So, to enable it, we should reduce
      field count in format of ephemeral space by number of matches between
      SELECT and ORDER BY column lists.
      
      Also, type of return value for random() function has been fixed.
      
      Closes #3783
      a7bbd70b
    • Kirill Shcherbatov's avatar
      memtx: hide index implementation details from header · 5be640a6
      Kirill Shcherbatov authored
      Refactored memtx_tree code so that memtx_tree.h, memtx_rtree.h,
      memtx_bitset.h, memtx_hash.h contained only the signature of the
      tree object constructor while all implementation details were in
      corresponding *.c files.
      
      Needed for #3961
      5be640a6
    • Kirill Shcherbatov's avatar
      lib: introduce BPS_TREE_IDENTICAL custom comparator · bb83a922
      Kirill Shcherbatov authored
      Introduce a macro BPS_TREE_IDENTICAL for BPS TREE class. This
      makes possible to define custom comparators for stucture-based
      leafs.
      Previously, a C++ comparison operator "!=" override was used for
      this purpose. Due to the fact that we are not going to rework on
      C++ C-only components of Tarantool like memtx_tree, we needed a
      way to make complex structures comparisons using preprocessor.
      
      Needed for #3961
      bb83a922
    • Kirill Shcherbatov's avatar
      lib: fix undef _api_name in bps_tree header · 250423ca
      Kirill Shcherbatov authored
      The bps_tree.h header defines the macro _api_name, but does not
      undefine it at the end. Fixed.
      250423ca
    • Ilya Kosarev's avatar
      iproto: close socket explicitly before wal_dir at exit · 305dbcf6
      Ilya Kosarev authored
      tarantool instance didn't close socket explicitly
      which could cause hot standby instance to fail to bind
      in case it tries to bind before socket is closed by OS.
      Now it is fixed by closing socket explicitly before wal_dir.
      
      Closes #3967
      305dbcf6
    • Roman Khabibov's avatar
      httpc: add checking of headers in httpc:request · 85e1d78b
      Roman Khabibov authored
      Add preprocessing of the request headers. Each header must be 'string' or 'table'
      with '__tostring' metamethod.
      
      Closes #3679
      85e1d78b
    • Cyrill Gorcunov's avatar
      lua/fiber: Fix abort on malformed join input · 404899d8
      Cyrill Gorcunov authored
      If I create a new fiber and the join to himself we get an abort:
      
       | tarantool> f = require('fiber')
       | ---
       | ...
       |
       | tarantool> f.join(f.self())
       | tarantool: src/fiber.c:407: fiber_join: Assertion `fiber->flags & FIBER_IS_JOINABLE' failed.
       | Aborted (core dumped)
      
      we should better throw an error.
      404899d8
    • Vladislav Shpilevoy's avatar
      salad: do not touch struct heap_node.pos in user's code · 2d1f841e
      Vladislav Shpilevoy authored
      The only goal of reading and writing heap_node.pos was checking
      if a node is now in a heap, or not. This commit encapsulates this
      logic into a couple of functions.
      2d1f841e
    • Roman Khabibov's avatar
      socket: throw error when size is negative in read()/sysread() · d6b42fd9
      Roman Khabibov authored
      Replace assert in socket:read() and add a check in socket:sysread()
      when the size is negative.
      
      Closes #3979
      d6b42fd9
    • Nikita Pettik's avatar
      sql: inherit global parameters for vinyl spaces · 9844102a
      Nikita Pettik authored
      It is possible to create vinyl tables, if pragma sql_default_engine is
      set to corresponding engine. However, such spaces don't inherit global
      vinyl-specific options which can be set by box.cfg{}. Lets fix it and
      during encoding of index options fetch appropriate configurations from
      cfg.
      
      Closes #3912
      9844102a
    • Nikita Pettik's avatar
      sql: raise integer overflow error during msgpack decode · 821d495d
      Nikita Pettik authored
      Since previous commit allows us to raise an error during msgpack decode
      inside VDBE, lets do this if decoded integer is out of
      [INT64_MIN, INT64_MAX] range and set "integer is overflowed" diagnostic
      message.
      
      Closes #3735
      Workaround for #3810
      821d495d
    • Nikita Pettik's avatar
      sql: refactor sqlVdbeMsgpackGet() · fd3d0847
      Nikita Pettik authored
      Tarantool allows to hold in INTEGER field values in range
      [INT64_MAX, UINT64_MAX], which is obviously larger than common int64_t
      range. In this regard, if value of integer field in range
      [INT64_MAX, UINT64_MAX] is presented in tuple (e.g. after insertion from
      Lua interface), then after decoding msgpack (during processing SQL
      query) its value won't fit into int64_t (which in turn is basic type
      used to hold integers inside VDBE memory). Now if this happens, instead
      of raising an overflow error, value is stored as floating point number
      (with precise loss, obviously). Such approach is considered to be messy
      and we are going to raise "integer overflow" error instead. To make this
      happen, lets firstly refactor sqlVdbeMsgpackGet() to make it return
      error code to indicate that something went wrong and move length of
      decoded part to output parameters. Codestyle fixes are included as well.
      
      Needed for #3735
      fd3d0847
    • Nikita Pettik's avatar
      sql: raise an integer overflow error during CAST · 95ca0bd7
      Nikita Pettik authored
      Before this patch, if integer overflow occurred during casting to
      integer, it was simply ignored. As a result, wrong results might take
      place. Lets check possible overflows before CAST conversion, and if it
      happens, raise an appropriate error.
      
      Part of #3735
      95ca0bd7
    • Nikita Pettik's avatar
      sql: raise an error if int is overflowed during math operations · 53a8ba87
      Nikita Pettik authored
      Before this patch, if integer was overflowed during math operations
      (OP_Add, OP_Subtract, OP_Multiply, OP_Divide), it would be implicitly
      converted and stored as floating point number. This is obviously wrong
      way to handle integer overflow errors. Instead, let's raise
      corresponding error.
      
      Part of #3735
      53a8ba87
    • Nikita Pettik's avatar
      sql: fix resulting type for concatenation operator · 7464491d
      Nikita Pettik authored
      Before this patch, resulting type of concatenation operator always was
      TEXT (i.e. type of memory cell containing result - MEM_Str). Lets fix it
      and return type depending on type of concatenation arguments: if both
      arguments are TEXT, then resulting type is TEXT; BLOB otherwise. Note
      that other options of combining types of arguments are illegal.
      
      Closes #3544
      7464491d
    • Nikita Pettik's avatar
      sql: allow only string-like arguments for concatenation · d8cfb800
      Nikita Pettik authored
      Original SQLite operator of concatenation accepts all types of
      arguments. If type of parameter is not TEXT, it is implicitly converted
      to TEXT (except for NULLs). That contradicts ANSI (it is regulated by
      [1]), so lets allow only TEXT and BLOB as argument type for
      concatenation.  Moreover, they both must be of the same type at the same
      time (i.e. both TEXT or BLOB).
      
      [1] SQL ANSI 2013, 9.5 Result of data type combination
      
      Part of #3544
      d8cfb800
    • Nikita Pettik's avatar
      sql: fix value of mask to map VDBE memory type · 17d1c6f1
      Nikita Pettik authored
      Accidentally, mask which is used to map type of VDBE memory cell into
      outer API types was replaced with MEM_TypeMask. But value of the latter
      is larger then possible values of VDBE memory cells types. Hence, if it
      is applied to memory cell, not only pure types is taken into
      consideration, but some additional flags (such as MEM_Zero) as well.
      Overall, it results in wrong type calculation for zeroed blobs, for
      instance. Lets return back previous mask.
      
      Follow-up #3698
      Needed for #3544
      17d1c6f1
    • Alexander Turenko's avatar
      lua-yaml: fix strings literals encoding in yaml · 4095e305
      Alexander Turenko authored
      yaml.encode() now wraps a string literal whose content is equal to a
      null or a boolean value representation in YAML into single quotes. Those
      literals are: 'false', 'no', 'true', 'yes', '~', 'null'.
      
      Reverted the a2d7643c commit to use single quotes instead of multiline
      encoding for 'true' and 'false' string literals.
      
      Follows up #3476
      Closes #3662
      Closes #3583
      4095e305
    • AKhatskevich's avatar
      lua-yaml: verify args in a consistent manner · e925356e
      AKhatskevich authored
      Use lua_is*() functions instead of explicit lua_gettop() checks in
      yaml.encode() and yaml.decode() functions.
      
      Behaviour changes:
      
      * yaml.decode(object, nil) ignores nil (it is consistent with encode
        behaviour).
      * yaml.encode() gives an usage error instead of "unsupported Lua type
        'thread'".
      * yaml.encode('', {}, {}) ignores 3rd argument (it is consistent with
        decode behaviour).
      e925356e
    • Serge Petrenko's avatar
      box: set readahead before replicaset sync · 99517b52
      Serge Petrenko authored
      Previously readahead was set after the instance synced with all existing
      masters. This could lead to a case when some client connections created
      rather early would start with default readahead value even when
      it was explicitly set to some value.
      So, start setting readahead before replicaset sync.
      
      Follow-up: #3958
      99517b52
    • Serge Petrenko's avatar
      iproto: update readahead in existing connections · 89ccc7a8
      Serge Petrenko authored
      Iproto connections keep old readahead values for input buffers even
      after box.cfg.readahead reconfiguration. This means that for the changes
      to take place for the old clients, they have to reconnect. Otherwise
      tarantool log will be spammed with 'readahead limit is reached' errors.
      
      To fix this, start updating input buffer size for iproto connections
      if needed every time the buffer is empty.
      
      Closes: #3958
      89ccc7a8
  4. Feb 24, 2019
  5. Feb 22, 2019
    • Vladimir Davydov's avatar
      vinyl: fix crash in run iterator due to uninitialized variable · 79bd523e
      Vladimir Davydov authored
      vy_run_iterator_seek left the return statement uninitialized under
      certain conditions. The branch in the code wasn't covered by any test,
      because it could only be triggered by an EQ SELECT following range
      coalescing, so we only saw it when a customer reported a crash.
      Fix it and improve vinyl/select_consistency test to cover this branch.
      79bd523e
    • Vladislav Shpilevoy's avatar
      salad: fix heap reserve() behaviour · b5448c95
      Vladislav Shpilevoy authored
      Reserve() function by definition should ensure that there is
      enough space to store something. But heap reserve() always just
      increases the capacity twice. Even if there was already enough
      memory. Check for not necessary realloc was done out of this
      function. This was wrong. The commit makes reserve() be real
      reserve().
      
      The commit is motivated not by pursue of justice, but by
      forthcoming usage of reserve() in SWIM module code.
      b5448c95
    • Vladislav Shpilevoy's avatar
      salad: make heap struct more friendly to use · e3d156cd
      Vladislav Shpilevoy authored
      Now heap API works with struct heap_node only, which forces a
      user to constantly call container_of. Such a code looks really
      awful. This commit makes heap taking and returning user defined
      structures, and removes container_of clue.
      
      It is worth noting, that the similar API rb-tree and b-tree
      have. Even rlist has its rlist_*_entry() wrappers, and mhash
      provides macroses to define your own value type.
      e3d156cd
    • Vladislav Shpilevoy's avatar
      Fix build · ca0baa9a
      Vladislav Shpilevoy authored
      ca0baa9a
Loading