[tarantool-patches] Re: [PATCH 1/3] txn: move fk_deferred_count from psql_txn to txn

n.pettik korablev at tarantool.org
Thu Aug 15 14:03:18 MSK 2019



> On 9 Aug 2019, at 23:59, Vladislav Shpilevoy <v.shpilevoy at tarantool.org> wrote:
> 
> Hi! Thanks for the patch!
> 
>> diff --git a/src/box/txn.h b/src/box/txn.h
>> index 37d90932b..87e880a6a 100644
>> --- a/src/box/txn.h
>> +++ b/src/box/txn.h
>> @@ -213,6 +208,7 @@ struct txn {
>> 	struct trigger fiber_on_stop;
>> 	/** Commit and rollback triggers. */
>> 	struct rlist on_commit, on_rollback;
>> +	uint32_t fk_deferred_count;
> 
> Please, add a comment. A detailed one. That this number is used
> by SQL only, what does it mean 'deferred fk', why is it stored
> in the transaction.

Done:

diff --git a/src/box/txn.h b/src/box/txn.h
index 87e880a6a..f795cb76f 100644
--- a/src/box/txn.h
+++ b/src/box/txn.h
@@ -208,6 +208,17 @@ struct txn {
        struct trigger fiber_on_stop;
        /** Commit and rollback triggers. */
        struct rlist on_commit, on_rollback;
+       /**
+        * This member represents counter of deferred foreign key
+        * violations within transaction. DEFERRED mode means
+        * that until transaction is committed violations are
+        * allowed to appear. However, transaction can't be
+        * committed in presence of violations, i.e. if this
+        * counter is not equal to zero. In the normal mode
+        * violations of FK are checked at the end of each
+        * statement processing. Note that at the moment it is
+        * SQL specific property.
+        */
        uint32_t fk_deferred_count;
        struct sql_txn *psql_txn;
 };





More information about the Tarantool-patches mailing list