Skip to content
Snippets Groups Projects
  1. May 22, 2022
  2. May 20, 2022
    • Timur Safin's avatar
      datetime: implement date.isdst · aec6fbac
      Timur Safin authored
      Properly calculate `isdst` field in datetime Lua object and
      for attribute returned by `:totable()` function.
      
      NO_DOC=next commit
      aec6fbac
    • Maxim Kokryashkin's avatar
      luajit: bump submodule · f40ad50d
      Maxim Kokryashkin authored
      LuaJIT submodule is bumped to introduce the following changes:
      * sysprof: change C configuration API
      * sysprof: enrich symtab on a new trace or a proto
      * sysprof: fix SYSPROF_HANDLER_STACK_DEPTH
      * sysprof: make internal API functions static
      * sysprof: add LUAJIT_DISABLE_SYSPROF to Makefile
      * symtab: check the _GNU_SOURCE definition
      
      Within this changeset Tarantool-specific backtrace handler is introduced
      and set to be used by sysprof machinery.
      
      Besides, all new public Lua C API introduced within this changeset is
      added to extra/exports.
      
      Follows up #781
      
      NO_DOC=LuaJIT submodule bump
      NO_TEST=LuaJIT submodule bump
      NO_CHANGELOG=LuaJIT submodule bump
      f40ad50d
    • Mergen Imeev's avatar
      sql: introduce operator [] · 814befe8
      Mergen Imeev authored
      This patch introduces operator [] that allows to get elements from MAP
      and ARRAY values.
      
      Closes #4762
      Closes #4763
      Part of #6251
      
      @TarantoolBot document
      Title: Operator [] in SQL
      
      Operator `[]` allows to get an element of MAP and ARRAY values.
      Examples:
      ```
      tarantool> box.execute([[SELECT [1, 2, 3, 4, 5][3];]])
      ---
      - metadata:
        - name: COLUMN_1
          type: any
        rows:
        - [3]
      ...
      
      tarantool> box.execute([[SELECT {'a' : 123, 7: 'asd'}['a'];]])
      ---
      - metadata:
        - name: COLUMN_1
          type: any
        rows:
        - [123]
      ...
      ```
      
      The returned values is of type ANY.
      
      If the operator is applied to a value that is not a MAP or ARRAY or is
      NULL, an error is thrown.
      
      Example:
      ```
      tarantool> box.execute([[SELECT 1[1];]])
      ---
      - null
      - Selecting is only possible from map and array values
      ...
      ```
      
      However, if there are two or more operators next to each other, the
      second or following operators do not throw an error, but instead
      return NULL.
      
      Example:
      ```
      tarantool> box.execute([[select [1][1][2][3][4];]])
      ---
      - metadata:
        - name: COLUMN_1
          type: any
        rows:
        - [null]
      ...
      ```
      814befe8
  3. May 11, 2022
    • Timur Safin's avatar
      datetime: handle timezone names in tz · 7036b55a
      Timur Safin authored
      Since recently we partially support timezone names (i.e. as
      abbreviations) so we may modify tz attribute support for
      datetime constructors or :set() operations.
      
      Closes #7076
      Relates to #7007
      
      @TarantoolBot document
      Title: datetime tz attribute
      
      Now `tz` attribute is properly handled in datetime value
      constructors or `:set{}` method modifiers.
      
      ```
      tarantool> T = date.new{year = 1980, tz = 'MSK'}
      ---
      ...
      
      tarantool> T.tzoffset
      ---
      - 180
      ...
      
      tarantool> T.tz
      ---
      - MSK
      ...
      tarantool> T = date.new{year = 1980, tzoffset = 180}
      ---
      ...
      
      tarantool> T.tzindex
      ---
      - 0
      ...
      
      tarantool> T.tz
      ---
      -
      ...
      
      tarantool> T.tzoffset
      ---
      - 180
      ...
      
      tarantool> T:set{tz = 'MSK'}
      ---
      ...
      
      tarantool> T.tz
      ---
      - MSK
      ...
      
      ```
      7036b55a
  4. Apr 29, 2022
  5. Apr 28, 2022
    • Yaroslav Lobankov's avatar
      ci: fix jepsen testing · 45bc9281
      Yaroslav Lobankov authored
      Fix the following error:
      
          {"badRequest": {"message": "The requested availability zone is not
          available", "code": 400}}
      
      NO_DOC=testing stuff
      NO_TEST=testing stuff
      NO_CHANGELOG=testing stuff
      45bc9281
  6. Apr 25, 2022
    • Maxim Kokryashkin's avatar
      luajit: bump new version · c6b038b0
      Maxim Kokryashkin authored
      LuaJIT submodule is bumped to introduce the following changes:
      * GC64: disable sysprof support
      * build: make -DLUAJIT_DISABLE_SYSPROF work
      * test: disable sysprof C API tests with backtrace
      * tools: introduce parsers for sysprof
      * sysprof: introduce Lua API
      * memprof: add profile common section
      * core: introduce lua and platform profiler
      * memprof: move symtab to a separate module
      * core: separate the profiling timer from lj_profile
      * vm: save topframe info into global_State
      
      Within this changeset a parser for binary data dumped via the sampling
      profiler to Tarantool binary. It is a set of the following Lua modules:
      * sysprof/parse.lua: decode the sampling profiler event stream
      * sysprof/collapse.lua: collapse stacks obtained while profiling
      * sysprof.lua: Lua script and module to display data
      
      Besides, all new public Lua C API introduced within this changeset is
      added to extra/exports.
      
      Closes #781
      
      NO_DOC=LuaJIT submodule bump
      NO_TEST=LuaJIT submodule bump
      c6b038b0
    • Mergen Imeev's avatar
      sql: introduce field type INTERVAL · 1c0fccbb
      Mergen Imeev authored
      This patch introduces basic INTERVAL support in SQL. After this patch,
      it will be allowed to select INTERVAL values from spaces, insert them
      into spaces, and use them in functions. CAST() from INTERVAL to STRING
      and ANY is also supported.
      
      Part of #6773
      
      NO_DOC=Will be added later.
      NO_CHANGELOG=Will be added later.
      1c0fccbb
  7. Apr 22, 2022
    • Mergen Imeev's avatar
      lua: introduce MP_INTERVAL to module msgpackffi · e6b354f3
      Mergen Imeev authored
      Part of #6773
      
      NO_DOC=INTERVAL has already been introduced earlier.
      NO_CHANGELOG=It will be added in another commit.
      e6b354f3
    • Timur Safin's avatar
      datetime: Mons intervals · d69b3229
      Timur Safin authored
      Split single sec field in the datetime_interval into multiple subfields,
      i.e. week, day, hour, min, sec. Make sure that whatever we enter in the
      constructor we get similarly visualized as textual representation
      
      Lua implementation of datetime_totable has been converted to C, which
      allows to use it for datetime values decomposing in datetimes
      subtraction. It uses per component subtraction for calculating of a
      resultant interval.
      
      Part of #6923
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      d69b3229
    • Timur Safin's avatar
      datetime: convert all sub/add datetime ops to C · 29f57b05
      Timur Safin authored
      Created C implementation for the rest of datetime/interval operations
      and call them via FFI. We need it for later Olson integration.
      
      Part of #6923
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      NO_TEST=refactoring, tests left intact
      29f57b05
    • Timur Safin's avatar
      datetime: datetime_increment_by in C from Lua · 5f3ea3b4
      Timur Safin authored
      Convert Lua implementation of datetime_increment_by to C from their
      Lua variant.
      
      Part of #6923
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      NO_TEST=refactoring, tests left intact
      5f3ea3b4
    • Timur Safin's avatar
      datetime: convert interval_to_string to C from Lua · 84b91f31
      Timur Safin authored
      Part of #6923
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      NO_TEST=refactoring, tests left intact
      84b91f31
  8. Apr 13, 2022
    • Nikita Pettik's avatar
      lua: introduce interface for prbuf · c53a45ec
      Nikita Pettik authored
      Simply add Lua wrappers for recently introduced prbuf.
      
      Introduce new buffer (in addition to ibuf) - prbuf. "pr" stands for
      "partitioned ring-". It save all metadata in the same memory chunk
      provided for storage, so it can be completely restored from the 'raw'
      memory. API:
      
      ```
      -- mem is a chunk of raw (char *) memory, of size mem_size.
      -- It is used for data storage. Note that available space is of less
      -- size due to prbuf metadata overhead.
      -- Returns handle to prbuf.
      --
      require('buffer').prbuf_create(mem, mem_size)
      
      -- mem is a chunk of memory, which contains already created prbuf.
      -- It implies that once prbuf_create() was called with the same memory.
      -- If mem does not contain valid buffer - raise an appropriate error.
      require('buffer').prbuf_open(mem)
      
      -- Returns continuous chunk of memory with given size. May return nil
      -- in case if requested chunk is too large. Note that after copying
      -- object to returned chunk, it should be committed with prbuf:commit();
      -- otherwise :prepare() may return the same chunk twice.
      prbuf:prepare(size)
      
      -- Commits the last prepared chunk. Undefined behaviour in case of
      -- committing the same chunk twice.
      prbuf:commit()
      
      -- Create and return prbuf_iterator. Does not fail. Created iterator
      -- points to nowhere - it should be adjusted with :next() call to
      -- the first entry.
      prbuf:iterator_create()
      
      -- Advance iterator position. Returns prbuf_entry or nil in case
      -- iterator has reached the end. Entry consists of two members:
      -- size and ptr. The last one is an array of characters of given size.
      iterator:next()
      ```
      
       Usage examples:
      
      ```
      
      local ibuf = buffer.ibuf()
      local prbuf_size = 100
      local memory = ibuf:alloc(prbuf_size)
      local prbuf = buffer.prbuf_create(memory, prbuf_size)
      
      local sample_size = 4
      local raw = prbuf:prepare(4)
      if raw == nil then
          -- allocation size is too large, try smaller.
      end
      raw[0] = ...
      ...
      raw[3] = ...
      prbuf:commit()
      local prbuf_recovered = buffer.prbuf_open(memory)
      local iter = prbuf_recovered:iterator_create()
      local entry = iter:next()
      assert(tonumber(entry.size) == 4)
      -- Check values stored in the buffer.
      assert(entry.ptr[0] == ...)
      entry = iter:next()
      -- Our buffer has only one entry.
      assert(entry == nil)
      
      ```
      
      NO_DOC=<Feature for internal usage>
      NO_CHANGELOG=<Feature for internal usage>
      c53a45ec
    • Pavel Balaev's avatar
      tarantoolctl: fix command in help messages · 0e7da5e6
      Pavel Balaev authored
      Currently `tarantoolctl rocks --help` generate such help message:
      
      NAME
      	/usr/bin/tarantoolctl - LuaRocks main command-line interface
      
      SYNOPSIS
      	/usr/bin/tarantoolctl [<flags...>] [VAR=VALUE]...
      
      This is wrong.
      
      This patch makes the output look like this:
      
      NAME
      	/usr/bin/tarantoolctl rocks - LuaRocks main command-line interface
      
      SYNOPSIS
      	/usr/bin/tarantoolctl rocks [<flags...>] [VAR=VALUE]...
      
      NO_DOC=bugfix
      0e7da5e6
  9. Apr 11, 2022
    • Andrey Saranchin's avatar
      box: add memtx_tx_gc() to box.internal · b4ebfc21
      Andrey Saranchin authored
      An opportunity to call garbage collector of memtx transaction
      manager manually allows to understand which garbage cannot be freed.
      This knowledge can help us to improve garbage collector. Also this
      opportunity makes it easier to test memtx mvcc memory monitoring.
      
      Part of #6150
      
      NO_DOC=internal feature
      NO_CHANGELOG=internal feature
      NO_TEST=internal feature
      b4ebfc21
  10. Apr 04, 2022
    • Aleksandr Lyapunov's avatar
      txm: introduce transaction isolation levels · ec750af6
      Aleksandr Lyapunov authored
      Now memtx TX manager tries to determine the best isolation level
      by itself. There could be two options:
      * READ_COMMITTED, when the transaction see changes of other tx
      that are committed but not yet confirmed (written to WAL)
      * READ_CONFIRMED, when the transaction see only confirmed changes.
      
      Introduce a simple way to specify the isolation level explicitly:
      box.begin{tx_isolation = 'default'} - the same as box.begin().
      box.begin{tx_isolation = 'read-committed'} - READ_COMMITTED.
      box.begin{tx_isolation = 'read-confirmed'} - READ_CONFIRMED.
      box.begin{tx_isolation = 'best-effort'} - old automatic way.
      
      Intrduce a bit more complex but potentially faster way to set
      isolation level, like that:
      my_level = box.tnx_isolation_level.READ_COMMITTED
      ..
      box.begin{tx_isolation = my_level}
      
      For simplicity of implementation also support symmetric values as
      'READ_COMMITTED' and box.tnx_isolation_level['read-committed'].
      
      Introduce a new box.cfg option - default_tx_isolation, that is
      used as a default when a transaction is started. The option is
      dynamic and possible values are the same as in box.begin, except
      'default' which is meaningless.
      
      In addition to string value the corresponding numeric values can
      be used in both box.begin and box.cfg.
      
      Part of #6930
      NO_DOC=see later commits
      NO_CHANGELOG=see later commits
      ec750af6
    • Timur Safin's avatar
      datetime: huge dates support in parse functions · 5511dda7
      Timur Safin authored
      * Default parse
        - new c-dt version used which handles extended years range
          while parse relaxed iso8601 gformat strings;
        - family of functions like dt_from_ymd_checked functions
          added to the new c-dt version, now used by conversion code
          to properly handle validation of a 32-bit boundary values;
        - datetime_parse_full() modified to properly handle huge years values;
        - added tests for extended years range.
      
      * strptime-like parse
        - properly handle longer than 4 years values, negative values,
          and handle zulu suffix, which may be generated by Tarantool
          stringization routines;
      
      Part of #6731
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      5511dda7
    • Timur Safin's avatar
      datetime, lua: strptime-like parse format · 02aa8f51
      Timur Safin authored
      To parse date/time strings using format string we use
      `strptime()` implementation from FreeBSD, which is
      modified to use our `struct datetime` data structure.
      
      List of supported format has been extended to include
      `%f` which is flag used whenever you need to process
      nanoseconds part of datetime value.
      
      ```
      tarantool> T = date.parse('Thu Jan  1 03:00:00 1970', {format = '%c'})
      
      tarantool> T
      - 1970-01-01T03:00:00Z
      
      tarantool> T = date.parse('12/31/2020', {format = '%m/%d/%y'})
      
      tarantool> T
      - 2020-12-31T00:00:00Z
      
      tarantool> T = date.parse('1970-01-01T03:00:00.125000000+0300',
                                {format = '%FT%T.%f%z'})
      
      tarantool> T
      - 1970-01-01T03:00:00.125+0300
      ```
      
      Part of #6731
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      02aa8f51
    • Timur Safin's avatar
      datetime, lua: date parsing functions · 3c403661
      Timur Safin authored
      Datetime module provides parse function to create
      datetime object given input string.
      
      `datetime.parse` function expect 1 required argument - which is
      input string, and set of optional parameters passed as table
      in 2nd argument.
      
      Allowed attributes in this optional table are:
      * `format` - should be either 'iso8601', 'rfc3339' or `strptime`-like
        format string. [strptime format will be added as part of next
        commit];
      * `tzoffset` - to redefine offset of input string value, if there
        is no timezone provided.
      * `tz` - human-readable, Olson database, timezone identifier, e.g.
        'Europe/Moscow'. Not yet implemented in this commit.
      
      ```
      tarantool> T = date.parse('1970-01-01T00:00:00Z')
      
      tarantool> T
      - 1970-01-01T00:00:00Z
      
      tarantool> T = date.parse('1970-01-01T00:00:00',
                                {format = 'iso8601', tzoffset = 180})
      
      tarantool> T
      - 1970-01-01T00:00:00+0300
      
      tarantool> T = date.parse('2017-12-27T18:45:32.999999-05:00',
                                {format = 'rfc3339'})
      
      tarantool> T
      - 2017-12-27T18:45:32.999999-0500
      ```
      
      Implemented as per RFC https://hackmd.io/@Mons/S1Vfc_axK#%D0%AD%D1%82%D0%B0%D0%BF-3-%D0%9F%D0%B0%D1%80%D1%81%D0%B8%D0%BD%D0%B3-%D0%B4%D0%B0%D1%82-%D0%BF%D0%BE-%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D1%83
      
      Part of #6731
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      3c403661
  11. Mar 14, 2022
    • Mergen Imeev's avatar
      sql: introduce DATETIME to SQL · 6dcd3822
      Mergen Imeev authored
      This patch introduces basic DATETIME support in SQL. After this patch,
      it will be allowed to select DATETIME values from spaces, insert them
      into spaces, and use them in functions. CAST() from DATETIME to STRING,
      SCALAR and ANY is also supported.
      
      Part of #6773
      
      NO_DOC=Doc-request will be added in another commit.
      NO_CHANGELOG=Changelog will be added in another commit.
      6dcd3822
  12. Dec 20, 2021
    • Timur Safin's avatar
      box, datetime: messagepack support for datetime · 768f5016
      Timur Safin authored
      Serialize `struct datetime` as newly introduced MP_EXT type.
      It saves 1 required integer field and 3 optional fields:
      - epoch is required field;
      - but nsec, tzoffset and tzindex are optional;
      
      * supported json, yaml serialization formats, lua output mode;
      
      Please refer to the
      https://hackmd.io/@Mons/S1Vfc_axK#%D0%A3%D0%BF%D0%B0%D0%BA%D0%BE%D0%B2%D0%BA%D0%B0-%D0%B2-msgpack
      for a description of a messagepack serialization schema for datetime
      values.
      
      Follow-up to #5941
      Part of #5946
      768f5016
    • Timur Safin's avatar
      datetime, lua: interval arithmetics · b0463da8
      Timur Safin authored
      Add interval arithmetics as date:add{} and date:sub{}, or
      overloaded '+' and '-' operators (__add/_sub metamethods).
      There is no special processing for timezone specific
      daylight saving time changes, which impacts result of arithmetics.
      This will be completed after Olsen database support added.
      
      If one needs to control a way arithmetic proceeded for days
      of months then there is optional argument to `:add()` or `:sub()`,
      which defines how we round day in month after arithmetic
      operation:
      
      - 'last' - mode when day snaps to the end of month, if happens:
      
        -- 29.02.2004 -> 31.03.2004
        dt:add{month = 1, adjust = "last" }
      
      - 'none' only truncation toward the end of month performed
        (**default mode**):
      
        -- 29.02.* -> 29.03.*
        dt:add{month = 1, adjust = "none" }
      
      - 'excess' - overflow mode, without any snap or truncation to
        the end of month, straight addition of days in month, stopping
        over month boundaries if there is less number of days.
      
        dt = new{year = 2004, month = 1, day = 31}
        dt:add{month = 1, adjust = 'excess'} -> 02.03.2004
      
        -- i.e. there were 29 days in February 2004, 2 excessive days
           from original date 31 make result 2nd March 2004
      
      Intervals objects, created via `datetime.interval.new()` call
      and objects of the same attributes are equivalent for interval
      arithmetics and exchangeable. i.e.
      
         dt + date.interval.new{year = 1, month = 2}
      
      is the same as
         dt + {year = 1, month = 2}
      
      Follow-up to #5941
      b0463da8
  13. Dec 17, 2021
    • Vladimir Davydov's avatar
      Introduce luarocks hardcoded config for static build · fa0cee99
      Vladimir Davydov authored
      Currently, we use the same luarocks hardcoded config for static build as
      for regular build. As a result, LUA_BINDIR, LUA_INCDIR, SYSCONFDIR, and
      PREFIX point to locations inside the build directory, which doesn't make
      any sense.
      
      Let's introduce a special hardcoded config which will set those
      directories to locations relative to the binary location:
      
       - LUA_BINDIR: directory where the binary is located (bindir)
       - PREFIX: <dir> if bindir is <dir>/bin, otherwise bindir.
       - LUA_INCDIR: PREFIX/include/tarantool
       - SYSCONFDIR: PREFIX/etc/tarantool/rocks
      
      Also, let's add the PREFIX/rocks to the rocks path if present.
      
      This is needed for Tarantool SDK bundle to work as expected.
      In particular the check for <dir>/bin is needed, because SDK
      installs binaries in bundle root, not in /bin.
      fa0cee99
    • Vladimir Davydov's avatar
      Remove unused options from luarocks hardcoded config · 1c05c631
      Vladimir Davydov authored
      The options are not used anymore since update to 3.1.1,
      see third_party/luarocks/src/luarocks/core/cfg.lua.
      
      They should have been removed by commit
      4222c1f6
      ("rocks: update luarocks to 3.1.1")
      1c05c631
    • Vladimir Davydov's avatar
      Format luarocks hardcoded config · 7ac60487
      Vladimir Davydov authored
      It contains Lua code. Format it appropriately. No functional changes.
      7ac60487
  14. Dec 13, 2021
    • mechanik20051988's avatar
      uri: implement ability to parse URIs passed in different ways · 37c35677
      mechanik20051988 authored
      Previously, URI can be passed as a string, which contains one URI
      or several URIs separated by commas. Now URIs can be passed in
      different ways: as before, as a table which contains URI and it's
      parameters in "param" table, as a table which contains URI strings
      and URI tables. Also there are different ways to specify properties
      for URI: in a string which contains URI, after '?' delimiter, in a
      table which contains URI in "params" table, in "default_params" table
      if it is default parameters for all URIs.
      For this purposes new method `parse_many` was implemented in tarantool
      `uri` library. Also `parse` method was updated to make possible the
      same as new `parse_many` method but only for single URI.
      ```lua
      uri = require('uri')
      -- Single URI, passed as before
      uri.parse_many("/tmp/unix.sock")
      -- Single URI, with query paramters
      uri.parse_many("/tmp/unix.sock?q1=v1&q2=v2")
      -- Several URIs with parameters in one string, separated by commas
      uri.parse_many("/tmp/unix.sock_1?q=v, /tmp/unix.sock_2?q=v")
      -- Single URI passed in table, with additional parameters, passed
      -- in "params" table. This parameters overwrite parameters from
      -- URI string (q1 = "v2" in example below).
      uri.parse_many({"/tmp/unix.sock?q1=v1", params = {q1 = "v2"}})
      -- For parse it's also works now
      uri.parse({"/tmp/unix.sock?q1=v1", params = {q1 = "v2"}})
      -- Several URIs passed in table with default parameters, passed
      -- in "default_params" table, which are used for parameters, which
      -- not specified for URI (q3 parameter with "v3" value corresponds
      -- to all URIs, and used if there is no such parameter in URI).
      uri.parse_many({
          "/tmp/unix.sock_1?q1=v1",
          { uri = "/tmp/unix.sock_2", params = { q2 = "v2" } },
          default_params = { q3 = "v3" }
      })
      ```
      37c35677
    • mechanik20051988's avatar
      uri: implement ability to parse several URIs · 3661bc3a
      mechanik20051988 authored
      Implement ability to parse a string, which contains several URIs
      separated by commas. Each URI can contain different query parameters
      after '?'. All created URIs saved in new implemented struct `uri_set`.
      
      Part of #5928
      3661bc3a
    • mechanik20051988's avatar
      uri: rework struct uri to use a copy of the original splitted string. · c65fd012
      mechanik20051988 authored
      In the future, it is planned to extend the URI structure to allow its
      passing with different options and in different formats (see next commit
      `uri: implement ability to parse URI query paramters` for example). For
      these purposes, it is planned to use functions that modify the source
      string, for example `strtok_r`, so we need to rework the URI structure
      to create copies of the string for each of the URI components.
      
      Part of #5928
      c65fd012
  15. Dec 10, 2021
  16. Dec 09, 2021
  17. Dec 01, 2021
  18. Nov 24, 2021
    • Mergen Imeev's avatar
      sql: introduce field type MAP · 1364629e
      Mergen Imeev authored
      This patch introduces MAP to SQL. After this patch, all SQL operations
      and built-in functions should work correctly with MAP values. However,
      there is currently no way to create MAP values using only SQL tools.
      
      Part of #4763
      
      @TarantoolBot document
      Title: Field type MAP in SQL
      
      Properties of type MAP in SQL:
      1) a value of type MAP can be implicitly and explicitly cast only to
      ANY;
      2) only a value of type ANY with primitive type MAP can be explicitly
      cast to MAP;
      3) a value of any other type cannot be implicitly cast to MAP;
      4) a value of type MAP cannot participate in arithmetic, bitwise,
      comparison, and concatination operations.
      1364629e
    • Mergen Imeev's avatar
      sql: introduce field type ARRAY · e2102a15
      Mergen Imeev authored
      This patch introduces ARRAY to SQL. After this patch, all SQL operations
      and built-in functions should work correctly with ARRAY values. However,
      there is currently no way to create ARRAY values using only SQL tools.
      
      Part of #4762
      
      @TarantoolBot document
      Title: Field type ARRAY in SQL
      
      Properties of type ARRAY in SQL:
      1) a value of type ARRAY can be implicitly and explicitly cast only
         to ANY;
      2) only a value of type ANY with primitive type ARRAY can be explicitly
         cast to ARRAY;
      3) a value of any other type cannot be implicitly cast to ARRAY;
      4) a value of type ARRAY cannot participate in arithmetic, bitwise,
         comparison, and concatination operations.
      e2102a15
  19. Nov 16, 2021
    • Vladislav Shpilevoy's avatar
      error: use error_payload in Lua · 54be00b6
      Vladislav Shpilevoy authored
      In Lua struct error used RTTI to return members of the error
      depending on its type. If a field was added to error's payload, it
      wasn't visible. The patch makes Lua use error_payload instead of
      RTTI. Now if the payload gets a new field, it becomes
      automatically visible in Lua without need to introduce a new
      method for it.
      
      Part of #5568
      Part of #4610
      Part of #4907
      54be00b6
  20. Nov 11, 2021
    • Mergen Imeev's avatar
      sql: introduce field type ANY · b8bd3138
      Mergen Imeev authored
      Closes #3174
      
      @TarantoolBot document
      Title: Field type ANY in SQL
      
      Properties of type ANY in SQL:
      1) typeof() with an argument of type ANY returns "any";
      2) any value of any type can be implicitly and explicitly cast to the ANY type;
      3) a value of type ANY cannot be implicitly cast to any other type;
      4) a value of type ANY cannot participate in arithmetic, bitwise, comparison,
         and concationation operations.
      b8bd3138
  21. Nov 02, 2021
    • Alexander Turenko's avatar
      jepsen: fix race condition with apt's sources.list · 20e72426
      Alexander Turenko authored
      Jepsen testing starts one or several virtual machines and runs tarantool
      instances on them. The first (first important for us here) command on
      the virtual machine is `apt-get <...> update`: we should download
      packages list to allow Jepsen to install necessary dependencies.
      
      However we can access the virtual machine (using ssh) before it is fully
      initialized by the cloud-init script. In particular, the cloud-init
      script replaces apt's mirror list file (`/etc/apt/sources.list`).
      
      Normally we should call `apt-get <...> update` after the package list
      update, but here cloud-init races with the update command.
      
      In the bad case the commands are executed in the opposite order:
      
      * Terraform calls `apt-get <...> update`.
      * cloud-init replaces `/etc/apt/sources.list`.
      
      Now an attempt to install a package using apt-get will give the 'unable
      to locate package' error, because we have no packages list for the 'new'
      mirrors.
      
      The problem is nicely described in [1]. See also the linked issue for
      details.
      
      [1]: https://github.com/hashicorp/packer/issues/41#issuecomment-21288589
      
      Fixes https://github.com/tarantool/jepsen.tarantool/issues/87
      20e72426
  22. Oct 25, 2021
    • mechanik20051988's avatar
      txn: implement timeout for transactions · a76eb6ef
      mechanik20051988 authored
      Client code errors or manual mistakes can create transactions that are
      never closed. Such transaction will work as a memory leak. Implement
      timeout for transactions after which they are rolled back.
      
      Part of #6177
      
      @TarantoolBot document
      Title: ability to set timeout for transactions was implemented
      Previously transactions are never closed until commit or rollback.
      Timeout for transactions was implemented after which they are rolled
      back. For these purpose, in `box.begin` the optional table parameter
      was added. For example if user want to start transaction with timeout
      3s, he should use `box.begin({timeout = 3})`. Also was implement new
      configuration option `box.cfg.txn_timeout` which determines timeout for
      transactions, for which the timeout was not explicitly set. By default
      this option is set to infinity (TIMEOUT_INFINITY = 365 * 100 * 86400).
      Also in C API was added new function to set timeout for transaction -
      'box_txn_set_timeout'.
      a76eb6ef
  23. Oct 14, 2021
    • Timur Safin's avatar
      build, lua: built-in module datetime · 43e10ed3
      Timur Safin authored
      Introduce a new builtin Tarantool module `datetime.lua` for timestamp
      and interval types support.
      
      New third_party module - c-dt
      -----------------------------
      
      * Integrated chansen/c-dt parser as 3rd party module to the
        Tarantool cmake build process;
      * We use tarantool/c-dt instead of original chansen/c-dt to
        have an easier cmake build integration, as we have added some
        changes, which provide cmake support, and allow to rename symbols
        if necessary (this symbol renaming is similar to that we see
        with xxhash or icu).
      
      New built-in module `datetime`
      ------------------------------
      
      * created a new Tarantool built-in module `datetime`, which uses
        `struct datetime` data structure for keeping timestamp values;
      * Lua module uses a number of `dt_*` functions from `c-dt` library,
        but they were renamed to `tnt_dt_*` at the moment of exporting
        from executable - to avoid possible name clashes with external
        libraries.
      
      * At the moment we libc `strftime` for formatting of datetime
        values according to flags passed, i.e. `date:format('%FT%T%z')`
        will return something like '1970-01-01T00:00:00+0000', but
        `date:format('%A %d, %B %Y')` will return 'Thursday 01, January 1970'
      
      * if there is no format provided then we use default
        `tnt_datetime_to_string()` function, which converts datetime
        to their default ISO-8601 output format, i.e.
        `tostring(date)` will return string like "1970-01-01T00:00:00Z"
      
      * There are a number of simplified interfaces
        - totable() for exporting table with attributes names as provided
          by `os.date('*t')`
        - set() method provides unified interface to set values using
          the set of attributes as defined above in totable()
      
      Example,
      
      ```
      local dt = datetime.new {
      	nsec      = 123456789,
      
      	sec       = 19,
      	min       = 29,
      	hour      = 18,
      
      	day       = 20,
      	month     = 8,
      	year      = 2021,
      
      	tzoffset  = 180
      }
      
      local t = dt:totable()
      --[[
      {
      	sec = 19,
      	min = 29,
      	wday = 6,
      	day = 20,
      	nsec = 123456789,
      	isdst = false,
      	yday = 232,
      	tzoffset = 180,
      	month = 8,
      	year = 2021,
      	hour = 18
      }
      --]]
      
      dt:format()   -- 2021-08-21T14:53:34.032Z
      dt:format('%Y-%m-%dT%H:%M:%S')   -- 2021-08-21T14:53:34
      
      dt:set {
      	usec      = 123456,
      
      	sec       = 19,
      	min       = 29,
      	hour      = 18,
      
      	day       = 20,
      	month     = 8,
      	year      = 2021,
      
      	tzoffset  = 180,
      
      }
      dt:set {
      	timestamp = 1629476485.124,
      
      	tzoffset  = 180,
      }
      
      ```
      
      Coverage is
      
      File                 Hits Missed Coverage
      -----------------------------------------
      builtin/datetime.lua 299  23     92.86%
      -----------------------------------------
      Total                299  23     92.86%
      
      Part of #5941
      
      @TarantoolBot document
      Title: Introduced a new `datetime` module for timestamp and interval support
      
      Create `datetime` module for timestamp and interval types support.
      It allows to create date and timestamp values using either object interface,
      or via parsing of string values conforming to iso-8601 standard.
      One may manipulate (modify, subtract or add) timestamp and interval values.
      
      Please refer to https://hackmd.io/@Mons/S1Vfc_axK#Datetime-in-Tarantool
      for a more detailed description of module API.
      43e10ed3
Loading