@@ -3826,6 +3826,33 @@ void spider_create_conn_key_add_one(int* counter, char** target, char* src)
3826
3826
}
3827
3827
}
3828
3828
3829
+ /*
3830
+ The conn keys are strings of the following format:
3831
+
3832
+ 0 \<idx1> <value1> \0 \<idx2> <value2> \0 ... \<idxN> <valueN> \0
3833
+
3834
+ Where idx1, idx2, etc. are the index of first, second, etc. options
3835
+ where the value is specified. We have the wrapper as the first
3836
+ option, host as the second, port as the third, socket as the fourth,
3837
+ and so on (see below for the order of all options). So here would be
3838
+ a conn key where only the host and the port are specified and
3839
+ nothing else:
3840
+
3841
+ 0\002localhost\000\00303306\000
3842
+
3843
+ And it has length 1 + 1 + 9 + 1 + 1 + 5 + 1 = 19.
3844
+
3845
+ In case of HA, say we have another link with the same options
3846
+ specified except that the port is 3307, then we place an extra NUL
3847
+ before placing the next conn_key:
3848
+
3849
+ 0\002localhost\000\00303306\000\0000\002localhost\000\00303307\000
3850
+ ^ ^
3851
+ conn_keys[0] conn_keys[1]
3852
+
3853
+ Thus the total number of chars (share->conn_keys_charlen) needed is
3854
+ (19 + 1) * 2 = 40
3855
+ */
3829
3856
int spider_create_conn_keys (
3830
3857
SPIDER_SHARE *share
3831
3858
) {
@@ -3904,7 +3931,7 @@ int spider_create_conn_keys(
3904
3931
+ (share->tgt_default_files [roop_count] ? share->tgt_default_files_lengths [roop_count] + 2 : 0 )
3905
3932
+ (share->tgt_default_groups [roop_count] ? share->tgt_default_groups_lengths [roop_count] + 2 : 0 )
3906
3933
+ (share->tgt_dsns [roop_count] ? share->tgt_dsns_lengths [roop_count] + 2 : 0 );
3907
- share->conn_keys_charlen += conn_keys_lengths[roop_count] + 2 ;
3934
+ share->conn_keys_charlen += conn_keys_lengths[roop_count] + 1 ;
3908
3935
}
3909
3936
if (!(share->conn_keys = (char **)
3910
3937
spider_bulk_alloc_mem (spider_current_trx, SPD_MID_CREATE_CONN_KEYS_1,
@@ -3973,6 +4000,7 @@ int spider_create_conn_keys(
3973
4000
spider_create_conn_key_add_one (&counter, &tmp_name, share->tgt_default_groups [roop_count]);
3974
4001
spider_create_conn_key_add_one (&counter, &tmp_name, share->tgt_dsns [roop_count]);
3975
4002
tmp_name++;
4003
+ tmp_name++;
3976
4004
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
3977
4005
share->conn_keys_hash_value [roop_count] = my_calc_hash (
3978
4006
&spider_open_connections, (uchar*) share->conn_keys [roop_count],
0 commit comments