Skip to content
Snippets Groups Projects
  1. Jan 24, 2018
    • Kirill Yukhin's avatar
      sql: Disable asserts for release builds · 8d7bfe97
      Kirill Yukhin authored
      Macro SQLITE_DEBUG was set unconditionally, so both release build
      modes had debugging enabled, including all asserts() and TESTCASE().
      Move this macro definition under check if mode is Debug and fix all
      warning which arised after disabling asserts().
      Most of them are unused variables.
      8d7bfe97
    • Kirill Yukhin's avatar
      sql: Enable asserts for box/sql.c · 7a8de281
      Kirill Yukhin authored
      Since asserts were always disbled in src/box/sql.c, number
      of issues were hidden. This patch enables asserts for mentioned
      file by disabling set of NDEBUG in box/src/sqliteInt.h.
      Also this patch fixes incorrect assertions about strlen() and
      assertion that fieldno should always be less than format->field_count.
      This assert is not always hold, e.g. for _schema space where max_id
      is stored behind formatted fields.
      
      Closes #3057
      7a8de281
    • Kirill Yukhin's avatar
      sql: add regenerated pase file. · 67a9422e
      Kirill Yukhin authored
      Add forgotten in previous commit regenerated box/sql/parse.c
      67a9422e
  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(...))
      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
Loading