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
b7938cce
Commit
b7938cce
authored
Mar 25, 2014
by
Kentoku SHIBA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scale for registering xid
parent
92fb1f3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+20
-0
storage/spider/spd_trx.cc
storage/spider/spd_trx.cc
+55
-1
No files found.
storage/spider/spd_table.cc
View file @
b7938cce
...
...
@@ -43,6 +43,9 @@
#include "spd_malloc.h"
ulong
*
spd_db_att_thread_id
;
#ifdef XID_CACHE_IS_SPLITTED
uint
*
spd_db_att_xid_cache_split_num
;
#endif
pthread_mutex_t
*
spd_db_att_LOCK_xid_cache
;
HASH
*
spd_db_att_xid_cache
;
struct
charset_info_st
*
spd_charset_utf8_bin
;
...
...
@@ -6040,6 +6043,16 @@ int spider_db_init(
HMODULE
current_module
=
GetModuleHandle
(
NULL
);
spd_db_att_thread_id
=
(
ulong
*
)
GetProcAddress
(
current_module
,
"?thread_id@@3KA"
);
#ifdef XID_CACHE_IS_SPLITTED
spd_db_att_xid_cache_split_num
=
(
uint
*
)
GetProcAddress
(
current_module
,
"?opt_xid_cache_split_num@@3IA"
);
spd_db_att_LOCK_xid_cache
=
*
((
pthread_mutex_t
**
)
GetProcAddress
(
current_module
,
"?LOCK_xid_cache@@3PAUst_mysql_mutex@@A"
));
spd_db_att_xid_cache
=
*
((
HASH
**
)
GetProcAddress
(
current_module
,
"?xid_cache@@3PAUst_hash@@A"
));
#else
spd_db_att_LOCK_xid_cache
=
(
pthread_mutex_t
*
)
#if MYSQL_VERSION_ID < 50500
GetProcAddress
(
current_module
,
...
...
@@ -6050,6 +6063,7 @@ int spider_db_init(
#endif
spd_db_att_xid_cache
=
(
HASH
*
)
GetProcAddress
(
current_module
,
"?xid_cache@@3Ust_hash@@A"
);
#endif
spd_charset_utf8_bin
=
(
struct
charset_info_st
*
)
GetProcAddress
(
current_module
,
"my_charset_utf8_bin"
);
spd_defaults_extra_file
=
(
const
char
**
)
...
...
@@ -6058,8 +6072,14 @@ int spider_db_init(
GetProcAddress
(
current_module
,
"my_defaults_file"
);
#else
spd_db_att_thread_id
=
&
thread_id
;
#ifdef XID_CACHE_IS_SPLITTED
spd_db_att_xid_cache_split_num
=
&
opt_xid_cache_split_num
;
spd_db_att_LOCK_xid_cache
=
LOCK_xid_cache
;
spd_db_att_xid_cache
=
xid_cache
;
#else
spd_db_att_LOCK_xid_cache
=
&
LOCK_xid_cache
;
spd_db_att_xid_cache
=
&
xid_cache
;
#endif
spd_charset_utf8_bin
=
&
my_charset_utf8_bin
;
spd_defaults_extra_file
=
&
my_defaults_extra_file
;
spd_defaults_file
=
&
my_defaults_file
;
...
...
storage/spider/spd_trx.cc
View file @
b7938cce
...
...
@@ -38,6 +38,9 @@
#include "spd_ping_table.h"
#include "spd_malloc.h"
#ifdef XID_CACHE_IS_SPLITTED
extern
uint
*
spd_db_att_xid_cache_split_num
;
#endif
extern
pthread_mutex_t
*
spd_db_att_LOCK_xid_cache
;
extern
HASH
*
spd_db_att_xid_cache
;
extern
struct
charset_info_st
*
spd_charset_utf8_bin
;
...
...
@@ -1500,16 +1503,31 @@ int spider_check_and_set_time_zone(
int
spider_xa_lock
(
XID_STATE
*
xid_state
)
{
THD
*
thd
=
current_thd
;
int
error_num
;
const
char
*
old_proc_info
;
DBUG_ENTER
(
"spider_xa_lock"
);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type
hash_value
=
my_calc_hash
(
spd_db_att_xid_cache
,
(
uchar
*
)
xid_state
->
xid
.
key
(),
xid_state
->
xid
.
key_length
());
#ifdef XID_CACHE_IS_SPLITTED
uint
idx
=
hash_value
%
*
spd_db_att_xid_cache_split_num
;
#endif
#endif
old_proc_info
=
thd_proc_info
(
thd
,
"Locking xid by Spider"
);
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_lock
(
&
spd_db_att_LOCK_xid_cache
[
idx
]);
#else
pthread_mutex_lock
(
spd_db_att_LOCK_xid_cache
);
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
#ifdef XID_CACHE_IS_SPLITTED
if
(
my_hash_search_using_hash_value
(
&
spd_db_att_xid_cache
[
idx
],
hash_value
,
xid_state
->
xid
.
key
(),
xid_state
->
xid
.
key_length
()))
#else
if
(
my_hash_search_using_hash_value
(
spd_db_att_xid_cache
,
hash_value
,
xid_state
->
xid
.
key
(),
xid_state
->
xid
.
key_length
()))
#endif
#else
if
(
my_hash_search
(
spd_db_att_xid_cache
,
xid_state
->
xid
.
key
(),
xid_state
->
xid
.
key_length
()))
...
...
@@ -1519,8 +1537,13 @@ int spider_xa_lock(
goto
error
;
}
#ifdef HASH_UPDATE_WITH_HASH_VALUE
#ifdef XID_CACHE_IS_SPLITTED
if
(
my_hash_insert_with_hash_value
(
&
spd_db_att_xid_cache
[
idx
],
hash_value
,
(
uchar
*
)
xid_state
))
#else
if
(
my_hash_insert_with_hash_value
(
spd_db_att_xid_cache
,
hash_value
,
(
uchar
*
)
xid_state
))
#endif
#else
if
(
my_hash_insert
(
spd_db_att_xid_cache
,
(
uchar
*
)
xid_state
))
#endif
...
...
@@ -1528,29 +1551,60 @@ int spider_xa_lock(
error_num
=
HA_ERR_OUT_OF_MEM
;
goto
error
;
}
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_unlock
(
&
spd_db_att_LOCK_xid_cache
[
idx
]);
#else
pthread_mutex_unlock
(
spd_db_att_LOCK_xid_cache
);
#endif
thd_proc_info
(
thd
,
old_proc_info
);
DBUG_RETURN
(
0
);
error:
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_unlock
(
&
spd_db_att_LOCK_xid_cache
[
idx
]);
#else
pthread_mutex_unlock
(
spd_db_att_LOCK_xid_cache
);
#endif
thd_proc_info
(
thd
,
old_proc_info
);
DBUG_RETURN
(
error_num
);
}
int
spider_xa_unlock
(
XID_STATE
*
xid_state
)
{
THD
*
thd
=
current_thd
;
const
char
*
old_proc_info
;
DBUG_ENTER
(
"spider_xa_unlock"
);
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
my_hash_value_type
hash_value
=
my_calc_hash
(
spd_db_att_xid_cache
,
(
uchar
*
)
xid_state
->
xid
.
key
(),
xid_state
->
xid
.
key_length
());
#ifdef XID_CACHE_IS_SPLITTED
uint
idx
=
hash_value
%
*
spd_db_att_xid_cache_split_num
;
#endif
#endif
old_proc_info
=
thd_proc_info
(
thd
,
"Unlocking xid by Spider"
);
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_lock
(
&
spd_db_att_LOCK_xid_cache
[
idx
]);
#else
pthread_mutex_lock
(
spd_db_att_LOCK_xid_cache
);
#endif
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
my_hash_delete_with_hash_value
(
spd_db_att_xid_cache
,
hash_value
,
(
uchar
*
)
xid_state
);
#ifdef XID_CACHE_IS_SPLITTED
my_hash_delete_with_hash_value
(
&
spd_db_att_xid_cache
[
idx
],
hash_value
,
(
uchar
*
)
xid_state
);
#else
my_hash_delete_with_hash_value
(
spd_db_att_xid_cache
,
hash_value
,
(
uchar
*
)
xid_state
);
#endif
#else
my_hash_delete
(
spd_db_att_xid_cache
,
(
uchar
*
)
xid_state
);
#endif
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_unlock
(
&
spd_db_att_LOCK_xid_cache
[
idx
]);
#else
pthread_mutex_unlock
(
spd_db_att_LOCK_xid_cache
);
#endif
thd_proc_info
(
thd
,
old_proc_info
);
DBUG_RETURN
(
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