Commit 8b087c63 authored by Jacob Mathew's avatar Jacob Mathew

MDEV-15697: Remote user used by Spider needs SUPER privilege

The remote users need the SUPER privilege because by default Spider sends a
'SET SQL_LOG_OFF' statement to the data nodes.  This is controlled by the
spider_internal_sql_log_off configuration setting on the Spider node, which
can only be set to 0 or 1, with a default value of 1.

I have fixed the problem by changing this configuration setting so that if it
is NOT SET, which is the most likely case, the Spider node DOES NOT SEND the
'SET SQL_LOG_OFF' statement to the data nodes.  However if the
spider_internal_sql_log_off setting IS EXPLICITLY SET to either 0 or 1, then
the Spider node DOES SEND the 'SET SQL_LOG_OFF' statement, requiring a remote
user with the SUPER privilege.  The Spider documentation will be updated to
reflect this change.

Author:
  Jacob Mathew.

Reviewer:
  Kentoku Shiba.

Merged:
  Branch bb-10.3-MDEV-15697 into 10.3
parents 85ccdd9f 72f0efac
......@@ -968,20 +968,25 @@ bool spider_param_use_default_database(
DBUG_RETURN(THDVAR(thd, use_default_database));
}
static int spider_internal_sql_log_off;
/*
FALSE: sql_log_off = 0
TRUE: sql_log_off = 1
*/
static MYSQL_THDVAR_BOOL(
internal_sql_log_off, /* name */
PLUGIN_VAR_OPCMDARG, /* opt */
"Sync sql_log_off", /* comment */
NULL, /* check */
NULL, /* update */
TRUE /* def */
);
bool spider_param_internal_sql_log_off(
-1 :don't know or does not matter; don't send 'SET SQL_LOG_OFF' statement
0 :do send 'SET SQL_LOG_OFF 0' statement to data nodes
1 :do send 'SET SQL_LOG_OFF 1' statement to data nodes
*/
static MYSQL_THDVAR_INT(
internal_sql_log_off, /* name */
PLUGIN_VAR_RQCMDARG, /* opt */
"Manage SQL_LOG_OFF mode statement to the data nodes", /* comment */
NULL, /* check */
NULL, /* update */
-1, /* default */
-1, /* min */
1, /* max */
0 /* blk */
);
int spider_param_internal_sql_log_off(
THD *thd
) {
DBUG_ENTER("spider_param_internal_sql_log_off");
......@@ -2224,15 +2229,15 @@ char *spider_param_remote_time_zone()
static int spider_remote_sql_log_off;
/*
-1 :don't set
0 :sql_log_off = 0
1 :sql_log_off = 1
-1 :don't know the value on all data nodes, or does not matter
0 :sql_log_off = 0 on all data nodes
1 :sql_log_off = 1 on all data nodes
*/
static MYSQL_SYSVAR_INT(
remote_sql_log_off,
spider_remote_sql_log_off,
PLUGIN_VAR_RQCMDARG,
"Set sql_log_off mode at connecting for improvement performance of connection if you know",
"Set SQL_LOG_OFF mode on connecting for improved performance of connection, if you know",
NULL,
NULL,
-1,
......
......@@ -113,7 +113,7 @@ bool spider_param_sync_time_zone(
bool spider_param_use_default_database(
THD *thd
);
bool spider_param_internal_sql_log_off(
int spider_param_internal_sql_log_off(
THD *thd
);
int spider_param_bulk_size(
......
......@@ -1638,15 +1638,20 @@ int spider_check_and_set_sql_log_off(
SPIDER_CONN *conn,
int *need_mon
) {
bool internal_sql_log_off;
int internal_sql_log_off;
DBUG_ENTER("spider_check_and_set_sql_log_off");
internal_sql_log_off = spider_param_internal_sql_log_off(thd);
if (internal_sql_log_off)
if (internal_sql_log_off != -1)
{
spider_conn_queue_sql_log_off(conn, TRUE);
} else {
spider_conn_queue_sql_log_off(conn, FALSE);
if (internal_sql_log_off)
{
spider_conn_queue_sql_log_off(conn, TRUE);
}
else
{
spider_conn_queue_sql_log_off(conn, FALSE);
}
}
/*
if (internal_sql_log_off && conn->sql_log_off != 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment