Skip to content
Snippets Groups Projects
  1. Nov 19, 2018
    • Nikita Pettik's avatar
      Disable triggers for _collation during bootstrap · a7dbf78f
      Nikita Pettik authored
      After patch that introduced "none" collation (a953051e),
      box.internal.bootstrap() started to fail due to inability to drop
      mentioned collation. Lets turn off system triggers for _collation space
      in order to process its complete purification during bootstrap.
      a7dbf78f
  2. Nov 15, 2018
    • Nikita Pettik's avatar
      Introduce "none" and "binary" collations · a953051e
      Nikita Pettik authored
      This patch introduces two new collation sequences: "none" and "binary".
      Despite the fact that they use the same comparing algorithm (simple
      byte-by-byte comparison), they don't mean the same. "binary" collation
      get to the format if user explicitly points it: either specifies this
      collation in space format manually or adds <COLLATE BINARY> clause to
      column definition within CREATE TABLE statement. "none" collation is
      used when user doesn't specify any collation at all. "none" collation always
      comes with id == 0 and it can't be changed (since its id vastly used
      under the hood as an indicator of absence of collation).
      Difference between these collations is vital for ANSI SQL: mixing
      "binary" with other collations is prohibited, meanwhile "none" collation
      can be used alongside with others.
      In this respect current patch extends list of available collations: now
      not only ICU collations are allowed, but also BINARY.
      
      Note, that in SQL some queries have changed their query plan. That
      occurred due to the fact that our parser allows using <COLLATE> clause
      with numeric fields:
      
      CREATE TABLE (id INT PRIMARY KEY);
      SELECT id COLLATE "binary" ...
      
      In the example collation of LHS (id column) is NULL, but collation of
      RHS is "binary". Before this patch both collations were NULL. Hence,
      usage of certain indexes may not be allowed by query planner.
      On the other hand, this feature is obviously broken, so that doesn't
      seem to be big deal.
      
      Needed for #3185
      a953051e
  3. 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
    • Serge Petrenko's avatar
      Introduce separate entity object types for entity privileges · ba5aec56
      Serge Petrenko authored
      When granting or revoking a privilege on an entire entity, id 0 was used
      to indicate the fact that we don't grant a privilege on a single object,
      but on a whole entity. This caused confusion, because for entity USER,
      for example, id 0 is a valid object id (user 'guest' uses it).
      Any non-zero id dedicated to this cause obviously may be confused as well.
      Fix this by creating separate schema_object_types for entities:
      SC_ENTITY_SPACE, SC_ENTITY_SEQUENCE, etc.
      
      Closes #3574
      Needed for #3524
      ba5aec56
  4. Aug 07, 2018
    • Nikita Pettik's avatar
      schema: add new system space for FK constraints · 78fef3d0
      Nikita Pettik authored
      This patch introduces new system space to persist foreign keys
      constraints. Format of the space:
      
      _fk_constraint (space id = 358)
      
      [<constraint name> STR, <parent id> UINT, <child id> UINT,
       <is deferred> BOOL, <match> STR, <on delete action> STR,
       <on update action> STR, <child cols> ARRAY<UINT>,
       <parent cols> ARRAY<UINT>]
      
      FK constraint is local to space, so every pair <FK name, child id>
      is unique (and it is PK in _fk_constraint space).
      
      After insertion into this space, new instance describing FK constraint
      is created. FK constraints are held in data-dictionary as two lists
      (for child and parent constraints) in struct space.
      
      There is a list of FK restrictions:
       - At the time of FK creation parent and child spaces must exist;
       - VIEWs can't be involved into FK processing;
       - Child space must be empty;
       - Types of referencing and referenced fields must be comparable;
       - Collations of referencing and referenced fields must match;
       - Referenced fields must compose unique index;
       - Referenced fields can not contain duplicates.
      
      Until space (child) features FK constraints it isn't allowed to be
      dropped. Implicitly referenced index also can't be dropped
      (and that is why parent space can't be dropped). But :drop() method
      of child space firstly deletes all FK constraint (the same as SQL
      triggers, indexes etc) and then removes entry from _space.
      
      Part of #3271
      
      Review fixes
      78fef3d0
  5. Jun 29, 2018
  6. Jun 14, 2018
    • Vladislav Shpilevoy's avatar
      Deal with upgrade mess in 2.0 · 9cf66ac0
      Vladislav Shpilevoy authored
      Merge upgrade to 1.8.2/.4 into 2.1.0. Versions 1.8.2/.4 are
      broken because of invalid _trigger creation and deprecated
      versioning policy.
      
      Vinyl/Xlog upgrade tests from 1.7.7 are broken too since they
      actually contains 1.8 snapshots, so remove them. Add the test on
      upgrade from 1.10 to ensure the new upgrade_to_2_1_0 works.
      9cf66ac0
  7. May 11, 2018
  8. Mar 31, 2018
    • Kirill Yukhin's avatar
      Add value field to _schema space · ddd8a259
      Kirill Yukhin authored
      _schema represented as key-value storage for various
      values common for Tarantool, like next id for space creation.
      SQL requires format to be fully specified for columns being
      access. Unfortunatelly, _schema is inserted into _space
      before _space's format is set and since DD triggers are
      disabled during upgrade, format for _schema tuple in _space
      stays the same. So, set value nullable field in upgrade,
      regenerate initial snap, update tests.
      Also, as far as _schema's tuple in _space is not updated:
      relax fieldno check in sql.c
      ddd8a259
  9. Feb 15, 2018
    • Kirill Yukhin's avatar
      sql: Add stat spaces during schema_init · e2d99a9b
      Kirill Yukhin authored
      If Tarantool is being starteed using data from older
      version, where stat tables were not system, it will definitely
      crash, since SQL statistics analyzer will try to access non-
      existing statistics tables (which will be added during upgrade).
      
      To avoid such crash: create dummy statistics spaces during
      schema init.
      
      Also, fix types for statistics space format: prohibit null values
      for statistic values and make sample format stronger.
      e2d99a9b
  10. 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
  11. Dec 29, 2017
    • Konstantin Osipov's avatar
      security: add 'super' role · d645f58d
      Konstantin Osipov authored
      Add a role which contains all ACLs.
      
      Fixes gh-3022.
      
      Useful for any quick start:
      
      box.schema.user.grant('guest', 'super')
      d645f58d
    • Ilya's avatar
      box: introduce system privileges · 74ab44ae
      Ilya authored
      Add system privileges 'session' and 'usage'
      
      * 'session' privilege lets user connect to database server
      * 'usage' privilege lets user use his/her rights on database objects
      * Both privileges are assigned to all users by default.
      
      Implementation details:
      * system privileges are special grant rights to 'universe'.
      Therefore, they can be granted only by admin. Because of this fact,
      during creation or deletion of user, we have to switch to 'admin' to
      grant or revoke these rights.
      
      Important changes:
      * changed bootstrap.snap due to need to start admin with new privileges
      * added auto upgrade script for 1.7.7
      
      Fixes gh-2898.
      
      With contributions by @kostja.
      74ab44ae
  12. Nov 06, 2017
  13. Oct 06, 2017
  14. 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
  15. 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
  16. Sep 18, 2017
  17. Aug 23, 2017
    • Vladislav Shpilevoy's avatar
      Forbid upgrade from Tarantool < 1.7.5 and refactor upgrade.lua · 7d3b80e7
      Vladislav Shpilevoy authored
      Now all upgrade_to_1_... can be removed, except 1_8_2(). Inital
      function initializes schema for 1.7.5, not for 1.6.0.
      
      We can not support upgrade directly from <1.7.5, because these
      versions contains space format conflicts, which are checked in 1.8.
      
      Needed for #2652
      7d3b80e7
    • Vladislav Shpilevoy's avatar
      schema: fix errors in 1.8 schema · 2178c5b4
      Vladislav Shpilevoy authored
      * upgrade handler for 1.8.2 must be set to auto instead of
        1.7.5;
      * _trigger's first field has type string, but index on this field
        has type unsigned - it is conflict.
      
      Needed for #2652
      2178c5b4
  18. Aug 21, 2017
    • Vladislav Shpilevoy's avatar
      schema: fix system space formats · a6128fcd
      Vladislav Shpilevoy authored
      Now system space formats contain conflicts between space:format,
      their index parts and actual tuple fields.
      
      Such formats can not be used to check tuple fields in SQL.
      
      Fix them in order of #2652
      a6128fcd
  19. Aug 17, 2017
  20. 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
  21. Jun 15, 2017
    • Vladimir Davydov's avatar
      box: auto upgrade to 1.7.5 · 29a197cf
      Vladimir Davydov authored
      We added _truncate space to 1.7.5 and we are going to add new system
      spaces for storing sequences and triggers. Without upgrade, the
      corresponding operations won't work. Since 1.7.5 is a minor upgrade,
      users may not call box.schema.upgrade(), so we need to call it for them
      automatically. This patch introduces infrastructure for automatic
      upgrades and sets upgrade to 1.7.5 to be called automatically.
      
      While we are at it, rename schema version 1.7.4 to 1.7.5 (1.7.4 has
      already been released).
      
      Closes #2517
      29a197cf
  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. Nov 18, 2016
  24. Sep 22, 2016
  25. Aug 04, 2016
    • Roman Tsisyk's avatar
      Rename field type names, deprecate 'num' · 3dff7589
      Roman Tsisyk authored
      * Rename fields types in data dictionary and test suite:
       - 'num' => 'unsigned'
       - 'str' => 'string'
       - 'int' => 'integer'
      * Force coversion to lowercase
      * Add aliases to space:create_index():
       - 'str' => 'string'
       - 'num' => 'unsigned' -- logs "field type 'num' is deprecated" warning
       - 'uint' => 'unsigned'
       - 'int' => 'integer'
      * Add prefix to `enum field_type` members
      * Add upgrade_to_1_7_2() script
      
      Fixes #942
      Fixes #1534
      3dff7589
  26. Jul 04, 2016
    • Konstantin Nazarov's avatar
      Permit empty passwords in net.box · 076a8420
      Konstantin Nazarov authored
      This is required to do the following:
      
      tarantoolctl user@host
      tarantoolctl guest@host
      tarantoolctl guest:@host
      
      Currently all of those will lead to error from net.box. Either because
      password is not specified, or because guest user can't login with empty
      password.
      
      This change effectively sets guest password to an empty string, to make
      it less of a special case to authentication.
      
      And since now guest can be authenticated with an empty password, net.box
      will replace nil passwords with empty strings, when user name is
      provided.
      
      We still support the case when username=nil and password=nil. In this
      case net.box doesn't send authentication packet at all. Guest login is
      just assumed.
      
      The bootstrap snapshot will now have guest user with an empty password,
      instead of no password.
      
      Fixes #1545
      076a8420
  27. Mar 28, 2016
  28. Jan 18, 2016
  29. Aug 10, 2015
  30. Apr 09, 2015
    • Roman Tsisyk's avatar
      Fix #323: implement system views · 4c159681
      Roman Tsisyk authored
      Add _vspace, _vindex, _vuser, _vfunc and _vpriv virtual spaces (views)
      which contains only objects allowed to the current user.
      
      This patch is needed for client connectors to work under non-admin user.
      4c159681
  31. Feb 20, 2015
    • Konstantin Osipov's avatar
      Extract xlog.test into an own test suite. Deal with the collateral damage. · ee901160
      Konstantin Osipov authored
      Extract xlog.test.py into an own test suite, in preparation
      for a split into many tests.
      xlog.test.py restarts the server all the time anyway, there is
      no point to keep all tests in the same file.
      
      Deal with collateral damange of this seemingly innocuous move:
      
       * fix an assertion failure in user.drop(), user_has_data().
         The check was using a wrong index.
       * fix test-run.py to leave cores around in case of a server crash
         (in a friendly gesture to develoeprs, and joining the ranks of
         such extremely succefful applications as apport and systemd, it used to
         delete them)
       * update bootstrap.snap to provide format for _index space
       * make a bunch of tests safe to the order in which they are executed
       * use space name rather than space id for error messages more often,
         since space id is very volatile after introduction of max_id sequence
         for space ids.
      ee901160
  32. Feb 17, 2015
  33. Dec 19, 2014
  34. Dec 17, 2014
  35. Dec 01, 2014
Loading