-
Notifications
You must be signed in to change notification settings - Fork 1k
Extending support for rds_topology metadata handling #4992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7355,23 +7355,27 @@ MySQLServers_SslParams * MySQL_HostGroups_Manager::get_Server_SSL_Params(char *h | |
* @param new_servers A vector of tuples where each tuple contains the values needed to add each new server. | ||
*/ | ||
void MySQL_HostGroups_Manager::add_discovered_servers_to_mysql_servers_and_replication_hostgroups( | ||
const vector<tuple<string, int, int>>& new_servers | ||
const vector<tuple<string, int, long, int>>& new_servers | ||
) { | ||
int added_new_server = -1; | ||
|
||
GloAdmin->mysql_servers_wrlock(); | ||
wrlock(); | ||
|
||
// Add the discovered server with default values | ||
for (const tuple<string, int, int>& s : new_servers) { | ||
for (const tuple<string, int, long, int>& s : new_servers) { | ||
string host = std::get<0>(s); | ||
uint16_t port = std::get<1>(s); | ||
int port = std::get<1>(s); | ||
long int hostgroup_id = std::get<2>(s); | ||
|
||
srv_info_t srv_info { host.c_str(), port, "AWS RDS" }; | ||
srv_opts_t srv_opts { -1, -1, -1 }; | ||
int weight = std::get<3>(s); | ||
|
||
srv_info_t srv_info { host.c_str(), (uint16_t)port, "AWS RDS" }; | ||
srv_opts_t srv_opts { weight, -1, -1 }; | ||
|
||
added_new_server = create_new_server_in_hg(hostgroup_id, srv_info, srv_opts); | ||
int res = create_new_server_in_hg(hostgroup_id, srv_info, srv_opts); | ||
if (added_new_server < 0) { | ||
added_new_server = res; | ||
} | ||
Comment on lines
+7375
to
+7378
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for For example:
Confirm if this change in how There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be missing something, but wouldn't The desired behavior is to update the internal structures if at least one new server was added. The previous implementation didn't do that. |
||
} | ||
|
||
// If servers were added, perform necessary updates to internal structures | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of
long
to the tuple suggests that hostgroup IDs can now be larger thanint
. Ensure that all related code (e.g., database schema, other functions using hostgroup IDs) are updated to handlelong
values to prevent potential truncation or overflow issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I aligned the data type with the existing extraction. Reading further in the code, it seems that this
long
is actually converted touint_32
implicitly right after. Did this have a reason in the original implementation? Happy to change both the new and the existing variable to useint
orunsigned int
instead.