Skip to content
Snippets Groups Projects
Commit c3d5944d authored by AKhatskevich's avatar AKhatskevich Committed by Kirill Yukhin
Browse files

sql: recover SQL savepoints & abort

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
parent 9ee1ebcf
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment