diff --git a/.gitignore b/.gitignore index 2e88e4698..36614e6fe 100644 --- a/.gitignore +++ b/.gitignore @@ -150,6 +150,7 @@ deps/libev/libev-4.24/ #libssl deps/libssl/openssl-1.1.0h/ deps/libssl/openssl-1.1.1b/ +deps/libssl/openssl-1.1.1d/ #google coredumper deps/google-coredumper/google-coredumper/ diff --git a/deps/Makefile b/deps/Makefile index 3b51d58b5..56becb207 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -33,8 +33,9 @@ libinjection: libinjection/libinjection/src/libinjection.a libssl/openssl/libssl.a: # cd libssl && rm -rf openssl-1.1.0h || true # cd libssl && tar -zxf openssl-1.1.0h.tar.gz + cd libssl && rm -rf openssl-1.1.1d || true cd libssl && rm -rf openssl-1.1.0h || true - cd libssl && tar -zxf openssl-1.1.0h.tar.gz + cd libssl && tar -zxf openssl-1.1.1d.tar.gz cd libssl/openssl && ./config no-ssl3 cd libssl/openssl && CC=${CC} CXX=${CXX} ${MAKE} cd libssl/openssl && ln -s . lib # curl wants this path @@ -121,7 +122,9 @@ mariadb-client-library/mariadb_client/libmariadb/libmariadbclient.a: libssl/open cd mariadb-client-library && rm -rf mariadb-connector-c-3.1.4-src cd mariadb-client-library && tar -zxf mariadb-connector-c-3.1.4-src.tar.gz cd mariadb-client-library/mariadb_client && patch ./plugins/auth/CMakeLists.txt < ../plugin_auth_CMakeLists.txt.patch - cd mariadb-client-library/mariadb_client && cmake . -DOPENSSL_ROOT_DIR=$(shell pwd)/libssl/openssl/ -DOPENSSL_LIBRARIES=$(shell pwd)/libssl/openssl/ . + cd mariadb-client-library/mariadb_client && patch ./CMakeLists.txt < ../CMakeLists.txt.patch +# cd mariadb-client-library/mariadb_client && cmake . -DOPENSSL_ROOT_DIR=$(shell pwd)/libssl/openssl/ -DOPENSSL_LIBRARIES=$(shell pwd)/libssl/openssl/ . + cd mariadb-client-library/mariadb_client && cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(shell pwd)/libssl/openssl/ -DOPENSSL_LIBRARIES=$(shell pwd)/libssl/openssl/ . # cd mariadb-client-library/mariadb_client && cmake . -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl # this is needed on MacOSX cd mariadb-client-library/mariadb_client && patch libmariadb/mariadb_stmt.c < ../mariadb_stmt.c.patch cd mariadb-client-library/mariadb_client && patch libmariadb/mariadb_lib.c < ../mariadb_lib.c.patch @@ -207,6 +210,7 @@ cleanall: cd libev && rm -rf libev-4.24 || true cd libssl && rm -rf openssl-1.1.0h || true cd libssl && rm -rf openssl-1.1.1b || true + cd libssl && rm -rf openssl-1.1.1d || true cd libconfig && rm -rf libconfig-1.7.2 || true .PHONY: cleanall diff --git a/deps/libssl/openssl b/deps/libssl/openssl index 7d0689fa9..08e39a1f3 120000 --- a/deps/libssl/openssl +++ b/deps/libssl/openssl @@ -1 +1 @@ -openssl-1.1.0h \ No newline at end of file +openssl-1.1.1d \ No newline at end of file diff --git a/deps/libssl/openssl-1.1.1d.tar.gz b/deps/libssl/openssl-1.1.1d.tar.gz new file mode 100644 index 000000000..216017a51 Binary files /dev/null and b/deps/libssl/openssl-1.1.1d.tar.gz differ diff --git a/deps/mariadb-client-library/CMakeLists.txt.patch b/deps/mariadb-client-library/CMakeLists.txt.patch new file mode 100644 index 000000000..36c27528b --- /dev/null +++ b/deps/mariadb-client-library/CMakeLists.txt.patch @@ -0,0 +1,13 @@ +--- CMakeLists.txt 2020-02-27 15:01:10.993225716 +0100 ++++ ../CMakeLists.txt 2020-02-27 15:00:57.705257256 +0100 +@@ -132,8 +132,8 @@ + # Disable dbug information for release builds + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF") +-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF") +-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF") ++SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF -ggdb -O0") ++SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF -ggdb -O0") + + IF(CMAKE_COMPILER_IS_GNUCC) + INCLUDE(CheckCCompilerFlag) diff --git a/deps/mariadb-client-library/mariadb_lib.c.patch b/deps/mariadb-client-library/mariadb_lib.c.patch index c6606a890..42ac20bb0 100644 --- a/deps/mariadb-client-library/mariadb_lib.c.patch +++ b/deps/mariadb-client-library/mariadb_lib.c.patch @@ -117,3 +117,11 @@ if (!mysql_real_query(mysql, buff, (unsigned long)strlen(buff))) { mysql->charset= cs; +@@ -3494,6 +3541,7 @@ + } + + error: ++ if (!cs) + my_set_error(mysql, CR_CANT_READ_CHARSET, SQLSTATE_UNKNOWN, + 0, csname, "compiled_in"); + return(mysql->net.last_errno); diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index d7056a8aa..e382077ab 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -2753,6 +2753,8 @@ bool MySQL_Session::handler_again___status_CHANGING_SCHEMA(int *_rc) { bool MySQL_Session::handler_again___status_CONNECTING_SERVER(int *_rc) { //fprintf(stderr,"CONNECTING_SERVER\n"); + unsigned long long curtime=monotonic_time(); + thread->atomic_curtime=curtime; if (mirror) { mybe->server_myds->connect_retries_on_failure=0; // no try for mirror mybe->server_myds->wait_until=thread->curtime+mysql_thread___connect_timeout_server*1000; diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index fc4656f71..41404f6f9 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -830,6 +830,14 @@ handler_again: break; break; case ASYNC_CONNECT_END: + if (myds) { + if (myds->sess) { + if (myds->sess->thread) { + unsigned long long curtime = monotonic_time(); + myds->sess->thread->atomic_curtime=curtime; + } + } + } if (!ret_mysql) { // always increase the counter proxy_error("Failed to mysql_real_connect() on %s:%d , FD (Conn:%d , MyDS:%d) , %d: %s.\n", parent->address, parent->port, mysql->net.fd , myds->fd, mysql_errno(mysql), mysql_error(mysql)); @@ -1280,7 +1288,8 @@ handler_again: } break; case ASYNC_SET_AUTOCOMMIT_FAILED: - fprintf(stderr,"%s\n",mysql_error(mysql)); + //fprintf(stderr,"%s\n",mysql_error(mysql)); + proxy_error("Failed SET AUTOCOMMIT: %s\n",mysql_error(mysql)); break; case ASYNC_SET_NAMES_START: set_names_start(); @@ -1308,7 +1317,8 @@ handler_again: case ASYNC_SET_NAMES_SUCCESSFUL: break; case ASYNC_SET_NAMES_FAILED: - fprintf(stderr,"%s\n",mysql_error(mysql)); + //fprintf(stderr,"%s\n",mysql_error(mysql)); + proxy_error("Failed SET NAMES: %s\n",mysql_error(mysql)); break; case ASYNC_INITDB_START: initdb_start(); @@ -1336,7 +1346,8 @@ handler_again: case ASYNC_INITDB_SUCCESSFUL: break; case ASYNC_INITDB_FAILED: - fprintf(stderr,"%s\n",mysql_error(mysql)); + proxy_error("Failed INITDB: %s\n",mysql_error(mysql)); + //fprintf(stderr,"%s\n",mysql_error(mysql)); break; case ASYNC_SET_OPTION_START: set_option_start(); diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 38049f01e..7b26faf62 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -8,6 +8,9 @@ #include "MySQL_PreparedStatement.h" #include "MySQL_Data_Stream.h" +/* + +in libssl 1.1.0 struct bio_st { const BIO_METHOD *method; long (*callback) (struct bio_st *, int, const char *, int, long, long); @@ -26,6 +29,32 @@ struct bio_st { CRYPTO_EX_DATA ex_data; CRYPTO_RWLOCK *lock; }; +*/ + +typedef int CRYPTO_REF_COUNT; + +// in libssl 1.1.1 +struct bio_st { + const BIO_METHOD *method; + /* bio, mode, argp, argi, argl, ret */ + BIO_callback_fn callback; + BIO_callback_fn_ex callback_ex; + char *cb_arg; /* first argument for the callback */ + int init; + int shutdown; + int flags; /* extra storage */ + int retry_reason; + int num; + void *ptr; + struct bio_st *next_bio; /* used by filter BIOs */ + struct bio_st *prev_bio; /* used by filter BIOs */ + CRYPTO_REF_COUNT references; + uint64_t num_read; + uint64_t num_write; + CRYPTO_EX_DATA ex_data; + CRYPTO_RWLOCK *lock; +}; + #define RESULTSET_BUFLEN_DS_16K 16000 #define RESULTSET_BUFLEN_DS_1M 1000*1024 @@ -108,6 +137,7 @@ static void __dump_pkt(const char *func, unsigned char *_ptr, unsigned int len) static enum sslstatus get_sslstatus(SSL* ssl, int n) { int err = SSL_get_error(ssl, n); + ERR_clear_error(); switch (err) { case SSL_ERROR_NONE: return SSLSTATUS_OK; diff --git a/src/proxysql.cfg b/src/proxysql.cfg index d210cc56e..dd230c349 100644 --- a/src/proxysql.cfg +++ b/src/proxysql.cfg @@ -8,7 +8,7 @@ restart_on_missing_heartbeats=10 datadir="/var/lib/proxysql" //execute_on_exit_failure="/path/to/script" //ldap_auth_plugin="../../proxysql_ldap_plugin/MySQL_LDAP_Authentication_plugin.so" -web_interface_plugin="../../proxysql_web_interface_plugin/src/Web_Interface_plugin.so" +#web_interface_plugin="../../proxysql_web_interface_plugin/src/Web_Interface_plugin.so" admin_variables= {