As database technology evolves and business scenarios become more diverse, flexibility and scalability have become core capabilities of modern distributed database systems. To meet the demand for efficient and flexible feature expansion, OceanBase Database introduces a plugin mechanism, offering a modular and non-intrusive way to extend functionality. This mechanism allows users to dynamically load, unload, and update feature modules without modifying the core code, enabling efficient customization and expansion of the database system.
Notice
- For OceanBase Database V4.3.5, the plugin mechanism is supported starting from V4.3.5 BP1.
- The plugin mechanism in OceanBase Database is currently an experimental feature and is not recommended for use in production environments. Its scope and stability are still being improved. At this stage, the plugin mechanism primarily supports the following scenarios:
- Tokenizer plugins: Extend the full-text search capabilities of the database, supporting user-defined tokenization logic.
- Feature verification: Users can experience the plugin mechanism early through this experimental feature and provide valuable feedback for future feature expansions.
Advantages of the plugin mechanism
Simplified expansion
With the plugin mechanism in OceanBase Database, you can easily add new feature modules to OceanBase Database without modifying the core code. This modular design makes feature expansion more convenient and intuitive.
Efficient updates
The plugin mechanism supports rapid iteration and updates, allowing users to promptly obtain and apply the latest feature improvements and bug fixes. This quick response capability ensures the system remains in optimal condition, meeting evolving business needs.
Customizable features
The plugin mechanism allows users to customize specific features based on their business requirements, enhancing the system's flexibility and adaptability. Users can selectively load or unload plugins to ensure only the required feature modules are running.
Community and ecosystem support
Through the plugin mechanism, OceanBase Database users can share and publish custom plugins, fostering community collaboration and enriching the plugin ecosystem. This not only diversifies the functionality of OceanBase Database but also drives the growth of the entire community.
Working principle of the plugin mechanism
OceanBase Database plugins are components that extend database functionality in the form of dynamic link libraries. You can add the following features without modifying OceanBase Database:
- Customized features (such as special tokenization algorithms).
- Compatibility with third-party ecosystems (such as support for specific data formats).
- Commercial expansion modules.
Plugin system architecture
The plugin system of OceanBase Database is designed to enable developers to quickly expand its capabilities.

The relevant modules are as follows:
Plugin library itself: such as external tables and tokenizers.
Plugin Interfaces: the version number of the plugin interface.
Note
Each plugin interface has its own version number.
Plugin API: the OceanBase Database capabilities provided to the plugin library.
OceanBase Database defines the interfaces that each plugin must implement. Each type of plugin has its own specific interfaces (Plugin Interfaces), such as external tables and tokenizers. The plugin library implements these interfaces, and OceanBase Database can call the plugin implementation when loading the plugin library. When implementing features, if a plugin needs to use OceanBase Database capabilities such as accessing OceanBase Database data or printing logs, it can call the Plugin API (Plugin API). The implementation of the Plugin API is in OceanBase Database, i.e., Plugin API Implementation.
This way, when developing plugins, you do not need to deeply understand the source code of OceanBase Database. You only need to rely on the plugin development library of OceanBase Database. Additionally, each type of plugin has a sample code for reference, such as the sample code of the tokenizer plugin.
Internally, to ensure compatibility with OceanBase Database features and plugins, the plugin system converts the plugin interfaces to be compatible with the original feature definitions of OceanBase Database, which is the Plugin Interface Adaptor module.
When you install a plugin, the plugin object is maintained internally by the Plugin Manager in OceanBase Database. When OceanBase Database uses a plugin, it also searches for the plugin through the Plugin Manager module.
Compatibility
Since plugins are independent of OceanBase Database, compatibility between different versions of plugins and different versions of OceanBase Database must be considered. OceanBase Database strives to ensure compatibility with older versions of plugins to prevent serious runtime issues (such as system crashes) caused by interface incompatibilities.
OceanBase Database provides two types of version numbers to ensure compatibility: the version number of the plugin interface (Plugin Interfaces) and the version number of the plugin API (Plugin API).
OceanBase Database designs a version number for each plugin interface. When compiling a plugin, you need to specify the version of the interface it implements. When the plugin library is installed into OceanBase Database, OceanBase Database verifies the version number. Additionally, to reduce the need for recompilation, plugin interfaces can only be added, not removed. OceanBase Database also handles compatibility with older versions of the interface when calling the plugin interface, which is typically done by the Plugin Adaptor. For example, the first version of the tokenizer plugin interface is 0.1.0. After adding the check_if_charset_supported interface, the new version number is 0.2.0. When developing a plugin library, you can use the version number to determine whether to implement the new check_if_charset_supported interface.
Another type of version number designed by OceanBase Database is the plugin API version number. This version number prevents situations where a plugin library needs to access a higher version of the API, but the running version of OceanBase Database is too old to provide that API. In such cases, an error can be thrown during installation. Similar to the plugin interface version number, the plugin API version number increases whenever new content is added.
Notably, there are multiple plugin interface version numbers, each corresponding to a specific type of interface, such as the tokenizer plugin interface and the external table plugin interface. However, there is only one global plugin API version number. Even if new APIs are added specifically for the tokenizer plugin, the global plugin API version number must be updated.
