Skip to content

Commit

Permalink
Merge branch 'v2.x' of https://github.com/sysown/proxysql into v2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed May 27, 2024
2 parents b362141 + 7ec6e14 commit 1115095
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 64 deletions.
4 changes: 2 additions & 2 deletions include/MySQL_HostGroups_Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <mutex>

// Headers for declaring Prometheus counters
#include <prometheus/counter.h>
#include <prometheus/gauge.h>
#include "prometheus/counter.h"
#include "prometheus/gauge.h"

#include "thread.h"
#include "wqueue.h"
Expand Down
4 changes: 2 additions & 2 deletions include/MySQL_Monitor.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef __CLASS_MYSQL_MONITOR_H
#define __CLASS_MYSQL_MONITOR_H
#include <future>
#include <prometheus/counter.h>
#include <prometheus/gauge.h>
#include "prometheus/counter.h"
#include "prometheus/gauge.h"

#include "MySQL_HostGroups_Manager.h"
#include "proxysql.h"
Expand Down
4 changes: 2 additions & 2 deletions include/MySQL_Thread.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef __CLASS_MYSQL_THREAD_H
#define __CLASS_MYSQL_THREAD_H
#define ____CLASS_STANDARD_MYSQL_THREAD_H
#include <prometheus/counter.h>
#include <prometheus/gauge.h>
#include "prometheus/counter.h"
#include "prometheus/gauge.h"

#include "proxysql.h"
#include "cpp.h"
Expand Down
4 changes: 2 additions & 2 deletions include/ProxySQL_Cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include "wqueue.h"
#include <vector>

#include <prometheus/counter.h>
#include <prometheus/gauge.h>
#include "prometheus/counter.h"
#include "prometheus/gauge.h"

#define PROXYSQL_NODE_METRICS_LEN 5

Expand Down
6 changes: 3 additions & 3 deletions include/prometheus_helpers.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef __PROXYSQL_PROMETHEUS_HELPERS_H
#define __PROXYSQL_PROMETHEUS_HELPERS_H

#include <prometheus/counter.h>
#include <prometheus/gauge.h>
#include <prometheus/family.h>
#include "prometheus/counter.h"
#include "prometheus/gauge.h"
#include "prometheus/family.h"
#include <string>

#include "proxysql.h"
Expand Down
10 changes: 5 additions & 5 deletions include/proxysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
#include <signal.h>
#include <errno.h>
#include <ctype.h>
#include <openssl/bio.h>
#include <openssl/sha.h>
#include <openssl/md5.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include "openssl/bio.h"
#include "openssl/sha.h"
#include "openssl/md5.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
#include <poll.h>
#include <execinfo.h>

Expand Down
4 changes: 2 additions & 2 deletions include/query_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#define DEFAULT_purge_threshold_pct_min 3
#define DEFAULT_purge_threshold_pct_max 90

#include <prometheus/counter.h>
#include <prometheus/gauge.h>
#include "prometheus/counter.h"
#include "prometheus/gauge.h"

class KV_BtreeArray;

Expand Down
8 changes: 4 additions & 4 deletions lib/MySQL_HostGroups_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <pthread.h>
#include <string>

#include <prometheus/counter.h>
#include <prometheus/detail/builder.h>
#include <prometheus/family.h>
#include <prometheus/gauge.h>
#include "prometheus/counter.h"
#include "prometheus/detail/builder.h"
#include "prometheus/family.h"
#include "prometheus/gauge.h"

#include "prometheus_helpers.h"
#include "proxysql_utils.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/MySQL_Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <thread>
#include <future>
#include <sstream>
#include <prometheus/counter.h>
#include "prometheus/counter.h"
#include "MySQL_Protocol.h"
#include "MySQL_HostGroups_Manager.h"
#include "MySQL_Monitor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion lib/MySQL_Protocol.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <openssl/rand.h>
#include "openssl/rand.h"
#include "proxysql.h"
#include "cpp.h"
#include "re2/re2.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/MySQL_ResultSet.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <openssl/rand.h>
#include "openssl/rand.h"
#include "proxysql.h"
#include "cpp.h"
#include "re2/re2.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/MySQL_encode.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <openssl/rand.h>
#include "openssl/rand.h"
#include "proxysql.h"
#include "cpp.h"

Expand Down
8 changes: 4 additions & 4 deletions lib/ProxySQL_Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include <memory>
#include <vector> // std::vector
#include <unordered_set>
#include <prometheus/exposer.h>
#include <prometheus/counter.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include "prometheus/exposer.h"
#include "prometheus/counter.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
#include "MySQL_HostGroups_Manager.h"
#include "mysql.h"
#include "proxysql_admin.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/ProxySQL_GloVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "cpp.h"
#include <string>
#include <sys/utsname.h>
#include <prometheus/registry.h>
#include "prometheus/registry.h"
#ifndef SPOOKYV2
#include "SpookyV2.h"
#define SPOOKYV2
Expand Down
2 changes: 1 addition & 1 deletion lib/Query_Cache.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <prometheus/counter.h>
#include "prometheus/counter.h"
#include "btree_map.h"
#include "proxysql.h"
#include "cpp.h"
Expand Down
10 changes: 5 additions & 5 deletions lib/c_tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,10 @@ void stage_1_parsing(shared_st* shared_st, stage_1_st* stage_1_st, options* opts
// Q: `SELECT\s\s 1`
// ^ address used to be replaced by next char
// ```
if (shared_st->prev_char == ' ' && is_space_char(*shared_st->q)) {
if (is_space_char(shared_st->prev_char) && is_space_char(*shared_st->q)) {
// if current position in result buffer is the first space found, we move to the next
// position, in order to respect the first space char.
if (*(shared_st->res_cur_pos-1) != ' ') {
if (!is_space_char(*(shared_st->res_cur_pos-1))) {
shared_st->res_cur_pos++;
}

Expand Down Expand Up @@ -2393,17 +2393,17 @@ char* mysql_query_digest_and_first_comment_one_it(char* q, int q_len, char** fst
// suppress all the double spaces.
// ==============================
//
// The supression is performed using the address of the second space found as the
// The suppression is performed using the address of the second space found as the
// pivoting point for further space suppression in the result buffer:
//
// ```
// Q: `SELECT\s\s 1`
// ^ address used to be replaced by next char
// ```
if (shared_st.prev_char == ' ' && is_space_char(*shared_st.q)) {
if (is_space_char(shared_st.prev_char) && is_space_char(*shared_st.q)) {
// if current position in result buffer is the first space found, we move to the next
// position, in order to respect the first space char.
if (*(shared_st.res_cur_pos-1) != ' ') {
if (!is_space_char(*(shared_st.res_cur_pos-1))) {
shared_st.res_cur_pos++;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <unistd.h>


#include <libconfig.h++>
#include "libconfig.h++"

using namespace std;
using namespace libconfig;
Expand Down
8 changes: 5 additions & 3 deletions lib/mysql_data_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "MySQL_PreparedStatement.h"
#include "MySQL_Data_Stream.h"

#include <openssl/x509v3.h>
#include "openssl/x509v3.h"


/**
Expand Down Expand Up @@ -433,7 +433,8 @@ MySQL_Data_Stream::~MySQL_Data_Stream() {
// other part, we perform a 'quiet' shutdown. For more context see
// MYSQL #29579.
SSL_set_quiet_shutdown(ssl, 1);
SSL_shutdown(ssl);
if (SSL_shutdown(ssl) < 0)
ERR_clear_error();
}
if (ssl) SSL_free(ssl);
}
Expand Down Expand Up @@ -515,7 +516,8 @@ void MySQL_Data_Stream::shut_hard() {
// other part, we perform a 'quiet' shutdown. For more context see
// MYSQL #29579.
SSL_set_quiet_shutdown(ssl, 1);
SSL_shutdown(ssl);
if (SSL_shutdown(ssl) < 0)
ERR_clear_error();
}
if (fd >= 0) {
shutdown(fd, SHUT_RDWR);
Expand Down
14 changes: 7 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
#include "Web_Interface.hpp"
#include "proxysql_utils.h"

#include <libdaemon/dfork.h>
#include <libdaemon/dsignal.h>
#include <libdaemon/dlog.h>
#include <libdaemon/dpid.h>
#include <libdaemon/dexec.h>
#include "libdaemon/dfork.h"
#include "libdaemon/dsignal.h"
#include "libdaemon/dlog.h"
#include "libdaemon/dpid.h"
#include "libdaemon/dexec.h"
#include "ev.h"

#include "curl/curl.h"

#include <openssl/x509v3.h>
#include "openssl/x509v3.h"

#include <sys/mman.h>

Expand Down Expand Up @@ -71,7 +71,7 @@ char *binary_sha1 = NULL;
#endif

static pthread_mutex_t *lockarray;
#include <openssl/crypto.h>
#include "openssl/crypto.h"


// this fuction will be called as a deatached thread
Expand Down
2 changes: 1 addition & 1 deletion src/proxy_tls.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "proxysql.h"
#include "cpp.h"
#include <openssl/x509v3.h>
#include "openssl/x509v3.h"

static long
get_file_size (const char *filename) {
Expand Down
2 changes: 1 addition & 1 deletion test/tap/tests/mysql_reconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <thread>

#ifdef LIBMYSQL_HELPER8
#include <mysql/mysql.h>
#include "mysql/mysql.h"
#else
#include "mysql.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion test/tap/tests/test_binlog_reader-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "mysql.h"
#include "mysqld_error.h"
#include <json.hpp>
#include "json.hpp"

#include "tap.h"
#include "command_line.h"
Expand Down
2 changes: 1 addition & 1 deletion test/tap/tests/test_client_limit_error-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <iostream>
#include <fstream>

#include <libconfig.h>
#include "libconfig.h"
#include "proxysql_utils.h"
#include "mysql.h"

Expand Down
2 changes: 1 addition & 1 deletion test/tap/tests/test_cluster_sync-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#include <regex>
#include <utility>

#include <libconfig.h>
#include "libconfig.h"

#include "proxysql_utils.h"

Expand Down
6 changes: 3 additions & 3 deletions test/tap/tests/test_cluster_sync_mysql_servers-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
#include <regex>
#include <utility>

#include <libconfig.h>
#include "libconfig.h"

#include <proxysql_utils.h>
#include "proxysql_utils.h"

#include <mysql.h>
#include "mysql.h"
#ifndef SPOOKYV2
#include "SpookyV2.h"
#define SPOOKYV2
Expand Down
8 changes: 5 additions & 3 deletions test/tap/tests/test_mysql_query_digests_stages-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
#include <random>
#include <vector>
#include <string>
#include <regex>

#include "json.hpp"
#include "proxysql.h"
#include "proxysql_utils.h"
#include "re2/re2.h"
#include "command_line.h"
#include "tap.h"

Expand Down Expand Up @@ -151,8 +151,10 @@ nlohmann::json get_tests_defs(const string& filepath) {
std::ifstream file_stream(filepath);
std::string test_file_contents((std::istreambuf_iterator<char>(file_stream)), (std::istreambuf_iterator<char>()));

std::regex comment_pattern { ".*\\/\\/.*[\\r\\n]" };
string test_file_no_comments { std::regex_replace(test_file_contents, comment_pattern, "") };
std::string comment_pattern { ".*\\/\\/.*[\\r\\n]" };
string test_file_no_comments { test_file_contents };

re2::RE2::GlobalReplace(&test_file_no_comments, comment_pattern, "");
nlohmann::json j_test_defs = nlohmann::json::parse(test_file_no_comments, nullptr, true);

return j_test_defs;
Expand Down
4 changes: 2 additions & 2 deletions test/tap/tests/test_warnings-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <thread>

#include "json.hpp"
#include <mysql.h>
#include <mysql/mysqld_error.h>
#include "mysql.h"
#include "mysql/mysqld_error.h"
#include "tap.h"
#include "command_line.h"
#include "utils.h"
Expand Down
Loading

0 comments on commit 1115095

Please sign in to comment.