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
9927d0f9
Commit
9927d0f9
authored
Jan 15, 2015
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DB-777 when a tokudb lock timeout occurs print info about the conflicting queries to the error log
parent
44bb19b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
storage/tokudb/hatoku_defines.h
storage/tokudb/hatoku_defines.h
+2
-0
storage/tokudb/hatoku_hton.cc
storage/tokudb/hatoku_hton.cc
+41
-2
No files found.
storage/tokudb/hatoku_defines.h
View file @
9927d0f9
...
...
@@ -161,6 +161,8 @@ PATENT RIGHTS GRANT:
#define TOKU_INCLUDE_UPSERT 1
#if defined(MARIADB_BASE_VERSION)
#define TOKU_INCLUDE_EXTENDED_KEYS 1
#else
#define TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING 1
#endif
#define TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL 0
...
...
storage/tokudb/hatoku_hton.cc
View file @
9927d0f9
...
...
@@ -1961,6 +1961,33 @@ static int tokudb_fractal_tree_block_map_done(void *p) {
return
0
;
}
#if TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING
struct
tokudb_search_txn_extra
{
bool
match_found
;
uint64_t
match_txn_id
;
uint64_t
match_client_id
;
};
static
int
tokudb_search_txn_callback
(
uint64_t
txn_id
,
uint64_t
client_id
,
iterate_row_locks_callback
iterate_locks
,
void
*
locks_extra
,
void
*
extra
)
{
struct
tokudb_search_txn_extra
*
e
=
reinterpret_cast
<
struct
tokudb_search_txn_extra
*>
(
extra
);
if
(
e
->
match_txn_id
==
txn_id
)
{
e
->
match_found
=
true
;
e
->
match_client_id
=
client_id
;
return
1
;
}
return
0
;
}
static
bool
tokudb_txn_id_to_client_id
(
THD
*
thd
,
uint64_t
blocking_txnid
,
uint64_t
*
blocking_client_id
)
{
struct
tokudb_search_txn_extra
e
=
{
false
,
blocking_txnid
,
0
};
(
void
)
db_env
->
iterate_live_transactions
(
db_env
,
tokudb_search_txn_callback
,
&
e
);
if
(
e
.
match_found
)
{
*
blocking_client_id
=
e
.
match_client_id
;
}
return
e
.
match_found
;
}
#endif
static
void
tokudb_pretty_key
(
const
DB
*
db
,
const
DBT
*
key
,
const
char
*
default_key
,
String
*
out
)
{
if
(
key
->
data
==
NULL
)
{
out
->
append
(
default_key
);
...
...
@@ -2010,8 +2037,9 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
// generate a JSON document with the lock timeout info
String
log_str
;
log_str
.
append
(
"{"
);
uint64_t
mysql_thread_id
=
thd
->
thread_id
;
log_str
.
append
(
"
\"
mysql_thread_id
\"
:"
);
log_str
.
append_ulonglong
(
thd
->
thread_id
);
log_str
.
append_ulonglong
(
mysql_
thread_id
);
log_str
.
append
(
",
\"
dbname
\"
:"
);
log_str
.
append
(
"
\"
"
);
log_str
.
append
(
tokudb_get_index_name
(
db
));
log_str
.
append
(
"
\"
"
);
log_str
.
append
(
",
\"
requesting_txnid
\"
:"
);
...
...
@@ -2051,7 +2079,18 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
}
// dump to stderr
if
(
lock_timeout_debug
&
2
)
{
sql_print_error
(
"%s: %s"
,
tokudb_hton_name
,
log_str
.
c_ptr
());
sql_print_error
(
"%s: lock timeout %s"
,
tokudb_hton_name
,
log_str
.
c_ptr
());
LEX_STRING
*
qs
=
thd_query_string
(
thd
);
sql_print_error
(
"%s: requesting_thread_id:%"
PRIu64
" q:%.*s"
,
tokudb_hton_name
,
mysql_thread_id
,
(
int
)
qs
->
length
,
qs
->
str
);
#if TOKU_INCLUDE_LOCK_TIMEOUT_QUERY_STRING
uint64_t
blocking_thread_id
=
0
;
if
(
tokudb_txn_id_to_client_id
(
thd
,
blocking_txnid
,
&
blocking_thread_id
))
{
String
blocking_qs
;
if
(
get_thread_query_string
(
blocking_thread_id
,
blocking_qs
)
==
0
)
{
sql_print_error
(
"%s: blocking_thread_id:%"
PRIu64
" q:%.*s"
,
tokudb_hton_name
,
blocking_thread_id
,
blocking_qs
.
length
(),
blocking_qs
.
c_ptr
());
}
}
#endif
}
}
}
...
...
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