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
c9d4d6aa
Commit
c9d4d6aa
authored
Mar 21, 2006
by
gluh@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
5.0 -> 5.1 merge
parents
bdc3f485
f78ae59f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
245 additions
and
54 deletions
+245
-54
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+7
-0
mysql-test/r/information_schema_db.result
mysql-test/r/information_schema_db.result
+14
-0
mysql-test/r/query_cache_notembedded.result
mysql-test/r/query_cache_notembedded.result
+30
-0
mysql-test/t/information_schema.test
mysql-test/t/information_schema.test
+5
-0
mysql-test/t/information_schema_db.test
mysql-test/t/information_schema_db.test
+31
-0
mysql-test/t/query_cache_notembedded.test
mysql-test/t/query_cache_notembedded.test
+40
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+27
-20
sql/sql_acl.cc
sql/sql_acl.cc
+7
-0
sql/sql_insert.cc
sql/sql_insert.cc
+31
-22
sql/sql_parse.cc
sql/sql_parse.cc
+13
-0
sql/sql_show.cc
sql/sql_show.cc
+3
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+23
-2
vio/viosocket.c
vio/viosocket.c
+14
-8
No files found.
mysql-test/r/information_schema.result
View file @
c9d4d6aa
...
...
@@ -294,6 +294,13 @@ sub1 sub1
select count(*) from information_schema.ROUTINES;
count(*)
2
create view v1 as select routine_schema, routine_name from information_schema.routines
order by routine_schema, routine_name;
select * from v1;
routine_schema routine_name
test sel2
test sub1
drop view v1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
ROUTINE_NAME ROUTINE_DEFINITION
show create function sub1;
...
...
mysql-test/r/information_schema_db.result
View file @
c9d4d6aa
...
...
@@ -33,4 +33,18 @@ create database `inf%`;
use `inf%`;
show tables;
Tables_in_inf%
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
create table t1 (f1 int);
create function func1(curr_int int) returns int
begin
declare ret_val int;
select max(f1) from t1 into ret_val;
return ret_val;
end|
create view v1 as select f1 from t1 where f1 = func1(f1);
select * from information_schema.tables;
drop user mysqltest_1@localhost;
drop view v1;
drop function func1;
drop table t1;
drop database `inf%`;
mysql-test/r/query_cache_notembedded.result
View file @
c9d4d6aa
...
...
@@ -314,4 +314,34 @@ drop procedure f2;
drop procedure f3;
drop procedure f4;
drop table t1;
reset query cache;
drop function if exists f1;
create table t1 (id int);
create function f1 ()
returns int
begin
declare i_var int;
set i_var = sleep(3);
insert into t1 values(3);
set i_var = sleep(3);
return 0;
end;|
select f1();
select sleep(4);
sleep(4)
0
select * from t1;
id
3
f1()
0
select * from t1;
id
3
reset query cache;
select * from t1;
id
3
drop table t1;
drop function f1;
set GLOBAL query_cache_size=0;
mysql-test/t/information_schema.test
View file @
c9d4d6aa
...
...
@@ -146,6 +146,11 @@ select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
mysql
.
proc
b
where
a
.
ROUTINE_NAME
=
convert
(
b
.
name
using
utf8
)
order
by
1
;
select
count
(
*
)
from
information_schema
.
ROUTINES
;
create
view
v1
as
select
routine_schema
,
routine_name
from
information_schema
.
routines
order
by
routine_schema
,
routine_name
;
select
*
from
v1
;
drop
view
v1
;
connect
(
user1
,
localhost
,
mysqltest_1
,,);
connection
user1
;
select
ROUTINE_NAME
,
ROUTINE_DEFINITION
from
information_schema
.
ROUTINES
;
...
...
mysql-test/t/information_schema_db.test
View file @
c9d4d6aa
...
...
@@ -8,4 +8,35 @@ show tables from INFORMATION_SCHEMA like 'T%';
create
database
`inf%`
;
use
`inf%`
;
show
tables
;
#
# Bug#18113 SELECT * FROM information_schema.xxx crashes server
# Crash happened when one selected data from one of INFORMATION_SCHEMA
# tables and in order to build its contents server had to open view which
# used stored function and table or view on which one had not global or
# database-level privileges (e.g. had only table-level or had no
# privileges at all).
#
grant
all
privileges
on
`inf%`
.*
to
'mysqltest_1'
@
'localhost'
;
create
table
t1
(
f1
int
);
delimiter
|
;
create
function
func1
(
curr_int
int
)
returns
int
begin
declare
ret_val
int
;
select
max
(
f1
)
from
t1
into
ret_val
;
return
ret_val
;
end
|
delimiter
;
|
create
view
v1
as
select
f1
from
t1
where
f1
=
func1
(
f1
);
connect
(
user1
,
localhost
,
mysqltest_1
,,);
connection
user1
;
--
disable_result_log
select
*
from
information_schema
.
tables
;
--
enable_result_log
connection
default
;
drop
user
mysqltest_1
@
localhost
;
drop
view
v1
;
drop
function
func1
;
drop
table
t1
;
drop
database
`inf%`
;
mysql-test/t/query_cache_notembedded.test
View file @
c9d4d6aa
...
...
@@ -180,5 +180,45 @@ drop procedure f3;
drop
procedure
f4
;
drop
table
t1
;
#
# bug#14767: INSERT in SF + concurrent SELECT with query cache
#
reset
query
cache
;
--
disable_warnings
drop
function
if
exists
f1
;
--
enable_warnings
create
table
t1
(
id
int
);
delimiter
|
;
create
function
f1
()
returns
int
begin
declare
i_var
int
;
set
i_var
=
sleep
(
3
);
insert
into
t1
values
(
3
);
set
i_var
=
sleep
(
3
);
return
0
;
end
;
|
delimiter
;
|
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connection
con1
;
send
select
f1
();
connection
con2
;
select
sleep
(
4
);
select
*
from
t1
;
connection
con1
;
reap
;
connection
con2
;
# This gives wrong result i.e. 't' table seems to be empty
select
*
from
t1
;
reset
query
cache
;
select
*
from
t1
;
drop
table
t1
;
drop
function
f1
;
disconnect
con1
;
disconnect
con2
;
connection
default
;
set
GLOBAL
query_cache_size
=
0
;
sql/ha_innodb.cc
View file @
c9d4d6aa
...
...
@@ -534,16 +534,23 @@ convert_error_code_to_mysql(
}
else
if
(
error
==
(
int
)
DB_CORRUPTION
)
{
return
(
HA_ERR_CRASHED
);
}
else
if
(
error
==
(
int
)
DB_NO_SAVEPOINT
)
{
return
(
HA_ERR_CRASHED
);
}
else
if
(
error
==
(
int
)
DB_NO_SAVEPOINT
)
{
return
(
HA_ERR_NO_SAVEPOINT
);
}
else
if
(
error
==
(
int
)
DB_LOCK_TABLE_FULL
)
{
return
(
HA_ERR_NO_SAVEPOINT
);
}
else
if
(
error
==
(
int
)
DB_LOCK_TABLE_FULL
)
{
/* Since we rolled back the whole transaction, we must
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
return
(
HA_ERR_LOCK_TABLE_FULL
);
}
else
{
return
(
-
1
);
// Unknown error
}
if
(
thd
)
{
ha_rollback
(
thd
);
}
return
(
HA_ERR_LOCK_TABLE_FULL
);
}
else
{
return
(
-
1
);
// Unknown error
}
}
/*****************************************************************
...
...
@@ -6950,25 +6957,25 @@ ha_innobase::store_lock(
}
/* If we are not doing a LOCK TABLE, DISCARD/IMPORT
TABLESPACE or TRUNCATE TABLE then allow multiple
TABLESPACE or TRUNCATE TABLE then allow multiple
writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
< TL_WRITE_CONCURRENT_INSERT.
We especially allow multiple writers if MySQL is at the
start of a stored procedure call (SQLCOM_CALL)
We especially allow multiple writers if MySQL is at the
start of a stored procedure call (SQLCOM_CALL)
(MySQL does have thd->in_lock_tables TRUE there). */
if
((
lock_type
>=
TL_WRITE_CONCURRENT_INSERT
&&
lock_type
<=
TL_WRITE
)
&&
(
!
thd
->
in_lock_tables
||
thd
->
lex
->
sql_command
==
SQLCOM_CALL
)
&&
!
thd
->
tablespace_op
&&
thd
->
lex
->
sql_command
!=
SQLCOM_TRUNCATE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_OPTIMIZE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_CREATE_TABLE
)
{
if
((
lock_type
>=
TL_WRITE_CONCURRENT_INSERT
&&
lock_type
<=
TL_WRITE
)
&&
!
(
thd
->
in_lock_tables
&&
thd
->
lex
->
sql_command
==
SQLCOM_LOCK_TABLES
)
&&
!
thd
->
tablespace_op
&&
thd
->
lex
->
sql_command
!=
SQLCOM_TRUNCATE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_OPTIMIZE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_CREATE_TABLE
)
{
lock_type
=
TL_WRITE_ALLOW_WRITE
;
}
}
/* In queries of type INSERT INTO t1 SELECT ... FROM t2 ...
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
...
...
sql/sql_acl.cc
View file @
c9d4d6aa
...
...
@@ -3668,6 +3668,13 @@ my_bool grant_reload(THD *thd)
RETURN
0 ok
1 Error: User did not have the requested privileges
NOTE
This functions assumes that either number of tables to be inspected
by it is limited explicitly (i.e. is is not UINT_MAX) or table list
used and thd->lex->query_tables_own_last value correspond to each
other (the latter should be either 0 or point to next_global member
of one of elements of this table list).
****************************************************************************/
bool
check_grant
(
THD
*
thd
,
ulong
want_access
,
TABLE_LIST
*
tables
,
...
...
sql/sql_insert.cc
View file @
c9d4d6aa
...
...
@@ -272,6 +272,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
bool
log_on
=
(
thd
->
options
&
OPTION_BIN_LOG
)
||
(
!
(
thd
->
security_ctx
->
master_access
&
SUPER_ACL
));
bool
transactional_table
,
joins_freed
=
FALSE
;
bool
changed
;
uint
value_count
;
ulong
counter
=
1
;
ulonglong
id
;
...
...
@@ -558,35 +559,33 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
else
if
(
table
->
next_number_field
&&
info
.
copied
)
id
=
table
->
next_number_field
->
val_int
();
// Return auto_increment value
/*
Invalidate the table in the query cache if something changed.
For the transactional algorithm to work the invalidation must be
before binlog writing and ha_autocommit_or_rollback
*/
if
(
info
.
copied
||
info
.
deleted
||
info
.
updated
)
{
query_cache_invalidate3
(
thd
,
table_list
,
1
);
}
transactional_table
=
table
->
file
->
has_transactions
();
if
((
info
.
copied
||
info
.
deleted
||
info
.
updated
)
&&
(
error
<=
0
||
!
transactional_table
))
if
((
changed
=
(
info
.
copied
||
info
.
deleted
||
info
.
updated
)))
{
if
(
mysql_bin_log
.
is_open
())
/*
Invalidate the table in the query cache if something changed.
For the transactional algorithm to work the invalidation must be
before binlog writing and ha_autocommit_or_rollback
*/
query_cache_invalidate3
(
thd
,
table_list
,
1
);
if
(
error
<=
0
||
!
transactional_table
)
{
if
(
error
<=
0
)
thd
->
clear_error
();
if
(
thd
->
binlog_query
(
THD
::
ROW_QUERY_TYPE
,
thd
->
query
,
thd
->
query_length
,
transactional_table
,
FALSE
)
&&
transactional_table
)
if
(
mysql_bin_log
.
is_open
())
{
error
=
1
;
if
(
error
<=
0
)
thd
->
clear_error
();
if
(
thd
->
binlog_query
(
THD
::
ROW_QUERY_TYPE
,
thd
->
query
,
thd
->
query_length
,
transactional_table
,
FALSE
)
&&
transactional_table
)
{
error
=
1
;
}
}
if
(
!
transactional_table
)
thd
->
options
|=
OPTION_STATUS_NO_TRANS_UPDATE
;
}
if
(
!
transactional_table
)
thd
->
options
|=
OPTION_STATUS_NO_TRANS_UPDATE
;
}
if
(
transactional_table
)
error
=
ha_autocommit_or_rollback
(
thd
,
error
);
...
...
@@ -594,6 +593,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if
(
thd
->
lock
)
{
mysql_unlock_tables
(
thd
,
thd
->
lock
);
/*
Invalidate the table in the query cache if something changed
after unlocking when changes become fisible.
TODO: this is workaround. right way will be move invalidating in
the unlock procedure.
*/
if
(
lock_type
==
TL_WRITE_CONCURRENT_INSERT
&&
changed
)
{
query_cache_invalidate3
(
thd
,
table_list
,
1
);
}
thd
->
lock
=
0
;
}
}
...
...
sql/sql_parse.cc
View file @
c9d4d6aa
...
...
@@ -3351,6 +3351,19 @@ mysql_execute_command(THD *thd)
select_lex
->
context
.
table_list
=
select_lex
->
context
.
first_name_resolution_table
=
second_table
;
res
=
handle_select
(
thd
,
lex
,
result
,
OPTION_SETUP_TABLES_DONE
);
/*
Invalidate the table in the query cache if something changed
after unlocking when changes become visible.
TODO: this is workaround. right way will be move invalidating in
the unlock procedure.
*/
if
(
first_table
->
lock_type
==
TL_WRITE_CONCURRENT_INSERT
&&
thd
->
lock
)
{
mysql_unlock_tables
(
thd
,
thd
->
lock
);
query_cache_invalidate3
(
thd
,
first_table
,
1
);
thd
->
lock
=
0
;
}
delete
result
;
}
/* revert changes for SP */
...
...
sql/sql_show.cc
View file @
c9d4d6aa
...
...
@@ -476,7 +476,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
table_list
.
table_name
=
file
->
name
;
table_list
.
table_name_length
=
strlen
(
file
->
name
);
table_list
.
grant
.
privilege
=
col_access
;
if
(
check_grant
(
thd
,
TABLE_ACLS
,
&
table_list
,
1
,
UINT_MAX
,
1
))
if
(
check_grant
(
thd
,
TABLE_ACLS
,
&
table_list
,
1
,
1
,
1
))
continue
;
}
#endif
...
...
@@ -4664,7 +4664,8 @@ bool get_schema_tables_result(JOIN *join)
TABLE_LIST
*
table_list
=
tab
->
table
->
pos_in_table_list
;
if
(
table_list
->
schema_table
&&
thd
->
fill_derived_tables
())
{
bool
is_subselect
=
(
&
lex
->
unit
!=
lex
->
current_select
->
master_unit
());
bool
is_subselect
=
(
&
lex
->
unit
!=
lex
->
current_select
->
master_unit
()
&&
lex
->
current_select
->
master_unit
()
->
item
);
/*
The schema table is already processed and
the statement is not a subselect.
...
...
sql/sql_yacc.yy
View file @
c9d4d6aa
...
...
@@ -7821,7 +7821,19 @@ replace:
;
insert_lock_option:
/* empty */ { $$= TL_WRITE_CONCURRENT_INSERT; }
/* empty */
{
#ifdef HAVE_QUERY_CACHE
/*
If it is SP we do not allow insert optimisation whan result of
insert visible only after the table unlocking but everyone can
read table.
*/
$$= (Lex->sphead ? TL_WRITE :TL_WRITE_CONCURRENT_INSERT);
#else
$$= TL_WRITE_CONCURRENT_INSERT;
#endif
}
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
| DELAYED_SYM { $$= TL_WRITE_DELAYED; }
| HIGH_PRIORITY { $$= TL_WRITE; }
...
...
@@ -8740,7 +8752,16 @@ opt_local:
load_data_lock:
/* empty */ { $$= YYTHD->update_lock_default; }
| CONCURRENT { $$= TL_WRITE_CONCURRENT_INSERT ; }
| CONCURRENT
{
#ifdef HAVE_QUERY_CACHE
/*
Ignore this option in SP to avoid problem with query cache
*/
if (Lex->sphead != 0)
#endif
$$= TL_WRITE_CONCURRENT_INSERT;
}
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; };
...
...
vio/viosocket.c
View file @
c9d4d6aa
...
...
@@ -560,14 +560,20 @@ int vio_close_shared_memory(Vio * vio)
Close all handlers. UnmapViewOfFile and CloseHandle return non-zero
result if they are success.
*/
r
=
UnmapViewOfFile
(
vio
->
handle_map
)
||
CloseHandle
(
vio
->
event_server_wrote
)
||
CloseHandle
(
vio
->
event_server_read
)
||
CloseHandle
(
vio
->
event_client_wrote
)
||
CloseHandle
(
vio
->
event_client_read
)
||
CloseHandle
(
vio
->
handle_file_map
);
if
(
!
r
)
{
DBUG_PRINT
(
"vio_error"
,
(
"close() failed, error: %d"
,
r
));
/* FIXME: error handling (not critical for MySQL) */
}
if
(
UnmapViewOfFile
(
vio
->
handle_map
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"UnmapViewOfFile() failed"
));
if
(
CloseHandle
(
vio
->
event_server_wrote
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->esw) failed"
));
if
(
CloseHandle
(
vio
->
event_server_read
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->esr) failed"
));
if
(
CloseHandle
(
vio
->
event_client_wrote
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecw) failed"
));
if
(
CloseHandle
(
vio
->
event_client_read
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecr) failed"
));
if
(
CloseHandle
(
vio
->
handle_file_map
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->hfm) failed"
));
if
(
CloseHandle
(
vio
->
event_conn_closed
)
==
0
)
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecc) failed"
));
}
vio
->
type
=
VIO_CLOSED
;
vio
->
sd
=
-
1
;
...
...
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