[Tarantool-patches] [PATCH v15 05/11] module_cache: add comment about weird resolving

Cyrill Gorcunov gorcunov at gmail.com
Fri Feb 5 21:54:30 MSK 2021


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 <gorcunov at gmail.com>
---
 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



More information about the Tarantool-patches mailing list