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
6c403ec9
Commit
6c403ec9
authored
Jun 03, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug28728
parents
04e2d152
b313fe13
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
7 deletions
+102
-7
include/thr_lock.h
include/thr_lock.h
+5
-0
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+24
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+55
-0
sql/set_var.cc
sql/set_var.cc
+5
-1
sql/sql_base.cc
sql/sql_base.cc
+7
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-6
No files found.
include/thr_lock.h
View file @
6c403ec9
...
@@ -54,6 +54,11 @@ enum thr_lock_type { TL_IGNORE=-1,
...
@@ -54,6 +54,11 @@ enum thr_lock_type { TL_IGNORE=-1,
TL_WRITE_CONCURRENT_INSERT
,
TL_WRITE_CONCURRENT_INSERT
,
/* Write used by INSERT DELAYED. Allows READ locks */
/* Write used by INSERT DELAYED. Allows READ locks */
TL_WRITE_DELAYED
,
TL_WRITE_DELAYED
,
/*
parser only! Late bound low_priority flag.
At open_tables() becomes thd->update_lock_default.
*/
TL_WRITE_DEFAULT
,
/* WRITE lock that has lower priority than TL_READ */
/* WRITE lock that has lower priority than TL_READ */
TL_WRITE_LOW_PRIORITY
,
TL_WRITE_LOW_PRIORITY
,
/* Normal WRITE lock */
/* Normal WRITE lock */
...
...
mysql-test/r/trigger.result
View file @
6c403ec9
...
@@ -1449,4 +1449,28 @@ isave
...
@@ -1449,4 +1449,28 @@ isave
1
1
2
2
drop table t1, t2, t3;
drop table t1, t2, t3;
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
INSERT INTO t2 VALUES (1),(2);
CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
INSERT INTO t2 VALUES (new.id);
SELECT GET_LOCK('B26162',20);
GET_LOCK('B26162',20)
1
SELECT 'rl_acquirer', GET_LOCK('B26162',5), id FROM t2 WHERE id = 1;
SET SESSION LOW_PRIORITY_UPDATES=1;
SET GLOBAL LOW_PRIORITY_UPDATES=1;
INSERT INTO t1 VALUES (5);
SELECT 'rl_contender', id FROM t2 WHERE id > 1;
SELECT RELEASE_LOCK('B26162');
RELEASE_LOCK('B26162')
0
rl_acquirer GET_LOCK('B26162',5) id
rl_acquirer 0 1
rl_contender id
rl_contender 2
DROP TRIGGER t1_test;
DROP TABLE t1,t2;
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/trigger.test
View file @
6c403ec9
...
@@ -1763,4 +1763,59 @@ select * from t1;
...
@@ -1763,4 +1763,59 @@ select * from t1;
select
*
from
t3
;
select
*
from
t3
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
# Bug #26162: Trigger DML ignores low_priority_updates setting
#
CREATE
TABLE
t1
(
id
INTEGER
);
CREATE
TABLE
t2
(
id
INTEGER
);
INSERT
INTO
t2
VALUES
(
1
),(
2
);
# trigger that produces the high priority insert, but should be low, adding
# LOW_PRIORITY fixes this
CREATE
TRIGGER
t1_test
AFTER
INSERT
ON
t1
FOR
EACH
ROW
INSERT
INTO
t2
VALUES
(
new
.
id
);
CONNECT
(
rl_acquirer
,
localhost
,
root
,,);
CONNECT
(
wl_acquirer
,
localhost
,
root
,,);
CONNECT
(
rl_contender
,
localhost
,
root
,,);
SELECT
GET_LOCK
(
'B26162'
,
20
);
CONNECTION
rl_acquirer
;
--
send
SELECT
'rl_acquirer'
,
GET_LOCK
(
'B26162'
,
5
),
id
FROM
t2
WHERE
id
=
1
;
CONNECTION
wl_acquirer
;
SET
SESSION
LOW_PRIORITY_UPDATES
=
1
;
SET
GLOBAL
LOW_PRIORITY_UPDATES
=
1
;
--
send
INSERT
INTO
t1
VALUES
(
5
);
CONNECTION
rl_contender
;
# must not "see" the row inserted by the INSERT (as it must run before the
# INSERT)
--
send
SELECT
'rl_contender'
,
id
FROM
t2
WHERE
id
>
1
;
CONNECTION
default
;
SELECT
RELEASE_LOCK
(
'B26162'
);
CONNECTION
wl_acquirer
;
--
reap
CONNECTION
rl_acquirer
;
--
reap
CONNECTION
rl_contender
;
--
reap
CONNECTION
default
;
DISCONNECT
rl_acquirer
;
DISCONNECT
wl_acquirer
;
DISCONNECT
rl_contender
;
DROP
TRIGGER
t1_test
;
DROP
TABLE
t1
,
t2
;
SET
SESSION
LOW_PRIORITY_UPDATES
=
DEFAULT
;
SET
GLOBAL
LOW_PRIORITY_UPDATES
=
DEFAULT
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/set_var.cc
View file @
6c403ec9
...
@@ -1226,7 +1226,11 @@ static void sys_default_ftb_syntax(THD *thd, enum_var_type type)
...
@@ -1226,7 +1226,11 @@ static void sys_default_ftb_syntax(THD *thd, enum_var_type type)
static
void
fix_low_priority_updates
(
THD
*
thd
,
enum_var_type
type
)
static
void
fix_low_priority_updates
(
THD
*
thd
,
enum_var_type
type
)
{
{
if
(
type
!=
OPT_GLOBAL
)
if
(
type
==
OPT_GLOBAL
)
thr_upgraded_concurrent_insert_lock
=
(
global_system_variables
.
low_priority_updates
?
TL_WRITE_LOW_PRIORITY
:
TL_WRITE
);
else
thd
->
update_lock_default
=
(
thd
->
variables
.
low_priority_updates
?
thd
->
update_lock_default
=
(
thd
->
variables
.
low_priority_updates
?
TL_WRITE_LOW_PRIORITY
:
TL_WRITE
);
TL_WRITE_LOW_PRIORITY
:
TL_WRITE
);
}
}
...
...
sql/sql_base.cc
View file @
6c403ec9
...
@@ -1505,6 +1505,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
...
@@ -1505,6 +1505,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
HASH_SEARCH_STATE
state
;
HASH_SEARCH_STATE
state
;
DBUG_ENTER
(
"open_table"
);
DBUG_ENTER
(
"open_table"
);
DBUG_ASSERT
(
table_list
->
lock_type
!=
TL_WRITE_DEFAULT
);
/* find a unused table in the open table cache */
/* find a unused table in the open table cache */
if
(
refresh
)
if
(
refresh
)
*
refresh
=
0
;
*
refresh
=
0
;
...
@@ -2674,6 +2675,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
...
@@ -2674,6 +2675,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
for
(
tables
=
*
start
;
tables
;
tables
=
tables
->
next_global
)
for
(
tables
=
*
start
;
tables
;
tables
=
tables
->
next_global
)
{
{
safe_to_ignore_table
=
FALSE
;
// 'FALSE', as per coding style
safe_to_ignore_table
=
FALSE
;
// 'FALSE', as per coding style
if
(
tables
->
lock_type
==
TL_WRITE_DEFAULT
)
{
tables
->
lock_type
=
thd
->
update_lock_default
;
DBUG_ASSERT
(
tables
->
lock_type
>=
TL_WRITE_ALLOW_WRITE
);
}
/*
/*
Ignore placeholders for derived tables. After derived tables
Ignore placeholders for derived tables. After derived tables
processing, link to created temporary table will be put here.
processing, link to created temporary table will be put here.
...
...
sql/sql_yacc.yy
View file @
6c403ec9
...
@@ -6548,7 +6548,7 @@ insert_lock_option:
...
@@ -6548,7 +6548,7 @@ insert_lock_option:
insert visible only after the table unlocking but everyone can
insert visible only after the table unlocking but everyone can
read table.
read table.
*/
*/
$$= (Lex->sphead ? TL_WRITE
:
TL_WRITE_CONCURRENT_INSERT);
$$= (Lex->sphead ? TL_WRITE
_DEFAULT :
TL_WRITE_CONCURRENT_INSERT);
#else
#else
$$= TL_WRITE_CONCURRENT_INSERT;
$$= TL_WRITE_CONCURRENT_INSERT;
#endif
#endif
...
@@ -6726,7 +6726,7 @@ insert_update_elem:
...
@@ -6726,7 +6726,7 @@ insert_update_elem:
};
};
opt_low_priority:
opt_low_priority:
/* empty */ { $$=
YYTHD->update_lock_default
; }
/* empty */ { $$=
TL_WRITE_DEFAULT
; }
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; };
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; };
/* Delete rows from a table */
/* Delete rows from a table */
...
@@ -6737,7 +6737,7 @@ delete:
...
@@ -6737,7 +6737,7 @@ delete:
LEX *lex= Lex;
LEX *lex= Lex;
lex->sql_command= SQLCOM_DELETE;
lex->sql_command= SQLCOM_DELETE;
mysql_init_select(lex);
mysql_init_select(lex);
lex->lock_option=
lex->thd->update_lock_default
;
lex->lock_option=
TL_WRITE_DEFAULT
;
lex->ignore= 0;
lex->ignore= 0;
lex->select_lex.init_order();
lex->select_lex.init_order();
}
}
...
@@ -7402,7 +7402,7 @@ opt_local:
...
@@ -7402,7 +7402,7 @@ opt_local:
| LOCAL_SYM { $$=1;};
| LOCAL_SYM { $$=1;};
load_data_lock:
load_data_lock:
/* empty */ { $$=
YYTHD->update_lock_default
; }
/* empty */ { $$=
TL_WRITE_DEFAULT
; }
| CONCURRENT
| CONCURRENT
{
{
#ifdef HAVE_QUERY_CACHE
#ifdef HAVE_QUERY_CACHE
...
@@ -7410,7 +7410,7 @@ load_data_lock:
...
@@ -7410,7 +7410,7 @@ load_data_lock:
Ignore this option in SP to avoid problem with query cache
Ignore this option in SP to avoid problem with query cache
*/
*/
if (Lex->sphead != 0)
if (Lex->sphead != 0)
$$=
YYTHD->update_lock_default
;
$$=
TL_WRITE_DEFAULT
;
else
else
#endif
#endif
$$= TL_WRITE_CONCURRENT_INSERT;
$$= TL_WRITE_CONCURRENT_INSERT;
...
@@ -8723,7 +8723,7 @@ table_lock:
...
@@ -8723,7 +8723,7 @@ table_lock:
lock_option:
lock_option:
READ_SYM { $$=TL_READ_NO_INSERT; }
READ_SYM { $$=TL_READ_NO_INSERT; }
| WRITE_SYM { $$=
YYTHD->update_lock_default
; }
| WRITE_SYM { $$=
TL_WRITE_DEFAULT
; }
| LOW_PRIORITY WRITE_SYM { $$=TL_WRITE_LOW_PRIORITY; }
| LOW_PRIORITY WRITE_SYM { $$=TL_WRITE_LOW_PRIORITY; }
| READ_SYM LOCAL_SYM { $$= TL_READ; }
| READ_SYM LOCAL_SYM { $$= TL_READ; }
;
;
...
...
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