Skip to content
Snippets Groups Projects
  1. Feb 25, 2019
    • 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
  2. Feb 24, 2019
  3. 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
    • Nikita Pettik's avatar
      sql: display decoded msgpack for EXPLAIN queries · 2e3a5b05
      Nikita Pettik authored
      During DDL routines we pass encoded space/index/trigger formats
      into msgpack to VDBE. EXPLAIN query displays arguments of each opcode of
      VDBE program in a readable format. So, lets decode arguments of OP_Blob
      opcode with subtype = _MSGPACK before displaying them. Also, lets
      enlarge static buffers for P4 operand value and opcode comment to fit
      decoded msgpack.
      
      What is more, it fixes buffer-overflow since before this patch operands
      of OP_Blob were treated as strings and passed to functions like strlen()
      (only during EXPLAIN query). On the other hand, generally speaking
      msgpack can come without null termination, or contain '\0' symbols in
      the middle of encoded array.
      
      Closes #3868
      2e3a5b05
    • Nikita Pettik's avatar
      sql: compute resulting collation for concatenation · 5e42fa66
      Nikita Pettik authored
      According to ANSI, result of concatenation operation should derive
      collation sequence from its operands. Now it is not true: result is
      always comes with no ("none") collation.
      
      In a nutshell[1], rules are quite simple:
      
      a) If some data type has an explicit collation EC1, then every data type
      that has an explicit collation shall have declared type collation that
      is EC1.  The collation derivation is explicit and the collation is EC1.
      
      b) If every data type has an implicit collation, then:
      
       - If every data type has the same declared type collation IC1, then
         the collation derivation is implicit and the collation is IC1.
      
       - Otherwise, the collation derivation is none.
      
      c) Otherwise, the collation derivation is none.
      
      [1] Read complete statement at chapter 9.5 Result of data type
      combinations, ANSI 2013, Part 2: Foundations.
      
      Closes #3937
      5e42fa66
    • Nikita Pettik's avatar
      sql: refactor sql_expr_coll and sql_binary_compare_coll_seq · d197d107
      Nikita Pettik authored
      Lets make sql_expr_coll() return error code. It is needed since we are
      going to use this function to detect operands of concatenation with
      incompatible collations. Hence, struct coll* has been moved to output
      parameters.  For the same reason lets make sql_binary_compare_coll_seq()
      return error code instead of struct coll*. The latter is really required
      only in one out of six usages, so lets remove it at all.
      
      Needed for #3947
      d197d107
    • Konstantin Osipov's avatar
      6630729e
    • Nikita Pettik's avatar
      sql: rfc for foreign keys · 4cb58437
      Nikita Pettik authored
      Part of #3271
      4cb58437
    • Konstantin Osipov's avatar
      sql: rename struct fkey and struct fkey_def · d7d613a2
      Konstantin Osipov authored
      Rename struct fkey and struct fkey_def to fk_constraint and
      fk_constraint_def respectively.
      Consistently use "fk" for foreign key variables, and fk_def for
      foreign key definition variables.
      
      Remove dependency of fkey.h on space.h.
      Enfore subject-verb-object naming in a few fk-related methods.
      d7d613a2
    • Konstantin Osipov's avatar
      Follow up on the patch adding transaction boundaries to xrow stream. · c9fadff3
      Konstantin Osipov authored
      Follow up on the patch adding transaction boundaries to xrow stream.
      Use tsn as an abbreviation for transaction identifier (transaction
      sequence number). It is an important enough concept to use a short and
      a convenient tag name for.
      Deploy the name across the code - in names and comments.
      Clarify comments.
      Still use box_txn_id() as API method since box_tsn() and box_txn() would
      be too easy to mistype.
      c9fadff3
    • Nikita Pettik's avatar
      sql: fix grammar for foreign key actions · c2bddf70
      Nikita Pettik authored
      SQLite grammar implementing foreign keys parsing is quite compact, but
      on the other hand it allows to define ON DELETE and ON UPDATE actions
      multiple times. For instance:
      
      ... REFERENCES t ON DELETE UPDATE ON DELETE RESTRICT;
      
      It makes no sense and contradicts original ANSI syntax. So, lets rework
      it a bit. Firstly, MATCH clause must come first, so we place it in
      independent rule. Then we remove ON INSERT clause, since there is no
      such opportunity at all. Finally, we have only 4 options to expose
      refargs (i.e. grammar rule to parse FK actions): ON UPDATE, ON DELETE,
      ON UPDATE ON DELETE, ON DELETE ON UPDATE. That's it.
      
      Closes #3475
      c2bddf70
  4. Feb 21, 2019
    • Georgy Kirichenko's avatar
      Journal transaction boundaries · 872d6f1f
      Georgy Kirichenko authored
      Append txn_id and is_commit to xrow_header structure, txn_id identifies
      transaction id on replica where transaction was started. As transaction id
      a lsn of the first row in the transaction is used. is_commit is set to true
      for the last row in a transaction.
      
      As encoding/deconding rule assumed:
       * txn_id encoded using transaction sequence number iproto field
         as IPROTO_TSN = lsn - txn_id,
       * is_commit packed into IPROTO_FLAGS field with a bit mask,
       * txn_id and is_commit are encoded only for multi-row transactions.
         So if we do not have txn_id after row decoding then this means that it
         is a single row transaction.
      
      These rules provide compatibility with previous xlog format as well
      as good compaction level.
      
      Needed for #2798
      872d6f1f
    • Vladimir Davydov's avatar
      vinyl: move vy_tuple_key_contains_null to generic code · bd0d43f0
      Vladimir Davydov authored
      The function doesn't require any knowledge of vinyl statement layout and
      can work on regular tuples. Let's rename it to tuple_key_contains_null,
      move its implementation to tuple_extract_key.cc, and declare it in
      key_def.h, as we do with other similar functions.
      bd0d43f0
    • Vladimir Davydov's avatar
      key_def: move cmp and hash functions declarations to key_def.h · 6df0ffa4
      Vladimir Davydov authored
      Most of them are already there - for instance see see tuple_extract_key
      and tuple_compare. Let's move the rest there too for consistency.
      6df0ffa4
    • Vladimir Davydov's avatar
      key_def: cleanup virtual function initialization · e49ffe9c
      Vladimir Davydov authored
       - Rename key_def_set_cmp to key_def_set_func, because it sets not only
         comparators these days.
       - Rename tuple_hash_func_set and tuple_extract_key_set to
         key_def_set_hash_func and key_def_set_extract_func, because it's more
         like subject-verb-object naming convention used throughout the code.
       - Introduce key_def_set_compare_func and use it instead of setting
         comparators explicitly in key_def.c.
      e49ffe9c
    • Vladimir Davydov's avatar
      vinyl: make vy_tuple_delete static · 4e6781ec
      Vladimir Davydov authored
      It isn't used anywhere outside vy_stmt.c.
      4e6781ec
    • Vladimir Davydov's avatar
      vinyl: use vy_lsm_env::empty_key where appropriate · 19de37d5
      Vladimir Davydov authored
      No need to allocate an empty key during DDL - we already have one
      preallocated in vy_lsm_env.
      19de37d5
    • Michał Durak's avatar
      lua: add 'chars' param to string.strip functions · 16f58830
      Michał Durak authored
      Add optional 'chars' parameter to string.strip, string.lstrip
      and string.rstrip for specifying the unwanted characters.
      Behavior modeled after the equivalent Python built-ins.
      
      Closes: #2977
      
      @TarantoolBot document
      Title: string.strip(inp, chars)
      Update the documentation for string.strip,
      string.lstrip and string.rstrip to reflect
      the addition of the optional param.
      16f58830
    • Mergen Imeev's avatar
      sql: add space name in error message · 61f9017f
      Mergen Imeev authored
      This patch adds space name to descriptions of some of new errors.
      Also it fixes name and description of a few errors.
      
      Part of #3965
      61f9017f
    • Vladislav Shpilevoy's avatar
      netbox: raise an error on a closed connection async call · eed866fb
      Vladislav Shpilevoy authored
      When a connection is closed, it should not allow any
      requests - async and not. But before this patch this error
      from netbox.perform_async_request was ignored.
      eed866fb
  5. Feb 18, 2019
    • Vladislav Shpilevoy's avatar
      test: add missing unit/sio.result · d306250e
      Vladislav Shpilevoy authored
      d306250e
    • Mergen Imeev's avatar
      sql: rework "no such object" and "object exists" errors · 2319caeb
      Mergen Imeev authored
      This patch reworks SQL errors of types "no such object" and
      "object exists". After this patch, these error will be set as
      Tarantool errors.
      
      Part of #3965
      2319caeb
    • Mergen Imeev's avatar
      sql: remove field suppressErr from struct sql · 7126d89f
      Mergen Imeev authored
      The suppressErr field was used to indicate that most of the errors
      during the parsing should be suppressed. There was only one
      feature that used it. After deleting this feature, it became
      obvious that this field had become unused and should be removed.
      
      The feature in question is: allow to use names and aliases from
      input in ORDER BY clause of UNION or INTERSECT. After deleting
      of this feature, requests like the one below become invalid:
      
      SELECT 1 AS a UNION ALL SELECT 2 AS b ORDER BY b;
      
      Part of #3965
      7126d89f
    • Stanislav Zudin's avatar
      sql: remove useless pragmas · 5a58d78a
      Stanislav Zudin authored
      The pragmas "query_only" and "read_uncommitted" didn't affect anything
      and were removed.
      Fixed an error in pragma index_list which caused a segmantation fault.
      pragma sql_default_engine accepts only strings.
      Thus pragma sql_default_engine('memtx') is a well-formed command,
      while pragma sql_default_engine(memtx) or
      pragma sql_default_engine("memtx") are considered as an ill-formed and
      raise an error.
      
      Closes #3733
      5a58d78a
    • Kirill Shcherbatov's avatar
      box: disable sparse optimization in box.tuple.new() · 1a4d8874
      Kirill Shcherbatov authored
      The box.tuple.new() used to call luamp_encode_tuple with
      default LUA serializer config 'luaL_msgpack_default'. This
      routine may consider an array to be excessively sparse when
        + encode_sparse_ratio > 0
        + max(table) > encode_sparse_safe
        + max(table) > count(table) * encode_sparse_ratio.
      Sparse optimization save memory via representing excessively
      sparse tuple as MP_MAP. But Tarantool tuple always must be
      MP_ARRAY so it is not relevant for box.tuple.new semantics.
      So it is disabled with encode_sparse_ratio = 0 in a new local
      serializer config.
      
      Closes #3882
      1a4d8874
  6. Feb 15, 2019
Loading