Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions include/PgSQL_HostGroups_Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
#endif /* DEBUG */
#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))"

// AWS Aurora PostgreSQL hostgroups table definition
#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) , " \
"active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , aurora_port INT NOT NULL DEFAULT 5432 , domain_name VARCHAR NOT NULL DEFAULT '' , " \
"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 NOT NULL DEFAULT '' , UNIQUE (reader_hostgroup))"

#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"

#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 '')"
Expand Down Expand Up @@ -379,6 +388,33 @@ struct PgSQL_srv_opts_t {
int32_t use_ssl;
};

/**
* @brief AWS Aurora PostgreSQL configuration info
* @details Stores configuration for each Aurora PostgreSQL hostgroup pair
*/
class PgSQL_AWS_Aurora_Info {
public:
int writer_hostgroup;
int reader_hostgroup;
int aurora_port;
int max_lag_ms;
int add_lag_ms;
int min_lag_ms;
int lag_num_checks;
int check_interval_ms;
int check_timeout_ms;
bool active;
bool __active; // temporary flag for tracking during regeneration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Identifiers that contain a double underscore are reserved for the C++ implementation. Using them can lead to undefined behavior. Please rename __active to a non-reserved name like _active or active_.

    bool _active;  // temporary flag for tracking during regeneration

int writer_is_also_reader;
int new_reader_weight;
char *domain_name;
char *comment;
Comment on lines +410 to +411

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For new classes like PgSQL_AWS_Aurora_Info, consider using std::string for members like domain_name and comment instead of char*. std::string handles its own memory management, which prevents memory leaks and makes the code safer and easier to maintain. This would eliminate the need for manual strdup and free calls.

    std::string domain_name;
    std::string comment;


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);
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);
~PgSQL_AWS_Aurora_Info();
};

class PgSQL_HostGroups_Manager : public Base_HostGroups_Manager<PgSQL_HGC> {
#if 0
SQLite3DB *admindb;
Expand Down Expand Up @@ -547,6 +583,13 @@ class PgSQL_HostGroups_Manager : public Base_HostGroups_Manager<PgSQL_HGC> {
*/
SQLite3_result *incoming_replication_hostgroups;

// AWS Aurora PostgreSQL
void generate_pgsql_aws_aurora_hostgroups_table();
SQLite3_result *incoming_aws_aurora_hostgroups;

pthread_mutex_t AWS_Aurora_Info_mutex;
std::map<int, PgSQL_AWS_Aurora_Info*> AWS_Aurora_Info_Map;

void generate_pgsql_hostgroup_attributes_table();
SQLite3_result *incoming_hostgroup_attributes;

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

// AWS Aurora PostgreSQL methods
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);
void update_aws_aurora_set_writer(int _whid, int _rhid, char *server_id, bool verbose=true);
void update_aws_aurora_set_reader(int _whid, int _rhid, char *server_id);
/**
* @brief Updates the resultset and corresponding checksum used by Monitor for AWS Aurora PostgreSQL.
* @param lock Whether if both 'AWS_Aurora_Info_mutex' and 'PgSQL_Monitor::aws_aurora_mutex' mutexes should
* be acquired before the update takes place or not.
*/
void update_aws_aurora_hosts_monitor_resultset(bool lock=false);

private:
void update_hostgroup_manager_mappings();
uint64_t get_pgsql_servers_checksum(SQLite3_result* runtime_pgsql_servers = nullptr);
Expand Down
109 changes: 109 additions & 0 deletions include/PgSQL_Monitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <cassert>
#include <mutex>
#include <vector>
#include <map>
#include <string>

#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))"

Expand All @@ -20,6 +22,20 @@

#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) )"

// AWS Aurora PostgreSQL monitoring tables
#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))"

#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))"

#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)"

#define PGSQL_AWS_Aurora_Nentries 150

// Forward declarations
class PgSQL_AWS_Aurora_monitor_node;
class PgSQL_AWS_Aurora_status_entry;
class PgSQL_Monitor_Connection_Pool;

struct PgSQL_Monitor {
// @brief Flags if monitoring threads should be shutdown.
bool shutdown = false;
Expand Down Expand Up @@ -54,6 +70,18 @@ struct PgSQL_Monitor {
const_cast<char*>("pgsql_server_read_only_log"),
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_READ_ONLY_LOG)
},
{
const_cast<char*>("pgsql_server_aws_aurora_log"),
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_LOG)
},
{
const_cast<char*>("pgsql_server_aws_aurora_check_status"),
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_CHECK_STATUS)
},
{
const_cast<char*>("pgsql_server_aws_aurora_failovers"),
const_cast<char*>(MONITOR_SQLITE_TABLE_PGSQL_SERVER_AWS_AURORA_FAILOVERS)
},
};

std::vector<table_def_t> tables_defs_monitor_internal {
Expand All @@ -63,7 +91,29 @@ struct PgSQL_Monitor {
}
};

// AWS Aurora PostgreSQL monitoring members - placed at end to avoid initialization issues
///////////////////////////////////////////////////////////////////////////
pthread_mutex_t aws_aurora_mutex; // initialized in constructor like MySQL
SQLite3_result* AWS_Aurora_Hosts_resultset;
uint64_t AWS_Aurora_Hosts_resultset_checksum;
std::map<std::string, PgSQL_AWS_Aurora_monitor_node*> AWS_Aurora_Hosts_Map;
PgSQL_Monitor_Connection_Pool* My_Conn_Pool; // Connection pool for Aurora monitoring
///////////////////////////////////////////////////////////////////////////

PgSQL_Monitor();
~PgSQL_Monitor();

// AWS Aurora PostgreSQL methods
unsigned int estimate_lag(char* server_id, PgSQL_AWS_Aurora_status_entry** aase, unsigned int idx,
unsigned int add_lag_ms, unsigned int min_lag_ms, unsigned int lag_num_checks);
void evaluate_pgsql_aws_aurora_results(unsigned int wHG, unsigned int rHG,
PgSQL_AWS_Aurora_status_entry** lasts_ase, unsigned int ase_idx,
unsigned int max_latency_ms, unsigned int add_lag_ms, unsigned int min_lag_ms, unsigned int lag_num_checks);
bool server_responds_to_ping(const char* addr, int port);

// Populate AWS Aurora monitoring tables
void populate_monitor_pgsql_server_aws_aurora_log();
void populate_monitor_pgsql_server_aws_aurora_check_status();
};

struct pgsql_conn_t {
Expand All @@ -74,6 +124,65 @@ struct pgsql_conn_t {
mf_unique_ptr<char> err {};
};

/**
* @brief Represents a single row from aurora_replica_status() function
* @details PostgreSQL Aurora equivalent of AWS_Aurora_replica_host_status_entry
*/
class PgSQL_AWS_Aurora_replica_host_status_entry {
public:
char* server_id = nullptr;
char* session_id = nullptr;
char* last_update_timestamp = nullptr;
float replica_lag_ms = 0.0;
unsigned int estimated_lag_ms = 0;
bool is_current_master = false;
PgSQL_AWS_Aurora_replica_host_status_entry(char* serid, char* sessid, char* lut, float rlm, bool is_master);
PgSQL_AWS_Aurora_replica_host_status_entry(char* serid, char* sessid, char* lut, const char* rlm, bool is_master);
~PgSQL_AWS_Aurora_replica_host_status_entry();
};

/**
* @brief Represents a single check executed against a single Aurora node
* @details Can contain several PgSQL_AWS_Aurora_replica_host_status_entry
*/
class PgSQL_AWS_Aurora_status_entry {
public:
unsigned long long start_time;
unsigned long long check_time;
char* error;
std::vector<PgSQL_AWS_Aurora_replica_host_status_entry*>* host_statuses;
PgSQL_AWS_Aurora_status_entry(unsigned long long st, unsigned long long ct, char* e);
void add_host_status(PgSQL_AWS_Aurora_replica_host_status_entry* hs);
~PgSQL_AWS_Aurora_status_entry();
};

/**
* @brief Represents a single Aurora node where checks are executed
* @details A single node will have a PgSQL_AWS_Aurora_status_entry per check
*/
class PgSQL_AWS_Aurora_monitor_node {
private:
int idx_last_entry;
public:
char* addr;
int port;
unsigned int writer_hostgroup;
uint64_t num_checks_tot;
uint64_t num_checks_ok;
time_t last_checked_at;
PgSQL_AWS_Aurora_status_entry* last_entries[PGSQL_AWS_Aurora_Nentries];
PgSQL_AWS_Aurora_monitor_node(char* _a, int _p, int _whg);
~PgSQL_AWS_Aurora_monitor_node();
bool add_entry(PgSQL_AWS_Aurora_status_entry* ase);
PgSQL_AWS_Aurora_status_entry* last_entry() {
if (idx_last_entry == -1) return nullptr;
return last_entries[idx_last_entry];
}
};

void* PgSQL_monitor_scheduler_thread();
void* PgSQL_monitor_AWS_Aurora_thread(void* arg);
void* PgSQL_monitor_AWS_Aurora_thread_HG(void* arg);
void* PgSQL_monitor_aws_aurora(void* arg);

#endif
5 changes: 5 additions & 0 deletions include/ProxySQL_Admin_Tables_Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@

#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))"

// AWS Aurora PostgreSQL
#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))"

#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))"

#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 '')"

#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 '')"
Expand Down
3 changes: 2 additions & 1 deletion include/proxysql_admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ struct peer_mysql_servers_v2_t {
struct incoming_pgsql_servers_t {
SQLite3_result* incoming_pgsql_servers_v2 = NULL;
SQLite3_result* incoming_replication_hostgroups = NULL;
SQLite3_result* incoming_aurora_hostgroups = NULL;
SQLite3_result* incoming_hostgroup_attributes = NULL;
SQLite3_result* runtime_pgsql_servers = NULL;

incoming_pgsql_servers_t();
incoming_pgsql_servers_t(SQLite3_result*, SQLite3_result*, SQLite3_result*, SQLite3_result*);
incoming_pgsql_servers_t(SQLite3_result*, SQLite3_result*, SQLite3_result*, SQLite3_result*, SQLite3_result*);
};

// Separate structs for runtime pgsql server and pgsql server v2 to avoid human error
Expand Down
Loading