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 CD2D664676; Fri, 5 Feb 2021 21:57:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CD2D664676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612551430; bh=5dX9nQiLOgCIX10AKMhRB9lwhfbPkecWJ4fIl6blzb4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=kIF7uF/3wFNePGi0VB1CbSQSVdSSITLPFrMUjqof/90jQvlxUyn6ITJDpCOCyFjBN UbXOA6InSENwiUXmhlr7KqRwfE5OXat3cEOkAbaMAzd0eQQA0mkXQ5OJXw4X0pUpZQ uRqXMFPQoLP992UTTlE9gSmMlvdxzvjwpM7RSZz8= Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 13F3964677 for ; Fri, 5 Feb 2021 21:55:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 13F3964677 Received: by mail-lj1-f174.google.com with SMTP id s18so8999324ljg.7 for ; Fri, 05 Feb 2021 10:55:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A5lLZubx3oLEZzh6Eh6rwE68Wz+3ybYcBGraWGxPJIQ=; b=o/wrXvQe3BgIgERJ0C6eWdsBu1DE+gSVx0lhfm9T/7yljFC8cb89ptWge/qVvXglW5 Vi4MadPVdqNWnaXhuhCVMwwaDXud7mdLjNQbqvUnfs22xrW/h5aznKYgGHUf8gsy8mjA 11sCr9zIpi1ZOnmcpZ/4e9mxFDh124ymUxdsUI5+pt3BBe7exbFNwxIVKXhb5J2Z1ngw hDFDfUkC9PlbcgMuSjttdnHxPU/2IWlND9Ddr228iozU8fv2XUsPUMPYcaL1Hns9YISr fKiWkirE9udurLsLgncn1zs8Gbt/ODyXfbdLGXY0FLMxqJfd5+aT717uvKFij37nve/T ZU2g== X-Gm-Message-State: AOAM532/iGbQfnGprfpJJ7mXOgOGzROuB7JtzRC+rt5zS9IGo+JRYuOR OzgD4Qgxc2kNpSainHJe0wc= X-Google-Smtp-Source: ABdhPJwq/Z44eOKGLaHDCXnhdTliI4mpJgjwUSAaay9nPMdFepmXzkpGnUY9cjq0XxIXiL7zhH5enA== X-Received: by 2002:a2e:918d:: with SMTP id f13mr3445396ljg.321.1612551338711; Fri, 05 Feb 2021 10:55:38 -0800 (PST) Received: from grain.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id j12sm1062942lfc.99.2021.02.05.10.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 10:55:37 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 85BEF560292; Fri, 5 Feb 2021 21:54:37 +0300 (MSK) To: tml Date: Fri, 5 Feb 2021 21:54:30 +0300 Message-Id: <20210205185436.638894-6-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205185436.638894-1-gorcunov@gmail.com> References: <20210205185436.638894-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v15 05/11] module_cache: add comment about weird resolving 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Mons Anderson , Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" The module management is not obvious when reading the code, mostly because of weird design in first place which we can't change without breaking backward compatibility. Add a note about this into code itself otherwise it is hard to understand why it works the way it does. Part-of #4642 Signed-off-by: Cyrill Gorcunov --- src/box/module_cache.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/box/module_cache.c b/src/box/module_cache.c index e8a510d26..f606ec327 100644 --- a/src/box/module_cache.c +++ b/src/box/module_cache.c @@ -418,6 +418,18 @@ int module_sym_call(struct module_sym *mod_sym, struct port *args, struct port *ret) { + /* + * The functions created with `box.schema.func` + * help are not resolved immediately. Instead + * they are deferred until first call. And when + * call happens the we try to load a module and + * resolve a symbol (which of course can fail if + * there is no such module at all). + * + * While this is very weird (and frankly speaking + * very bad design) we can't change it for backward + * compatibility sake! + */ if (mod_sym->addr == NULL) { if (module_sym_load(mod_sym) != 0) return -1; -- 2.29.2