Merge pull request #1543 from sysown/v2_149-commits

Merging commits from 1.4.9
v2.0.0-cachegrind
René Cannaò 8 years ago committed by GitHub
commit 8c0eb73d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,9 +25,12 @@ Make sure you have installed the equivalent for each of these packages for your
Shortcut commands for installing pre-requisites:
```
# RHEL / CentOS Based:
# RHEL / CentOS < 7:
yum install automake bzip2 cmake make g++ gcc git openssl openssl-devel patch
# CentOS 7.4+ / Fedora 28+:
yum install automake bzip2 cmake make gcc-c++ gcc git openssl openssl-devel patch
# Debian / Ubuntu Based:
apt-get install automake bzip2 cmake make g++ gcc git openssl libssl-dev patch
```

@ -1,7 +1,7 @@
How to operate ProxySQL
=======================
First of all, ProxySQL is a daemon ran by an angel process. The angel process monitors the daemon and restarts it when it has crashed, in order to minimize downtime. The daemon accepts incoming traffic from MySQL clients and forwards it to backend MySQL servers.
First of all, ProxySQL is a daemon run by an angel process. The angel process monitors the daemon and restarts it when it has crashed, in order to minimize downtime. The daemon accepts incoming traffic from MySQL clients and forwards it to backend MySQL servers.
The proxy is designed to run for as long as possible without needing to be restarted. Most configurations can be done at runtime, through a configuration system that responds to SQL-like queries (["admin interface"](https://github.com/sysown/proxysql/blob/master/doc/admin_tables.md)). Runtime parameters, server grouping and traffic-related settings can all be changed at runtime.
@ -54,4 +54,4 @@ Let us explain in more depth each individual option.
* `-S, --admin-socket ARG`. Currently unused.
* `-V, --version`. Print the current version of ProxySQL
* `--initial`. Reset the admin database with the content from the configuration file. Refer to the [configuration system documentation](https://github.com/sysown/proxysql/blob/master/doc/configuration_system.md) for more information.
* `--reload`. Merge the configuration from the config file with the current runtime database. Refer to the [configuration system documentation](https://github.com/sysown/proxysql/blob/master/doc/configuration_system.md) for more information.
* `--reload`. Merge the configuration from the config file with the current runtime database. Refer to the [configuration system documentation](https://github.com/sysown/proxysql/blob/master/doc/configuration_system.md) for more information.

@ -3822,6 +3822,9 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
if (rc && ( i==0 || i==1) ) {
//fprintf(stderr,"sql_log_bin=%d\n", i);
client_myds->myconn->options.sql_log_bin=i;
#ifdef DEBUG
proxy_info("Setting SQL_LOG_BIN to %d\n", i);
#endif
if (command_type == _MYSQL_COM_QUERY) {
client_myds->DSS=STATE_QUERY_SENT_NET;
uint16_t setStatus = (nTrx ? SERVER_STATUS_IN_TRANS : 0 );
@ -3834,8 +3837,23 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return true;
}
} else {
proxy_error("Unable to parse query. If correct, report it as a bug: %s\n", nq.c_str());
return false;
int kq = 0;
kq = strncmp((const char *)CurrentQuery.QueryPointer, (const char *)"SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;" , CurrentQuery.QueryLength);
if (kq == 0) {
client_myds->DSS=STATE_QUERY_SENT_NET;
uint16_t setStatus = (nTrx ? SERVER_STATUS_IN_TRANS : 0 );
if (autocommit) setStatus= SERVER_STATUS_AUTOCOMMIT;
client_myds->myprot.generate_pkt_OK(true,NULL,NULL,1,0,0,setStatus,0,NULL);
client_myds->DSS=STATE_SLEEP;
status=WAITING_CLIENT_DATA;
l_free(pkt->size,pkt->ptr);
RequestEnd(NULL);
return true;
} else {
string nqn = string((char *)CurrentQuery.QueryPointer,CurrentQuery.QueryLength);
proxy_error("Unable to parse query. If correct, report it as a bug: %s\n", nqn.c_str());
return false;
}
}
}
if (match_regexes && match_regexes[1]->match(dig)) {
@ -3988,8 +4006,23 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return true;
}
} else {
proxy_error("Unable to parse query. If correct, report it as a bug: %s\n", nq.c_str());
return false;
int kq = 0;
kq = strncmp((const char *)CurrentQuery.QueryPointer, (const char *)"/*!40101 SET SQL_MODE=@OLD_SQL_MODE */" , CurrentQuery.QueryLength);
if (kq == 0) {
client_myds->DSS=STATE_QUERY_SENT_NET;
uint16_t setStatus = (nTrx ? SERVER_STATUS_IN_TRANS : 0 );
if (autocommit) setStatus= SERVER_STATUS_AUTOCOMMIT;
client_myds->myprot.generate_pkt_OK(true,NULL,NULL,1,0,0,setStatus,0,NULL);
client_myds->DSS=STATE_SLEEP;
status=WAITING_CLIENT_DATA;
l_free(pkt->size,pkt->ptr);
RequestEnd(NULL);
return true;
} else {
string nqn = string((char *)CurrentQuery.QueryPointer,CurrentQuery.QueryLength);
proxy_error("Unable to parse query. If correct, report it as a bug: %s\n", nqn.c_str());
return false;
}
}
}
}
@ -4006,6 +4039,9 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
delete opt2;
if (rc) {
//fprintf(stderr,"time_zone='%s'\n", s.c_str());
#ifdef DEBUG
proxy_info("Setting TIME_ZONE to %s\n", s.c_str());
#endif
uint32_t time_zone_int=SpookyHash::Hash32(s.c_str(),s.length(),10);
if (client_myds->myconn->options.time_zone_int != time_zone_int) {
//fprintf(stderr,"time_zone_int='%u'\n", time_zone_int);
@ -4027,8 +4063,23 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return true;
}
} else {
proxy_error("Unable to parse query. If correct, report it as a bug: %s\n", nq.c_str());
return false;
int kq = 0;
kq = strncmp((const char *)CurrentQuery.QueryPointer, (const char *)"/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */" , CurrentQuery.QueryLength);
if (kq == 0) {
client_myds->DSS=STATE_QUERY_SENT_NET;
uint16_t setStatus = (nTrx ? SERVER_STATUS_IN_TRANS : 0 );
if (autocommit) setStatus += SERVER_STATUS_AUTOCOMMIT;
client_myds->myprot.generate_pkt_OK(true,NULL,NULL,1,0,0,setStatus,0,NULL);
client_myds->DSS=STATE_SLEEP;
status=WAITING_CLIENT_DATA;
l_free(pkt->size,pkt->ptr);
RequestEnd(NULL);
return true;
} else {
string nqn = string((char *)CurrentQuery.QueryPointer,CurrentQuery.QueryLength);
proxy_error("Unable to parse query. If correct, report it as a bug: %s\n", nqn.c_str());
return false;
}
}
}
}

@ -2465,6 +2465,12 @@ void admin_session_handler(MySQL_Session *sess, void *_pa, PtrSize_t *pkt) {
run_query=false;
goto __run_query;
}
if (!strncmp("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'performance_schema' AND table_name = 'session_variables'", query_no_space, strlen("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'performance_schema' AND table_name = 'session_variables'"))) {
l_free(query_length,query);
query=l_strdup("SELECT 0 as 'COUNT(*)'");
query_length=strlen(query)+1;
goto __run_query;
}
if (!strncmp("SHOW VARIABLES LIKE 'gtid\\_mode'", query_no_space, strlen("SHOW VARIABLES LIKE 'gtid\\_mode'"))) {
l_free(query_length,query);
query=l_strdup("SELECT variable_name Variable_name, Variable_value Value FROM global_variables WHERE Variable_name='gtid_mode'");

@ -63,7 +63,7 @@ int Thread::join()
if (m_running == 1) {
result = pthread_join(m_tid, NULL);
if (result == 0) {
m_detached = 0;
m_running = 0;
}
}
return result;

@ -44,7 +44,7 @@ COREDUMPER_DIR=$(DEPS_PATH)/google-coredumper/google-coredumper
COREDUMPER_IDIR=$(COREDUMPER_DIR)/src
COREDUMPER_LDIR=$(COREDUMPER_DIR)/.libs
CURL_DIR=$(DEPS_PATH)/curl/curl/
CURL_DIR=$(DEPS_PATH)/curl/curl
CURL_IDIR=$(CURL_DIR)/include
CURL_LDIR=$(CURL_DIR)/lib/.libs

@ -49,6 +49,15 @@ WRITER_IS_READER="${4:-1}"
ERR_FILE="${5:-/dev/null}"
RELOAD_CHECK_FILE="/var/lib/proxysql/reload"
# Prevent duplicate execution
BASENAME=`basename "$0"`
pidof -x -o %PPID ${BASENAME}
ANOTHER_PROCESS_IS_RUNNING=$?
if [ ${ANOTHER_PROCESS_IS_RUNNING} -eq 0 ]; then
echo "`date` ###### Another process is already running. Abort! ######" >> ${ERR_FILE}
exit 0
fi
echo "0" > ${RELOAD_CHECK_FILE}
if [ "$1" = '-h' -o "$1" = '--help' -o -z "$1" ]

Loading…
Cancel
Save