Skip to content

Commit df420cb

Browse files
author
Jacob Mathew
committed
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. Cherry-Picked: Commit 72f0efa on branch bb-10.3-MDEV-15697
1 parent fe95cb2 commit df420cb

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

storage/spider/spd_param.cc

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -928,20 +928,25 @@ bool spider_param_use_default_database(
928928
DBUG_RETURN(THDVAR(thd, use_default_database));
929929
}
930930

931+
static int spider_internal_sql_log_off;
931932
/*
932-
FALSE: sql_log_off = 0
933-
TRUE: sql_log_off = 1
934-
*/
935-
static MYSQL_THDVAR_BOOL(
936-
internal_sql_log_off, /* name */
937-
PLUGIN_VAR_OPCMDARG, /* opt */
938-
"Sync sql_log_off", /* comment */
939-
NULL, /* check */
940-
NULL, /* update */
941-
TRUE /* def */
942-
);
943-
944-
bool spider_param_internal_sql_log_off(
933+
-1 :don't know or does not matter; don't send 'SET SQL_LOG_OFF' statement
934+
0 :do send 'SET SQL_LOG_OFF 0' statement to data nodes
935+
1 :do send 'SET SQL_LOG_OFF 1' statement to data nodes
936+
*/
937+
static MYSQL_THDVAR_INT(
938+
internal_sql_log_off, /* name */
939+
PLUGIN_VAR_RQCMDARG, /* opt */
940+
"Manage SQL_LOG_OFF mode statement to the data nodes", /* comment */
941+
NULL, /* check */
942+
NULL, /* update */
943+
-1, /* default */
944+
-1, /* min */
945+
1, /* max */
946+
0 /* blk */
947+
);
948+
949+
int spider_param_internal_sql_log_off(
945950
THD *thd
946951
) {
947952
DBUG_ENTER("spider_param_internal_sql_log_off");
@@ -2182,15 +2187,15 @@ char *spider_param_remote_time_zone()
21822187

21832188
static int spider_remote_sql_log_off;
21842189
/*
2185-
-1 :don't set
2186-
0 :sql_log_off = 0
2187-
1 :sql_log_off = 1
2190+
-1 :don't know the value on all data nodes, or does not matter
2191+
0 :sql_log_off = 0 on all data nodes
2192+
1 :sql_log_off = 1 on all data nodes
21882193
*/
21892194
static MYSQL_SYSVAR_INT(
21902195
remote_sql_log_off,
21912196
spider_remote_sql_log_off,
21922197
PLUGIN_VAR_RQCMDARG,
2193-
"Set sql_log_off mode at connecting for improvement performance of connection if you know",
2198+
"Set SQL_LOG_OFF mode on connecting for improved performance of connection, if you know",
21942199
NULL,
21952200
NULL,
21962201
-1,

storage/spider/spd_param.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bool spider_param_sync_time_zone(
110110
bool spider_param_use_default_database(
111111
THD *thd
112112
);
113-
bool spider_param_internal_sql_log_off(
113+
int spider_param_internal_sql_log_off(
114114
THD *thd
115115
);
116116
int spider_param_bulk_size(

storage/spider/spd_trx.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,15 +1590,20 @@ int spider_check_and_set_sql_log_off(
15901590
SPIDER_CONN *conn,
15911591
int *need_mon
15921592
) {
1593-
bool internal_sql_log_off;
1593+
int internal_sql_log_off;
15941594
DBUG_ENTER("spider_check_and_set_sql_log_off");
15951595

15961596
internal_sql_log_off = spider_param_internal_sql_log_off(thd);
1597-
if (internal_sql_log_off)
1597+
if (internal_sql_log_off != -1)
15981598
{
1599-
spider_conn_queue_sql_log_off(conn, TRUE);
1600-
} else {
1601-
spider_conn_queue_sql_log_off(conn, FALSE);
1599+
if (internal_sql_log_off)
1600+
{
1601+
spider_conn_queue_sql_log_off(conn, TRUE);
1602+
}
1603+
else
1604+
{
1605+
spider_conn_queue_sql_log_off(conn, FALSE);
1606+
}
16021607
}
16031608
/*
16041609
if (internal_sql_log_off && conn->sql_log_off != 1)

0 commit comments

Comments
 (0)