diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index bdc368b4b..88dacf723 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -2706,7 +2706,7 @@ MySrvC *MyHGC::get_random_MySrvC(char * gtid_uuid, uint64_t gtid_trxid, int max_ } } else { if (max_lag_ms >= 0) { - if (max_lag_ms >= mysrvc->aws_aurora_current_lag_us/1000) { + if ((unsigned int)max_lag_ms >= mysrvc->aws_aurora_current_lag_us/1000) { sum+=mysrvc->weight; TotalUsedConn+=mysrvc->ConnectionsUsed->conns_length(); mysrvcCandidates[num_candidates]=mysrvc; @@ -2760,7 +2760,7 @@ MySrvC *MyHGC::get_random_MySrvC(char * gtid_uuid, uint64_t gtid_trxid, int max_ } } else { if (max_lag_ms >= 0) { - if (max_lag_ms >= mysrvc->aws_aurora_current_lag_us/1000) { + if ((unsigned int)max_lag_ms >= mysrvc->aws_aurora_current_lag_us/1000) { sum+=mysrvc->weight; TotalUsedConn+=mysrvc->ConnectionsUsed->conns_length(); mysrvcCandidates[num_candidates]=mysrvc; @@ -2835,7 +2835,7 @@ MySrvC *MyHGC::get_random_MySrvC(char * gtid_uuid, uint64_t gtid_trxid, int max_ } } else { if (max_lag_ms >= 0) { - if (max_lag_ms >= mysrvc->aws_aurora_current_lag_us/1000) { + if ((unsigned int)max_lag_ms >= mysrvc->aws_aurora_current_lag_us/1000) { sum+=mysrvc->weight; TotalUsedConn+=mysrvc->ConnectionsUsed->conns_length(); mysrvcCandidates[num_candidates]=mysrvc; @@ -2899,7 +2899,7 @@ MySrvC *MyHGC::get_random_MySrvC(char * gtid_uuid, uint64_t gtid_trxid, int max_ // latency awareness algorithm is enabled only when compiled with USE_MYSRVC_ARRAY if (sess->thread->variables.min_num_servers_lantency_awareness) { - if (num_candidates >= sess->thread->variables.min_num_servers_lantency_awareness) { + if ((int) num_candidates >= sess->thread->variables.min_num_servers_lantency_awareness) { unsigned int servers_with_latency = 0; unsigned int total_latency_us = 0; // scan and verify that all servers have some latency @@ -3004,14 +3004,12 @@ MySQL_Connection * MySrvConnList::get_random_MyConn(MySQL_Session *sess, bool ff MySQL_Connection * client_conn = sess->client_myds->myconn; bool conn_found = false; unsigned int k; - unsigned int options_matching_idx; bool options_matching_found = false; for (k = i; conn_found == false && k < l; k++) { conn = (MySQL_Connection *)conns->index(k); if (conn->match_tracked_options(client_conn)) { if (options_matching_found == false) { options_matching_found = true; - options_matching_idx = k; } if (strcmp(conn->userinfo->schemaname,schema)==0 && strcmp(conn->userinfo->username,username)==0) { conn_found = true; @@ -3025,7 +3023,6 @@ MySQL_Connection * MySrvConnList::get_random_MyConn(MySQL_Session *sess, bool ff if (conn->match_tracked_options(client_conn)) { if (options_matching_found == false) { options_matching_found = true; - options_matching_idx = k; } if (strcmp(conn->userinfo->schemaname,schema)==0 && strcmp(conn->userinfo->username,username)==0) { conn_found = true; diff --git a/lib/MySQL_Logger.cpp b/lib/MySQL_Logger.cpp index 9995b5296..5d857ac5a 100644 --- a/lib/MySQL_Logger.cpp +++ b/lib/MySQL_Logger.cpp @@ -125,7 +125,7 @@ void MySQL_Event::write_auth(std::fstream *f, MySQL_Session *sess) { time_t timer=start_time/1000/1000; struct tm* tm_info; tm_info = localtime(&timer); - char buffer1[64]; + char buffer1[36]; char buffer2[64]; strftime(buffer1, 32, "%Y-%m-%d %H:%M:%S", tm_info); sprintf(buffer2,"%s.%03u", buffer1, (unsigned)(start_time%1000000)/1000); @@ -208,7 +208,7 @@ void MySQL_Event::write_auth(std::fstream *f, MySQL_Session *sess) { time_t timer= (orig_time)/1000/1000; struct tm* tm_info; tm_info = localtime(&timer); - char buffer1[64]; + char buffer1[36]; char buffer2[64]; strftime(buffer1, 32, "%Y-%m-%d %H:%M:%S", tm_info); sprintf(buffer2,"%s.%03u", buffer1, (unsigned)(orig_time%1000000)/1000); @@ -384,7 +384,7 @@ uint64_t MySQL_Event::write_query_format_2_json(std::fstream *f) { time_t timer=start_time/1000/1000; struct tm* tm_info; tm_info = localtime(&timer); - char buffer1[64]; + char buffer1[36]; char buffer2[64]; strftime(buffer1, 32, "%Y-%m-%d %H:%M:%S", tm_info); sprintf(buffer2,"%s.%06u", buffer1, (unsigned)(start_time%1000000)); @@ -395,7 +395,7 @@ uint64_t MySQL_Event::write_query_format_2_json(std::fstream *f) { time_t timer=end_time/1000/1000; struct tm* tm_info; tm_info = localtime(&timer); - char buffer1[64]; + char buffer1[36]; char buffer2[64]; strftime(buffer1, 32, "%Y-%m-%d %H:%M:%S", tm_info); sprintf(buffer2,"%s.%06u", buffer1, (unsigned)(end_time%1000000)); @@ -813,7 +813,6 @@ void MySQL_Logger::log_audit_entry(log_event_type _et, MySQL_Session *sess, MySQ } uint64_t curtime_real=realtime_time(); - uint64_t curtime_mono=sess->thread->curtime; int cl=0; char *ca=(char *)""; // default if (sess->client_myds->addr.addr) { @@ -862,11 +861,6 @@ void MySQL_Logger::log_audit_entry(log_event_type _et, MySQL_Session *sess, MySQ sprintf(sa,"%s:%d", myds->myconn->parent->address, myds->myconn->parent->port); } sl=strlen(sa); - if (sl) { - int hid=-1; - hid=myds->myconn->parent->myhgc->hid; -// me.set_server(hid,sa,sl); - } if (xi) { me.set_extra_info(xi); diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index b003f2427..f5859b33e 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -1460,16 +1460,6 @@ __exit_monitor_group_replication_thread: } goto __end_process_group_replication_result2; } -/* - if (num_fields!=3) { - proxy_error("Incorrect number of fields, please report a bug\n"); - goto __end_process_group_replication_result; - } - if (num_rows!=1) { - proxy_error("Incorrect number of rows, please report a bug\n"); - goto __end_process_group_replication_result; - } -*/ MYSQL_ROW row=mysql_fetch_row(mmsd->result); if (!strcasecmp(row[0],"YES")) { viable_candidate=true; @@ -1486,7 +1476,6 @@ __exit_monitor_group_replication_thread: mysql_free_result(mmsd->result); mmsd->result=NULL; } -__end_process_group_replication_result: //proxy_info("GR: %s:%d , viable=%s , ro=%s, trx=%ld, err=%s\n", mmsd->hostname, mmsd->port, (viable_candidate ? "YES": "NO") , (read_only ? "YES": "NO") , transactions_behind, ( mmsd->mysql_error_msg ? mmsd->mysql_error_msg : "") ); if (mmsd->mysql_error_msg) { //proxy_warning("GR: %s:%d , viable=%s , ro=%s, trx=%ld, err=%s\n", mmsd->hostname, mmsd->port, (viable_candidate ? "YES": "NO") , (read_only ? "YES": "NO") , transactions_behind, ( mmsd->mysql_error_msg ? mmsd->mysql_error_msg : "") ); @@ -1675,7 +1664,7 @@ void * monitor_galera_thread(void *arg) { unsigned long long start_time=mysql_thr->curtime; #ifdef DEBUG - MYSQL *mysqlcopy = NULL; + MYSQL *mysqlcopy __attribute__((unused)) = NULL; #endif // DEBUG mmsd->t1=start_time; @@ -1815,16 +1804,6 @@ __exit_monitor_galera_thread: } goto __end_process_galera_result2; } -/* - if (num_fields!=7) { - proxy_error("Incorrect number of fields, please report a bug\n"); - goto __end_process_galera_result; - } - if (num_rows!=1) { - proxy_error("Incorrect number of rows, please report a bug\n"); - goto __end_process_galera_result; - } -*/ MYSQL_ROW row=mysql_fetch_row(mmsd->result); if (row[0]) { wsrep_local_state = atoi(row[0]); @@ -1870,7 +1849,6 @@ __exit_monitor_galera_thread: mysql_free_result(mmsd->result); mmsd->result=NULL; } -__end_process_galera_result: if (mmsd->mysql_error_msg) { } unsigned long long time_now=realtime_time(); @@ -2056,7 +2034,7 @@ void * monitor_replication_lag_thread(void *arg) { mysql_thr->refresh_variables(); #ifdef DEBUG - MYSQL *mysqlcopy = NULL; + MYSQL *mysqlcopy __attribute__((unused)) = NULL; #endif // DEBUG mmsd->mysql=GloMyMon->My_Conn_Pool->get_connection(mmsd->hostname, mmsd->port, mmsd); @@ -2144,6 +2122,7 @@ void * monitor_replication_lag_thread(void *arg) { MyHGM->p_update_mysql_error_counter(p_mysql_error_type::proxysql, mmsd->hostgroup_id, mmsd->hostname, mmsd->port, mysql_errno(mmsd->mysql)); unsigned long long now=monotonic_time(); #ifdef DEBUG + unsigned long long now=monotonic_time(); proxy_error("Error after %dms: mmsd %p , MYSQL %p , FD %d : %s\n", (now-mmsd->t1)/1000, mmsd, mmsd->mysql, mmsd->mysql->net.fd, mmsd->mysql_error_msg); #endif // DEBUG if (mmsd->mysql) { @@ -2834,7 +2813,6 @@ __sleep_monitor_read_only: void * MySQL_Monitor::monitor_group_replication() { // initialize the MySQL Thread (note: this is not a real thread, just the structures associated with it) // struct event_base *libevent_base; - unsigned int latest_table_servers_version=0; unsigned int MySQL_Monitor__thread_MySQL_Thread_Variables_version; MySQL_Thread * mysql_thr = new MySQL_Thread(); mysql_thr->curtime=monotonic_time(); @@ -2964,7 +2942,6 @@ __sleep_monitor_group_replication: void * MySQL_Monitor::monitor_galera() { // initialize the MySQL Thread (note: this is not a real thread, just the structures associated with it) // struct event_base *libevent_base; - unsigned int latest_table_servers_version=0; unsigned int MySQL_Monitor__thread_MySQL_Thread_Variables_version; MySQL_Thread * mysql_thr = new MySQL_Thread(); mysql_thr->curtime=monotonic_time(); @@ -3263,8 +3240,8 @@ __monitor_run: My_Conn_Pool->purge_some_connections(); } usleep(200000); - int qsize=queue->size(); - if (qsize > mysql_thread___monitor_threads_queue_maxsize/4) { + unsigned int qsize=queue->size(); + if (qsize > (unsigned int)mysql_thread___monitor_threads_queue_maxsize/4) { proxy_warning("Monitor queue too big: %d\n", qsize); unsigned int threads_max = (unsigned int)mysql_thread___monitor_threads_max; if (threads_max > num_threads) { @@ -3287,7 +3264,7 @@ __monitor_run: // check again. Do we need also aux threads? usleep(50000); qsize=queue->size(); - if (qsize > mysql_thread___monitor_threads_queue_maxsize) { + if (qsize > (unsigned int)mysql_thread___monitor_threads_queue_maxsize) { qsize=qsize/50; unsigned int threads_max = (unsigned int)mysql_thread___monitor_threads_max; if ((qsize + num_threads) > (threads_max * 2)) { // allow a small bursts @@ -3298,11 +3275,11 @@ __monitor_run: ConsumerThread **threads_aux= (ConsumerThread **)malloc(sizeof(ConsumerThread *)*qsize); aux_threads = qsize; started_threads += aux_threads; - for (int i=0; istart(2048,false); } - for (int i=0; ijoin(); delete threads_aux[i]; } @@ -3722,7 +3699,7 @@ char * MySQL_Monitor::galera_find_last_node(int writer_hostgroup) { std::string s = ""; for (it2=GloMyMon->Galera_Hosts_Map.begin(); it2!=GloMyMon->Galera_Hosts_Map.end(); ++it2) { node=it2->second; - if (node->writer_hostgroup == writer_hostgroup) { + if (node->writer_hostgroup == (unsigned int)writer_hostgroup) { Galera_status_entry_t * st = node->last_entry(); if (st) { if (st->start_time >= curtime - ti) { // only consider recent checks @@ -3765,7 +3742,7 @@ std::vector * MySQL_Monitor::galera_find_possible_last_nodes(int writer_ ti *= 2; for (it2=GloMyMon->Galera_Hosts_Map.begin(); it2!=GloMyMon->Galera_Hosts_Map.end(); ++it2) { node=it2->second; - if (node->writer_hostgroup == writer_hostgroup) { + if (node->writer_hostgroup == (unsigned int)writer_hostgroup) { Galera_status_entry_t * st = node->last_entry(); if (st) { if (st->start_time >= curtime - ti) { // only consider recent checks @@ -3991,7 +3968,6 @@ AWS_Aurora_monitor_node::~AWS_Aurora_monitor_node() { bool AWS_Aurora_monitor_node::add_entry(AWS_Aurora_status_entry *ase) { bool ret=false; if (idx_last_entry==-1) ret=true; - int prev_last_entry=idx_last_entry; idx_last_entry++; if (idx_last_entry>=AWS_Aurora_Nentries) { idx_last_entry=0; @@ -4071,7 +4047,7 @@ void * monitor_AWS_Aurora_thread_HG(void *arg) { // count the number of hosts for (std::vector::iterator it = GloMyMon->AWS_Aurora_Hosts_resultset->rows.begin() ; it != GloMyMon->AWS_Aurora_Hosts_resultset->rows.end(); ++it) { SQLite3_row *r=*it; - if (atoi(r->fields[0]) == wHG) { + if (atoi(r->fields[0]) == (int)wHG) { num_hosts++; if (max_lag_ms == 0) { max_lag_ms = atoi(r->fields[5]); @@ -4093,7 +4069,7 @@ void * monitor_AWS_Aurora_thread_HG(void *arg) { host_def_t *hpa = (host_def_t *)malloc(sizeof(host_def_t)*num_hosts); for (std::vector::iterator it = GloMyMon->AWS_Aurora_Hosts_resultset->rows.begin() ; it != GloMyMon->AWS_Aurora_Hosts_resultset->rows.end(); ++it) { SQLite3_row *r=*it; - if (atoi(r->fields[0]) == wHG) { + if (atoi(r->fields[0]) == (int)wHG) { hpa[cur_host_idx].host = strdup(r->fields[2]); hpa[cur_host_idx].port = atoi(r->fields[3]); hpa[cur_host_idx].use_ssl = atoi(r->fields[4]); @@ -4312,7 +4288,6 @@ __exit_monitor_aws_aurora_HG_thread: AWS_Aurora_status_entry *ase_l = new AWS_Aurora_status_entry(time_now, mmsd->t2-mmsd->t1, mmsd->mysql_error_msg); if (mmsd->interr == 0 && mmsd->result) { int num_fields=0; - int num_rows=0; num_fields = mysql_num_fields(mmsd->result); if (num_fields!=5) { proxy_error("Incorrect number of fields, please report a bug\n"); @@ -4473,7 +4448,6 @@ __exit_monitor_AWS_Aurora_thread_HG_now: void * MySQL_Monitor::monitor_aws_aurora() { // initialize the MySQL Thread (note: this is not a real thread, just the structures associated with it) - unsigned int latest_table_servers_version=0; unsigned int MySQL_Monitor__thread_MySQL_Thread_Variables_version; MySQL_Thread * mysql_thr = new MySQL_Thread(); mysql_thr->curtime=monotonic_time(); @@ -4481,10 +4455,6 @@ void * MySQL_Monitor::monitor_aws_aurora() { mysql_thr->refresh_variables(); if (!GloMTH) return NULL; // quick exit during shutdown/restart - unsigned long long t1; - unsigned long long t2; - unsigned long long next_loop_at=0; - uint64_t last_raw_checksum = 0; // ADD here an unordered map , Writer HG => next time at @@ -4498,7 +4468,6 @@ void * MySQL_Monitor::monitor_aws_aurora() { while (GloMyMon->shutdown==false && mysql_thread___monitor_enabled==true) { unsigned int glover; - t1=monotonic_time(); if (!GloMTH) return NULL; // quick exit during shutdown/restart @@ -4507,7 +4476,6 @@ void * MySQL_Monitor::monitor_aws_aurora() { if (MySQL_Monitor__thread_MySQL_Thread_Variables_version < glover ) { MySQL_Monitor__thread_MySQL_Thread_Variables_version=glover; mysql_thr->refresh_variables(); - next_loop_at=0; } // if list of servers or HG or options has changed, triggers new checks @@ -4516,7 +4484,6 @@ void * MySQL_Monitor::monitor_aws_aurora() { pthread_mutex_unlock(&aws_aurora_mutex); if (new_raw_checksum != last_raw_checksum) { proxy_info("Detected new/changed definition for AWS Aurora monitoring\n"); - next_loop_at = 0; last_raw_checksum = new_raw_checksum; if (pthreads_array) { // wait all threads to terminate @@ -4541,7 +4508,7 @@ void * MySQL_Monitor::monitor_aws_aurora() { bool found = false; // very simple search. Far from optimal, but assuming very few HGs it is fast enough for (unsigned int i=0; i < hgs_num; i++) { - if (tmp_hgs_array[i] == wHG) { + if (tmp_hgs_array[i] == (unsigned int)wHG) { found = true; } } @@ -4729,7 +4696,6 @@ __exit_monitor_aws_aurora_thread: AWS_Aurora_status_entry *ase = new AWS_Aurora_status_entry(mmsd->t1, mmsd->t2-mmsd->t1, mmsd->mysql_error_msg); if (mmsd->interr == 0 && mmsd->result) { int num_fields=0; - int num_rows=0; num_fields = mysql_num_fields(mmsd->result); if (num_fields!=5) { proxy_error("Incorrect number of fields, please report a bug\n"); @@ -4814,7 +4780,7 @@ unsigned int MySQL_Monitor::estimate_lag(char* server_id, AWS_Aurora_status_entr unsigned int mlag = 0; unsigned int lag = 0; - for (int i = 1; i <= lag_num_checks; i++) { + for (unsigned int i = 1; i <= lag_num_checks; i++) { if (!aase[idx] || !aase[idx]->host_statuses) break; for (auto hse : *(aase[idx]->host_statuses)) { @@ -4832,8 +4798,8 @@ unsigned int MySQL_Monitor::estimate_lag(char* server_id, AWS_Aurora_status_entr } void MySQL_Monitor::evaluate_aws_aurora_results(unsigned int wHG, unsigned int rHG, 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) { - unsigned int i = 0; #ifdef TEST_AURORA + unsigned int i = 0; bool verbose = false; unsigned int action_yes = 0; unsigned int action_no = 0; diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index 69cf509d6..1f4b36daa 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -2283,7 +2283,6 @@ stmt_execute_metadata_t * MySQL_Protocol::get_binds_from_pkt(void *ptr, unsigned } bool MySQL_Protocol::generate_COM_QUERY_from_COM_FIELD_LIST(PtrSize_t *pkt) { - PtrSize_t n_pkt; unsigned int o_pkt_size = pkt->size; char *pkt_ptr = (char *)pkt->ptr; diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 900061c5a..b277f8095 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -1238,13 +1238,11 @@ bool MySQL_Session::handler_special_queries(PtrSize_t *pkt) { ) { char *unstripped=strndup((char *)pkt->ptr+15,pkt->size-15); char *csname=trim_spaces_and_quotes_in_place(unstripped); - bool collation_specified = false; //unsigned int charsetnr = 0; const MARIADB_CHARSET_INFO * c; char * collation_name_unstripped = NULL; char * collation_name = NULL; if (strcasestr(csname," COLLATE ")) { - collation_specified = true; collation_name_unstripped = strcasestr(csname," COLLATE ") + strlen(" COLLATE "); collation_name = trim_spaces_and_quotes_in_place(collation_name_unstripped); char *_s1=index(csname,' '); diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index db10dd809..9dee79e1d 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -6032,7 +6032,7 @@ MySQL_Connection * MySQL_Thread::get_MyConn_local(unsigned int _hid, MySQL_Sessi // c=(MySQL_Connection *)cached_connections->remove_index_fast(i); if (max_lag_ms >= 0) { - if (max_lag_ms < (c->parent->aws_aurora_current_lag_us / 1000)) { + if ((unsigned int)max_lag_ms < (c->parent->aws_aurora_current_lag_us / 1000)) { status_variables.stvar[st_var_aws_aurora_replicas_skipped_during_query]++; continue; } diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 056292a76..d5624bf99 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -2825,7 +2825,7 @@ bool admin_handler_command_load_or_save(char *query_no_space, unsigned int query fileName.erase(fileName.find_last_not_of("\t\n\v\f\r ") + 1); if (fileName.size() == 0) { proxy_error("ProxySQL Admin Error: empty file name\n"); - SPA->send_MySQL_ERR(&sess->client_myds->myprot, "ProxySQL Admin Error: empty file name"); + SPA->send_MySQL_ERR(&sess->client_myds->myprot, (char *)"ProxySQL Admin Error: empty file name"); return false; } std::string data; @@ -2840,7 +2840,7 @@ bool admin_handler_command_load_or_save(char *query_no_space, unsigned int query if (rc) { std::stringstream ss; proxy_error("ProxySQL Admin Error: Cannot extract configuration\n"); - SPA->send_MySQL_ERR(&sess->client_myds->myprot, "ProxySQL Admin Error: Cannot extract configuration"); + SPA->send_MySQL_ERR(&sess->client_myds->myprot, (char *)"ProxySQL Admin Error: Cannot extract configuration"); return false; } else { std::ofstream out; @@ -2932,7 +2932,7 @@ bool ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign bool stats_proxysql_servers_checksums = false; bool stats_proxysql_servers_metrics = false; - bool stats_proxysql_servers_status = false; + //bool stats_proxysql_servers_status = false; // temporary disabled because not implemented if (strcasestr(query_no_space,"processlist")) // This will match the following usecases: @@ -2951,13 +2951,13 @@ bool ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign char *_ret = NULL; c = (char *)query_no_space; _ret = NULL; - while (_ret = strstr(c,"stats_mysql_query_digest_reset")) { + while ((_ret = strstr(c,"stats_mysql_query_digest_reset"))) { ndr++; c = _ret + strlen("stats_mysql_query_digest_reset"); } c = (char *)query_no_space; _ret = NULL; - while (_ret = strstr(c,"stats_mysql_query_digest")) { + while ((_ret = strstr(c,"stats_mysql_query_digest"))) { nd++; c = _ret + strlen("stats_mysql_query_digest"); } @@ -2995,9 +2995,11 @@ bool ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign { stats_proxysql_servers_checksums = true; refresh = true; } if (strstr(query_no_space,"stats_proxysql_servers_metrics")) { stats_proxysql_servers_metrics = true; refresh = true; } + // temporary disabled because not implemented +/* if (strstr(query_no_space,"stats_proxysql_servers_status")) { stats_proxysql_servers_status = true; refresh = true; } - +*/ if (strstr(query_no_space,"stats_mysql_prepared_statements_info")) { stats_mysql_prepared_statements_info=true; refresh=true; } @@ -3120,6 +3122,7 @@ bool ProxySQL_Admin::GenericRefreshStatistics(const char *query_no_space, unsign if (stats_proxysql_servers_checksums) { stats___proxysql_servers_checksums(); } + // temporary disabled because not implemented // if (stats_proxysql_servers_status) { // stats___proxysql_servers_status(); // } @@ -5921,7 +5924,7 @@ void ProxySQL_Admin::flush_mysql_variables___database_to_runtime(SQLite3DB *db, proxy_info("Changing mysql-default_charset to %s using configured mysql-default_collation_connection %s\n", cic->csname, cic->name); sprintf(q,"INSERT OR REPLACE INTO global_variables VALUES(\"mysql-default_charset\",\"%s\")", cic->csname); db->execute(q); - GloMTH->set_variable("default_charset",cic->csname); + GloMTH->set_variable((char *)"default_charset",cic->csname); } else { proxy_info("Changing mysql-default_collation_connection to %s using configured mysql-default_charset: %s\n", ci->name, ci->csname); sprintf(q,"INSERT OR REPLACE INTO global_variables VALUES(\"mysql-default_collation_connection\",\"%s\")", ci->name); diff --git a/lib/ProxySQL_Statistics.cpp b/lib/ProxySQL_Statistics.cpp index 7ee8ee6cc..5a4ca45d5 100644 --- a/lib/ProxySQL_Statistics.cpp +++ b/lib/ProxySQL_Statistics.cpp @@ -604,7 +604,7 @@ void ProxySQL_Statistics::system_memory_sets() { } free(error); } else { - char buf[256]; + char buf[512]; if (resultset->rows_count == 0) { sprintf(buf,"INSERT INTO system_memory_hour SELECT timestamp/3600*3600 , AVG(allocated), AVG(resident), AVG(active), AVG(mapped), AVG(metadata), AVG(retained) FROM system_memory WHERE timestamp < %ld GROUP BY timestamp/3600", (ts/3600)*3600); statsdb_disk->execute(buf); diff --git a/src/SQLite3_Server.cpp b/src/SQLite3_Server.cpp index 13c17597d..04f7ce03e 100644 --- a/src/SQLite3_Server.cpp +++ b/src/SQLite3_Server.cpp @@ -89,9 +89,6 @@ static char *s_strdup(char *s) { } static int __SQLite3_Server_refresh_interval=1000; -static bool testTimeoutSequence[] = {true, false, true, false, true, false, true, false}; -static int testIndex = 7; -static int testLag = 10; extern Query_Cache *GloQC; extern MySQL_Authentication *GloMyAuth; diff --git a/src/main.cpp b/src/main.cpp index 8e0591b5e..5e204a62d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -323,16 +323,6 @@ struct cpu_timer }; -static void lock_callback(int mode, int type, const char *file, int line) { - (void)file; - (void)line; - if(mode & CRYPTO_LOCK) { - pthread_mutex_lock(&(lockarray[type])); - } else { - pthread_mutex_unlock(&(lockarray[type])); - } -} - static unsigned long thread_id(void) { unsigned long ret; ret = (unsigned long)pthread_self(); @@ -346,7 +336,8 @@ static void init_locks(void) { pthread_mutex_init(&(lockarray[i]), NULL); } CRYPTO_set_id_callback((unsigned long (*)())thread_id); - CRYPTO_set_locking_callback((void (*)(int, int, const char *, int))lock_callback); + // deprecated + //CRYPTO_set_locking_callback((void (*)(int, int, const char *, int))lock_callback); } X509 * generate_x509(EVP_PKEY *pkey, const unsigned char *cn, uint32_t serial, int days, X509 *ca_x509, EVP_PKEY *ca_pkey) { @@ -1830,7 +1821,9 @@ __start_label: } if (time_next_version_check == 0) time_next_version_check = curtime; - time_next_version_check += 24*3600*(1000*1000); + unsigned long long inter = 24*3600*1000; + inter *= 1000; + time_next_version_check += inter; } } inner_loops++;