File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -12918,6 +12918,15 @@ void ha_spider::sync_from_clone_source_base(
12918
12918
DBUG_VOID_RETURN;
12919
12919
}
12920
12920
12921
+ /*
12922
+ Set the initial values for each dbton_handler's first_link_idx and
12923
+ strict_group_by.
12924
+
12925
+ First, reset first_link_idx to -1.
12926
+ Then, for each active remote server, if the corresponding
12927
+ dbton_handler has not been set yet (first_link_idx == -1), set its
12928
+ first_link_idx to be the index of the connection.
12929
+ */
12921
12930
void ha_spider::set_first_link_idx ()
12922
12931
{
12923
12932
int roop_count, all_link_idx;
@@ -12957,6 +12966,16 @@ void ha_spider::set_first_link_idx()
12957
12966
DBUG_VOID_RETURN;
12958
12967
}
12959
12968
12969
+ /*
12970
+ Reset the initial values for each dbton_handler's first_link_idx to
12971
+ -1.
12972
+
12973
+ Also, set the search_link_idx'th active server's first_link_idx to
12974
+ search_link_idx.
12975
+
12976
+ search_link_idx is commonly randomly set using
12977
+ spider_conn_first_link_idx - see the commentary of that function.
12978
+ */
12960
12979
void ha_spider::reset_first_link_idx ()
12961
12980
{
12962
12981
int all_link_idx;
Original file line number Diff line number Diff line change @@ -167,7 +167,13 @@ class ha_spider final : public handler
167
167
ulonglong *db_request_id;
168
168
uchar *db_request_phase;
169
169
uchar *m_handler_opened;
170
+ /* ids for use in HANDLER command */
170
171
uint *m_handler_id;
172
+ /*
173
+ aliases for use in HANDLER command, in the format of t%5u on
174
+ m_handler_id. So for example, if m_handler_id is 3, then the
175
+ corresponding m_handler_cid is t00003
176
+ */
171
177
char **m_handler_cid;
172
178
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
173
179
bool do_direct_update;
Original file line number Diff line number Diff line change @@ -1135,6 +1135,7 @@ class spider_db_handler
1135
1135
uint dbton_id;
1136
1136
ha_spider *spider;
1137
1137
spider_db_share *db_share;
1138
+ /* Index of active server, used in query construction. */
1138
1139
int first_link_idx;
1139
1140
bool strict_group_by= false ;
1140
1141
bool no_where_cond= false ;
Original file line number Diff line number Diff line change @@ -3933,6 +3933,15 @@ void spider_reuse_trx_ha(
3933
3933
DBUG_VOID_RETURN;
3934
3934
}
3935
3935
3936
+ /* *
3937
+ Sets link indices for load balancing read connections
3938
+
3939
+ Assuming `spider->share->link_count` is the number of active servers
3940
+ to use, this function updates `spider->conn_link_idx` with the first
3941
+ server in the same "modulus group" whose link status is not
3942
+ `SPIDER_LINK_STATUS_NG`, or if one cannot be found, use the
3943
+ `link_idx`th server
3944
+ */
3936
3945
void spider_trx_set_link_idx_for_all (
3937
3946
ha_spider *spider
3938
3947
) {
You can’t perform that action at this time.
0 commit comments