mirror of https://github.com/sysown/proxysql
The chassis ABI 2 query-hook surface (ProxySQL_PluginQueryHookPayload /
Result / Action plus register_query_hook / dispatch_configured_plugin_
query_hook) is wired through ProxySQL_PluginManager and exercised end-
to-end by unit tests. But the production data plane never calls
proxysql_dispatch_configured_plugin_query_hook — neither MySQL_Session
nor PgSQL_Session has the integration point.
Net effect today: a plugin can register a query hook successfully and
unit tests can drive dispatch through it, but a real client query
arriving over MySQL or PgSQL will never consult the hook. The DENY
contract from the public ABI ("DENY prevents a query from dispatching")
is currently a promise the production path doesn't keep.
# Why scaffold-state instead of immediate full integration
Wiring the dispatch into MySQL_Session::handler___status_WAITING_
CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY_qpo (and the COM_STMT_
PREPARE / COM_STMT_EXECUTE entries that share the qpo machinery) is
mechanical but touches a 95k-LOC hot-path file. A bug in the
integration would manifest as a query-blocking regression that's hard
to debug and easy to ship.
Same for PgSQL_Session. The integration deserves its own focused PR
with TAP coverage that exercises both ALLOW and DENY paths against a
fake plugin — not a side-quest in this PR which is already large.
# What this commit does
1. Updates the ABI doc block in include/ProxySQL_Plugin.h to call out
the scaffold state explicitly. A plugin author reading the header
today would reasonably assume the hook fires in production; that
assumption is wrong, and the doc block now says so. References the
precise grep target ("TODO(plugin-query-hook)") that points at the
missing injection sites.
2. Adds two TODO(plugin-query-hook) markers to MySQL_Session.cpp:
- line ~3387 (COM_STMT_PREPARE → COM_QUERY shared codepath)
- line ~5403 (the main COM_QUERY execution path)
Each immediately follows the GloMyQPro->process_query call, where
CurrentQuery is populated and the dispatch payload would be ready.
3. Adds one TODO(plugin-query-hook) marker to PgSQL_Session.cpp at
line ~2387, following the GloPgQPro->process_query call.
# What this commit deliberately does NOT do
The actual dispatch wiring. The next person picking this up has:
- A precise injection site (3 in MySQL, 1+ in PgSQL).
- Pre-built ABI surface (proxysql_has_configured_plugin_query_hook
for the lock-free fast-path probe; proxysql_dispatch_configured_
plugin_query_hook for the actual hook invocation under shared lock).
- Existing test_helpers/fake_plugin.cpp with a HOOK_DENY env toggle
that exercises the dispatch path under unit test today — extensible
to TAP integration tests once the production wiring lands.
Caught by an external review pass, finding #5. Filing as a deferred
fix with explicit scaffold acknowledgement rather than rushing the
integration.
pull/5702/head
parent
e535a66ee1
commit
6d8dff2939
Loading…
Reference in new issue