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
24db691d
Commit
24db691d
authored
Mar 25, 2014
by
Kentoku SHIBA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new xa naming rule
parent
7d9342be
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
25 deletions
+61
-25
storage/spider/spd_db_conn.cc
storage/spider/spd_db_conn.cc
+1
-1
storage/spider/spd_param.cc
storage/spider/spd_param.cc
+24
-0
storage/spider/spd_param.h
storage/spider/spd_param.h
+3
-0
storage/spider/spd_trx.cc
storage/spider/spd_trx.cc
+33
-24
No files found.
storage/spider/spd_db_conn.cc
View file @
24db691d
...
...
@@ -1205,7 +1205,7 @@ void spider_db_append_xid_str(
DBUG_ENTER
(
"spider_db_append_xid_str"
);
format_id_length
=
my_sprintf
(
format_id
,
(
format_id
,
"
0x%lx
"
,
xid
->
formatID
));
my_sprintf
(
format_id
,
(
format_id
,
"
%lu
"
,
xid
->
formatID
));
spider_db_append_hex_string
(
tmp_str
,
(
uchar
*
)
xid
->
data
,
xid
->
gtrid_length
);
/*
tmp_str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
...
...
storage/spider/spd_param.cc
View file @
24db691d
...
...
@@ -2838,6 +2838,29 @@ static MYSQL_SYSVAR_STR(
SPIDER_DETAIL_VERSION
);
/*
0: server_id + thread_id
1: server_id + thread_id + query_id
*/
static
MYSQL_THDVAR_UINT
(
internal_xa_id_type
,
/* name */
PLUGIN_VAR_RQCMDARG
,
/* opt */
"The type of internal_xa id"
,
/* comment */
NULL
,
/* check */
NULL
,
/* update */
0
,
/* def */
0
,
/* min */
1
,
/* max */
0
/* blk */
);
uint
spider_param_internal_xa_id_type
(
THD
*
thd
)
{
DBUG_ENTER
(
"spider_param_internal_xa_id_type"
);
DBUG_RETURN
(
THDVAR
(
thd
,
internal_xa_id_type
));
}
static
struct
st_mysql_storage_engine
spider_storage_engine
=
{
MYSQL_HANDLERTON_INTERFACE_VERSION
};
...
...
@@ -2966,6 +2989,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR
(
general_log
),
MYSQL_SYSVAR
(
log_result_errors
),
MYSQL_SYSVAR
(
version
),
MYSQL_SYSVAR
(
internal_xa_id_type
),
NULL
};
...
...
storage/spider/spd_param.h
View file @
24db691d
...
...
@@ -370,3 +370,6 @@ int spider_param_udf_ds_use_real_table(
#endif
my_bool
spider_param_general_log
();
uint
spider_param_log_result_errors
();
uint
spider_param_internal_xa_id_type
(
THD
*
thd
);
storage/spider/spd_trx.cc
View file @
24db691d
...
...
@@ -1626,10 +1626,11 @@ int spider_internal_start_trx(
)
{
int
error_num
;
SPIDER_TRX
*
trx
=
spider
->
trx
;
bool
sync_autocommit
=
spider_param_sync_autocommit
(
trx
->
thd
);
bool
sync_time_zone
=
spider_param_sync_time_zone
(
trx
->
thd
);
THD
*
thd
=
trx
->
thd
;
bool
sync_autocommit
=
spider_param_sync_autocommit
(
thd
);
bool
sync_time_zone
=
spider_param_sync_time_zone
(
thd
);
double
ping_interval_at_trx_start
=
spider_param_ping_interval_at_trx_start
(
t
rx
->
t
hd
);
spider_param_ping_interval_at_trx_start
(
thd
);
bool
xa_lock
=
FALSE
;
time_t
tmp_time
=
(
time_t
)
time
((
time_t
*
)
0
);
DBUG_ENTER
(
"spider_internal_start_trx"
);
...
...
@@ -1646,19 +1647,19 @@ int spider_internal_start_trx(
if
(
!
trx
->
trx_consistent_snapshot
)
{
trx
->
use_consistent_snapshot
=
spider_param_use_consistent_snapshot
(
t
rx
->
t
hd
);
trx
->
internal_xa
=
spider_param_internal_xa
(
t
rx
->
t
hd
);
trx
->
internal_xa_snapshot
=
spider_param_internal_xa_snapshot
(
t
rx
->
t
hd
);
spider_param_use_consistent_snapshot
(
thd
);
trx
->
internal_xa
=
spider_param_internal_xa
(
thd
);
trx
->
internal_xa_snapshot
=
spider_param_internal_xa_snapshot
(
thd
);
}
}
if
(
(
error_num
=
spider_check_and_set_sql_log_off
(
t
rx
->
t
hd
,
conn
,
(
error_num
=
spider_check_and_set_sql_log_off
(
thd
,
conn
,
&
spider
->
need_mons
[
link_idx
]))
||
(
sync_time_zone
&&
(
error_num
=
spider_check_and_set_time_zone
(
t
rx
->
t
hd
,
conn
,
(
error_num
=
spider_check_and_set_time_zone
(
thd
,
conn
,
&
spider
->
need_mons
[
link_idx
])))
||
(
sync_autocommit
&&
(
error_num
=
spider_check_and_set_autocommit
(
t
rx
->
t
hd
,
conn
,
(
error_num
=
spider_check_and_set_autocommit
(
thd
,
conn
,
&
spider
->
need_mons
[
link_idx
])))
)
goto
error
;
...
...
@@ -1682,11 +1683,11 @@ int spider_internal_start_trx(
if
(
!
trx
->
trx_start
)
{
if
(
t
rx
->
t
hd
->
transaction
.
xid_state
.
xa_state
==
XA_ACTIVE
&&
thd
->
transaction
.
xid_state
.
xa_state
==
XA_ACTIVE
&&
spider_param_support_xa
()
)
{
trx
->
trx_xa
=
TRUE
;
thd_get_xid
(
t
rx
->
t
hd
,
(
MYSQL_XID
*
)
&
trx
->
xid
);
thd_get_xid
(
thd
,
(
MYSQL_XID
*
)
&
trx
->
xid
);
}
if
(
...
...
@@ -1697,19 +1698,27 @@ int spider_internal_start_trx(
)
{
trx
->
trx_xa
=
TRUE
;
trx
->
xid
.
formatID
=
1
;
trx
->
xid
.
gtrid_length
=
my_sprintf
(
trx
->
xid
.
data
,
(
trx
->
xid
.
data
,
"%lx"
,
thd_get_thread_id
(
trx
->
thd
)));
if
(
spider_param_internal_xa_id_type
(
thd
)
==
0
)
{
trx
->
xid
.
gtrid_length
=
my_sprintf
(
trx
->
xid
.
data
,
(
trx
->
xid
.
data
,
"%lx"
,
thd_get_thread_id
(
thd
)));
}
else
{
trx
->
xid
.
gtrid_length
=
my_sprintf
(
trx
->
xid
.
data
,
(
trx
->
xid
.
data
,
"%lx%016llx"
,
thd_get_thread_id
(
thd
),
thd
->
query_id
));
}
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
trx
->
xid
.
bqual_length
=
my_sprintf
(
trx
->
xid
.
data
+
trx
->
xid
.
gtrid_length
,
(
trx
->
xid
.
data
+
trx
->
xid
.
gtrid_length
,
"%lx"
,
t
rx
->
t
hd
->
variables
.
server_id
));
thd
->
variables
.
server_id
));
#else
trx
->
xid
.
bqual_length
=
my_sprintf
(
trx
->
xid
.
data
+
trx
->
xid
.
gtrid_length
,
(
trx
->
xid
.
data
+
trx
->
xid
.
gtrid_length
,
"%x"
,
t
rx
->
t
hd
->
server_id
));
thd
->
server_id
));
#endif
trx
->
internal_xid_state
.
xa_state
=
XA_ACTIVE
;
...
...
@@ -1729,9 +1738,9 @@ int spider_internal_start_trx(
trx
->
trx_consistent_snapshot
?
"TRUE"
:
"FALSE"
));
if
(
!
trx
->
trx_consistent_snapshot
)
{
trans_register_ha
(
t
rx
->
t
hd
,
FALSE
,
spider_hton_ptr
);
if
(
thd_test_options
(
t
rx
->
t
hd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
trans_register_ha
(
t
rx
->
t
hd
,
TRUE
,
spider_hton_ptr
);
trans_register_ha
(
thd
,
FALSE
,
spider_hton_ptr
);
if
(
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
trans_register_ha
(
thd
,
TRUE
,
spider_hton_ptr
);
}
trx
->
trx_start
=
TRUE
;
trx
->
trx_xa_prepared
=
FALSE
;
...
...
@@ -1741,7 +1750,7 @@ int spider_internal_start_trx(
DBUG_PRINT
(
"info"
,(
"spider conn->semi_trx_chk = %d"
,
conn
->
semi_trx_chk
));
DBUG_PRINT
(
"info"
,(
"spider conn->table_lock = %d"
,
conn
->
table_lock
));
DBUG_PRINT
(
"info"
,(
"spider conn->autocommit = %d"
,
conn
->
autocommit
));
DBUG_PRINT
(
"info"
,(
"spider semi_trx = %d"
,
spider_param_semi_trx
(
t
rx
->
t
hd
)));
DBUG_PRINT
(
"info"
,(
"spider semi_trx = %d"
,
spider_param_semi_trx
(
thd
)));
conn
->
semi_trx
=
FALSE
;
if
(
conn
->
table_lock
==
3
)
{
...
...
@@ -1758,7 +1767,7 @@ int spider_internal_start_trx(
(
!
conn
->
queued_autocommit
&&
conn
->
autocommit
==
1
)
||
(
conn
->
queued_autocommit
&&
conn
->
queued_autocommit_val
==
TRUE
)
)
&&
spider_param_semi_trx
(
t
rx
->
t
hd
)
spider_param_semi_trx
(
thd
)
)
{
DBUG_PRINT
(
"info"
,(
"spider semi_trx is set"
));
conn
->
semi_trx
=
TRUE
;
...
...
@@ -1767,7 +1776,7 @@ int spider_internal_start_trx(
conn
->
disable_xa
=
FALSE
;
}
else
if
(
!
trx
->
trx_consistent_snapshot
&&
!
thd_test_options
(
t
rx
->
t
hd
,
OPTION_BEGIN
)
&&
!
thd_test_options
(
thd
,
OPTION_BEGIN
)
&&
sync_autocommit
&&
conn
->
semi_trx_chk
&&
!
conn
->
table_lock
&&
...
...
@@ -1775,14 +1784,14 @@ int spider_internal_start_trx(
(
!
conn
->
queued_autocommit
&&
conn
->
autocommit
==
1
)
||
(
conn
->
queued_autocommit
&&
conn
->
queued_autocommit_val
==
TRUE
)
)
&&
spider_param_semi_trx
(
t
rx
->
t
hd
)
spider_param_semi_trx
(
thd
)
)
{
DBUG_PRINT
(
"info"
,(
"spider semi_trx is set"
));
spider_conn_queue_start_transaction
(
conn
);
conn
->
semi_trx
=
TRUE
;
}
else
if
(
!
trx
->
trx_consistent_snapshot
&&
thd_test_options
(
t
rx
->
t
hd
,
OPTION_BEGIN
)
thd_test_options
(
thd
,
OPTION_BEGIN
)
)
{
DBUG_PRINT
(
"info"
,(
"spider start transaction"
));
spider_conn_queue_start_transaction
(
conn
);
...
...
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