Skip to content

Commit

Permalink
1. Using now mysql_thread___protocol_compression_level
Browse files Browse the repository at this point in the history
2. Changed performance diff to float in tap test
  • Loading branch information
yashwantsahu20 committed Jan 9, 2025
1 parent 2f3b2da commit 7c3a832
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/mysql_data_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ void MySQL_Data_Stream::generate_compressed_packet() {
total_size+=p2.size;
l_free(p2.size,p2.ptr);
}
int rc=compress2(dest, &destLen, source, sourceLen, GloMTH->variables.protocol_compression_level);
int rc=compress2(dest, &destLen, source, sourceLen, mysql_thread___protocol_compression_level);
assert(rc==Z_OK);
l_free(total_size, source);
queueOUT.pkt.size=destLen+7;
Expand Down
10 changes: 5 additions & 5 deletions test/tap/tests/mysql-protocol_compression_level-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main(int argc, char** argv) {
MYSQL* proxysql_admin = nullptr;
MYSQL* mysql_compression = nullptr;
MYSQL* mysql = nullptr;
int performance_diff = 0;
float performance_diff = 0;

if(cl.getEnv())
return exit_status();
Expand Down Expand Up @@ -142,9 +142,9 @@ int main(int argc, char** argv) {
}

diff = abs(time_proxy - time_proxy_compressed);
performance_diff = (diff * 100) / time_proxy;
performance_diff = (float)(diff * 100) / time_proxy;

ok((performance_diff < 10), "proxysql with compression performed well compared to without compression. Performance difference: %d percentage", performance_diff);
ok((performance_diff < 10), "proxysql with compression performed well compared to without compression. Performance difference: %f percentage", performance_diff);

time_mysql_compressed = calculate_query_execution_time(mysql_compression, query);
diag("Time taken for query with mysql with compression: %ld", time_mysql_compressed);
Expand All @@ -159,9 +159,9 @@ int main(int argc, char** argv) {
}

diff = abs(time_mysql_without_compressed - time_mysql_compressed);
performance_diff = (diff * 100) / time_mysql_without_compressed;
performance_diff = (float)(diff * 100) / time_mysql_without_compressed;

ok((performance_diff < 10), "MySQL with compression performed well compared to without compression. Performance difference: %d percentage", performance_diff);
ok((performance_diff < 10), "MySQL with compression performed well compared to without compression. Performance difference: %f percentage", performance_diff);

ret = get_variable_value(proxysql_admin, "mysql-protocol_compression_level", compression_level, true);
if (ret == EXIT_SUCCESS) {
Expand Down

0 comments on commit 7c3a832

Please sign in to comment.