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
151065d4
Commit
151065d4
authored
Jul 21, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1-push
parents
6034874c
88a9b4b2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
123 additions
and
76 deletions
+123
-76
include/thr_lock.h
include/thr_lock.h
+1
-1
mysys/thr_lock.c
mysys/thr_lock.c
+5
-2
sql/handler.cc
sql/handler.cc
+2
-0
sql/lock.cc
sql/lock.cc
+17
-6
sql/mysql_priv.h
sql/mysql_priv.h
+6
-2
sql/sql_base.cc
sql/sql_base.cc
+80
-42
sql/sql_table.cc
sql/sql_table.cc
+12
-23
No files found.
include/thr_lock.h
View file @
151065d4
...
@@ -111,7 +111,7 @@ void thr_unlock(THR_LOCK_DATA *data);
...
@@ -111,7 +111,7 @@ void thr_unlock(THR_LOCK_DATA *data);
int
thr_multi_lock
(
THR_LOCK_DATA
**
data
,
uint
count
);
int
thr_multi_lock
(
THR_LOCK_DATA
**
data
,
uint
count
);
void
thr_multi_unlock
(
THR_LOCK_DATA
**
data
,
uint
count
);
void
thr_multi_unlock
(
THR_LOCK_DATA
**
data
,
uint
count
);
void
thr_abort_locks
(
THR_LOCK
*
lock
);
void
thr_abort_locks
(
THR_LOCK
*
lock
);
void
thr_abort_locks_for_thread
(
THR_LOCK
*
lock
,
pthread_t
thread
);
bool
thr_abort_locks_for_thread
(
THR_LOCK
*
lock
,
pthread_t
thread
);
void
thr_print_locks
(
void
);
/* For debugging */
void
thr_print_locks
(
void
);
/* For debugging */
my_bool
thr_upgrade_write_delay_lock
(
THR_LOCK_DATA
*
data
);
my_bool
thr_upgrade_write_delay_lock
(
THR_LOCK_DATA
*
data
);
my_bool
thr_reschedule_write_lock
(
THR_LOCK_DATA
*
data
);
my_bool
thr_reschedule_write_lock
(
THR_LOCK_DATA
*
data
);
...
...
mysys/thr_lock.c
View file @
151065d4
...
@@ -966,9 +966,10 @@ void thr_abort_locks(THR_LOCK *lock)
...
@@ -966,9 +966,10 @@ void thr_abort_locks(THR_LOCK *lock)
This is used to abort all locks for a specific thread
This is used to abort all locks for a specific thread
*/
*/
void
thr_abort_locks_for_thread
(
THR_LOCK
*
lock
,
pthread_t
thread
)
bool
thr_abort_locks_for_thread
(
THR_LOCK
*
lock
,
pthread_t
thread
)
{
{
THR_LOCK_DATA
*
data
;
THR_LOCK_DATA
*
data
;
bool
found
=
FALSE
;
DBUG_ENTER
(
"thr_abort_locks_for_thread"
);
DBUG_ENTER
(
"thr_abort_locks_for_thread"
);
pthread_mutex_lock
(
&
lock
->
mutex
);
pthread_mutex_lock
(
&
lock
->
mutex
);
...
@@ -978,6 +979,7 @@ void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
...
@@ -978,6 +979,7 @@ void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
{
{
DBUG_PRINT
(
"info"
,(
"Aborting read-wait lock"
));
DBUG_PRINT
(
"info"
,(
"Aborting read-wait lock"
));
data
->
type
=
TL_UNLOCK
;
/* Mark killed */
data
->
type
=
TL_UNLOCK
;
/* Mark killed */
found
=
TRUE
;
pthread_cond_signal
(
data
->
cond
);
pthread_cond_signal
(
data
->
cond
);
data
->
cond
=
0
;
/* Removed from list */
data
->
cond
=
0
;
/* Removed from list */
...
@@ -993,6 +995,7 @@ void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
...
@@ -993,6 +995,7 @@ void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
{
{
DBUG_PRINT
(
"info"
,(
"Aborting write-wait lock"
));
DBUG_PRINT
(
"info"
,(
"Aborting write-wait lock"
));
data
->
type
=
TL_UNLOCK
;
data
->
type
=
TL_UNLOCK
;
found
=
TRUE
;
pthread_cond_signal
(
data
->
cond
);
pthread_cond_signal
(
data
->
cond
);
data
->
cond
=
0
;
data
->
cond
=
0
;
...
@@ -1003,7 +1006,7 @@ void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
...
@@ -1003,7 +1006,7 @@ void thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
}
}
}
}
pthread_mutex_unlock
(
&
lock
->
mutex
);
pthread_mutex_unlock
(
&
lock
->
mutex
);
DBUG_
VOID_RETURN
;
DBUG_
RETURN
(
found
)
;
}
}
...
...
sql/handler.cc
View file @
151065d4
...
@@ -1514,6 +1514,8 @@ int ha_discover(THD *thd, const char *db, const char *name,
...
@@ -1514,6 +1514,8 @@ int ha_discover(THD *thd, const char *db, const char *name,
int
error
=
-
1
;
// Table does not exist in any handler
int
error
=
-
1
;
// Table does not exist in any handler
DBUG_ENTER
(
"ha_discover"
);
DBUG_ENTER
(
"ha_discover"
);
DBUG_PRINT
(
"enter"
,
(
"db: %s, name: %s"
,
db
,
name
));
DBUG_PRINT
(
"enter"
,
(
"db: %s, name: %s"
,
db
,
name
));
if
(
is_prefix
(
name
,
tmp_file_prefix
))
/* skip temporary tables */
DBUG_RETURN
(
error
);
#ifdef HAVE_NDBCLUSTER_DB
#ifdef HAVE_NDBCLUSTER_DB
if
(
have_ndbcluster
==
SHOW_OPTION_YES
)
if
(
have_ndbcluster
==
SHOW_OPTION_YES
)
error
=
ndbcluster_discover
(
thd
,
db
,
name
,
frmblob
,
frmlen
);
error
=
ndbcluster_discover
(
thd
,
db
,
name
,
frmblob
,
frmlen
);
...
...
sql/lock.cc
View file @
151065d4
...
@@ -337,20 +337,25 @@ void mysql_lock_abort(THD *thd, TABLE *table)
...
@@ -337,20 +337,25 @@ void mysql_lock_abort(THD *thd, TABLE *table)
/* Abort one thread / table combination */
/* Abort one thread / table combination */
void
mysql_lock_abort_for_thread
(
THD
*
thd
,
TABLE
*
table
)
bool
mysql_lock_abort_for_thread
(
THD
*
thd
,
TABLE
*
table
)
{
{
MYSQL_LOCK
*
locked
;
MYSQL_LOCK
*
locked
;
TABLE
*
write_lock_used
;
TABLE
*
write_lock_used
;
bool
result
=
FALSE
;
DBUG_ENTER
(
"mysql_lock_abort_for_thread"
);
DBUG_ENTER
(
"mysql_lock_abort_for_thread"
);
if
((
locked
=
get_lock_data
(
thd
,
&
table
,
1
,
1
,
&
write_lock_used
)))
if
((
locked
=
get_lock_data
(
thd
,
&
table
,
1
,
1
,
&
write_lock_used
)))
{
{
for
(
uint
i
=
0
;
i
<
locked
->
lock_count
;
i
++
)
for
(
uint
i
=
0
;
i
<
locked
->
lock_count
;
i
++
)
thr_abort_locks_for_thread
(
locked
->
locks
[
i
]
->
lock
,
{
bool
found
;
found
=
thr_abort_locks_for_thread
(
locked
->
locks
[
i
]
->
lock
,
table
->
in_use
->
real_id
);
table
->
in_use
->
real_id
);
result
|=
found
;
}
my_free
((
gptr
)
locked
,
MYF
(
0
));
my_free
((
gptr
)
locked
,
MYF
(
0
));
}
}
DBUG_
VOID_RETURN
;
DBUG_
RETURN
(
result
)
;
}
}
...
@@ -578,8 +583,14 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
...
@@ -578,8 +583,14 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
my_free
((
gptr
)
table
,
MYF
(
0
));
my_free
((
gptr
)
table
,
MYF
(
0
));
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
if
(
remove_table_from_cache
(
thd
,
db
,
table_list
->
real_name
))
{
if
(
remove_table_from_cache
(
thd
,
db
,
table_list
->
real_name
,
RTFC_NO_FLAG
))
{
DBUG_RETURN
(
1
);
// Table is in use
DBUG_RETURN
(
1
);
// Table is in use
}
}
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
sql/mysql_priv.h
View file @
151065d4
...
@@ -763,8 +763,12 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
...
@@ -763,8 +763,12 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
const
char
*
table_name
);
const
char
*
table_name
);
void
remove_db_from_cache
(
const
char
*
db
);
void
remove_db_from_cache
(
const
char
*
db
);
void
flush_tables
();
void
flush_tables
();
#define RTFC_NO_FLAG 0x0000
#define RTFC_OWNED_BY_THD_FLAG 0x0001
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
#define RTFC_CHECK_KILLED_FLAG 0x0004
bool
remove_table_from_cache
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table
,
bool
remove_table_from_cache
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table
,
bool
return_if_owned_by_thd
=
0
);
uint
flags
);
bool
close_cached_tables
(
THD
*
thd
,
bool
wait_for_refresh
,
TABLE_LIST
*
tables
);
bool
close_cached_tables
(
THD
*
thd
,
bool
wait_for_refresh
,
TABLE_LIST
*
tables
);
void
copy_field_from_tmp_record
(
Field
*
field
,
int
offset
);
void
copy_field_from_tmp_record
(
Field
*
field
,
int
offset
);
int
fill_record
(
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
,
bool
ignore_errors
);
int
fill_record
(
List
<
Item
>
&
fields
,
List
<
Item
>
&
values
,
bool
ignore_errors
);
...
@@ -1000,7 +1004,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
...
@@ -1000,7 +1004,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
void
mysql_unlock_some_tables
(
THD
*
thd
,
TABLE
**
table
,
uint
count
);
void
mysql_unlock_some_tables
(
THD
*
thd
,
TABLE
**
table
,
uint
count
);
void
mysql_lock_remove
(
THD
*
thd
,
MYSQL_LOCK
*
locked
,
TABLE
*
table
);
void
mysql_lock_remove
(
THD
*
thd
,
MYSQL_LOCK
*
locked
,
TABLE
*
table
);
void
mysql_lock_abort
(
THD
*
thd
,
TABLE
*
table
);
void
mysql_lock_abort
(
THD
*
thd
,
TABLE
*
table
);
void
mysql_lock_abort_for_thread
(
THD
*
thd
,
TABLE
*
table
);
bool
mysql_lock_abort_for_thread
(
THD
*
thd
,
TABLE
*
table
);
MYSQL_LOCK
*
mysql_lock_merge
(
MYSQL_LOCK
*
a
,
MYSQL_LOCK
*
b
);
MYSQL_LOCK
*
mysql_lock_merge
(
MYSQL_LOCK
*
a
,
MYSQL_LOCK
*
b
);
bool
lock_global_read_lock
(
THD
*
thd
);
bool
lock_global_read_lock
(
THD
*
thd
);
void
unlock_global_read_lock
(
THD
*
thd
);
void
unlock_global_read_lock
(
THD
*
thd
);
...
...
sql/sql_base.cc
View file @
151065d4
...
@@ -284,7 +284,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
...
@@ -284,7 +284,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
bool
found
=
0
;
bool
found
=
0
;
for
(
TABLE_LIST
*
table
=
tables
;
table
;
table
=
table
->
next
)
for
(
TABLE_LIST
*
table
=
tables
;
table
;
table
=
table
->
next
)
{
{
if
(
remove_table_from_cache
(
thd
,
table
->
db
,
table
->
real_name
,
1
))
if
(
remove_table_from_cache
(
thd
,
table
->
db
,
table
->
real_name
,
RTFC_OWNED_BY_THD_FLAG
))
found
=
1
;
found
=
1
;
}
}
if
(
!
found
)
if
(
!
found
)
...
@@ -2933,15 +2934,19 @@ void flush_tables()
...
@@ -2933,15 +2934,19 @@ void flush_tables()
*/
*/
bool
remove_table_from_cache
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
bool
remove_table_from_cache
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
bool
return_if_owned_by_thd
)
uint
flags
)
{
{
char
key
[
MAX_DBKEY_LENGTH
];
char
key
[
MAX_DBKEY_LENGTH
];
uint
key_length
;
uint
key_length
;
TABLE
*
table
;
TABLE
*
table
;
bool
result
=
0
;
bool
result
=
0
,
signalled
=
0
;
DBUG_ENTER
(
"remove_table_from_cache"
);
DBUG_ENTER
(
"remove_table_from_cache"
);
key_length
=
(
uint
)
(
strmov
(
strmov
(
key
,
db
)
+
1
,
table_name
)
-
key
)
+
1
;
key_length
=
(
uint
)
(
strmov
(
strmov
(
key
,
db
)
+
1
,
table_name
)
-
key
)
+
1
;
for
(;;)
{
result
=
signalled
=
0
;
for
(
table
=
(
TABLE
*
)
hash_search
(
&
open_cache
,(
byte
*
)
key
,
key_length
)
;
for
(
table
=
(
TABLE
*
)
hash_search
(
&
open_cache
,(
byte
*
)
key
,
key_length
)
;
table
;
table
;
table
=
(
TABLE
*
)
hash_next
(
&
open_cache
,(
byte
*
)
key
,
key_length
))
table
=
(
TABLE
*
)
hash_next
(
&
open_cache
,(
byte
*
)
key
,
key_length
))
...
@@ -2967,6 +2972,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
...
@@ -2967,6 +2972,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
if
(
in_use
->
mysys_var
->
current_cond
)
if
(
in_use
->
mysys_var
->
current_cond
)
{
{
pthread_mutex_lock
(
in_use
->
mysys_var
->
current_mutex
);
pthread_mutex_lock
(
in_use
->
mysys_var
->
current_mutex
);
signalled
=
1
;
pthread_cond_broadcast
(
in_use
->
mysys_var
->
current_cond
);
pthread_cond_broadcast
(
in_use
->
mysys_var
->
current_cond
);
pthread_mutex_unlock
(
in_use
->
mysys_var
->
current_mutex
);
pthread_mutex_unlock
(
in_use
->
mysys_var
->
current_mutex
);
}
}
...
@@ -2981,14 +2987,46 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
...
@@ -2981,14 +2987,46 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
thd_table
=
thd_table
->
next
)
thd_table
=
thd_table
->
next
)
{
{
if
(
thd_table
->
db_stat
)
// If table is open
if
(
thd_table
->
db_stat
)
// If table is open
mysql_lock_abort_for_thread
(
thd
,
thd_table
);
signalled
|=
mysql_lock_abort_for_thread
(
thd
,
thd_table
);
}
}
}
}
else
else
result
=
result
||
return_if_owned_by_thd
;
result
=
result
||
(
flags
&
RTFC_OWNED_BY_THD_FLAG
)
;
}
}
while
(
unused_tables
&&
!
unused_tables
->
version
)
while
(
unused_tables
&&
!
unused_tables
->
version
)
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
VOID
(
hash_delete
(
&
open_cache
,(
byte
*
)
unused_tables
));
if
(
result
&&
(
flags
&
RTFC_WAIT_OTHER_THREAD_FLAG
))
{
if
(
!
(
flags
&
RTFC_CHECK_KILLED_FLAG
)
||
!
thd
->
killed
)
{
if
(
likely
(
signalled
))
{
dropping_tables
++
;
(
void
)
pthread_cond_wait
(
&
COND_refresh
,
&
LOCK_open
);
dropping_tables
--
;
continue
;
}
else
{
/*
It can happen that another thread has opened the
table but has not yet locked any table at all. Since
it can be locked waiting for a table that our thread
has done LOCK TABLE x WRITE on previously, we need to
ensure that the thread actually hears our signal
before we go to sleep. Thus we wait for a short time
and then we retry another loop in the
remove_table_from_cache routine.
*/
pthread_mutex_unlock
(
&
LOCK_open
);
my_sleep
(
10
);
pthread_mutex_lock
(
&
LOCK_open
);
continue
;
}
}
}
break
;
}
DBUG_RETURN
(
result
);
DBUG_RETURN
(
result
);
}
}
...
...
sql/sql_table.cc
View file @
151065d4
...
@@ -220,6 +220,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -220,6 +220,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
;
char
*
db
=
table
->
db
;
uint
flags
;
mysql_ha_flush
(
thd
,
table
,
MYSQL_HA_CLOSE_FINAL
);
mysql_ha_flush
(
thd
,
table
,
MYSQL_HA_CLOSE_FINAL
);
if
(
!
close_temporary_table
(
thd
,
db
,
table
->
real_name
))
if
(
!
close_temporary_table
(
thd
,
db
,
table
->
real_name
))
{
{
...
@@ -231,12 +232,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -231,12 +232,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if
(
!
drop_temporary
)
if
(
!
drop_temporary
)
{
{
abort_locked_tables
(
thd
,
db
,
table
->
real_name
);
abort_locked_tables
(
thd
,
db
,
table
->
real_name
);
while
(
remove_table_from_cache
(
thd
,
db
,
table
->
real_name
)
&&
!
thd
->
killed
)
flags
=
RTFC_WAIT_OTHER_THREAD_FLAG
|
RTFC_CHECK_KILLED_FLAG
;
{
remove_table_from_cache
(
thd
,
db
,
table
->
real_name
,
flags
);
dropping_tables
++
;
(
void
)
pthread_cond_wait
(
&
COND_refresh
,
&
LOCK_open
);
dropping_tables
--
;
}
drop_locked_tables
(
thd
,
db
,
table
->
real_name
);
drop_locked_tables
(
thd
,
db
,
table
->
real_name
);
if
(
thd
->
killed
)
if
(
thd
->
killed
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
...
@@ -1661,13 +1658,8 @@ static void wait_while_table_is_used(THD *thd,TABLE *table,
...
@@ -1661,13 +1658,8 @@ static void wait_while_table_is_used(THD *thd,TABLE *table,
mysql_lock_abort
(
thd
,
table
);
// end threads waiting on lock
mysql_lock_abort
(
thd
,
table
);
// end threads waiting on lock
/* Wait until all there are no other threads that has this table open */
/* Wait until all there are no other threads that has this table open */
while
(
remove_table_from_cache
(
thd
,
table
->
table_cache_key
,
remove_table_from_cache
(
thd
,
table
->
table_cache_key
,
table
->
real_name
))
table
->
real_name
,
RTFC_WAIT_OTHER_THREAD_FLAG
);
{
dropping_tables
++
;
(
void
)
pthread_cond_wait
(
&
COND_refresh
,
&
LOCK_open
);
dropping_tables
--
;
}
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1989,18 +1981,14 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
...
@@ -1989,18 +1981,14 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
/* Close all instances of the table to allow repair to rename files */
/* Close all instances of the table to allow repair to rename files */
if
(
lock_type
==
TL_WRITE
&&
table
->
table
->
version
)
if
(
lock_type
==
TL_WRITE
&&
table
->
table
->
version
)
{
{
uint
flags
;
pthread_mutex_lock
(
&
LOCK_open
);
pthread_mutex_lock
(
&
LOCK_open
);
const
char
*
old_message
=
thd
->
enter_cond
(
&
COND_refresh
,
&
LOCK_open
,
const
char
*
old_message
=
thd
->
enter_cond
(
&
COND_refresh
,
&
LOCK_open
,
"Waiting to get writelock"
);
"Waiting to get writelock"
);
mysql_lock_abort
(
thd
,
table
->
table
);
mysql_lock_abort
(
thd
,
table
->
table
);
while
(
remove_table_from_cache
(
thd
,
table
->
table
->
table_cache_key
,
flags
=
RTFC_WAIT_OTHER_THREAD_FLAG
|
RTFC_CHECK_KILLED_FLAG
;
table
->
table
->
real_name
)
&&
remove_table_from_cache
(
thd
,
table
->
table
->
table_cache_key
,
!
thd
->
killed
)
table
->
table
->
real_name
,
flags
);
{
dropping_tables
++
;
(
void
)
pthread_cond_wait
(
&
COND_refresh
,
&
LOCK_open
);
dropping_tables
--
;
}
thd
->
exit_cond
(
old_message
);
thd
->
exit_cond
(
old_message
);
if
(
thd
->
killed
)
if
(
thd
->
killed
)
goto
err
;
goto
err
;
...
@@ -2123,7 +2111,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
...
@@ -2123,7 +2111,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
{
{
pthread_mutex_lock
(
&
LOCK_open
);
pthread_mutex_lock
(
&
LOCK_open
);
remove_table_from_cache
(
thd
,
table
->
table
->
table_cache_key
,
remove_table_from_cache
(
thd
,
table
->
table
->
table_cache_key
,
table
->
table
->
real_name
);
table
->
table
->
real_name
,
RTFC_NO_FLAG
);
pthread_mutex_unlock
(
&
LOCK_open
);
pthread_mutex_unlock
(
&
LOCK_open
);
/* May be something modified consequently we have to invalidate cache */
/* May be something modified consequently we have to invalidate cache */
query_cache_invalidate3
(
thd
,
table
->
table
,
0
);
query_cache_invalidate3
(
thd
,
table
->
table
,
0
);
...
@@ -3418,7 +3406,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -3418,7 +3406,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if
(
table
)
if
(
table
)
{
{
VOID
(
table
->
file
->
extra
(
HA_EXTRA_FORCE_REOPEN
));
// Use new file
VOID
(
table
->
file
->
extra
(
HA_EXTRA_FORCE_REOPEN
));
// Use new file
remove_table_from_cache
(
thd
,
db
,
table_name
);
// Mark all in-use copies old
remove_table_from_cache
(
thd
,
db
,
table_name
,
RTFC_NO_FLAG
);
// Mark in-use copies old
mysql_lock_abort
(
thd
,
table
);
// end threads waiting on lock
mysql_lock_abort
(
thd
,
table
);
// end threads waiting on lock
}
}
VOID
(
quick_rm_table
(
old_db_type
,
db
,
old_name
));
VOID
(
quick_rm_table
(
old_db_type
,
db
,
old_name
));
...
...
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