Skip to content
Snippets Groups Projects
  1. Jan 24, 2018
  2. Jan 23, 2018
    • Kirill Yukhin's avatar
      sql: Ban ALTER TABLE ADD COLUMN · 5163872d
      Kirill Yukhin authored
      Currently, only ALTER TABLE RENAME is supported in SQL. Ban
      ALTER TABLE ADD COLUMN in the grammar until it is supported.
      Corresponding issue submitted: #3075
      
      Closes #2607
      5163872d
  3. Jan 18, 2018
    • Kirill Yukhin's avatar
      sql: Fix build for FreeBSD · e2c08028
      Kirill Yukhin authored
      There're 3 places where FreeBSD specific routines
      contained (for compatibility) unused parameters.
      Mark them w/ unused attribute.
      
      Closes #3037
      e2c08028
  4. Jan 15, 2018
    • Alexander Turenko's avatar
      sql: remove SQLite shared cache mode · ff0b2857
      Alexander Turenko authored
      SQLITE_ENABLE_UNLOCK_NOTIFY assumed to be always disabled.
      SQLITE_OMIT_SHARED_CACHE assumed to be always enabled.
      
      Deleted files
      -------------
      
      src/box/sql/notify.c
      src/box/sql/btmutex.c
      
      Deleted non-static functions
      ----------------------------
      
      // btmutex.c
      sqlite3BtreeEnter()
      sqlite3BtreeLeave()
      sqlite3BtreeHoldsMutex()
      sqlite3BtreeEnterAll()
      sqlite3BtreeLeaveAll()
      sqlite3BtreeHoldsAllMutexes()
      sqlite3SchemaMutexHeld()
      sqlite3BtreeEnterCursor()
      sqlite3BtreeLeaveCursor()
      
      // btree.c
      sqlite3BtreeLockTable()
      sqlite3BtreeSharable()
      sqlite3BtreeConnectionCount()
      
      // notify.c
      sqlite3_unlock_notify()
      sqlite3ConnectionBlocked()
      sqlite3ConnectionUnlocked()
      sqlite3ConnectionClosed()
      
      // vdbeaux.c
      sqlite3VdbeEnter()
      sqlite3VdbeLeave()
      
      Deleted structure fields
      ------------------------
      
      // btreeInt.h
      struct Btree.wantToLock
      struct Btree.lock
      struct BtShared.nRef
      struct BtShared.pNext
      struct BtShared.pLock
      struct BtShared.pWriter
      
      // sqliteInt.h
      struct sqlite3.pBlockingConnection
      struct sqlite3.pUnlockConnection
      struct sqlite3.pUnlockArg
      struct sqlite3.xUnlockNotify
      struct sqlite3.pNextBlocked
      
      Deleted asserts
      ---------------
      
      // common
      assert(sqlite3BtreeHoldsAllMutexes(...))
      assert(sqlite3SchemaMutexHeld(...))
      assert(sqlite3BtreeHoldsMutex(...))
      
      // btree.c
      assert(... || sqlite3BtreeConnectionCount(...) > 0)
      assert(p->wantToLock == 0 && p->locked == 0)
      assert(hasSharedCacheTableLock(...))
      assert(... || !hasReadConflicts(...))
      Unverified
      ff0b2857
  5. Jan 05, 2018
    • khatskevich's avatar
      sql: add test on savepoints · e5b5dbc1
      khatskevich authored
      Part of #2931
      e5b5dbc1
    • khatskevich's avatar
      sql: add do_cahchsql_set_test to sqltester · b30a0b93
      khatskevich authored
        There are some cases where a number of similar tests should be performed.
      In this scenario, we had to write a lot of redundant symbols.
      
        The new method allows one to write the minimal number of code necessary for
      tests.
      b30a0b93
    • khatskevich's avatar
      eb5171ec
    • AKhatskevich's avatar
      sql: recover SQL savepoints & abort · c3d5944d
      AKhatskevich authored
      This comit introduces a number of changes:
      
      1. move a transaction state to fiber local struct
      
        This is important because the `sqlite3` is a shared structure and it was
      used to store data related to the transaction. However it was working because
      yield is called only on commit and it garanteed unique access. (With possible
      effects on ddl.)
      
      NOTE: `nDeferredCons` and `nDeferredImmCons` are stored in vdbe during vdbe
      execution and moved to sql_txn when it needs to be saved until execution of the
      next vdbe in the same transaction.
      
      2. support savepoints
      
      2.1. support abort (anonymous savepoints)
      
        Abort mechanism was simplified. Instead of storing track of all
      savepoints without name, this commit introduces `anonymous_savepoint`.
        `anonymous_savepoint` is a structure which is stored in Vdbe and represents
      the state of database on the beginning of the current statement. Tarantool
      disallow multistatement, so a vdbe can have one statement max. That is why
      having one savepoint is enough to perform abort.
      
      2.2. named savepoints
      
      Key points:
        - It uses Tarantool's savepoints
        - It allocates savepoints on the "region" (they are destroyed automatically)
        - There are some crutches around ddl (ddl should not be placed into a
      transaction)
      
      Closes #2989 #2931 #2964
      c3d5944d
  6. Dec 26, 2017
  7. Dec 20, 2017
  8. Dec 18, 2017
    • Kirill Yukhin's avatar
      sql: Remove dead opcodes, including table locking · f92bc1e6
      Kirill Yukhin authored
      Removed OP_ParseSchema, OP_TableLock.
      All other dead code connected to locking of open tables (for both
      reading and writing) removed as well.
      Remove auth.c file, it is not used anymore.
      f92bc1e6
    • Kirill Yukhin's avatar
      sql: emove idb operand from VM opcodes · daa00ab8
      Kirill Yukhin authored
      Few opcodes like OpenRead/OpenWrite exepcted 3rd argument to be DB
      descriptor. Now there's a single DB backend and there's no need
      for any descriptors. Remove from VDBE, fix code generator, update
      opcode descriptions.
      
      Closes #2855
      daa00ab8
  9. Dec 15, 2017
  10. Dec 08, 2017
  11. Dec 06, 2017
    • Nikita Pettik's avatar
      sql: fail of DROP TABLE doesn't lead to truncate · 41ca410c
      Nikita Pettik authored
      Deletion of rows from table (which is part of DROP TABLE procedure) is
      wrapped in transaction now. If any Foreign Key violations occur, then
      rollback transaction and halt execution of statement. Otherwise, commit
      changes and continue DROP TABLE routine. This logic is implemented by
      OP_FkCheckCommit opcode.
      Added tests for this case.
      
      Closes #2953
      41ca410c
  12. Dec 05, 2017
    • khatskevich's avatar
      remove sqlite's likely/SWAP completely · 2d38c663
      khatskevich authored
        There were analogies of those functions in Tarantool. This commit makes
      SQL reuse them.
        All crutches (undef) are deleted.
      2d38c663
    • Nikita Pettik's avatar
      sql: enable alter rename table · 9faea8e1
      Nikita Pettik authored
      Added new opcode OP_RenameTable, which implements
      SQL statment: ALTER TABLE old_name RENAME TO new_name;
      The main idea is to replace corresponding tuple in _space.
      New tuple will contain new name and new SQL statement, which
      creates this table. If it is parent table for foreign key,
      update SQL statement of child table. Then, remove old name
      from hash table and by calling callback function from VDBE,
      update database schema with new table name. After all,
      in the same way update triggers' statements in _trigger table,
      if any exist.
      
      Closes #2204
      9faea8e1
  13. Nov 30, 2017
  14. Nov 29, 2017
  15. Nov 27, 2017
    • khatskevich's avatar
      sql: reload table with unique constraint · c47e3648
      khatskevich authored
          For some reason 'tnum' attribute for pk was set in convertToWithoutRowid
      function, while for other indexes it was set in sqlite3CreateIndex. The if
      clause in sqlite3CreateIndex was filtering not only PK, but inline unique
      indexes too.
      
          Now 'tnum' is always set in sqlite3CreateIndex procedure.
      
      Closes #2808
      c47e3648
    • Ilya's avatar
      digest: add pbkdf2 hashing · 93980aef
      Ilya authored
      * Add pbkdf2 hashing API
      * Wrapper of OpenSSL
      
      Closes #2874
      93980aef
    • Vladimir Davydov's avatar
      vinyl: fix crash in vy_read_iterator_restore_mem · 44b4d7ec
      Vladimir Davydov authored
      vy_read_iterator_restore_mem() is called after a yield caused by a disk
      read to restore the position of the iterator over the active in-memory
      tree. It assumes that if a statement inserted into the active in-memory
      tree during the yield is equal to the statement at which the read
      iterator is positioned now (curr_stmt) by key but is older in terms of
      LSN, then the iterator must be positioned at a txw statement. However,
      the iterator could be positioned at an uncommitted statement stored in
      the cache before the yield. We don't restore the cache iterator after a
      yield, so if the new statement has been committed, its LSN will be less
      than the LSN of the uncommitted statement stored in the cache although
      it is indeed newer. This results in an assertion failure:
      
        vy_read_iterator.c:421: vy_read_iterator_restore_mem: Assertion `itr->curr_src == itr->txw_src' failed.
      
      To fix this, let's modify the code checking if the iterator should be
      repositioned to the active in-memory tree (mem_src) after a yield:
      instead of comparing statement LSNs, let's reposition the iterator
      unless it is currently positioned at a txw statement as it is the only
      case when curr_stmt can be newer than the newly inserted statement.
      
      Closes #2926
      44b4d7ec
    • khatskevich's avatar
      make coll_cmp_f attibutes to be const · 4eeab69a
      khatskevich authored
        It is not very important change, but implementing collations in SQL required
      to either delete const modificator from some functions in SQL or make
      coll_cmp_f arguments to be const. The second option were chosen because it
      makes more sense.
      4eeab69a
Loading