Originally, Serg and Bar decided to implement function plugins through MariaDB_FUNCTION_COLLECTION_PLUGIN, so a plugin can export multiple SQL functions at the same type.
The retionale of this solution was to avoid flooding the output of this query:
For example, we have 155 GEOMETRY related functions. Exporting all 155 function as individual plugins would add 155 entries to the query output.
After adding MariaDB_FUNCTION_COLLECTION_PLUGIN, we came up to the following:
- The hash to lookup functions by name appeared to be redundant. We already have a hash to lookup plugins by name (and type). So this new hash looked really duplicate.
- It's not possible to maintain ref_count of individual functions. So some more code duplication is needed for dynamic plugins, to maintain reference counters.
After discussing, Serg and Bar decided that:
- For now we should go through a new plugin type, MariaDB_FUNCTION_PLUGIN, where each plugin exports a single function. We'll do flood the output of INFORMATION_SCHEMA.PLUGINS queries for now, but this is tolerable. It's more important to avoid code duplication.
- Eventually we'll add generic collection plugins with these characteristics:
- A generic collection plugin will be able to join multiple plugins, even of different types (e.g. a number of MariaDB_DATE_TYPE_PLUGINs and MariaDB_FUNCTION_PLUGINs) into a single instance, which will be available in some INFORMATION_SCHEMA table (either PLUGINS, or a new one) as a single record.
- A generic collection plugin will be able to do atomic initialization: either load all sub-plugins, or load non of them.
Under terms of this task we do the following:
- Implement MariaDB_FUNCTION_PLUGIN, to export individual functions.
- Change the code in /plugins/type_inet/ and /plugins/type_test/ to use MariaDB_FUNCTION_PLUGIN instead of MariaDB_FUNCTION_COLLECTION_PLUGIN.
- Remove MariaDB_FUNCTION_COLLECTION.