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
29cf8fb3
Commit
29cf8fb3
authored
Jun 08, 2014
by
Kentoku SHIBA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge Spider 3.2.4
parent
349e31d5
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1295 additions
and
325 deletions
+1295
-325
storage/spider/ha_spider.cc
storage/spider/ha_spider.cc
+318
-84
storage/spider/ha_spider.h
storage/spider/ha_spider.h
+1
-0
storage/spider/mysql-test/spider/bg/r/direct_aggregate.result
...age/spider/mysql-test/spider/bg/r/direct_aggregate.result
+5
-5
storage/spider/mysql-test/spider/bg/r/direct_aggregate_part.result
...pider/mysql-test/spider/bg/r/direct_aggregate_part.result
+5
-5
storage/spider/mysql-test/spider/bg/r/spider_fixes.result
storage/spider/mysql-test/spider/bg/r/spider_fixes.result
+0
-1
storage/spider/mysql-test/spider/r/direct_aggregate.result
storage/spider/mysql-test/spider/r/direct_aggregate.result
+5
-5
storage/spider/mysql-test/spider/r/direct_aggregate_part.result
...e/spider/mysql-test/spider/r/direct_aggregate_part.result
+5
-5
storage/spider/mysql-test/spider/r/spider_fixes.result
storage/spider/mysql-test/spider/r/spider_fixes.result
+49
-45
storage/spider/spd_conn.cc
storage/spider/spd_conn.cc
+51
-0
storage/spider/spd_db_conn.cc
storage/spider/spd_db_conn.cc
+18
-10
storage/spider/spd_db_handlersocket.cc
storage/spider/spd_db_handlersocket.cc
+27
-5
storage/spider/spd_db_handlersocket.h
storage/spider/spd_db_handlersocket.h
+5
-0
storage/spider/spd_db_include.h
storage/spider/spd_db_include.h
+14
-0
storage/spider/spd_db_mysql.cc
storage/spider/spd_db_mysql.cc
+252
-22
storage/spider/spd_db_mysql.h
storage/spider/spd_db_mysql.h
+5
-0
storage/spider/spd_db_oracle.cc
storage/spider/spd_db_oracle.cc
+29
-7
storage/spider/spd_db_oracle.h
storage/spider/spd_db_oracle.h
+5
-0
storage/spider/spd_include.h
storage/spider/spd_include.h
+30
-2
storage/spider/spd_malloc.cc
storage/spider/spd_malloc.cc
+39
-1
storage/spider/spd_ping_table.cc
storage/spider/spd_ping_table.cc
+144
-102
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+264
-26
storage/spider/spd_table.h
storage/spider/spd_table.h
+24
-0
No files found.
storage/spider/ha_spider.cc
View file @
29cf8fb3
This diff is collapsed.
Click to expand it.
storage/spider/ha_spider.h
View file @
29cf8fb3
...
...
@@ -167,6 +167,7 @@ public:
bool
insert_delayed
;
bool
use_pre_call
;
bool
use_pre_records
;
bool
pre_bitmap_checked
;
enum
thr_lock_type
lock_type
;
int
lock_mode
;
uint
sql_command
;
...
...
storage/spider/mysql-test/spider/bg/r/direct_aggregate.result
View file @
29cf8fb3
...
...
@@ -48,31 +48,31 @@ COUNT(*)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l;
MAX(a)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l;
MIN(a)
1
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l WHERE a < 5;
MAX(a)
4
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l WHERE a > 1;
MIN(a)
2
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
deinit
DROP DATABASE IF EXISTS auto_test_local;
...
...
storage/spider/mysql-test/spider/bg/r/direct_aggregate_part.result
View file @
29cf8fb3
...
...
@@ -39,31 +39,31 @@ COUNT(*)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l2;
MAX(a)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l2;
MIN(a)
1
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l2 WHERE a < 5;
MAX(a)
4
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l2 WHERE a > 1;
MIN(a)
2
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
deinit
DROP DATABASE IF EXISTS auto_test_local;
...
...
storage/spider/mysql-test/spider/bg/r/spider_fixes.result
View file @
29cf8fb3
...
...
@@ -414,7 +414,6 @@ id
Warnings:
Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
INSERT INTO t1 (id) VALUES (1);
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
...
...
storage/spider/mysql-test/spider/r/direct_aggregate.result
View file @
29cf8fb3
...
...
@@ -48,31 +48,31 @@ COUNT(*)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l;
MAX(a)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l;
MIN(a)
1
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l WHERE a < 5;
MAX(a)
4
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l WHERE a > 1;
MIN(a)
2
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
1
Spider_direct_aggregate
0
deinit
DROP DATABASE IF EXISTS auto_test_local;
...
...
storage/spider/mysql-test/spider/r/direct_aggregate_part.result
View file @
29cf8fb3
...
...
@@ -39,31 +39,31 @@ COUNT(*)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l2;
MAX(a)
5
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l2;
MIN(a)
1
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MAX(a) FROM ta_l2 WHERE a < 5;
MAX(a)
4
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
SELECT MIN(a) FROM ta_l2 WHERE a > 1;
MIN(a)
2
SHOW STATUS LIKE 'Spider_direct_aggregate';
Variable_name Value
Spider_direct_aggregate
2
Spider_direct_aggregate
0
deinit
DROP DATABASE IF EXISTS auto_test_local;
...
...
storage/spider/mysql-test/spider/r/spider_fixes.result
View file @
29cf8fb3
...
...
@@ -245,7 +245,7 @@ a b c
direct order limit
SHOW STATUS LIKE 'Spider_direct_order_limit';
Variable_name Value
Spider_direct_order_limit
0
Spider_direct_order_limit
2
SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
a b c
1 2 4
...
...
@@ -253,7 +253,7 @@ a b c
3 4 5
SHOW STATUS LIKE 'Spider_direct_order_limit';
Variable_name Value
Spider_direct_order_limit
0
Spider_direct_order_limit
3
2.26
lock tables
...
...
@@ -297,79 +297,83 @@ PRIMARY KEY (id)
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
2
SELECT MAX(id) FROM t1;
MAX(id)
777
2
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1554
6
SELECT MAX(id) FROM t1;
MAX(id)
1554
6
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2331
10
SELECT MAX(id) FROM t1;
MAX(id)
2331
10
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3108
14
SELECT MAX(id) FROM t1;
MAX(id)
3108
14
INSERT INTO t1 () VALUES (),(),(),();
Warnings:
Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3885
18
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
3885
466
2
5439
6216
2
6
10
14
18
2
2
26
30
SET INSERT_ID=5000;
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
34
SELECT MAX(id) FROM t1;
MAX(id)
6216
34
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
38
SELECT MAX(id) FROM t1;
MAX(id)
10000
38
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
42
SELECT MAX(id) FROM t1;
MAX(id)
10000
42
SELECT id FROM t1 ORDER BY id;
id
2
6
10
14
18
34
777
1000
1554
2331
3108
3885
4662
5000
5439
6216
10000
read only
...
...
@@ -380,22 +384,22 @@ PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1
SELECT id FROM t1 ORDER BY id;
id
777
1000
1
554
2331
310
8
3885
4662
500
0
5439
6216
10000
2
6
1
0
14
1
8
22
26
3
0
34
38
42
INSERT INTO t1 (id) VALUES (1);
ERROR HY000: Table 'auto_test_local.t1' is read only
UPDATE t1 SET id = 4 WHERE id =
777
;
UPDATE t1 SET id = 4 WHERE id =
2
;
ERROR HY000: Table 'auto_test_local.t1' is read only
DELETE FROM t1 WHERE id =
777
;
DELETE FROM t1 WHERE id =
2
;
ERROR HY000: Table 'auto_test_local.t1' is read only
DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
...
...
@@ -414,13 +418,13 @@ id
Warnings:
Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
INSERT INTO t1 (id) VALUES (1);
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
DELETE FROM t1;
Warnings:
Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
...
...
storage/spider/spd_conn.cc
View file @
29cf8fb3
...
...
@@ -62,6 +62,7 @@ extern PSI_cond_key spd_key_cond_bg_sts_sync;
extern
PSI_cond_key
spd_key_cond_bg_crd
;
extern
PSI_cond_key
spd_key_cond_bg_crd_sync
;
extern
PSI_cond_key
spd_key_cond_bg_mon
;
extern
PSI_cond_key
spd_key_cond_bg_mon_sleep
;
extern
PSI_thread_key
spd_key_thd_bg
;
extern
PSI_thread_key
spd_key_thd_bg_sts
;
extern
PSI_thread_key
spd_key_thd_bg_crd
;
...
...
@@ -3425,6 +3426,8 @@ int spider_create_mon_threads(
&
share
->
bg_mon_mutexes
,
sizeof
(
pthread_mutex_t
)
*
share
->
all_link_count
,
&
share
->
bg_mon_conds
,
sizeof
(
pthread_cond_t
)
*
share
->
all_link_count
,
&
share
->
bg_mon_sleep_conds
,
sizeof
(
pthread_cond_t
)
*
share
->
all_link_count
,
NullS
))
)
{
error_num
=
HA_ERR_OUT_OF_MEM
;
...
...
@@ -3463,6 +3466,22 @@ int spider_create_mon_threads(
goto
error_cond_init
;
}
}
for
(
roop_count
=
0
;
roop_count
<
(
int
)
share
->
all_link_count
;
roop_count
++
)
{
if
(
share
->
monitoring_bg_kind
[
roop_count
]
&&
#if MYSQL_VERSION_ID < 50500
pthread_cond_init
(
&
share
->
bg_mon_sleep_conds
[
roop_count
],
NULL
)
#else
mysql_cond_init
(
spd_key_cond_bg_mon_sleep
,
&
share
->
bg_mon_sleep_conds
[
roop_count
],
NULL
)
#endif
)
{
error_num
=
HA_ERR_OUT_OF_MEM
;
goto
error_sleep_cond_init
;
}
}
link_pack
.
share
=
share
;
for
(
roop_count
=
0
;
roop_count
<
(
int
)
share
->
all_link_count
;
roop_count
++
)
...
...
@@ -3514,6 +3533,13 @@ error_thread_create:
}
share
->
bg_mon_kill
=
FALSE
;
roop_count
=
share
->
all_link_count
;
error_sleep_cond_init:
for
(
roop_count
--
;
roop_count
>=
0
;
roop_count
--
)
{
if
(
share
->
monitoring_bg_kind
[
roop_count
])
pthread_cond_destroy
(
&
share
->
bg_mon_sleep_conds
[
roop_count
]);
}
roop_count
=
share
->
all_link_count
;
error_cond_init:
for
(
roop_count
--
;
roop_count
>=
0
;
roop_count
--
)
{
...
...
@@ -3540,6 +3566,16 @@ void spider_free_mon_threads(
DBUG_ENTER
(
"spider_free_mon_threads"
);
if
(
share
->
bg_mon_init
)
{
for
(
roop_count
=
0
;
roop_count
<
(
int
)
share
->
all_link_count
;
roop_count
++
)
{
if
(
share
->
monitoring_bg_kind
[
roop_count
]
&&
share
->
bg_mon_thds
[
roop_count
]
)
{
share
->
bg_mon_thds
[
roop_count
]
->
killed
=
SPIDER_THD_KILL_CONNECTION
;
}
}
for
(
roop_count
=
0
;
roop_count
<
(
int
)
share
->
all_link_count
;
roop_count
++
)
{
...
...
@@ -3552,11 +3588,13 @@ void spider_free_mon_threads(
{
if
(
share
->
monitoring_bg_kind
[
roop_count
])
{
pthread_cond_signal
(
&
share
->
bg_mon_sleep_conds
[
roop_count
]);
pthread_cond_wait
(
&
share
->
bg_mon_conds
[
roop_count
],
&
share
->
bg_mon_mutexes
[
roop_count
]);
pthread_mutex_unlock
(
&
share
->
bg_mon_mutexes
[
roop_count
]);
pthread_join
(
share
->
bg_mon_threads
[
roop_count
],
NULL
);
pthread_cond_destroy
(
&
share
->
bg_mon_conds
[
roop_count
]);
pthread_cond_destroy
(
&
share
->
bg_mon_sleep_conds
[
roop_count
]);
pthread_mutex_destroy
(
&
share
->
bg_mon_mutexes
[
roop_count
]);
}
}
...
...
@@ -3614,7 +3652,9 @@ void *spider_bg_mon_action(
}
share
->
bg_mon_thds
[
link_idx
]
=
thd
;
pthread_cond_signal
(
&
share
->
bg_mon_conds
[
link_idx
]);
/*
pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]);
*/
/* init end */
while
(
TRUE
)
...
...
@@ -3622,12 +3662,23 @@ void *spider_bg_mon_action(
DBUG_PRINT
(
"info"
,(
"spider bg mon sleep %lld"
,
share
->
monitoring_bg_interval
[
link_idx
]));
if
(
!
share
->
bg_mon_kill
)
{
struct
timespec
abstime
;
set_timespec_nsec
(
abstime
,
share
->
monitoring_bg_interval
[
link_idx
]
*
1000
);
pthread_cond_timedwait
(
&
share
->
bg_mon_sleep_conds
[
link_idx
],
&
share
->
bg_mon_mutexes
[
link_idx
],
&
abstime
);
/*
my_sleep((ulong) share->monitoring_bg_interval[link_idx]);
*/
}
DBUG_PRINT
(
"info"
,(
"spider bg mon roop start"
));
if
(
share
->
bg_mon_kill
)
{
DBUG_PRINT
(
"info"
,(
"spider bg mon kill start"
));
/*
pthread_mutex_lock(&share->bg_mon_mutexes[link_idx]);
*/
pthread_cond_signal
(
&
share
->
bg_mon_conds
[
link_idx
]);
pthread_mutex_unlock
(
&
share
->
bg_mon_mutexes
[
link_idx
]);
spider_free_trx
(
trx
,
TRUE
);
...
...
storage/spider/spd_db_conn.cc
View file @
29cf8fb3
...
...
@@ -2490,6 +2490,7 @@ int spider_db_fetch_for_item_sum_func(
)
{
int
error_num
;
SPIDER_SHARE
*
share
=
spider
->
share
;
THD
*
thd
=
spider
->
trx
->
thd
;
DBUG_ENTER
(
"spider_db_fetch_for_item_sum_func"
);
DBUG_PRINT
(
"info"
,(
"spider Sumfunctype = %d"
,
item_sum
->
sum_func
()));
switch
(
item_sum
->
sum_func
())
...
...
@@ -2556,10 +2557,12 @@ int spider_db_fetch_for_item_sum_func(
}
if
(
!
spider
->
direct_aggregate_item_current
->
item
)
{
Item
*
free_list
=
thd
->
free_list
;
spider
->
direct_aggregate_item_current
->
item
=
new
Item_string
(
share
->
access_charset
);
if
(
!
spider
->
direct_aggregate_item_current
->
item
)
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
thd
->
free_list
=
free_list
;
}
Item_sum_hybrid
*
item_hybrid
=
(
Item_sum_hybrid
*
)
item_sum
;
...
...
@@ -3678,6 +3681,7 @@ int spider_db_store_result(
pthread_mutex_unlock
(
&
conn
->
mta_conn_mutex
);
}
current
->
record_num
=
current
->
result
->
num_rows
();
current
->
dbton_id
=
current
->
result
->
dbton_id
;
result_list
->
record_num
+=
current
->
record_num
;
DBUG_PRINT
(
"info"
,(
"spider current->record_num=%lld"
,
current
->
record_num
));
...
...
@@ -3754,6 +3758,7 @@ int spider_db_store_result(
pthread_mutex_unlock
(
&
conn
->
mta_conn_mutex
);
}
}
current
->
dbton_id
=
current
->
result
->
dbton_id
;
SPIDER_DB_ROW
*
row
;
if
(
!
(
row
=
current
->
result
->
fetch_row
()))
{
...
...
@@ -5861,8 +5866,10 @@ int spider_db_update_auto_increment(
}
#endif
DBUG_PRINT
(
"info"
,(
"spider last_insert_id=%llu"
,
last_insert_id
));
share
->
auto_increment_value
=
share
->
lgtm_tblhnd_share
->
auto_increment_value
=
last_insert_id
+
affected_rows
;
DBUG_PRINT
(
"info"
,(
"spider auto_increment_value=%llu"
,
share
->
lgtm_tblhnd_share
->
auto_increment_value
));
/*
thd->record_first_successful_insert_id_in_cur_stmt(last_insert_id);
*/
...
...
@@ -8047,11 +8054,10 @@ int spider_db_open_item_string(
tmp_str
.
mem_calc
();
str
->
q_append
(
SPIDER_SQL_VALUE_QUOTE_STR
,
SPIDER_SQL_VALUE_QUOTE_LEN
);
if
(
str
->
get_str
()
->
append_for_single_quote
(
tmp_str2
)
||
str
->
append_for_single_quote
(
tmp_str2
)
||
str
->
reserve
(
SPIDER_SQL_VALUE_QUOTE_LEN
)
)
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
str
->
mem_calc
();
str
->
q_append
(
SPIDER_SQL_VALUE_QUOTE_STR
,
SPIDER_SQL_VALUE_QUOTE_LEN
);
}
DBUG_RETURN
(
0
);
...
...
@@ -9033,11 +9039,13 @@ int spider_db_udf_ping_table(
uint
tmp_conn_link_idx
=
0
;
ha_spider
spider
;
uchar
db_request_phase
=
0
;
ulonglong
db_request_id
=
0
;
spider
.
share
=
share
;
spider
.
trx
=
trx
;
spider
.
need_mons
=
&
need_mon
;
spider
.
conn_link_idx
=
&
tmp_conn_link_idx
;
spider
.
db_request_phase
=
&
db_request_phase
;
spider
.
db_request_id
=
&
db_request_id
;
pthread_mutex_lock
(
&
conn
->
mta_conn_mutex
);
SPIDER_SET_FILE_POS
(
&
conn
->
mta_conn_mutex_file_pos
);
conn
->
need_mon
=
&
need_mon
;
...
...
@@ -9192,8 +9200,7 @@ int spider_db_udf_ping_table_append_mon_next(
str
->
q_append
(
SPIDER_SQL_SELECT_STR
,
SPIDER_SQL_SELECT_LEN
);
str
->
q_append
(
SPIDER_SQL_PING_TABLE_STR
,
SPIDER_SQL_PING_TABLE_LEN
);
str
->
q_append
(
SPIDER_SQL_VALUE_QUOTE_STR
,
SPIDER_SQL_VALUE_QUOTE_LEN
);
str
->
get_str
()
->
append_for_single_quote
(
child_table_name_str
.
get_str
());
str
->
mem_calc
();
str
->
append_for_single_quote
(
child_table_name_str
.
get_str
());
str
->
q_append
(
SPIDER_SQL_VALUE_QUOTE_STR
,
SPIDER_SQL_VALUE_QUOTE_LEN
);
str
->
q_append
(
SPIDER_SQL_COMMA_STR
,
SPIDER_SQL_COMMA_LEN
);
str
->
qs_append
(
link_id
);
...
...
@@ -9203,8 +9210,7 @@ int spider_db_udf_ping_table_append_mon_next(
str
->
q_append
(
limit_str
,
limit_str_length
);
str
->
q_append
(
SPIDER_SQL_COMMA_STR
,
SPIDER_SQL_COMMA_LEN
);
str
->
q_append
(
SPIDER_SQL_VALUE_QUOTE_STR
,
SPIDER_SQL_VALUE_QUOTE_LEN
);
str
->
get_str
()
->
append_for_single_quote
(
where_clause_str
.
get_str
());
str
->
mem_calc
();
str
->
append_for_single_quote
(
where_clause_str
.
get_str
());
str
->
q_append
(
SPIDER_SQL_VALUE_QUOTE_STR
,
SPIDER_SQL_VALUE_QUOTE_LEN
);
str
->
q_append
(
SPIDER_SQL_COMMA_STR
,
SPIDER_SQL_COMMA_LEN
);
str
->
q_append
(
sid_str
,
sid_str_length
);
...
...
@@ -9255,9 +9261,11 @@ int spider_db_udf_ping_table_append_select(
SPIDER_SQL_LIMIT_LEN
+
limit_str_length
))
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
if
(
use_where
)
str
->
get_str
()
->
append_for_single_quote
(
where_str
->
get_str
());
str
->
mem_calc
();
if
(
use_where
&&
str
->
append_for_single_quote
(
where_str
->
get_str
())
)
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
str
->
q_append
(
SPIDER_SQL_LIMIT_STR
,
SPIDER_SQL_LIMIT_LEN
);
str
->
q_append
(
limit_str
,
limit_str_length
);
DBUG_RETURN
(
0
);
...
...
storage/spider/spd_db_handlersocket.cc
View file @
29cf8fb3
...
...
@@ -820,6 +820,16 @@ int spider_db_handlersocket_result::fetch_index_for_discover_table_structure(
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
HA_ERR_WRONG_COMMAND
);
}
int
spider_db_handlersocket_result
::
fetch_table_for_discover_table_structure
(
spider_string
*
str
,
SPIDER_SHARE
*
spider_share
,
CHARSET_INFO
*
access_charset
)
{
DBUG_ENTER
(
"spider_db_handlersocket_result::fetch_table_for_discover_table_structure"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
HA_ERR_WRONG_COMMAND
);
}
#endif
spider_db_handlersocket
::
spider_db_handlersocket
(
...
...
@@ -963,8 +973,11 @@ int spider_db_handlersocket::connect(
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
while
(
hs_conn
->
get_error_code
())
{
if
(
!
connect_retry_count
)
{
THD
*
thd
=
current_thd
;
if
(
!
connect_retry_count
||
(
thd
&&
thd
->
killed
)
)
{
my_error
(
ER_CONNECT_TO_FOREIGN_DATA_SOURCE
,
MYF
(
0
),
conn
->
tgt_host
);
DBUG_RETURN
(
ER_CONNECT_TO_FOREIGN_DATA_SOURCE
);
...
...
@@ -3481,8 +3494,8 @@ int spider_db_handlersocket_util::append_escaped_util(
)
{
DBUG_ENTER
(
"spider_db_handlersocket_util::append_escaped_util"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
append_escaped
(
to
->
get_str
(),
from
);
to
->
mem_calc
(
);
if
(
to
->
append_for_single_quote
(
from
))
DBUG_RETURN
(
HA_ERR_OUT_OF_MEM
);
DBUG_RETURN
(
0
);
}
...
...
@@ -4088,7 +4101,9 @@ int spider_handlersocket_handler::append_minimum_select_without_quote(
{
if
(
minimum_select_bit_is_set
((
*
field
)
->
field_index
))
{
/*
spider_set_bit(minimum_select_bitmap, (*field)->field_index);
*/
field_length
=
handlersocket_share
->
column_name_str
[(
*
field
)
->
field_index
].
length
();
if
(
str
->
reserve
(
field_length
+
SPIDER_SQL_COMMA_LEN
))
...
...
@@ -5283,6 +5298,7 @@ int spider_handlersocket_handler::show_table_status(
)
{
spider_db_handlersocket_result
res
;
SPIDER_SHARE
*
share
=
spider
->
share
;
ulonglong
auto_increment_value
=
0
;
DBUG_ENTER
(
"spider_handlersocket_show_table_status"
);
res
.
fetch_table_status
(
sts_mode
,
...
...
@@ -5291,11 +5307,17 @@ int spider_handlersocket_handler::show_table_status(
share
->
data_file_length
,
share
->
max_data_file_length
,
share
->
index_file_length
,
share
->
auto_increment_value
,
auto_increment_value
,
share
->
create_time
,
share
->
update_time
,
share
->
check_time
);
if
(
auto_increment_value
>
share
->
lgtm_tblhnd_share
->
auto_increment_value
)
{
share
->
lgtm_tblhnd_share
->
auto_increment_value
=
auto_increment_value
;
DBUG_PRINT
(
"info"
,(
"spider auto_increment_value=%llu"
,
share
->
lgtm_tblhnd_share
->
auto_increment_value
));
}
DBUG_RETURN
(
0
);
}
...
...
storage/spider/spd_db_handlersocket.h
View file @
29cf8fb3
...
...
@@ -220,6 +220,11 @@ public:
spider_string
*
str
,
CHARSET_INFO
*
access_charset
);
int
fetch_table_for_discover_table_structure
(
spider_string
*
str
,
SPIDER_SHARE
*
spider_share
,
CHARSET_INFO
*
access_charset
);
#endif
};
...
...
storage/spider/spd_db_include.h
View file @
29cf8fb3
...
...
@@ -159,6 +159,8 @@ typedef st_spider_result SPIDER_RESULT;
#define SPIDER_SQL_CREATE_TABLE_LEN (sizeof(SPIDER_SQL_CREATE_TABLE_STR) - 1)
#define SPIDER_SQL_DEFAULT_CHARSET_STR " default charset "
#define SPIDER_SQL_DEFAULT_CHARSET_LEN (sizeof(SPIDER_SQL_DEFAULT_CHARSET_STR) - 1)
#define SPIDER_SQL_CHARACTER_SET_STR " character set "
#define SPIDER_SQL_CHARACTER_SET_LEN (sizeof(SPIDER_SQL_CHARACTER_SET_STR) - 1)
#define SPIDER_SQL_COLLATE_STR " collate "
#define SPIDER_SQL_COLLATE_LEN (sizeof(SPIDER_SQL_COLLATE_STR) - 1)
#define SPIDER_SQL_COMMENT_STR " comment "
...
...
@@ -496,6 +498,12 @@ public:
const
char
*
st
,
uint
len
);
bool
append_for_single_quote
(
const
String
*
s
);
bool
append_for_single_quote
(
const
char
*
st
);
#endif
void
print
(
String
*
print
...
...
@@ -778,6 +786,11 @@ public:
spider_string
*
str
,
CHARSET_INFO
*
access_charset
)
=
0
;
virtual
int
fetch_table_for_discover_table_structure
(
spider_string
*
str
,
SPIDER_SHARE
*
spider_share
,
CHARSET_INFO
*
access_charset
)
=
0
;
#endif
};
...
...
@@ -1538,6 +1551,7 @@ typedef struct st_spider_condition
typedef
struct
st_spider_result
{
uint
dbton_id
;
SPIDER_DB_RESULT
*
result
;
#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
...
...
storage/spider/spd_db_mysql.cc
View file @
29cf8fb3
This diff is collapsed.
Click to expand it.
storage/spider/spd_db_mysql.h
View file @
29cf8fb3
...
...
@@ -214,6 +214,11 @@ public:
spider_string
*
str
,
CHARSET_INFO
*
access_charset
);
int
fetch_table_for_discover_table_structure
(
spider_string
*
str
,
SPIDER_SHARE
*
spider_share
,
CHARSET_INFO
*
access_charset
);
#endif
};
...
...
storage/spider/spd_db_oracle.cc
View file @
29cf8fb3
...
...
@@ -1075,6 +1075,16 @@ int spider_db_oracle_result::fetch_index_for_discover_table_structure(
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
HA_ERR_WRONG_COMMAND
);
}
int
spider_db_oracle_result
::
fetch_table_for_discover_table_structure
(
spider_string
*
str
,
SPIDER_SHARE
*
spider_share
,
CHARSET_INFO
*
access_charset
)
{
DBUG_ENTER
(
"spider_db_oracle_result::fetch_table_for_discover_table_structure"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
HA_ERR_WRONG_COMMAND
);
}
#endif
spider_db_oracle
::
spider_db_oracle
(
...
...
@@ -6022,7 +6032,9 @@ int spider_oracle_handler::append_minimum_select(
{
if
(
minimum_select_bit_is_set
((
*
field
)
->
field_index
))
{
/*
spider_set_bit(minimum_select_bitmap, (*field)->field_index);
*/
field_length
=
oracle_share
->
column_name_str
[(
*
field
)
->
field_index
].
length
();
if
(
str
->
reserve
(
field_length
+
...
...
@@ -6109,7 +6121,9 @@ int spider_oracle_handler::append_minimum_select_with_alias(
{
if
(
minimum_select_bit_is_set
((
*
field
)
->
field_index
))
{
/*
spider_set_bit(minimum_select_bitmap, (*field)->field_index);
*/
field_length
=
oracle_share
->
column_name_str
[(
*
field
)
->
field_index
].
length
();
if
(
str
->
reserve
(
alias_length
+
field_length
+
...
...
@@ -10193,6 +10207,7 @@ int spider_oracle_handler::show_table_status(
SPIDER_DB_RESULT
*
res
;
SPIDER_SHARE
*
share
=
spider
->
share
;
uint
pos
=
(
2
*
spider
->
conn_link_idx
[
link_idx
]);
ulonglong
auto_increment_value
=
0
;
DBUG_ENTER
(
"spider_oracle_handler::show_table_status"
);
DBUG_PRINT
(
"info"
,(
"spider sts_mode=%d"
,
sts_mode
));
if
(
...
...
@@ -10301,7 +10316,7 @@ int spider_oracle_handler::show_table_status(
share->data_file_length,
share->max_data_file_length,
share->index_file_length,
share->
auto_increment_value,
auto_increment_value,
share->create_time,
share->update_time,
share->check_time
...
...
@@ -10317,9 +10332,6 @@ int spider_oracle_handler::show_table_status(
share
->
data_file_length
=
65535
;
share
->
max_data_file_length
=
65535
;
share
->
index_file_length
=
65535
;
/*
share->auto_increment_value = 0;
*/
share
->
create_time
=
(
time_t
)
0
;
share
->
update_time
=
(
time_t
)
0
;
share
->
check_time
=
(
time_t
)
0
;
...
...
@@ -10412,7 +10424,7 @@ int spider_oracle_handler::show_table_status(
share
->
data_file_length
,
share
->
max_data_file_length
,
share
->
index_file_length
,
share
->
auto_increment_value
,
auto_increment_value
,
share
->
create_time
,
share
->
update_time
,
share
->
check_time
...
...
@@ -10422,6 +10434,12 @@ int spider_oracle_handler::show_table_status(
if
(
error_num
)
DBUG_RETURN
(
error_num
);
}
if
(
auto_increment_value
>
share
->
lgtm_tblhnd_share
->
auto_increment_value
)
{
share
->
lgtm_tblhnd_share
->
auto_increment_value
=
auto_increment_value
;
DBUG_PRINT
(
"info"
,(
"spider auto_increment_value=%llu"
,
share
->
lgtm_tblhnd_share
->
auto_increment_value
));
}
DBUG_RETURN
(
0
);
}
...
...
@@ -10914,9 +10932,13 @@ int spider_oracle_handler::show_autoinc(
DBUG_PRINT
(
"info"
,
(
"spider error_num=%d 7"
,
error_num
));
DBUG_RETURN
(
error_num
);
}
if
(
auto_increment_value
>=
share
->
auto_increment_value
)
if
(
auto_increment_value
>=
share
->
lgtm_tblhnd_share
->
auto_increment_value
)
{
share
->
auto_increment_value
=
auto_increment_value
+
1
;
share
->
lgtm_tblhnd_share
->
auto_increment_value
=
auto_increment_value
+
1
;
DBUG_PRINT
(
"info"
,(
"spider auto_increment_value=%llu"
,
share
->
lgtm_tblhnd_share
->
auto_increment_value
));
}
DBUG_RETURN
(
0
);
}
...
...
storage/spider/spd_db_oracle.h
View file @
29cf8fb3
...
...
@@ -248,6 +248,11 @@ public:
spider_string
*
str
,
CHARSET_INFO
*
access_charset
);
int
fetch_table_for_discover_table_structure
(
spider_string
*
str
,
SPIDER_SHARE
*
spider_share
,
CHARSET_INFO
*
access_charset
);
#endif
/* for oracle */
int
set_column_info
();
...
...
storage/spider/spd_include.h
View file @
29cf8fb3
...
...
@@ -13,7 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define SPIDER_DETAIL_VERSION "3.2.
0
"
#define SPIDER_DETAIL_VERSION "3.2.
4
"
#define SPIDER_HEX_VERSION 0x0302
#if MYSQL_VERSION_ID < 50500
...
...
@@ -47,6 +47,10 @@
#undef pthread_cond_wait
#endif
#define pthread_cond_wait mysql_cond_wait
#ifdef pthread_cond_timedwait
#undef pthread_cond_timedwait
#endif
#define pthread_cond_timedwait mysql_cond_timedwait
#ifdef pthread_cond_signal
#undef pthread_cond_signal
#endif
...
...
@@ -75,6 +79,7 @@
#define SPIDER_ALTER_REBUILD_PARTITION Alter_info::ALTER_REBUILD_PARTITION
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION
#else
#if MYSQL_VERSION_ID < 50500
#define spider_stmt_da_message(A) (A)->main_da.message()
...
...
@@ -97,6 +102,7 @@
#define SPIDER_ALTER_REBUILD_PARTITION ALTER_REBUILD_PARTITION
#define SPIDER_WARN_LEVEL_WARN MYSQL_ERROR::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION THD::KILL_CONNECTION
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009
...
...
@@ -132,7 +138,7 @@
#define SPIDER_TMP_SHARE_LONG_COUNT 15
#define SPIDER_TMP_SHARE_LONGLONG_COUNT 3
#define SPIDER_MEM_CALC_LIST_NUM 24
4
#define SPIDER_MEM_CALC_LIST_NUM 24
6
#define SPIDER_BACKUP_DASTATUS \
bool da_status; if (thd) da_status = thd->is_error(); else da_status = FALSE;
...
...
@@ -426,6 +432,19 @@ typedef struct st_spider_conn
#endif
}
SPIDER_CONN
;
typedef
struct
st_spider_lgtm_tblhnd_share
{
char
*
table_name
;
uint
table_name_length
;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type
table_path_hash_value
;
#endif
pthread_mutex_t
auto_increment_mutex
;
volatile
bool
auto_increment_init
;
volatile
ulonglong
auto_increment_lclval
;
ulonglong
auto_increment_value
;
}
SPIDER_LGTM_TBLHND_SHARE
;
#ifdef WITH_PARTITION_STORAGE_ENGINE
typedef
struct
st_spider_patition_handler_share
{
...
...
@@ -614,9 +633,12 @@ typedef struct st_spider_share
pthread_mutex_t
mutex
;
pthread_mutex_t
sts_mutex
;
pthread_mutex_t
crd_mutex
;
/*
pthread_mutex_t auto_increment_mutex;
*/
THR_LOCK
lock
;
TABLE_SHARE
*
table_share
;
SPIDER_LGTM_TBLHND_SHARE
*
lgtm_tblhnd_share
;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type
table_name_hash_value
;
#ifdef WITH_PARTITION_STORAGE_ENGINE
...
...
@@ -669,13 +691,18 @@ typedef struct st_spider_share
pthread_t
*
bg_mon_threads
;
pthread_mutex_t
*
bg_mon_mutexes
;
pthread_cond_t
*
bg_mon_conds
;
pthread_cond_t
*
bg_mon_sleep_conds
;
#endif
/*
volatile bool auto_increment_init;
volatile ulonglong auto_increment_lclval;
*/
ulonglong
data_file_length
;
ulonglong
max_data_file_length
;
ulonglong
index_file_length
;
/*
ulonglong auto_increment_value;
*/
ha_rows
records
;
ulong
mean_rec_length
;
time_t
check_time
;
...
...
@@ -721,6 +748,7 @@ typedef struct st_spider_share
int
semi_table_lock_conn
;
int
selupd_lock_mode
;
int
query_cache
;
int
query_cache_sync
;
int
internal_delayed
;
int
bulk_size
;
int
bulk_update_mode
;
...
...
storage/spider/spd_malloc.cc
View file @
29cf8fb3
...
...
@@ -1221,7 +1221,6 @@ bool spider_string::append(
DBUG_RETURN
(
res
);
}
#ifdef SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
bool
spider_string
::
append_for_single_quote
(
const
char
*
st
,
uint
len
...
...
@@ -1231,11 +1230,50 @@ bool spider_string::append_for_single_quote(
DBUG_ASSERT
(
mem_calc_inited
);
DBUG_ASSERT
((
!
current_alloc_mem
&&
!
str
.
is_alloced
())
||
current_alloc_mem
==
str
.
alloced_length
());
#ifdef SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
bool
res
=
str
.
append_for_single_quote
(
st
,
len
);
#else
String
ststr
(
st
,
len
,
str
.
charset
());
bool
res
=
append_escaped
(
&
str
,
&
ststr
);
#endif
SPIDER_STRING_CALC_MEM
;
DBUG_RETURN
(
res
);
}
bool
spider_string
::
append_for_single_quote
(
const
String
*
s
)
{
DBUG_ENTER
(
"spider_string::append_for_single_quote"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_ASSERT
(
mem_calc_inited
);
DBUG_ASSERT
((
!
current_alloc_mem
&&
!
str
.
is_alloced
())
||
current_alloc_mem
==
str
.
alloced_length
());
#ifdef SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
bool
res
=
str
.
append_for_single_quote
(
s
);
#else
bool
res
=
append_escaped
(
&
str
,
s
);
#endif
SPIDER_STRING_CALC_MEM
;
DBUG_RETURN
(
res
);
}
bool
spider_string
::
append_for_single_quote
(
const
char
*
st
)
{
DBUG_ENTER
(
"spider_string::append_for_single_quote"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_ASSERT
(
mem_calc_inited
);
DBUG_ASSERT
((
!
current_alloc_mem
&&
!
str
.
is_alloced
())
||
current_alloc_mem
==
str
.
alloced_length
());
#ifdef SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
bool
res
=
str
.
append_for_single_quote
(
st
);
#else
String
ststr
(
st
,
str
.
charset
());
bool
res
=
append_escaped
(
&
str
,
&
ststr
);
#endif
SPIDER_STRING_CALC_MEM
;
DBUG_RETURN
(
res
);
}
void
spider_string
::
swap
(
spider_string
&
s
...
...
storage/spider/spd_ping_table.cc
View file @
29cf8fb3
This diff is collapsed.
Click to expand it.
storage/spider/spd_table.cc
View file @
29cf8fb3
This diff is collapsed.
Click to expand it.
storage/spider/spd_table.h
View file @
29cf8fb3
...
...
@@ -152,6 +152,30 @@ int spider_create_conn_keys(
SPIDER_SHARE
*
share
);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
SPIDER_LGTM_TBLHND_SHARE
*
spider_get_lgtm_tblhnd_share
(
const
char
*
table_name
,
uint
table_name_length
,
my_hash_value_type
hash_value
,
bool
locked
,
bool
need_to_create
,
int
*
error_num
);
#else
SPIDER_LGTM_TBLHND_SHARE
*
spider_get_lgtm_tblhnd_share
(
const
char
*
table_name
,
uint
table_name_length
,
bool
locked
,
bool
need_to_create
,
int
*
error_num
);
#endif
void
spider_free_lgtm_tblhnd_share_alloc
(
SPIDER_LGTM_TBLHND_SHARE
*
lgtm_tblhnd_share
,
bool
locked
);
SPIDER_SHARE
*
spider_create_share
(
const
char
*
table_name
,
TABLE_SHARE
*
table_share
,
...
...
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