diff --git a/debian/changelog b/debian/changelog index 1acbd0337b96aad15b6c4c0eb4dd196916a04a0d..f17f7602096e5bc1056d52e00987e2cc26d76792 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,19 @@ -tarantool (1.6.3.183.gd309992-1) UNRELEASED; urgency=medium +tarantool (1.6.3.539.g211672f-1) unstable; urgency=medium * Init infrastructure for tarantool 1.6. - - -- Dmitry E. Oboukhov <unera@debian.org> Wed, 20 Aug 2014 17:19:14 +0400 + * Update debian/copyright: + + cmake/luatest.cpp + + third_party/PMurHash.* + + third_party/lua-yaml/* + + third_party/sha1.* + + third_party/open_memstream.* + * Add lintian-oferrides: libyaml: + tarantool has patched version of the library. + * Rename -plugin* package to -module* + * Conflicts: tarantool 1.5 (it was renamed to tarantool-lts). + * NOSTRIP /usr/bin/tarantool binary: it uses symbols runtime. + + -- Dmitry E. Oboukhov <unera@debian.org> Mon, 27 Oct 2014 14:33:07 +0300 tarantool (1.5.3.53.ge2308d8-1) unstable; urgency=medium diff --git a/debian/copyright b/debian/copyright index 59daed1a0d362192f3860a2ffb0fd92f955e84ef..6d01443b320c667ca7740889dba61f5843a2ba0b 100644 --- a/debian/copyright +++ b/debian/copyright @@ -217,7 +217,7 @@ License: BSD-3-Clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Files: third_party/luajit/* +Files: third_party/luajit/* cmake/luatest.cpp Copyright: 2005-2011 Mike Pall. All rights reserved. 1994-2011 Lua.org, PUC-Rio. License: MIT @@ -302,6 +302,7 @@ Files: third_party/qsort_arg.c third_party/compat/sys/bsd_time.h third_party/queue.h connector/c/tntsql/include/tnt_queue.h + third_party/rb.h Copyright: 1992, 1993 The Regents of the University of California. License: BSD-3-Clause All rights reserved. @@ -571,6 +572,69 @@ License: BSD-2-Clause THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Files: third_party/PMurHash.* +Copyright: Austin Appleby +License: Public-Domain + MurmurHash3 was written by Austin Appleby, and is placed in the public + domain. + . + This implementation was written by Shane Day, and is also public domain. + . + This is a portable ANSI C implementation of MurmurHash3_x86_32 (Murmur3A) + with support for progressive processing. + +Files: third_party/lua-yaml/* +Copyright: 2009, Andrew Danforth +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +Files: ./third_party/sha1.* +Copyright: Steve Reid <steve@edmweb.com> +License: Public-Domain + Public Domain. + +Files: third_party/open_memstream.* +Copyright: 2013 Advanced Computing Technologies LLC, + Written by: John H. Baldwin <jhb@FreeBSD.org> +License: BSD-2-Clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + Files: * Copyright: 2010-2014 by Aleksey Demakov, Aleksey Mashanov, Alexandre Kalendarev, Damien Lefortier, Dmitry E. Oboukhov, diff --git a/debian/tarantool.lintian-overrides b/debian/tarantool.lintian-overrides index 79de2b236e53ae6dff1c40a7d0a33221e1a1fd18..67d2005c096b6ec202b10db73b9def47293fbf66 100644 --- a/debian/tarantool.lintian-overrides +++ b/debian/tarantool.lintian-overrides @@ -1 +1,2 @@ tarantool: unstripped-binary-or-object usr/bin/tarantool +tarantool: embedded-library usr/bin/tarantool: libyaml diff --git a/extra/rpm/mock/tarantool-el-5-i386.cfg b/extra/rpm/mock/tarantool-el-5-i386.cfg index 9d2555fee4b4c66c43aaf7e45b6be297026738cb..13174e0ed3fbecb8d9cd57085f7589acea9c4d00 100644 --- a/extra/rpm/mock/tarantool-el-5-i386.cfg +++ b/extra/rpm/mock/tarantool-el-5-i386.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-el-5-i386' config_opts['target_arch'] = 'i386' config_opts['legal_host_arches'] = ('i386', 'i586', 'i686', 'x86_64') -config_opts['chroot_setup_cmd'] = 'install buildsys-build' +config_opts['chroot_setup_cmd'] = 'install buildsys-build scl-utils-build' config_opts['dist'] = 'el5' # only useful for --resultdir variable subst config_opts['plugin_conf']['ccache_enable'] = False # beware RHEL use 5Server or 5Client diff --git a/extra/rpm/mock/tarantool-el-5-x86_64.cfg b/extra/rpm/mock/tarantool-el-5-x86_64.cfg index 1d9ed6820f1eb514fbde5d4886155f92c6556ed6..00a777109a068b53cc217c991b6e3cdaeef9d631 100644 --- a/extra/rpm/mock/tarantool-el-5-x86_64.cfg +++ b/extra/rpm/mock/tarantool-el-5-x86_64.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-el-5-x86_64' config_opts['target_arch'] = 'x86_64' config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install buildsys-build' +config_opts['chroot_setup_cmd'] = 'install buildsys-build scl-utils-build' config_opts['dist'] = 'el5' # only useful for --resultdir variable subst config_opts['plugin_conf']['ccache_enable'] = False # beware RHEL use 5Server or 5Client diff --git a/extra/rpm/mock/tarantool-el-6-i386.cfg b/extra/rpm/mock/tarantool-el-6-i386.cfg index 6c0d14a6e2998a8f29053671537512e3e050285a..27e3ce9de6436223adbce7f551656836d96a8160 100644 --- a/extra/rpm/mock/tarantool-el-6-i386.cfg +++ b/extra/rpm/mock/tarantool-el-6-i386.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-el-6-i386' config_opts['target_arch'] = 'i386' config_opts['legal_host_arches'] = ('i386', 'i586', 'i686', 'x86_64') -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'el6' # only useful for --resultdir variable subst config_opts['plugin_conf']['ccache_enable'] = False # beware RHEL use 6Server or 6Client diff --git a/extra/rpm/mock/tarantool-el-6-x86_64.cfg b/extra/rpm/mock/tarantool-el-6-x86_64.cfg index e96a1356b6fffdcc14f37f656fdacbbd28bad4d0..089db14b5530254a48e6f1c7b294d1c206d344a4 100644 --- a/extra/rpm/mock/tarantool-el-6-x86_64.cfg +++ b/extra/rpm/mock/tarantool-el-6-x86_64.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-el-6-x86_64' config_opts['target_arch'] = 'x86_64' config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'el6' # only useful for --resultdir variable subst config_opts['plugin_conf']['ccache_enable'] = False # beware RHEL use 6Server or 6Client diff --git a/extra/rpm/mock/tarantool-el-7-x86_64.cfg b/extra/rpm/mock/tarantool-el-7-x86_64.cfg index f03f90956027f073d98c99ae00d953008699b51b..11a154f8fd69415b09d96948ef62b47914016d1c 100644 --- a/extra/rpm/mock/tarantool-el-7-x86_64.cfg +++ b/extra/rpm/mock/tarantool-el-7-x86_64.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-el-7-x86_64' config_opts['target_arch'] = 'x86_64' config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'el7' # only useful for --resultdir variable subst config_opts['yum.conf'] = """ @@ -20,7 +20,7 @@ syslog_device= # repos [el] name=el -baseurl=http://kojipkgs.fedoraproject.org/rhel/beta/7/x86_64/os/ +baseurl=http://mirror.centos.org/centos-7/7/os/x86_64/ failovermethod=priority [epel] diff --git a/extra/rpm/mock/tarantool-fedora-19-i386.cfg b/extra/rpm/mock/tarantool-fedora-19-i386.cfg index 688b1a766f9bc1eb3edb5ff0d8b47c9aab5f2923..557c10bafaf3fca9790fe4ac4794b956d254a41b 100644 --- a/extra/rpm/mock/tarantool-fedora-19-i386.cfg +++ b/extra/rpm/mock/tarantool-fedora-19-i386.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-fedora-19-i386' config_opts['target_arch'] = 'i386' config_opts['legal_host_arches'] = ('i386', 'i586', 'i686', 'x86_64') -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'fc19' # only useful for --resultdir variable subst config_opts['extra_chroot_dirs'] = [ '/run/lock', ] config_opts['releasever'] = '19' diff --git a/extra/rpm/mock/tarantool-fedora-19-x86_64.cfg b/extra/rpm/mock/tarantool-fedora-19-x86_64.cfg index 10b1913780ee0c5001017d32074f6dedc4d26c43..a1447b063f55804bc62266e0c14fbad5cb8c7950 100644 --- a/extra/rpm/mock/tarantool-fedora-19-x86_64.cfg +++ b/extra/rpm/mock/tarantool-fedora-19-x86_64.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-fedora-19-x86_64' config_opts['target_arch'] = 'x86_64' config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'fc19' # only useful for --resultdir variable subst config_opts['extra_chroot_dirs'] = [ '/run/lock', ] config_opts['releasever'] = '19' diff --git a/extra/rpm/mock/tarantool-fedora-20-i386.cfg b/extra/rpm/mock/tarantool-fedora-20-i386.cfg index 3231044d3b76b4b01c6041a3ac07616fa402667e..f8bb4783f2e84c5d3b1edb691fc5db1e82514b2a 100644 --- a/extra/rpm/mock/tarantool-fedora-20-i386.cfg +++ b/extra/rpm/mock/tarantool-fedora-20-i386.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-fedora-20-i386' config_opts['target_arch'] = 'i386' config_opts['legal_host_arches'] = ('i386', 'i586', 'i686', 'x86_64') -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'fc20' # only useful for --resultdir variable subst config_opts['extra_chroot_dirs'] = [ '/run/lock', ] config_opts['releasever'] = '20' diff --git a/extra/rpm/mock/tarantool-fedora-20-x86_64.cfg b/extra/rpm/mock/tarantool-fedora-20-x86_64.cfg index 89fce7f6bb69d45e2bf265752f6e8cff604110f5..a2ab8a849e90530031ab84c2d41c687a69a8b206 100644 --- a/extra/rpm/mock/tarantool-fedora-20-x86_64.cfg +++ b/extra/rpm/mock/tarantool-fedora-20-x86_64.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-fedora-20-x86_64' config_opts['target_arch'] = 'x86_64' config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'fc20' # only useful for --resultdir variable subst config_opts['extra_chroot_dirs'] = [ '/run/lock', ] config_opts['releasever'] = '20' diff --git a/extra/rpm/mock/tarantool-fedora-rawhide-i386.cfg b/extra/rpm/mock/tarantool-fedora-rawhide-i386.cfg index 86bf7479da35c3e78cce9d1cfbb4c06b57147189..46db6f37b016e9c589da646ceca2c4eb22498b31 100644 --- a/extra/rpm/mock/tarantool-fedora-rawhide-i386.cfg +++ b/extra/rpm/mock/tarantool-fedora-rawhide-i386.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-fedora-rawhide-i386' config_opts['target_arch'] = 'i386' config_opts['legal_host_arches'] = ('i386', 'i586', 'i686', 'x86_64') -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'rawhide' # only useful for --resultdir variable subst config_opts['extra_chroot_dirs'] = [ '/run/lock', ] config_opts['releasever'] = '21' diff --git a/extra/rpm/mock/tarantool-fedora-rawhide-x86_64.cfg b/extra/rpm/mock/tarantool-fedora-rawhide-x86_64.cfg index e15f95a4675f3b1a495a3104d2dc04feae0fa017..136c221dc86dc3c727e7b058a6981de8cc3c31a6 100644 --- a/extra/rpm/mock/tarantool-fedora-rawhide-x86_64.cfg +++ b/extra/rpm/mock/tarantool-fedora-rawhide-x86_64.cfg @@ -1,7 +1,7 @@ config_opts['root'] = 'tarantool-fedora-rawhide-x86_64' config_opts['target_arch'] = 'x86_64' config_opts['legal_host_arches'] = ('x86_64',) -config_opts['chroot_setup_cmd'] = 'install @buildsys-build' +config_opts['chroot_setup_cmd'] = 'install @buildsys-build scl-utils-build' config_opts['dist'] = 'rawhide' # only useful for --resultdir variable subst config_opts['extra_chroot_dirs'] = [ '/run/lock', ] config_opts['releasever'] = '21' diff --git a/extra/rpm/tarantool.rpm.spec.in b/extra/rpm/tarantool.rpm.spec.in index 15ac88d03df2687515a2084164207a3db4acadcc..96cbdb18e3d41851ca379f4f757271f7bf493e05 100644 --- a/extra/rpm/tarantool.rpm.spec.in +++ b/extra/rpm/tarantool.rpm.spec.in @@ -92,7 +92,9 @@ Summary: Tarantool common files Vendor: tarantool.org Group: Applications/Databases Provides: %{?scl_prefix}tarantool-common +%if 0%{?rhel} != 5 BuildArch: noarch +%endif Requires: %{?scl_prefix}tarantool %description common Tarantool is a high performance in-memory NoSQL database. diff --git a/src/box/access.cc b/src/box/access.cc index d4437c94a16c2047925d796fcdc4b535a8851c5f..1521b5f6e4a8f4557a4df1db829659034f60b8eb 100644 --- a/src/box/access.cc +++ b/src/box/access.cc @@ -98,6 +98,7 @@ user_cache_replace(struct user *user) old->auth_token = auth_token; } user->auth_token = old->auth_token; + user->universal_access = old->universal_access; *old = *user; struct mh_i32ptr_node_t node = { old->uid, old }; mh_i32ptr_put(user_registry, &node, NULL, NULL); diff --git a/src/box/alter.cc b/src/box/alter.cc index 43441d7b004d750b3687fdea791e7cd62d4fbf31..7a1b19296c1c352d9e5d9a5ad0055d520f68bef1 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -214,13 +214,13 @@ AlterSpaceOp::destroy(AlterSpaceOp *op) * A trigger installed on transaction commit/rollback events of * the transaction which initiated the alter. */ -struct trigger * -txn_alter_trigger_new(trigger_f run, struct alter_space *alter) +static struct trigger * +txn_alter_trigger_new(trigger_f run, void *data) { struct trigger *trigger = (struct trigger *) region_alloc0(&fiber()->gc, sizeof(*trigger)); trigger->run = run; - trigger->data = alter; + trigger->data = data; trigger->destroy = NULL; return trigger; } @@ -438,7 +438,7 @@ alter_space_do(struct txn *txn, struct alter_space *alter, * Create a new (empty) space for the new definition. * Sic: the space engine is not the same yet, the * triggers are not set. - */ + */ alter->new_space = space_new(&alter->space_def, &alter->key_list); /* * Copy the engine, the new space is at the same recovery @@ -659,15 +659,6 @@ ModifyIndex::~ModifyIndex() * * The trigger is removed when alter operation commits/rolls back. */ -struct trigger * -add2index_trigger_new(trigger_f run, Index *new_index) -{ - struct trigger *trigger = (struct trigger *) - region_alloc0(&fiber()->gc, sizeof(*trigger)); - trigger->run = run; - trigger->data = new_index; - return trigger; -} /** AddIndex - add a new index to the space. */ class AddIndex: public AlterSpaceOp { @@ -761,7 +752,7 @@ on_replace_in_old_space(struct trigger *trigger, void *event) * creating the trigger may fail. */ struct trigger *on_rollback = - add2index_trigger_new(on_rollback_in_old_space, new_index); + txn_alter_trigger_new(on_rollback_in_old_space, new_index); /* * In a multi-statement transaction the same space * may be modified many times, but we need only one @@ -877,7 +868,7 @@ AddIndex::alter(struct alter_space *alter) assert(old_tuple == NULL); /* Guaranteed by DUP_INSERT. */ (void) old_tuple; } - on_replace = add2index_trigger_new(on_replace_in_old_space, + on_replace = txn_alter_trigger_new(on_replace_in_old_space, new_index); trigger_add(&alter->old_space->on_replace, on_replace); } @@ -912,9 +903,6 @@ on_drop_space(struct trigger * /* trigger */, void *event) space_delete(space); } -static struct trigger drop_space_trigger = - { rlist_nil, on_drop_space, NULL, NULL }; - /** * A trigger which is invoked on replace in a data dictionary * space _space. @@ -1007,7 +995,9 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event) * so it's safe to simply drop the space on * rollback. */ - trigger_add(&txn->on_rollback, &drop_space_trigger); + struct trigger *on_rollback = + txn_alter_trigger_new(on_drop_space, NULL); + trigger_add(&txn->on_rollback, on_rollback); } else if (new_tuple == NULL) { /* DELETE */ access_check_ddl(old_space->def.uid); /* Verify that the space is empty (has no indexes) */ @@ -1026,7 +1016,9 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event) * dd_space_delete() can't fail, any such * failure would have to abort the server. */ - trigger_add(&txn->on_commit, &drop_space_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(on_drop_space, NULL); + trigger_add(&txn->on_commit, on_commit); } else { /* UPDATE, REPLACE */ assert(old_space != NULL && new_tuple != NULL); /* @@ -1255,9 +1247,6 @@ user_cache_remove_user(struct trigger * /* trigger */, void *event) user_cache_delete(uid); } -static struct trigger drop_user_trigger = - { rlist_nil, user_cache_remove_user, NULL, NULL }; - static void user_cache_alter_user(struct trigger * /* trigger */, void *event) { @@ -1268,9 +1257,6 @@ user_cache_alter_user(struct trigger * /* trigger */, void *event) user_cache_replace(&user); } -static struct trigger modify_user_trigger = - { rlist_nil, user_cache_alter_user, NULL, NULL }; - /** * A trigger invoked on replace in the user table. */ @@ -1290,7 +1276,9 @@ on_replace_dd_user(struct trigger * /* trigger */, void *event) struct user user; user_create_from_tuple(&user, new_tuple); (void) user_cache_replace(&user); - trigger_add(&txn->on_rollback, &drop_user_trigger); + struct trigger *on_rollback = + txn_alter_trigger_new(user_cache_remove_user, NULL); + trigger_add(&txn->on_rollback, on_rollback); } else if (new_tuple == NULL) { /* DELETE */ access_check_ddl(old_user->owner); /* Can't drop guest or super user */ @@ -1307,7 +1295,9 @@ on_replace_dd_user(struct trigger * /* trigger */, void *event) tnt_raise(ClientError, ER_DROP_USER, old_user->name, "the user has objects"); } - trigger_add(&txn->on_commit, &drop_user_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(user_cache_remove_user, NULL); + trigger_add(&txn->on_commit, on_commit); } else { /* UPDATE, REPLACE */ assert(old_user != NULL && new_tuple != NULL); /* @@ -1317,7 +1307,9 @@ on_replace_dd_user(struct trigger * /* trigger */, void *event) */ struct user user; user_create_from_tuple(&user, new_tuple); - trigger_add(&txn->on_commit, &modify_user_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(user_cache_alter_user, NULL); + trigger_add(&txn->on_commit, on_commit); } } @@ -1353,9 +1345,6 @@ func_cache_remove_func(struct trigger * /* trigger */, void *event) func_cache_delete(fid); } -static struct trigger drop_func_trigger = - { rlist_nil, func_cache_remove_func, NULL, NULL }; - /** Replace a function in the function cache */ static void func_cache_replace_func(struct trigger * /* trigger */, void *event) @@ -1366,9 +1355,6 @@ func_cache_replace_func(struct trigger * /* trigger */, void *event) func_cache_replace(&func); } -static struct trigger modify_func_trigger = - { rlist_nil, func_cache_replace_func, NULL, NULL }; - /** * A trigger invoked on replace in a space containing * functions on which there were defined any grants. @@ -1389,7 +1375,9 @@ on_replace_dd_func(struct trigger * /* trigger */, void *event) if (new_tuple != NULL && old_func == NULL) { /* INSERT */ func_def_create_from_tuple(&func, new_tuple); func_cache_replace(&func); - trigger_add(&txn->on_rollback, &drop_func_trigger); + struct trigger *on_rollback = + txn_alter_trigger_new(func_cache_remove_func, NULL); + trigger_add(&txn->on_rollback, on_rollback); } else if (new_tuple == NULL) { /* DELETE */ func_def_create_from_tuple(&func, old_tuple); /* @@ -1403,11 +1391,15 @@ on_replace_dd_func(struct trigger * /* trigger */, void *event) (unsigned) func.uid, "function has grants"); } - trigger_add(&txn->on_commit, &drop_func_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(func_cache_remove_func, NULL); + trigger_add(&txn->on_commit, on_commit); } else { /* UPDATE, REPLACE */ func_def_create_from_tuple(&func, new_tuple); access_check_ddl(func.uid); - trigger_add(&txn->on_commit, &modify_func_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(func_cache_replace_func, NULL); + trigger_add(&txn->on_commit, on_commit); } } @@ -1533,9 +1525,6 @@ revoke_priv(struct trigger * /* trigger */, void *event) grant_or_revoke(&priv); } -static struct trigger revoke_priv_trigger = - { rlist_nil, revoke_priv, NULL, NULL }; - /** A trigger called on rollback of grant, or on commit of revoke. */ static void modify_priv(struct trigger * /* trigger */, void *event) @@ -1546,9 +1535,6 @@ modify_priv(struct trigger * /* trigger */, void *event) grant_or_revoke(&priv); } -static struct trigger modify_priv_trigger = - { rlist_nil, modify_priv, NULL, NULL }; - /** * A trigger invoked on replace in the space containing * all granted privileges. @@ -1566,16 +1552,22 @@ on_replace_dd_priv(struct trigger * /* trigger */, void *event) priv_def_create_from_tuple(&priv, new_tuple); priv_def_check(&priv); grant_or_revoke(&priv); - trigger_add(&txn->on_rollback, &revoke_priv_trigger); + struct trigger *on_rollback = + txn_alter_trigger_new(revoke_priv, NULL); + trigger_add(&txn->on_rollback, on_rollback); } else if (new_tuple == NULL) { /* revoke */ assert(old_tuple); priv_def_create_from_tuple(&priv, old_tuple); access_check_ddl(priv.grantor_id); - trigger_add(&txn->on_commit, &revoke_priv_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(revoke_priv, NULL); + trigger_add(&txn->on_commit, on_commit); } else { /* modify */ priv_def_create_from_tuple(&priv, new_tuple); priv_def_check(&priv); - trigger_add(&txn->on_commit, &modify_priv_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(modify_priv, NULL); + trigger_add(&txn->on_commit, on_commit); } } @@ -1655,9 +1647,6 @@ on_commit_dd_cluster(struct trigger *trigger, void *event) cluster_set_server(&uuid, id); } -static struct trigger commit_cluster_trigger = - { rlist_nil, on_commit_dd_cluster, NULL, NULL }; - /** * A trigger invoked on replace in the space _cluster, * which contains cluster configuration. @@ -1684,22 +1673,21 @@ on_replace_dd_cluster(struct trigger *trigger, void *event) txn_check_autocommit(txn, "Space _cluster"); struct txn_stmt *stmt = txn_stmt(txn); struct tuple *new_tuple = stmt->new_tuple; - if (new_tuple == NULL) { - trigger_add(&txn->on_commit, &commit_cluster_trigger); - return; + if (new_tuple != NULL) { + /* Check fields */ + uint32_t server_id = tuple_field_u32(new_tuple, 0); + if (cserver_id_is_reserved(server_id)) + tnt_raise(ClientError, ER_SERVER_ID_IS_RESERVED, + (unsigned) server_id); + tt_uuid server_uuid = tuple_field_uuid(new_tuple, 1); + if (tt_uuid_is_nil(&server_uuid)) + tnt_raise(ClientError, ER_INVALID_UUID, + tt_uuid_str(&server_uuid)); } - /* Check fields */ - uint32_t server_id = tuple_field_u32(new_tuple, 0); - if (cserver_id_is_reserved(server_id)) - tnt_raise(ClientError, ER_SERVER_ID_IS_RESERVED, - (unsigned) server_id); - tt_uuid server_uuid = tuple_field_uuid(new_tuple, 1); - if (tt_uuid_is_nil(&server_uuid)) - tnt_raise(ClientError, ER_INVALID_UUID, - tt_uuid_str(&server_uuid)); - - trigger_add(&txn->on_commit, &commit_cluster_trigger); + struct trigger *on_commit = + txn_alter_trigger_new(on_commit_dd_cluster, NULL); + trigger_add(&txn->on_commit, on_commit); } /* }}} cluster configuration */ diff --git a/src/lua/tap.lua b/src/lua/tap.lua index 34c4f3fe6012135a9ad3072af70e9f6294742d4e..67cb4026cf86ca7f852bda811e4af8bb58f30d44 100644 --- a/src/lua/tap.lua +++ b/src/lua/tap.lua @@ -126,6 +126,20 @@ local function cmpdeeply(got, expected, extra) return true end +local function like(test, got, pattern, message, extra) + extra = extra or {} + extra.got = got + extra.expected = pattern + return ok(test, string.match(tostring(got), pattern) ~= nil, message, extra) +end + +local function unlike(test, got, pattern, message, extra) + extra = extra or {} + extra.got = got + extra.expected = pattern + return ok(test, string.match(tostring(got), pattern) == nil, message, extra) +end + local function is(test, got, expected, message, extra) extra = extra or {} extra.got = got @@ -141,7 +155,7 @@ local function isnt(test, got, unexpected, message, extra) end -local function isdeeply(test, got, expected, message, extra) +local function is_deeply(test, got, expected, message, extra) extra = extra or {} extra.got = got extra.expected = expected @@ -268,7 +282,9 @@ test_mt = { isboolean = isboolean; isudata = isudata; iscdata = iscdata; - isdeeply = isdeeply; + is_deeply = is_deeply; + like = like; + unlike = unlike; } } diff --git a/test/app/lua/serializer_test.lua b/test/app/lua/serializer_test.lua index 22f7b028b2668163aa3aedb1efd4be5474c169f6..3adb18518d913d8112c498d3a6ca19aeaa398d13 100644 --- a/test/app/lua/serializer_test.lua +++ b/test/app/lua/serializer_test.lua @@ -18,7 +18,7 @@ local function rt(test, s, x) else xstr = tostring(x) end - test:isdeeply(x, x1, "encode/decode for "..xstr) + test:is_deeply(x, x1, "encode/decode for "..xstr) end local function test_unsigned(test, s) diff --git a/test/app/msgpack.test.lua b/test/app/msgpack.test.lua index b101b361bff04ee2d2d1f8f7196d8f06cbed3073..8fd8b15d8edbb603ee4fa2e59671a627c5404d7f 100755 --- a/test/app/msgpack.test.lua +++ b/test/app/msgpack.test.lua @@ -25,11 +25,11 @@ local function test_offsets(test, s) local a local offset = 1 a, offset = s.decode(dump, offset) - test:isdeeply(a, arr1, "decoded part1") + test:is_deeply(a, arr1, "decoded part1") test:is(offset, 5, "offset of part2") a, offset = s.decode(dump, offset) - test:isdeeply(a, arr2, "decoded part2") + test:is_deeply(a, arr2, "decoded part2") test:is(offset, 9, "offset of end") test:ok(not pcall(s.decode, dump, offset), "invalid offset") diff --git a/test/app/msgpackffi.test.lua b/test/app/msgpackffi.test.lua index 3a9e2fc76477cd7b1459f4cf494420deb86f889e..a3fdf7504b1041778d2bd06aafd07b6346e5db09 100755 --- a/test/app/msgpackffi.test.lua +++ b/test/app/msgpackffi.test.lua @@ -25,11 +25,11 @@ local function test_offsets(test, s) local a local offset = 1 a, offset = s.decode(dump, offset) - test:isdeeply(a, arr1, "decoded part1") + test:is_deeply(a, arr1, "decoded part1") test:is(offset, 5, "offset of part2") a, offset = s.decode(dump, offset) - test:isdeeply(a, arr2, "decoded part2") + test:is_deeply(a, arr2, "decoded part2") test:is(offset, 9, "offset of end") test:ok(not pcall(s.decode, dump, offset), "invalid offset") diff --git a/test/app/tap.result b/test/app/tap.result index a26757e5bf0de39ea0266d114785af85f9dafc64..3e7882331599fad91d2a2f6d2aefa9efa7a62a43 100644 --- a/test/app/tap.result +++ b/test/app/tap.result @@ -1,5 +1,5 @@ TAP version 13 -1..31 +1..32 ok - true ok - extra information is not printed on success not ok - extra printed using yaml only on failure @@ -118,7 +118,7 @@ not ok - failed subtests planned: 1 failed: 1 ... - # isdeeply + # is_deeply 1..6 ok - 1 and 1 ok - abc and abc @@ -136,10 +136,16 @@ not ok - failed subtests expected: 5 got: 4 ... - # isdeeply: end + # is_deeply: end not ok - failed subtests --- planned: 6 failed: 2 ... + # like + 1..2 + ok - like(abcde, cd) + ok - unlike(abcde, acd) + # like: end +ok - like # failed subtest: 15 diff --git a/test/app/tap.test.lua b/test/app/tap.test.lua index cc2d9bf3828395259b466ecc27e284bfd6cdaa62..a823faaa9ced0977fa00253d76442f1a9ca3a8a6 100755 --- a/test/app/tap.test.lua +++ b/test/app/tap.test.lua @@ -20,7 +20,7 @@ test.trace = false -- ok, fail and skip predicates -- -test:plan(31) -- plan to run 3 test +test:plan(32) -- plan to run 3 test test:ok(true, 'true') -- basic function local extra = { state = 'some userful information to debug on failure', details = 'a table argument formatted using yaml.encode()' } @@ -117,18 +117,25 @@ end) -test:test('isdeeply', function(t) +test:test('is_deeply', function(t) t:plan(6) - t:isdeeply(1, 1, '1 and 1') - t:isdeeply('abc', 'abc', 'abc and abc') - t:isdeeply({}, {}, 'empty tables') - t:isdeeply({1}, {1}, '{1} and {1}') - t:isdeeply({1}, {2}, '{1} and {2}') - t:isdeeply({1, 2, { 3, 4 }}, {1, 2, { 3, 5 }}, '{1,2,{3,4}} and {1,2,{3,5}}') + t:is_deeply(1, 1, '1 and 1') + t:is_deeply('abc', 'abc', 'abc and abc') + t:is_deeply({}, {}, 'empty tables') + t:is_deeply({1}, {1}, '{1} and {1}') + t:is_deeply({1}, {2}, '{1} and {2}') + t:is_deeply({1, 2, { 3, 4 }}, {1, 2, { 3, 5 }}, '{1,2,{3,4}} and {1,2,{3,5}}') end) + +test:test('like', function(t) + t:plan(2) + t:like('abcde', 'cd', 'like(abcde, cd)') + t:unlike('abcde', 'acd', 'unlike(abcde, acd)') +end) + -- -- Finish root test. Since we used non-callback variant, we have to -- call check explicitly. diff --git a/test/box/access_bin.result b/test/box/access_bin.result index 3b2958f0d0afceb16af28f29a888cae66bb33812..1633ab763fe4e8a190c7ebf22d3831f6cf7e26c7 100644 --- a/test/box/access_bin.result +++ b/test/box/access_bin.result @@ -178,3 +178,33 @@ c:close() test:drop() --- ... +-- +-- gh-575: User loses 'universe' grants after alter +-- +box.space._priv:get{1} +--- +- [1, 1, 'universe', 0, 7] +... +u = box.space._user:get{1} +--- +... +box.session.su('admin') +--- +... +box.schema.user.passwd('Gx5!') +--- +... +c = require('net.box').new('admin:Gx5!@'..box.cfg.listen) +--- +... +c:call('dostring', 'return 2 + 2') +--- +- - [4] +... +c:close() +--- +... +box.space._user:replace(u) +--- +- [1, 1, 'admin', 'user'] +... diff --git a/test/box/access_bin.test.lua b/test/box/access_bin.test.lua index f5e95fb7eaedef8578038131e522c5ef2ddf0acd..0dc4162047683da055b6b007dff5a167dcfaa009 100644 --- a/test/box/access_bin.test.lua +++ b/test/box/access_bin.test.lua @@ -67,3 +67,15 @@ c.space.test:insert{1} c:close() test:drop() +-- +-- gh-575: User loses 'universe' grants after alter +-- + +box.space._priv:get{1} +u = box.space._user:get{1} +box.session.su('admin') +box.schema.user.passwd('Gx5!') +c = require('net.box').new('admin:Gx5!@'..box.cfg.listen) +c:call('dostring', 'return 2 + 2') +c:close() +box.space._user:replace(u) diff --git a/test/box/alter.result b/test/box/alter.result index 93d4866c93a82ea89cd8763bfcafe004dc825e16..e5974dc8195617b14807d660197f2cbc2561970e 100644 --- a/test/box/alter.result +++ b/test/box/alter.result @@ -405,3 +405,28 @@ index = s:create_index('primary', {unique = true, parts = 'bug'}) s:drop() --- ... +-- ------------------------------------------------------------------ +-- gh-155 Tarantool failure on simultaneous space:drop() +-- ------------------------------------------------------------------ +--# setopt delimiter ';' +local fiber = require('fiber') +local W = 4 +local N = 50 +local ch = fiber.channel(W) +for i=1,W do + fiber.create(function() + for k=1,N do + local space_id = math.random(2147483647) + local space = box.schema.create_space(string.format('space_%d', space_id)) + space:create_index('pk', { type = 'tree' }) + space:drop() + end + ch:put(true) + end) +end +for i=1,W do + ch:get() +end +--- +... +--# setopt delimiter '' diff --git a/test/box/alter.test.lua b/test/box/alter.test.lua index 3cf6025b2f5b95f5d7c737fc67c1ac1daab42143..d93b775345f51cdc15a1a6d92cb8242473a59da5 100644 --- a/test/box/alter.test.lua +++ b/test/box/alter.test.lua @@ -151,3 +151,29 @@ index = s:create_index('primary', {unique = true, parts = {0, 'NUM', 1, 'STR'}}) index = s:create_index('primary', {unique = true, parts = {'NUM', 1, 'STR', 2}}) index = s:create_index('primary', {unique = true, parts = 'bug'}) s:drop() + + +-- ------------------------------------------------------------------ +-- gh-155 Tarantool failure on simultaneous space:drop() +-- ------------------------------------------------------------------ + +--# setopt delimiter ';' +local fiber = require('fiber') +local W = 4 +local N = 50 +local ch = fiber.channel(W) +for i=1,W do + fiber.create(function() + for k=1,N do + local space_id = math.random(2147483647) + local space = box.schema.create_space(string.format('space_%d', space_id)) + space:create_index('pk', { type = 'tree' }) + space:drop() + end + ch:put(true) + end) +end +for i=1,W do + ch:get() +end +--# setopt delimiter ''