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
55e77757
Commit
55e77757
authored
May 13, 2004
by
lenz@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge lgrimmer@build.mysql.com:/home/bk/mysql-4.0
into mysql.com:/space/my/mysql-4.0
parents
b3bbac25
cafad010
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
sql/ha_innodb.cc
sql/ha_innodb.cc
+26
-4
No files found.
sql/ha_innodb.cc
View file @
55e77757
...
@@ -325,10 +325,18 @@ innobase_mysql_print_thd(
...
@@ -325,10 +325,18 @@ innobase_mysql_print_thd(
{
{
const
THD
*
thd
;
const
THD
*
thd
;
const
char
*
s
;
const
char
*
s
;
char
buf
[
301
];
thd
=
(
const
THD
*
)
input_thd
;
thd
=
(
const
THD
*
)
input_thd
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
/* We cannot use LOCK_thread_count to protect this operation because we own
the InnoDB kernel_mutex when we enter this function, but in freeing of a
THD object, MySQL first reserves LOCK_thread_count and AFTER THAT InnoDB
reserves kernel_mutex when freeing the trx object => a deadlock can occur.
The solution is for MySQL to use a separate mutex to protect thd->query and
thd->query_len. Someone should do that! This bug has been here for 3 years!
VOID(pthread_mutex_lock(&LOCK_thread_count)); */
fprintf
(
f
,
"MySQL thread id %lu, query id %lu"
,
fprintf
(
f
,
"MySQL thread id %lu, query id %lu"
,
thd
->
thread_id
,
thd
->
query_id
);
thd
->
thread_id
,
thd
->
query_id
);
...
@@ -354,15 +362,29 @@ innobase_mysql_print_thd(
...
@@ -354,15 +362,29 @@ innobase_mysql_print_thd(
if
((
s
=
thd
->
query
))
{
if
((
s
=
thd
->
query
))
{
/* determine the length of the query string */
/* determine the length of the query string */
uint32
i
,
len
=
thd
->
query_length
;
uint32
i
,
len
;
len
=
thd
->
query_length
;
if
(
len
>
300
)
{
len
=
300
;
/* A TEMPORARY SOLUTION: print at most
300 chars to reduce the probability of
a seg fault in a race */
}
for
(
i
=
0
;
i
<
len
&&
s
[
i
];
i
++
);
for
(
i
=
0
;
i
<
len
&&
s
[
i
];
i
++
);
memcpy
(
buf
,
s
,
i
);
/* use memcpy to reduce the timeframe
for a race, compared to fwrite() */
buf
[
300
]
=
'\0'
;
putc
(
'\n'
,
f
);
putc
(
'\n'
,
f
);
fwrite
(
s
,
1
,
i
,
f
);
fwrite
(
buf
,
1
,
i
,
f
);
}
}
putc
(
'\n'
,
f
);
putc
(
'\n'
,
f
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
/* VOID(pthread_mutex_unlock(&LOCK_thread_count)); */
}
}
/*************************************************************************
/*************************************************************************
...
...
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