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
d1c2cd30
Commit
d1c2cd30
authored
Dec 27, 2017
by
Vicențiu Ciorbaru
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch '10.0' into 10.1
parents
5377242f
4b8cd453
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
161 additions
and
15 deletions
+161
-15
mysql-test/suite/innodb/r/innodb.result
mysql-test/suite/innodb/r/innodb.result
+80
-0
mysql-test/suite/innodb/t/innodb.test
mysql-test/suite/innodb/t/innodb.test
+70
-0
sql/sql_acl.cc
sql/sql_acl.cc
+11
-15
No files found.
mysql-test/suite/innodb/r/innodb.result
View file @
d1c2cd30
...
...
@@ -3144,3 +3144,83 @@ show status like "handler_read_key";
Variable_name Value
Handler_read_key 0
drop table t1;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(0);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
ROLLBACK;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
INSERT INTO t2 VALUES(1);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
COMMIT;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1
1
3
DROP TABLE t2;
CREATE TEMPORARY TABLE t2 (
c1 INT AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
)
ENGINE=InnoDB DEFAULT CHARSET=latin1
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
ROLLBACK;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1 c2
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction.
COMMIT;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
)
ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1 c2
4 1
7 1
5 2
8 2
6 3
9 3
DROP TABLE t1;
DROP TABLE t2;
mysql-test/suite/innodb/t/innodb.test
View file @
d1c2cd30
...
...
@@ -2530,6 +2530,76 @@ select f1 from t1;
show
status
like
"handler_read_key"
;
drop
table
t1
;
#
# Test handling of writes to TEMPORARY tables for read-only transactions
#
CREATE
TABLE
t1
(
c1
INT
)
ENGINE
=
InnoDB
;
CREATE
TEMPORARY
TABLE
t2
(
c1
INT
)
ENGINE
=
InnoDB
;
# Check that the rollback works
START
TRANSACTION
READ
ONLY
;
INSERT
INTO
t2
VALUES
(
0
);
--
error
ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT
INTO
t1
VALUES
(
0
);
ROLLBACK
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
START
TRANSACTION
READ
ONLY
;
--
error
ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT
INTO
t1
VALUES
(
0
);
INSERT
INTO
t2
VALUES
(
1
);
COMMIT
;
SET
TRANSACTION
READ
ONLY
;
START
TRANSACTION
;
INSERT
INTO
t2
VALUES
(
3
);
--
error
ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT
INTO
t1
VALUES
(
0
);
COMMIT
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
# This time with some indexes
CREATE
TEMPORARY
TABLE
t2
(
c1
INT
AUTO_INCREMENT
PRIMARY
KEY
,
c2
INT
,
INDEX
idx
(
c2
))
ENGINE
=
InnoDB
;
SHOW
CREATE
TABLE
t2
;
# Check that the rollback works
START
TRANSACTION
READ
ONLY
;
INSERT
INTO
t2
VALUES
(
NULL
,
1
),(
NULL
,
2
),(
NULL
,
3
);
--
error
ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT
INTO
t1
VALUES
(
0
);
ROLLBACK
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
START
TRANSACTION
READ
ONLY
;
--
error
ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT
INTO
t1
VALUES
(
0
);
INSERT
INTO
t2
VALUES
(
NULL
,
1
),(
NULL
,
2
),(
NULL
,
3
);
COMMIT
;
SET
TRANSACTION
READ
ONLY
;
START
TRANSACTION
;
INSERT
INTO
t2
VALUES
(
NULL
,
1
),(
NULL
,
2
),(
NULL
,
3
);
--
error
ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT
INTO
t1
VALUES
(
0
);
COMMIT
;
SHOW
CREATE
TABLE
t2
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
;
DROP
TABLE
t2
;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
...
...
sql/sql_acl.cc
View file @
d1c2cd30
...
...
@@ -5672,6 +5672,8 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)),
if
(
--
grantee
->
counter
)
return
1
;
// don't recurse into grantee just yet
grantee
->
counter
=
1
;
// Mark the grantee as merged.
/* if we'll do db/table/routine privileges, create a hash of role names */
role_hash_t
role_hash
(
role_key
);
if
(
data
->
what
!=
PRIVS_TO_MERGE
::
GLOBAL
)
...
...
@@ -6761,14 +6763,16 @@ static bool grant_load(THD *thd, TABLE_LIST *tables)
DBUG_RETURN
(
return_val
);
}
static
my_bool
collect_leaf_roles
(
void
*
role_ptr
,
void
*
roles_array
)
static
my_bool
propagate_role_grants_action
(
void
*
role_ptr
,
void
*
ptr
__attribute__
((
unused
))
)
{
ACL_ROLE
*
role
=
static_cast
<
ACL_ROLE
*>
(
role_ptr
);
Dynamic_array
<
ACL_ROLE
*>
*
array
=
static_cast
<
Dynamic_array
<
ACL_ROLE
*>
*>
(
roles_array
);
if
(
!
role
->
counter
)
array
->
push
(
role
);
if
(
role
->
counter
)
return
0
;
mysql_mutex_assert_owner
(
&
acl_cache
->
lock
);
PRIVS_TO_MERGE
data
=
{
PRIVS_TO_MERGE
::
ALL
,
0
,
0
};
traverse_role_graph_up
(
role
,
&
data
,
NULL
,
merge_role_privileges
);
return
0
;
}
...
...
@@ -6835,15 +6839,7 @@ bool grant_reload(THD *thd)
}
mysql_mutex_lock
(
&
acl_cache
->
lock
);
Dynamic_array
<
ACL_ROLE
*>
leaf_roles
;
my_hash_iterate
(
&
acl_roles
,
collect_leaf_roles
,
&
leaf_roles
);
PRIVS_TO_MERGE
data
=
{
PRIVS_TO_MERGE
::
ALL
,
0
,
0
};
for
(
size_t
i
=
0
;
i
<
leaf_roles
.
elements
();
i
++
)
{
traverse_role_graph_up
(
leaf_roles
.
at
(
i
),
&
data
,
NULL
,
merge_role_privileges
);
}
my_hash_iterate
(
&
acl_roles
,
propagate_role_grants_action
,
NULL
);
mysql_mutex_unlock
(
&
acl_cache
->
lock
);
mysql_rwlock_unlock
(
&
LOCK_grant
);
...
...
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