Remove not relevant servers tables from PgSQL

v2.x_pg_PrepStmtBase_240714
René Cannaò 2 years ago
parent cf311557dd
commit a0172c4803

@ -48,22 +48,6 @@ namespace nlohmann { class json; }
#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','innodb_read_only','super_read_only','read_only|innodb_read_only','read_only&innodb_read_only')) NOT NULL DEFAULT 'read_only' , comment VARCHAR NOT NULL DEFAULT '' , UNIQUE (reader_hostgroup))"
#define MYHGM_PgSQL_GROUP_REPLICATION_HOSTGROUPS "CREATE TABLE pgsql_group_replication_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , backup_writer_hostgroup INT CHECK (backup_writer_hostgroup>=0 AND backup_writer_hostgroup<>writer_hostgroup) NOT NULL , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND backup_writer_hostgroup<>reader_hostgroup AND reader_hostgroup>0) , offline_hostgroup INT NOT NULL CHECK (offline_hostgroup<>writer_hostgroup AND offline_hostgroup<>reader_hostgroup AND backup_writer_hostgroup<>offline_hostgroup AND offline_hostgroup>=0) , active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , max_writers INT NOT NULL CHECK (max_writers >= 0) DEFAULT 1 , writer_is_also_reader INT CHECK (writer_is_also_reader IN (0,1,2)) NOT NULL DEFAULT 0 , max_transactions_behind INT CHECK (max_transactions_behind>=0) NOT NULL DEFAULT 0 , comment VARCHAR , UNIQUE (reader_hostgroup) , UNIQUE (offline_hostgroup) , UNIQUE (backup_writer_hostgroup))"
#define MYHGM_PgSQL_GALERA_HOSTGROUPS "CREATE TABLE pgsql_galera_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY , backup_writer_hostgroup INT CHECK (backup_writer_hostgroup>=0 AND backup_writer_hostgroup<>writer_hostgroup) NOT NULL , reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND backup_writer_hostgroup<>reader_hostgroup AND reader_hostgroup>0) , offline_hostgroup INT NOT NULL CHECK (offline_hostgroup<>writer_hostgroup AND offline_hostgroup<>reader_hostgroup AND backup_writer_hostgroup<>offline_hostgroup AND offline_hostgroup>=0) , active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1 , max_writers INT NOT NULL CHECK (max_writers >= 0) DEFAULT 1 , writer_is_also_reader INT CHECK (writer_is_also_reader IN (0,1,2)) NOT NULL DEFAULT 0 , max_transactions_behind INT CHECK (max_transactions_behind>=0) NOT NULL DEFAULT 0 , comment VARCHAR , UNIQUE (reader_hostgroup) , UNIQUE (offline_hostgroup) , UNIQUE (backup_writer_hostgroup))"
#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 3306 , 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 ," \
"UNIQUE (reader_hostgroup))"
#define MYHGM_GEN_ADMIN_RUNTIME_SERVERS "SELECT hostgroup_id, hostname, port, gtid_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 '')"
@ -641,7 +625,6 @@ class PgSQL_HostGroups_Manager {
void purge_pgsql_servers_table();
void generate_pgsql_servers_table(int *_onlyhg=NULL);
void generate_pgsql_replication_hostgroups_table();
PgSQL_Galera_Info *get_galera_node_info(int hostgroup);
/**
* @brief This resultset holds the current values for 'runtime_pgsql_servers' computed by either latest
@ -676,35 +659,6 @@ class PgSQL_HostGroups_Manager {
*/
SQLite3_result *incoming_replication_hostgroups;
void generate_pgsql_group_replication_hostgroups_table();
/**
* @brief Regenerates the resultset used by 'MySQL_Monitor' containing the servers to be monitored.
* @details This function is required to be called after any action that results in the addition of a new
* server that 'MySQL_Monitor' should be aware of for 'group_replication', i.e. a server added to the
* hostgroups present in any entry of 'pgsql_group_replication_hostgroups'. E.g:
* - Inside 'generate_pgsql_group_replication_hostgroups_table'.
* - Autodiscovery.
*
* NOTE: This is a common pattern for all the clusters monitoring.
*/
void generate_pgsql_group_replication_hostgroups_monitor_resultset();
SQLite3_result *incoming_group_replication_hostgroups;
pthread_mutex_t Group_Replication_Info_mutex;
std::map<int , PgSQL_Group_Replication_Info *> Group_Replication_Info_Map;
void generate_pgsql_galera_hostgroups_table();
SQLite3_result *incoming_galera_hostgroups;
pthread_mutex_t Galera_Info_mutex;
std::map<int , PgSQL_Galera_Info *> Galera_Info_Map;
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;
@ -738,10 +692,7 @@ class PgSQL_HostGroups_Manager {
std::map<std::string, prometheus::Gauge*>& m_map, unsigned long long value, PgSQL_p_hg_dyn_gauge::metric idx
);
void group_replication_lag_action_set_server_status(PgSQL_HGC* myhgc, char* address, int port, int lag_count, bool enable);
public:
std::mutex galera_set_writer_mutex;
/**
* @brief Mutex used to guard 'pgsql_servers_to_monitor' resulset.
*/
@ -886,9 +837,6 @@ class PgSQL_HostGroups_Manager {
* @brief Update all HGM_TABLES checksums and uses them to update the supplied SpookyHash.
* @details Checksums are the checksums for the following tables:
* - pgsql_replication_hostgroups
* - pgsql_group_replication_hostgroups
* - pgsql_galera_hostgroups
* - pgsql_aws_aurora_hostgroups
* - pgsql_hostgroup_attributes
*
* These checksums are used to compute the global checksum for 'pgsql_servers_v2'.
@ -939,9 +887,6 @@ class PgSQL_HostGroups_Manager {
/**
* @brief Creates a resultset with the current full content of the target table.
* @param string The target table. Valid values are:
* - "pgsql_aws_aurora_hostgroups"
* - "pgsql_galera_hostgroups"
* - "pgsql_group_replication_hostgroups"
* - "pgsql_replication_hostgroups"
* - "pgsql_hostgroup_attributes"
* - "pgsql_servers"
@ -1017,88 +962,6 @@ class PgSQL_HostGroups_Manager {
void set_server_current_latency_us(char *hostname, int port, unsigned int _current_latency_us);
unsigned long long Get_Memory_Stats();
void update_group_replication_set_offline(char *_hostname, int _port, int _writer_hostgroup, char *error);
void update_group_replication_set_read_only(char *_hostname, int _port, int _writer_hostgroup, char *error);
void update_group_replication_set_writer(char *_hostname, int _port, int _writer_hostgroup);
/**
* @brief Tries to add a new server found during GR autodiscovery to the supplied hostgroup.
* @details For adding the new server, several actions are performed:
* 1. Lookup the target server in the corresponding PgSQL_HGC for the supplied hostgroup.
* 2. If server is found, and it's status isn't 'OFFLINE_HARD' do nothing. Otherwise:
* - If server is found as 'OFFLINE_HARD', reset the internal values corresponding to
* 'servers_defaults' values to '-1', update the defaulted values to the ones in its 'PgSQL_HGC', lastly
* re-enable the server and log the action.
* - If server isn't found, create it in the corresponding reader hostgroup of the supplied writer
* hostgroup, setting all 'servers_defaults' params as '-1', log the action.
* - After any of the two previous actions, always regenerate servers data structures.
*
* NOTE: Server data structures regeneration requires:
* 1. Purging the 'pgsql_servers_table' (Lazy removal of 'OFFLINE_HARD' servers.)
* 2. Regenerate the actual 'myhgm::pgsql_servers' table from memory structures.
* 3. Update the 'pgsql_servers' resultset used for monitoring. This resultset is used for general
* monitoring actions like 'ping', 'connect'.
* 4. Regenerate the specific resultset for 'Group Replication' monitoring. This resultset is the way to
* communicate back to the main monitoring thread that servers config has changed, and a new thread
* shall be created with the new servers config. This same principle is used for Aurora.
*
* @param _host Server address.
* @param _port Server port.
* @param _wr_hg Writer hostgroup of the cluster being monitored. Autodiscovered servers are always added
* to the reader hostgroup by default, later monitoring actions will re-position the server is required.
*/
void update_group_replication_add_autodiscovered(const std::string& _host, int _port, int _wr_hg);
void converge_group_replication_config(int _writer_hostgroup);
/**
* @brief Set the supplied server as SHUNNED, this function shall be called
* to 'SHUNNED' those servers which replication lag is bigger than:
* - `mysql_thread___monitor_groupreplication_max_transactions_behind_count`
*
* @details The function automatically handles the appropriate operation to
* perform on the supplied server, based on the supplied 'enable' flag and
* in 'monitor_groupreplication_max_transaction_behind_for_read_only'
* variable. In case the value of the variable is:
*
* * '0' or '2': It's required to search the writer hostgroup for
* finding the supplied server.
* * '1' or '2': It's required to search the reader hostgroup for
* finding the supplied server.
*
* @param _hid The writer hostgroup.
* @param address The server address.
* @param port The server port.
* @param lag_counts The computed lag for the sever.
* @param read_only Boolean specifying the read_only flag value of the server.
* @param enable Boolean specifying if the server needs to be disabled / enabled,
* 'true' for enabling the server if it's 'SHUNNED', 'false' for disabling it.
*/
void group_replication_lag_action(int _hid, char *address, unsigned int port, int lag_counts, bool read_only, bool enable);
void update_galera_set_offline(char *_hostname, int _port, int _writer_hostgroup, char *error, bool soft=false);
void update_galera_set_read_only(char *_hostname, int _port, int _writer_hostgroup, char *error);
void update_galera_set_writer(char *_hostname, int _port, int _writer_hostgroup);
void converge_galera_config(int _writer_hostgroup);
// FIXME : add action functions for AWS Aurora
//void aws_aurora_replication_lag_action(int _whid, int _rhid, char *address, unsigned int port, float current_replication_lag, bool enable, bool verbose=true);
//bool aws_aurora_replication_lag_action(int _whid, int _rhid, char *address, unsigned int port, unsigned int current_replication_lag_us, bool enable, bool is_writer, bool verbose=true);
//void update_aws_aurora_set_writer(int _whid, int _rhid, char *address, unsigned int port, bool verbose=true);
//void update_aws_aurora_set_reader(int _whid, int _rhid, char *_hostname, int _port);
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.
* @details This is required to be called when:
* - The 'pgsql_aws_aurora_hostgroups' table is regenerated (via 'commit').
* - When new servers are discovered, and created in already monitored Aurora clusters.
*
* The resultset holds the servers that are present in 'pgsql_servers' table, and share hostgroups with
* the **active** clusters specified in 'pgsql_aws_aurora_hostgroups'. See query
* 'SELECT_AWS_AURORA_SERVERS_FOR_MONITOR'.
* @param lock Wether if both 'AWS_Aurora_Info_mutex' and 'MySQL_Monitor::aws_aurora_mutex' mutexes should
* be taken or not.
*/
void update_aws_aurora_hosts_monitor_resultset(bool lock=false);
SQLite3_result * get_stats_pgsql_gtid_executed();
void generate_pgsql_gtid_executed_tables();
bool gtid_exists(PgSQL_SrvC *mysrvc, char * gtid_uuid, uint64_t gtid_trxid);

File diff suppressed because it is too large Load Diff

@ -142,9 +142,9 @@ static const vector<string> mysql_servers_tablenames = {
static const vector<string> pgsql_servers_tablenames = {
"pgsql_servers",
"pgsql_replication_hostgroups",
"pgsql_group_replication_hostgroups",
"pgsql_galera_hostgroups",
"pgsql_aws_aurora_hostgroups",
// "pgsql_group_replication_hostgroups",
// "pgsql_galera_hostgroups",
// "pgsql_aws_aurora_hostgroups",
"pgsql_hostgroup_attributes",
};
@ -3298,12 +3298,6 @@ bool ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign
||
strstr(query_no_space, "runtime_pgsql_replication_hostgroups")
||
strstr(query_no_space, "runtime_pgsql_group_replication_hostgroups")
||
strstr(query_no_space, "runtime_pgsql_galera_hostgroups")
||
strstr(query_no_space, "runtime_pgsql_aws_aurora_hostgroups")
||
strstr(query_no_space, "runtime_pgsql_hostgroup_attributes")
) {
runtime_pgsql_servers = true; refresh = true;
@ -12315,150 +12309,6 @@ void ProxySQL_Admin::save_pgsql_servers_runtime_to_database(bool _runtime) {
if (resultset) delete resultset;
resultset = NULL;
// dump pgsql_group_replication_hostgroups
if (_runtime) {
query = (char*)"DELETE FROM main.runtime_pgsql_group_replication_hostgroups";
}
else {
query = (char*)"DELETE FROM main.pgsql_group_replication_hostgroups";
}
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
admindb->execute(query);
resultset = PgHGM->dump_table_pgsql("pgsql_group_replication_hostgroups");
if (resultset) {
int rc;
sqlite3_stmt* statement = NULL;
//sqlite3 *mydb3=admindb->get_db();
char* query = NULL;
if (_runtime) {
query = (char*)"INSERT INTO runtime_pgsql_group_replication_hostgroups(writer_hostgroup,backup_writer_hostgroup,reader_hostgroup,offline_hostgroup,active,max_writers,writer_is_also_reader,max_transactions_behind,comment) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)";
}
else {
query = (char*)"INSERT INTO pgsql_group_replication_hostgroups(writer_hostgroup,backup_writer_hostgroup,reader_hostgroup,offline_hostgroup,active,max_writers,writer_is_also_reader,max_transactions_behind,comment) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)";
}
//rc=(*proxy_sqlite3_prepare_v2)(mydb3, query, -1, &statement, 0);
rc = admindb->prepare_v2(query, &statement);
ASSERT_SQLITE_OK(rc, admindb);
//proxy_info("New pgsql_group_replication_hostgroups table\n");
for (std::vector<SQLite3_row*>::iterator it = resultset->rows.begin(); it != resultset->rows.end(); ++it) {
SQLite3_row* r = *it;
rc = (*proxy_sqlite3_bind_int64)(statement, 1, atoi(r->fields[0])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 2, atoi(r->fields[1])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 3, atoi(r->fields[2])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 4, atoi(r->fields[3])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 5, atoi(r->fields[4])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 6, atoi(r->fields[5])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 7, atoi(r->fields[6])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 8, atoi(r->fields[7])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_text)(statement, 9, r->fields[8], -1, SQLITE_TRANSIENT); ASSERT_SQLITE_OK(rc, admindb);
SAFE_SQLITE3_STEP2(statement);
rc = (*proxy_sqlite3_clear_bindings)(statement); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_reset)(statement); ASSERT_SQLITE_OK(rc, admindb);
}
(*proxy_sqlite3_finalize)(statement);
}
if (resultset) delete resultset;
resultset = NULL;
// dump pgsql_galera_hostgroups
if (_runtime) {
query = (char*)"DELETE FROM main.runtime_pgsql_galera_hostgroups";
}
else {
query = (char*)"DELETE FROM main.pgsql_galera_hostgroups";
}
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
admindb->execute(query);
resultset = PgHGM->dump_table_pgsql("pgsql_galera_hostgroups");
if (resultset) {
int rc;
sqlite3_stmt* statement = NULL;
//sqlite3 *mydb3=admindb->get_db();
char* query = NULL;
if (_runtime) {
query = (char*)"INSERT INTO runtime_pgsql_galera_hostgroups(writer_hostgroup,backup_writer_hostgroup,reader_hostgroup,offline_hostgroup,active,max_writers,writer_is_also_reader,max_transactions_behind,comment) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)";
}
else {
query = (char*)"INSERT INTO pgsql_galera_hostgroups(writer_hostgroup,backup_writer_hostgroup,reader_hostgroup,offline_hostgroup,active,max_writers,writer_is_also_reader,max_transactions_behind,comment) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)";
}
//rc=(*proxy_sqlite3_prepare_v2)(mydb3, query, -1, &statement, 0);
rc = admindb->prepare_v2(query, &statement);
ASSERT_SQLITE_OK(rc, admindb);
//proxy_info("New pgsql_galera_hostgroups table\n");
for (std::vector<SQLite3_row*>::iterator it = resultset->rows.begin(); it != resultset->rows.end(); ++it) {
SQLite3_row* r = *it;
rc = (*proxy_sqlite3_bind_int64)(statement, 1, atoi(r->fields[0])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 2, atoi(r->fields[1])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 3, atoi(r->fields[2])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 4, atoi(r->fields[3])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 5, atoi(r->fields[4])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 6, atoi(r->fields[5])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 7, atoi(r->fields[6])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 8, atoi(r->fields[7])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_text)(statement, 9, r->fields[8], -1, SQLITE_TRANSIENT); ASSERT_SQLITE_OK(rc, admindb);
SAFE_SQLITE3_STEP2(statement);
rc = (*proxy_sqlite3_clear_bindings)(statement); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_reset)(statement); ASSERT_SQLITE_OK(rc, admindb);
}
(*proxy_sqlite3_finalize)(statement);
}
if (resultset) delete resultset;
resultset = NULL;
// dump pgsql_aws_aurora_hostgroups
if (_runtime) {
query = (char*)"DELETE FROM main.runtime_pgsql_aws_aurora_hostgroups";
}
else {
query = (char*)"DELETE FROM main.pgsql_aws_aurora_hostgroups";
}
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
admindb->execute(query);
resultset = PgHGM->dump_table_pgsql("pgsql_aws_aurora_hostgroups");
if (resultset) {
int rc;
sqlite3_stmt* statement = NULL;
//sqlite3 *mydb3=admindb->get_db();
char* query = NULL;
if (_runtime) {
query = (char*)"INSERT INTO runtime_pgsql_aws_aurora_hostgroups(writer_hostgroup,reader_hostgroup,active,aurora_port,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,comment) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14)";
}
else {
query = (char*)"INSERT INTO pgsql_aws_aurora_hostgroups(writer_hostgroup,reader_hostgroup,active,aurora_port,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,comment) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14)";
}
//rc=(*proxy_sqlite3_prepare_v2)(mydb3, query, -1, &statement, 0);
rc = admindb->prepare_v2(query, &statement);
ASSERT_SQLITE_OK(rc, admindb);
//proxy_info("New pgsql_aws_aurora_hostgroups table\n");
for (std::vector<SQLite3_row*>::iterator it = resultset->rows.begin(); it != resultset->rows.end(); ++it) {
SQLite3_row* r = *it;
rc = (*proxy_sqlite3_bind_int64)(statement, 1, atoi(r->fields[0])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 2, atoi(r->fields[1])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 3, atoi(r->fields[2])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 4, atoi(r->fields[3])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_text)(statement, 5, r->fields[4], -1, SQLITE_TRANSIENT); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 6, atoi(r->fields[5])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 7, atoi(r->fields[6])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 8, atoi(r->fields[7])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 9, atoi(r->fields[8])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 10, atoi(r->fields[9])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 11, atoi(r->fields[10])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 12, atoi(r->fields[11])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_int64)(statement, 13, atoi(r->fields[12])); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_bind_text)(statement, 14, r->fields[13], -1, SQLITE_TRANSIENT); ASSERT_SQLITE_OK(rc, admindb);
SAFE_SQLITE3_STEP2(statement);
rc = (*proxy_sqlite3_clear_bindings)(statement); ASSERT_SQLITE_OK(rc, admindb);
rc = (*proxy_sqlite3_reset)(statement); ASSERT_SQLITE_OK(rc, admindb);
}
(*proxy_sqlite3_finalize)(statement);
}
if (resultset) delete resultset;
resultset = NULL;
// dump pgsql_hostgroup_attributes
StrQuery = "DELETE FROM main.";
@ -12842,112 +12692,6 @@ void ProxySQL_Admin::load_pgsql_servers_to_runtime(const incoming_pgsql_servers_
//if (resultset) delete resultset;
//resultset=NULL;
// support for Group Replication, table pgsql_group_replication_hostgroups
// look for invalid combinations
query = (char*)"SELECT a.* FROM pgsql_group_replication_hostgroups a JOIN pgsql_group_replication_hostgroups b ON a.writer_hostgroup=b.reader_hostgroup WHERE b.reader_hostgroup UNION ALL SELECT a.* FROM pgsql_group_replication_hostgroups a JOIN pgsql_group_replication_hostgroups b ON a.writer_hostgroup=b.backup_writer_hostgroup WHERE b.backup_writer_hostgroup UNION ALL SELECT a.* FROM pgsql_group_replication_hostgroups a JOIN pgsql_group_replication_hostgroups b ON a.writer_hostgroup=b.offline_hostgroup WHERE b.offline_hostgroup";
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
admindb->execute_statement(query, &error, &cols, &affected_rows, &resultset);
if (error) {
proxy_error("Error on %s : %s\n", query, error);
}
else {
for (std::vector<SQLite3_row*>::iterator it = resultset->rows.begin(); it != resultset->rows.end(); ++it) {
SQLite3_row* r = *it;
proxy_error("Incompatible entry in pgsql_group_replication_hostgroups will be ignored : ( %s , %s , %s , %s )\n", r->fields[0], r->fields[1], r->fields[2], r->fields[3]);
}
}
if (resultset) delete resultset;
resultset = NULL;
query = (char*)"SELECT a.* FROM pgsql_group_replication_hostgroups a LEFT JOIN pgsql_group_replication_hostgroups b ON (a.writer_hostgroup=b.reader_hostgroup OR a.writer_hostgroup=b.backup_writer_hostgroup OR a.writer_hostgroup=b.offline_hostgroup) WHERE b.reader_hostgroup IS NULL AND b.backup_writer_hostgroup IS NULL AND b.offline_hostgroup IS NULL ORDER BY writer_hostgroup";
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
if (incoming_group_replication_hostgroups == nullptr) {
admindb->execute_statement(query, &error, &cols, &affected_rows, &resultset_group_replication);
}
else {
resultset_group_replication = incoming_group_replication_hostgroups;
}
if (error) {
proxy_error("Error on %s : %s\n", query, error);
}
else {
// Pass the resultset to PgHGM
PgHGM->save_incoming_pgsql_table(resultset_group_replication, "pgsql_group_replication_hostgroups");
}
// support for Galera, table pgsql_galera_hostgroups
// look for invalid combinations
query = (char*)"SELECT a.* FROM pgsql_galera_hostgroups a JOIN pgsql_galera_hostgroups b ON a.writer_hostgroup=b.reader_hostgroup WHERE b.reader_hostgroup UNION ALL SELECT a.* FROM pgsql_galera_hostgroups a JOIN pgsql_galera_hostgroups b ON a.writer_hostgroup=b.backup_writer_hostgroup WHERE b.backup_writer_hostgroup UNION ALL SELECT a.* FROM pgsql_galera_hostgroups a JOIN pgsql_galera_hostgroups b ON a.writer_hostgroup=b.offline_hostgroup WHERE b.offline_hostgroup";
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
admindb->execute_statement(query, &error, &cols, &affected_rows, &resultset);
if (error) {
proxy_error("Error on %s : %s\n", query, error);
}
else {
for (std::vector<SQLite3_row*>::iterator it = resultset->rows.begin(); it != resultset->rows.end(); ++it) {
SQLite3_row* r = *it;
proxy_error("Incompatible entry in pgsql_galera_hostgroups will be ignored : ( %s , %s , %s , %s )\n", r->fields[0], r->fields[1], r->fields[2], r->fields[3]);
}
}
if (resultset) delete resultset;
resultset = NULL;
query = (char*)"SELECT a.* FROM pgsql_galera_hostgroups a LEFT JOIN pgsql_galera_hostgroups b ON (a.writer_hostgroup=b.reader_hostgroup OR a.writer_hostgroup=b.backup_writer_hostgroup OR a.writer_hostgroup=b.offline_hostgroup) WHERE b.reader_hostgroup IS NULL AND b.backup_writer_hostgroup IS NULL AND b.offline_hostgroup IS NULL ORDER BY writer_hostgroup";
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
if (incoming_galera_hostgroups == nullptr) {
admindb->execute_statement(query, &error, &cols, &affected_rows, &resultset_galera);
}
else {
resultset_galera = incoming_galera_hostgroups;
}
if (error) {
proxy_error("Error on %s : %s\n", query, error);
}
else {
// Pass the resultset to PgHGM
PgHGM->save_incoming_pgsql_table(resultset_galera, "pgsql_galera_hostgroups");
}
// support for AWS Aurora, table pgsql_aws_aurora_hostgroups
// look for invalid combinations
query = (char*)"SELECT a.* FROM pgsql_aws_aurora_hostgroups a JOIN pgsql_aws_aurora_hostgroups b ON a.writer_hostgroup=b.reader_hostgroup WHERE b.reader_hostgroup";
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
admindb->execute_statement(query, &error, &cols, &affected_rows, &resultset);
if (error) {
proxy_error("Error on %s : %s\n", query, error);
}
else {
for (std::vector<SQLite3_row*>::iterator it = resultset->rows.begin(); it != resultset->rows.end(); ++it) {
SQLite3_row* r = *it;
proxy_error("Incompatible entry in pgsql_aws_aurora_hostgroups will be ignored : ( %s , %s , %s , %s )\n", r->fields[0], r->fields[1], r->fields[2], r->fields[3]);
}
}
if (resultset) delete resultset;
resultset = NULL;
//#ifdef TEST_AURORA // temporary enabled only for testing purpose
query = (char*)"SELECT a.* FROM pgsql_aws_aurora_hostgroups a LEFT JOIN pgsql_aws_aurora_hostgroups b ON (a.writer_hostgroup=b.reader_hostgroup) WHERE b.reader_hostgroup IS NULL ORDER BY writer_hostgroup";
//#else
// query=(char *)"SELECT a.* FROM pgsql_aws_aurora_hostgroups a WHERE 1=0";
//#endif
proxy_debug(PROXY_DEBUG_ADMIN, 4, "%s\n", query);
if (incoming_aurora_hostgroups == nullptr) {
admindb->execute_statement(query, &error, &cols, &affected_rows, &resultset_aws_aurora);
}
else {
resultset_aws_aurora = incoming_aurora_hostgroups;
}
if (error) {
proxy_error("Error on %s : %s\n", query, error);
}
else {
// Pass the resultset to PgHGM
PgHGM->save_incoming_pgsql_table(resultset_aws_aurora, "pgsql_aws_aurora_hostgroups");
}
// support for hostgroup attributes, table pgsql_hostgroup_attributes
query = (char*)"SELECT * FROM pgsql_hostgroup_attributes ORDER BY hostgroup_id";

@ -1489,113 +1489,6 @@ int ProxySQL_Config::Write_PgSQL_Servers_to_configfile(std::string& data) {
}
}
if (sqlite_resultset)
delete sqlite_resultset;
query = (char*)"SELECT * FROM pgsql_group_replication_hostgroups";
admindb->execute_statement(query, &error, &cols, &affected_rows, &sqlite_resultset);
if (error) {
proxy_error("Error on read from pgsql_group_replication_hostgroups : %s\n", error);
return -1;
}
else {
if (sqlite_resultset) {
data += "pgsql_group_replication_hostgroups:\n(\n";
bool isNext = false;
for (auto r : sqlite_resultset->rows) {
if (isNext)
data += ",\n";
data += "\t{\n";
addField(data, "writer_hostgroup", r->fields[0], "");
addField(data, "backup_writer_hostgroup", r->fields[1], "");
addField(data, "reader_hostgroup", r->fields[2], "");
addField(data, "offline_hostgroup", r->fields[3], "");
addField(data, "active", r->fields[4], "");
addField(data, "max_writers", r->fields[5], "");
addField(data, "writer_is_also_reader", r->fields[6], "");
addField(data, "max_transactions_behind", r->fields[7], "");
addField(data, "comment", r->fields[8]);
data += "\t}";
isNext = true;
}
data += "\n)\n";
}
}
if (sqlite_resultset)
delete sqlite_resultset;
query = (char*)"SELECT * FROM pgsql_galera_hostgroups";
admindb->execute_statement(query, &error, &cols, &affected_rows, &sqlite_resultset);
if (error) {
proxy_error("Error on read from pgsql_galera_hostgroups: %s\n", error);
return -1;
}
else {
if (sqlite_resultset) {
data += "pgsql_galera_hostgroups:\n(\n";
bool isNext = false;
for (auto r : sqlite_resultset->rows) {
if (isNext)
data += ",\n";
data += "\t{\n";
addField(data, "writer_hostgroup", r->fields[0], "");
addField(data, "backup_writer_hostgroup", r->fields[1], "");
addField(data, "reader_hostgroup", r->fields[2], "");
addField(data, "offline_hostgroup", r->fields[3], "");
addField(data, "active", r->fields[4], "");
addField(data, "max_writers", r->fields[5], "");
addField(data, "writer_is_also_reader", r->fields[6], "");
addField(data, "max_transactions_behind", r->fields[7], "");
addField(data, "comment", r->fields[8]);
data += "\t}";
isNext = true;
}
data += "\n)\n";
}
}
if (sqlite_resultset)
delete sqlite_resultset;
query = (char*)"SELECT * FROM pgsql_aws_aurora_hostgroups";
admindb->execute_statement(query, &error, &cols, &affected_rows, &sqlite_resultset);
if (error) {
proxy_error("Error on read from pgsql_aws_aurora_hostgroups: %s\n", error);
return -1;
}
else {
if (sqlite_resultset) {
data += "pgsql_aws_aurora_hostgroups:\n(\n";
bool isNext = false;
for (auto r : sqlite_resultset->rows) {
if (isNext)
data += ",\n";
data += "\t{\n";
addField(data, "writer_hostgroup", r->fields[0], "");
addField(data, "reader_hostgroup", r->fields[1], "");
addField(data, "active", r->fields[2], "");
addField(data, "aurora_port", r->fields[3], "");
addField(data, "domain_name", r->fields[4]);
addField(data, "max_lag_ms", r->fields[5], "");
addField(data, "check_interval_ms", r->fields[6], "");
addField(data, "check_timeout_ms", r->fields[7], "");
addField(data, "writer_is_also_reader", r->fields[8], "");
addField(data, "new_reader_weight", r->fields[9], "");
addField(data, "add_lag_ms", r->fields[10], "");
addField(data, "min_lag_ms", r->fields[11], "");
addField(data, "lag_num_checks", r->fields[12], "");
addField(data, "comment", r->fields[13]);
data += "\t}";
isNext = true;
}
data += "\n)\n";
}
}
if (sqlite_resultset)
delete sqlite_resultset;
@ -1711,155 +1604,6 @@ int ProxySQL_Config::Read_PgSQL_Servers_from_configfile() {
rows++;
}
}
if (root.exists("pgsql_group_replication_hostgroups") == true) {
const Setting& pgsql_group_replication_hostgroups = root["pgsql_group_replication_hostgroups"];
int count = pgsql_group_replication_hostgroups.getLength();
char* q = (char*)"INSERT OR REPLACE INTO pgsql_group_replication_hostgroups (writer_hostgroup, backup_writer_hostgroup, reader_hostgroup, offline_hostgroup, active, max_writers, writer_is_also_reader, max_transactions_behind, comment) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, '%s')";
for (i = 0; i < count; i++) {
const Setting& line = pgsql_group_replication_hostgroups[i];
int writer_hostgroup;
int backup_writer_hostgroup;
int reader_hostgroup;
int offline_hostgroup;
int active = 1; // default
int max_writers;
int writer_is_also_reader;
int max_transactions_behind;
std::string comment = "";
if (line.lookupValue("writer_hostgroup", writer_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_group_replication_hostgroups in config file without a mandatory writer_hostgroup\n");
continue;
}
if (line.lookupValue("backup_writer_hostgroup", backup_writer_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_group_replication_hostgroups in config file without a mandatory backup_writer_hostgroup\n");
continue;
}
if (line.lookupValue("reader_hostgroup", reader_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_group_replication_hostgroups in config file without a mandatory reader_hostgroup\n");
continue;
}
if (line.lookupValue("offline_hostgroup", offline_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_group_replication_hostgroups in config file without a mandatory offline_hostgroup\n");
continue;
}
if (line.lookupValue("max_writers", max_writers) == false) max_writers = 1;
if (line.lookupValue("writer_is_also_reader", writer_is_also_reader) == false) writer_is_also_reader = 0;
if (line.lookupValue("max_transactions_behind", max_transactions_behind) == false) max_transactions_behind = 0;
line.lookupValue("comment", comment);
char* o1 = strdup(comment.c_str());
char* o = escape_string_single_quotes(o1, false);
char* query = (char*)malloc(strlen(q) + strlen(o) + 128); // 128 vs sizeof(int)*8
sprintf(query, q, writer_hostgroup, backup_writer_hostgroup, reader_hostgroup, offline_hostgroup, active, max_writers, writer_is_also_reader, max_transactions_behind, o);
//fprintf(stderr, "%s\n", query);
admindb->execute(query);
if (o != o1) free(o);
free(o1);
free(query);
rows++;
}
}
if (root.exists("pgsql_galera_hostgroups") == true) {
const Setting& pgsql_galera_hostgroups = root["pgsql_galera_hostgroups"];
int count = pgsql_galera_hostgroups.getLength();
char* q = (char*)"INSERT OR REPLACE INTO pgsql_galera_hostgroups (writer_hostgroup, backup_writer_hostgroup, reader_hostgroup, offline_hostgroup, active, max_writers, writer_is_also_reader, max_transactions_behind, comment) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, '%s')";
for (i = 0; i < count; i++) {
const Setting& line = pgsql_galera_hostgroups[i];
int writer_hostgroup;
int backup_writer_hostgroup;
int reader_hostgroup;
int offline_hostgroup;
int active = 1; // default
int max_writers;
int writer_is_also_reader;
int max_transactions_behind;
std::string comment = "";
if (line.lookupValue("writer_hostgroup", writer_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_galera_hostgroups in config file without a mandatory writer_hostgroup\n");
continue;
}
if (line.lookupValue("backup_writer_hostgroup", backup_writer_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_galera_hostgroups in config file without a mandatory backup_writer_hostgroup\n");
continue;
}
if (line.lookupValue("reader_hostgroup", reader_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_galera_hostgroups in config file without a mandatory reader_hostgroup\n");
continue;
}
if (line.lookupValue("offline_hostgroup", offline_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_galera_hostgroups in config file without a mandatory offline_hostgroup\n");
continue;
}
if (line.lookupValue("max_writers", max_writers) == false) max_writers = 1;
if (line.lookupValue("writer_is_also_reader", writer_is_also_reader) == false) writer_is_also_reader = 0;
if (line.lookupValue("max_transactions_behind", max_transactions_behind) == false) max_transactions_behind = 0;
line.lookupValue("comment", comment);
char* o1 = strdup(comment.c_str());
char* o = escape_string_single_quotes(o1, false);
char* query = (char*)malloc(strlen(q) + strlen(o) + 128); // 128 vs sizeof(int)*8
sprintf(query, q, writer_hostgroup, backup_writer_hostgroup, reader_hostgroup, offline_hostgroup, active, max_writers, writer_is_also_reader, max_transactions_behind, o);
//fprintf(stderr, "%s\n", query);
admindb->execute(query);
if (o != o1) free(o);
free(o1);
free(query);
rows++;
}
}
if (root.exists("pgsql_aws_aurora_hostgroups") == true) {
const Setting& pgsql_aws_aurora_hostgroups = root["pgsql_aws_aurora_hostgroups"];
int count = pgsql_aws_aurora_hostgroups.getLength();
char* q = (char*)"INSERT OR REPLACE INTO pgsql_aws_aurora_hostgroups (writer_hostgroup, reader_hostgroup, active, aurora_port, 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, comment ) VALUES (%d, %d, %d, %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, '%s')";
for (i = 0; i < count; i++) {
const Setting& line = pgsql_aws_aurora_hostgroups[i];
int writer_hostgroup;
int reader_hostgroup;
int active = 1; // default
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;
int writer_is_also_reader;
int new_reader_weight;
std::string comment = "";
std::string domain_name = "";
if (line.lookupValue("writer_hostgroup", writer_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_aws_aurora_hostgroups in config file without a mandatory writer_hostgroup\n");
continue;
}
if (line.lookupValue("reader_hostgroup", reader_hostgroup) == false) {
proxy_error("Admin: detected a pgsql_aws_aurora_hostgroups in config file without a mandatory reader_hostgroup\n");
continue;
}
if (line.lookupValue("aurora_port", aurora_port) == false) aurora_port = 3306;
if (line.lookupValue("max_lag_ms", max_lag_ms) == false) max_lag_ms = 600000;
if (line.lookupValue("check_interval_ms", check_interval_ms) == false) check_interval_ms = 1000;
if (line.lookupValue("check_timeout_ms", check_timeout_ms) == false) check_timeout_ms = 1000;
if (line.lookupValue("writer_is_also_reader", writer_is_also_reader) == false) writer_is_also_reader = 0;
if (line.lookupValue("new_reader_weight", new_reader_weight) == false) new_reader_weight = 1;
if (line.lookupValue("add_lag_ms", add_lag_ms) == false) add_lag_ms = 30;
if (line.lookupValue("min_lag_ms", min_lag_ms) == false) min_lag_ms = 30;
if (line.lookupValue("lag_num_checks", lag_num_checks) == false) lag_num_checks = 1;
line.lookupValue("comment", comment);
line.lookupValue("domain_name", domain_name);
char* o1 = strdup(comment.c_str());
char* o = escape_string_single_quotes(o1, false);
char* p1 = strdup(domain_name.c_str());
char* p = escape_string_single_quotes(p1, false);
char* query = (char*)malloc(strlen(q) + strlen(o) + strlen(p) + 256); // 128 vs sizeof(int)*8
sprintf(query, q, writer_hostgroup, reader_hostgroup, active, aurora_port, p, 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, o);
//fprintf(stderr, "%s\n", query);
admindb->execute(query);
if (o != o1) free(o);
free(o1);
if (p != p1) free(p);
free(p1);
free(query);
rows++;
}
}
admindb->execute("PRAGMA foreign_keys = ON");
return rows;
}
@ -2308,4 +2052,4 @@ int ProxySQL_Config::Read_PgSQL_Query_Rules_from_configfile() {
}
admindb->execute("PRAGMA foreign_keys = ON");
return rows;
}
}

Loading…
Cancel
Save