Commit d54bc3c0 authored by Nirbhay Choubey's avatar Nirbhay Choubey

Cleanup: remove dead code which could also lead to race.

parent 9d5767cf
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL read_only=TRUE;
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
CREATE USER foo@localhost;
# Open connection to node 2 using 'foo' user.
# Connect with foo_node_2
INSERT INTO t1 VALUES (2);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SET GLOBAL read_only=FALSE;
DROP TABLE t1;
DROP USER foo@localhost;
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# Ensure that the read_only option does not apply to Galera appliers and that replication
# continues, the way MySQL replication would.
#
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
--connection node_2
SET GLOBAL read_only=TRUE;
--connection node_1
INSERT INTO t1 VALUES (1);
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
CREATE USER foo@localhost;
--echo # Open connection to node 2 using 'foo' user.
--let $port_2= \$NODE_MYPORT_2
--connect(foo_node_2,127.0.0.1,foo,,test,$port_2,)
--echo
--echo # Connect with foo_node_2
--connection foo_node_2
--error ER_OPTION_PREVENTS_STATEMENT
INSERT INTO t1 VALUES (2);
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
# Cleanup
SET GLOBAL read_only=FALSE;
DROP TABLE t1;
DROP USER foo@localhost;
...@@ -982,22 +982,6 @@ static my_bool deny_updates_if_read_only_option(THD *thd, ...@@ -982,22 +982,6 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
} }
#ifdef WITH_WSREP #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) static void wsrep_copy_query(THD *thd)
{ {
thd->wsrep_retry_command = thd->command; thd->wsrep_retry_command = thd->command;
...@@ -1011,6 +995,7 @@ static void wsrep_copy_query(THD *thd) ...@@ -1011,6 +995,7 @@ static void wsrep_copy_query(THD *thd)
thd->wsrep_retry_query[thd->wsrep_retry_query_len] = '\0'; thd->wsrep_retry_query[thd->wsrep_retry_query_len] = '\0';
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/** /**
Perform one connection-level (COM_XXXX) command. Perform one connection-level (COM_XXXX) command.
...@@ -6355,8 +6340,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -6355,8 +6340,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
bool is_autocommit= bool is_autocommit=
!thd->in_multi_stmt_transaction_mode() && !thd->in_multi_stmt_transaction_mode() &&
thd->wsrep_conflict_state == NO_CONFLICT && thd->wsrep_conflict_state == NO_CONFLICT &&
!thd->wsrep_applier && !thd->wsrep_applier;
wsrep_read_only_option(thd, thd->lex->query_tables);
do do
{ {
......
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