Skip to content
Snippets Groups Projects
  1. 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
  2. Mar 17, 2020
  3. Mar 16, 2020
  4. Mar 12, 2020
    • Alexander Turenko's avatar
      test: update test-run · c401880b
      Alexander Turenko authored
      Add filename option to grep_log() (#106).
      
      The option can be used when it is not possible to grab 'box.cfg.log'
      value from a tarantool instance: say, when the instance is stopped or
      crashed.
      
      Usage:
      
       | local test_run = require('test_run').new()
       | test_run:grep_log(node, what, bytes, {filename = <...>})
      c401880b
  5. Mar 10, 2020
    • Vladislav Shpilevoy's avatar
      box: fix struct port_tuple.size wrong type in Lua · 8bea83ed
      Vladislav Shpilevoy authored
      Original port_tuple in C has 'int size;' field. It was
      'size_t size' in Lua. Since sizeof(size_t) usually is
      8, and sizeof(int) is 4, this was a really bad typo.
      8bea83ed
    • Olga Arkhangelskaia's avatar
      memtx: fix out of memory handling for rtree · 3b4fbdc0
      Olga Arkhangelskaia authored
      When tarantool tries to recover rtree from a snapshot and memtx_memory value
      is lower than it has been when the snapshot was created, server suffers from
      segmentation fault. This happens because there is no out of memory error
      handling in rtree lib. In another words, we do not check the result of
      malloc operation.
      The execution flow in case of recovery uses different way and the secondary
      keys are build in batches. That way has no checks and reservations.
      The patch adds memtx_rtree_index_reserve implementation to make sure that any
      memory allocation in rtree will fail. Although this gives us no additional
      optimization as in case of memtx_tree, the memory reservation prevents
      tarantool from segmentation fault. If there is not enough memory to be reserved
      server will fail gently with the "Failed to allocate" error message.
      
      Closes #4619
      3b4fbdc0
  6. Mar 08, 2020
    • Maria's avatar
      box: netbox.self and connect should work interchangeably · 0bcf9a59
      Maria authored
      Despite what was stated in the documentation, netbox.connect was not always
      equivalent to netbox.self. In particular, they converted tuple to different
      types - table and cdata respectively.
      
      The patch fixes the issue and covers all cases where netbox.self and connect
      perform conversion of types - e.g., for box.error.
      
      Closes #4513
      0bcf9a59
  7. Mar 06, 2020
    • Vladislav Shpilevoy's avatar
      test: fix fio.test.lua flakiness · d8a9f1d9
      Vladislav Shpilevoy authored
      In 89c73e64 ("fio: respect
      $TMPDIR in fio.tempdir(), when it is set") was added a test
      checking that fio.tempdir() returns a path to a folder, stored
      by a path specified in $TMPDIR environment variable.
      
      Check was done by calling Lua returned_path:find(tmpdir_path).
      If tmpdir path contained 'special' characters such as '.', it
      didn't match, because string.find() takes a regular expression,
      not just a string.
      
      string.startswith() works fine.
      
      Follow-up #4794
      d8a9f1d9
    • Maria's avatar
      Hotfix for b0f588f6: don't account :execute() call twice · c05f5d4a
      Maria authored
      The patch fixes a bug for the commit b0f588f6 where statistics on
      box.execute was collected twice. This happened because
      sql_prepare_and_execute called sql_execute under the hood, so there's
      no need to do rmean_collect in both of them.
      
      Follow-up #4756
      c05f5d4a
  8. Mar 05, 2020
    • Chris Sosnin's avatar
      lua: expose checktuple function · 82cc5631
      Chris Sosnin authored
      All lua types feature check, push and is functions. We expose lua_checktuple
      for full consistency.
      
      Closes #2553
      82cc5631
    • Kirill Yukhin's avatar
      luajit: bump new version · 12694d72
      Kirill Yukhin authored
      - Make string to number conversions fail on NUL char.
      12694d72
    • Kirill Yukhin's avatar
      luajit: bump new version · a81453b9
      Kirill Yukhin authored
      - gdb: adjust the extension to be used with Python 2
      - gdb: introduce luajit-gdb extension
      a81453b9
    • Vladislav Shpilevoy's avatar
      fio: respect $TMPDIR in fio.tempdir(), when it is set · 89c73e64
      Vladislav Shpilevoy authored
      TMPDIR is an environment variable used to tell what a directory
      should be used to create temporary files. It is described in the
      POSIX standard, and should be used by programs creating temporary
      files.
      
      Closes #4794
      
      @TarantoolBot document
      Title: fio.tempdir() $TMPDIR
      
      fio.tempdir() stores created temporary directory into /tmp by
      default. This can be changed by setting TMPDIR environment
      variable. Before starting Tarantool, or at runtime by
      os.setenv().
      89c73e64
    • Serge Petrenko's avatar
      build: link bundled libcurl with c-ares · 23837076
      Serge Petrenko authored
      libcurl has a built-in threaded resolver used for asynchronous DNS
      requests, however, when DNS server is slow to respond, the request still
      hangs tarantool until it is finished. The reason is that curl calls
      thread_join on the resolving thread internally upon timeout, making the
      calling thread hang until resolution has ended.
      Use c-ares as an asynchronous resolver instead to eliminate the problem.
      
      Closes #4591
      23837076
    • Maria's avatar
      box: replication shouldn't leak user password · a806549d
      Maria authored
      It was possible to leak user password through setting 'replication'
      configuration option in first box.cfg invocation. This happened due
      to unconditional logging in load_cfg function. The patch introduces
      conditional logging.
      
      Closes #4493
      a806549d
  9. Mar 04, 2020
    • Roman Khabibov's avatar
      sql: support constraint drop · 85adac03
      Roman Khabibov authored
      Extend <ALTER TABLE> statement to drop table constraints by their
      names.
      
      Closes #4120
      
      @TarantoolBot document
      Title: Drop table constraints in SQL
      Now, it is possible to drop table constraints (PRIMARY KEY,
      UNIQUE, FOREIGN KEY, CHECK) using
      <ALTER TABLE table_name DROP CONSTRAINT constraint_name> statement
      by their names.
      
      For example:
      
      tarantool> box.execute([[CREATE TABLE test (
                                   a INTEGER PRIMARY KEY,
                                   b INTEGER,
                                   CONSTRAINT cnstr CHECK (a >= 0)
                              );]])
      ---
      - row_count: 1
      ...
      
      tarantool> box.execute('ALTER TABLE test DROP CONSTRAINT cnstr;')
      ---
      - row_count: 1
      ...
      
      The same for all the other constraints.
      85adac03
    • Roman Khabibov's avatar
      sql: don't select from _index during parsing · 4bdcb3fa
      Roman Khabibov authored
      Remove function box_index_by_name() from parser to avoid selects
      during parsing. Add the ability to choose index during VDBE code
      compilation which will be used to find the tuple to drop from a
      system space.
      
      Needed for #4120
      4bdcb3fa
    • Roman Khabibov's avatar
      sql: improve "no such constraint" error message · 7d558ae8
      Roman Khabibov authored
      Clarify the error message for better user handling. Add the name
      of space where the constraint under dropping wasn't founded.
      
      Part of #4120
      7d558ae8
  10. Mar 03, 2020
    • Serge Petrenko's avatar
      replication: fix rebootstrap in case the instance is listed in box.cfg.replication · dbcfaf70
      Serge Petrenko authored
      When checking wheter rejoin is needed, replica loops through all the
      instances in box.cfg.replication, which makes it believe that there is a
      master holding files, needed by it, since it accounts itself just like
      all other instances.
      So make replica skip itself when finding an instance which holds files
      needed by it, and determining whether rebootstrap is needed.
      
      We already have a working test for the issue, it missed the issue due to
      replica.lua replication settings. Fix replica.lua to optionally include
      itself in box.cfg.replication, so that the corresponding test works
      correctly.
      
      Closes #4759
      dbcfaf70
  11. Mar 02, 2020
    • Serge Petrenko's avatar
      replication: do not relay rows coming from a remote instance back to it · ed2e1430
      Serge Petrenko authored
      We have a mechanism for restoring rows originating from an instance that
      suffered a sudden power loss: remote masters resend the isntance's rows
      received before a certain point in time, defined by remote master vclock
      at the moment of subscribe.
      However, this is useful only on initial replication configuraiton, when
      an instance has just recovered, so that it can receive what it has
      relayed but haven't synced to disk.
      In other cases, when an instance is operating normally and master-master
      replication is configured, the mechanism described above may lead to
      instance re-applying instance's own rows, coming from a master it has just
      subscribed to.
      To fix the problem do not relay rows coming from a remote instance, if
      the instance has already recovered.
      
      Closes #4739
      ed2e1430
    • Serge Petrenko's avatar
      replication: implement an instance id filter for relay · 45de9907
      Serge Petrenko authored
      Add a filter for relay to skip rows coming from unwanted instances.
      A list of instance ids whose rows replica doesn't want to fetch is encoded
      together with SUBSCRIBE request after a freshly introduced flag IPROTO_ID_FILTER.
      
      Filtering rows is needed to prevent an instance from fetching its own
      rows from a remote master, which is useful on initial configuration and
      harmful on resubscribe.
      
      Prerequisite #4739, #3294
      
      @TarantoolBot document
      
      Title: document new binary protocol key and subscribe request changes
      
      Add key `IPROTO_ID_FILTER = 0x51` to the internals reference.
      This is an optional key used in SUBSCRIBE request followed by an array
      of ids of instances whose rows won't be relayed to the replica.
      
      SUBSCRIBE request is supplemented with an optional field of the
      following structure:
      ```
      +====================+
      |      ID_FILTER     |
      |   0x51 : ID LIST   |
      | MP_INT : MP_ARRRAY |
      |                    |
      +====================+
      ```
      The field is encoded only when the id list is not empty.
      45de9907
    • Serge Petrenko's avatar
      wal: warn when trying to write a record with a broken lsn · e0750262
      Serge Petrenko authored
      There is an assertion in vclock_follow `lsn > prev_lsn`, which doesn't
      fire in release builds, of course. Let's at least warn the user on an
      attempt to write a record with a duplicate or otherwise broken lsn, and
      not follow such an lsn.
      
      Follow-up #4739
      e0750262
    • Serge Petrenko's avatar
      box: expose box_is_orphan method · 7b83b73d
      Serge Petrenko authored
      is_orphan status check is needed by applier in order to tell relay
      whether to send the instance's own rows back or not.
      
      Prerequisite #4739
      7b83b73d
  12. Feb 28, 2020
Loading