Skip to content
Snippets Groups Projects
  1. Jul 20, 2018
    • N.Tatunov's avatar
      sql: remove 'BEGIN TRANSACTION' · a00a128d
      N.Tatunov authored
      Previously "BEGIN" / "BEGIN TRANSACTION", "COMMIT TRANSACTION" /
      "END" / "END TRANSACTION", "ROLLBACK TRANSACTION" could be used
      to handle transactions. By changing these commands syntax in
      parser we're aiming on getting closer to ANSI SQL. Also found
      initialization in ifdef that caused some problems with error
      messages in occasions when the wrong syntax was used.
      
      With the patch applied only following commands can be used:
       - "START TRANSACTION" to begin transaction.
       - "COMMIT" to end transaction.
       - "ROLLBACK" to rollback transaction without savepoints.
       - "ROLLBACK TO .." to rollback transaction to savepoint.
      
      Closes #2164
      a00a128d
    • N.Tatunov's avatar
      sql: assertion fail on nested select · c8ea9483
      N.Tatunov authored
      To optimize the select-subquery tarantool uses
      subquery flattening optimization which is only used
      with respect to some restrictions. When any of
      subselects but the last one has an ORDER BY
      clause we should raise an error. So subquery
      components containing it are not accepted
      to be optimized.
      
      Checking part was only checking if the last
      subselect contains the clause which led to an
      assertion fail. With the patch applied
      flattening is not used in case any of
      subselects has an ORDER BY.
      
      Closes #3353
      c8ea9483
  2. Jul 19, 2018
  3. Jul 18, 2018
    • Vladimir Davydov's avatar
      xrow: factor out function for decoding vclock · fdb1e715
      Vladimir Davydov authored
      We will need it in other places.
      fdb1e715
    • Vladimir Davydov's avatar
      recovery: clean up WAL dir scan code · 9f1e0f44
      Vladimir Davydov authored
       - Remove extra scan of the WAL directory from local_recovery() - we
         scan the directory in recovery_end_vclock() hence we can skip scan in
         recover_remaining_wals() by passing scan_dir = false.
      
       - Rename recovery_end_vclock() to recovery_scan() to emphasize the fact
         that this function scans the WAL directory. Write a comment to this
         function.
      
       - Add comments to wal.c explaining why we scan the WAL directory there.
      
      Follow-up 0695fbbb ("box: retrieve end vclock before starting local
      recovery").
      9f1e0f44
    • Vladimir Davydov's avatar
      Update test-run · c9bb2492
      Vladimir Davydov authored
      To bring crash_expected option of "start server" command.
      c9bb2492
    • Serge Petrenko's avatar
      Add errors for non-existent privileges and entities. · aecbbfd7
      Serge Petrenko authored
      There were no checks for granting and revoking a non-existent
      privilege or a privilege to a non-existent entity.
      Added the checks, and a test case.
      
      Closes #3417
      aecbbfd7
  4. Jul 17, 2018
    • Kirill Shcherbatov's avatar
      net.box: fix invalid index:count() with iterator · 25b9f0f0
      Kirill Shcherbatov authored
      Net.box didn't pass options containing iterator to
      server side.
      There were also invalid results for two :count tests in
      net.box.result file.
      
      Thanks @ademenev for contributing problem and help with
      problem locating.
      
      Closes #3262.
      25b9f0f0
    • Ivan Koptelov's avatar
      sql: add index_def to Index · 0bc63674
      Ivan Koptelov authored
      Now every sqlite struct Index is created with tnt
      struct index_def inside. This allows us to use tnt
      index_def in work with sqlite indexes in the same
      manner as with tnt index and is a step to remove
      sqlite Index with tnt index.
      Fields coll_array, coll_id_array, aiColumn,
      sort_order, aiRowLogEst and zName are removed from
      Index. All usages of this fields changed to usage of
      corresponding index_def or index_def->opts fields.
      index_is_unique(), sql_index_collation() and
      index_column_count() are removed with calls of
      index_def corresponding fields.
      Also there is small change in behavior: before the
      patch a statement like
      CREATE TABLE t1(a,b, PRIMARY KEY(a,b), UNIQUE(a,b))
      created only one constraint index (for primary key)
      and no index for UNIQUE constraint (since it is upon
      the same columns), neither it is named or non-named
      constraint.
      After the patch index will be always created for named
      constraints. It is a temporary solution. In future
      it's preferable not to create an index, but to make
      some record in _constraints space that this named
      unique constraint implemented with the same index as
      primary key constraint.
      
      Closes: #3369, #3498
      0bc63674
    • Kirill Yukhin's avatar
      Merge branch '1.10' into 2.0 · 09d7a5da
      Kirill Yukhin authored
      09d7a5da
    • Kirill Shcherbatov's avatar
      sql: assertion fault on select after analyze · b92589c7
      Kirill Shcherbatov authored
      Binary search in whereKeyStats function that uses routine
      sqlite3VdbeRecordCompareMsgpack returned invalid result,
      because it made wrong assumption about the number of
      coinciding index columns based on _sql_stat4.
      But all collected index statistics were wrong.
      
      The analyzeOneTable routine used to call sqlite3GetTempRange
      and sqlite3ReleaseTempRange functions inside of cycle intensively
      changes Parser->nMem value. Thanks this pattern routine
      sqlite3ReleaseTempRange could push nMem variable onto aTempReg
      queue. As Parser->nMem could be bigger next time, this
      variable may be used twice:
      
                [74, 'Column', 4, 1, 11, '', '00', 'r[11]=']
                [75, 'Column', 4, 2, 12, '', '00', 'r[12]=']
      |->       [76, 'Column', 4, 3, 13, '', '00', 'r[13]=']
                [77, 'Column', 4, 4, 14, '', '00', 'r[14]=']
      !rewrite  [78, 'Column', 4, 0, 13, '', '00', 'r[13]=ID']
                [79, 'MakeRecord', 13, 1, 6, '', '00',
                 'r[6]=mkrec(r[13])']
      
      Thus all assumptions about data below should be invalid and
      some artifacts could exhibit.
      
      Example:
      \set language sql
      CREATE TABLE t1(id INTEGER PRIMARY KEY AUTOINCREMENT, a,
      		b, c, f, d, e);
      CREATE INDEX i1 ON t1(a, b, c, f, d);
      \set language lua
      for i = 0, 100 do
          box.sql.execute(string.format("INSERT INTO t1 VALUES(null,
      		    'x', 'y', 'z', 'a', %s, %s);", i,
      		    math.floor(i / 2)))
      end
      \set language sql
      SELECT * FROM "_sql_stat4";
      ---
      ['T1', 'I1', '101 101 1 1 1', '0 0 44 44 44', '0 0 44 44 44',
       ['x', 'y', 'z', 'a', 44]]
      ---
      
      Expected:
      ---
      ['T1', 'I1', '101 101 101 101 1', '0 0 0 0 44', '0 0 0 0 44',
       ['x', 'y', 'z', 'a', 44]]
      ---
      
      Resolves #2847.
      b92589c7
    • Vladimir Davydov's avatar
      vinyl: fix potential use-after-free in vy_read_view_merge · 18d1acbd
      Vladimir Davydov authored
      If is_first_insert flag is set and vy_stmt_type(rv->tuple) equals
      IPROTO_DELETE, we free rv->tuple, but then we dereference it via
      an on-stack variable to check if we need to turn a REPLACE into an
      INSERT or vice versa. Fix this.
      18d1acbd
    • Vladimir Davydov's avatar
      vinyl: do not pass region explicitly to write iterator functions · 32854f40
      Vladimir Davydov authored
      This is not necessary, as we can use fiber()->gc, as we usually do.
      32854f40
    • Vladimir Davydov's avatar
      test: unit/vy_write_iterator: minor refactoring · 8c447591
      Vladimir Davydov authored
      Move key_def creation to compare_write_iterator_results as it is the
      same for all test cases. Performance is not an issue here, obviously, so
      we can close our eyes to the fact that now we create a new key def for
      each test cases.
      8c447591
    • Vladimir Davydov's avatar
      stailq: add stailq_insert function · 37502562
      Vladimir Davydov authored
      The new function inserts a new item into the list at the specified
      postion.
      37502562
  5. Jul 16, 2018
  6. Jul 13, 2018
  7. Jul 12, 2018
Loading