Skip to content

Commit d1114d6

Browse files
Add AWS Aurora PostgreSQL auto-discovery support
This commit implements Aurora PostgreSQL auto-discovery functionality, mirroring the existing Aurora MySQL implementation. The feature enables automatic detection and management of Aurora PostgreSQL cluster topology. Key features: - Auto-discovery using aurora_replica_status() function - Writer detection via session_id = 'MASTER_SESSION_ID' - Automatic failover handling with hostgroup reconfiguration - Replication lag-based server shunning - Dynamic server addition when new nodes join the cluster New tables: - pgsql_aws_aurora_hostgroups (configuration) - runtime_pgsql_aws_aurora_hostgroups (runtime) Configuration parameters (same as MySQL Aurora): - writer_hostgroup, reader_hostgroup - aurora_port (default: 5432) - domain_name, max_lag_ms, check_interval_ms, check_timeout_ms - writer_is_also_reader, new_reader_weight - add_lag_ms, min_lag_ms, lag_num_checks Files modified: - include/ProxySQL_Admin_Tables_Definitions.h: Aurora table definitions - include/proxysql_admin.h: incoming_aurora_hostgroups field - lib/Admin_Bootstrap.cpp: Admin table registration - lib/ProxySQL_Config.cpp: Config file parsing - lib/ProxySQL_Admin.cpp: Runtime load logic - include/PgSQL_HostGroups_Manager.h: PgSQL_AWS_Aurora_Info class - lib/PgSQL_HostGroups_Manager.cpp: Hostgroup management implementation - include/PgSQL_Monitor.hpp: Monitoring class definitions - lib/PgSQL_Monitor.cpp: Monitoring thread implementation
1 parent 6ee087c commit d1114d6

9 files changed

+1574
-2
lines changed

include/PgSQL_HostGroups_Manager.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@
4848
#endif /* DEBUG */
4949
#define MYHGM_PgSQL_REPLICATION_HOSTGROUPS "CREATE TABLE pgsql_replication_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND reader_hostgroup>=0) , check_type VARCHAR CHECK (LOWER(check_type) IN ('read_only')) NOT NULL DEFAULT 'read_only' , comment VARCHAR NOT NULL DEFAULT '' , UNIQUE (reader_hostgroup))"
5050

51+
// AWS Aurora PostgreSQL hostgroups table definition
52+
#define MYHGM_PgSQL_AWS_AURORA_HOSTGROUPS "CREATE TABLE pgsql_aws_aurora_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND reader_hostgroup>0) , " \
53+
"active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , aurora_port INT NOT NULL DEFAULT 5432 , domain_name VARCHAR NOT NULL DEFAULT '' , " \
54+
"max_lag_ms INT NOT NULL CHECK (max_lag_ms>= 10 AND max_lag_ms <= 600000) DEFAULT 600000 , check_interval_ms INT NOT NULL CHECK (check_interval_ms >= 100 AND check_interval_ms <= 600000) DEFAULT 1000 , " \
55+
"check_timeout_ms INT NOT NULL CHECK (check_timeout_ms >= 80 AND check_timeout_ms <= 3000) DEFAULT 800 , " \
56+
"writer_is_also_reader INT CHECK (writer_is_also_reader IN (0,1)) NOT NULL DEFAULT 0 , new_reader_weight INT CHECK (new_reader_weight >= 0 AND new_reader_weight <=10000000) NOT NULL DEFAULT 1 , " \
57+
"add_lag_ms INT NOT NULL CHECK (add_lag_ms >= 0 AND add_lag_ms <= 600000) DEFAULT 30 , min_lag_ms INT NOT NULL CHECK (min_lag_ms >= 0 AND min_lag_ms <= 600000) DEFAULT 30 , " \
58+
"lag_num_checks INT NOT NULL CHECK (lag_num_checks >= 1 AND lag_num_checks <= 16) DEFAULT 1 , comment VARCHAR NOT NULL DEFAULT '' , UNIQUE (reader_hostgroup))"
59+
5160
#define PGHGM_GEN_ADMIN_RUNTIME_SERVERS "SELECT hostgroup_id, hostname, port, CASE status WHEN 0 THEN \"ONLINE\" WHEN 1 THEN \"SHUNNED\" WHEN 2 THEN \"OFFLINE_SOFT\" WHEN 3 THEN \"OFFLINE_HARD\" WHEN 4 THEN \"SHUNNED\" END status, weight, compression, max_connections, max_replication_lag, use_ssl, max_latency_ms, comment FROM pgsql_servers ORDER BY hostgroup_id, hostname, port"
5261

5362
#define MYHGM_PgSQL_HOSTGROUP_ATTRIBUTES "CREATE TABLE pgsql_hostgroup_attributes (hostgroup_id INT NOT NULL PRIMARY KEY , max_num_online_servers INT CHECK (max_num_online_servers>=0 AND max_num_online_servers <= 1000000) NOT NULL DEFAULT 1000000 , autocommit INT CHECK (autocommit IN (-1, 0, 1)) NOT NULL DEFAULT -1 , free_connections_pct INT CHECK (free_connections_pct >= 0 AND free_connections_pct <= 100) NOT NULL DEFAULT 10 , init_connect VARCHAR NOT NULL DEFAULT '' , multiplex INT CHECK (multiplex IN (0, 1)) NOT NULL DEFAULT 1 , connection_warming INT CHECK (connection_warming IN (0, 1)) NOT NULL DEFAULT 0 , throttle_connections_per_sec INT CHECK (throttle_connections_per_sec >= 1 AND throttle_connections_per_sec <= 1000000) NOT NULL DEFAULT 1000000 , ignore_session_variables VARCHAR CHECK (JSON_VALID(ignore_session_variables) OR ignore_session_variables = '') NOT NULL DEFAULT '' , hostgroup_settings VARCHAR CHECK (JSON_VALID(hostgroup_settings) OR hostgroup_settings = '') NOT NULL DEFAULT '' , servers_defaults VARCHAR CHECK (JSON_VALID(servers_defaults) OR servers_defaults = '') NOT NULL DEFAULT '' , comment VARCHAR NOT NULL DEFAULT '')"
@@ -379,6 +388,33 @@ struct PgSQL_srv_opts_t {
379388
int32_t use_ssl;
380389
};
381390

391+
/**
392+
* @brief AWS Aurora PostgreSQL configuration info
393+
* @details Stores configuration for each Aurora PostgreSQL hostgroup pair
394+
*/
395+
class PgSQL_AWS_Aurora_Info {
396+
public:
397+
int writer_hostgroup;
398+
int reader_hostgroup;
399+
int aurora_port;
400+
int max_lag_ms;
401+
int add_lag_ms;
402+
int min_lag_ms;
403+
int lag_num_checks;
404+
int check_interval_ms;
405+
int check_timeout_ms;
406+
bool active;
407+
bool __active; // temporary flag for tracking during regeneration
408+
int writer_is_also_reader;
409+
int new_reader_weight;
410+
char *domain_name;
411+
char *comment;
412+
413+
PgSQL_AWS_Aurora_Info(int w, int r, int _port, char *_domain, int maxl, int al, int minl, int lnc, int ci, int ct, bool _a, int wiar, int nrw, char *c);
414+
bool update(int r, int _port, char *_domain, int maxl, int al, int minl, int lnc, int ci, int ct, bool _a, int wiar, int nrw, char *c);
415+
~PgSQL_AWS_Aurora_Info();
416+
};
417+
382418
class PgSQL_HostGroups_Manager : public Base_HostGroups_Manager<PgSQL_HGC> {
383419
#if 0
384420
SQLite3DB *admindb;
@@ -547,6 +583,13 @@ class PgSQL_HostGroups_Manager : public Base_HostGroups_Manager<PgSQL_HGC> {
547583
*/
548584
SQLite3_result *incoming_replication_hostgroups;
549585

586+
// AWS Aurora PostgreSQL
587+
void generate_pgsql_aws_aurora_hostgroups_table();
588+
SQLite3_result *incoming_aws_aurora_hostgroups;
589+
590+
pthread_mutex_t AWS_Aurora_Info_mutex;
591+
std::map<int, PgSQL_AWS_Aurora_Info*> AWS_Aurora_Info_Map;
592+
550593
void generate_pgsql_hostgroup_attributes_table();
551594
SQLite3_result *incoming_hostgroup_attributes;
552595

@@ -839,6 +882,17 @@ class PgSQL_HostGroups_Manager : public Base_HostGroups_Manager<PgSQL_HGC> {
839882
void unshun_server_all_hostgroups(const char * address, uint16_t port, time_t t, int max_wait_sec, unsigned int *skip_hid);
840883
PgSQL_SrvC* find_server_in_hg(unsigned int _hid, const std::string& addr, int port);
841884

885+
// AWS Aurora PostgreSQL methods
886+
bool aws_aurora_replication_lag_action(int _whid, int _rhid, char *server_id, float current_replication_lag_ms, bool enable, bool is_writer, bool verbose=true);
887+
void update_aws_aurora_set_writer(int _whid, int _rhid, char *server_id, bool verbose=true);
888+
void update_aws_aurora_set_reader(int _whid, int _rhid, char *server_id);
889+
/**
890+
* @brief Updates the resultset and corresponding checksum used by Monitor for AWS Aurora PostgreSQL.
891+
* @param lock Whether if both 'AWS_Aurora_Info_mutex' and 'PgSQL_Monitor::aws_aurora_mutex' mutexes should
892+
* be acquired before the update takes place or not.
893+
*/
894+
void update_aws_aurora_hosts_monitor_resultset(bool lock=false);
895+
842896
private:
843897
void update_hostgroup_manager_mappings();
844898
uint64_t get_pgsql_servers_checksum(SQLite3_result* runtime_pgsql_servers = nullptr);

include/PgSQL_Monitor.hpp

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <cassert>
1010
#include <mutex>
1111
#include <vector>
12+
#include <map>
13+
#include <string>
1214

1315
#define MONITOR_SQLITE_TABLE_PGSQL_SERVER_CONNECT_LOG "CREATE TABLE pgsql_server_connect_log (hostname VARCHAR NOT NULL , port INT NOT NULL DEFAULT 3306 , time_start_us INT NOT NULL DEFAULT 0 , connect_success_time_us INT DEFAULT 0 , connect_error VARCHAR , PRIMARY KEY (hostname, port, time_start_us))"
1416

@@ -20,6 +22,19 @@
2022

2123
#define MONITOR_SQLITE_TABLE_PROXYSQL_SERVERS "CREATE TABLE proxysql_servers (hostname VARCHAR NOT NULL , port INT NOT NULL DEFAULT 6032 , weight INT CHECK (weight >= 0) NOT NULL DEFAULT 0 , comment VARCHAR NOT NULL DEFAULT '' , PRIMARY KEY (hostname, port) )"
2224

25+
// AWS Aurora PostgreSQL monitoring tables
26+
#define MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_LOG "CREATE TABLE pgsql_server_aws_aurora_log (hostname VARCHAR NOT NULL , port INT NOT NULL DEFAULT 5432 , time_start_us INT NOT NULL DEFAULT 0 , success_time_us INT DEFAULT 0 , error VARCHAR , server_id VARCHAR NOT NULL DEFAULT '' , session_id VARCHAR , last_update_timestamp VARCHAR , replica_lag_in_msec INT NOT NULL DEFAULT 0 , estimated_lag_ms INT NOT NULL DEFAULT 0 , PRIMARY KEY (hostname, port, time_start_us, server_id))"
27+
28+
#define MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_CHECK_STATUS "CREATE TABLE pgsql_server_aws_aurora_check_status (writer_hostgroup INT NOT NULL , hostname VARCHAR NOT NULL , port INT NOT NULL DEFAULT 5432 , last_checked_at VARCHAR , checks_tot INT NOT NULL DEFAULT 0 , checks_ok INT NOT NULL DEFAULT 0 , last_error VARCHAR , PRIMARY KEY (writer_hostgroup, hostname, port))"
29+
30+
#define MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_FAILOVERS "CREATE TABLE pgsql_server_aws_aurora_failovers (writer_hostgroup INT NOT NULL , hostname VARCHAR NOT NULL , inserted_at VARCHAR NOT NULL)"
31+
32+
#define PGSQL_AWS_Aurora_Nentries 150
33+
34+
// Forward declarations
35+
class PgSQL_AWS_Aurora_monitor_node;
36+
class PgSQL_AWS_Aurora_status_entry;
37+
2338
struct PgSQL_Monitor {
2439
// @brief Flags if monitoring threads should be shutdown.
2540
bool shutdown = false;
@@ -54,6 +69,18 @@ struct PgSQL_Monitor {
5469
const_cast<char*>("pgsql_server_read_only_log"),
5570
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_READ_ONLY_LOG)
5671
},
72+
{
73+
const_cast<char*>("pgsql_server_aws_aurora_log"),
74+
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_LOG)
75+
},
76+
{
77+
const_cast<char*>("pgsql_server_aws_aurora_check_status"),
78+
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_CHECK_STATUS)
79+
},
80+
{
81+
const_cast<char*>("pgsql_server_aws_aurora_failovers"),
82+
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_FAILOVERS)
83+
},
5784
};
5885

5986
std::vector<table_def_t> tables_defs_monitor_internal {
@@ -63,7 +90,24 @@ struct PgSQL_Monitor {
6390
}
6491
};
6592

93+
// AWS Aurora PostgreSQL monitoring members - placed at end to avoid initialization issues
94+
///////////////////////////////////////////////////////////////////////////
95+
pthread_mutex_t aws_aurora_mutex; // initialized in constructor like MySQL
96+
SQLite3_result* AWS_Aurora_Hosts_resultset;
97+
uint64_t AWS_Aurora_Hosts_resultset_checksum;
98+
std::map<std::string, PgSQL_AWS_Aurora_monitor_node*> AWS_Aurora_Hosts_Map;
99+
///////////////////////////////////////////////////////////////////////////
100+
66101
PgSQL_Monitor();
102+
~PgSQL_Monitor();
103+
104+
// AWS Aurora PostgreSQL methods
105+
unsigned int estimate_lag(char* server_id, PgSQL_AWS_Aurora_status_entry** aase, unsigned int idx,
106+
unsigned int add_lag_ms, unsigned int min_lag_ms, unsigned int lag_num_checks);
107+
void evaluate_pgsql_aws_aurora_results(unsigned int wHG, unsigned int rHG,
108+
PgSQL_AWS_Aurora_status_entry** lasts_ase, unsigned int ase_idx,
109+
unsigned int max_latency_ms, unsigned int add_lag_ms, unsigned int min_lag_ms, unsigned int lag_num_checks);
110+
bool server_responds_to_ping(const char* addr, int port);
67111
};
68112

69113
struct pgsql_conn_t {
@@ -74,6 +118,65 @@ struct pgsql_conn_t {
74118
mf_unique_ptr<char> err {};
75119
};
76120

121+
/**
122+
* @brief Represents a single row from aurora_replica_status() function
123+
* @details PostgreSQL Aurora equivalent of AWS_Aurora_replica_host_status_entry
124+
*/
125+
class PgSQL_AWS_Aurora_replica_host_status_entry {
126+
public:
127+
char* server_id = nullptr;
128+
char* session_id = nullptr;
129+
char* last_update_timestamp = nullptr;
130+
float replica_lag_ms = 0.0;
131+
unsigned int estimated_lag_ms = 0;
132+
bool is_current_master = false;
133+
PgSQL_AWS_Aurora_replica_host_status_entry(char* serid, char* sessid, char* lut, float rlm, bool is_master);
134+
PgSQL_AWS_Aurora_replica_host_status_entry(char* serid, char* sessid, char* lut, const char* rlm, bool is_master);
135+
~PgSQL_AWS_Aurora_replica_host_status_entry();
136+
};
137+
138+
/**
139+
* @brief Represents a single check executed against a single Aurora node
140+
* @details Can contain several PgSQL_AWS_Aurora_replica_host_status_entry
141+
*/
142+
class PgSQL_AWS_Aurora_status_entry {
143+
public:
144+
unsigned long long start_time;
145+
unsigned long long check_time;
146+
char* error;
147+
std::vector<PgSQL_AWS_Aurora_replica_host_status_entry*>* host_statuses;
148+
PgSQL_AWS_Aurora_status_entry(unsigned long long st, unsigned long long ct, char* e);
149+
void add_host_status(PgSQL_AWS_Aurora_replica_host_status_entry* hs);
150+
~PgSQL_AWS_Aurora_status_entry();
151+
};
152+
153+
/**
154+
* @brief Represents a single Aurora node where checks are executed
155+
* @details A single node will have a PgSQL_AWS_Aurora_status_entry per check
156+
*/
157+
class PgSQL_AWS_Aurora_monitor_node {
158+
private:
159+
int idx_last_entry;
160+
public:
161+
char* addr;
162+
int port;
163+
unsigned int writer_hostgroup;
164+
uint64_t num_checks_tot;
165+
uint64_t num_checks_ok;
166+
time_t last_checked_at;
167+
PgSQL_AWS_Aurora_status_entry* last_entries[PGSQL_AWS_Aurora_Nentries];
168+
PgSQL_AWS_Aurora_monitor_node(char* _a, int _p, int _whg);
169+
~PgSQL_AWS_Aurora_monitor_node();
170+
bool add_entry(PgSQL_AWS_Aurora_status_entry* ase);
171+
PgSQL_AWS_Aurora_status_entry* last_entry() {
172+
if (idx_last_entry == -1) return nullptr;
173+
return last_entries[idx_last_entry];
174+
}
175+
};
176+
77177
void* PgSQL_monitor_scheduler_thread();
178+
void* PgSQL_monitor_AWS_Aurora_thread(void* arg);
179+
void* PgSQL_monitor_AWS_Aurora_thread_HG(void* arg);
180+
void* PgSQL_monitor_aws_aurora(void* arg);
78181

79182
#endif

include/ProxySQL_Admin_Tables_Definitions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@
221221

222222
#define ADMIN_SQLITE_TABLE_RUNTIME_MYSQL_AWS_AURORA_HOSTGROUPS "CREATE TABLE runtime_mysql_aws_aurora_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND reader_hostgroup>0) , active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , aurora_port INT NOT NUlL DEFAULT 3306 , domain_name VARCHAR NOT NULL CHECK (SUBSTR(domain_name,1,1) = '.') , max_lag_ms INT NOT NULL CHECK (max_lag_ms>= 10 AND max_lag_ms <= 600000) DEFAULT 600000 , check_interval_ms INT NOT NULL CHECK (check_interval_ms >= 100 AND check_interval_ms <= 600000) DEFAULT 1000 , check_timeout_ms INT NOT NULL CHECK (check_timeout_ms >= 80 AND check_timeout_ms <= 3000) DEFAULT 800 , writer_is_also_reader INT CHECK (writer_is_also_reader IN (0,1)) NOT NULL DEFAULT 0 , new_reader_weight INT CHECK (new_reader_weight >= 0 AND new_reader_weight <=10000000) NOT NULL DEFAULT 1 , add_lag_ms INT NOT NULL CHECK (add_lag_ms >= 0 AND add_lag_ms <= 600000) DEFAULT 30 , min_lag_ms INT NOT NULL CHECK (min_lag_ms >= 0 AND min_lag_ms <= 600000) DEFAULT 30 , lag_num_checks INT NOT NULL CHECK (lag_num_checks >= 1 AND lag_num_checks <= 16) DEFAULT 1 , comment VARCHAR , UNIQUE (reader_hostgroup))"
223223

224+
// AWS Aurora PostgreSQL
225+
#define ADMIN_SQLITE_TABLE_PGSQL_AWS_AURORA_HOSTGROUPS "CREATE TABLE pgsql_aws_aurora_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND reader_hostgroup>0) , active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , aurora_port INT NOT NULL DEFAULT 5432 , domain_name VARCHAR NOT NULL CHECK (SUBSTR(domain_name,1,1) = '.') , max_lag_ms INT NOT NULL CHECK (max_lag_ms>= 10 AND max_lag_ms <= 600000) DEFAULT 600000 , check_interval_ms INT NOT NULL CHECK (check_interval_ms >= 100 AND check_interval_ms <= 600000) DEFAULT 1000 , check_timeout_ms INT NOT NULL CHECK (check_timeout_ms >= 80 AND check_timeout_ms <= 3000) DEFAULT 800 , writer_is_also_reader INT CHECK (writer_is_also_reader IN (0,1)) NOT NULL DEFAULT 0 , new_reader_weight INT CHECK (new_reader_weight >= 0 AND new_reader_weight <=10000000) NOT NULL DEFAULT 1 , add_lag_ms INT NOT NULL CHECK (add_lag_ms >= 0 AND add_lag_ms <= 600000) DEFAULT 30 , min_lag_ms INT NOT NULL CHECK (min_lag_ms >= 0 AND min_lag_ms <= 600000) DEFAULT 30 , lag_num_checks INT NOT NULL CHECK (lag_num_checks >= 1 AND lag_num_checks <= 16) DEFAULT 1 , comment VARCHAR , UNIQUE (reader_hostgroup))"
226+
227+
#define ADMIN_SQLITE_TABLE_RUNTIME_PGSQL_AWS_AURORA_HOSTGROUPS "CREATE TABLE runtime_pgsql_aws_aurora_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND reader_hostgroup>0) , active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , aurora_port INT NOT NULL DEFAULT 5432 , domain_name VARCHAR NOT NULL CHECK (SUBSTR(domain_name,1,1) = '.') , max_lag_ms INT NOT NULL CHECK (max_lag_ms>= 10 AND max_lag_ms <= 600000) DEFAULT 600000 , check_interval_ms INT NOT NULL CHECK (check_interval_ms >= 100 AND check_interval_ms <= 600000) DEFAULT 1000 , check_timeout_ms INT NOT NULL CHECK (check_timeout_ms >= 80 AND check_timeout_ms <= 3000) DEFAULT 800 , writer_is_also_reader INT CHECK (writer_is_also_reader IN (0,1)) NOT NULL DEFAULT 0 , new_reader_weight INT CHECK (new_reader_weight >= 0 AND new_reader_weight <=10000000) NOT NULL DEFAULT 1 , add_lag_ms INT NOT NULL CHECK (add_lag_ms >= 0 AND add_lag_ms <= 600000) DEFAULT 30 , min_lag_ms INT NOT NULL CHECK (min_lag_ms >= 0 AND min_lag_ms <= 600000) DEFAULT 30 , lag_num_checks INT NOT NULL CHECK (lag_num_checks >= 1 AND lag_num_checks <= 16) DEFAULT 1 , comment VARCHAR , UNIQUE (reader_hostgroup))"
228+
224229
#define ADMIN_SQLITE_TABLE_MYSQL_HOSTGROUP_ATTRIBUTES_V2_5_0 "CREATE TABLE mysql_hostgroup_attributes (hostgroup_id INT NOT NULL PRIMARY KEY , max_num_online_servers INT CHECK (max_num_online_servers>=0 AND max_num_online_servers <= 1000000) NOT NULL DEFAULT 1000000 , autocommit INT CHECK (autocommit IN (-1, 0, 1)) NOT NULL DEFAULT -1 , free_connections_pct INT CHECK (free_connections_pct >= 0 AND free_connections_pct <= 100) NOT NULL DEFAULT 10 , init_connect VARCHAR NOT NULL DEFAULT '' , multiplex INT CHECK (multiplex IN (0, 1)) NOT NULL DEFAULT 1 , connection_warming INT CHECK (connection_warming IN (0, 1)) NOT NULL DEFAULT 0 , throttle_connections_per_sec INT CHECK (throttle_connections_per_sec >= 1 AND throttle_connections_per_sec <= 1000000) NOT NULL DEFAULT 1000000 , ignore_session_variables VARCHAR CHECK (JSON_VALID(ignore_session_variables) OR ignore_session_variables = '') NOT NULL DEFAULT '' , comment VARCHAR NOT NULL DEFAULT '')"
225230

226231
#define ADMIN_SQLITE_TABLE_MYSQL_HOSTGROUP_ATTRIBUTES_V2_5_2 "CREATE TABLE mysql_hostgroup_attributes (hostgroup_id INT NOT NULL PRIMARY KEY , max_num_online_servers INT CHECK (max_num_online_servers>=0 AND max_num_online_servers <= 1000000) NOT NULL DEFAULT 1000000 , autocommit INT CHECK (autocommit IN (-1, 0, 1)) NOT NULL DEFAULT -1 , free_connections_pct INT CHECK (free_connections_pct >= 0 AND free_connections_pct <= 100) NOT NULL DEFAULT 10 , init_connect VARCHAR NOT NULL DEFAULT '' , multiplex INT CHECK (multiplex IN (0, 1)) NOT NULL DEFAULT 1 , connection_warming INT CHECK (connection_warming IN (0, 1)) NOT NULL DEFAULT 0 , throttle_connections_per_sec INT CHECK (throttle_connections_per_sec >= 1 AND throttle_connections_per_sec <= 1000000) NOT NULL DEFAULT 1000000 , ignore_session_variables VARCHAR CHECK (JSON_VALID(ignore_session_variables) OR ignore_session_variables = '') NOT NULL DEFAULT '' , servers_defaults VARCHAR CHECK (JSON_VALID(servers_defaults) OR servers_defaults = '') NOT NULL DEFAULT '' , comment VARCHAR NOT NULL DEFAULT '')"

include/proxysql_admin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,12 @@ struct peer_mysql_servers_v2_t {
200200
struct incoming_pgsql_servers_t {
201201
SQLite3_result* incoming_pgsql_servers_v2 = NULL;
202202
SQLite3_result* incoming_replication_hostgroups = NULL;
203+
SQLite3_result* incoming_aurora_hostgroups = NULL;
203204
SQLite3_result* incoming_hostgroup_attributes = NULL;
204205
SQLite3_result* runtime_pgsql_servers = NULL;
205206

206207
incoming_pgsql_servers_t();
207-
incoming_pgsql_servers_t(SQLite3_result*, SQLite3_result*, SQLite3_result*, SQLite3_result*);
208+
incoming_pgsql_servers_t(SQLite3_result*, SQLite3_result*, SQLite3_result*, SQLite3_result*, SQLite3_result*);
208209
};
209210

210211
// Separate structs for runtime pgsql server and pgsql server v2 to avoid human error

0 commit comments

Comments
 (0)