Add MCP module to admin bootstrap and SHOW MCP VARIABLES command

The MCP module was not being loaded because:

1. The admin bootstrap process was not calling flush_mcp_variables___database_to_runtime
   - Added the call after flush_sqliteserver_variables___database_to_runtime

2. There was no SHOW MCP VARIABLES command handler
   - Added the handler in Admin_Handler.cpp, following the same pattern as
     SHOW MYSQL VARIABLES and SHOW PGSQL VARIABLES

Now after this change:
- MCP variables (mcp-enabled, mcp-port, mcp-mysql_hosts, etc.) will be
  automatically inserted into global_variables table during ProxySQL startup
- Users can run "SHOW MCP VARIABLES" to list all MCP configuration variables
- The configure_mcp.sh script will work correctly

Note: Requires rebuilding ProxySQL for changes to take effect.
pull/5310/head
Rene Cannao 1 month ago
parent 28742554b5
commit ef07831780

@ -1208,6 +1208,7 @@ bool ProxySQL_Admin::init(const bootstrap_info_t& bootstrap_info) {
flush_clickhouse_variables___database_to_runtime(admindb,true);
#endif /* PROXYSQLCLICKHOUSE */
flush_sqliteserver_variables___database_to_runtime(admindb,true);
flush_mcp_variables___database_to_runtime(admindb, true);
if (GloVars.__cmd_proxysql_admin_socket) {
set_variable((char *)"mysql_ifaces",GloVars.__cmd_proxysql_admin_socket);

@ -4016,6 +4016,13 @@ void admin_session_handler(S* sess, void *_pa, PtrSize_t *pkt) {
goto __run_query;
}
if (query_no_space_length == strlen("SHOW MCP VARIABLES") && !strncasecmp("SHOW MCP VARIABLES", query_no_space, query_no_space_length)) {
l_free(query_length, query);
query = l_strdup("SELECT variable_name AS Variable_name, variable_value AS Value FROM global_variables WHERE variable_name LIKE 'mcp-%' ORDER BY variable_name");
query_length = strlen(query) + 1;
goto __run_query;
}
strA=(char *)"SHOW CREATE TABLE ";
strB=(char *)"SELECT name AS 'table' , REPLACE(REPLACE(sql,' , ', X'2C0A20202020'),'CREATE TABLE %s (','CREATE TABLE %s ('||X'0A20202020') AS 'Create Table' FROM %s.sqlite_master WHERE type='table' AND name='%s'";
strAl=strlen(strA);

Loading…
Cancel
Save