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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d490b56e
Commit
d490b56e
authored
Jan 28, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed "DROP table_open_in_handler" hang
parent
35955563
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
21 deletions
+49
-21
mysql-test/r/handler.result
mysql-test/r/handler.result
+7
-1
mysql-test/t/handler.test
mysql-test/t/handler.test
+17
-4
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_handler.cc
sql/sql_handler.cc
+22
-15
sql/sql_table.cc
sql/sql_table.cc
+2
-1
No files found.
mysql-test/r/handler.result
View file @
d490b56e
...
@@ -136,4 +136,10 @@ a b
...
@@ -136,4 +136,10 @@ a b
handler t2 read last;
handler t2 read last;
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
handler t2 close;
drop table if exists t1;
handler t1 open as t2;
drop table t1;
create table t1 (a int);
insert into t1 values (17);
handler t2 read first;
Unknown table 't2' in HANDLER
drop table t1;
mysql-test/t/handler.test
View file @
d490b56e
...
@@ -28,13 +28,15 @@ handler t2 read a next;
...
@@ -28,13 +28,15 @@ handler t2 read a next;
handler
t2
read
a
=
(
15
);
handler
t2
read
a
=
(
15
);
handler
t2
read
a
=
(
16
);
handler
t2
read
a
=
(
16
);
!
$
1070
handler
t2
read
a
=
(
19
,
"fff"
);
--
error
1070
handler
t2
read
a
=
(
19
,
"fff"
);
handler
t2
read
b
=
(
19
,
"fff"
);
handler
t2
read
b
=
(
19
,
"fff"
);
handler
t2
read
b
=
(
19
,
"yyy"
);
handler
t2
read
b
=
(
19
,
"yyy"
);
handler
t2
read
b
=
(
19
);
handler
t2
read
b
=
(
19
);
!
$
1109
handler
t1
read
a
last
;
--
error
1109
handler
t1
read
a
last
;
handler
t2
read
a
=
(
11
);
handler
t2
read
a
=
(
11
);
handler
t2
read
a
>=
(
11
);
handler
t2
read
a
>=
(
11
);
...
@@ -60,8 +62,19 @@ handler t2 read first;
...
@@ -60,8 +62,19 @@ handler t2 read first;
handler
t2
read
next
;
handler
t2
read
next
;
alter
table
t1
type
=
MyISAM
;
alter
table
t1
type
=
MyISAM
;
handler
t2
read
next
;
handler
t2
read
next
;
!
$
1064
handler
t2
read
last
;
--
error
1064
handler
t2
read
last
;
handler
t2
close
;
handler
t2
close
;
drop
table
if
exists
t1
;
#
# DROP TABLE
#
handler
t1
open
as
t2
;
drop
table
t1
;
create
table
t1
(
a
int
);
insert
into
t1
values
(
17
);
--
error
1109
handler
t2
read
first
;
drop
table
t1
;
sql/mysql_priv.h
View file @
d490b56e
...
@@ -501,6 +501,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
...
@@ -501,6 +501,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
/* sql_handler.cc */
/* sql_handler.cc */
int
mysql_ha_open
(
THD
*
thd
,
TABLE_LIST
*
tables
);
int
mysql_ha_open
(
THD
*
thd
,
TABLE_LIST
*
tables
);
int
mysql_ha_close
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
dont_send_ok
=
0
);
int
mysql_ha_close
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
dont_send_ok
=
0
);
int
mysql_ha_closeall
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
dont_send_ok
=
0
);
int
mysql_ha_read
(
THD
*
,
TABLE_LIST
*
,
enum
enum_ha_read_modes
,
char
*
,
int
mysql_ha_read
(
THD
*
,
TABLE_LIST
*
,
enum
enum_ha_read_modes
,
char
*
,
List
<
Item
>
*
,
enum
ha_rkey_function
,
Item
*
,
ha_rows
,
ha_rows
);
List
<
Item
>
*
,
enum
ha_rkey_function
,
Item
*
,
ha_rows
,
ha_rows
);
...
...
sql/sql_handler.cc
View file @
d490b56e
...
@@ -43,8 +43,8 @@
...
@@ -43,8 +43,8 @@
thd->open_tables=thd->handler_tables; \
thd->open_tables=thd->handler_tables; \
thd->handler_tables=tmp; }
thd->handler_tables=tmp; }
static
TABLE
**
find_table_ptr_by_name
(
THD
*
thd
,
const
char
*
db
,
static
TABLE
**
find_table_ptr_by_name
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
const
char
*
table_name
,
bool
is_alias
);
int
mysql_ha_open
(
THD
*
thd
,
TABLE_LIST
*
tables
)
int
mysql_ha_open
(
THD
*
thd
,
TABLE_LIST
*
tables
)
{
{
...
@@ -68,7 +68,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
...
@@ -68,7 +68,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
int
mysql_ha_close
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
dont_send_ok
)
int
mysql_ha_close
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
dont_send_ok
)
{
{
TABLE
**
ptr
=
find_table_ptr_by_name
(
thd
,
tables
->
db
,
tables
->
alias
);
TABLE
**
ptr
=
find_table_ptr_by_name
(
thd
,
tables
->
db
,
tables
->
alias
,
1
);
if
(
*
ptr
)
if
(
*
ptr
)
{
{
...
@@ -87,6 +87,21 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
...
@@ -87,6 +87,21 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
return
0
;
return
0
;
}
}
int
mysql_ha_closeall
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
dont_send_ok
)
{
TABLE
**
ptr
=
find_table_ptr_by_name
(
thd
,
tables
->
db
,
tables
->
real_name
,
0
);
DBUG_ASSERT
(
dont_send_ok
);
if
(
*
ptr
)
{
// if (!dont_send_ok) VOID(pthread_mutex_lock(&LOCK_open));
close_thread_table
(
thd
,
ptr
);
// if (!dont_send_ok) VOID(pthread_mutex_unlock(&LOCK_open));
}
// if (!dont_send_ok) send_ok(&thd->net);
return
0
;
}
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
{
RNEXT
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
};
{
RNEXT
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
};
...
@@ -97,7 +112,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -97,7 +112,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
ha_rows
select_limit
,
ha_rows
offset_limit
)
ha_rows
select_limit
,
ha_rows
offset_limit
)
{
{
int
err
,
keyno
=-
1
;
int
err
,
keyno
=-
1
;
TABLE
*
table
=*
find_table_ptr_by_name
(
thd
,
tables
->
db
,
tables
->
alias
);
TABLE
*
table
=*
find_table_ptr_by_name
(
thd
,
tables
->
db
,
tables
->
alias
,
1
);
if
(
!
table
)
if
(
!
table
)
{
{
my_printf_error
(
ER_UNKNOWN_TABLE
,
ER
(
ER_UNKNOWN_TABLE
),
MYF
(
0
),
my_printf_error
(
ER_UNKNOWN_TABLE
,
ER
(
ER_UNKNOWN_TABLE
),
MYF
(
0
),
...
@@ -250,17 +265,8 @@ err0:
...
@@ -250,17 +265,8 @@ err0:
return
-
1
;
return
-
1
;
}
}
/**************************************************************************
2Monty: It could easily happen, that the following service functions are
already defined somewhere in the code, but I failed to find them.
If this is the case, just say a word and I'll use old functions here.
**************************************************************************/
/* Note: this function differs from find_locked_table() because we're looking
here for alias, not real table name
*/
static
TABLE
**
find_table_ptr_by_name
(
THD
*
thd
,
const
char
*
db
,
static
TABLE
**
find_table_ptr_by_name
(
THD
*
thd
,
const
char
*
db
,
const
char
*
alias
)
const
char
*
table_name
,
bool
is_
alias
)
{
{
int
dblen
;
int
dblen
;
TABLE
**
ptr
;
TABLE
**
ptr
;
...
@@ -273,9 +279,10 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
...
@@ -273,9 +279,10 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
for
(
TABLE
*
table
=*
ptr
;
table
;
table
=*
ptr
)
for
(
TABLE
*
table
=*
ptr
;
table
;
table
=*
ptr
)
{
{
if
(
!
memcmp
(
table
->
table_cache_key
,
db
,
dblen
)
&&
if
(
!
memcmp
(
table
->
table_cache_key
,
db
,
dblen
)
&&
!
my_strcasecmp
(
table
->
table_name
,
alias
))
!
my_strcasecmp
(
(
is_alias
?
table
->
table_name
:
table
->
real_name
),
table_name
))
break
;
break
;
ptr
=&
(
table
->
next
);
ptr
=&
(
table
->
next
);
}
}
return
ptr
;
return
ptr
;
}
}
sql/sql_table.cc
View file @
d490b56e
...
@@ -74,7 +74,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
...
@@ -74,7 +74,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
}
}
error
=
mysql_rm_table_part2
(
thd
,
tables
,
if_exists
,
0
);
error
=
mysql_rm_table_part2
(
thd
,
tables
,
if_exists
,
0
);
err:
err:
pthread_mutex_unlock
(
&
LOCK_open
);
pthread_mutex_unlock
(
&
LOCK_open
);
VOID
(
pthread_cond_broadcast
(
&
COND_refresh
));
// Signal to refresh
VOID
(
pthread_cond_broadcast
(
&
COND_refresh
));
// Signal to refresh
...
@@ -136,6 +136,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -136,6 +136,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for
(
table
=
tables
;
table
;
table
=
table
->
next
)
for
(
table
=
tables
;
table
;
table
=
table
->
next
)
{
{
char
*
db
=
table
->
db
?
table
->
db
:
thd
->
db
;
char
*
db
=
table
->
db
?
table
->
db
:
thd
->
db
;
mysql_ha_closeall
(
thd
,
table
,
1
);
if
(
!
close_temporary_table
(
thd
,
db
,
table
->
real_name
))
if
(
!
close_temporary_table
(
thd
,
db
,
table
->
real_name
))
{
{
tmp_table_deleted
=
1
;
tmp_table_deleted
=
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