Added MySQL compression level

pull/4764/head
Yashwant Sahu 1 year ago
parent 6a7c1cf2d0
commit a846447a22

@ -470,6 +470,7 @@ class MySQL_Threads_Handler
bool parse_failure_logs_digest;
bool default_reconnect;
bool have_compress;
int compression_level;
bool have_ssl;
bool multiplexing;
// bool stmt_multiplexing;

@ -1167,6 +1167,7 @@ __thread int mysql_thread___poll_timeout;
__thread int mysql_thread___poll_timeout_on_failure;
__thread bool mysql_thread___connection_warming;
__thread bool mysql_thread___have_compress;
__thread int mysql_thread___compression_level;
__thread bool mysql_thread___have_ssl;
__thread bool mysql_thread___multiplexing;
__thread bool mysql_thread___log_unhealthy_connections;
@ -1463,6 +1464,7 @@ extern __thread int mysql_thread___poll_timeout;
extern __thread int mysql_thread___poll_timeout_on_failure;
extern __thread bool mysql_thread___connection_warming;
extern __thread bool mysql_thread___have_compress;
extern __thread int mysql_thread___compression_level;
extern __thread bool mysql_thread___have_ssl;
extern __thread bool mysql_thread___multiplexing;
extern __thread bool mysql_thread___log_unhealthy_connections;

@ -504,6 +504,7 @@ static char * mysql_thread_variables_names[]= {
(char *)"handle_warnings",
(char *)"evaluate_replication_lag_on_servers_load",
(char *)"proxy_protocol_networks",
(char *)"compression_level",
NULL
};
@ -1137,6 +1138,7 @@ MySQL_Threads_Handler::MySQL_Threads_Handler() {
variables.enable_load_data_local_infile=false;
variables.log_mysql_warnings_enabled=false;
variables.data_packets_history_size=0;
variables.compression_level=3;
// status variables
status_variables.mirror_sessions_current=0;
__global_MySQL_Thread_Variables_version=1;
@ -2264,6 +2266,7 @@ char ** MySQL_Threads_Handler::get_variables_list() {
VariablesPointers_int["client_host_error_counts"] = make_tuple(&variables.client_host_error_counts, 0, 1024*1024, false);
VariablesPointers_int["handle_warnings"] = make_tuple(&variables.handle_warnings, 0, 1, false);
VariablesPointers_int["evaluate_replication_lag_on_servers_load"] = make_tuple(&variables.evaluate_replication_lag_on_servers_load, 0, 1, false);
VariablesPointers_int["compression_level"] = make_tuple(&variables.compression_level, 0, 9, false);
// logs
VariablesPointers_int["auditlog_filesize"] = make_tuple(&variables.auditlog_filesize, 1024*1024, 1*1024*1024*1024, false);
@ -4180,6 +4183,7 @@ void MySQL_Thread::refresh_variables() {
REFRESH_VARIABLE_INT(poll_timeout);
REFRESH_VARIABLE_INT(poll_timeout_on_failure);
REFRESH_VARIABLE_BOOL(have_compress);
REFRESH_VARIABLE_INT(compression_level);
REFRESH_VARIABLE_BOOL(have_ssl);
REFRESH_VARIABLE_BOOL(multiplexing);
REFRESH_VARIABLE_BOOL(log_unhealthy_connections);
@ -4264,6 +4268,8 @@ MySQL_Thread::MySQL_Thread() {
mysql_thread___ssl_p2s_crl=NULL;
mysql_thread___ssl_p2s_crlpath=NULL;
mysql_thread___compression_level=3;
last_maintenance_time=0;
last_move_to_idle_thread_time=0;
maintenance_loop=true;

@ -1321,7 +1321,7 @@ void MySQL_Data_Stream::generate_compressed_packet() {
total_size+=p2.size;
l_free(p2.size,p2.ptr);
}
int rc=compress(dest, &destLen, source, sourceLen);
int rc=compress2(dest, &destLen, source, sourceLen, GloMTH->variables.compression_level);
assert(rc==Z_OK);
l_free(total_size, source);
queueOUT.pkt.size=destLen+7;
@ -1353,9 +1353,9 @@ void MySQL_Data_Stream::generate_compressed_packet() {
dest1=(Bytef *)malloc(destLen1+7);
destLen2=len2*120/100+12;
dest2=(Bytef *)malloc(destLen2+7);
rc=compress(dest1+7, &destLen1, (const unsigned char *)p2.ptr, len1);
rc=compress2(dest1+7, &destLen1, (const unsigned char *)p2.ptr, len1, GloMTH->variables.compression_level);
assert(rc==Z_OK);
rc=compress(dest2+7, &destLen2, (const unsigned char *)p2.ptr+len1, len2);
rc=compress2(dest2+7, &destLen2, (const unsigned char *)p2.ptr+len1, len2, GloMTH->variables.compression_level);
assert(rc==Z_OK);
hdr.pkt_length=destLen1;

@ -222,6 +222,7 @@ mysql_variables =
use_tcp_keepalive="mysql"
verbose_query_error="mysql"
wait_timeout="mysql"
compression_level="mysql"
}
mysql_users:
(

Loading…
Cancel
Save