From 6c15528757b2e3a67655f0e73659ca9eefa23ded Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Tue, 24 Oct 2023 07:21:54 +0000 Subject: [PATCH] use inludes from our deps intead of system --- include/proxysql_admin.h | 6 +- include/proxysql_glovars.hpp | 2 +- test/tap/tests/admin-listen_on_unix-t.cpp | 4 +- test/tap/tests/admin_show_create_table-t.cpp | 4 +- test/tap/tests/admin_show_fields_from-t.cpp | 4 +- test/tap/tests/admin_show_table_status-t.cpp | 4 +- test/tap/tests/admin_various_commands-t.cpp | 4 +- test/tap/tests/admin_various_commands2-t.cpp | 4 +- test/tap/tests/admin_various_commands3-t.cpp | 4 +- test/tap/tests/charset_unsigned_int-t.cpp | 2 +- test/tap/tests/firewall_commands1-t.cpp | 4 +- test/tap/tests/kill_connection-t.cpp | 2 +- test/tap/tests/kill_connection2-t.cpp | 2 +- test/tap/tests/kill_connection3-t.cpp | 2 +- test/tap/tests/max_connections_ff-t.cpp | 4 +- .../tests/multiple_prepared_statements-t.cpp | 4 +- test/tap/tests/mysql-fast_forward-t.cpp | 2 +- test/tap/tests/mysql-init_connect-1-t.cpp | 2 +- test/tap/tests/mysql-init_connect-2-t.cpp | 2 +- test/tap/tests/mysql-last_insert_id-t.cpp | 2 +- test/tap/tests/mysql-mirror1-t.cpp | 2 +- test/tap/tests/mysql-set_transaction-t.cpp | 2 +- test/tap/tests/mysql-sql_log_bin-error-t.cpp | 2 +- test/tap/tests/mysql-test_ssl_CA-t.cpp | 2 +- ...ostgroup_attributes-servers_defaults-t.cpp | 4 +- .../tap/tests/mysql_stmt_send_long_data-t.cpp | 2 +- .../mysql_stmt_send_long_data_large-t.cpp | 2 +- .../tap/tests/prepare_statement_err3024-t.cpp | 2 +- .../reg_test_1493-mixed_compression-t.cpp | 4 +- ...4-mariadb_read_stmt_execute_response-t.cpp | 2 +- .../tests/reg_test_1574-stmt_metadata-t.cpp | 2 +- .../tap/tests/reg_test_2793-compression-t.cpp | 4 +- .../reg_test_3184-set_wait_timeout-t.cpp | 2 +- .../tests/reg_test_3247-mycli_support-t.cpp | 4 +- test/tap/tests/reg_test_3273_ssl_con-t.cpp | 2 +- ..._3317-lock_hostgroup_special_queries-t.cpp | 2 +- ..._3327-process_query_set_status_flags-t.cpp | 2 +- ..._test_3427-stmt_first_comment1-param-t.cpp | 285 +++++++++++++++++- .../reg_test_3427-stmt_first_comment1-t.cpp | 4 +- ..._test_3427-stmt_first_comment2-param-t.cpp | 285 +++++++++++++++++- .../reg_test_3427-stmt_first_comment2-t.cpp | 285 +++++++++++++++++- .../tests/reg_test_3434-text_stmt_mix-t.cpp | 2 +- .../reg_test_3493-USE_with_comment-t.cpp | 2 +- .../tap/tests/reg_test_3504-change_user-t.cpp | 4 +- .../reg_test_3504-change_user_helper.cpp | 4 +- .../reg_test_3546-stmt_empty_params-t.cpp | 4 +- .../reg_test_3549-autocommit_tracking-t.cpp | 2 +- .../tests/reg_test_3585-stmt_metadata-t.cpp | 2 +- .../tests/reg_test_3591-restapi_num_fds-t.cpp | 2 +- .../tests/reg_test_3603-stmt_metadata-t.cpp | 2 +- .../tests/reg_test_3606-mysql_warnings-t.cpp | 6 +- ...5-sqlite3_session_client_error_limit-t.cpp | 4 +- .../reg_test_3690-admin_large_pkts-t.cpp | 2 +- .../tap/tests/reg_test_3765_ssl_pollout-t.cpp | 2 +- .../tests/reg_test_3838-restapi_eintr-t.cpp | 4 +- test/tap/tests/reg_test_3847_admin_lock-t.cpp | 4 +- ...ast_forward_malformed_packet-mysqlsh-t.cpp | 2 +- ...t_3992_fast_forward_malformed_packet-t.cpp | 2 +- ...eg_test_4001-restapi_scripts_num_fds-t.cpp | 2 +- .../tests/reg_test_4072-show-warnings-t.cpp | 4 +- .../tests/reg_test_4264-commit_rollback-t.cpp | 4 +- .../reg_test_4300-dollar_quote_check-t.cpp | 4 +- .../reg_test_fast_forward_split_packet-t.cpp | 2 +- .../reg_test_mariadb_stmt_store_result-t.cpp | 2 +- .../tests/reg_test_sql_calc_found_rows-t.cpp | 4 +- .../reg_test_stmt_resultset_err_no_rows-t.cpp | 4 +- ..._test_stmt_resultset_err_no_rows_php-t.cpp | 4 +- .../tests/repro_3404-mysql_close_fd_leak.cpp | 2 +- test/tap/tests/repro_test_leak_3350.cpp | 2 +- test/tap/tests/repro_test_leak_3525.cpp | 2 +- test/tap/tests/savepoint-3749-t.cpp | 2 +- test/tap/tests/savepoint-948-t.cpp | 2 +- test/tap/tests/set_character_set-t.cpp | 2 +- test/tap/tests/set_testing-240-t.cpp | 2 +- test/tap/tests/set_testing-multi-t.cpp | 2 +- test/tap/tests/set_testing-t.cpp | 2 +- test/tap/tests/sqlite3-t.cpp | 3 +- test/tap/tests/sqlite_autocommit-t.cpp | 2 +- ...metheus_metrics_dump-t_disabled_gh3571.cpp | 4 +- test/tap/tests/test_admin_stats-t.cpp | 4 +- .../test_auto_increment_delay_multiplex-t.cpp | 4 +- test/tap/tests/test_binlog_fast_forward-t.cpp | 2 +- test/tap/tests/test_binlog_reader-t.cpp | 4 +- ...inlog_reader_uses_previous_hostgroup-t.cpp | 2 +- test/tap/tests/test_clickhouse_server-t.cpp | 4 +- test/tap/tests/test_client_limit_error-t.cpp | 4 +- test/tap/tests/test_cluster1-t.cpp | 2 +- test/tap/tests/test_cluster_sync-t.cpp | 4 +- ...com_reset_connection_com_change_user-t.cpp | 4 +- .../tests/test_connection_annotation-t.cpp | 4 +- .../tests/test_csharp_connector_support-t.cpp | 2 +- test/tap/tests/test_debug_filters-t.cpp | 2 +- ..._default_value_transaction_isolation-t.cpp | 2 +- ...ult_value_transaction_isolation_attr-t.cpp | 2 +- test/tap/tests/test_digest_umap_aux-t.cpp | 2 +- test/tap/tests/test_dns_cache-t.cpp | 4 +- .../test_enforce_autocommit_on_reads-t.cpp | 2 +- .../tests/test_filtered_set_statements-t.cpp | 2 +- test/tap/tests/test_firewall-t.cpp | 2 +- test/tap/tests/test_flagOUT_weight-t.cpp | 2 +- test/tap/tests/test_gtid_forwarding-t.cpp | 4 +- .../test_keep_multiplexing_variables-t.cpp | 2 +- test/tap/tests/test_log_last_insert_id-t.cpp | 4 +- .../test_mysql_connect_retries_delay-t.cpp | 4 +- .../test_mysql_hostgroup_attributes-1-t.cpp | 2 +- .../test_mysql_query_rules_fast_routing-t.cpp | 2 +- test/tap/tests/test_mysqlsh-t.cpp | 4 +- test/tap/tests/test_prometheus_metrics-t.cpp | 4 +- test/tap/tests/test_ps_async-t.cpp | 2 +- test/tap/tests/test_ps_hg_routing-t.cpp | 2 +- test/tap/tests/test_ps_large_result-t.cpp | 2 +- test/tap/tests/test_ps_no_store-t.cpp | 2 +- .../tests/test_query_cache_soft_ttl_pct-t.cpp | 2 +- ...t_query_rules_fast_routing_algorithm-t.cpp | 4 +- test/tap/tests/test_query_rules_routing-t.cpp | 4 +- test/tap/tests/test_query_timeout-t.cpp | 2 +- ...ad_only_actions_offline_hard_servers-t.cpp | 2 +- test/tap/tests/test_rw_binary_data-t.cpp | 4 +- .../tests/test_set_character_results-t.cpp | 2 +- test/tap/tests/test_set_collation-t.cpp | 2 +- .../test_simple_embedded_HTTP_server-t.cpp | 4 +- test/tap/tests/test_sqlite3_server-t.cpp | 4 +- ...test_sqlite3_server_and_fast_routing-t.cpp | 4 +- test/tap/tests/test_ssl_connect-t.cpp | 4 +- test/tap/tests/test_ssl_fast_forward-1-t.cpp | 2 +- test/tap/tests/test_ssl_fast_forward-2-t.cpp | 2 +- test/tap/tests/test_ssl_fast_forward-3-t.cpp | 2 +- test/tap/tests/test_ssl_large_query-1-t.cpp | 2 +- test/tap/tests/test_ssl_large_query-2-t.cpp | 2 +- .../test_stats_proxysql_message_metrics-t.cpp | 4 +- ...ottle_max_bytes_per_second_to_client-t.cpp | 2 +- test/tap/tests/test_unshun_algorithm-t.cpp | 4 +- test/tap/tests/test_unsupported_queries-t.cpp | 4 +- .../deprecate_eof_support/Makefile | 105 ++++--- .../deprecate_eof_cache-t.cpp | 9 +- .../eof_conn_options_check-t.cpp | 2 + .../eof_fast_forward-t.cpp | 8 +- .../eof_packet_mixed_queries-t.cpp | 4 +- .../deprecate_eof_support/fwd_eof_query.cpp | 8 +- 139 files changed, 1126 insertions(+), 238 deletions(-) mode change 120000 => 100644 test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp mode change 120000 => 100644 test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp mode change 120000 => 100644 test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp diff --git a/include/proxysql_admin.h b/include/proxysql_admin.h index 12037861cf..6eef38bbb4 100644 --- a/include/proxysql_admin.h +++ b/include/proxysql_admin.h @@ -1,9 +1,9 @@ #ifndef __CLASS_PROXYSQL_ADMIN_H #define __CLASS_PROXYSQL_ADMIN_H -#include -#include -#include +#include "prometheus/exposer.h" +#include "prometheus/counter.h" +#include "prometheus/gauge.h" #include "query_processor.h" #include "proxy_defines.h" diff --git a/include/proxysql_glovars.hpp b/include/proxysql_glovars.hpp index fe23e756fd..119d336c6a 100644 --- a/include/proxysql_glovars.hpp +++ b/include/proxysql_glovars.hpp @@ -5,7 +5,7 @@ #define CLUSTER_SYNC_INTERFACES_MYSQL "('mysql-interfaces')" #include -#include +#include "prometheus/registry.h" #include "configfile.hpp" #include "proxy_defines.h" diff --git a/test/tap/tests/admin-listen_on_unix-t.cpp b/test/tap/tests/admin-listen_on_unix-t.cpp index b5917a5d7c..f562d3adea 100644 --- a/test/tap/tests/admin-listen_on_unix-t.cpp +++ b/test/tap/tests/admin-listen_on_unix-t.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/admin_show_create_table-t.cpp b/test/tap/tests/admin_show_create_table-t.cpp index 7647e59891..18aa4a4751 100644 --- a/test/tap/tests/admin_show_create_table-t.cpp +++ b/test/tap/tests/admin_show_create_table-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/admin_show_fields_from-t.cpp b/test/tap/tests/admin_show_fields_from-t.cpp index 6ace382f26..4578f5289f 100644 --- a/test/tap/tests/admin_show_fields_from-t.cpp +++ b/test/tap/tests/admin_show_fields_from-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/admin_show_table_status-t.cpp b/test/tap/tests/admin_show_table_status-t.cpp index 42c02b7d07..27f57ebc05 100644 --- a/test/tap/tests/admin_show_table_status-t.cpp +++ b/test/tap/tests/admin_show_table_status-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/admin_various_commands-t.cpp b/test/tap/tests/admin_various_commands-t.cpp index db683ba859..86016e91c8 100644 --- a/test/tap/tests/admin_various_commands-t.cpp +++ b/test/tap/tests/admin_various_commands-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/admin_various_commands2-t.cpp b/test/tap/tests/admin_various_commands2-t.cpp index d38c2cc409..526d8bb879 100644 --- a/test/tap/tests/admin_various_commands2-t.cpp +++ b/test/tap/tests/admin_various_commands2-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/admin_various_commands3-t.cpp b/test/tap/tests/admin_various_commands3-t.cpp index 4a80f16b08..619a56e7b0 100644 --- a/test/tap/tests/admin_various_commands3-t.cpp +++ b/test/tap/tests/admin_various_commands3-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/charset_unsigned_int-t.cpp b/test/tap/tests/charset_unsigned_int-t.cpp index 62fd4cdac6..fafc557d48 100644 --- a/test/tap/tests/charset_unsigned_int-t.cpp +++ b/test/tap/tests/charset_unsigned_int-t.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/firewall_commands1-t.cpp b/test/tap/tests/firewall_commands1-t.cpp index f3bfd1a631..6c4c783fc6 100644 --- a/test/tap/tests/firewall_commands1-t.cpp +++ b/test/tap/tests/firewall_commands1-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/kill_connection-t.cpp b/test/tap/tests/kill_connection-t.cpp index ade613df06..5f964a959d 100644 --- a/test/tap/tests/kill_connection-t.cpp +++ b/test/tap/tests/kill_connection-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/kill_connection2-t.cpp b/test/tap/tests/kill_connection2-t.cpp index 3b89032e98..947c9d9cf5 100644 --- a/test/tap/tests/kill_connection2-t.cpp +++ b/test/tap/tests/kill_connection2-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/kill_connection3-t.cpp b/test/tap/tests/kill_connection3-t.cpp index 3fd31bf98a..ef28ac6cb6 100644 --- a/test/tap/tests/kill_connection3-t.cpp +++ b/test/tap/tests/kill_connection3-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/max_connections_ff-t.cpp b/test/tap/tests/max_connections_ff-t.cpp index 22f1285abb..0dfe61f503 100644 --- a/test/tap/tests/max_connections_ff-t.cpp +++ b/test/tap/tests/max_connections_ff-t.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "json.hpp" diff --git a/test/tap/tests/multiple_prepared_statements-t.cpp b/test/tap/tests/multiple_prepared_statements-t.cpp index 8a4560437c..1497f85118 100644 --- a/test/tap/tests/multiple_prepared_statements-t.cpp +++ b/test/tap/tests/multiple_prepared_statements-t.cpp @@ -21,8 +21,8 @@ It stresses how proxysql managers prepared statements, specifically: #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "command_line.h" #include "proxysql_utils.h" diff --git a/test/tap/tests/mysql-fast_forward-t.cpp b/test/tap/tests/mysql-fast_forward-t.cpp index 7b43a29276..6fa29c4eb0 100644 --- a/test/tap/tests/mysql-fast_forward-t.cpp +++ b/test/tap/tests/mysql-fast_forward-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-init_connect-1-t.cpp b/test/tap/tests/mysql-init_connect-1-t.cpp index b0643b14a4..65dc2202b4 100644 --- a/test/tap/tests/mysql-init_connect-1-t.cpp +++ b/test/tap/tests/mysql-init_connect-1-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-init_connect-2-t.cpp b/test/tap/tests/mysql-init_connect-2-t.cpp index cc9aeea1ed..705869c70c 100644 --- a/test/tap/tests/mysql-init_connect-2-t.cpp +++ b/test/tap/tests/mysql-init_connect-2-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-last_insert_id-t.cpp b/test/tap/tests/mysql-last_insert_id-t.cpp index 4d8acd3acc..1e8e9d18b1 100644 --- a/test/tap/tests/mysql-last_insert_id-t.cpp +++ b/test/tap/tests/mysql-last_insert_id-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-mirror1-t.cpp b/test/tap/tests/mysql-mirror1-t.cpp index 42e00c8726..54e63488f7 100644 --- a/test/tap/tests/mysql-mirror1-t.cpp +++ b/test/tap/tests/mysql-mirror1-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-set_transaction-t.cpp b/test/tap/tests/mysql-set_transaction-t.cpp index 5472e97dd2..1948bafb40 100644 --- a/test/tap/tests/mysql-set_transaction-t.cpp +++ b/test/tap/tests/mysql-set_transaction-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-sql_log_bin-error-t.cpp b/test/tap/tests/mysql-sql_log_bin-error-t.cpp index 9e1e4ad792..8311372a6b 100644 --- a/test/tap/tests/mysql-sql_log_bin-error-t.cpp +++ b/test/tap/tests/mysql-sql_log_bin-error-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql-test_ssl_CA-t.cpp b/test/tap/tests/mysql-test_ssl_CA-t.cpp index 7ded1443e9..b09d659e03 100644 --- a/test/tap/tests/mysql-test_ssl_CA-t.cpp +++ b/test/tap/tests/mysql-test_ssl_CA-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include #include "tap.h" diff --git a/test/tap/tests/mysql_hostgroup_attributes-servers_defaults-t.cpp b/test/tap/tests/mysql_hostgroup_attributes-servers_defaults-t.cpp index 06a1907214..c0dcd1a38a 100644 --- a/test/tap/tests/mysql_hostgroup_attributes-servers_defaults-t.cpp +++ b/test/tap/tests/mysql_hostgroup_attributes-servers_defaults-t.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "json.hpp" diff --git a/test/tap/tests/mysql_stmt_send_long_data-t.cpp b/test/tap/tests/mysql_stmt_send_long_data-t.cpp index d14a7e102e..92722c5bf8 100644 --- a/test/tap/tests/mysql_stmt_send_long_data-t.cpp +++ b/test/tap/tests/mysql_stmt_send_long_data-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp b/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp index 15486cfa64..e0e504e5bf 100644 --- a/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp +++ b/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/prepare_statement_err3024-t.cpp b/test/tap/tests/prepare_statement_err3024-t.cpp index 51eea03e22..3938d4cf1e 100644 --- a/test/tap/tests/prepare_statement_err3024-t.cpp +++ b/test/tap/tests/prepare_statement_err3024-t.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_1493-mixed_compression-t.cpp b/test/tap/tests/reg_test_1493-mixed_compression-t.cpp index 75edafffba..95d4c9b06c 100644 --- a/test/tap/tests/reg_test_1493-mixed_compression-t.cpp +++ b/test/tap/tests/reg_test_1493-mixed_compression-t.cpp @@ -8,8 +8,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp b/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp index a803d0d2d6..0a78523c7c 100644 --- a/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp +++ b/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp b/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp index 742ee3aed7..fb61d6a474 100644 --- a/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp +++ b/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_2793-compression-t.cpp b/test/tap/tests/reg_test_2793-compression-t.cpp index 5f493f0b7d..f0780da770 100644 --- a/test/tap/tests/reg_test_2793-compression-t.cpp +++ b/test/tap/tests/reg_test_2793-compression-t.cpp @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3184-set_wait_timeout-t.cpp b/test/tap/tests/reg_test_3184-set_wait_timeout-t.cpp index ff5b5cdcc5..d3eddc8d40 100644 --- a/test/tap/tests/reg_test_3184-set_wait_timeout-t.cpp +++ b/test/tap/tests/reg_test_3184-set_wait_timeout-t.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3247-mycli_support-t.cpp b/test/tap/tests/reg_test_3247-mycli_support-t.cpp index 0cb9505c73..86fd06cb81 100644 --- a/test/tap/tests/reg_test_3247-mycli_support-t.cpp +++ b/test/tap/tests/reg_test_3247-mycli_support-t.cpp @@ -8,8 +8,8 @@ #include #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3273_ssl_con-t.cpp b/test/tap/tests/reg_test_3273_ssl_con-t.cpp index 6cc59cd3d4..1c1193b82c 100644 --- a/test/tap/tests/reg_test_3273_ssl_con-t.cpp +++ b/test/tap/tests/reg_test_3273_ssl_con-t.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include "mysql.h" #include #include "tap.h" diff --git a/test/tap/tests/reg_test_3317-lock_hostgroup_special_queries-t.cpp b/test/tap/tests/reg_test_3317-lock_hostgroup_special_queries-t.cpp index 46264349c1..5eadc264fb 100644 --- a/test/tap/tests/reg_test_3317-lock_hostgroup_special_queries-t.cpp +++ b/test/tap/tests/reg_test_3317-lock_hostgroup_special_queries-t.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3327-process_query_set_status_flags-t.cpp b/test/tap/tests/reg_test_3327-process_query_set_status_flags-t.cpp index 8f6c0506ed..98a0983dbc 100644 --- a/test/tap/tests/reg_test_3327-process_query_set_status_flags-t.cpp +++ b/test/tap/tests/reg_test_3327-process_query_set_status_flags-t.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp deleted file mode 120000 index e365158207..0000000000 --- a/test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp +++ /dev/null @@ -1 +0,0 @@ -reg_test_3427-stmt_first_comment1-t.cpp \ No newline at end of file diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp new file mode 100644 index 0000000000..9b87053899 --- /dev/null +++ b/test/tap/tests/reg_test_3427-stmt_first_comment1-param-t.cpp @@ -0,0 +1,284 @@ +/** + * @file reg_test_3427-stmt_first_comment-t.cpp + * @brief This test is a regression test for exercising all code related to + * 'first_comment' changes added in PR #3453. + * @details Testing revealed that the fix introduced for proper routing of + * prepared statements with query rules has invalid interaction with query + * annotation 'hostgroup' feature. + * For solving the issue, 'first_comment' was made part of 'MySQL_STMT_Global_info'. + * This test aims to exercise all the parts of ProxySQL affected by this change. + * + * Procedure: + * ========= + * + * The test creates a number of prepared statements and execute them, until passing + * the limit of prepared statements allowed per connection. After the connection + * has been reset by ProxySQL because of the limit exceeding, it tries to execute + * the same prepared statements again. This way those prepared statements wont be + * available in the connection and will need to be fetched by ProxySQL for the + * reset connection. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mysql.h" +#include "mysql/mysqld_error.h" + +#include "proxysql_utils.h" +#include "tap.h" +#include "command_line.h" +#include "utils.h" +#include "errno.h" + +/** + * @brief String size of the columns created for the testing table. + */ +const int STRING_SIZE=32; +/** + * @brief Number of max stmt per connection to be configured for + * ProxySQL. + */ +const uint32_t MAX_STMT_NUM_QUERIES = 20; +/** + * @brief Number of queries to RESET the connection being target, + * it's simply: MAX_STMT_NUM_QUERIES + 1 + */ +const uint32_t RESET_CONNECTION_QUERIES = 2*MAX_STMT_NUM_QUERIES; +/** + * @brief Id for the current writer hostgroup. + */ +const uint32_t WRITER_HOSTGROUP_ID = 0; + +int main(int argc, char** argv) { + int res = EXIT_SUCCESS; + + CommandLine cl; + + if (cl.getEnv()) { + diag("Failed to get the required environmental variables."); + return -1; + } + + plan(5*RESET_CONNECTION_QUERIES); + + bool param = false; + { + // we parse argv[0] to see if filename includes "param" + std::string str = std::string(argv[0]); + std::size_t found = str.find("param"); + if (found!=std::string::npos) { + param = true; + } + } + + MYSQL* proxysql_mysql = mysql_init(NULL); + MYSQL* proxysql_admin = mysql_init(NULL); + + if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_mysql)); + return -1; + } + + if (!mysql_real_connect(proxysql_admin, cl.host, cl.admin_username, cl.admin_password, NULL, cl.admin_port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_admin)); + return -1; + } + + // Insert data in the table to be queried + // ************************************************************************* + + MYSQL_QUERY(proxysql_mysql, "CREATE DATABASE IF NOT EXISTS test"); + MYSQL_QUERY(proxysql_mysql, "DROP TABLE IF EXISTS test.reg_test_3427"); + MYSQL_QUERY( + proxysql_mysql, + "CREATE TABLE IF NOT EXISTS test.reg_test_3427" + " (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `c1` BIGINT, `c2` varchar(32))" + ); + MYSQL_QUERY(proxysql_mysql, "INSERT INTO test.reg_test_3427(c1, c2) VALUES (100, 'abcde')"); + + mysql_close(proxysql_mysql); + + // Initialize the connection again + proxysql_mysql = mysql_init(NULL); + + if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_mysql)); + return -1; + } + + // ************************************************************************* + + { + // Set the number of maximum connections for servers in the writer hostgroup + std::string t_update_mysql_servers { + "UPDATE mysql_servers SET max_connections=1 WHERE hostgroup_id=%d" + }; + std::string update_mysql_queries {}; + string_format(t_update_mysql_servers, update_mysql_queries, WRITER_HOSTGROUP_ID); + MYSQL_QUERY(proxysql_admin, update_mysql_queries.c_str()); + MYSQL_QUERY(proxysql_admin, "LOAD MYSQL SERVERS TO RUNTIME"); + + // Set the number of maximum prepared statements per connection + std::string t_max_stmt_query { + "SET mysql-max_stmts_per_connection=%d" + }; + std::string max_stmt_query {}; + string_format(t_max_stmt_query, max_stmt_query, MAX_STMT_NUM_QUERIES); + MYSQL_QUERY(proxysql_admin, max_stmt_query.c_str()); + MYSQL_QUERY(proxysql_admin, "LOAD MYSQL VARIABLES TO RUNTIME"); + + uint32_t query_id = 0; + + for (uint32_t i = 0; i < RESET_CONNECTION_QUERIES; i++) { + if (i <= MAX_STMT_NUM_QUERIES) { + query_id = i; + } else if (i == MAX_STMT_NUM_QUERIES + 1) { + query_id = 0; + } else { + query_id += 1; + } + + // create unique stmt + std::string query_t {}; + + if (param) { + query_t = "SELECT /* ;hostgroup=0;%d */ * FROM test.reg_test_3427 WHERE id IN (?)"; + } else { + query_t = "SELECT /* ;hostgroup=0;%d */ * FROM test.reg_test_3427"; + } + + std::string query {}; + string_format(query_t, query, query_id); + + MYSQL_STMT* stmt = mysql_stmt_init(proxysql_mysql); + if (!stmt) { + diag("mysql_stmt_init(), out of memory"); + res = EXIT_FAILURE; + goto exit; + } + ok(stmt != NULL , "mysql_stmt_init() succeeded"); + + if (mysql_stmt_prepare(stmt, query.c_str(), strlen(query.c_str()))) { + diag("mysql_stmt_prepare at line %d failed: %s", __LINE__ , mysql_error(proxysql_mysql)); + mysql_close(proxysql_mysql); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_prepare() succeeded"); + } + + if (param) { + MYSQL_BIND bind_params; + int64_t data_param = 1; + + memset(&bind_params, 0, sizeof(MYSQL_BIND)); + bind_params.buffer_type = MYSQL_TYPE_LONGLONG; + bind_params.buffer = (char *)&data_param; + bind_params.buffer_length = sizeof(int64_t); + + if (mysql_stmt_bind_param(stmt, &bind_params)) { + diag( + "mysql_stmt_bind_result at line %d failed: %s", __LINE__ , + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } + } + + if (mysql_stmt_execute(stmt)) { + diag( + "mysql_stmt_execute at line %d failed: %s", __LINE__ , + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_execute() succeeded"); + } + + MYSQL_BIND bind[3]; + int data_id; + int64_t data_c1; + char data_c2[STRING_SIZE]; + char is_null[3]; + long unsigned int length[3]; + char error[3]; + memset(bind, 0, sizeof(bind)); + + bind[0].buffer_type = MYSQL_TYPE_LONG; + bind[0].buffer = (char *)&data_id; + bind[0].buffer_length = sizeof(int); + bind[0].is_null = &is_null[0]; + bind[0].length = &length[0]; + + bind[1].buffer_type = MYSQL_TYPE_LONGLONG; + bind[1].buffer = (char *)&data_c1; + bind[1].buffer_length = sizeof(int64_t); + bind[1].is_null = &is_null[1]; + bind[1].length = &length[1]; + + bind[2].buffer_type = MYSQL_TYPE_STRING; + bind[2].buffer = (char *)&data_c2; + bind[2].buffer_length = STRING_SIZE; + bind[2].is_null = &is_null[2]; + bind[2].length = &length[2]; + bind[2].error = &error[2]; + + if (mysql_stmt_bind_result(stmt, bind)) { + diag( + "mysql_stmt_bind_result at line %d failed: %s", __LINE__, + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_bind_result() succeeded"); + } + + if (mysql_stmt_fetch(stmt) == 1) { + diag( + "mysql_stmt_fetch at line %d failed: %s", __LINE__, + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_fetch() succeeded"); + } + + bool data_match_expected = + (data_id == static_cast(1)) && + (data_c1 == static_cast(100)) && + (strcmp(data_c2, "abcde") == 0); + + if (data_match_expected == false) { + diag( + "Prepared statement SELECT result didn't matched expected -" + " Exp=(id:1, c1:100, c2:'abcde'), Act=(id:%d, c1:%ld, c2:'%s')", + data_id, + data_c1, + data_c2 + ); + res = EXIT_FAILURE; + goto exit; + } + + mysql_stmt_close(stmt); + } + } + +exit: + mysql_close(proxysql_mysql); + mysql_close(proxysql_admin); + + return exit_status(); +} diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment1-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment1-t.cpp index 4b03f23fdc..9b87053899 100644 --- a/test/tap/tests/reg_test_3427-stmt_first_comment1-t.cpp +++ b/test/tap/tests/reg_test_3427-stmt_first_comment1-t.cpp @@ -29,8 +29,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp deleted file mode 120000 index e365158207..0000000000 --- a/test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp +++ /dev/null @@ -1 +0,0 @@ -reg_test_3427-stmt_first_comment1-t.cpp \ No newline at end of file diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp new file mode 100644 index 0000000000..9b87053899 --- /dev/null +++ b/test/tap/tests/reg_test_3427-stmt_first_comment2-param-t.cpp @@ -0,0 +1,284 @@ +/** + * @file reg_test_3427-stmt_first_comment-t.cpp + * @brief This test is a regression test for exercising all code related to + * 'first_comment' changes added in PR #3453. + * @details Testing revealed that the fix introduced for proper routing of + * prepared statements with query rules has invalid interaction with query + * annotation 'hostgroup' feature. + * For solving the issue, 'first_comment' was made part of 'MySQL_STMT_Global_info'. + * This test aims to exercise all the parts of ProxySQL affected by this change. + * + * Procedure: + * ========= + * + * The test creates a number of prepared statements and execute them, until passing + * the limit of prepared statements allowed per connection. After the connection + * has been reset by ProxySQL because of the limit exceeding, it tries to execute + * the same prepared statements again. This way those prepared statements wont be + * available in the connection and will need to be fetched by ProxySQL for the + * reset connection. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mysql.h" +#include "mysql/mysqld_error.h" + +#include "proxysql_utils.h" +#include "tap.h" +#include "command_line.h" +#include "utils.h" +#include "errno.h" + +/** + * @brief String size of the columns created for the testing table. + */ +const int STRING_SIZE=32; +/** + * @brief Number of max stmt per connection to be configured for + * ProxySQL. + */ +const uint32_t MAX_STMT_NUM_QUERIES = 20; +/** + * @brief Number of queries to RESET the connection being target, + * it's simply: MAX_STMT_NUM_QUERIES + 1 + */ +const uint32_t RESET_CONNECTION_QUERIES = 2*MAX_STMT_NUM_QUERIES; +/** + * @brief Id for the current writer hostgroup. + */ +const uint32_t WRITER_HOSTGROUP_ID = 0; + +int main(int argc, char** argv) { + int res = EXIT_SUCCESS; + + CommandLine cl; + + if (cl.getEnv()) { + diag("Failed to get the required environmental variables."); + return -1; + } + + plan(5*RESET_CONNECTION_QUERIES); + + bool param = false; + { + // we parse argv[0] to see if filename includes "param" + std::string str = std::string(argv[0]); + std::size_t found = str.find("param"); + if (found!=std::string::npos) { + param = true; + } + } + + MYSQL* proxysql_mysql = mysql_init(NULL); + MYSQL* proxysql_admin = mysql_init(NULL); + + if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_mysql)); + return -1; + } + + if (!mysql_real_connect(proxysql_admin, cl.host, cl.admin_username, cl.admin_password, NULL, cl.admin_port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_admin)); + return -1; + } + + // Insert data in the table to be queried + // ************************************************************************* + + MYSQL_QUERY(proxysql_mysql, "CREATE DATABASE IF NOT EXISTS test"); + MYSQL_QUERY(proxysql_mysql, "DROP TABLE IF EXISTS test.reg_test_3427"); + MYSQL_QUERY( + proxysql_mysql, + "CREATE TABLE IF NOT EXISTS test.reg_test_3427" + " (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `c1` BIGINT, `c2` varchar(32))" + ); + MYSQL_QUERY(proxysql_mysql, "INSERT INTO test.reg_test_3427(c1, c2) VALUES (100, 'abcde')"); + + mysql_close(proxysql_mysql); + + // Initialize the connection again + proxysql_mysql = mysql_init(NULL); + + if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_mysql)); + return -1; + } + + // ************************************************************************* + + { + // Set the number of maximum connections for servers in the writer hostgroup + std::string t_update_mysql_servers { + "UPDATE mysql_servers SET max_connections=1 WHERE hostgroup_id=%d" + }; + std::string update_mysql_queries {}; + string_format(t_update_mysql_servers, update_mysql_queries, WRITER_HOSTGROUP_ID); + MYSQL_QUERY(proxysql_admin, update_mysql_queries.c_str()); + MYSQL_QUERY(proxysql_admin, "LOAD MYSQL SERVERS TO RUNTIME"); + + // Set the number of maximum prepared statements per connection + std::string t_max_stmt_query { + "SET mysql-max_stmts_per_connection=%d" + }; + std::string max_stmt_query {}; + string_format(t_max_stmt_query, max_stmt_query, MAX_STMT_NUM_QUERIES); + MYSQL_QUERY(proxysql_admin, max_stmt_query.c_str()); + MYSQL_QUERY(proxysql_admin, "LOAD MYSQL VARIABLES TO RUNTIME"); + + uint32_t query_id = 0; + + for (uint32_t i = 0; i < RESET_CONNECTION_QUERIES; i++) { + if (i <= MAX_STMT_NUM_QUERIES) { + query_id = i; + } else if (i == MAX_STMT_NUM_QUERIES + 1) { + query_id = 0; + } else { + query_id += 1; + } + + // create unique stmt + std::string query_t {}; + + if (param) { + query_t = "SELECT /* ;hostgroup=0;%d */ * FROM test.reg_test_3427 WHERE id IN (?)"; + } else { + query_t = "SELECT /* ;hostgroup=0;%d */ * FROM test.reg_test_3427"; + } + + std::string query {}; + string_format(query_t, query, query_id); + + MYSQL_STMT* stmt = mysql_stmt_init(proxysql_mysql); + if (!stmt) { + diag("mysql_stmt_init(), out of memory"); + res = EXIT_FAILURE; + goto exit; + } + ok(stmt != NULL , "mysql_stmt_init() succeeded"); + + if (mysql_stmt_prepare(stmt, query.c_str(), strlen(query.c_str()))) { + diag("mysql_stmt_prepare at line %d failed: %s", __LINE__ , mysql_error(proxysql_mysql)); + mysql_close(proxysql_mysql); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_prepare() succeeded"); + } + + if (param) { + MYSQL_BIND bind_params; + int64_t data_param = 1; + + memset(&bind_params, 0, sizeof(MYSQL_BIND)); + bind_params.buffer_type = MYSQL_TYPE_LONGLONG; + bind_params.buffer = (char *)&data_param; + bind_params.buffer_length = sizeof(int64_t); + + if (mysql_stmt_bind_param(stmt, &bind_params)) { + diag( + "mysql_stmt_bind_result at line %d failed: %s", __LINE__ , + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } + } + + if (mysql_stmt_execute(stmt)) { + diag( + "mysql_stmt_execute at line %d failed: %s", __LINE__ , + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_execute() succeeded"); + } + + MYSQL_BIND bind[3]; + int data_id; + int64_t data_c1; + char data_c2[STRING_SIZE]; + char is_null[3]; + long unsigned int length[3]; + char error[3]; + memset(bind, 0, sizeof(bind)); + + bind[0].buffer_type = MYSQL_TYPE_LONG; + bind[0].buffer = (char *)&data_id; + bind[0].buffer_length = sizeof(int); + bind[0].is_null = &is_null[0]; + bind[0].length = &length[0]; + + bind[1].buffer_type = MYSQL_TYPE_LONGLONG; + bind[1].buffer = (char *)&data_c1; + bind[1].buffer_length = sizeof(int64_t); + bind[1].is_null = &is_null[1]; + bind[1].length = &length[1]; + + bind[2].buffer_type = MYSQL_TYPE_STRING; + bind[2].buffer = (char *)&data_c2; + bind[2].buffer_length = STRING_SIZE; + bind[2].is_null = &is_null[2]; + bind[2].length = &length[2]; + bind[2].error = &error[2]; + + if (mysql_stmt_bind_result(stmt, bind)) { + diag( + "mysql_stmt_bind_result at line %d failed: %s", __LINE__, + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_bind_result() succeeded"); + } + + if (mysql_stmt_fetch(stmt) == 1) { + diag( + "mysql_stmt_fetch at line %d failed: %s", __LINE__, + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_fetch() succeeded"); + } + + bool data_match_expected = + (data_id == static_cast(1)) && + (data_c1 == static_cast(100)) && + (strcmp(data_c2, "abcde") == 0); + + if (data_match_expected == false) { + diag( + "Prepared statement SELECT result didn't matched expected -" + " Exp=(id:1, c1:100, c2:'abcde'), Act=(id:%d, c1:%ld, c2:'%s')", + data_id, + data_c1, + data_c2 + ); + res = EXIT_FAILURE; + goto exit; + } + + mysql_stmt_close(stmt); + } + } + +exit: + mysql_close(proxysql_mysql); + mysql_close(proxysql_admin); + + return exit_status(); +} diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp deleted file mode 120000 index e365158207..0000000000 --- a/test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp +++ /dev/null @@ -1 +0,0 @@ -reg_test_3427-stmt_first_comment1-t.cpp \ No newline at end of file diff --git a/test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp b/test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp new file mode 100644 index 0000000000..9b87053899 --- /dev/null +++ b/test/tap/tests/reg_test_3427-stmt_first_comment2-t.cpp @@ -0,0 +1,284 @@ +/** + * @file reg_test_3427-stmt_first_comment-t.cpp + * @brief This test is a regression test for exercising all code related to + * 'first_comment' changes added in PR #3453. + * @details Testing revealed that the fix introduced for proper routing of + * prepared statements with query rules has invalid interaction with query + * annotation 'hostgroup' feature. + * For solving the issue, 'first_comment' was made part of 'MySQL_STMT_Global_info'. + * This test aims to exercise all the parts of ProxySQL affected by this change. + * + * Procedure: + * ========= + * + * The test creates a number of prepared statements and execute them, until passing + * the limit of prepared statements allowed per connection. After the connection + * has been reset by ProxySQL because of the limit exceeding, it tries to execute + * the same prepared statements again. This way those prepared statements wont be + * available in the connection and will need to be fetched by ProxySQL for the + * reset connection. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mysql.h" +#include "mysql/mysqld_error.h" + +#include "proxysql_utils.h" +#include "tap.h" +#include "command_line.h" +#include "utils.h" +#include "errno.h" + +/** + * @brief String size of the columns created for the testing table. + */ +const int STRING_SIZE=32; +/** + * @brief Number of max stmt per connection to be configured for + * ProxySQL. + */ +const uint32_t MAX_STMT_NUM_QUERIES = 20; +/** + * @brief Number of queries to RESET the connection being target, + * it's simply: MAX_STMT_NUM_QUERIES + 1 + */ +const uint32_t RESET_CONNECTION_QUERIES = 2*MAX_STMT_NUM_QUERIES; +/** + * @brief Id for the current writer hostgroup. + */ +const uint32_t WRITER_HOSTGROUP_ID = 0; + +int main(int argc, char** argv) { + int res = EXIT_SUCCESS; + + CommandLine cl; + + if (cl.getEnv()) { + diag("Failed to get the required environmental variables."); + return -1; + } + + plan(5*RESET_CONNECTION_QUERIES); + + bool param = false; + { + // we parse argv[0] to see if filename includes "param" + std::string str = std::string(argv[0]); + std::size_t found = str.find("param"); + if (found!=std::string::npos) { + param = true; + } + } + + MYSQL* proxysql_mysql = mysql_init(NULL); + MYSQL* proxysql_admin = mysql_init(NULL); + + if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_mysql)); + return -1; + } + + if (!mysql_real_connect(proxysql_admin, cl.host, cl.admin_username, cl.admin_password, NULL, cl.admin_port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_admin)); + return -1; + } + + // Insert data in the table to be queried + // ************************************************************************* + + MYSQL_QUERY(proxysql_mysql, "CREATE DATABASE IF NOT EXISTS test"); + MYSQL_QUERY(proxysql_mysql, "DROP TABLE IF EXISTS test.reg_test_3427"); + MYSQL_QUERY( + proxysql_mysql, + "CREATE TABLE IF NOT EXISTS test.reg_test_3427" + " (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `c1` BIGINT, `c2` varchar(32))" + ); + MYSQL_QUERY(proxysql_mysql, "INSERT INTO test.reg_test_3427(c1, c2) VALUES (100, 'abcde')"); + + mysql_close(proxysql_mysql); + + // Initialize the connection again + proxysql_mysql = mysql_init(NULL); + + if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { + fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(proxysql_mysql)); + return -1; + } + + // ************************************************************************* + + { + // Set the number of maximum connections for servers in the writer hostgroup + std::string t_update_mysql_servers { + "UPDATE mysql_servers SET max_connections=1 WHERE hostgroup_id=%d" + }; + std::string update_mysql_queries {}; + string_format(t_update_mysql_servers, update_mysql_queries, WRITER_HOSTGROUP_ID); + MYSQL_QUERY(proxysql_admin, update_mysql_queries.c_str()); + MYSQL_QUERY(proxysql_admin, "LOAD MYSQL SERVERS TO RUNTIME"); + + // Set the number of maximum prepared statements per connection + std::string t_max_stmt_query { + "SET mysql-max_stmts_per_connection=%d" + }; + std::string max_stmt_query {}; + string_format(t_max_stmt_query, max_stmt_query, MAX_STMT_NUM_QUERIES); + MYSQL_QUERY(proxysql_admin, max_stmt_query.c_str()); + MYSQL_QUERY(proxysql_admin, "LOAD MYSQL VARIABLES TO RUNTIME"); + + uint32_t query_id = 0; + + for (uint32_t i = 0; i < RESET_CONNECTION_QUERIES; i++) { + if (i <= MAX_STMT_NUM_QUERIES) { + query_id = i; + } else if (i == MAX_STMT_NUM_QUERIES + 1) { + query_id = 0; + } else { + query_id += 1; + } + + // create unique stmt + std::string query_t {}; + + if (param) { + query_t = "SELECT /* ;hostgroup=0;%d */ * FROM test.reg_test_3427 WHERE id IN (?)"; + } else { + query_t = "SELECT /* ;hostgroup=0;%d */ * FROM test.reg_test_3427"; + } + + std::string query {}; + string_format(query_t, query, query_id); + + MYSQL_STMT* stmt = mysql_stmt_init(proxysql_mysql); + if (!stmt) { + diag("mysql_stmt_init(), out of memory"); + res = EXIT_FAILURE; + goto exit; + } + ok(stmt != NULL , "mysql_stmt_init() succeeded"); + + if (mysql_stmt_prepare(stmt, query.c_str(), strlen(query.c_str()))) { + diag("mysql_stmt_prepare at line %d failed: %s", __LINE__ , mysql_error(proxysql_mysql)); + mysql_close(proxysql_mysql); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_prepare() succeeded"); + } + + if (param) { + MYSQL_BIND bind_params; + int64_t data_param = 1; + + memset(&bind_params, 0, sizeof(MYSQL_BIND)); + bind_params.buffer_type = MYSQL_TYPE_LONGLONG; + bind_params.buffer = (char *)&data_param; + bind_params.buffer_length = sizeof(int64_t); + + if (mysql_stmt_bind_param(stmt, &bind_params)) { + diag( + "mysql_stmt_bind_result at line %d failed: %s", __LINE__ , + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } + } + + if (mysql_stmt_execute(stmt)) { + diag( + "mysql_stmt_execute at line %d failed: %s", __LINE__ , + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_execute() succeeded"); + } + + MYSQL_BIND bind[3]; + int data_id; + int64_t data_c1; + char data_c2[STRING_SIZE]; + char is_null[3]; + long unsigned int length[3]; + char error[3]; + memset(bind, 0, sizeof(bind)); + + bind[0].buffer_type = MYSQL_TYPE_LONG; + bind[0].buffer = (char *)&data_id; + bind[0].buffer_length = sizeof(int); + bind[0].is_null = &is_null[0]; + bind[0].length = &length[0]; + + bind[1].buffer_type = MYSQL_TYPE_LONGLONG; + bind[1].buffer = (char *)&data_c1; + bind[1].buffer_length = sizeof(int64_t); + bind[1].is_null = &is_null[1]; + bind[1].length = &length[1]; + + bind[2].buffer_type = MYSQL_TYPE_STRING; + bind[2].buffer = (char *)&data_c2; + bind[2].buffer_length = STRING_SIZE; + bind[2].is_null = &is_null[2]; + bind[2].length = &length[2]; + bind[2].error = &error[2]; + + if (mysql_stmt_bind_result(stmt, bind)) { + diag( + "mysql_stmt_bind_result at line %d failed: %s", __LINE__, + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_bind_result() succeeded"); + } + + if (mysql_stmt_fetch(stmt) == 1) { + diag( + "mysql_stmt_fetch at line %d failed: %s", __LINE__, + mysql_stmt_error(stmt) + ); + res = EXIT_FAILURE; + goto exit; + } else { + ok(1,"mysql_stmt_fetch() succeeded"); + } + + bool data_match_expected = + (data_id == static_cast(1)) && + (data_c1 == static_cast(100)) && + (strcmp(data_c2, "abcde") == 0); + + if (data_match_expected == false) { + diag( + "Prepared statement SELECT result didn't matched expected -" + " Exp=(id:1, c1:100, c2:'abcde'), Act=(id:%d, c1:%ld, c2:'%s')", + data_id, + data_c1, + data_c2 + ); + res = EXIT_FAILURE; + goto exit; + } + + mysql_stmt_close(stmt); + } + } + +exit: + mysql_close(proxysql_mysql); + mysql_close(proxysql_admin); + + return exit_status(); +} diff --git a/test/tap/tests/reg_test_3434-text_stmt_mix-t.cpp b/test/tap/tests/reg_test_3434-text_stmt_mix-t.cpp index b232ab5c27..6fc4bdac3d 100644 --- a/test/tap/tests/reg_test_3434-text_stmt_mix-t.cpp +++ b/test/tap/tests/reg_test_3434-text_stmt_mix-t.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include "mysql.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/reg_test_3493-USE_with_comment-t.cpp b/test/tap/tests/reg_test_3493-USE_with_comment-t.cpp index 16600783e2..66f509296c 100644 --- a/test/tap/tests/reg_test_3493-USE_with_comment-t.cpp +++ b/test/tap/tests/reg_test_3493-USE_with_comment-t.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3504-change_user-t.cpp b/test/tap/tests/reg_test_3504-change_user-t.cpp index fa9f09b902..6c362c7218 100644 --- a/test/tap/tests/reg_test_3504-change_user-t.cpp +++ b/test/tap/tests/reg_test_3504-change_user-t.cpp @@ -21,8 +21,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "command_line.h" #include "proxysql_utils.h" diff --git a/test/tap/tests/reg_test_3504-change_user_helper.cpp b/test/tap/tests/reg_test_3504-change_user_helper.cpp index 1efb7a0c3f..07019dca39 100644 --- a/test/tap/tests/reg_test_3504-change_user_helper.cpp +++ b/test/tap/tests/reg_test_3504-change_user_helper.cpp @@ -31,8 +31,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "json.hpp" diff --git a/test/tap/tests/reg_test_3546-stmt_empty_params-t.cpp b/test/tap/tests/reg_test_3546-stmt_empty_params-t.cpp index 82c0e3323f..53b8431f01 100644 --- a/test/tap/tests/reg_test_3546-stmt_empty_params-t.cpp +++ b/test/tap/tests/reg_test_3546-stmt_empty_params-t.cpp @@ -20,8 +20,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/reg_test_3549-autocommit_tracking-t.cpp b/test/tap/tests/reg_test_3549-autocommit_tracking-t.cpp index 65656a4b7f..42980c22b5 100644 --- a/test/tap/tests/reg_test_3549-autocommit_tracking-t.cpp +++ b/test/tap/tests/reg_test_3549-autocommit_tracking-t.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include "mysql.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/reg_test_3585-stmt_metadata-t.cpp b/test/tap/tests/reg_test_3585-stmt_metadata-t.cpp index c6a19cb872..f40e959a39 100644 --- a/test/tap/tests/reg_test_3585-stmt_metadata-t.cpp +++ b/test/tap/tests/reg_test_3585-stmt_metadata-t.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3591-restapi_num_fds-t.cpp b/test/tap/tests/reg_test_3591-restapi_num_fds-t.cpp index f859517183..13bb29142e 100644 --- a/test/tap/tests/reg_test_3591-restapi_num_fds-t.cpp +++ b/test/tap/tests/reg_test_3591-restapi_num_fds-t.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3603-stmt_metadata-t.cpp b/test/tap/tests/reg_test_3603-stmt_metadata-t.cpp index 1f4eb5b693..8afc9a8614 100644 --- a/test/tap/tests/reg_test_3603-stmt_metadata-t.cpp +++ b/test/tap/tests/reg_test_3603-stmt_metadata-t.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3606-mysql_warnings-t.cpp b/test/tap/tests/reg_test_3606-mysql_warnings-t.cpp index 412bc68b61..561da5508f 100644 --- a/test/tap/tests/reg_test_3606-mysql_warnings-t.cpp +++ b/test/tap/tests/reg_test_3606-mysql_warnings-t.cpp @@ -18,10 +18,10 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" -#include +#include "proxysql_utils.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3625-sqlite3_session_client_error_limit-t.cpp b/test/tap/tests/reg_test_3625-sqlite3_session_client_error_limit-t.cpp index 9d4624aeb5..00ad27d64a 100644 --- a/test/tap/tests/reg_test_3625-sqlite3_session_client_error_limit-t.cpp +++ b/test/tap/tests/reg_test_3625-sqlite3_session_client_error_limit-t.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3690-admin_large_pkts-t.cpp b/test/tap/tests/reg_test_3690-admin_large_pkts-t.cpp index 486c46bd54..83687245fc 100644 --- a/test/tap/tests/reg_test_3690-admin_large_pkts-t.cpp +++ b/test/tap/tests/reg_test_3690-admin_large_pkts-t.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include "mysql.h" #include "json.hpp" #include "tap.h" diff --git a/test/tap/tests/reg_test_3765_ssl_pollout-t.cpp b/test/tap/tests/reg_test_3765_ssl_pollout-t.cpp index 7570c4642e..e559c758f8 100644 --- a/test/tap/tests/reg_test_3765_ssl_pollout-t.cpp +++ b/test/tap/tests/reg_test_3765_ssl_pollout-t.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include "mysql.h" #include #include "tap.h" diff --git a/test/tap/tests/reg_test_3838-restapi_eintr-t.cpp b/test/tap/tests/reg_test_3838-restapi_eintr-t.cpp index cd081cd0b1..79379863d6 100644 --- a/test/tap/tests/reg_test_3838-restapi_eintr-t.cpp +++ b/test/tap/tests/reg_test_3838-restapi_eintr-t.cpp @@ -22,8 +22,8 @@ #include "curl/curl.h" -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "json.hpp" #include "tap.h" diff --git a/test/tap/tests/reg_test_3847_admin_lock-t.cpp b/test/tap/tests/reg_test_3847_admin_lock-t.cpp index 8fad233ef9..683527dfa8 100644 --- a/test/tap/tests/reg_test_3847_admin_lock-t.cpp +++ b/test/tap/tests/reg_test_3847_admin_lock-t.cpp @@ -10,8 +10,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-mysqlsh-t.cpp b/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-mysqlsh-t.cpp index 51fd91de47..b19e38edc2 100644 --- a/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-mysqlsh-t.cpp +++ b/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-mysqlsh-t.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-t.cpp b/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-t.cpp index 7335ed7b67..128fdec549 100644 --- a/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-t.cpp +++ b/test/tap/tests/reg_test_3992_fast_forward_malformed_packet-t.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_4001-restapi_scripts_num_fds-t.cpp b/test/tap/tests/reg_test_4001-restapi_scripts_num_fds-t.cpp index e8c162c88e..b035d8c40d 100644 --- a/test/tap/tests/reg_test_4001-restapi_scripts_num_fds-t.cpp +++ b/test/tap/tests/reg_test_4001-restapi_scripts_num_fds-t.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include "mysql.h" #include "command_line.h" #include "proxysql_utils.h" diff --git a/test/tap/tests/reg_test_4072-show-warnings-t.cpp b/test/tap/tests/reg_test_4072-show-warnings-t.cpp index d0bcf6dbb4..2ef153da3f 100644 --- a/test/tap/tests/reg_test_4072-show-warnings-t.cpp +++ b/test/tap/tests/reg_test_4072-show-warnings-t.cpp @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" #include "utils.h" diff --git a/test/tap/tests/reg_test_4264-commit_rollback-t.cpp b/test/tap/tests/reg_test_4264-commit_rollback-t.cpp index 15369d8895..ebf6246e46 100644 --- a/test/tap/tests/reg_test_4264-commit_rollback-t.cpp +++ b/test/tap/tests/reg_test_4264-commit_rollback-t.cpp @@ -41,8 +41,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "utils.h" diff --git a/test/tap/tests/reg_test_4300-dollar_quote_check-t.cpp b/test/tap/tests/reg_test_4300-dollar_quote_check-t.cpp index 72ecc5b70c..24e27c3ce6 100644 --- a/test/tap/tests/reg_test_4300-dollar_quote_check-t.cpp +++ b/test/tap/tests/reg_test_4300-dollar_quote_check-t.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "utils.h" diff --git a/test/tap/tests/reg_test_fast_forward_split_packet-t.cpp b/test/tap/tests/reg_test_fast_forward_split_packet-t.cpp index a302543202..626545055b 100644 --- a/test/tap/tests/reg_test_fast_forward_split_packet-t.cpp +++ b/test/tap/tests/reg_test_fast_forward_split_packet-t.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_mariadb_stmt_store_result-t.cpp b/test/tap/tests/reg_test_mariadb_stmt_store_result-t.cpp index aa21489f1f..292f98f137 100644 --- a/test/tap/tests/reg_test_mariadb_stmt_store_result-t.cpp +++ b/test/tap/tests/reg_test_mariadb_stmt_store_result-t.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/reg_test_sql_calc_found_rows-t.cpp b/test/tap/tests/reg_test_sql_calc_found_rows-t.cpp index 10aef61c33..1bf13fc430 100644 --- a/test/tap/tests/reg_test_sql_calc_found_rows-t.cpp +++ b/test/tap/tests/reg_test_sql_calc_found_rows-t.cpp @@ -12,8 +12,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "json.hpp" diff --git a/test/tap/tests/reg_test_stmt_resultset_err_no_rows-t.cpp b/test/tap/tests/reg_test_stmt_resultset_err_no_rows-t.cpp index 514b5d627e..a84e82283b 100644 --- a/test/tap/tests/reg_test_stmt_resultset_err_no_rows-t.cpp +++ b/test/tap/tests/reg_test_stmt_resultset_err_no_rows-t.cpp @@ -16,8 +16,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/reg_test_stmt_resultset_err_no_rows_php-t.cpp b/test/tap/tests/reg_test_stmt_resultset_err_no_rows_php-t.cpp index 03a1f0143e..78c9330f17 100644 --- a/test/tap/tests/reg_test_stmt_resultset_err_no_rows_php-t.cpp +++ b/test/tap/tests/reg_test_stmt_resultset_err_no_rows_php-t.cpp @@ -8,8 +8,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/repro_3404-mysql_close_fd_leak.cpp b/test/tap/tests/repro_3404-mysql_close_fd_leak.cpp index 83b1e28770..5e0ec91332 100644 --- a/test/tap/tests/repro_3404-mysql_close_fd_leak.cpp +++ b/test/tap/tests/repro_3404-mysql_close_fd_leak.cpp @@ -56,7 +56,7 @@ #include #include -#include +#include "mysql.h" #include #include "tap.h" diff --git a/test/tap/tests/repro_test_leak_3350.cpp b/test/tap/tests/repro_test_leak_3350.cpp index 6d51b66367..bc0644f6e2 100644 --- a/test/tap/tests/repro_test_leak_3350.cpp +++ b/test/tap/tests/repro_test_leak_3350.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/repro_test_leak_3525.cpp b/test/tap/tests/repro_test_leak_3525.cpp index 5ac66cbe4a..c4b50932cd 100644 --- a/test/tap/tests/repro_test_leak_3525.cpp +++ b/test/tap/tests/repro_test_leak_3525.cpp @@ -7,7 +7,7 @@ */ #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/savepoint-3749-t.cpp b/test/tap/tests/savepoint-3749-t.cpp index 9606863af3..e8202d900d 100644 --- a/test/tap/tests/savepoint-3749-t.cpp +++ b/test/tap/tests/savepoint-3749-t.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/savepoint-948-t.cpp b/test/tap/tests/savepoint-948-t.cpp index 3ec1a2168c..a174ed2fc2 100644 --- a/test/tap/tests/savepoint-948-t.cpp +++ b/test/tap/tests/savepoint-948-t.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/set_character_set-t.cpp b/test/tap/tests/set_character_set-t.cpp index b0fdce464b..f208e532f9 100644 --- a/test/tap/tests/set_character_set-t.cpp +++ b/test/tap/tests/set_character_set-t.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/set_testing-240-t.cpp b/test/tap/tests/set_testing-240-t.cpp index 0576bc4b81..a7709bb52e 100644 --- a/test/tap/tests/set_testing-240-t.cpp +++ b/test/tap/tests/set_testing-240-t.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/set_testing-multi-t.cpp b/test/tap/tests/set_testing-multi-t.cpp index 02d87f9f26..1f85d6a95b 100644 --- a/test/tap/tests/set_testing-multi-t.cpp +++ b/test/tap/tests/set_testing-multi-t.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/set_testing-t.cpp b/test/tap/tests/set_testing-t.cpp index 18f336bd56..0604669075 100644 --- a/test/tap/tests/set_testing-t.cpp +++ b/test/tap/tests/set_testing-t.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/sqlite3-t.cpp b/test/tap/tests/sqlite3-t.cpp index e41f0068e3..c9c1a421c7 100644 --- a/test/tap/tests/sqlite3-t.cpp +++ b/test/tap/tests/sqlite3-t.cpp @@ -5,7 +5,8 @@ #include #include #include -#include + +#include "openssl/ssl.h" #include "mysql.h" #include "proxysql_structs.h" diff --git a/test/tap/tests/sqlite_autocommit-t.cpp b/test/tap/tests/sqlite_autocommit-t.cpp index 0fb858d56e..e5a15e0726 100644 --- a/test/tap/tests/sqlite_autocommit-t.cpp +++ b/test/tap/tests/sqlite_autocommit-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_admin_prometheus_metrics_dump-t_disabled_gh3571.cpp b/test/tap/tests/test_admin_prometheus_metrics_dump-t_disabled_gh3571.cpp index 4b3ba54325..08115a0010 100644 --- a/test/tap/tests/test_admin_prometheus_metrics_dump-t_disabled_gh3571.cpp +++ b/test/tap/tests/test_admin_prometheus_metrics_dump-t_disabled_gh3571.cpp @@ -10,8 +10,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_admin_stats-t.cpp b/test/tap/tests/test_admin_stats-t.cpp index 7128767250..56a933d483 100644 --- a/test/tap/tests/test_admin_stats-t.cpp +++ b/test/tap/tests/test_admin_stats-t.cpp @@ -27,8 +27,8 @@ DELETE FROM history_mysql_status_variables; #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_auto_increment_delay_multiplex-t.cpp b/test/tap/tests/test_auto_increment_delay_multiplex-t.cpp index ad6f04a258..b2d18a0d83 100644 --- a/test/tap/tests/test_auto_increment_delay_multiplex-t.cpp +++ b/test/tap/tests/test_auto_increment_delay_multiplex-t.cpp @@ -28,8 +28,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "json.hpp" diff --git a/test/tap/tests/test_binlog_fast_forward-t.cpp b/test/tap/tests/test_binlog_fast_forward-t.cpp index a80247fb7a..281ac0e056 100644 --- a/test/tap/tests/test_binlog_fast_forward-t.cpp +++ b/test/tap/tests/test_binlog_fast_forward-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_binlog_reader-t.cpp b/test/tap/tests/test_binlog_reader-t.cpp index 432d1244ef..6ceb8d15b1 100644 --- a/test/tap/tests/test_binlog_reader-t.cpp +++ b/test/tap/tests/test_binlog_reader-t.cpp @@ -28,8 +28,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include #include "tap.h" diff --git a/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp b/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp index 45e214f296..2015e47163 100644 --- a/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp +++ b/test/tap/tests/test_binlog_reader_uses_previous_hostgroup-t.cpp @@ -10,7 +10,7 @@ */ #include -#include +#include "mysql.h" #include #include diff --git a/test/tap/tests/test_clickhouse_server-t.cpp b/test/tap/tests/test_clickhouse_server-t.cpp index 1fe6a08665..940671a520 100644 --- a/test/tap/tests/test_clickhouse_server-t.cpp +++ b/test/tap/tests/test_clickhouse_server-t.cpp @@ -28,8 +28,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_client_limit_error-t.cpp b/test/tap/tests/test_client_limit_error-t.cpp index 8ae4618d2e..6d84f245a7 100644 --- a/test/tap/tests/test_client_limit_error-t.cpp +++ b/test/tap/tests/test_client_limit_error-t.cpp @@ -48,8 +48,8 @@ #include #include -#include -#include +#include "proxysql_utils.h" +#include "mysql.h" #include "json.hpp" #include "tap.h" diff --git a/test/tap/tests/test_cluster1-t.cpp b/test/tap/tests/test_cluster1-t.cpp index b3a4526cef..089c4bd82a 100644 --- a/test/tap/tests/test_cluster1-t.cpp +++ b/test/tap/tests/test_cluster1-t.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_cluster_sync-t.cpp b/test/tap/tests/test_cluster_sync-t.cpp index e5897061ec..d4940c1fd4 100644 --- a/test/tap/tests/test_cluster_sync-t.cpp +++ b/test/tap/tests/test_cluster_sync-t.cpp @@ -46,9 +46,9 @@ #include -#include +#include "proxysql_utils.h" -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_com_reset_connection_com_change_user-t.cpp b/test/tap/tests/test_com_reset_connection_com_change_user-t.cpp index e02981b2c3..fe5fd698ae 100644 --- a/test/tap/tests/test_com_reset_connection_com_change_user-t.cpp +++ b/test/tap/tests/test_com_reset_connection_com_change_user-t.cpp @@ -19,8 +19,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "command_line.h" #include "proxysql_utils.h" diff --git a/test/tap/tests/test_connection_annotation-t.cpp b/test/tap/tests/test_connection_annotation-t.cpp index 93b09f28fe..c04544a1af 100644 --- a/test/tap/tests/test_connection_annotation-t.cpp +++ b/test/tap/tests/test_connection_annotation-t.cpp @@ -10,8 +10,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_csharp_connector_support-t.cpp b/test/tap/tests/test_csharp_connector_support-t.cpp index 6c4856f079..a6a1168fe7 100644 --- a/test/tap/tests/test_csharp_connector_support-t.cpp +++ b/test/tap/tests/test_csharp_connector_support-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_debug_filters-t.cpp b/test/tap/tests/test_debug_filters-t.cpp index c3b17bc2df..559f73b653 100644 --- a/test/tap/tests/test_debug_filters-t.cpp +++ b/test/tap/tests/test_debug_filters-t.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_default_value_transaction_isolation-t.cpp b/test/tap/tests/test_default_value_transaction_isolation-t.cpp index cca5d20806..972b9a3ac0 100644 --- a/test/tap/tests/test_default_value_transaction_isolation-t.cpp +++ b/test/tap/tests/test_default_value_transaction_isolation-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_default_value_transaction_isolation_attr-t.cpp b/test/tap/tests/test_default_value_transaction_isolation_attr-t.cpp index e709c24635..c90541e200 100644 --- a/test/tap/tests/test_default_value_transaction_isolation_attr-t.cpp +++ b/test/tap/tests/test_default_value_transaction_isolation_attr-t.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_digest_umap_aux-t.cpp b/test/tap/tests/test_digest_umap_aux-t.cpp index f68be97350..227f5af08d 100644 --- a/test/tap/tests/test_digest_umap_aux-t.cpp +++ b/test/tap/tests/test_digest_umap_aux-t.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/test_dns_cache-t.cpp b/test/tap/tests/test_dns_cache-t.cpp index c1b5f14c75..213e9751f3 100644 --- a/test/tap/tests/test_dns_cache-t.cpp +++ b/test/tap/tests/test_dns_cache-t.cpp @@ -14,8 +14,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_enforce_autocommit_on_reads-t.cpp b/test/tap/tests/test_enforce_autocommit_on_reads-t.cpp index 1dbc62af7c..0d7550c4a9 100644 --- a/test/tap/tests/test_enforce_autocommit_on_reads-t.cpp +++ b/test/tap/tests/test_enforce_autocommit_on_reads-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_filtered_set_statements-t.cpp b/test/tap/tests/test_filtered_set_statements-t.cpp index fee2dee096..6a1710f285 100644 --- a/test/tap/tests/test_filtered_set_statements-t.cpp +++ b/test/tap/tests/test_filtered_set_statements-t.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include "mysql.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/test_firewall-t.cpp b/test/tap/tests/test_firewall-t.cpp index 39ccf4bd6d..a9b8cc6bab 100644 --- a/test/tap/tests/test_firewall-t.cpp +++ b/test/tap/tests/test_firewall-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_flagOUT_weight-t.cpp b/test/tap/tests/test_flagOUT_weight-t.cpp index df6aa718c5..f07da9f2cc 100644 --- a/test/tap/tests/test_flagOUT_weight-t.cpp +++ b/test/tap/tests/test_flagOUT_weight-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_gtid_forwarding-t.cpp b/test/tap/tests/test_gtid_forwarding-t.cpp index 4be02a5c72..5ac70f80c9 100644 --- a/test/tap/tests/test_gtid_forwarding-t.cpp +++ b/test/tap/tests/test_gtid_forwarding-t.cpp @@ -14,8 +14,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_keep_multiplexing_variables-t.cpp b/test/tap/tests/test_keep_multiplexing_variables-t.cpp index ef4995bc91..56e283c93b 100644 --- a/test/tap/tests/test_keep_multiplexing_variables-t.cpp +++ b/test/tap/tests/test_keep_multiplexing_variables-t.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_log_last_insert_id-t.cpp b/test/tap/tests/test_log_last_insert_id-t.cpp index 8fa074c153..883c8bdc05 100644 --- a/test/tap/tests/test_log_last_insert_id-t.cpp +++ b/test/tap/tests/test_log_last_insert_id-t.cpp @@ -7,8 +7,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_mysql_connect_retries_delay-t.cpp b/test/tap/tests/test_mysql_connect_retries_delay-t.cpp index e08596bb9a..5d5bf8dcaf 100644 --- a/test/tap/tests/test_mysql_connect_retries_delay-t.cpp +++ b/test/tap/tests/test_mysql_connect_retries_delay-t.cpp @@ -18,8 +18,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_mysql_hostgroup_attributes-1-t.cpp b/test/tap/tests/test_mysql_hostgroup_attributes-1-t.cpp index 85ee8211f7..0aa9411d6f 100644 --- a/test/tap/tests/test_mysql_hostgroup_attributes-1-t.cpp +++ b/test/tap/tests/test_mysql_hostgroup_attributes-1-t.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_mysql_query_rules_fast_routing-t.cpp b/test/tap/tests/test_mysql_query_rules_fast_routing-t.cpp index 765366165c..cecfd8dfcc 100644 --- a/test/tap/tests/test_mysql_query_rules_fast_routing-t.cpp +++ b/test/tap/tests/test_mysql_query_rules_fast_routing-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_mysqlsh-t.cpp b/test/tap/tests/test_mysqlsh-t.cpp index bb1324398f..309ea8fb3e 100644 --- a/test/tap/tests/test_mysqlsh-t.cpp +++ b/test/tap/tests/test_mysqlsh-t.cpp @@ -8,8 +8,8 @@ #include #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_prometheus_metrics-t.cpp b/test/tap/tests/test_prometheus_metrics-t.cpp index 1b52e23934..3df50999bf 100644 --- a/test/tap/tests/test_prometheus_metrics-t.cpp +++ b/test/tap/tests/test_prometheus_metrics-t.cpp @@ -16,8 +16,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "json.hpp" #include "tap.h" diff --git a/test/tap/tests/test_ps_async-t.cpp b/test/tap/tests/test_ps_async-t.cpp index 5674b532c1..707d880eaf 100644 --- a/test/tap/tests/test_ps_async-t.cpp +++ b/test/tap/tests/test_ps_async-t.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ps_hg_routing-t.cpp b/test/tap/tests/test_ps_hg_routing-t.cpp index ad4da4000c..02a514f111 100644 --- a/test/tap/tests/test_ps_hg_routing-t.cpp +++ b/test/tap/tests/test_ps_hg_routing-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ps_large_result-t.cpp b/test/tap/tests/test_ps_large_result-t.cpp index 5f2b47c70d..52e6caaba9 100644 --- a/test/tap/tests/test_ps_large_result-t.cpp +++ b/test/tap/tests/test_ps_large_result-t.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ps_no_store-t.cpp b/test/tap/tests/test_ps_no_store-t.cpp index f2aad57199..a64b507bf9 100644 --- a/test/tap/tests/test_ps_no_store-t.cpp +++ b/test/tap/tests/test_ps_no_store-t.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_query_cache_soft_ttl_pct-t.cpp b/test/tap/tests/test_query_cache_soft_ttl_pct-t.cpp index 4594477c4f..68bce7954f 100644 --- a/test/tap/tests/test_query_cache_soft_ttl_pct-t.cpp +++ b/test/tap/tests/test_query_cache_soft_ttl_pct-t.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include "mysql.h" #include #include #include diff --git a/test/tap/tests/test_query_rules_fast_routing_algorithm-t.cpp b/test/tap/tests/test_query_rules_fast_routing_algorithm-t.cpp index b0171f9c37..e7a3cdec7e 100644 --- a/test/tap/tests/test_query_rules_fast_routing_algorithm-t.cpp +++ b/test/tap/tests/test_query_rules_fast_routing_algorithm-t.cpp @@ -13,8 +13,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "utils.h" diff --git a/test/tap/tests/test_query_rules_routing-t.cpp b/test/tap/tests/test_query_rules_routing-t.cpp index 165e08543e..521308335d 100644 --- a/test/tap/tests/test_query_rules_routing-t.cpp +++ b/test/tap/tests/test_query_rules_routing-t.cpp @@ -19,8 +19,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "command_line.h" #include "proxysql_utils.h" diff --git a/test/tap/tests/test_query_timeout-t.cpp b/test/tap/tests/test_query_timeout-t.cpp index 32ae524c4c..9f4af5f6b5 100644 --- a/test/tap/tests/test_query_timeout-t.cpp +++ b/test/tap/tests/test_query_timeout-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_read_only_actions_offline_hard_servers-t.cpp b/test/tap/tests/test_read_only_actions_offline_hard_servers-t.cpp index 3ee3e9a42e..90380e20f9 100644 --- a/test/tap/tests/test_read_only_actions_offline_hard_servers-t.cpp +++ b/test/tap/tests/test_read_only_actions_offline_hard_servers-t.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" #include "utils.h" diff --git a/test/tap/tests/test_rw_binary_data-t.cpp b/test/tap/tests/test_rw_binary_data-t.cpp index a61f9834b6..ec861d4d30 100644 --- a/test/tap/tests/test_rw_binary_data-t.cpp +++ b/test/tap/tests/test_rw_binary_data-t.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "command_line.h" #include "proxysql_utils.h" diff --git a/test/tap/tests/test_set_character_results-t.cpp b/test/tap/tests/test_set_character_results-t.cpp index 5bd927353f..a4499ac04c 100644 --- a/test/tap/tests/test_set_character_results-t.cpp +++ b/test/tap/tests/test_set_character_results-t.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_set_collation-t.cpp b/test/tap/tests/test_set_collation-t.cpp index 563f6af61c..cc3a6df4b9 100644 --- a/test/tap/tests/test_set_collation-t.cpp +++ b/test/tap/tests/test_set_collation-t.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include "mysql.h" #include #include "tap.h" diff --git a/test/tap/tests/test_simple_embedded_HTTP_server-t.cpp b/test/tap/tests/test_simple_embedded_HTTP_server-t.cpp index 86d9328bb1..bc2402ce20 100644 --- a/test/tap/tests/test_simple_embedded_HTTP_server-t.cpp +++ b/test/tap/tests/test_simple_embedded_HTTP_server-t.cpp @@ -8,8 +8,8 @@ #include "curl/curl.h" -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_sqlite3_server-t.cpp b/test/tap/tests/test_sqlite3_server-t.cpp index 36d6982ef8..e1d1bb7528 100644 --- a/test/tap/tests/test_sqlite3_server-t.cpp +++ b/test/tap/tests/test_sqlite3_server-t.cpp @@ -35,8 +35,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_sqlite3_server_and_fast_routing-t.cpp b/test/tap/tests/test_sqlite3_server_and_fast_routing-t.cpp index 84f74042e6..bda4c57a9d 100644 --- a/test/tap/tests/test_sqlite3_server_and_fast_routing-t.cpp +++ b/test/tap/tests/test_sqlite3_server_and_fast_routing-t.cpp @@ -7,8 +7,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ssl_connect-t.cpp b/test/tap/tests/test_ssl_connect-t.cpp index f517c5a82d..08def17dae 100644 --- a/test/tap/tests/test_ssl_connect-t.cpp +++ b/test/tap/tests/test_ssl_connect-t.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ssl_fast_forward-1-t.cpp b/test/tap/tests/test_ssl_fast_forward-1-t.cpp index b075ef632f..f8c5022c8d 100644 --- a/test/tap/tests/test_ssl_fast_forward-1-t.cpp +++ b/test/tap/tests/test_ssl_fast_forward-1-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ssl_fast_forward-2-t.cpp b/test/tap/tests/test_ssl_fast_forward-2-t.cpp index dd5b0b9a3b..e90f4b8d94 100644 --- a/test/tap/tests/test_ssl_fast_forward-2-t.cpp +++ b/test/tap/tests/test_ssl_fast_forward-2-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ssl_fast_forward-3-t.cpp b/test/tap/tests/test_ssl_fast_forward-3-t.cpp index af48b854d4..24d36e3842 100644 --- a/test/tap/tests/test_ssl_fast_forward-3-t.cpp +++ b/test/tap/tests/test_ssl_fast_forward-3-t.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ssl_large_query-1-t.cpp b/test/tap/tests/test_ssl_large_query-1-t.cpp index fd9ef63a9e..896a2d955d 100644 --- a/test/tap/tests/test_ssl_large_query-1-t.cpp +++ b/test/tap/tests/test_ssl_large_query-1-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_ssl_large_query-2-t.cpp b/test/tap/tests/test_ssl_large_query-2-t.cpp index eb780cf2b4..eaaaada5db 100644 --- a/test/tap/tests/test_ssl_large_query-2-t.cpp +++ b/test/tap/tests/test_ssl_large_query-2-t.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_stats_proxysql_message_metrics-t.cpp b/test/tap/tests/test_stats_proxysql_message_metrics-t.cpp index 173dff40b4..43a9a9db4d 100644 --- a/test/tap/tests/test_stats_proxysql_message_metrics-t.cpp +++ b/test/tap/tests/test_stats_proxysql_message_metrics-t.cpp @@ -8,8 +8,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "tap.h" #include "utils.h" diff --git a/test/tap/tests/test_throttle_max_bytes_per_second_to_client-t.cpp b/test/tap/tests/test_throttle_max_bytes_per_second_to_client-t.cpp index 3382d1fa21..d031f3c561 100644 --- a/test/tap/tests/test_throttle_max_bytes_per_second_to_client-t.cpp +++ b/test/tap/tests/test_throttle_max_bytes_per_second_to_client-t.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include "mysql.h" #include "tap.h" #include "command_line.h" diff --git a/test/tap/tests/test_unshun_algorithm-t.cpp b/test/tap/tests/test_unshun_algorithm-t.cpp index 6e57c5f8a0..e17f0b3ca8 100644 --- a/test/tap/tests/test_unshun_algorithm-t.cpp +++ b/test/tap/tests/test_unshun_algorithm-t.cpp @@ -63,8 +63,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "proxysql_utils.h" #include "tap.h" diff --git a/test/tap/tests/test_unsupported_queries-t.cpp b/test/tap/tests/test_unsupported_queries-t.cpp index 35acce78ab..1fe705474a 100644 --- a/test/tap/tests/test_unsupported_queries-t.cpp +++ b/test/tap/tests/test_unsupported_queries-t.cpp @@ -12,8 +12,8 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" #include "command_line.h" #include "json.hpp" diff --git a/test/tap/tests_with_deps/deprecate_eof_support/Makefile b/test/tap/tests_with_deps/deprecate_eof_support/Makefile index 4db69b67f1..29a8f4600f 100644 --- a/test/tap/tests_with_deps/deprecate_eof_support/Makefile +++ b/test/tap/tests_with_deps/deprecate_eof_support/Makefile @@ -1,33 +1,72 @@ -include ../common_defs.Makefile +#!/bin/make -f -MARIADB_BASE_FOLDER=$(TEST_DEPS)/mariadb-client-library-3.1.9/ -MARIADB_TEST_DEP=$(TEST_DEPS)/mariadb-client-library-3.1.9/mariadb-connector-c + +TEST_DEPS_PATH ?= /var/lib/jenkins/scripts/test-scripts/deps + +MARIADB_BASE_FOLDER := $(TEST_DEPS_PATH)/mariadb-client-library-3.1.9/ +MARIADB_TEST_DEP := $(TEST_DEPS_PATH)/mariadb-client-library-3.1.9/mariadb-connector-c BASE_DIR_EXIST := $(shell if [ -d $(MARIADB_BASE_FOLDER) ]; then echo 1; else echo 0; fi) DEP_FOLDER_EMPTY := $(shell if [ -f $(MARIADB_TEST_DEP)/CMakeLists.txt ]; then echo 1; else echo 0; fi) -ifeq ($(BASE_DIR_EXIST), 1) +ifeq ($(BASE_DIR_EXIST),1) + +ifeq ($(DEP_FOLDER_EMPTY),0) +$(error "Dependency folder '$(MARIADB_TEST_DEP)' is empty. Make sure folder is initialized.") +endif + +PROXYSQL_PATH := ../../../.. +DEPS_PATH := $(PROXYSQL_PATH)/deps -ifeq ($(DEP_FOLDER_EMPTY), 0) - $(error "Dependency folder '$(MARIADB_TEST_DEP)' is empty. Make sure folder is initialized") +WGCOV := +ifeq ($(WITHGCOV),1) + WGCOV := -DWITHGCOV --coverage -lgcov endif +WASAN := +ifeq ($(WITHASAN),1) + WASAN := -fsanitize=address +endif + +OPT := -O2 $(WGCOV) -Wl,--no-as-needed +LLP := $(shell pwd)/../../tap +TAP_LIBDIR := ../../tap + +TESTS_DEPS := $(TAP_LIBDIR)/libtap.a $(MARIADB_TEST_DEP)/libmariadb/libmariadbclient.a + +INCLUDEDIRS := -I$(PROXYSQL_PATH)/include +INCLUDEDIRS += -I$(DEPS_PATH)/sqlite3/sqlite3 +INCLUDEDIRS += -I$(DEPS_PATH)/json +INCLUDEDIRS += -I$(DEPS_PATH)/prometheus-cpp/prometheus-cpp/core/include -I$(DEPS_PATH)/prometheus-cpp/prometheus-cpp/pull/include +INCLUDEDIRS += -I$(DEPS_PATH)/libconfig/libconfig/lib +INCLUDEDIRS += -I$(DEPS_PATH)/jemalloc/jemalloc/include/jemalloc +INCLUDEDIRS += -I$(DEPS_PATH)/libhttpserver/libhttpserver/src +INCLUDEDIRS += -I$(DEPS_PATH)/libmicrohttpd/libmicrohttpd/src/include/ +INCLUDEDIRS += -I$(DEPS_PATH)/re2/re2 +INCLUDEDIRS += -I$(DEPS_PATH)/libev/libev +INCLUDEDIRS += -I$(MARIADB_TEST_DEP)/include + +PROXYLDIR := $(PROXYSQL_PATH)/lib + +.PHONY: default +default: all + .PHONY: all all: build_deps tests -OPT=-O2 $(WGCOV) -Wl,--no-as-needed - .PHONY: debug -debug: OPT=-O0 -DDEBUG -ggdb -Wl,--no-as-needed $(WGCOV) $(WASAN) +debug: DEBUG := -DDEBUG +debug: OPT := -O0 -DDEBUG -ggdb -Wl,--no-as-needed $(WGCOV) $(WASAN) debug: build_deps tests -LLP=$(shell pwd)/../../tap + $(MARIADB_TEST_DEP)/libmariadb/libmariadbclient.a: cd $(MARIADB_BASE_FOLDER) && CC=${CC} CXX=${CXX} ${MAKE} mariadb_client .PHONY: build_deps build_deps: $(MARIADB_TEST_DEP)/libmariadb/libmariadbclient.a + .PHONY: clean clean: rm -f *-t @@ -36,66 +75,54 @@ clean: rm -f *.a *.o cd $(MARIADB_BASE_FOLDER) && ${MAKE} clean -WITHGCOVVAR := $(shell echo $(WITHGCOV)) -ifeq ($(WITHGCOVVAR),1) -WGCOV=-DWITHGCOV --coverage -lgcov -else -WGCOV= -endif - -WITHASANVAR := $(shell echo $(WITHASAN)) -ifeq ($(WITHASANVAR),1) -WASAN=-fsanitize=address -else -WASAN= -endif - -TESTS_DEPS=$(TAP_LIBDIR)/libtap.a $(MARIADB_TEST_DEP)/libmariadb/libmariadbclient.a tests: $(patsubst %.cpp,%,$(wildcard *-t.cpp)) fwd_eof_query fwd_eof_ok_query -COMMONARGS1=$(OPT) -std=c++11 -I$(TAP_LIBDIR) -L$(TAP_LIBDIR) -ltap -lcpp_dotenv -Wl,--no-as-needed -lz -ldl -lpthread -DGITVERSION=\"$(GIT_VERSION)\" -DDEBUG -I$(JSON_IDIR) -COMMONARGS=$(COMMONARGS1) $(MYLIBS) +COMMONARGS1 := $(OPT) -std=c++11 -I$(TAP_LIBDIR) -L$(TAP_LIBDIR) -ltap -lcpp_dotenv -Wl,--no-as-needed -lz -ldl -lpthread -DGITVERSION=\"$(GIT_VERSION)\" -DDEBUG +COMMONARGS := $(COMMONARGS1) $(MYLIBS) ok_packet_mixed_queries-t: eof_packet_mixed_queries-t.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) $< $(INCLUDEDIRS) $(LDIRS) $(COMMONARGS) -o $@ + $(CXX) $< $(INCLUDEDIRS) $(LDIRS) -lmysqlclient $(COMMONARGS) -o $@ eof_packet_mixed_queries-t: eof_packet_mixed_queries-t.cpp ok_packet_mixed_queries-t $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) -DNON_EOF_SUPPORT $< $(INCLUDEDIRS) -I$(MARIADB_TEST_DEP)/include/ -L$(MARIADB_TEST_DEP)/libmariadb $(COMMONARGS) -o $@ + $(CXX) -DNON_EOF_SUPPORT $< $(INCLUDEDIRS) -I$(MARIADB_TEST_DEP)/include/ -L$(MARIADB_TEST_DEP)/libmariadb -lmysqlclient $(COMMONARGS) -o $@ fwd_eof_query: fwd_eof_query.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) -DNON_EOF_SUPPORT $< $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb $(COMMONARGS) -o $@ + $(CXX) -DNON_EOF_SUPPORT $< $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb -lmysqlclient $(COMMONARGS) -o $@ #fwd_eof_ok_query: fwd_eof_query.cpp $(TESTS_DEPS) # $(CXX) -DDEBUG fwd_eof_query.cpp $(INCLUDEDIRS) $(LDIRS) $(OPT) -std=c++11 -I$(TAP_LIBDIR) -L$(TAP_LIBDIR) $(MYLIBS) -L$(SSL_LDIR) -ltap -Wl,--no-as-needed -ldl -lpthread -o fwd_eof_ok_query -DGITVERSION=\"$(GIT_VERSION)\" # NOTE: Compilation with 'libmysql' instead of 'libmariadb' client to confirm packet sequence id isn't check by 'libmariadb' -fwd_eof_ok_query: fwd_eof_query.cpp $(TAP_LIBDIR)/libtap.a - LD_LIBRARY_PATH=$(LLP) $(CXX) $< -I/usr/include/mysql/ -I$(IDIR) -L/usr/lib/x86_64-linux-gnu/ -lmysqlclient $(COMMONARGS1) -o $@ +fwd_eof_ok_query: fwd_eof_query.cpp fwd_eof_query $(TAP_LIBDIR)/libtap.a + $(CXX) $< $(INCLUDEDIRS) -I/usr/include/mysql/ -lmysqlclient -I$(IDIR) -L/usr/lib/x86_64-linux-gnu/ $(COMMONARGS1) -o $@ deprecate_eof_cache-t: deprecate_eof_cache-t.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) $^ $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb -L$(PROXYLDIR) -lproxysql $(COMMONARGS) -o $@ + $(CXX) $^ $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb -L$(PROXYLDIR) -lproxysql $(COMMONARGS) -o $@ eof_cache_mixed_flags-t: eof_cache_mixed_flags-t.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) $^ $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb $(COMMONARGS) -o $@ + $(CXX) $^ $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb $(COMMONARGS) -o $@ eof_mixed_flags_queries-t: eof_mixed_flags_queries-t.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) $^ $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb $(COMMONARGS) -o $@ + $(CXX) $^ $(INCLUDEDIRS) -L$(MARIADB_TEST_DEP)/libmariadb $(COMMONARGS) -o $@ eof_conn_options_check-t: eof_conn_options_check-t.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) $< $(INCLUDEDIRS) $(LDIRS) $(COMMONARGS) -o $@ + $(CXX) $< $(INCLUDEDIRS) $(LDIRS) -lmysqlclient $(COMMONARGS) -o $@ eof_fast_forward-t: eof_fast_forward-t.cpp $(TESTS_DEPS) - LD_LIBRARY_PATH=$(LLP) $(CXX) $< $(INCLUDEDIRS) $(LDIRS) $(COMMONARGS) -o $@ + $(CXX) $< $(INCLUDEDIRS) $(LDIRS) -lmysqlclient $(COMMONARGS) -o $@ + +$(TAP_LIBDIR)/libtap.a: + cd ../../tap && CC=${CC} CXX=${CXX} ${MAKE} else .PHONY: all all: - $(warning The required deps were not found. Tests 'deprecate_eof_support' wont be build) +$(warning The required deps were not found. Tests 'deprecate_eof_support' wont be build) .PHONY: debug debug: - $(warning The required deps were not found. Tests 'deprecate_eof_support' wont be build) +$(warning The required deps were not found. Tests 'deprecate_eof_support' wont be build) .PHONY: clean clean: diff --git a/test/tap/tests_with_deps/deprecate_eof_support/deprecate_eof_cache-t.cpp b/test/tap/tests_with_deps/deprecate_eof_support/deprecate_eof_cache-t.cpp index 66c4e8b8c1..890a94ac01 100644 --- a/test/tap/tests_with_deps/deprecate_eof_support/deprecate_eof_cache-t.cpp +++ b/test/tap/tests_with_deps/deprecate_eof_support/deprecate_eof_cache-t.cpp @@ -3,13 +3,14 @@ #include #include #include +#include #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" -#include +#include "proxysql_utils.h" #include "tap.h" #include "command_line.h" @@ -17,6 +18,8 @@ #include "json.hpp" +#include "MySQL_Protocol.h" + using std::vector; using std::string; using std::pair; diff --git a/test/tap/tests_with_deps/deprecate_eof_support/eof_conn_options_check-t.cpp b/test/tap/tests_with_deps/deprecate_eof_support/eof_conn_options_check-t.cpp index bb9cbfe999..1ce8454e9f 100644 --- a/test/tap/tests_with_deps/deprecate_eof_support/eof_conn_options_check-t.cpp +++ b/test/tap/tests_with_deps/deprecate_eof_support/eof_conn_options_check-t.cpp @@ -24,6 +24,8 @@ #include "command_line.h" #include "utils.h" +#include "MySQL_Protocol.h" + using nlohmann::json; /** diff --git a/test/tap/tests_with_deps/deprecate_eof_support/eof_fast_forward-t.cpp b/test/tap/tests_with_deps/deprecate_eof_support/eof_fast_forward-t.cpp index 976c4931c5..9aa1088159 100644 --- a/test/tap/tests_with_deps/deprecate_eof_support/eof_fast_forward-t.cpp +++ b/test/tap/tests_with_deps/deprecate_eof_support/eof_fast_forward-t.cpp @@ -17,15 +17,17 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" -#include +#include "proxysql_utils.h" #include "tap.h" #include "command_line.h" #include "utils.h" +#include "MySQL_Protocol.h" + using std::vector; using std::string; using std::pair; diff --git a/test/tap/tests_with_deps/deprecate_eof_support/eof_packet_mixed_queries-t.cpp b/test/tap/tests_with_deps/deprecate_eof_support/eof_packet_mixed_queries-t.cpp index 6584afb920..2b49c9a2ef 100644 --- a/test/tap/tests_with_deps/deprecate_eof_support/eof_packet_mixed_queries-t.cpp +++ b/test/tap/tests_with_deps/deprecate_eof_support/eof_packet_mixed_queries-t.cpp @@ -21,12 +21,14 @@ #include "mysql.h" #include "mysql/mysqld_error.h" -#include +#include "proxysql_utils.h" #include "tap.h" #include "command_line.h" #include "utils.h" +#include "MySQL_Protocol.h" + using std::pair; using std::string; using std::vector; diff --git a/test/tap/tests_with_deps/deprecate_eof_support/fwd_eof_query.cpp b/test/tap/tests_with_deps/deprecate_eof_support/fwd_eof_query.cpp index faf18c8599..15261042fc 100644 --- a/test/tap/tests_with_deps/deprecate_eof_support/fwd_eof_query.cpp +++ b/test/tap/tests_with_deps/deprecate_eof_support/fwd_eof_query.cpp @@ -5,16 +5,18 @@ #include #include -#include -#include +#include "mysql.h" +#include "mysql/mysqld_error.h" -#include +#include "proxysql_utils.h" #include "tap.h" #include "command_line.h" #include "json.hpp" +#include "MySQL_Protocol.h" + using namespace nlohmann; using std::string;