[Tarantool-patches] [PATCH 12/15] box: increment schema_version on ddl operations

Nikita Pettik korablev at tarantool.org
Thu Nov 7 04:04:52 MSK 2019


Some DDL operations such as SQL trigger alter, check and foreign
constraint alter don't result in schema version change. On the other
hand, we are going to rely on schema version to determine expired
prepared statements: for instance, if FK constraint has been created
after DML statement preparation, the latter may ignore FK constraint
(instead of proper "statement has expired" error). Let's fix it and
account schema change on each DDL operation.

Need for #2592
---
 src/box/alter.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/box/alter.cc b/src/box/alter.cc
index 941b638ea..3b7f79b5a 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -4110,6 +4110,7 @@ on_replace_dd_trigger(struct trigger * /* trigger */, void *event)
 
 	txn_stmt_on_rollback(stmt, on_rollback);
 	txn_stmt_on_commit(stmt, on_commit);
+	++schema_version;
 }
 
 /**
@@ -4565,6 +4566,7 @@ on_replace_dd_fk_constraint(struct trigger * /* trigger*/, void *event)
 		space_reset_fk_constraint_mask(child_space);
 		space_reset_fk_constraint_mask(parent_space);
 	}
+	++schema_version;
 }
 
 /** Create an instance of check constraint definition by tuple. */
@@ -4777,6 +4779,7 @@ on_replace_dd_ck_constraint(struct trigger * /* trigger*/, void *event)
 	txn_stmt_on_commit(stmt, on_commit);
 
 	trigger_run_xc(&on_alter_space, space);
+	++schema_version;
 }
 
 /** A trigger invoked on replace in the _func_index space. */
-- 
2.15.1



More information about the Tarantool-patches mailing list