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 6A65E6C7D4; Wed, 3 Feb 2021 01:14:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6A65E6C7D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612304086; bh=mgUC74W7FFjYUu81Tf5pb5VWnSV+72pW35u9BEsrOIg=; 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=m8C+hIxiU+M+Wqt3eeuWA8VhznbTs1wvLl8x75O8+3PfpUujLbRa9oh26d5i6UboJ buxaaRist/+1uDftto/mJMC4tjN7s8ap9FYQqdSLXTkqctzlS++Vzk4ZuQBax9o3lc x2Ww7yqTQ/MTKu4Rzb8coFnyrxiZUKY2o3fgWoBQ= Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 52FDE6C7D4 for ; Wed, 3 Feb 2021 01:13:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 52FDE6C7D4 Received: by mail-lf1-f53.google.com with SMTP id v24so30367002lfr.7 for ; Tue, 02 Feb 2021 14:13:13 -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=Ib0IbQKaLe7LUSIjNA+WWdPnXz873GjZYh14aU+ajx8=; b=Sj7nUBb7jnX9tP2GVLCDeUVp44gcCbDz3ESlEDnkhtPpEdiJHi2B8dxAnG7I6Fsf5O sVjGSCfnjxTT1ZvcvPMnBFZSgiroHA31t4fOYm0cq2FqmyQDFTO+pjJR2H5t8CjLUC6X jOOtjB2n4wbVxiWIYVfhSWm87t8vFMeq+SRB46FQ0+nGbMiletaR6MfbMkzuUD1Un4Hv LOBkK8btysif/P9q4YQ15NeTZzZbC/vqIoMHED7RM8xEA6xNTKFks2TLbWXNk9vvk5wk hsKbqSbwT1hoX0oK+vEo0aAE0xUlcKBu8byXfz0NgSRl8YBnALStignySehVb9MO61wL gpSQ== X-Gm-Message-State: AOAM532xKuoghODHY71OHZpt6amSaOF3moGI84xGMEVcJ/g9VZAkXQhF b/If6eD2cXmh67g9itPv5e2tV8Lb52g= X-Google-Smtp-Source: ABdhPJxnAyCXuhp5hkvC2UF30ic9SX1XZnzla3DG9Cja82MiDgfB6tx4Yxf6bVhKIa1JfVPycLmKhQ== X-Received: by 2002:ac2:5fc8:: with SMTP id q8mr44678lfg.338.1612303992192; Tue, 02 Feb 2021 14:13:12 -0800 (PST) Received: from grain.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id z9sm30243lfc.125.2021.02.02.14.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 14:13:10 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 8F11156029E; Wed, 3 Feb 2021 01:12:08 +0300 (MSK) To: tml Date: Wed, 3 Feb 2021 01:12:00 +0300 Message-Id: <20210202221207.383101-6-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210202221207.383101-1-gorcunov@gmail.com> References: <20210202221207.383101-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v14 05/12] 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: 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 9e5670c03..60af290ae 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