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
5f6561ec
Commit
5f6561ec
authored
Jan 26, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table_locks_waited
Table_locks_immediate
parent
7c5db0d3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
2 deletions
+42
-2
mysql-test/r/status.result
mysql-test/r/status.result
+6
-0
mysql-test/t/status.test
mysql-test/t/status.test
+23
-0
mysys/thr_lock.c
mysys/thr_lock.c
+7
-1
sql/mysqld.cc
sql/mysqld.cc
+3
-0
sql/sql_base.cc
sql/sql_base.cc
+3
-1
No files found.
mysql-test/r/status.result
0 → 100644
View file @
5f6561ec
Variable_name Value
Table_locks_immediate 5
Table_locks_waited 0
Variable_name Value
Table_locks_immediate 8
Table_locks_waited 1
mysql-test/t/status.test
0 → 100644
View file @
5f6561ec
connect
(
con1
,
localhost
,
root
,,
test
,
0
,
mysql
-
master
.
sock
);
connect
(
con2
,
localhost
,
root
,,
test
,
0
,
mysql
-
master
.
sock
);
#don't polute binlog
show
status
like
'Table_lock%'
;
connection
con1
;
SET
SQL_LOG_BIN
=
0
;
drop
table
if
exists
t1
;
create
table
t1
(
n
int
);
insert
into
t1
values
(
1
);
connection
con2
;
lock
tables
t1
read
;
unlock
tables
;
lock
tables
t1
read
;
connection
con1
;
send
update
t1
set
n
=
3
;
connection
con2
;
sleep
0.5
;
unlock
tables
;
connection
con1
;
reap
;
show
status
like
'Table_lock%'
;
mysys/thr_lock.c
View file @
5f6561ec
...
...
@@ -83,7 +83,7 @@ multiple read locks.
#include <errno.h>
my_bool
thr_lock_inited
=
0
;
ulong
locks_immediate
=
0L
,
locks_waited
=
0L
;
/* The following constants are only for debug output */
#define MAX_THREADS 100
...
...
@@ -387,6 +387,7 @@ static my_bool wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
else
{
result
=
0
;
++
locks_waited
;
if
(
data
->
lock
->
get_status
)
(
*
data
->
lock
->
get_status
)(
data
->
status_param
);
check_locks
(
data
->
lock
,
"got wait_for_lock"
,
0
);
...
...
@@ -447,6 +448,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks
(
lock
,
"read lock with old write lock"
,
0
);
if
(
lock
->
get_status
)
(
*
lock
->
get_status
)(
data
->
status_param
);
++
locks_immediate
;
goto
end
;
}
if
(
lock
->
write
.
data
->
type
==
TL_WRITE_ONLY
)
...
...
@@ -470,6 +472,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if
((
int
)
lock_type
==
(
int
)
TL_READ_NO_INSERT
)
lock
->
read_no_write_count
++
;
check_locks
(
lock
,
"read lock with no write locks"
,
0
);
++
locks_immediate
;
goto
end
;
}
/* Can't get lock yet; Wait for it */
...
...
@@ -501,6 +504,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
data
->
cond
=
get_cond
();
if
(
lock
->
get_status
)
(
*
lock
->
get_status
)(
data
->
status_param
);
++
locks_immediate
;
goto
end
;
}
}
...
...
@@ -535,6 +539,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks
(
lock
,
"second write lock"
,
0
);
if
(
data
->
lock
->
get_status
)
(
*
data
->
lock
->
get_status
)(
data
->
status_param
);
++
locks_immediate
;
goto
end
;
}
DBUG_PRINT
(
"lock"
,(
"write locked by thread: %ld"
,
...
...
@@ -560,6 +565,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if
(
data
->
lock
->
get_status
)
(
*
data
->
lock
->
get_status
)(
data
->
status_param
);
check_locks
(
lock
,
"only write lock"
,
0
);
++
locks_immediate
;
goto
end
;
}
}
...
...
sql/mysqld.cc
View file @
5f6561ec
...
...
@@ -260,6 +260,7 @@ ulong query_id=1L,long_query_count,long_query_time,aborted_threads,
delayed_queue_size
,
delayed_insert_threads
,
delayed_insert_writes
,
delayed_rows_in_use
,
delayed_insert_errors
,
flush_time
,
thread_created
;
ulong
filesort_rows
,
filesort_range_count
,
filesort_scan_count
;
extern
"C"
ulong
locks_immediate
,
locks_waited
;
ulong
filesort_merge_passes
;
ulong
select_range_check_count
,
select_range_count
,
select_scan_count
;
ulong
select_full_range_join_count
,
select_full_join_count
;
...
...
@@ -2804,6 +2805,8 @@ struct show_var_st status_vars[]= {
{
"Sort_range"
,
(
char
*
)
&
filesort_range_count
,
SHOW_LONG
},
{
"Sort_rows"
,
(
char
*
)
&
filesort_rows
,
SHOW_LONG
},
{
"Sort_scan"
,
(
char
*
)
&
filesort_scan_count
,
SHOW_LONG
},
{
"Table_locks_immediate"
,
(
char
*
)
&
locks_immediate
,
SHOW_LONG
},
{
"Table_locks_waited"
,
(
char
*
)
&
locks_waited
,
SHOW_LONG
},
{
"Threads_cached"
,
(
char
*
)
&
cached_thread_count
,
SHOW_LONG_CONST
},
{
"Threads_created"
,
(
char
*
)
&
thread_created
,
SHOW_LONG_CONST
},
{
"Threads_connected"
,
(
char
*
)
&
thread_count
,
SHOW_INT_CONST
},
...
...
sql/sql_base.cc
View file @
5f6561ec
...
...
@@ -32,6 +32,7 @@
TABLE
*
unused_tables
;
/* Used by mysql_test */
HASH
open_cache
;
/* Used by mysql_test */
extern
"C"
ulong
locks_waited
,
locks_immediate
;
static
int
open_unireg_entry
(
THD
*
thd
,
TABLE
*
entry
,
const
char
*
db
,
const
char
*
name
,
const
char
*
alias
,
bool
locked
);
...
...
@@ -1166,7 +1167,8 @@ bool wait_for_tables(THD *thd)
{
/* Now we can open all tables without any interference */
thd
->
proc_info
=
"Reopen tables"
;
result
=
reopen_tables
(
thd
,
0
,
0
);
if
(
!
(
result
=
reopen_tables
(
thd
,
0
,
0
)))
++
locks_waited
;
}
pthread_mutex_unlock
(
&
LOCK_open
);
thd
->
proc_info
=
0
;
...
...
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