Skip to content
Snippets Groups Projects
  1. Oct 19, 2022
    • Mergen Imeev's avatar
      box: fix format of _vfunc · ee06f892
      Mergen Imeev authored
      The _vfunc system space is the sysview for the _func system space.
      However, the _vfunc format is different from the _func format. This
      patch makes the _vfunc format the same as the _func format.
      
      Closes #7822
      
      NO_DOC=bugfix
      
      (cherry picked from commit 707da125)
      ee06f892
  2. Oct 18, 2022
    • Timur Safin's avatar
      datetime: datetimes subtractions ignored timezone · 8aa13474
      Timur Safin authored
      We used to ignore timezone difference (in `tzoffset`) for
      datetime subtraction operation:
      
      ```
      tarantool> datetime.new{tz='MSK'} - datetime.new{tz='UTC'}
      ---
      - +0 seconds
      ...
      
      tarantool> datetime.new{tz='MSK'}.timestamp -
                 datetime.new{tz='UTC'}.timestamp
      ---
      - -10800
      ...
      ```
      
      Now we accumulate tzoffset difference in the minute component
      of a resultant interval:
      
      ```
      tarantool> datetime.new{tz='MSK'} - datetime.new{tz='UTC'}
      ---
      - -180 minutes
      ...
      ```
      
      Closes #7698
      
      NO_DOC=bugfix
      
      (cherry picked from commit 0daed8d5)
      Unverified
      8aa13474
    • Timur Safin's avatar
      datetime: fix interval arithmetic for DST · 9f8b05ab
      Timur Safin authored
      We did not take into consideration the fact that
      as result of date/time arithmetic we could get
      in a different timezone, if DST boundary has been
      crossed during operation.
      
      ```
      tarantool> datetime.new{year=2008, month=1, day=1,
      			tz='Europe/Moscow'} +
      	   datetime.interval.new{month=6}
      ---
      - 2008-07-01T01:00:00 Europe/Moscow
      ...
      ```
      
      Now we resolve tzoffset at the end of operation if
      tzindex is not 0.
      
      Fixes #7700
      
      NO_DOC=bugfix
      
      (cherry picked from commit 6ca07285)
      Unverified
      9f8b05ab
    • Yaroslav Lobankov's avatar
      ci: use `coveralls-lcov` instead of GitHub action · abba4f80
      Yaroslav Lobankov authored
      In PR #7791 the coverage stuff is slightly updated. The changes are
      related to excluding some directories where the coverage will not be
      calculated. The patch itself is straightforward enough, but I can see
      the problems with uploading the results to coveralls.io:
      
      NO_WRAP
          Using lcov file: ./coverage.info
          FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
      
          <--- Last few GCs --->
      
          [2683200:0x327c000]    27836 ms: Scavenge 2033.4 (2038.7) -> 2033.2 (2044.2) MB, 6.8 / 0.0 ms  (average mu = 0.258, current mu = 0.243) allocation failure
          [2683200:0x327c000]    27854 ms: Scavenge 2036.7 (2044.2) -> 2037.1 (2044.4) MB, 15.6 / 0.0 ms  (average mu = 0.258, current mu = 0.243) allocation failure
          [2683200:0x327c000]    27871 ms: Scavenge 2037.2 (2044.4) -> 2036.7 (2055.9) MB, 17.1 / 0.0 ms  (average mu = 0.258, current mu = 0.243) allocation failure
      
          <--- JS stacktrace --->
      
          ==== JS stack trace =========================================
      
              0: ExitFrame [pc: 0x140dc19]
          Security context: 0x2481918808d1 <JSObject>
              1: encode(aka encode) [0x23ec5e514a11] [/opt/actions-runner/_work/_actions/coverallsapp/github-action/v1.1.2/node_modules/qs/lib/utils.js:~118] [pc=0x193ecd3d5d82](this=0x35d34e4804b1 <undefined>,0x1e5895380119 <Very long string[60387428]>)
              2: stringify(aka stringify) [0x23ec5e5174c9] [/opt/actions-runner/_work/_actions/coverallsapp/github-action/v1.1.2/n...
      
           1: 0xa1a640 node::Abort() [/opt/actions-runner/externals/node12/bin/node]
           2: 0xa1aa4c node::OnFatalError(char const*, char const*) [/opt/actions-runner/externals/node12/bin/node]
           3: 0xb9a62e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/actions-runner/externals/node12/bin/node]
           4: 0xb9a9a9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/actions-runner/externals/node12/bin/node]
           5: 0xd57c25  [/opt/actions-runner/externals/node12/bin/node]
           6: 0xd582b6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/opt/actions-runner/externals/node12/bin/node]
           7: 0xd64b75 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/opt/actions-runner/externals/node12/bin/node]
           8: 0xd65a25 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/actions-runner/externals/node12/bin/node]
           9: 0xd670cf v8::internal::Heap::HandleGCRequest() [/opt/actions-runner/externals/node12/bin/node]
          10: 0xd15b35 v8::internal::StackGuard::HandleInterrupts() [/opt/actions-runner/externals/node12/bin/node]
          11: 0x1071176 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/opt/actions-runner/externals/node12/bin/node]
          12: 0x140dc19  [/opt/actions-runner/externals/node12/bin/node]
      NO_WRAP
      
      I have tried to use the latest version of the action (1.1.3), but I have
      got the same issue.
      
      It looks like it is a `coverallsapp/github-action` issue due to issue
      in JavaScript due to inefficient amount of memory. The corresponding
      bug [1] was filed against the repo.
      
      So I suggest switching to the console utility `coveralls-lcov`. I did
      some internal testing and it works fine.
      
      [1] https://github.com/coverallsapp/github-action/issues/133
      
      Fixes tarantool/tarantool-qa#278
      
      NO_DOC=ci
      NO_TEST=ci
      NO_CHANGELOG=ci
      
      (cherry picked from commit 761574e3)
      Unverified
      abba4f80
  3. Oct 14, 2022
  4. Oct 13, 2022
  5. Oct 12, 2022
  6. Oct 11, 2022
    • Mergen Imeev's avatar
      sql: change rules used to determine NULLIF() type · 5c6afe47
      Mergen Imeev authored
      This patch introduces new rules to determine type of NULLIF() built-in
      function.
      
      Closes #6990
      
      @TarantoolBot document
      Title: New rules to determine type of result of NULLIF
      
      The type of the result of NULLIF() function now matches the type of the
      first argument.
      
      (cherry picked from commit 805cbaa7)
      5c6afe47
    • Mergen Imeev's avatar
      sql: change rules used to determine CASE type · 5585825a
      Mergen Imeev authored
      This patch introduces new rules to determine type of CASE operation.
      
      Part of #6990
      
      @TarantoolBot document
      Title: New rules to determine type of result of CASE
      
      New rules are applied to determine the type of the CASE operation. If
      all values are NULL with no type, or if a bind variable exists among
      the possible results, then the type of CASE is ANY. Otherwise, all NULL
      values with no type are ignored, and the type of CASE is determined
      using the following rules:
      1) if all values of the same type, then type of CASE is this type;
      2) otherwise, if any of the possible results is of one of the
      incomparable types, then the type of CASE is ANY;
      3) otherwise, if any of the possible results is of one of the
      non-numeric types, then the type of CASE is SCALAR;
      4) otherwise, if any of the possible results is of type NUMBER, then the
      type of CASE is NUMBER;
      5) otherwise, if any of the possible results is of type DECIMAL, then
      the type of CASE is DECIMAL;
      6) otherwise, if any of the possible results is of type DOUBLE, then the
      type of CASE is DOUBLE;
      7) otherwise the type of CASE is INTEGER.
      
      (cherry picked from commit 90f64460)
      5585825a
  7. Oct 07, 2022
  8. Oct 06, 2022
  9. Oct 05, 2022
  10. Sep 30, 2022
  11. Sep 29, 2022
    • Serge Petrenko's avatar
      gc: replace vclockset_psearch with _match in wal_collect_garbage_f · d6fc95f6
      Serge Petrenko authored
      When using vclockset_psearch, the resulting vclock may be incomparable
      to the search key. For example, with a vclock set { } (empty vclock),
      {0: 1, 1: 10}, {0: 2, 1:11} vclockset_psearch(set, {0:2, 1: 9}) might
      return {0: 1, 1: 10}, and not { }.
      This is known and avoided in other places, for example
      recover_remaining_wals(), where vclockset_match() is used instead.
      vclockset_match() starts with the same result as vclockset_psearch() and
      then unwinds the result until the first vclock which is less or equal to
      the search key is found.
      
      Having vclockset_psearch in wal_collect_garbage_f could lead to issues
      even before local space changes became written to 0-th vclock component.
      Once replica subscribes, its' gc consumer is set to the vclock, which
      the replica sent in subscribe request. This vclock might be incomparable
      with xlog vclocks of the master, leading to the same issue of
      potentially deleting a needed xlog during gc.
      
      Closes #7584
      
      NO_DOC=bugfix
      
      (cherry picked from commit c63bfb9a)
      d6fc95f6
  12. Sep 28, 2022
    • Georgiy Lebedev's avatar
      memtx: fix transaction manager MVCC invariant violation · 1fac9eef
      Georgiy Lebedev authored
      We hold the following invariant in MVCC: the story at the top of the
      history chain is present in index.
      
      If a story is subject to be deleted from index and there is an older story
      in the history chain, the older story starts to be at the top of the
      history chain and is not present in index, which violates our invariant:
      explicitly check for this case when evaluating whether a story can be
      garbage collected and add an assertion to check the invariant above is not
      violated.
      
      Rollbacked stories need to be handled in a special way: they are
      present at the end of some history chains and completely unlinked from
      others (which also implies they are not present in the corresponding
      indexes).
      
      `memtx_tx_story_full_unlink` is called in two contexts: space deletion, in
      which we delete all stories, and garbage collection step — the former case
      can break the invariant described above, while the latter must preserve it,
      hence add two different functions for the corresponding contexts.
      
      Closes #7490
      
      NO_CHANGELOG=<internal bugfix not user observable>
      NO_DOC=<bugfix>
      
      (cherry picked from commit c8eccfbb)
      1fac9eef
    • Georgiy Lebedev's avatar
      memtx: rework transaction rollback · 61be2c8f
      Georgiy Lebedev authored
      When we rollback a transaction statement, we relink its read trackers
      to a newer story in the history chain, if present (6c990a7b), but we do not
      handle the case when there is no newer story.
      
      If there is an older story in the history chain, we can relink the
      rollbacked story's reader to it, but if the rollbacked story is the
      only one left, we need to retain it, because it stores the reader list
      needed for conflict resolution — such stories are distinguished by the
      rollbacked flag, and there can be no more than one such story located
      strictly at the end of a given history chain (which means a story can be
      fully unlinked from some indexes and present at the end of others).
      
      There are several nuances we need to account for:
      
      Firstly, such rollbacked stories must be impossible to read from an index:
      this is ensured by `memtx_tx_story_is_visible`.
      
      Secondly, rollbacked transactions need to be treated as prepared with
      stories that have `add_psn == del_psn`, so that they are correctly deleted
      during garbage collection.
      
      After this logical change we have the following partially ordered set over
      tuple stories:
      ———————————————————————————————————————————————————————> serialization time
      |- - - - - - - -|— — — — — -|— — — — — |— — — — — — -|— — — — — — — -
      | No more than  | Committed | Prepared | In-progress | One dirty
      | one rollbacked|           |          |             | story in index
      | story         |           |          |             |
      |- - - - - - - -|— — — — — -| — — — — —|— — — — — — -|— — — — — — — —
      
      Closes #7343
      
      NO_DOC=bugfix
      
      (cherry picked from commit 56cf737c)
      61be2c8f
    • Georgiy Lebedev's avatar
      memtx: remove redundant `space` field from `struct memtx_story` · 8ee6a2f2
      Georgiy Lebedev authored
      `struct memtx_story` has a `space` field, which is basically used
      to identify that a tuple is unlinked from the history chain in
      `memtx_tx_index_invisible_count_slow` (though this can be determined by its
      presence in the index) and is used to get the space's index in
      `memtx_tx_story_link_top` (though it can be  retrieved from the older
      story's link field): remove this redundant field.
      
      Needed for #7343
      
      NO_CHANGELOG=<refactoring>
      NO_DOC=<refactoring>
      NO_TEST=<refactoring>
      
      (cherry picked from commit 55e64a8d)
      8ee6a2f2
    • Georgiy Lebedev's avatar
      memtx: refactor story cleanup on space delete · 0533d097
      Georgiy Lebedev authored
      When a space is deleted, all transactions need to be aborted and all their
      stories need to be removed immediately out of order: currently we
      artificially rollback statements — instead call this statement
      removal to logically distinguish it from rollback. It differs in the sense
      that the whole space's tuple history is teared down instead — no more
      transaction managing is going to be done as opposed to rollback of an
      individual transaction.
      
      Needed for #7343
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit 88203d4f)
      0533d097
    • Georgiy Lebedev's avatar
      memtx: refactor `memtx_tx_history_rollback_stmt` · 81fede2f
      Georgiy Lebedev authored
      Follow `memtx_tx_history_{add, prepare}_{insert, delete}` pattern: split
      code responsible for rollbacking addition and deletion of a story into
      separate functions.
      
      Needed for #7343
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactorin
      
      (cherry picked from commit 9dd27681)
      81fede2f
    • Georgiy Lebedev's avatar
      memtx: refactor removing of story's delete statements · a3f136cf
      Georgiy Lebedev authored
      When a statement gets rollbacked, we need to remove delete statements
      attached to the story it adds by relinking them and making them delete an
      older story in the history chain: refactor this loop out into a separate
      function.
      
      Needed for #7343
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit 1da727f6)
      a3f136cf
    • Georgiy Lebedev's avatar
      memtx: refactor sinking of story added by prepared statement · f0c3ccb8
      Georgiy Lebedev authored
      If a statement becomes prepared, the story it adds must be 'sunk' to
      the level of prepared stories: refactor this loop into a
      separate function.
      
      Needed for #7343
      
      NO_CHANGELOG=refactoring
      NO_DOC=refactoring
      NO_TEST=refactoring
      
      (cherry picked from commit b25d3729)
      f0c3ccb8
  13. Sep 26, 2022
    • Vladislav Shpilevoy's avatar
      xrow: fix crash on nested map/array update ops · 3def2916
      Vladislav Shpilevoy authored
      If an update operation tried to insert a new key into a map or an
      array which was created by a previous update operation, then the
      process would fail an assertion.
      
      That was because the first operation was stored as a bar update.
      The second operation tried to branch it assuming that the entire
      bar update's JSON path must exist, but it wasn't so for the newly
      created part of the path.
      
      The solution is to fallback to branching earlier than the entire
      bar path ends, if can see that the next part of the path can't be
      found.
      
      Closes #7705
      
      NO_DOC=bugfix
      
      (cherry picked from commit 8425ebfc)
      3def2916
  14. Sep 23, 2022
    • Georgiy Lebedev's avatar
      memtx: track `index:random` reads and clarify result · 2af84a85
      Georgiy Lebedev authored
      TREE (HASH) index implements `random` method: if the space is empty from
      the transaction's perspective, which means we have to return nothing, add
      gap tracking of whole range (full scan
      tracking), since this result is equivalent to `index:select{}`, otherwise
      repeatedly call `random` and clarify result, until we get a non-empty one.
      We do not care about performance here, since all operations in context of
      transaction management currently have O(number of dirty tuples)
      complexity.
      
      Closes #7670
      
      NO_DOC=bugfix
      
      (cherry picked from commit 1b82beb2)
      2af84a85
    • Vladimir Davydov's avatar
      salad: add LIGHT(random) method · a647b1d8
      Vladimir Davydov authored
      This commit moves the code that gets the index of a random light
      record from the memtx hash index implementation to a new light method.
      This gives us more freedom of refactoring the light internals without
      modifying the code using it.
      
      After this change, LIGHT(pos_valid) isn't needed anymore so it's
      inlined in LIGHT(random).
      
      Needed for #7192
      
      NO_DOC=refactoring
      NO_TEST=refactoring
      NO_CHANGELOG=refactoring
      
      (cherry picked from commit 76add786)
      a647b1d8
    • Georgiy Lebedev's avatar
      memtx: refactor `index_def_new` · 07c0d3a6
      Georgiy Lebedev authored
      Since `key_def_merge` sets the merged key definition's unique part count
      equal to the new part count, the extra assignment in case the index is not
      unique is redundant: remove it.
      
      NO_CHANGELOG=<refactoring>
      NO_DOC=<refactoring>
      NO_TEST=<refactoring>
      
      (cherry picked from commit 1d6c92e5)
      07c0d3a6
    • Georgiy Lebedev's avatar
      memtx: fix TREE index `get` check for part count · b9d62fca
      Georgiy Lebedev authored
      If TREE index `get` result is empty, the key part count is incorrectly
      compared to the tree's `cmp_def->part_count`, though it should be compared
      with `cmp_def->unique_part_count`. But we can actually assume that by the
      time we get to the index's `get` method the part count is equal to the
      unique part count (partial keys are rejected and `get` is not
      supported for non-unique indexes): change check to correct assertion.
      
      Closes #7685
      
      NO_DOC=<bugfix>
      
      (cherry picked from commit bfcd8ca7)
      b9d62fca
  15. Sep 21, 2022
    • Boris Stepanenko's avatar
      limbo: fix assertions in box_issue_de/promote · 65b3bad6
      Boris Stepanenko authored
      Replaced assertions, that no one started new elections/promoted while
      acquiring limbo, with checks that raft term and limbo term didn't
      change. In case they did - don't write DEMOTE/PROMOTE and just release
      limbo, because it's already owned/will soon be by someone else.
      
      Closes #7086
      
      NO_DOC=Bugfix
      
      (cherry picked from commit 8ee0e434)
      65b3bad6
Loading