Skip to content
Snippets Groups Projects
  1. Nov 15, 2019
  2. Aug 23, 2019
    • Alexander Turenko's avatar
      test: tarantoolctl: verify delayed box.cfg() · 3e4dea42
      Alexander Turenko authored
      app-tap.tarantoolctl.test.lua fails after
      17df9edf ('tarantoolctl: allow to start
      instances with delayed box.cfg{}').
      
      The commit fixes the test case that did check that an error is reported
      if box.cfg() was not called in an instance script.
      
      Follows up #4435.
      Fixes #4448.
      
      (cherry picked from commit 6c627af3)
      3e4dea42
  3. Jul 26, 2019
    • Kirill Shcherbatov's avatar
      box: introduce functional indexes in memxtx · 4177fe17
      Kirill Shcherbatov authored
      Closes #1260
      
      @TarantoolBot document
      Title: introduce func indexes in memtx
      Now you can define a func_index using a registered persistent
      function.
      
      There are restrictions for function and key definition for
      a functional index:
       - the referenced function must be persistent, deterministic
         and must return a scalar type or an array.
       - you must define key parts which describe the function return value
       - the function must return data which types match the
         defined key parts
       - the function may return multiple keys; this would be a multikey
         functional index; each key entry is indexed separately;
       - for multikey functional indexes, the key definition should
         start with part 1 and cover all returned key parts
       - key parts can't use JSON paths.
       - the function used for the functional index can not access tuple
         fields by name, only by index.
      
      Functional index can't be primary.
      It is not possible to change the used function after a functional
      index is defined on it. The index must be dropped first.
      
      Each key returned by functional index function (even when it is a
      single scalar) must be returned as a table i.e. {1} and must
      match the key definition.
      
      To define a multikey functional index, create a function with
      opts = {is_multikey = true} and return a table of keys.
      
      Example:
      s = box.schema.space.create('withdata')
      s:format({{name = 'name', type = 'string'},
                {name = 'address', type = 'string'}})
      pk = s:create_index('name', {parts = {1, 'string'}})
      lua_code = [[function(tuple)
                      local address = string.split(tuple[2])
                      local ret = {}
                      for _, v in pairs(address) do
      			table.insert(ret, {utf8.upper(v)})
      		end
                      return ret
                   end]]
      box.schema.func.create('address', {body = lua_code,
                             is_deterministic = true, is_sandboxed = true,
                             opts = {is_multikey = true}})
      idx = s:create_index('addr', {unique = false,
                           func = 'address',
                           parts = {{1, 'string', collation = 'unicode_ci'}}})
      s:insert({"James", "SIS Building Lambeth London UK"})
      s:insert({"Sherlock", "221B Baker St Marylebone London NW1 6XE UK"})
      idx:select('Uk')
      ---
      - - ['James', 'SIS Building Lambeth London UK']
        - ['Sherlock', '221B Baker St Marylebone London NW1 6XE UK']
      ...
      4177fe17
  4. Jun 06, 2019
    • Roman Khabibov's avatar
      schema: add "_vcollation" sysview · 3e3ef182
      Roman Khabibov authored
      Add "_vcollation" sysview to read it from net.box. This
      sysview is always readable, except when a user doesn't have
      "public" role.
      
      Needed for #3941
      
      @TarantoolBot document
      Title: box.space._vcollation
      
      _vcollation is a system space that represents a virtual view.
      The structure of its tuples is identical to that of _collation.
      Tuples of this sysview is always readable, except when the user
      doesn't have "public" role.
      3e3ef182
    • Kirill Shcherbatov's avatar
      schema: add new system space for CHECK constraints · ef56c42d
      Kirill Shcherbatov authored
      This patch introduces a new system space to persist check
      constraints. The format of the new system space is
      
      _ck_constraint (space id = 364)
      [<space id> UINT, <constraint name> STR,
       <is_deferred>BOOL, <language>STR, <code>STR]
      
      A CK constraint is local for a space, so every pair
      <space id, CK name> is unique
      (it is also the PK in the _ck_constraint space).
      
      After insertion into this space, a new instance describing check
      constraint is created. Check constraint holds an exspression AST.
      While space features some check constraints, it isn't allowed to
      be dropped. The :drop() space method firstly deletes all check
      constraints and then removes an entry from the _space.
      
      Because the space alter, the index alter and the space truncate
      operations cause space recreation process, a new
      RebuildCkConstrains object is introduced. This alter object
      compiles a new ck constraint object, replaces and removes
      an existent instances atomically (but if the assembly of some
      ck constraint object fails, nothing is changed).
      In fact, in scope of this patch we don't really need to recreate
      a ck_constraint object in such situations (it is enough to patch
      space_def pointer in AST tree like we did it before, but we are
      going to recompile a VDBE that represents ck constraint in
      further patches, and that operation is not safe).
      
      The main motivation for these changes is an ability to support
      ADD CHECK CONSTRAINT operation in the future. CK constraints are
      easier to manage as self-sustained objects: such change is
      managed with atomic insertion(unlike the current architecture).
      
      Finally, the xfer optimization is disabled now if some space have
      ck constraints. In following patches this xfer optimisation
      becomes impossible, so there is no reason to rewrite this code
      now.
      
      Needed for #3691
      ef56c42d
  5. 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
  6. Apr 05, 2019
    • Mergen Imeev's avatar
      box: remove _sql_stat1 and _sql_stat4 system tables · ec93b4a5
      Mergen Imeev authored
      These tables won't be used anymore and should be deleted.
      
      Note, this patch breaks backward compatibility between 2.1.1 and
      2.1.2, but that's okay as 2.1.1 was beta and we didn't recommend
      anyone to use it.
      
      Part of #2843
      Follow up #4069
      ec93b4a5
  7. Mar 26, 2019
    • Alexander Turenko's avatar
      Fix tarantoolctl cat/play premature stop with --to · 70a8342f
      Alexander Turenko authored
      Stop a file processing loop only when it is guaranteed that we will not
      find a record that match user-provided filters later in this file. If
      --replica R is provided one time and we're meet a record from R with a
      LSN equal or above of a --to value, we'll stop the loop. Otherwise (no
      --replica, several --replica arguments) a file will be read until an end
      even if --to is provided.
      
      Fixes #3827.
      70a8342f
    • Alexander Turenko's avatar
      Unify tarantoolctl cat/play xlog filtering code · 092bc7ed
      Alexander Turenko authored
      Exposed this unified code (filter_xlog() function) and wrote a unit
      test.
      
      Allow to run app-tap/tarantoolctl.test.lua w/o test-run.
      
      Needed for #3827.
      092bc7ed
  8. Sep 25, 2018
    • Serge Petrenko's avatar
      tarantoolctl: fix cat and play for empty body requests · 24a87ff2
      Serge Petrenko authored
      If space.before_replace returns the old tuple, the operation turns into
      no-op, but is still written to WAL as IPROTO_NOP for the sake of
      replication. Such a request doesn't have a body, and tarantoolctl failed
      to parse such requests in `tarantoolctl cat` and `tarantoolctl play`.
      Fix this by checking whether a request has a body. Also skip such
      requests in `play`, since they have no effect, and, while we're at it,
      make sure `play` and `cat` do not read excess rows with lsn>=to in case
      these rows are skipped.
      
      Closes #3675
      24a87ff2
  9. Aug 22, 2018
    • Vladimir Davydov's avatar
      Introduce _vinyl_deferred_delete system space · f4cb5fc8
      Vladimir Davydov authored
      The space is a blackhole. It will be used for writing deferred DELETE
      statements generated by vinyl compaction tasks to WAL so that we can
      recover deferred DELETEs that hadn't been dumped to disk before the
      server was restarted.
      
      Since the new space doesn't depend on other system spaces, let's assign
      the minimal possible id to it, i.e. 257.
      
      Needed for #2129
      f4cb5fc8
  10. Aug 21, 2018
  11. Aug 20, 2018
    • Vladimir Davydov's avatar
      tarantoolctl: remove confusing message on eval error · dc648b99
      Vladimir Davydov authored
      If `tarantoolctl eval` fails, apart from returning 3 and printing the
      eval error to stderr, tarantoolctl will also emit the following message:
      
        Error while reloading config:
      
      This message is quite confusing and useless too, as we have the return
      code for that. Let's zap it.
      
      Closes #3560
      dc648b99
  12. Aug 17, 2018
    • Serge Petrenko's avatar
      test: fix app-tap/tarantoolctl sporadic failure · 9bf93573
      Serge Petrenko authored
      When `tarantoolctl status` is called immediately after `tarantoolctl
      stop` there is a chance that tarantool hasn't exited yet, so the pid
      file still exists, which is reported by `tarantoolctl status`. This
      leads to occasional test failures. Fix this by waiting till tarantool
      exits before calling `status`.
      
      Closes #3557
      9bf93573
  13. Aug 13, 2018
  14. Jun 29, 2018
  15. May 11, 2018
  16. Feb 09, 2018
    • AKhatskevich's avatar
      sql: make _sql_stat[14] to be a system spaces · bf08081e
      AKhatskevich authored
        Making `stat[14]` a system spaces enables us to allow users to create
      spaces which starts with `_`, because it cannot affect internal state
      anymore.
        Since now the only constraints on table names is:
          - consists of printable symbols only
          - length < 65k
      
      Closes #2126
      bf08081e
  17. Oct 06, 2017
  18. Sep 26, 2017
    • Vladimir Davydov's avatar
      box: implement auto increment · d121e7c4
      Vladimir Davydov authored
      The value returned by space.auto_increment() is not guaranteed to be
      monotonically growing, because this method uses max+1 for the next
      generated value, which can be less than a value generated before in case
      the max key is deleted. Besides, calling max() may be expensive, e.g. it
      requires a disk access in case of Vinyl. So this patch implements auto
      increment based on persistent sequences.
      
      To be used for auto increment, a sequence needs to be attached to a
      space. To attach an existing sequence to a space, pass 'sequence=ID' in
      index options when creating or modifying the primary key. Here ID is the
      name or the numeric identifier of the sequence to attach. Note,
      sequences can be attached only to spaces with integer primary key.
      After a sequence is attached, it will be used for auto increment when
      the user passes 'nil' for the primary key value. If the user passes a
      value different from 'nil', the value will be used to update the
      attached sequence.
      
      To detach a sequence from the space it was attached to, either drop the
      primary key of the space or alter the primary key with 'sequence=false'.
      
      It is not necessary to pre-create a sequence to use it for auto
      increment - a sequence can be automatically generated. To generate a
      sequence automatically, pass 'sequence=true' in index options.
      Automatically generated sequences are named '_auto_ID', where ID is the
      space id, and removed when the space is dropped or the sequence is
      detached.
      
      A sequence cannot be dropped as long as it is attached to any spaces.
      
      Closes #389
      d121e7c4
  19. Sep 19, 2017
    • Vladimir Davydov's avatar
      box: implement persistent sequences · f797eec4
      Vladimir Davydov authored
      This patch implements a new object type, persistent sequences. Sequences
      are created with function box.schema.sequence.create(name, options).
      Options include min/max, start value, increment, cache size, just like
      in Postgresql, although 'cache' is ignored for now. All sequences can be
      accessed via box.sequence.<name>, similarly to spaces. To generate a
      sequence value, use seq:next() method. To retrieve the last generated
      value, use seq:get(). A sequence value can also be reset to the start
      value or to any other value using seq:reset() and seq:set() methods.
      
      Needed for #389
      f797eec4
  20. Jul 20, 2017
  21. Jun 21, 2017
    • Vladimir Davydov's avatar
      alter: initialize truncate system space lazily · 1f0b74e4
      Vladimir Davydov authored
      Currently, space.create must insert an entry into 'truncate' system
      space - if it does not, space.truncate won't work. This is incontinent,
      as it makes it impossible to create spaces by simply inserting a tuple
      into the 'space' system space via iproto API. So let's insert entries
      into truncate space lazily, on the first space truncation.
      
      Closes #2524
      1f0b74e4
  22. Jun 08, 2017
    • Kirill Yukhin's avatar
      sql: Support persistency for SQL triggers · f135657f
      Kirill Yukhin authored
      Persistency for SQL triggers supported by introducing
      new system space called `_trigger` which should store all
      SQL triggers registered. Add space itself, make
      visible to Lua, update bootstrap code and regenerate
      bootstrap.snap.
      Insertion into the space is done by introducing new VDBE
      opcode `OP_ParseSchema3` which provides a pair of trigger
      name and SQL which creates the trigger.
      During system restore `_trigger` is scanned and its contents
      parsed back into VDBE.
      Update tests and extend test for persistency w/ trigger case.
      
      Closes #2320
      f135657f
    • Vladimir Davydov's avatar
      Rework space truncation · 353bcdc5
      Vladimir Davydov authored
      Space truncation that we have now is not atomic: we recreate all indexes
      of the truncated space one by one. This can result in nasty failures if
      a tuple insertion races with the space truncation and sees some indexes
      truncated and others not.
      
      This patch redesigns space truncation as follows:
      
       - Truncate is now triggered by bumping a counter in a new system space
         called _truncate. As before, space truncation is implemented by
         recreating all of its indexes, but now this is done internally in one
         go, inside the space alter trigger. This makes the operation atomic.
      
       - New indexes are created with Handler::createIndex method, old indexes
         are deleted with Index::~Index. Neither Index::commitCreate nor
         Index::commitDrop are called in case of truncation, in contrast to
         space alter. Since memtx needs to release tuples referenced by old
         indexes, and vinyl needs to log space truncation in the metadata log,
         new Handler methods are introduced, prepareTruncateSpace and
         commitTruncateSpace, which are passed the old and new spaces. They
         are called before and after truncate record is written to WAL,
         respectively.
      
       - Since Handler::commitTruncateSpace must not fail while vylog write
         obviously may, we reuse the technique used by commitCreate and
         commitDrop methods of VinylIndex, namely leave the record we failed
         to write in vylog buffer to be either flushed along with the next
         write or replayed on WAL recovery. To be able to detect if truncation
         was logged while recovering WAL, we introduce a new vylog record
         type, VY_LOG_TRUNCATE_INDEX which takes truncate_count as a key: if
         on WAL recovery index truncate_count happens to be <= space
         truncate_count, then it it means that truncation was not logged and
         we need to log it again.
      
      Closes #618
      Closes #2060
      353bcdc5
  23. Apr 07, 2017
  24. Apr 05, 2017
  25. Mar 09, 2017
  26. Feb 01, 2017
  27. Jan 31, 2017
  28. Jan 18, 2017
  29. Jan 13, 2017
  30. Nov 14, 2016
  31. Apr 01, 2016
    • bigbes's avatar
      Refactor tarantoolctl · 2a861ae4
      bigbes authored
      + closes gh-1405 (right path for unix socket)
      + wrap box.cfg and loadfile with pcall
      + some variable/function scope cleanups (global -> local)
      + closes gh-1409 (check for lua syntax before running/restarting/eval server)
      2a861ae4
  32. Feb 05, 2016
Loading