Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d54bc3c0
Commit
d54bc3c0
authored
Sep 21, 2015
by
Nirbhay Choubey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: remove dead code which could also lead to race.
parent
9d5767cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
18 deletions
+59
-18
mysql-test/suite/galera/r/galera_read_only.result
mysql-test/suite/galera/r/galera_read_only.result
+18
-0
mysql-test/suite/galera/t/galera_read_only.test
mysql-test/suite/galera/t/galera_read_only.test
+39
-0
sql/sql_parse.cc
sql/sql_parse.cc
+2
-18
No files found.
mysql-test/suite/galera/r/galera_read_only.result
0 → 100644
View file @
d54bc3c0
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;
mysql-test/suite/galera/t/galera_read_only.test
0 → 100644
View file @
d54bc3c0
--
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
;
sql/sql_parse.cc
View file @
d54bc3c0
...
...
@@ -982,22 +982,6 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
}
#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
->
command
;
...
...
@@ -1011,6 +995,7 @@ static void wsrep_copy_query(THD *thd)
thd
->
wsrep_retry_query
[
thd
->
wsrep_retry_query_len
]
=
'\0'
;
}
#endif
/* WITH_WSREP */
/**
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
=
!
thd
->
in_multi_stmt_transaction_mode
()
&&
thd
->
wsrep_conflict_state
==
NO_CONFLICT
&&
!
thd
->
wsrep_applier
&&
wsrep_read_only_option
(
thd
,
thd
->
lex
->
query_tables
);
!
thd
->
wsrep_applier
;
do
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment