Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v2 0/2] Add constraint names hash table to space
@ 2019-11-28 18:34 Roman Khabibov
  2019-11-28 18:34 ` [Tarantool-patches] [PATCH v2 1/2] box: introduce constraint names hash table Roman Khabibov
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Roman Khabibov @ 2019-11-28 18:34 UTC (permalink / raw)
  To: tarantool-patches; +Cc: v.shpilevoy

I have made essential changes to the previous patch, so I decided
to send it as v2.

1) I still don't understand, why we need to store constraint id. If we have the
query "ALTER TABLE T DROP CONSTRAINT C", we just get struct space by its name,
then find the corresponding constraint_def node by the name and emit opcode on
replace in _index/_fk_constraint/_ck_constraint depending on
constraint_def->type.

2) space_delete()
I don't know how to check, if the hash table is empty, because it jsut freed.

salad/mhash.h
void
_mh(delete)(struct _mh(t) *h)
{
	if (h->shadow->p) {
		free(h->shadow->p);
		free(h->shadow->b);
		memset(h->shadow, 0, sizeof(*h->shadow));
	}
	free(h->shadow);
	free(h->b);
	free(h->p);
	free(h);
}

3) I copy names of constraints instead of use index_def->name or
ck_constraint_def->name or fk_constraint_def->name, because in some cases these
defs can be freed. I discovered it during degugging, when I haven't use name copy
yet: there was node in the hash table with name length and hash, but without name
itself. Now, I decided to store duplicates in struct constraint_def.

Issue: https://github.com/tarantool/tarantool/issues/3503
Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3503-constr-names_v3

Roman Khabibov (2):
  box: introduce constraint names hash table
  sql: make constraint operations transactional

 src/box/CMakeLists.txt       |   1 +
 src/box/alter.cc             | 427 +++++++++++++++++++++++++++++++----
 src/box/constraint_def.c     |  59 +++++
 src/box/constraint_def.h     |  83 +++++++
 src/box/space.c              |  56 +++++
 src/box/space.h              |  39 ++++
 test/sql/constraint.result   | 190 ++++++++++++++++
 test/sql/constraint.test.lua |  84 +++++++
 8 files changed, 892 insertions(+), 47 deletions(-)
 create mode 100755 src/box/constraint_def.c
 create mode 100755 src/box/constraint_def.h
 create mode 100644 test/sql/constraint.result
 create mode 100755 test/sql/constraint.test.lua

-- 
2.21.0 (Apple Git-122)

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2019-12-30 12:05 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 18:34 [Tarantool-patches] [PATCH v2 0/2] Add constraint names hash table to space Roman Khabibov
2019-11-28 18:34 ` [Tarantool-patches] [PATCH v2 1/2] box: introduce constraint names hash table Roman Khabibov
2019-11-30  1:03   ` Vladislav Shpilevoy
2019-12-04 16:23     ` [Tarantool-patches] [PATCH v2 1/3] " Roman Khabibov
2019-12-07 16:34       ` Vladislav Shpilevoy
2019-12-10 12:48         ` Roman Khabibov
2019-11-28 18:34 ` [Tarantool-patches] [PATCH v2 2/2] sql: make constraint operations transactional Roman Khabibov
2019-11-29  7:38   ` Roman Khabibov
2019-11-30  1:03   ` Vladislav Shpilevoy
2019-12-04 16:23     ` [Tarantool-patches] [PATCH v2 2/3] " Roman Khabibov
2019-12-05 18:43     ` Roman Khabibov
2019-12-07 16:35       ` Vladislav Shpilevoy
2019-12-10 12:49         ` [Tarantool-patches] [PATCH v2 2/3] box: " Roman Khabibov
2019-12-15 22:26           ` Vladislav Shpilevoy
2019-12-17 15:03             ` Roman Khabibov
2019-12-28  0:18               ` Nikita Pettik
2019-12-28 11:07                 ` Vladislav Shpilevoy
2019-12-29  0:07                   ` Nikita Pettik
2019-12-29 15:51                     ` Vladislav Shpilevoy
2019-12-29 22:28                       ` Nikita Pettik
2019-12-29 22:35                         ` Vladislav Shpilevoy
2019-12-30 11:12                         ` Sergey Ostanevich
2019-12-30 12:05                           ` Nikita Pettik
2019-12-21 20:54           ` Sergey Ostanevich
2019-12-22 14:59             ` Vladislav Shpilevoy
2019-12-24 12:06             ` Roman Khabibov
2019-11-30  1:03 ` [Tarantool-patches] [PATCH v2 0/2] Add constraint names hash table to space Vladislav Shpilevoy
2019-12-04 16:23   ` [Tarantool-patches] [PATCH v2 0/3] " Roman Khabibov
2019-12-07 16:34     ` Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox