1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-15935 Adding global/session system var redirect_url

Adding a global/session var `redirect_url' of string type. The initial
value is empty. Can be supplied in mysqld with --redirect-url or set
in --init-connect. A valid redirect_url should be of the format

{mysql,mariadb}://host[:port]

where <host> is an arbitrary string not containing colons, and <port>
is a number between 0 and 65535 inclusive.

The variable will be used by the server to notify clients that they
should connect to another server, specified by the value of the
variable, if not empty.

The notification is done by the inclusion of the variable in
session_track_system_variable.
This commit is contained in:
Yuchen Pei
2023-09-13 11:49:57 +10:00
parent 6151bde48c
commit 5af70decca
12 changed files with 286 additions and 16 deletions

View File

@ -3278,6 +3278,8 @@ void plugin_thdvar_init(THD *thd)
/* This and all other variable cleanups are here for COM_CHANGE_USER :( */
#ifndef EMBEDDED_LIBRARY
thd->session_tracker.sysvars.deinit(thd);
my_free(thd->variables.redirect_url);
thd->variables.redirect_url= 0;
#endif
my_free((char*) thd->variables.default_master_connection.str);
thd->variables.default_master_connection.str= 0;
@ -3311,7 +3313,12 @@ void plugin_thdvar_init(THD *thd)
MYF(MY_WME | MY_THREAD_SPECIFIC));
#ifndef EMBEDDED_LIBRARY
thd->session_tracker.sysvars.init(thd);
thd->variables.redirect_url=
my_strdup(key_memory_Sys_var_charptr_value,
global_system_variables.redirect_url,
MYF(MY_WME | MY_THREAD_SPECIFIC));
#endif
DBUG_VOID_RETURN;
}
@ -3379,6 +3386,8 @@ void plugin_thdvar_cleanup(THD *thd)
#ifndef EMBEDDED_LIBRARY
thd->session_tracker.sysvars.deinit(thd);
my_free(thd->variables.redirect_url);
thd->variables.redirect_url= 0;
#endif
my_free((char*) thd->variables.default_master_connection.str);
thd->variables.default_master_connection.str= 0;