|
|
|
|
@ -1704,106 +1704,6 @@ uint64_t PgSQL_HostGroups_Manager::get_pgsql_servers_checksum(SQLite3_result* ru
|
|
|
|
|
return table_resultset_checksum[HGM_TABLES::PgSQL_SERVERS];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
bool PgSQL_HostGroups_Manager::gtid_exists(PgSQL_SrvC *mysrvc, char * gtid_uuid, uint64_t gtid_trxid) {
|
|
|
|
|
bool ret = false;
|
|
|
|
|
pthread_rwlock_rdlock(>id_rwlock);
|
|
|
|
|
std::string s1 = mysrvc->address;
|
|
|
|
|
s1.append(":");
|
|
|
|
|
s1.append(std::to_string(mysrvc->port));
|
|
|
|
|
std::unordered_map <string, PgSQL_GTID_Server_Data *>::iterator it2;
|
|
|
|
|
it2 = gtid_map.find(s1);
|
|
|
|
|
PgSQL_GTID_Server_Data *gtid_is=NULL;
|
|
|
|
|
if (it2!=gtid_map.end()) {
|
|
|
|
|
gtid_is=it2->second;
|
|
|
|
|
if (gtid_is) {
|
|
|
|
|
if (gtid_is->active == true) {
|
|
|
|
|
ret = gtid_is->gtid_exists(gtid_uuid,gtid_trxid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//proxy_info("Checking if server %s has GTID %s:%lu . %s\n", s1.c_str(), gtid_uuid, gtid_trxid, (ret ? "YES" : "NO"));
|
|
|
|
|
pthread_rwlock_unlock(>id_rwlock);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PgSQL_HostGroups_Manager::generate_pgsql_gtid_executed_tables() {
|
|
|
|
|
pthread_rwlock_wrlock(>id_rwlock);
|
|
|
|
|
// first, set them all as active = false
|
|
|
|
|
std::unordered_map<string, PgSQL_GTID_Server_Data *>::iterator it = gtid_map.begin();
|
|
|
|
|
while(it != gtid_map.end()) {
|
|
|
|
|
PgSQL_GTID_Server_Data * gtid_si = it->second;
|
|
|
|
|
if (gtid_si) {
|
|
|
|
|
gtid_si->active = false;
|
|
|
|
|
}
|
|
|
|
|
it++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NOTE: We are required to lock while iterating over 'MyHostGroups'. Otherwise race conditions could take place,
|
|
|
|
|
// e.g. servers could be purged by 'purge_pgsql_servers_table' and invalid memory be accessed.
|
|
|
|
|
wrlock();
|
|
|
|
|
for (unsigned int i=0; i<MyHostGroups->len; i++) {
|
|
|
|
|
PgSQL_HGC *myhgc=(PgSQL_HGC *)MyHostGroups->index(i);
|
|
|
|
|
PgSQL_SrvC *mysrvc=NULL;
|
|
|
|
|
for (unsigned int j=0; j<myhgc->mysrvs->servers->len; j++) {
|
|
|
|
|
mysrvc=myhgc->mysrvs->idx(j);
|
|
|
|
|
if (mysrvc->gtid_port) {
|
|
|
|
|
std::string s1 = mysrvc->address;
|
|
|
|
|
s1.append(":");
|
|
|
|
|
s1.append(std::to_string(mysrvc->port));
|
|
|
|
|
std::unordered_map <string, PgSQL_GTID_Server_Data *>::iterator it2;
|
|
|
|
|
it2 = gtid_map.find(s1);
|
|
|
|
|
PgSQL_GTID_Server_Data *gtid_is=NULL;
|
|
|
|
|
if (it2!=gtid_map.end()) {
|
|
|
|
|
gtid_is=it2->second;
|
|
|
|
|
if (gtid_is == NULL) {
|
|
|
|
|
gtid_map.erase(it2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (gtid_is) {
|
|
|
|
|
gtid_is->active = true;
|
|
|
|
|
} else if (mysrvc->status != MYSQL_SERVER_STATUS_OFFLINE_HARD) {
|
|
|
|
|
// we didn't find it. Create it
|
|
|
|
|
/*
|
|
|
|
|
struct ev_io *watcher = (struct ev_io *)malloc(sizeof(struct ev_io));
|
|
|
|
|
gtid_is = new PgSQL_GTID_Server_Data(watcher, mysrvc->address, mysrvc->port, mysrvc->gtid_port);
|
|
|
|
|
gtid_map.emplace(s1,gtid_is);
|
|
|
|
|
*/
|
|
|
|
|
struct ev_io * c = NULL;
|
|
|
|
|
c = new_connector(mysrvc->address, mysrvc->gtid_port, mysrvc->port);
|
|
|
|
|
if (c) {
|
|
|
|
|
gtid_is = (PgSQL_GTID_Server_Data *)c->data;
|
|
|
|
|
gtid_map.emplace(s1,gtid_is);
|
|
|
|
|
//pthread_mutex_lock(&ev_loop_mutex);
|
|
|
|
|
ev_io_start(PgHGM->gtid_ev_loop,c);
|
|
|
|
|
//pthread_mutex_unlock(&ev_loop_mutex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
wrunlock();
|
|
|
|
|
std::vector<string> to_remove;
|
|
|
|
|
it = gtid_map.begin();
|
|
|
|
|
while(it != gtid_map.end()) {
|
|
|
|
|
PgSQL_GTID_Server_Data * gtid_si = it->second;
|
|
|
|
|
if (gtid_si && gtid_si->active == false) {
|
|
|
|
|
to_remove.push_back(it->first);
|
|
|
|
|
}
|
|
|
|
|
it++;
|
|
|
|
|
}
|
|
|
|
|
for (std::vector<string>::iterator it3=to_remove.begin(); it3!=to_remove.end(); ++it3) {
|
|
|
|
|
it = gtid_map.find(*it3);
|
|
|
|
|
PgSQL_GTID_Server_Data * gtid_si = it->second;
|
|
|
|
|
ev_io_stop(PgHGM->gtid_ev_loop, gtid_si->w);
|
|
|
|
|
close(gtid_si->w->fd);
|
|
|
|
|
free(gtid_si->w);
|
|
|
|
|
gtid_map.erase(*it3);
|
|
|
|
|
}
|
|
|
|
|
pthread_rwlock_unlock(>id_rwlock);
|
|
|
|
|
}
|
|
|
|
|
#endif // 0
|
|
|
|
|
|
|
|
|
|
void PgSQL_HostGroups_Manager::purge_pgsql_servers_table() {
|
|
|
|
|
for (unsigned int i=0; i<MyHostGroups->len; i++) {
|
|
|
|
|
PgSQL_HGC *myhgc=(PgSQL_HGC *)MyHostGroups->index(i);
|
|
|
|
|
@ -2057,49 +1957,6 @@ SQLite3_result * PgSQL_HostGroups_Manager::dump_table_pgsql(const string& name)
|
|
|
|
|
return resultset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
PgSQL_HGC * PgSQL_HostGroups_Manager::MyHGC_create(unsigned int _hid) {
|
|
|
|
|
PgSQL_HGC *myhgc=new PgSQL_HGC(_hid);
|
|
|
|
|
return myhgc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PgSQL_HGC * PgSQL_HostGroups_Manager::MyHGC_find(unsigned int _hid) {
|
|
|
|
|
if (MyHostGroups->len < 100) {
|
|
|
|
|
// for few HGs, we use the legacy search
|
|
|
|
|
for (unsigned int i=0; i<MyHostGroups->len; i++) {
|
|
|
|
|
PgSQL_HGC *myhgc=(PgSQL_HGC *)MyHostGroups->index(i);
|
|
|
|
|
if (myhgc->hid==_hid) {
|
|
|
|
|
return myhgc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// for a large number of HGs, we use the unordered_map
|
|
|
|
|
// this search is slower for a small number of HGs, therefore we use
|
|
|
|
|
// it only for large number of HGs
|
|
|
|
|
std::unordered_map<unsigned int, PgSQL_HGC *>::const_iterator it = MyHostGroups_map.find(_hid);
|
|
|
|
|
if (it != MyHostGroups_map.end()) {
|
|
|
|
|
PgSQL_HGC *myhgc = it->second;
|
|
|
|
|
return myhgc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PgSQL_HGC * PgSQL_HostGroups_Manager::MyHGC_lookup(unsigned int _hid) {
|
|
|
|
|
PgSQL_HGC *myhgc=NULL;
|
|
|
|
|
myhgc=MyHGC_find(_hid);
|
|
|
|
|
if (myhgc==NULL) {
|
|
|
|
|
myhgc=MyHGC_create(_hid);
|
|
|
|
|
} else {
|
|
|
|
|
return myhgc;
|
|
|
|
|
}
|
|
|
|
|
assert(myhgc);
|
|
|
|
|
MyHostGroups->add(myhgc);
|
|
|
|
|
MyHostGroups_map.emplace(_hid,myhgc);
|
|
|
|
|
return myhgc;
|
|
|
|
|
}
|
|
|
|
|
#endif // 0
|
|
|
|
|
|
|
|
|
|
void PgSQL_HostGroups_Manager::increase_reset_counter() {
|
|
|
|
|
wrlock();
|
|
|
|
|
status.myconnpoll_reset++;
|
|
|
|
|
@ -4237,10 +4094,6 @@ void PgSQL_HostGroups_Manager::p_update_metrics() {
|
|
|
|
|
|
|
|
|
|
// Update the *connection_pool* metrics
|
|
|
|
|
this->p_update_connection_pool();
|
|
|
|
|
#if 0
|
|
|
|
|
// Update the *gtid_executed* metrics
|
|
|
|
|
this->p_update_pgsql_gtid_executed();
|
|
|
|
|
#endif // 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SQLite3_result * PgSQL_HostGroups_Manager::SQL3_Get_ConnPool_Stats() {
|
|
|
|
|
@ -4321,186 +4174,6 @@ unsigned long long PgSQL_HostGroups_Manager::Get_Memory_Stats() {
|
|
|
|
|
return intsize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
PgSQL_Group_Replication_Info::PgSQL_Group_Replication_Info(int w, int b, int r, int o, int mw, int mtb, bool _a, int _w, char *c) {
|
|
|
|
|
comment=NULL;
|
|
|
|
|
if (c) {
|
|
|
|
|
comment=strdup(c);
|
|
|
|
|
}
|
|
|
|
|
writer_hostgroup=w;
|
|
|
|
|
backup_writer_hostgroup=b;
|
|
|
|
|
reader_hostgroup=r;
|
|
|
|
|
offline_hostgroup=o;
|
|
|
|
|
max_writers=mw;
|
|
|
|
|
max_transactions_behind=mtb;
|
|
|
|
|
active=_a;
|
|
|
|
|
writer_is_also_reader=_w;
|
|
|
|
|
current_num_writers=0;
|
|
|
|
|
current_num_backup_writers=0;
|
|
|
|
|
current_num_readers=0;
|
|
|
|
|
current_num_offline=0;
|
|
|
|
|
__active=true;
|
|
|
|
|
need_converge=true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PgSQL_Group_Replication_Info::~PgSQL_Group_Replication_Info() {
|
|
|
|
|
if (comment) {
|
|
|
|
|
free(comment);
|
|
|
|
|
comment=NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PgSQL_Group_Replication_Info::update(int b, int r, int o, int mw, int mtb, bool _a, int _w, char *c) {
|
|
|
|
|
bool ret=false;
|
|
|
|
|
__active=true;
|
|
|
|
|
if (backup_writer_hostgroup!=b) {
|
|
|
|
|
backup_writer_hostgroup=b;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (reader_hostgroup!=r) {
|
|
|
|
|
reader_hostgroup=r;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (offline_hostgroup!=o) {
|
|
|
|
|
offline_hostgroup=o;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (max_writers!=mw) {
|
|
|
|
|
max_writers=mw;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (max_transactions_behind!=mtb) {
|
|
|
|
|
max_transactions_behind=mtb;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (active!=_a) {
|
|
|
|
|
active=_a;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (writer_is_also_reader!=_w) {
|
|
|
|
|
writer_is_also_reader=_w;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
// for comment we don't change return value
|
|
|
|
|
if (comment) {
|
|
|
|
|
if (c) {
|
|
|
|
|
if (strcmp(comment,c)) {
|
|
|
|
|
free(comment);
|
|
|
|
|
comment=strdup(c);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
free(comment);
|
|
|
|
|
comment=NULL;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (c) {
|
|
|
|
|
comment=strdup(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PgSQL_HostGroups_Manager::p_update_pgsql_gtid_executed() {
|
|
|
|
|
pthread_rwlock_wrlock(>id_rwlock);
|
|
|
|
|
|
|
|
|
|
std::unordered_map<string, PgSQL_GTID_Server_Data*>::iterator it = gtid_map.begin();
|
|
|
|
|
while(it != gtid_map.end()) {
|
|
|
|
|
PgSQL_GTID_Server_Data* gtid_si = it->second;
|
|
|
|
|
std::string address {};
|
|
|
|
|
std::string port {};
|
|
|
|
|
std::string endpoint_id {};
|
|
|
|
|
|
|
|
|
|
if (gtid_si) {
|
|
|
|
|
address = std::string(gtid_si->address);
|
|
|
|
|
port = std::to_string(gtid_si->pgsql_port);
|
|
|
|
|
} else {
|
|
|
|
|
std::string s = it->first;
|
|
|
|
|
std::size_t found = s.find_last_of(":");
|
|
|
|
|
address = s.substr(0, found);
|
|
|
|
|
port = s.substr(found + 1);
|
|
|
|
|
}
|
|
|
|
|
endpoint_id = address + ":" + port;
|
|
|
|
|
|
|
|
|
|
const auto& gitd_id_counter = this->status.p_gtid_executed_map.find(endpoint_id);
|
|
|
|
|
prometheus::Counter* gtid_counter = nullptr;
|
|
|
|
|
|
|
|
|
|
if (gitd_id_counter == this->status.p_gtid_executed_map.end()) {
|
|
|
|
|
auto& gitd_counter =
|
|
|
|
|
this->status.p_dyn_counter_array[PgSQL_p_hg_dyn_counter::gtid_executed];
|
|
|
|
|
|
|
|
|
|
gtid_counter = std::addressof(gitd_counter->Add({
|
|
|
|
|
{ "hostname", address },
|
|
|
|
|
{ "port", port },
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
this->status.p_gtid_executed_map.insert(
|
|
|
|
|
{
|
|
|
|
|
endpoint_id,
|
|
|
|
|
gtid_counter
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
gtid_counter = gitd_id_counter->second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gtid_si) {
|
|
|
|
|
const auto& cur_executed_gtid = gtid_counter->Value();
|
|
|
|
|
gtid_counter->Increment(gtid_si->events_read - cur_executed_gtid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
it++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pthread_rwlock_unlock(>id_rwlock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SQLite3_result * PgSQL_HostGroups_Manager::get_stats_pgsql_gtid_executed() {
|
|
|
|
|
const int colnum = 4;
|
|
|
|
|
SQLite3_result * result = new SQLite3_result(colnum);
|
|
|
|
|
result->add_column_definition(SQLITE_TEXT,"hostname");
|
|
|
|
|
result->add_column_definition(SQLITE_TEXT,"port");
|
|
|
|
|
result->add_column_definition(SQLITE_TEXT,"gtid_executed");
|
|
|
|
|
result->add_column_definition(SQLITE_TEXT,"events");
|
|
|
|
|
int k;
|
|
|
|
|
pthread_rwlock_wrlock(>id_rwlock);
|
|
|
|
|
std::unordered_map<string, PgSQL_GTID_Server_Data *>::iterator it = gtid_map.begin();
|
|
|
|
|
while(it != gtid_map.end()) {
|
|
|
|
|
PgSQL_GTID_Server_Data * gtid_si = it->second;
|
|
|
|
|
char buf[64];
|
|
|
|
|
char **pta=(char **)malloc(sizeof(char *)*colnum);
|
|
|
|
|
if (gtid_si) {
|
|
|
|
|
pta[0]=strdup(gtid_si->address);
|
|
|
|
|
sprintf(buf,"%d", (int)gtid_si->pgsql_port);
|
|
|
|
|
pta[1]=strdup(buf);
|
|
|
|
|
//sprintf(buf,"%d", mysrvc->port);
|
|
|
|
|
string s1 = gtid_executed_to_string(gtid_si->gtid_executed);
|
|
|
|
|
pta[2]=strdup(s1.c_str());
|
|
|
|
|
sprintf(buf,"%llu", gtid_si->events_read);
|
|
|
|
|
pta[3]=strdup(buf);
|
|
|
|
|
} else {
|
|
|
|
|
std::string s = it->first;
|
|
|
|
|
std::size_t found=s.find_last_of(":");
|
|
|
|
|
std::string host=s.substr(0,found);
|
|
|
|
|
std::string port=s.substr(found+1);
|
|
|
|
|
pta[0]=strdup(host.c_str());
|
|
|
|
|
pta[1]=strdup(port.c_str());
|
|
|
|
|
pta[2]=strdup((char *)"NULL");
|
|
|
|
|
pta[3]=strdup((char *)"0");
|
|
|
|
|
}
|
|
|
|
|
result->add_row(pta);
|
|
|
|
|
for (k=0; k<colnum; k++) {
|
|
|
|
|
if (pta[k])
|
|
|
|
|
free(pta[k]);
|
|
|
|
|
}
|
|
|
|
|
free(pta);
|
|
|
|
|
it++;
|
|
|
|
|
}
|
|
|
|
|
pthread_rwlock_unlock(>id_rwlock);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // 0
|
|
|
|
|
|
|
|
|
|
class MySQL_Errors_stats {
|
|
|
|
|
public:
|
|
|
|
|
int hostgroup;
|
|
|
|
|
@ -4706,125 +4379,6 @@ SQLite3_result * PgSQL_HostGroups_Manager::get_pgsql_errors(bool reset) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
PgSQL_AWS_Aurora_Info::PgSQL_AWS_Aurora_Info(int w, int r, int _port, char *_end_addr, int maxl, int al, int minl, int lnc, int ci, int ct, bool _a, int wiar, int nrw, char *c) {
|
|
|
|
|
comment=NULL;
|
|
|
|
|
if (c) {
|
|
|
|
|
comment=strdup(c);
|
|
|
|
|
}
|
|
|
|
|
writer_hostgroup=w;
|
|
|
|
|
reader_hostgroup=r;
|
|
|
|
|
max_lag_ms=maxl;
|
|
|
|
|
add_lag_ms=al;
|
|
|
|
|
min_lag_ms=minl;
|
|
|
|
|
lag_num_checks=lnc;
|
|
|
|
|
check_interval_ms=ci;
|
|
|
|
|
check_timeout_ms=ct;
|
|
|
|
|
writer_is_also_reader=wiar;
|
|
|
|
|
new_reader_weight=nrw;
|
|
|
|
|
active=_a;
|
|
|
|
|
__active=true;
|
|
|
|
|
//need_converge=true;
|
|
|
|
|
aurora_port = _port;
|
|
|
|
|
domain_name = strdup(_end_addr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PgSQL_AWS_Aurora_Info::~PgSQL_AWS_Aurora_Info() {
|
|
|
|
|
if (comment) {
|
|
|
|
|
free(comment);
|
|
|
|
|
comment=NULL;
|
|
|
|
|
}
|
|
|
|
|
if (domain_name) {
|
|
|
|
|
free(domain_name);
|
|
|
|
|
domain_name=NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PgSQL_AWS_Aurora_Info::update(int r, int _port, char *_end_addr, int maxl, int al, int minl, int lnc, int ci, int ct, bool _a, int wiar, int nrw, char *c) {
|
|
|
|
|
bool ret=false;
|
|
|
|
|
__active=true;
|
|
|
|
|
if (reader_hostgroup!=r) {
|
|
|
|
|
reader_hostgroup=r;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (max_lag_ms!=maxl) {
|
|
|
|
|
max_lag_ms=maxl;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (add_lag_ms!=al) {
|
|
|
|
|
add_lag_ms=al;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (min_lag_ms!=minl) {
|
|
|
|
|
min_lag_ms=minl;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (lag_num_checks!=lnc) {
|
|
|
|
|
lag_num_checks=lnc;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (check_interval_ms!=ci) {
|
|
|
|
|
check_interval_ms=ci;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (check_timeout_ms!=ct) {
|
|
|
|
|
check_timeout_ms=ct;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (writer_is_also_reader != wiar) {
|
|
|
|
|
writer_is_also_reader = wiar;
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
if (new_reader_weight != nrw) {
|
|
|
|
|
new_reader_weight = nrw;
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
if (active!=_a) {
|
|
|
|
|
active=_a;
|
|
|
|
|
ret=true;
|
|
|
|
|
}
|
|
|
|
|
if (aurora_port != _port) {
|
|
|
|
|
aurora_port = _port;
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
if (domain_name) {
|
|
|
|
|
if (_end_addr) {
|
|
|
|
|
if (strcmp(domain_name,_end_addr)) {
|
|
|
|
|
free(domain_name);
|
|
|
|
|
domain_name = strdup(_end_addr);
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
free(domain_name);
|
|
|
|
|
domain_name=NULL;
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (_end_addr) {
|
|
|
|
|
domain_name=strdup(_end_addr);
|
|
|
|
|
ret = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// for comment we don't change return value
|
|
|
|
|
if (comment) {
|
|
|
|
|
if (c) {
|
|
|
|
|
if (strcmp(comment,c)) {
|
|
|
|
|
free(comment);
|
|
|
|
|
comment=strdup(c);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
free(comment);
|
|
|
|
|
comment=NULL;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (c) {
|
|
|
|
|
comment=strdup(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
#endif // 0
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initializes the supplied 'PgSQL_HGC' with the specified 'hostgroup_settings'.
|
|
|
|
|
* @details Input verification is performed in the supplied 'hostgroup_settings'. It's expected to be a valid
|
|
|
|
|
|