From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 60155469719 for ; Tue, 13 Oct 2020 02:23:07 +0300 (MSK) From: Alexander Turenko Date: Tue, 13 Oct 2020 02:23:07 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v3 00/16] module api: extend for external key_def Lua module List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org, Alexander Turenko Vlad, Thank you for the past thorough reviews and answering to a lot of my questions! Can you look over the updated patchset once again? Overview -------- The patchset exposes and adds new functions into the module API, which are necessary to implement the external tuple.keydef module. Aside of this, a couple of relevant bugs were fixed. The extra commits for tarantool-1.10 are the following: - lua: adjust contract of luaT_tuple_new() - collation: allow to find a collation by a name I'll not flood the mailing list with the 1.10 version of the patchset (if someone will not ask me do to that). It mostly the same or similar as this patchset (however there are some code differences). Previous versions: [v1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-September/019583.html [v2]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-October/020019.html Changelog from v2 to v3 ----------------------- In brief: the last three commits from v2 gains test cases, the new function box_key_def_validate_full_key() is added. - Clarified how default values of may be changed in a future tarantool versions. - Added a test case for 'none' collation for box_key_def_dump_parts(). - Added -g to build module API test to obtain backtraces from GDB. - Added box_key_def_merge() test. - Added basic box_key_def_extract_key() test. - Added basic box_key_def_validate_key() test. - Clarified box_key_def_validate_key() API comment. - Fixed some typos, made suggested style changes. - Added region_truncate() in case of encoding or OOM error inside luaT_tuple_encode(). - Added box_key_def_validate_full_key(). - Clafiried the Lua stack manipulations in luaT_tuple_encode_on_lua_ibuf(). @ChangeLog - Module API: Get rid of typedef redefinitions for compatibility with C99 (gh-5313). - Lua: Fixed unhandled Lua error that may lead to memory leaks and inconsistencies in `:frommap()`, `:compare()`, `:select()` (gh-5382). - Module API: Exposed the box region, key_def and several other functions in order to implement an external tuple.keydef module on top of them (gh-5273). Issues ------ https://github.com/tarantool/tarantool/issues/5313 ('module api: module API requires C11') https://github.com/tarantool/tarantool/issues/5382 ('luaT_tuple_new() raises a Lua error that leads to various problems') https://github.com/tarantool/tarantool/issues/5273 ('module api: expose everything that is needed for external key_def module') Branches -------- https://github.com/tarantool/tarantool/tree/Totktonada/gh-5273-expand-module-api (top 16 commits) https://github.com/tarantool/tarantool/tree/Totktonada/gh-5273-expand-module-api-1.10 (top 18 commits) The module based on this API ---------------------------- https://github.com/Totktonada/key_def The module repository will be moved to the tarantool organization soon, when the module API will come into the server. It'll be in https://github.com/tarantool/tuple-keydef Alexander Turenko (16): module api: get rid of typedef redefinitions module api: expose box region module api/lua: add luaL_iscdata() function lua: factor out tuple encoding from luaT_tuple_new lua: don't raise a Lua error from luaT_tuple_new() module api/lua: add luaT_tuple_encode() module api/lua: expose luaT_tuple_new() module api/lua: add API_EXPORT to tuple functions module api: add API_EXPORT to key_def functions module api: add box_key_def_new_v2() module api: add box_key_def_dump_parts() module api: expose box_key_def_validate_tuple() module api: expose box_key_def_merge() module api: expose box_key_def_extract_key() module api: add box_key_def_validate_key() module api: add box_key_def_validate_full_key() src/CMakeLists.txt | 2 +- src/box/index.h | 5 +- src/box/key_def.c | 264 +++++ src/box/key_def.h | 268 ++++- src/box/lua/tuple.c | 210 +++- src/box/lua/tuple.h | 46 +- src/exports.h | 15 + src/lib/core/fiber.c | 24 + src/lib/core/fiber.h | 76 ++ src/lua/utils.c | 6 + src/lua/utils.h | 20 + test/app-tap/CMakeLists.txt | 6 + test/app-tap/module_api.c | 1711 ++++++++++++++++++++++++++++++ test/app-tap/module_api.test.lua | 63 +- test/unit/luaT_tuple_new.c | 42 +- test/unit/luaT_tuple_new.result | 6 +- 16 files changed, 2705 insertions(+), 59 deletions(-) -- 2.25.0