Plugins that declare admin-side runtime views of their own in-memory
state need a way to register a projection callback the chassis can
invoke when admin SELECTs against the registered table. Without this
hook, the only way for a plugin to surface its runtime state to admin
operators was to *persist* a duplicate copy of the data into admin_db,
which violates the separation of duties between Admin (owns
configuration tables and views) and the module (owns runtime state).
Refs #5687.
ABI surface (in include/ProxySQL_Plugin.h):
- struct ProxySQL_PluginRuntimeView { table_name, refresh, opaque }
- new services.register_runtime_view callback
- bumps PROXYSQL_PLUGIN_ABI_VERSION to 3
The new field is appended at the end of ProxySQL_PluginServices, so
ABI-2 plugins keep working — they neither set nor read past the
previous layout. ABI 3 plugins set abi_version=3 and use the new
field. Loader accepts ABI 1, 2, and 3.
Plumbing (in lib/ProxySQL_PluginManager.cpp):
- register_runtime_view_service() free fn wires through to the
manager's runtime_views_ vector
- ProxySQL_PluginManager::register_runtime_view() rejects empty
table names, null callbacks, and duplicate registrations
- sql_references_table_ci() does whole-identifier substring match,
so a SELECT on `runtime_mysqlx_users` doesn't fire the refresh
for `runtime_mysqlx_users_extra` if both ever coexist
- refresh_runtime_views_for_query() iterates registered views and
invokes the matching refresh callbacks
- proxysql_refresh_configured_plugin_runtime_views() is the
Admin-callable wrapper that takes the manager shared lock
Admin-handler integration (in lib/ProxySQL_Admin.cpp):
- the existing pre-SELECT refresh block (where runtime_mysql_users
triggers save_mysql_users_runtime_to_database(true), etc.) now
also calls proxysql_refresh_configured_plugin_runtime_views().
This is the SAME refresh point the canonical core tables use, so
plugin views are guaranteed to refresh before the admin query
actually executes against admindb.
Doc block at the bottom of ProxySQL_Plugin.h rewritten to spell out
the separation-of-duties contract explicitly, replacing the previous
"copy_table guidance" that incorrectly endorsed plugins persisting
their runtime state to admin_db tables.
This commit is the foundation only — no plugin uses the new API yet.
The follow-up commits convert the mysqlx plugin's four entity pairs
(users / routes / endpoints / variables) to the canonical pattern.