Skip to content
Snippets Groups Projects
  1. Apr 14, 2020
    • Vladislav Shpilevoy's avatar
      box: export box_session_push to the public C API · 5d795527
      Vladislav Shpilevoy authored
      API is different from box.session.push() - sync argument was
      removed. It will disappear from Lua API as well, because it just
      is not needed here. Session is omitted as well. Indeed, a user
      can't push to a foreign session, and the current session can be
      obtained inside box_session_push(). And anyway session is not in
      the public C API.
      
      Internally dump into iproto is done using obuf_dup(), just like
      tuple_to_obuf() does. obuf_alloc() would be a bad call here,
      because it wouldn't be able to split the pushed data into several
      obuf chunks, and would cause obuf fragmentation.
      
      Dump into plain text behaves just like a Lua push - it produces a
      YAML formatted text or Lua text depending on output format. But to
      turn MessagePack into YAML or Lua text an intermediate Lua
      representation is used, because there are no a MessagePack -> YAML
      and MessagePack -> Lua text translators yet.
      
      Closes #4734
      
      @TarantoolBot document
      Title: box_session_push() C API
      
      There is a new function in the public C API:
      ```C
          int
          box_session_push(const char *data, const char *data_end);
      ```
      
      It takes raw MessagePack, and behaves just like Lua
      `box.session.push()`.
      5d795527
    • Leonid's avatar
      rocks: forward options to luarocks · ce8c6ef1
      Leonid authored
      The policy for check of luarocks flags has been changed
      (moved from tarantoolctl to luarocks).
      Chdir has been moved to luarocks.
      
      Closes #4629
      
      @TarantoolBot document
      Title: Update tarantoolctl rocks
      tarantoolctl rocks commands has been added:
      build
      config
      download
      init
      lint
      new_version
      purge
      which
      write_rockspec
      
      https://github.com/luarocks/luarocks/wiki/luarocks
      ce8c6ef1
  2. Apr 13, 2020
    • Chris Sosnin's avatar
      session: store output format in struct session · 9c0e40f9
      Chris Sosnin authored
      box.session.storage is a general-purpose table, which can be
      used by user. Therefore, we shouldn't store any internal details
      in it.
      
      Needed for #4686
      9c0e40f9
    • Chris Sosnin's avatar
      sql: provide a user friendly frontend for accessing session settings · 6706f659
      Chris Sosnin authored
      Currently if a user wants to change session setting with SQL, one has
      to execute UPDATE query like:
      [[UPDATE "_session_settings" SET "value" = true WHERE "name" = 'name']]
      However, direct access to system spaces isn't considered to be a good practice.
      To avoid that and a bit simplify user's life, we introduce SQL shortcut command
      SET SESSION.
      
      Closes #4711
      
      @TarantoolBot document
      Title: API for accessing _session_settings space.
      There are two ways of updating values of session settings:
      via Lua and SQL.
      
      Lua:
      box.session.settings is a table, which is always accessible
      to user. The syntax is the following:
      `box.session.settings.<setting_name> = <new_value>`.
      
      Example of usage:
      ```
      tarantool> box.session.settings.sql_default_engine
      ---
      - memtx
      ...
      
      tarantool> box.session.settings.sql_default_engine = 'vinyl'
      ---
      ...
      
      ```
      
      The table itself represents the (unordered) result of select
      from _session_settings space.
      
      SQL:
      Instead of typing long UPDATE query one can use the SET SESSION command:
      `box.execute([[SET SESSION "<setting_name>" = <new_value>]])`.
      Note, that this query is case sensitive so the name must be quoted.
      Also, SET SESSION doesn't provide any implicit casts, so <new_value> must
      be of the type corresponding to the setting being updated.
      
      Example:
      ```
      tarantool> box.execute([[set session "sql_default_engine" = 'memtx']])
      ---
      - row_count: 1
      ...
      
      tarantool> box.execute([[set session "sql_defer_foreign_keys" = true]])
      ---
      - row_count: 1
      ...
      
      ```
      6706f659
    • Serge Petrenko's avatar
      box: add MsgPack encoding/decoding for UUID · d68fc292
      Serge Petrenko authored
      A special format for encoding UUIDs to MsgPack is introduced.
      It is supported by both lua and C encoders/decoders, and it is now
      possible to insert UUIDs into spaces, but only into unindexed fields
      without format for now.
      
      Prerequisite #4268
      
      @TarantoolBot document
      Title: Internals: msgpack format for UUID
      
      UUID values share the MessagePack type with decimals:
      both use MP_EXT. A new subtype is introduced for UUIDs,
      MP_UUID = `0x02`
      UUID is encoded as follows:
      ```
          +--------+---------+-----------+
          | MP_EXT | MP_UUID | UuidValue |
          +--------+---------+-----------+
      ```
      Since UUID is 16 bytes in size, the header, MP_EXT, is always the same:
      `0xd8`. MP_UUID = `0x02` follows. The header is followed by the 16
      bytes of the UuidValue.
      
      UuidValue consists of 11 fields, which are encoded as big endian
      unsigned integers in the following order: `time_low` (4 bytes), `time_mid`
      (2 bytes), `time_hi_and_version` (2 bytes), `clock_seq_hi_and_reserved` (1
      byte), `clock_seq_low` (1 byte), `node[0], ..., node[5]` (1 byte each).
      
      The total size of such a representation is 18 bytes, whereas storing
      uuids as strings requires from 34 (when '-'s are ommitted) to 38 bytes
      per UUID, giving a 2x space usage improvement.
      d68fc292
  3. Apr 07, 2020
    • Nikita Pettik's avatar
      box: introduce stacked diagnostic area · 3b887d04
      Nikita Pettik authored
      In terms of implementation, now struct error objects can be organized
      into double-linked lists. To achieve this pointers to the next and
      previous elements (cause and effect correspondingly) have been added to
      struct error. It is worth mentioning that already existing rlist and
      stailq list implementations are not suitable: rlist is cycled list, as a
      result it is impossible to start iteration over the list from random
      list entry and finish it at the logical end of the list; stailq is
      single-linked list leaving no possibility to remove elements from the
      middle of the list.
      
      As a part of C interface, box_error_add() has been introduced. In
      contrast to box_error_set() it does not replace last raised error, but
      instead it adds error to the list of diagnostic errors having already
      been set. If error is to be deleted (its reference counter hits 0 value)
      it is unlinked from the list it belongs to and destroyed. Meanwhile,
      error destruction leads to decrement of reference counter of its
      previous error and so on.
      
      To organize errors into lists in Lua, table representing error object in
      Lua now has .prev field (corresponding to 'previous' error) and method
      :set_prev(e). The latter accepts error object (i.e. created via
      box.error.new() or box.error.last()) and nil value. Both field .prev and
      :set_prev() method are implemented as ffi functions. Also note that
      cycles are not allowed while organizing errors into lists:
      e1 -> e2 -> e3; e3:set_prev(e1) -- would lead to error.
      
      Part of #1148
      3b887d04
  4. Apr 02, 2020
  5. Mar 18, 2020
    • Oleg Babin's avatar
      box: allow to retrieve the last generated value of sequence · 64c69fe0
      Oleg Babin authored
      
      This patch introduces "current" function for sequences.
      It returns the last retrieved value of specified sequence or
      throws an error if no value has been generated yet.
      
      This patch partially reverts 3ff1f1e3
      (box: remove sequence_get) here similar function "get" was removed
      to avoid possible misleading with "currval" function of PosgreSQL
      that returns the last obtained value of the sequence in the scope
      of current session. In contrast "current" returns the last globally
      retrieved value of the sequence.
      
      Closes #4752
      
      Reviewed-by: default avatarVladislav Shpilevoy <v.shpilevoy@tarantool.org>
      Reviewed-by: default avatarNikita Pettik <korablev@tarantool.org>
      
      @TarantoolBot document
      Title: sequence:current()
      
      This patch introduces "current" function for sequences.
      It returns the last retrieved value of specified sequence or
      throws an error if no value has been generated yet ("next"
      has not been called yet or right after "reset" is called).
      
      Lua:
      
      Example:
      
      ```lua
      sq = box.schema.sequence.create('test')
      ---
      ...
      sq:current()
      ---
      - error: Sequence 'test' is not started
      ...
      sq:next()
      ---
      - 1
      ...
      sq:current()
      ---
      - 1
      ...
      sq:set(42)
      ---
      ...
      sq:current()
      ---
      - 42
      ...
      sq:reset()
      ---
      ...
      sq:current()  -- error
      ---
      - error: Sequence 'test' is not started
      ...
      ```
      
      C API:
      
      ```C
      int
      box_sequence_current(uint32_t seq_id, int64_t *result);
      ```
      
      Where:
        * seq_id - sequence identifier;
        * result - pointer to a variable where the current sequence
        value will be stored on success.
      
      Returns 0 on success and -1 otherwise. In case of an error user
      could get it via `box_error_last()`.
      64c69fe0
  6. Mar 05, 2020
  7. Dec 28, 2019
    • Nikita Pettik's avatar
      sql: display line and position in syntax errors · ea958f41
      Nikita Pettik authored
      When it comes for huge queries, it may turn out to be useful to see
      exact position of occurred error. Hence, let's now display line and
      position within line near which syntax error takes place. Note that it
      can be done only during parsing process (since AST can be analysed only
      after its construction is completed), so most of semantic errors still
      don't contain position. A few errors have been reworked to match new
      formatting patterns.
      
      First iteration of this patch is implemented by @romanhabibov
      
      Closes #2611
      ea958f41
  8. Dec 27, 2019
    • Mergen Imeev's avatar
      sql: introduce DOUBLE type · 64745b10
      Mergen Imeev authored
      This patch introduces type DOUBLE in SQL.
      
      Closes #3812
      Needed for #4233
      
      @TarantoolBot document
      Title: Tarantool DOUBLE field type and DOUBLE type in SQL
      The DOUBLE field type was added to Tarantool mainly for adding the
      DOUBLE type to SQL. Values of this type are stored as MP_DOUBLE in
      msgpack. The size of the encoded value is always 9 bytes.
      
      In Lua, only non-integer numbers and CDATA of type DOUBLE can be
      inserted in this field. You cannot insert integers of type Lua
      NUMBER or CDATA of type int64 or uint64 in this field. The same
      rules apply to key in get(), select(), update() and upsert()
      methods. It was done this way to avoid unwanted implicit casts
      that could affect performance.
      
      It is important to note that you can use the ffi.cast() function
      to cast numbers to CDATA of type DOUBLE. An example of this can be
      seen below.
      
      Another very important point is that CDATA of type DOUBLE in lua
      can be used in arithmetic, but arithmetic for them does not work
      correctly. This comes from LuaJIT and most likely will not be
      fixed.
      
      Example of usage in Lua:
      s = box.schema.space.create('s', {format = {{'d', 'double'}}})
      _ = s:create_index('ii')
      s:insert({1.1})
      ffi = require('ffi')
      s:insert({ffi.cast('double', 1)})
      s:insert({ffi.cast('double', tonumber('123'))})
      s:select(1.1)
      s:select({ffi.cast('double', 1)})
      
      In SQL, DOUBLE type behavior is different due to implicit casting.
      In a column of type DOUBLE, the number of any supported type can
      be inserted. However, it is possible that the number that will be
      inserted will be different from that which is inserted due to the
      rules for casting to DOUBLE. In addition, after this patch, all
      floating point literals will be recognized as DOUBLE. Prior to
      that, they were considered as NUMBER.
      
      Example of usage in SQL:
      box.execute('CREATE TABLE t (d DOUBLE PRIMARY KEY);')
      box.execute('INSERT INTO t VALUES (10), (-2.0), (3.3);')
      box.execute('SELECT * FROM t;')
      box.execute('SELECT d / 100 FROM t;')
      box.execute('SELECT * from t WHERE d < 15;')
      box.execute('SELECT * from t WHERE d = 3.3;')
      64745b10
  9. Oct 16, 2019
    • Kirill Shcherbatov's avatar
      sql: add an ability to disable CK constraints · c4781f93
      Kirill Shcherbatov authored
      Closes #4244
      
      @TarantoolBot document
      Title: an ability to disable CK constraints
      
      Now it is possible to disable and enable ck constraints.
      All ck constraints are enabled by default when Tarantool is
      configured. Ck constraints checks are not performed during
      standard recovery, but performed during force_recovery -
      all conflicting tuples are skipped in case of ck_constraint
      conflict.
      
      To change CK constraint "is_enabled" state, call
      -- in LUA
      ck_obj:enable(new_state in {true, false})
      -- in SQL
      ALTER TABLE {TABLE_NAME} {EN, DIS}ABLE CHECK CONSTRAINT {CK_NAME};
      
      Example:
      box.space.T6.ck_constraint.ck_unnamed_T6_1:enable(false)
      box.space.T6.ck_constraint.ck_unnamed_T6_1
      - space_id: 512
        is_enabled: false
        name: ck_unnamed_T6_1
        expr: a < 10
      box.space.T6:insert({11})
      -- passed
      box.execute("ALTER TABLE t6 ENABLE CHECK CONSTRAINT \"ck_unnamed_T6_1\"")
      box.space.T6:insert({12})
      - error: 'Check constraint failed ''ck_unnamed_T6_1'': a < 10'
      c4781f93
  10. Sep 16, 2019
    • Nikita Pettik's avatar
      sql: remove ENGINE from list of reserved keywords · 07618dad
      Nikita Pettik authored
      ENGINE became reserved keyword in 1013a744. There's no any actual
      reason why ENGINE should be reserved keyword. What is more, we are going
      to use this word as a name of some fields for tables forming
      informational schema. Hence, until it is too late (it is not documented
      yet), let's remove ENGINE from the list of reserved keywords and allow
      identifiers be that word.
      07618dad
  11. Aug 22, 2019
    • Max Melentiev's avatar
      tarantoolctl: allow to start instances with delayed box.cfg{} · 17df9edf
      Max Melentiev authored
      `tarantoolctl start` patches box.cfg two times:
      1) before the init script to set default values and enforce some others,
      2) after the init script to prevent changing a pid_file in runtime.
      
      The second patching fails if an init file does not call
      box.cfg{} before it's finished. This can take a place in apps with
      managed instances which receive configuration from external server.
      
      This patch moves the second patching into the box.cfg
      wrapper created during the first patching. So the second patching
      is performed only after box.cfg{} was invoked, so it does not fail anymore.
      
      However there is relatively minor flaw for applications that
      invoke box.cfg{} after init script is finished:
      `tarantoolctl start` goes to background only when box.cfg{} is called.
      Though this is not the case for daemon management systems like systemd,
      as they handle backgrounding on their side
      
      Fixes #4435
      
      @TarantoolBot document
      Title: tarantoolctl allows to start instances without a box.cfg{}
      
      tarantoolctl now works for instances without box.cfg{} or
      with delayed box.cfg{} call. This can be managed instances which receive
      configuration from external server.
      
      For such instances `tarantoolctl start` goes to background when
      box.cfg{} is called, so it will wait until options for box.cfg are received.
      However this is not the case for daemon management systems like systemd,
      as they handle backgrounding on their side.
      17df9edf
    • Nikita Pettik's avatar
      sql: allow to specify engine in CREATE TABLE stmt · 1013a744
      Nikita Pettik authored
      Closes #4422
      
      @TarantoolBot document
      Title: Introduce <WITH ENGINE> clause for CREATE TABLE statement
      
      To allow user to specify engine as per table option, CREATE TABLE
      statement has been extended with optional <WITH ENGINE = engine_name>
      clause. This clause comes at the end of CREATE TABLE statement.
      For instance:
      
      CREATE TABLE t_vinyl (id INT PRIMARY KEY) WITH ENGINE = 'vinyl';
      
      Name of engine is considered to be string literal ergo should be
      enclosed in single quotation marks and be lower-cased. Note that engine
      specified in WITH ENGINE clause overwrites default engine, which is set
      via 'pragma sql_default_engine'.
      1013a744
    • Serge Petrenko's avatar
      decimal: allow to encode/decode decimals as MsgPack · 485439e3
      Serge Petrenko authored
      This patch adds the methods necessary to encode and decode decimals to
      MsgPack. MsgPack EXT type (MP_EXT) together with a new extension type
      MP_DECIMAL is used as a record header.
      
      The decimal MsgPack representation looks like this:
      +--------+-------------------+------------+===============+
      | MP_EXT | length (optional) | MP_DECIMAL | PackedDecimal |
      +--------+-------------------+------------+===============+
      The whole record may be encoded and decoded with
      mp_encode_decimal() and mp_decode_decimal(). This is equivalent to
      performing mp_encode_extl()/mp_decode_extl() on the first 3 fields and
      decimal_pack/unpack() on the PackedDecimal field.
      
      It is also possible to decode and encode decimals to msgpack from lua,
      which means you can insert decimals into spaces, but only into unindexed
      fields for now.
      
      Follow up #692
      Part of #4333
      485439e3
  12. Aug 16, 2019
    • Roman Khabibov's avatar
      sql: remove mask from struct Keyword · 13ed1126
      Roman Khabibov authored
      Originally, mask in struct Keyword served to reduce set of reserved
      keywords for build-dependent features. For instance, it was allowed to
      disable triggers as a compilation option, and in this case TRIGGER
      wouldn't be reserved word. Nowadays, our build always comprises all
      features, so there's no need in this option anymore. Hence, we can
      remove mask alongside with related to it macros.
      
      Closes #4155
      13ed1126
  13. Aug 01, 2019
    • Nikita Pettik's avatar
      sql: introduce VARBINARY column type · b4e61e1b
      Nikita Pettik authored
      Current patch introduces new type available in SQL:
       - VARBINARY now is reserved keyword;
       - Allow to specify VARBINARY column and CAST type;
       - All literals which start from 'x' are assumed to be of this type;
       - There's no available implicit or explicit conversions between
         VARBINARY and other types;
       - Under the hood all values of VARBINARY type are stored as MP_BIN
         msgpack format type.
      
      Closes #4206
      b4e61e1b
  14. Jul 30, 2019
    • Nikita Pettik's avatar
      sql: rename REAL/FLOAT/DOUBLE types to NUMBER · 36bdfbb2
      Nikita Pettik authored
      Before this patch it was allowed to specify REAL/FLOAT/DOUBLE types
      which matched with NUMBER NoSQL type in space format. However, NUMBER is
      different from standard floating point types, since it is able to hold
      integers in range [-2^63; 2^64-1] alongside with double precision
      floating point values. Hence, to not confuse users it has been decided
      to remove support of REAL/FLOAT/DOUBLE types from SQL grammar and use
      instead original NUMBER type naming.
      36bdfbb2
    • Nikita Pettik's avatar
      sql: add STRING alias to TEXT type · 36fc5fe1
      Nikita Pettik authored
      TEXT type is called "string" in the original Tarantool NoSQL, so it would
      be rational to allow using the same type name in SQL.
      36fc5fe1
  15. Jul 24, 2019
    • Nikita Pettik's avatar
      sql: allow to specify UNSIGNED column type · a4386277
      Nikita Pettik authored
      Since all preparations concerning internal handling of unsigned values
      have been done, now nothing prevents us from using UNSIGNED type in SQL.
      This patch allows to specify UNSIGNED as a column type and adds CAST
      rules, which are the same as for casual INTEGER, but with additional
      check - result must be positive. Otherwise, error is raised.
      
      Closes #4015
      a4386277
  16. Jun 18, 2019
    • Alexander Turenko's avatar
      lua: escape trigraphs in bundled lua sources · 177a1713
      Alexander Turenko authored
      Built-in modules are bundled into tarantool in the following way. A lua
      file from src/lua or src/box/lua is stored as a string literal in a C
      file, then built and linked into tarantool. During startup tarantool
      calls luaL_loadbuffer() on this string.
      
      When a Lua source is converted to a C literal, proper escaping is
      performed. However there is one case, which was not covered: trigraphs.
      The patch adds escaping of question mark symbols to avoid matching ??X
      sequences as trigraphs by C preprocessor.
      
      The most simple way to check that it works is to apply the following
      patch:
      
       | diff --git a/src/lua/string.lua b/src/lua/string.lua
       | index 6e12c59ae..2da2dbf4d 100644
       | --- a/src/lua/string.lua
       | +++ b/src/lua/string.lua
       | @@ -425,3 +425,6 @@ string.fromhex    = string_fromhex
       |  string.strip      = string_strip
       |  string.lstrip      = string_lstrip
       |  string.rstrip      = string_rstrip
       | +string.foo = function()
       | +    return '??('
       | +end
      
      And call the function like so:
      
       | ./src/tarantool -e 'print(string.foo()) os.exit()'
      
      If it printfs `??(`, then everything is okay. If it prints `[`, then
      `??(` was preprocessed as the trigraph.
      
      We hit this problem when tried to bundle luarocks-3: it contains
      "^(.-)(%??)$" regexp, where `??)` was interpreted as `]`. Debug build or
      a build with -DENABLE_WERROR reports an error in the case, but usual
      RelWithDebInfo build passes (with -Wtrigraphs warnings) and can show
      this unexpected behaviour.
      
      Fixes #4291.
      177a1713
  17. Jun 16, 2019
  18. Jun 13, 2019
    • Stanislav Zudin's avatar
      sql: cleanup code from obsolete macros · 6d7ca0e6
      Stanislav Zudin authored
      Removes the following unused macros:
      SQL_OMIT_AUTOINCREMENT
      SQL_OMIT_CONFLICT_CLAUSE
      SQL_OMIT_PRAGMA
      SQL_PRINTF_PRECISION_LIMIT
      SQL_OMIT_COMPOUND_SELECT
      SQL_POWERSAFE_OVERWRITE
      SQL_OMIT_PROGRESS_CALLBACK
      SQL_OMIT_AUTORESET
      SQL_OMIT_DECLTYPE
      SQL_ENABLE_COLUMN_METADATA
      SQL_TRACE_SIZE_LIMIT
      SQL_OMIT_LIKE_OPTIMIZATION
      SQL_OMIT_OR_OPTIMIZATION
      SQL_OMIT_BETWEEN_OPTIMIZATION
      SQL_EXPLAIN_ESTIMATED_ROWS
      SQL_ENABLE_COLUMN_USED_MASK
      SQL_DISABLE_DIRSYNC
      SQL_DEBUG_SORTER_THREADS
      SQL_DEFAULT_WORKER_THREADS
      SQL_LIMIT_WORKER_THREADS
      SQL_MAX_WORKER_THREADS
      SQL_ENABLE_MEMORY_MANAGEMENT
      SQL_ENABLE_UNKNOWN_SQL_FUNCTION
      SQL_SUBSTR_COMPATIBILITY
      SQL_ENABLE_STMT_SCANSTATUS
      Removed the remains of multithreading in the VDBE
      sorting tools.
      Updates tests.
      
      Closes #3978
      6d7ca0e6
  19. Jun 09, 2019
  20. May 21, 2019
    • Vladislav Shpilevoy's avatar
      swim: swim:set_codec() Lua API · 2dc1af75
      Vladislav Shpilevoy authored
      Encryption with an arbitrary algorithm and any mode with a
      configurable private key.
      
      Closes #3234
      2dc1af75
    • Vladislav Shpilevoy's avatar
      swim: cache decoded payload in the Lua module · 8ae88a3f
      Vladislav Shpilevoy authored
      Users of Lua SWIM module likely will use Lua objects as a
      payload. Lua objects are serialized into MessagePack
      automatically, and deserialized back on other instances. But
      deserialization of 1.2Kb payload on each member:payload()
      invocation is quite heavy operation. This commit caches decoded
      payloads to return them again until change.
      
      A microbenchmark showed, that cached payload is returned ~100
      times faster, than it is decoded each time. Even though a tested
      payload was quite small and simple:
      
          s:set_payload({a = 100, b = 200})
      
      Even this payload is returned 100 times faster, and does not
      affect GC.
      
      Part of #3234
      8ae88a3f
    • Vladislav Shpilevoy's avatar
      swim: introduce Lua interface · 407adf40
      Vladislav Shpilevoy authored
      SWIM as a library can be useful not only for server internals,
      but for users as well. This commit exposes Lua bindings to SWIM
      C API. Here only basic bindings are introduced to create, delete,
      quit, check a SWIM instance. With sanity tests.
      
      Part of #3234
      407adf40
    • Vladislav Shpilevoy's avatar
      buffer: port static allocator to Lua · 7fd6c809
      Vladislav Shpilevoy authored
      Static allocator gives memory blocks from cyclic BSS memory
      block of 3 pages 4096 bytes each. It is much faster than
      malloc, when a temporary buffer is needed. Moreover, it does not
      complicate GC job. Despite being faster than malloc, it is still
      slower, than ffi.new() of size <= 128 known in advance (according
      to microbenchmarks).
      
      ffi.new(size<=128) works either much faster or with the same
      speed as static_alloc, because internally FFI allocator library
      caches small blocks and can return them without malloc().
      
      A simple micro benchmark showed, that ffi.new() vs
      buffer.static_alloc() is ~100 times slower on allocations of
      > 128 size,  on <= 128 when size is not inlined.
      
      To better understand what is meant as 'inlined': this
      
          ffi.new('char[?]', < <=128 >)
      
      works ~100 times faster than this:
      
          local size = <= 128
          ffi.new('char[?]', size)
      
      ffi.new() with inlined size <= 128 works faster than light, and
      even static allocator can't beat it.
      7fd6c809
  21. May 17, 2019
    • Mergen Imeev's avatar
      sql: stop parser on error · d039fc05
      Mergen Imeev authored
      This patch stops the parser if any error occurs. Prior to this
      patch, it was possible to replace the error with another one,
      since the parser may continue to work, even if an error occurred.
      
      For example:
      box.execute("insert into not_exist values(1) a")
      
      The first error is "Space 'NOT_EXIST' does not exist", but "Syntax
      error near 'a'" is displayed.
      
      After this patch, the first error will be displayed.
      
      Closes #3964
      Closes #4195
      d039fc05
  22. May 15, 2019
  23. Apr 30, 2019
  24. Apr 25, 2019
    • Nikita Pettik's avatar
      sql: introduce type boolean · 0a8b1791
      Nikita Pettik authored
      This patch introduces basic facilities to operate on boolean type:
      boolean literals "true" and "false" where true > false; alias to null -
      unknown; column type "BOOLEAN" and shortcut "BOOL"; opportunity to
      insert and select boolean values from table; OR and AND predicates
      accept boolean arguments; CAST operation involving boolean type;
      comparison between boolean values (including VDBE sorter routines).
      
      Part of #3648
      0a8b1791
  25. Apr 23, 2019
    • Roman Khabibov's avatar
      sql: modify TRIM() function signature · f95a34da
      Roman Khabibov authored
      According to the ANSI standard, ltrim, rtrim and trim should
      be merged into one unified TRIM() function. The specialization of
      trimming (left, right or both and trimming characters) determined
      in arguments of this function.
      
      Closes #3879
      
      @TarantoolBot document
      Title: TRIM() function
      
      Modify signature of SQL function TRIM(). This function removes
      characters included in <trim character> (binary) string from
      <trim source> (binary) string until encounter a character that doesn't
      belong to <trim character>. Removal occurs on the side, specified by
      <trim specification>. Now, syntax is following:
      TRIM([ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>).
      
      <trim specification> can be one of the following keywords: LEADING,
      TRAILING and BOTH.
      <trim character> is the set of trimming characters.
      <trim source> is the string, that will be trimmed.
      If FROM is specified, then:
      1) Either <trim specification> or <trim character> or both shall be
      specified.
      2) If <trim specification> is not specified, then BOTH is implicit.
      3) If <trim character> is not specified, then ' ' is implicit.
      f95a34da
  26. Apr 17, 2019
  27. Apr 16, 2019
    • Roman Khabibov's avatar
      tarantoolctl: raise error when box.cfg isn't called · 2b387d1c
      Roman Khabibov authored
      Added a check whether box.cfg() is called within an instance
      file. If box.cfg() is missed, point a user the reason of a
      fail explicitly.
      
      Before this commit the error was look so:
      
      /usr/bin/tarantoolctl:541: attempt to index a nil value
      
      Closes #3953
      2b387d1c
Loading