Skip to content
Snippets Groups Projects
  1. May 30, 2022
    • Oleg Babin's avatar
      fiber: don't skip fiber_obj:info() arguments · 086b4dde
      Oleg Babin authored
      Commit b18dd47f ("Introduce backtrace=true option to fiber.info()")
      introduced a way to skip backtraces in fiber.info() calls.
      Commit 9da7e03e ("fiber: introduce fiber_o:info() and fiber_o:csw()")
      introduced `options` function for fiber object however it ignored
      passed options.
      This patch fixed it. Currently fiber:info({backtrace = false})
      returns info without backtrace.
      
      Closes #7210
      
      NO_DOC=bugfix
      
      (cherry picked from commit 0eac13b9)
      086b4dde
  2. May 26, 2022
  3. May 25, 2022
    • Timur Safin's avatar
      build: submodule third_party/tz instead of git · d979637f
      Timur Safin authored
      FreeBSD Tarantool port has some problems if build uses cmake'
      ExternalProject_Add which refers to the github repository.
      Sumodule works better - so switching to using it.
      
      NO_CHANGELOG=build
      NO_DOC=build
      NO_TEST=build
      
      (cherry picked from commit 4eaff4e0)
      d979637f
    • Timur Safin's avatar
      build: datetime insource build · dfd02088
      Timur Safin authored
      Previous version of tzcode/CMakeLists.txt leaves untracked files under
      source directory src/lib/tzcode/tz/. We have changed slightly an approach
      used to checkout and build IANA github sources under build/ directory,
      not in ${PROJECT_BINARY_DIR} (which may be pointing not to out-of-source
      build directory, but rather to the repository root itself, if insource
      build used).
      
      Closes #7173
      
      NO_CHANGELOG=infra
      NO_DOC=infra
      NO_TEST=infra
      
      (cherry picked from commit 5f143288)
      dfd02088
  4. May 23, 2022
    • Denis Smirnov's avatar
      sql: fix -Wnull-pointer-subtraction warning · 969cd680
      Denis Smirnov authored
      
      clang 13 includes a check for subtraction from NULL pointer which
      is considered UB: historically, we had an alignment checking macro
      which is affected by this. It seems like the intention of the
      macro's author was to implicitly cast the pointer being checked to
      uintptr_t without including stddef.h — replace this subtraction
      with an explicit cast.
      
      There is no way to set SQL_4_BYTE_ALIGNED_MALLOC, so the corresponding
      part of the code was removed. Now there are only 8 byte alignment
      assertions.
      
      NO_CHANGELOG=UB fix
      NO_DOC=UB fix
      NO_TEST=UB fix
      
      Co-authored-by: default avatarGeorgiy Lebedev <curiousgeorgiy@gmail.com>
      (cherry picked from commit 0289433a)
      969cd680
  5. May 22, 2022
  6. May 20, 2022
    • Nikita Pettik's avatar
      error: fix ER_CANT_UPDATE_PRIMARY_KEY template · 73f84aae
      Nikita Pettik authored
      This client error assumes two arguments: space's name and index's name.
      Since from the context it's clear that primary index is affected,
      let's drop index name from error message. It's quite handy for space
      upgrade case, since in such situation we have lack of information
      concerning space.
      
      NO_CHANGELOG=<Minor change>
      NO_DOC=<No functional changes>
      
      (cherry picked from commit 6e76410a)
      73f84aae
    • Nikita Pettik's avatar
      space_upgrade: extend space_ugprade_new() signature · 9709dc89
      Nikita Pettik authored
      We are going to utilize primary key definition during space upgrade in
      order to verify primary key invariant. So we need it to be stored in
      space_upgrade metadata. Let's extend space_upgrade_new() signature and
      pass there primary key definition. Also patch moves space_upgrade_new()
      call a bit lower through code - now it's called after all indexes are
      assigned (to simplify extraction of primary key definition).
      Moreover, in order to print pretty error message during space upgrade
      we should keep space in struct space_upgrade.
      
      NO_DOC=ee
      NO_TEST=ee
      NO_CHANGELOG=ee
      
      (cherry picked from commit 9255b607)
      9709dc89
    • Nikita Pettik's avatar
      net.box: fix box.error() usage · 3bfb1cec
      Nikita Pettik authored
      box.error() expects first argument to be numeric or table; passing
      string to it is wrong. Accidentally in net.box module two places where
      string is passed to box.error() as first argument: in :unprepare() and
      :connect() methods. Let's fix them and pass error code ER_ILLEGAL_PARAMS.
      
      NO_DOC=<bugfix>
      NO_CHANGELOG=<Minor>
      
      (cherry picked from commit a74c549a)
      3bfb1cec
    • Kseniia Antonova's avatar
      doc: proofread changelogs/unreleased · c7fa00e2
      Kseniia Antonova authored
      Fix wording, punctuation, and formatting.
      
      NO_DOC=changelog
      NO_TEST=changelog
      
      (cherry picked from commit ac365ecf)
      c7fa00e2
    • Denis Smirnov's avatar
      sql: fix insertion crash · 287e65c5
      Denis Smirnov authored
      
      Previously SQL didn't validate for all cases, that the amount of the
      source and destination columns during insertion is equal. The problem
      was detected when we insert an incorrect amount of values into the
      table. For example, the query
      
      insert into t(a) select a, b from t
      
      produced an instance crash. Fixed.
      
      Closes #7132
      
      NO_DOC=bug fix
      
      Co-authored-by: default avatarMergen Imeev <imeevma@gmail.com>
      (cherry picked from commit dfa0ea2b)
      287e65c5
    • Timur Safin's avatar
      datetime: implement interval comparison · fb9505fb
      Timur Safin authored
      We used to not implement comparison operators for interval
      objects, thus any compare (even of equal) objects returned false:
      
      	```
      	tarantool> dt1 = datetime.new()
      	---
      	...
      
      	tarantool> dt2 = datetime.now()
      	---
      	...
      
      	tarantool> dt1 - dt1 == dt2 - dt2
      	---
      	- false
      	...
      	```
      
      Now we implemented comparison for interval objects, where we compare
      field by field starting from highest attribute (e.g. `year`) to
      smallest attribute (e.g. `nsec`) and if any of comparison
      returned non zero value then we return this result.
      
      NO_DOC=bugfix
      NO_CHANGELOG=bugfix
      
      (cherry picked from commit 65a3c17f)
      fb9505fb
    • Timur Safin's avatar
      datetime: Olson timezones changelog and doc request · b78f4734
      Timur Safin authored
      Use Olson/IANA tzdata for timezone handling in datetime string.
      
      Closes of #6751
      
      NO_TEST=doc
      
      @TarantoolBot document
      Title: Document timezone support
      
      Timezones support
      -----------------
      
      Tarantool uses IANA tzdata aka Olson DB facilities for timezone
      resolution at the moment of parsing of datetime literals or while
      parsing `tz` attribute in constructor, or `:set{}` method call.
      
      In addition to the `tzoffset` we provided before, we now define
      `tzindex`, the unique index assigned by Tarantool to each known IANA
      timezone.
      
      ```lua
      date = require 'datetime'
      
      tarantool> T = date.parse '2022-01-01T00:00 Europe/Moscow'
      
      tarantool> T.tzindex
      ---
      - 947
      ...
      
      tarantool> T.tzoffset
      ---
      - 180
      ...
      
      tarantool> T.tz
      ---
      - Europe/Moscow
      ...
      ```
      
      Now `date.isdst` field (alone and as part of `:totable()` table) is
      correctly calculated using `tzindex` and attributes of the selected
      timezone in the Olson DB timezone.
      
      ```
      tarantool> date.parse('2004-06-01T00:00 Europe/Moscow').isdst
      ---
      - true
      ...
      
      tarantool> date.parse('2004-12-01T00:00 Europe/Moscow'):totable()
      ---
      - sec: 0
        min: 0
        yday: 336
        day: 1
        nsec: 0
        isdst: false
        wday: 4
        tzoffset: 180
        month: 12
        year: 2004
        hour: 0
      ...
      
      ```
      
      All timezone names and abbreviations, known to the current Tarantool
      version are available via `datetime.TZ` bidirectional array.
      
      ```lua
      print(date.TZ['Europe/Moscow']) -- 947
      print(date.TZ[947]) -- Europe/Moscow
      ```
      
      Limitations
      -----------
      
      There were moments in past history, when local mean time in some
      partcular zone used timezone offset not representable in whole
      minutes, but rather in seconds, i.e. in Moscow before 1918 there
      used to be offset +2 hours 31 minutes and 19 seconds. Please see
      Olson dump for this period
      
      ```
      $ ./src/lib/tzcode/install/usr/bin/zdump -c1880,1918 -i Europe/Moscow
      
      TZ="Europe/Moscow"
      -       -       +023017 MMT
      1916-07-03      00:01:02        +023119 MMT
      1917-07-02      00      +033119 MST     1
      1917-12-27      23      +023119 MMT
      ```
      
      Modern tzdata rules do not use such tiny fraction, and all timezones differ
      to UTC in units measured in minutes, not seconds. Tarantool datetime uses
      minutes internally as units for `tzoffset` so there is some loss of
      precision if you try to operate with such ancient timestamps.
      
      (cherry picked from commit 979a8fbd)
      b78f4734
    • Timur Safin's avatar
      datetime: use lookaside pointer for tzalloc · 3206ee1b
      Timur Safin authored
      For performance reasons try to reuse previously
      allocated structure across calls to tzalloc() if
      zone appears to be the same.
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit 6ba2cc36)
      3206ee1b
    • Timur Safin's avatar
      datetime: interval initialization via pairs · 8b941f83
      Timur Safin authored
      Fixed incorrect interval initialization for case of `()` used
      while it was correct for `{}` arguments.
      
      NO_DOC=bugfix
      NO_CHANGELOG=bugfix
      NO_TEST=bugfix
      
      ```
      tarantool> itv = require('datetime').interval.new{}
      ---
      ...
      
      tarantool> itv
      ---
      - 0 seconds
      ...
      
      tarantool> itv = require('datetime').interval.new()
      ---
      ...
      
      tarantool> itv
      ---
      - +0.000000001 seconds
      ...
      ```
      
      (cherry picked from commit d183ae6d)
      8b941f83
    • Timur Safin's avatar
      datetime: datetime.TZ array · cb348219
      Timur Safin authored
      Extended gen-zone-abbrevs.pl script with capability to generate
      timezones.lua in addition to timezones.h.
      
      That's bidirectional Lua translation table for resolution of
      timezone name by it's index and vice versa. Exported to Lua
      world via `datetime.TZ`
      
      NO_DOC=next commit
      
      (cherry picked from commit 9ee45289)
      cb348219
    • Timur Safin's avatar
      datetime: implement date.isdst · 063cfdcd
      Timur Safin authored
      Properly calculate `isdst` field in datetime Lua object and
      for attribute returned by `:totable()` function.
      
      NO_DOC=next commit
      
      (cherry picked from commit aec6fbac)
      063cfdcd
    • Timur Safin's avatar
      datetime: use Olson for timezone name · 0b0f2cd1
      Timur Safin authored
      * Modified localtime.c to use tnt_tm instead of tm structure;
      * Use this structure for passing data to tnt_localtime_rz at
        the moment of time-zone resolution;
      * As a side-effect of refactoring - simplified singleton we
        used to use for automagical sorting of array with timezone
        abbreviations
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      
      (cherry picked from commit 2116bbfd)
      0b0f2cd1
    • Timur Safin's avatar
      datetime: localtime.c switched to Tarantool struct tnt_tm · e14ceb32
      Timur Safin authored
      Using our own `tnt_tm` allows to properly pass `tm_tzindex`.
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit 08400823)
      e14ceb32
    • Timur Safin's avatar
      datetime: primary and aliases zones in Olson · 71ebc1b0
      Timur Safin authored
      * localtime.c refactored to make tzalloc/tzfree public;
      * Modified Perl script to generate primary Olson timezones and aliases.
        Get rid of NYI;
      
      NO_DOC=refactoring
      NO_CHANGELOG=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit b6ff1978)
      71ebc1b0
    • Timur Safin's avatar
      datetime, build - tzcode/olson integrated into cmake · 83fe3c97
      Timur Safin authored
      - localtime.c, tzfile.h added to build
      
      NO_DOC=build
      NO_CHANGELOG=build
      NO_TEST=build
      
      (cherry picked from commit d3acfece)
      83fe3c97
    • Vladimir Davydov's avatar
      applier: make SSLError retryable · 238be74a
      Vladimir Davydov authored
      A certificate used for an encrypted replication connection may expire,
      in which case the user will be forced to reconfigure the connection both
      on the master and on the replica to use the new certificate. If the
      replica completes the reconfiguration first, it will fail to connect to
      the master and never retry, even though the master should complete its
      reconfiguration in a moment.
      
      To avoid that, we should make the applier retry to connect on SSLError,
      just like it does on SocketError.
      
      Needed for https://github.com/tarantool/tarantool-ee/issues/107
      
      NO_DOC=ee
      NO_TEST=ee
      NO_CHANGELOG=ee
      
      (cherry picked from commit a1183d6e)
      238be74a
    • Vladimir Davydov's avatar
      box: add error code for SSLError · 1806f816
      Vladimir Davydov authored
      Applier uses box_error_code() to for better logging:
       - It remembers tha last raised error code and skips logging if the new
         error code is the same.
       - It logs "will retry every X seconds" only for retryable error codes
         (for example, ER_SYSTEM) while for non-retryable errors (for example,
         ER_PROC_LUA) the message isn't logged.
      
      box_error_code() returns ER_PROC_LUA for SSLError, which is confusing
      and would result in inconsistent logging in applier if we made SSLError
      retryable. Let's add a separate error code for this error (ER_SSL) and
      introduce a test case that checks that box_error_code() works as
      expected for all kinds of errors.
      
      Follow-up commit a7028dde ("Add SSL iostream stub").
      Needed for https://github.com/tarantool/tarantool-ee/issues/107
      
      NO_DOC=internal
      NO_CHANGELOG=internal
      
      (cherry picked from commit b85cf605)
      1806f816
    • Maxim Kokryashkin's avatar
      luajit: bump submodule · 3ff2aec1
      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
      
      (cherry picked from commit f40ad50d)
      3ff2aec1
    • Mergen Imeev's avatar
      sql: introduce operator [] · cff513d1
      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]
      ...
      ```
      
      (cherry picked from commit 814befe8)
      cff513d1
  7. May 19, 2022
  8. May 18, 2022
    • Mergen Imeev's avatar
      sql: fix type calculation for DATETIME arithmetic · c36986b6
      Mergen Imeev authored
      After this correction DATETIME arithmetic result type will be
      calculated correctly. Before this fix the type returned in the metadata
      was "scalar".
      
      Follow-up #6773
      
      NO_DOC=Bugfix
      NO_CHANGELOG=Bugfix
      c36986b6
    • Mergen Imeev's avatar
      sql: introduce cast from MAP to INTERVAL · ac06e04e
      Mergen Imeev authored
      This patch introduces explicit cast from MAP to INTERVAL.
      
      Follow-up #6773
      
      NO_DOC=INTERVAL has already been introduced.
      NO_CHANGELOG=INTERVAL has already been introduced.
      ac06e04e
    • Mergen Imeev's avatar
      sql: introduce cast from MAP to DATETIME · 086bcfd2
      Mergen Imeev authored
      This patch introduces explicit cast from MAP to DATETIME.
      
      Follow-up #6773
      
      NO_DOC=DATETIME has already been introduced.
      NO_CHANGELOG=DATETIME has already been introduced.
      086bcfd2
    • Mergen Imeev's avatar
      sql: introduce cast from STRING to DATETIME · 48dfe7b3
      Mergen Imeev authored
      This patch introduces explicit cast from STRING to DATETIME.
      
      Follow-up #6773
      
      NO_DOC=DATETIME has already been introduced.
      NO_CHANGELOG=DATETIME has already been introduced.
      48dfe7b3
    • Serge Petrenko's avatar
      replication: fix race in accessing vclock by applier and tx threads · a3ea6fe5
      Serge Petrenko authored
      When applier ack writer was moved to applier thread, it was overlooked
      that it would start sharing replicaset.vclock between two threads.
      
      This could lead to the following replication errors on master:
      
       relay//102/main:reader V> Got a corrupted row:
       relay//102/main:reader V> 00000000: 81 00 00 81 26 81 01 09 02 01
      
      Such a row has an incorrectly-encoded vclock: `81 01 09 02 01`.
      When writer fiber encoded the vclock length (`81`), there was only one
      vclock component: {1: 9}, but at the moment of iterating over the
      components, another WAL write was reported to TX thread, which bumped
      the second vclock component {1: 9, 2: 1}.
      
      Let's fix the race by delivering a copy of current replicaset vclock to
      the applier thread.
      
      Also add a perf test to the perf/ directory.
      
      Closes #7089
      Part-of tarantool/tarantool-qa#166
      
      NO_DOC=internal fix
      NO_TEST=hard to test
      
      (cherry picked from commit ddec704e)
      a3ea6fe5
Loading