summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2022-05-12 15:17:37 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2022-05-17 10:28:21 +0300
commit4dffa7b5c5baadf95e01d7d595b4ae0dab5965cf (patch)
treedf833e18273d7faf74277e2e757375444062e944 /sql
parent4a8a6f605d3f9c8cbca14a04cb75c6d2a29fb6f6 (diff)
downloadmariadb-git-4dffa7b5c5baadf95e01d7d595b4ae0dab5965cf.tar.gz
MDEV-28546 : Possible to write/update with read_only=ON and not a SUPER privilege
Function wsrep_read_only_option was already removed in commit d54bc3c0d1 because it could cause race condition on variable opt_readonly so that value OFF can become permanent. Removed function again and added test case. Note that writes to TEMPORARY tables are still allowed when read_only=ON.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc18
1 files changed, 1 insertions, 17 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b5e6b6540c5..04c3450dd98 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1468,22 +1468,6 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
}
#ifdef WITH_WSREP
-static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables)
-{
- int opt_readonly_saved = opt_readonly;
- ulong flag_saved = (ulong)(thd->security_ctx->master_access & SUPER_ACL);
-
- opt_readonly = 0;
- thd->security_ctx->master_access &= ~SUPER_ACL;
-
- my_bool ret = !deny_updates_if_read_only_option(thd, all_tables);
-
- opt_readonly = opt_readonly_saved;
- thd->security_ctx->master_access |= flag_saved;
-
- return ret;
-}
-
static void wsrep_copy_query(THD *thd)
{
thd->wsrep_retry_command = thd->get_command();
@@ -7807,7 +7791,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
{
bool is_autocommit=
!thd->in_multi_stmt_transaction_mode() &&
- wsrep_read_only_option(thd, thd->lex->query_tables);
+ !thd->wsrep_applier;
bool retry_autocommit;
do
{