Merge pull request #4083 from sysown/v2.x-fast_forward_ssl_230117

Consume all network buffer if SSL is in use
v2.4.8 v2.4.7
René Cannaò 3 years ago committed by GitHub
commit d467cc0bfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1375,11 +1375,11 @@ static void *child_mysql(void *arg) {
// PMC-10004
// we probably should use SSL_pending() and/or SSL_has_pending() to determine
// if there is more data to be read, but it doesn't seem to be working.
// Therefore we hardcored the values 4096 (4K) as a special case and
// we try to call read_from_net() again.
// Therefore we try to call read_from_net() again as long as there is data.
// Previously we hardcoded 16KB but it seems that it can return in smaller
// chunks of 4KB.
while (rb > 0 && rb%4096 == 0) {
// We finally removed the chunk size as it seems that any size is possible.
while (rb > 0) {
rb = myds->read_from_net();
if (myds->net_failure) goto __exit_child_mysql;
myds->read_pkts();

@ -3598,15 +3598,17 @@ bool MySQL_Thread::process_data_on_data_stream(MySQL_Data_Stream *myds, unsigned
// PMC-10004
// we probably should use SSL_pending() and/or SSL_has_pending() to determine
// if there is more data to be read, but it doesn't seem to be working.
// Therefore we hardcored the value 16384 (16KB) as a special case and
// we try to call read_from_net() again
// Therefore we try to call read_from_net() again as long as there is data.
// Previously we hardcoded 16KB but it seems that it can return in smaller
// chunks of 4KB.
// We finally removed the chunk size as it seems that any size is possible.
/*
int sslp = SSL_pending(myds->ssl);
int sslhp = SSL_has_pending(myds->ssl);
proxy_debug(PROXY_DEBUG_NET, 5, "Session=%p: in fast_forward mode and SSL read %d bytes , SSL_pending: %d bytes , SSL_has_pending: %d\n", myds->sess, rb, sslp, sslhp);
*/
proxy_debug(PROXY_DEBUG_NET, 5, "Session=%p, DataStream=%p , thread_session_id=%u -- in fast_forward mode and SSL read %d bytes\n", myds->sess, myds, myds->sess->thread_session_id, rb);
while (rb == 16384) {
while (rb > 0) {
rb = myds->read_from_net();
if (rb > 0 && myds->myds_type == MYDS_FRONTEND) {
status_variables.stvar[st_var_queries_frontends_bytes_recv] += rb;

@ -5466,11 +5466,11 @@ void *child_mysql(void *arg) {
// PMC-10004
// we probably should use SSL_pending() and/or SSL_has_pending() to determine
// if there is more data to be read, but it doesn't seem to be working.
// Therefore we hardcored the values 4096 (4K) as a special case and
// we try to call read_from_net() again.
// Therefore we try to call read_from_net() again as long as there is data.
// Previously we hardcoded 16KB but it seems that it can return in smaller
// chunks of 4KB.
while (rb > 0 && rb%4096 == 0) {
// We finally removed the chunk size as it seems that any size is possible.
while (rb > 0) {
rb = myds->read_from_net();
if (myds->net_failure) goto __exit_child_mysql;
myds->read_pkts();

@ -944,11 +944,11 @@ static void *child_mysql(void *arg) {
// PMC-10004
// we probably should use SSL_pending() and/or SSL_has_pending() to determine
// if there is more data to be read, but it doesn't seem to be working.
// Therefore we hardcored the values 4096 (4K) as a special case and
// we try to call read_from_net() again.
// Therefore we try to call read_from_net() again as long as there is data.
// Previously we hardcoded 16KB but it seems that it can return in smaller
// chunks of 4KB.
while (rb > 0 && rb%4096 == 0) {
// We finally removed the chunk size as it seems that any size is possible.
while (rb > 0) {
rb = myds->read_from_net();
if (myds->net_failure) goto __exit_child_mysql;
myds->read_pkts();

@ -66,6 +66,11 @@ std::vector<std::string> queries_SQL2 = {
"INSERT INTO tbl1459 SELECT NULL , i1 + id, i2 + id FROM tbl1459",
};
std::vector<std::string> queries_SQL4 = {
"DROP TABLE IF EXISTS tbl1459",
"VACUUM",
};
std::vector<unsigned long long int> queries_limits = {
1, 10, 20, 27, 103, 169, 320, 450, 512, 619, 915, 1022,
1033, 1145, 1516, 1920, 2034, 5014, 9932, 10111,
@ -255,6 +260,10 @@ int main(int argc, char** argv) {
// clean up
if (run_queries_sets(queries_SQL4, mysqls[0], "Running on SQLite3"))
return exit_status();
for (int i=0; i<5; i++) {
diag("Connection %d has thread_id: %lu", i, mysqls[i]->thread_id);

@ -55,6 +55,11 @@ std::vector<std::string> queries_SQL3 = {
"CREATE TABLE tbl1459v (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , t1 VARCHAR)",
};
std::vector<std::string> queries_SQL4 = {
"DROP TABLE IF EXISTS tbl1459v",
"VACUUM",
};
int run_queries_sets(std::vector<std::string>& queries, MYSQL *my, const std::string& message_prefix) {
for (std::vector<std::string>::iterator it = queries.begin(); it != queries.end(); it++) {
@ -246,6 +251,9 @@ int main(int argc, char** argv) {
}
}
}
// clean up
if (run_queries_sets(queries_SQL4, mysqls[0], "Running on SQLite3"))
return exit_status();
mysql_close(mysqladmin);

Loading…
Cancel
Save