[MDEV-20837] Add MariaDB_FUNCTION_PLUGIN Created: 2019-10-16  Updated: 2020-08-11  Resolved: 2019-10-16

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.5.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-274 The data type for IPv6/IPv4 addresses... Closed
blocks MDEV-4912 Data type plugin API version 1 Closed
blocks MDEV-20841 Turn GIS implementation into a plugin Open
blocks MDEV-20842 Crash using versioning plugin functio... Closed
Relates
relates to MDEV-20846 Add proper unlocking for MariaDB_FUNC... Open
relates to MDEV-20764 Add MariaDB_FUNCTION_COLLECTION_PLUGIN Closed
relates to MDEV-23290 Add overloading support in MariaDB_FU... Open

 Description   

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:

SELECT * FROM INFORMATION_SCHEMA.PLUGINS;

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.


 Comments   
Comment by Alexander Barkov [ 2019-10-16 ]

serg, please review:
https://github.com/MariaDB/server/commits/bb-10.5-bar

Generated at Thu Feb 08 09:02:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.