summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Mathew <jacob.mathew@mariadb.com>2018-05-01 14:14:06 -0700
committerJacob Mathew <jacob.mathew@mariadb.com>2018-05-01 14:14:06 -0700
commit72f0efac67c21df6639f3dd01dfc74f0896172ec (patch)
treea6a337ddfe67750dbb0781d162f9a3d3f8449016
parent99fa7c6c2f9c8d705481bec35f7c4af48848cf70 (diff)
downloadmariadb-git-bb-10.3-MDEV-15697.tar.gz
MDEV-15697: Remote user used by Spider needs SUPER privilegebb-10.3-MDEV-15697
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.
-rw-r--r--storage/spider/spd_param.cc39
-rw-r--r--storage/spider/spd_param.h2
-rw-r--r--storage/spider/spd_trx.cc15
3 files changed, 33 insertions, 23 deletions
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index 6970f19e85f..bc8888babb0 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -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,
diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h
index d4af48a75ea..9a358c54be5 100644
--- a/storage/spider/spd_param.h
+++ b/storage/spider/spd_param.h
@@ -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(
diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index 53c83026f50..cf60a0376bb 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -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)