mirror of
https://github.com/MariaDB/server.git
synced 2025-07-07 06:01:31 +03:00
Cleanup: remove dead code which could also lead to race.
This commit is contained in:
18
mysql-test/suite/galera/r/galera_read_only.result
Normal file
18
mysql-test/suite/galera/r/galera_read_only.result
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
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;
|
39
mysql-test/suite/galera/t/galera_read_only.test
Normal file
39
mysql-test/suite/galera/t/galera_read_only.test
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
--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,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#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)
|
|||||||
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,
|
|||||||
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
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user