From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id D59DF6B962; Wed, 14 Apr 2021 11:07:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D59DF6B962 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618387659; bh=Jp8BvZADeNWDlabNizfDyx7f+y+SlBUjF1tNdNKi1EQ=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RbUXo+BkDPMtsKEdq6DY3l7LRZ0t0dcHgmyvElURZhB3pa6yP+XDkrC9hjM2kuCOc DHnJ0OfD4EYbUANSAF8/eLyH4TPd8xxx3EkzEDvrSjN/jKCTB+FfwKk6mDFgbBA0Uf cKHucQ8KZ/BA0HY7eKS3rcxONAN+KZJ9W0CbozFM= Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (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 889176BD23 for ; Wed, 14 Apr 2021 11:07:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 889176BD23 Received: by smtp52.i.mail.ru with esmtpa (envelope-from ) id 1lWaYh-0007Na-De; Wed, 14 Apr 2021 11:07:35 +0300 Date: Wed, 14 Apr 2021 08:07:32 +0000 To: Cyrill Gorcunov Message-ID: <20210414080732.5m7hium5iaqy2wk3@tarantool.org> References: <20210408164151.1759348-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210408164151.1759348-1-gorcunov@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480D608FE24BC85426BB1B55F651FED8C70182A05F53808504033D610296F34C4611B670622C8D0B0EF1E38D6C4A79789F8041ADB75702EFB28 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AEA4A6B3AFC9B957C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE746D93DAA4671895CEA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA65811008BCF650FE6E8B84BD61E3F3A7668F6B57BC7E64490618DEB871D839B73339E8FC8737B5C22494854413538E1713FCC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE9647ADFADE5905B1C8623B8F170C382FD8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3FA486DC37A503D0B040F9FF01DFDA4A8C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BD19508DA9CE2B92375ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A23F051236DBC9DA6306C627C4D753511DAE0174B7F1092AFB3EDAD912AF36B8D9C24402E8F517A12C X-C1DE0DAB: 0D63561A33F958A52B3C212614AAC6E54351903DD5D741C61045B97BCA4DA782D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344888A9AABCDD32257BC9C1334E258E27FE7373177E2377E0576A628D3A41ADF71693FD1872E0EA901D7E09C32AA3244C368158FA7831E8BF1E437420D9DD46E5A995755A1445935E927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXGbH+2bA9yX4A== X-Mailru-Sender: 05EB39F83D09414F9B5D7F52D7CDFDD2323A73BBA435F86E00623D3B22CFE8AE976AF1CB91E6F881CA16B95394F0DD5CE99530A0C0F27B5268329DCED823713783C0E760C018FF54112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v21 0/6] box: implement box.lib Lua module X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Kirill Yukhin via Tarantool-patches Reply-To: Kirill Yukhin Cc: tml , Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hello, On 08 апр 19:41, Cyrill Gorcunov wrote: > v1-v3 are development ones and not sent. > > v5 (by vlad): > - drop exists, list methods: they are redundant > - rename cfunc to cbox > - when create a function make it callable Lua object > - initialize cbox out of modules > - fix error in passing module name for reloading > - make api been cbox.func.[create|drop] and > cbox.module.reload > - fix test for OSX sake > > v6 (by vlad): > - move module handling into module_cache file. > v7: > - development > v8: > - use rbtree for function instance storage, since > i don't like the idea of unexpected rehashing of > values in case of massive number of functions > allocated > - use reference counter and free function instance > if only load/unload are coupled > - keep a pointer to the function inside Lua object > so we don't need to lookup on every function call. > this force us to implement __gc method > - use new API and update docs > v9: > - development > v10: > - use hashes for function names lookup > - simply function loads counting > - use luaL_register_module and luaL_register_type for > easier methods registering > - carry functions as userdata object > v11: > - development > v12: > - switch to new API as been discussed in > https://lists.tarantool.org/tarantool-patches/e186c454-6765-4776-6433-f3f791ff4c27@tarantool.org/ > v13: > - development > v14: > - switch to refs to carry module usage > - drop func_name structure renaming > - carry two hashes for backward compatibility with > functions created via box.schema.func help > - complete rework of cmod and most parts of > module_cache > - account for file statistics to invalidate > module cache > - new API for cmod, no more :reload, the :load > procedure uses cache invalidation > - update test cases > - still there is no GC test since I didn't > manage to deal with it > v15: > - report module state cached/orphan > - update test cases > - do not prevent functions lookup in orphan modules > - there was an idea to use box.shema.func cache as on > top of cmod's one, but this doesn't work because in case > if module doesnt exist in any caches we would put it into > into cmod's one as well but there wont be a module on > cmod level which would clean it up later (which makes > code a way more comple if we choose to track state > of modules). > v16: > - internal > v17: > - drop idea of unifying box.schema.func and cmod functions > cache, it brings more problems than solves due to too > different context of execution; > - make cmod self consistent, which shrink patch series > size ~1/5 in compare with previous attempts; > - improve tests to account internal states of modules > and functions (tt_dev key in reports). > v18: > - implement pass-through cache for modules loading, for > this sake 'struct module' uses cmod internally; > - improve tests to cover sole cmod case and a mixture > of box.schema.func and cmod to make sure the caches > are not corrupted. > > v19: > - move module handling into separate subsystem; > - switch box.schema.func and cmod to use this shared > code to eliminate code duplication; > - update tests. > > v20: > - fix potential nil dereference in schema_init while I'm in the code; > - during working on the series found a bug in module recovery, > fixed it in the series because my further work depends on it; > - main module which allows to create C functions now named as box.lib; > - structures renaming: > - box.schema.func uses struct schema_module to carry underlied > struct module; > - box.lib uses struct module directly and struct box_module_func > to carry cache of functions. > - name unification: > - schema_module variables are named as `mod`; > - box.schema.func api prefixed as `schema_module_x`; > - debug properties for module counting prefixed as `debug_x`; > - the test remains disabled because > - I run it locally all the time > - better to have it in repo and enable then since patching > test-run can take weeks, it is slow procedure > v21: > - rename functions and members from Vlad's comments > - use @base name for lowlevel module and functions > - use @module name for toplevel instances > - rename __schema_module_load to schema_do_module_load > - rename schema_func_c_load to func_c_load_from > - rename box_lib.[ch] to plain lib.[ch] > - cache free methods only clear the hash table itself > - in cache_put make sure there is an empty slot we're touching > - unify `const char *` usage > - use lua_isstring instead of LUA_TSTRING test > - optimize clearing of user data on Lua level via clear_udata > helper > - don't use tt_static hepers > - in schema_module_reload restore failing function immediately > and the proceed the remaining ones > - move ERRINJ_DYN_MODULE_COUNT to module_cache so that > old tests are passing > - more detailed testing of module loading > - make box.lib enabled by default even without box.cfg{} > > I pushed it and since github actions are not that fast I ran > tests locally as well > > Statistics: > * pass: 1250 > * disabled: 70 > > issue https://github.com/tarantool/tarantool/issues/4642 > branch gorcunov/gh-4642-func-ro-21 I've checked your patch set into master. -- Regards, Kirill Yukhin