MXS-1475 Enable MaxScale specific user variables
With the changes in this commit it is possible to add and remove MaxScale specific user variables. A MaxScale specific user variable is a user variable that is interpreted by MaxScale and that potentially changes the behaviour of MaxScale. MaxScale specific user variables are of the format "@maxscale.x.y" where "@maxscale" is a mandatory prefix, x a scope identifying the component that handles the variable and y the component specific variable. So, a variable might be called e.g. "@maxscale.cache.enabled". The scope "core" is reserved (although not enforced yet) to MaxScale itself. The idea is that although MaxScale catches these, they are passed through to the server. The benefit of this is that we do not need to detect e.g. "SELECT @maxscale.cache.enabled", but can let the result be returned from the server. The interpretation of a provided value is handled by the component that adds the variable. In a subsequent commit, it will be possible for a component to reject a value, which will then cause an error to be returned to the client. There are 3 new functions: - session_add_variable() using which a variable is added, - session_remove_variable() using which a variable is removed, and - session_set_variable_value(). The two former ones are to be called by components, the last one by the protocol that catches the "set @maxscale..." statements.
This commit is contained in:
@ -917,7 +917,9 @@ void handle_variables(MXS_SESSION* session, GWBUF** read_buffer)
|
||||
break;
|
||||
|
||||
case SetParser::IS_SET_MAXSCALE:
|
||||
// TODO: Handle "set @MAXSCALE...=...";
|
||||
session_set_variable_value(session,
|
||||
result.variable_begin(), result.variable_end(),
|
||||
result.value_begin(), result.value_end());
|
||||
break;
|
||||
|
||||
case SetParser::NOT_RELEVANT:
|
||||
|
Reference in New Issue
Block a user