Merge pull request #4069 from sysown/v2.x-4066-upgrade_deps

upgrade deps - part of #4066
pull/4090/head
René Cannaò 3 years ago committed by GitHub
commit 9e40acf999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

102
.gitignore vendored

@ -73,96 +73,24 @@ architecture.txt
proxysql-2.*
### DEPS
#jemalloc source
deps/jemalloc/jemalloc-3.6.0/
deps/jemalloc/jemalloc-4.1.0/
deps/jemalloc/jemalloc-4.2.1/
deps/jemalloc/jemalloc-4.3.1/
deps/jemalloc/jemalloc-5.2.0/
#libdaemon
deps/libdaemon/libdaemon-0.14/
#mariadb client library
deps/mariadb-client-library/mariadb_client-2.0.0-Linux-x86/
deps/mariadb-client-library/mariadb_client-2.0.0-Linux-x86_64/
deps/mariadb-client-library/mariadb_client-2.0.0-src/
deps/mariadb-client-library/mariadb-connector-c-2.1.0-src/
deps/mariadb-client-library/mariadb-connector-c-2.3.1/
deps/mariadb-client-library/mariadb-connector-c-3.0.2-src/
deps/mariadb-client-library/mariadb-connector-c-3.0.9-src/
deps/mariadb-client-library/mariadb-connector-c-3.1.4-src/
deps/mariadb-client-library/mariadb-connector-c-3.1.9-src/
#libinjection
deps/libinjection/libinjection-3.10.0/
#glib
deps/glib/glib-2.40.0/
#libevent
deps/libevent/libevent-2.0.22-stable/
#memcached
deps/memcached/memcached-1.4.20/
#libconfig
deps/libconfig/libconfig-1.4.9/
deps/libconfig/libconfig-1.7.2/
#libmicrohttpd
deps/libmicrohttpd/libmicrohttpd-0.9.55/
deps/libmicrohttpd/libmicrohttpd-0.9.68/
deps/libmicrohttpd/libmicrohttpd
#libhttpserver
deps/libhttpserver/libhttpserver-master_20191121/
deps/libhttpserver/libhttpserver-0.18.1/
#clickhouse
deps/clickhouse-cpp/clickhouse-cpp-*
deps/cityhash/cityhash/
deps/lz4/lz4-1.7.5/
deps/lz4/lz4/
#re2
deps/re2/re2/
deps/re2/re2-2018-07-01/
deps/re2/re2-2020-07-06/
deps/pcre/pcre-8.39/
deps/pcre/pcre-8.44/
deps/pcre/pcre/
# curl
deps/curl/curl/
deps/cityhash/cityhash-*/
deps/clickhouse-cpp/clickhouse-cpp-*/
deps/curl/curl-*/
deps/libev/libev-4.24/
#protobuf
deps/protobuf/protobuf-2.6.1/
deps/sqlite3/sqlite-amalgamation-3150000/
deps/sqlite3/sqlite-amalgamation-3190200/
deps/sqlite3/sqlite-amalgamation-3270200/
deps/cityhash/cityhash/
deps/lz4/lz4-1.7.5/
#libev
deps/libev/libev-4.24/
#libssl
deps/jemalloc/jemalloc-*/
deps/libconfig/libconfig-*/
deps/libdaemon/libdaemon-*/
deps/libev/libev-*/
deps/libhttpserver/libhttpserver-*/
deps/libinjection/libinjection-*/
deps/libmicrohttpd/libmicrohttpd-*/
deps/libssl/openssl-openssl-*/
deps/libssl/openssl-3*/
#google coredumper
deps/google-coredumper/google-coredumper/
deps/lz4/lz4-*/
deps/mariadb-client-library/mariadb-connector-c-*/
deps/pcre/pcre-*/
deps/prometheus-cpp/prometheus-cpp-*/
deps/re2/re2-*/
deps/sqlite3/sqlite-amalgamation-*/
#prometheus-cpp
deps/prometheus-cpp/*
!deps/prometheus-cpp/patches
test/.vagrant
.DS_Store

123
deps/Makefile vendored

@ -64,6 +64,7 @@ endif
.PHONY: default
libinjection/libinjection/src/libinjection.a:
cd libinjection && rm -rf libinjection-*/ || true
cd libinjection && tar -zxf libinjection-3.10.0.tar.gz
@ -77,8 +78,10 @@ else
sed -i 's/CC=/CC?=/' libinjection/libinjection/src/Makefile
endif
cd libinjection/libinjection && CC=${CC} CXX=${CXX} ${MAKE}
libinjection: libinjection/libinjection/src/libinjection.a
libssl/openssl/libssl.a:
cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
cd libssl && tar -zxf openssl-*.tar.gz
@ -87,58 +90,48 @@ libssl/openssl/libssl.a:
cd libssl/openssl && ./config no-ssl3 no-tests
cd libssl/openssl && CC=${CC} CXX=${CXX} ${MAKE}
cd libssl/openssl && ln -s . lib # curl wants this path
libssl: libssl/openssl/libssl.a
MIN_VERSION := 4.9.0
GCC_VERSION := $(shell gcc -dumpversion)
SORTED_VERSIONS := $(shell echo -e "$(GCC_VERSION)\n$(MIN_VERSION)" | sort -V)
libssl: libssl/openssl/libssl.a
REQUIRE_PATCH = false
ifeq ($(MIN_VERSION),$(lastword $(SORTED_VERSIONS)))
REQUIRE_PATCH = true
endif
libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a re2/re2/obj/libre2.a
cd libhttpserver && rm -rf libhttpserver-*/ || true
cd libhttpserver && tar -zxf libhttpserver-0.18.1.tar.gz
#ifeq ($(REQUIRE_PATCH), true)
cd libhttpserver/libhttpserver && patch src/httpserver/basic_auth_fail_response.hpp < ../basic_auth_fail_response.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/create_webserver.hpp < ../create_webserver.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/deferred_response.hpp < ../deferred_response.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/digest_auth_fail_response.hpp < ../digest_auth_fail_response.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/file_response.hpp < ../file_response.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/http_request.hpp < ../http_request.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/http_resource.hpp < ../http_resource.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/http_response.hpp < ../http_response.hpp.patch
cd libhttpserver/libhttpserver && patch src/httpserver/string_response.hpp < ../string_response.hpp.patch
cd libhttpserver/libhttpserver && patch -p0 < ../re2_regex.patch
#endif
cd libhttpserver/libhttpserver && patch -p0 < ../final_val_post_process.patch
cd libhttpserver/libhttpserver && patch -p0 < ../empty_uri_log_crash.patch
cd libhttpserver && tar -zxf libhttpserver-*.tar.gz
cd libhttpserver/libhttpserver && patch -p1 < ../noexcept.patch
cd libhttpserver/libhttpserver && patch -p1 < ../re2_regex.patch
cd libhttpserver/libhttpserver && patch -p1 < ../final_val_post_process.patch
cd libhttpserver/libhttpserver && patch -p1 < ../empty_uri_log_crash.patch
ifeq ($(UNAME_S),FreeBSD)
sed -i -e 's/\/bin\/bash/\/usr\/local\/bin\/bash/' libhttpserver/libhttpserver/bootstrap
endif
cd libhttpserver/libhttpserver && ./bootstrap && mkdir build
cd libhttpserver/libhttpserver/build && LDFLAGS=-L$(shell pwd)/libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/ CPPFLAGS=-I$(shell pwd)/libmicrohttpd/libmicrohttpd/src/include ../configure --disable-doxygen-doc --disable-doxygen-dot --disable-doxygen-man --disable-doxygen-html --enable-fastopen=false
cd libhttpserver/libhttpserver/build && CC=${CC} CXX=${CXX} ${MAKE}
libhttpserver: libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a
libev/libev/.libs/libev.a:
cd libev && rm -rf libev-*/ || true
cd libev && tar -zxf libev-4.24.tar.gz
cd libev/libev && patch ev.c < ../ev.c-multiplication-overflow.patch
cd libev/libev && ./configure
cd libev && tar -zxf libev-*.tar.gz
# cd libev/libev && patch ev.c < ../ev.c-multiplication-overflow.patch
cd libev/libev && ./configure
cd libev/libev && CC=${CC} CXX=${CXX} ${MAKE}
ev: libev/libev/.libs/libev.a
curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a
cd curl && rm -rf curl-*/ || true
cd curl && tar -zxf curl-*.tar.gz
#cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --with-ssl=$(shell pwd)/../../libssl/openssl/ && CC=${CC} CXX=${CXX} ${MAKE}
cd curl/curl && patch configure < ../configure.patch
# cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --with-ssl=$(shell pwd)/../../libssl/openssl/ && CC=${CC} CXX=${CXX} ${MAKE}
# cd curl/curl && patch configure < ../configure.patch
cd curl/curl && autoreconf -fi
cd curl/curl && CFLAGS=-fPIC ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=no && CC=${CC} CXX=${CXX} ${MAKE}
curl: curl/curl/lib/.libs/libcurl.a
libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a:
cd libmicrohttpd && rm -rf libmicrohttpd-*/ || true
cd libmicrohttpd && rm -f libmicrohttpd || true
@ -146,39 +139,44 @@ ifeq ($(CENTOSVER),6)
cd libmicrohttpd && ln -s libmicrohttpd-0.9.55 libmicrohttpd
cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.55.tar.gz
else
cd libmicrohttpd && ln -s libmicrohttpd-0.9.68 libmicrohttpd
cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.68.tar.gz
cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/connection.c < ../connection.c-snprintf-overflow.patch
cd libmicrohttpd && ln -s libmicrohttpd-0.9.75 libmicrohttpd
cd libmicrohttpd && tar -zxf libmicrohttpd-0.9.75.tar.gz
# cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/connection.c < ../connection.c-snprintf-overflow.patch
endif
ifeq ($(UNAME_S),Darwin)
cd libmicrohttpd/libmicrohttpd && patch src/microhttpd/mhd_sockets.c < ../mhd_sockets.c-issue-5977.patch
endif
cd libmicrohttpd/libmicrohttpd && ./configure --enable-https && CC=${CC} CXX=${CXX} ${MAKE}
microhttpd: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a
cityhash/cityhash/src/.libs/libcityhash.a:
cd cityhash && rm -rf cityhash/ || true
cd cityhash && tar -zxf cityhash.tar.gz
cd cityhash/cityhash && cp ../config.guess . && chmod +x config.guess && cp ../config.sub . && chmod +x config.sub && ./configure && CC=${CC} CXX=${CXX} ${MAKE}
cd cityhash && rm -rf cityhash-*/ || true
cd cityhash && tar -zxf cityhash-*.tar.gz && sync
cd cityhash/cityhash && cp ../config.guess . && chmod +x config.guess && cp ../config.sub . && chmod +x config.sub
cd cityhash/cityhash && ./configure && CC=${CC} CXX=${CXX} ${MAKE}
cityhash: cityhash/cityhash/src/.libs/libcityhash.a
lz4/lz4/liblz4.a:
lz4/lz4/lib/liblz4.a:
cd lz4 && rm -rf lz4-*/ || true
cd lz4 && tar -zxf lz4-1.7.5.tar.gz
cd lz4 && tar -zxf lz4-*.tar.gz
cd lz4/lz4 && CC=${CC} CXX=${CXX} ${MAKE}
lz4: lz4/lz4/liblz4.a
lz4: lz4/lz4/lib/liblz4.a
clickhouse-cpp/clickhouse-cpp/clickhouse/libclickhouse-cpp-lib-static.a:
cd clickhouse-cpp && rm -rf clickhouse-cpp-*/ || true
ifeq ($(IS_CXX17), 1)
echo ">>> Clickhouse CXX17"
cd clickhouse-cpp && ln -fs clickhouse-cpp-2.1.0 clickhouse-cpp
cd clickhouse-cpp && rm -rf clickhouse-cpp-*/ || true
cd clickhouse-cpp && tar -zxf v2.1.0.tar.gz && sync
cd clickhouse-cpp && ln -fs clickhouse-cpp-2.3.0 clickhouse-cpp
cd clickhouse-cpp && tar -zxf v2.3.0.tar.gz && sync
else
echo ">>> Clickhouse CXX11"
cd clickhouse-cpp && ln -fs clickhouse-cpp-1.0.0 clickhouse-cpp
cd clickhouse-cpp && rm -rf clickhouse-cpp-*/ || true
cd clickhouse-cpp && tar -zxf v1.0.0.tar.gz && sync
cd clickhouse-cpp && sed -i 's/SET (CMAKE_CXX_STANDARD_REQUIRED ON)//' clickhouse-cpp/cmake/cpp17.cmake
endif
@ -196,6 +194,7 @@ libdaemon/libdaemon/libdaemon/.libs/libdaemon.a:
libdaemon: libdaemon/libdaemon/libdaemon/.libs/libdaemon.a
jemalloc/jemalloc/lib/libjemalloc.a:
cd jemalloc && rm -rf jemalloc-*/ || true
cd jemalloc && tar --no-same-owner -jxf jemalloc-5.2.0.tar.bz2
@ -207,6 +206,7 @@ jemalloc/jemalloc/lib/libjemalloc.a:
jemalloc: jemalloc/jemalloc/lib/libjemalloc.a
WITHASAN := $(shell echo $(WITHASAN))
mariadb-client-library/mariadb_client/libmariadb/libmariadbclient.a: libssl/openssl/libssl.a
@ -255,59 +255,66 @@ mariadb_client: mariadb-client-library/mariadb_client/libmariadb/libmariadbclien
sqlite3/sqlite3/sqlite3.o:
cd sqlite3 && rm -rf sqlite-amalgamation-*/ || true
cd sqlite3 && tar -zxf sqlite-amalgamation-3190200.tar.gz
cd sqlite3/sqlite3 && patch sqlite3.c < ../from_unixtime.patch
cd sqlite3/sqlite3 && patch sqlite3.c < ../sqlite3.c-multiplication-overflow.patch
cd sqlite3 && tar -zxf sqlite-amalgamation-*.tar.gz
cd sqlite3/sqlite3 && patch -p1 < ../from_unixtime.patch
# cd sqlite3/sqlite3 && patch sqlite3.c < ../sqlite3.c-multiplication-overflow.patch
cd sqlite3/sqlite3 && ${CC} ${MYCFLAGS} -fPIC -c -o sqlite3.o sqlite3.c -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_JSON1 -DSQLITE_DLL=1
cd sqlite3/sqlite3 && ${CC} -shared -o libsqlite3.so sqlite3.o
sqlite3: sqlite3/sqlite3/sqlite3.o
libconfig/libconfig/lib/.libs/libconfig++.a:
cd libconfig && rm -rf libconfig-*/ || true
cd libconfig && tar -zxf libconfig-1.7.2.tar.gz
cd libconfig && tar -zxf libconfig-*.tar.gz
cd libconfig/libconfig && ./configure --disable-examples
cd libconfig/libconfig && CC=${CC} CXX=${CXX} ${MAKE}
libconfig: libconfig/libconfig/lib/.libs/libconfig++.a
prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a:
cd prometheus-cpp && rm -rf prometheus-cpp-*/ || true
cd prometheus-cpp && tar -zxf v0.9.0.tar.gz
cd prometheus-cpp && tar --strip-components=1 -zxf civetweb-v1.11.tar.gz -C prometheus-cpp/3rdparty/civetweb
cd prometheus-cpp && tar -zxf prometheus-cpp-*.tar.gz
cd prometheus-cpp && tar --strip-components=1 -zxf civetweb-*.tar.gz -C prometheus-cpp/3rdparty/civetweb
cd prometheus-cpp/prometheus-cpp && patch -p1 < ../serial_exposer.patch
cd prometheus-cpp/prometheus-cpp && patch -p0 < ../registry_counters_reset.patch
cd prometheus-cpp/prometheus-cpp && patch -p0 < ../include_limits.patch
cd prometheus-cpp/prometheus-cpp && patch -p1 < ../registry_counters_reset.patch
cd prometheus-cpp/prometheus-cpp && patch -p1 < ../fix_old_distros.patch
cd prometheus-cpp/prometheus-cpp && cmake . -DBUILD_SHARED_LIBS=OFF -DENABLE_TESTING=OFF -DENABLE_PUSH=OFF
cd prometheus-cpp/prometheus-cpp && CC=${CC} CXX=${CXX} ${MAKE}
prometheus-cpp: prometheus-cpp/prometheus-cpp/lib/libprometheus-cpp-core.a
re2/re2/obj/libre2.a:
cd re2 && rm -rf re2-*/ || true
cd re2 && tar -zxf re2.tar.gz
cd re2 && tar -zxf re2-*.tar.gz
# cd re2/re2 && sed -i -e 's/-O3 -g /-O3 -fPIC /' Makefile
# cd re2/re2 && patch util/mutex.h < ../mutex.h.patch
cd re2/re2 && patch re2/onepass.cc < ../onepass.cc-multiplication-overflow.patch
# cd re2/re2 && patch re2/onepass.cc < ../onepass.cc-multiplication-overflow.patch
ifeq ($(UNAME_S),Darwin)
cd re2/re2 && sed -i '' -e 's/-O3 /-O3 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
cd re2/re2 && sed -i '' -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
cd re2/re2 && sed -i '' -e 's/-O3 -g/-O3 -g -std=c++11 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
# cd re2/re2 && sed -i '' -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
else
cd re2/re2 && sed -i -e 's/-O3 /-O3 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
cd re2/re2 && sed -i -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
cd re2/re2 && sed -i -e 's/-O3 -g/-O3 -g -std=c++11 -fPIC -DMEMORY_SANITIZER -DRE2_ON_VALGRIND /' Makefile
# cd re2/re2 && sed -i -e 's/RE2_CXXFLAGS?=-std=c++11 /RE2_CXXFLAGS?=-std=c++11 -fPIC /' Makefile
endif
cd re2/re2 && CC=${CC} CXX=${CXX} ${MAKE}
re2: re2/re2/obj/libre2.a
pcre/pcre/.libs/libpcre.a:
cd pcre && rm -rf pcre-*/ || true
cd pcre && tar -zxf pcre-8.44.tar.gz
cd pcre/pcre && patch pcretest.c < ../pcretest.c-multiplication-overflow.patch
cd pcre && tar -zxf pcre-*.tar.gz
# cd pcre/pcre && patch pcretest.c < ../pcretest.c-multiplication-overflow.patch
cd pcre/pcre && ./configure
cd pcre/pcre && CC=${CC} CXX=${CXX} ${MAKE}
pcre: pcre/pcre/.libs/libpcre.a
cleanpart:
cd mariadb-client-library && rm -rf mariadb-connector-c-*/ || true
cd jemalloc && rm -rf jemalloc-*/ || true
@ -333,6 +340,6 @@ cleanall:
cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
cd libconfig && rm -rf libconfig-*/ || true
cd prometheus-cpp && rm -rf prometheus-cpp-*/ || true
cd cityhash && rm -rf cityhash/ || true
cd cityhash && rm -rf cityhash-*/ || true
.PHONY: cleanall

@ -0,0 +1 @@
cityhash-1.1.1-5-gf5dc541

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
clickhouse-cpp-2.1.0
clickhouse-cpp-2.3.0

Binary file not shown.

Binary file not shown.

2
deps/curl/curl vendored

@ -1 +1 @@
curl-7.82.0
curl-curl-7_87_0

Binary file not shown.

Binary file not shown.

27542
deps/json/json.hpp vendored

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
libconfig-1.7.2
libconfig-1.7.3

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
deps/libev/libev vendored

@ -1 +1 @@
libev-4.24
libev-4.33

Binary file not shown.

Binary file not shown.

@ -1,8 +1,14 @@
diff --git src/webserver.cpp src/webserver.cpp
index 5ae7381..04a5a28 100644
--- src/webserver.cpp
+++ src/webserver.cpp
@@ -443,7 +443,7 @@ int policy_callback (void *cls, const struct sockaddr* addr, socklen_t addrlen)
commit 2678fcf0bc7a645a4043f5c194dfc75da35ab072
Author: Miro Stauder <miro@proxysql.com>
Date: Tue Jan 24 15:05:11 2023 +0000
webserver.patch
diff --git a/src/webserver.cpp b/src/webserver.cpp
index 38542f2..0ae69dc 100644
--- a/src/webserver.cpp
+++ b/src/webserver.cpp
@@ -441,7 +441,7 @@ MHD_Result policy_callback (void *cls, const struct sockaddr* addr, socklen_t ad
void* uri_log(void* cls, const char* uri)
{
struct details::modded_request* mr = new details::modded_request();

@ -1,8 +1,14 @@
diff --git src/webserver.cpp src/webserver.cpp
index a3104e9..5ae7381 100644
--- src/webserver.cpp
+++ src/webserver.cpp
@@ -676,6 +676,14 @@ int webserver::finalize_answer(
commit 3dab3a696e61c341029ad459608f2626e6e5547f
Author: Miro Stauder <miro@proxysql.com>
Date: Mon Jan 9 12:06:29 2023 +0000
final_val_post_process.patch
diff --git a/src/webserver.cpp b/src/webserver.cpp
index 38542f2..e6ef554 100644
--- a/src/webserver.cpp
+++ b/src/webserver.cpp
@@ -674,6 +674,14 @@ MHD_Result webserver::finalize_answer(
{
if(hrm->is_allowed(method))
{

@ -1 +1 @@
libhttpserver-0.18.1
libhttpserver-0.18.2

Binary file not shown.

Binary file not shown.

@ -0,0 +1,127 @@
commit 28afed88f70420ee256e627d065d21a00d9d7977
Author: Miro Stauder <miro@proxysql.com>
Date: Mon Jan 9 12:05:26 2023 +0000
noexcept.patch
diff --git a/src/httpserver/basic_auth_fail_response.hpp b/src/httpserver/basic_auth_fail_response.hpp
index a28fa3d..24bb132 100644
--- a/src/httpserver/basic_auth_fail_response.hpp
+++ b/src/httpserver/basic_auth_fail_response.hpp
@@ -52,7 +52,7 @@ class basic_auth_fail_response : public string_response
}
basic_auth_fail_response(const basic_auth_fail_response& other) = default;
- basic_auth_fail_response(basic_auth_fail_response&& other) noexcept = default;
+ basic_auth_fail_response(basic_auth_fail_response&& other) = default;
basic_auth_fail_response& operator=(const basic_auth_fail_response& b) = default;
basic_auth_fail_response& operator=(basic_auth_fail_response&& b) = default;
diff --git a/src/httpserver/create_webserver.hpp b/src/httpserver/create_webserver.hpp
index 39cb3ec..f43c8f5 100644
--- a/src/httpserver/create_webserver.hpp
+++ b/src/httpserver/create_webserver.hpp
@@ -48,7 +48,7 @@ class create_webserver
public:
create_webserver() = default;
create_webserver(const create_webserver& b) = default;
- create_webserver(create_webserver&& b) noexcept = default;
+ create_webserver(create_webserver&& b) = default;
create_webserver& operator=(const create_webserver& b) = default;
create_webserver& operator=(create_webserver&& b) = default;
diff --git a/src/httpserver/deferred_response.hpp b/src/httpserver/deferred_response.hpp
index 9e4601e..a8ba748 100644
--- a/src/httpserver/deferred_response.hpp
+++ b/src/httpserver/deferred_response.hpp
@@ -61,7 +61,7 @@ class deferred_response : public string_response
}
deferred_response(const deferred_response& other) = default;
- deferred_response(deferred_response&& other) noexcept = default;
+ deferred_response(deferred_response&& other) = default;
deferred_response& operator=(const deferred_response& b) = default;
deferred_response& operator=(deferred_response&& b) = default;
diff --git a/src/httpserver/digest_auth_fail_response.hpp b/src/httpserver/digest_auth_fail_response.hpp
index 50abcee..18cf19c 100644
--- a/src/httpserver/digest_auth_fail_response.hpp
+++ b/src/httpserver/digest_auth_fail_response.hpp
@@ -56,7 +56,7 @@ class digest_auth_fail_response : public string_response
}
digest_auth_fail_response(const digest_auth_fail_response& other) = default;
- digest_auth_fail_response(digest_auth_fail_response&& other) noexcept = default;
+ digest_auth_fail_response(digest_auth_fail_response&& other) = default;
digest_auth_fail_response& operator=(const digest_auth_fail_response& b) = default;
digest_auth_fail_response& operator=(digest_auth_fail_response&& b) = default;
diff --git a/src/httpserver/file_response.hpp b/src/httpserver/file_response.hpp
index 0c9386f..2e10f6c 100644
--- a/src/httpserver/file_response.hpp
+++ b/src/httpserver/file_response.hpp
@@ -50,7 +50,7 @@ class file_response : public http_response
}
file_response(const file_response& other) = default;
- file_response(file_response&& other) noexcept = default;
+ file_response(file_response&& other) = default;
file_response& operator=(const file_response& b) = default;
file_response& operator=(file_response&& b) = default;
diff --git a/src/httpserver/http_request.hpp b/src/httpserver/http_request.hpp
index 6aacbfe..0b83fa2 100644
--- a/src/httpserver/http_request.hpp
+++ b/src/httpserver/http_request.hpp
@@ -227,7 +227,7 @@ class http_request
* @param b http_request b to copy attributes from.
**/
http_request(const http_request& b) = default;
- http_request(http_request&& b) noexcept = default;
+ http_request(http_request&& b) = default;
http_request& operator=(const http_request& b) = default;
http_request& operator=(http_request&& b) = default;
diff --git a/src/httpserver/http_resource.hpp b/src/httpserver/http_resource.hpp
index 04f67cb..59829e8 100644
--- a/src/httpserver/http_resource.hpp
+++ b/src/httpserver/http_resource.hpp
@@ -211,7 +211,7 @@ class http_resource
* Copy constructor
**/
http_resource(const http_resource& b) = default;
- http_resource(http_resource&& b) noexcept = default;
+ http_resource(http_resource&& b) = default;
http_resource& operator=(const http_resource& b) = default;
http_resource& operator=(http_resource&& b) = default;
diff --git a/src/httpserver/http_response.hpp b/src/httpserver/http_response.hpp
index 1f3f097..3564f37 100644
--- a/src/httpserver/http_response.hpp
+++ b/src/httpserver/http_response.hpp
@@ -55,10 +55,10 @@ class http_response
* @param b The http_response object to copy attributes value from.
**/
http_response(const http_response& b) = default;
- http_response(http_response&& b) noexcept = default;
+ http_response(http_response&& b) = default;
http_response& operator=(const http_response& b) = default;
- http_response& operator=(http_response&& b) noexcept = default;
+ http_response& operator=(http_response&& b) = default;
virtual ~http_response() = default;
diff --git a/src/httpserver/string_response.hpp b/src/httpserver/string_response.hpp
index 43e7580..2043890 100644
--- a/src/httpserver/string_response.hpp
+++ b/src/httpserver/string_response.hpp
@@ -51,7 +51,7 @@ class string_response : public http_response
}
string_response(const string_response& other) = default;
- string_response(string_response&& other) noexcept = default;
+ string_response(string_response&& other) = default;
string_response& operator=(const string_response& b) = default;
string_response& operator=(string_response&& b) = default;

@ -1,7 +1,13 @@
diff --git examples/Makefile.am examples/Makefile.am
index 318a7a8..2f5e1fb 100644
--- examples/Makefile.am
+++ examples/Makefile.am
commit ff6527c6b71fd1d33c39b8dca2a89170de5c2263
Author: Miro Stauder <miro@proxysql.com>
Date: Mon Jan 9 12:05:55 2023 +0000
re2_regex.patch
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 318a7a8..0da1879 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -16,8 +16,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -17,10 +23,10 @@ index 318a7a8..2f5e1fb 100644
METASOURCES = AUTO
noinst_PROGRAMS = hello_world service minimal_hello_world custom_error allowing_disallowing_methods handlers hello_with_get_arg setting_headers custom_access_log basic_authentication digest_authentication minimal_https minimal_file_response minimal_deferred url_registration minimal_ip_ban benchmark_select benchmark_threads benchmark_nodelay deferred_with_accumulator
diff --git src/Makefile.am src/Makefile.am
index 5e549bb..ddb05ea 100644
--- src/Makefile.am
+++ src/Makefile.am
diff --git a/src/Makefile.am b/src/Makefile.am
index 5e549bb..1fcc59e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,7 +16,11 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -43,11 +49,11 @@ index 5e549bb..ddb05ea 100644
install-data-hook:
(mkdir -p $(DESTDIR)$(includedir) && cd $(DESTDIR)$(includedir) && $(LN_S) -f httpserver.hpp httpserverpp)
diff --git src/details/http_endpoint.cpp src/details/http_endpoint.cpp
index be76ddd..b6738a0 100644
--- src/details/http_endpoint.cpp
+++ src/details/http_endpoint.cpp
@@ -46,6 +46,7 @@ http_endpoint::http_endpoint
diff --git a/src/details/http_endpoint.cpp b/src/details/http_endpoint.cpp
index 584fb50..01292d5 100644
--- a/src/details/http_endpoint.cpp
+++ b/src/details/http_endpoint.cpp
@@ -52,6 +52,7 @@ http_endpoint::http_endpoint
bool registration,
bool use_regex
):
@ -55,7 +61,7 @@ index be76ddd..b6738a0 100644
family_url(family),
reg_compiled(false)
{
@@ -124,9 +125,19 @@ http_endpoint::http_endpoint
@@ -130,9 +131,19 @@ http_endpoint::http_endpoint
url_normalized += "$";
try
{
@ -77,7 +83,7 @@ index be76ddd..b6738a0 100644
{
throw std::invalid_argument("Not a valid regex in URL: " + url_normalized);
}
@@ -140,7 +151,7 @@ http_endpoint::http_endpoint(const http_endpoint& h):
@@ -146,7 +157,7 @@ http_endpoint::http_endpoint(const http_endpoint& h):
url_pars(h.url_pars),
url_pieces(h.url_pieces),
chunk_positions(h.chunk_positions),
@ -86,7 +92,7 @@ index be76ddd..b6738a0 100644
family_url(h.family_url),
reg_compiled(h.reg_compiled)
{
@@ -152,7 +163,7 @@ http_endpoint& http_endpoint::operator =(const http_endpoint& h)
@@ -158,7 +169,7 @@ http_endpoint& http_endpoint::operator =(const http_endpoint& h)
url_normalized = h.url_normalized;
family_url = h.family_url;
reg_compiled = h.reg_compiled;
@ -95,7 +101,7 @@ index be76ddd..b6738a0 100644
url_pars = h.url_pars;
url_pieces = h.url_pieces;
chunk_positions = h.chunk_positions;
@@ -170,7 +181,7 @@ bool http_endpoint::match(const http_endpoint& url) const
@@ -176,7 +187,7 @@ bool http_endpoint::match(const http_endpoint& url) const
if(!family_url || url.url_pieces.size() < url_pieces.size())
{
@ -104,7 +110,7 @@ index be76ddd..b6738a0 100644
}
string nn = "/";
@@ -180,7 +191,7 @@ bool http_endpoint::match(const http_endpoint& url) const
@@ -186,7 +197,7 @@ bool http_endpoint::match(const http_endpoint& url) const
nn += (first ? "" : "/") + url.url_pieces[i];
first = false;
}
@ -113,10 +119,10 @@ index be76ddd..b6738a0 100644
}
};
diff --git src/httpserver/details/http_endpoint.hpp src/httpserver/details/http_endpoint.hpp
index 147956a..2afd42f 100644
--- src/httpserver/details/http_endpoint.hpp
+++ src/httpserver/details/http_endpoint.hpp
diff --git a/src/httpserver/details/http_endpoint.hpp b/src/httpserver/details/http_endpoint.hpp
index 37fd0d8..ae92782 100644
--- a/src/httpserver/details/http_endpoint.hpp
+++ b/src/httpserver/details/http_endpoint.hpp
@@ -25,11 +25,12 @@
#ifndef _HTTP_ENDPOINT_HPP_
#define _HTTP_ENDPOINT_HPP_

Binary file not shown.

Binary file not shown.

2
deps/lz4/lz4 vendored

@ -1 +1 @@
lz4-1.7.5
lz4-1.9.4

Binary file not shown.

Binary file not shown.

2
deps/pcre/pcre vendored

@ -1 +1 @@
pcre-8.44
pcre-8.45

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,70 @@
diff --git a/core/include/prometheus/family.h b/core/include/prometheus/family.h
index 4f62fda..09cfbb5 100644
--- a/core/include/prometheus/family.h
+++ b/core/include/prometheus/family.h
@@ -110,7 +110,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Family : public Collectable {
/// \throw std::runtime_exception on invalid label names.
template <typename... Args>
T& Add(const Labels& labels, Args&&... args) {
- return Add(labels, std::make_unique<T>(args...));
+ return Add(labels, std::unique_ptr<T>(new T(args...)));
}
/// \brief Remove the given dimensional data.
diff --git a/core/src/registry.cc b/core/src/registry.cc
index 7a365ed..60aa010 100644
--- a/core/src/registry.cc
+++ b/core/src/registry.cc
@@ -147,7 +147,7 @@ Family<T>& Registry::Add(const std::string& name, const std::string& help,
throw std::invalid_argument("Family name already exists");
}
- auto family = std::make_unique<Family<T>>(name, help, labels);
+ auto family = std::unique_ptr<Family<T>>(new Family<T>(name, help, labels));
auto& ref = *family;
families.push_back(std::move(family));
return ref;
diff --git a/pull/src/endpoint.cc b/pull/src/endpoint.cc
index 5c44bee..b0a3e69 100644
--- a/pull/src/endpoint.cc
+++ b/pull/src/endpoint.cc
@@ -21,7 +21,7 @@ Endpoint::Endpoint(CivetServer& server, std::string uri)
: server_(server),
uri_(std::move(uri)),
endpoint_registry_(std::make_shared<Registry>()),
- metrics_handler_(std::make_unique<MetricsHandler>(*endpoint_registry_)) {
+ metrics_handler_(std::unique_ptr<MetricsHandler>(new MetricsHandler(*endpoint_registry_))) {
RegisterCollectable(endpoint_registry_);
server_.addHandler(uri_, metrics_handler_.get());
}
@@ -46,7 +46,7 @@ void Endpoint::RegisterAuth(
// split creating, assigning, and storing to avoid a race-condition when
// being called the second time and the handler is replaced
auto new_handler =
- std::make_unique<BasicAuthHandler>(std::move(authCB), realm);
+ std::unique_ptr<BasicAuthHandler>(new BasicAuthHandler(std::move(authCB), realm));
server_.addAuthHandler(uri_, new_handler.get());
auth_handler_ = std::move(new_handler);
}
diff --git a/pull/src/exposer.cc b/pull/src/exposer.cc
index 0d62bf3..1fce973 100644
--- a/pull/src/exposer.cc
+++ b/pull/src/exposer.cc
@@ -21,7 +21,7 @@ Exposer::Exposer(const std::string& bind_address, const std::size_t num_threads,
Exposer::Exposer(std::vector<std::string> options,
const CivetCallbacks* callbacks)
- : server_(std::make_unique<CivetServer>(std::move(options), callbacks)) {}
+ : server_(std::unique_ptr<CivetServer>(new CivetServer(std::move(options), callbacks))) {}
Exposer::~Exposer() = default;
@@ -60,7 +60,7 @@ detail::Endpoint& Exposer::GetEndpointForUri(const std::string& uri) {
return *it->get();
}
- endpoints_.emplace_back(std::make_unique<detail::Endpoint>(*server_, uri));
+ endpoints_.emplace_back(std::unique_ptr<detail::Endpoint>(new detail::Endpoint(*server_, uri)));
return *endpoints_.back().get();
}

@ -1,12 +0,0 @@
diff --git core/src/histogram.cc core/src/histogram.cc
index 8023529..b298fd4 100644
--- core/src/histogram.cc
+++ core/src/histogram.cc
@@ -3,6 +3,7 @@
#include <algorithm>
#include <cassert>
#include <iterator>
+#include <limits>
#include <numeric>
#include <ostream>

@ -1 +1 @@
prometheus-cpp-0.9.0/
prometheus-cpp-1.1.0

@ -1,7 +1,7 @@
diff --git core/include/prometheus/counter.h core/include/prometheus/counter.h
index 6ec01dd..6223106 100644
--- core/include/prometheus/counter.h
+++ core/include/prometheus/counter.h
diff --git a/core/include/prometheus/counter.h b/core/include/prometheus/counter.h
index 9b2ad19..4fa1fba 100644
--- a/core/include/prometheus/counter.h
+++ b/core/include/prometheus/counter.h
@@ -46,6 +46,12 @@ class PROMETHEUS_CPP_CORE_EXPORT Counter {
/// Collect is called by the Registry when collecting metrics.
ClientMetric Collect() const;
@ -15,11 +15,11 @@ index 6ec01dd..6223106 100644
private:
Gauge gauge_{0.0};
};
diff --git core/include/prometheus/family.h core/include/prometheus/family.h
index aa94683..925445a 100644
--- core/include/prometheus/family.h
+++ core/include/prometheus/family.h
@@ -135,6 +135,12 @@ class PROMETHEUS_CPP_CORE_EXPORT Family : public Collectable {
diff --git a/core/include/prometheus/family.h b/core/include/prometheus/family.h
index 0bc0723..4f62fda 100644
--- a/core/include/prometheus/family.h
+++ b/core/include/prometheus/family.h
@@ -141,6 +141,12 @@ class PROMETHEUS_CPP_CORE_EXPORT Family : public Collectable {
/// \return Zero or more samples for each dimensional data.
std::vector<MetricFamily> Collect() const override;
@ -30,15 +30,15 @@ index aa94683..925445a 100644
+ void ResetMetrics();
+
private:
std::unordered_map<std::size_t, std::unique_ptr<T>> metrics_;
std::unordered_map<std::size_t, std::map<std::string, std::string>> labels_;
diff --git core/include/prometheus/registry.h core/include/prometheus/registry.h
index c8fdeb2..e8a58c5 100644
--- core/include/prometheus/registry.h
+++ core/include/prometheus/registry.h
@@ -73,6 +73,12 @@ class PROMETHEUS_CPP_CORE_EXPORT Registry : public Collectable {
/// \return Zero or more metrics and their samples.
std::vector<MetricFamily> Collect() const override;
std::unordered_map<Labels, std::unique_ptr<T>, detail::LabelHasher> metrics_;
diff --git a/core/include/prometheus/registry.h b/core/include/prometheus/registry.h
index 6603f6c..877c085 100644
--- a/core/include/prometheus/registry.h
+++ b/core/include/prometheus/registry.h
@@ -94,6 +94,12 @@ class PROMETHEUS_CPP_CORE_EXPORT Registry : public Collectable {
template <typename T>
bool Remove(const Family<T>& family);
+ /// \brief Reset all the counters hold within the registry to a value of zero.
+ ///
@ -49,11 +49,11 @@ index c8fdeb2..e8a58c5 100644
private:
template <typename T>
friend class detail::Builder;
diff --git core/src/counter.cc core/src/counter.cc
index fc5b6f3..82fb8ae 100644
--- core/src/counter.cc
+++ core/src/counter.cc
@@ -8,6 +8,8 @@ void Counter::Increment(const double val) { gauge_.Increment(val); }
diff --git a/core/src/counter.cc b/core/src/counter.cc
index 2a93463..a12885d 100644
--- a/core/src/counter.cc
+++ b/core/src/counter.cc
@@ -13,6 +13,8 @@ void Counter::Increment(const double val) {
double Counter::Value() const { return gauge_.Value(); }
@ -62,33 +62,35 @@ index fc5b6f3..82fb8ae 100644
ClientMetric Counter::Collect() const {
ClientMetric metric;
metric.counter.value = Value();
diff --git core/src/family.cc core/src/family.cc
index 83631ab..aa25edb 100644
--- core/src/family.cc
+++ core/src/family.cc
@@ -97,6 +97,17 @@ ClientMetric Family<T>::CollectMetric(std::size_t hash, T* metric) const {
diff --git a/core/src/family.cc b/core/src/family.cc
index f087586..8f9d276 100644
--- a/core/src/family.cc
+++ b/core/src/family.cc
@@ -122,6 +122,19 @@ ClientMetric Family<T>::CollectMetric(const Labels& metric_labels,
return collected;
}
+
+template <>
+void Family<Counter>::ResetMetrics() {
+ auto reset_metric =
+ [](std::pair<const std::size_t, std::unique_ptr<Counter>>& metric) {
+ metric.second->Reset();
+ };
+
+ std::for_each(metrics_.begin(), metrics_.end(), reset_metric);
+// const auto reset_metric =
+// [](std::pair<const std::size_t, std::unique_ptr<Counter>>& metric) {
+// metric.second->Reset();
+// };
+//
+// std::for_each(metrics_.begin(), metrics_.end(), reset_metric);
+ for (const auto& m : metrics_) {
+ m.second->Reset();
+ }
+}
+
template class PROMETHEUS_CPP_CORE_EXPORT Family<Counter>;
template class PROMETHEUS_CPP_CORE_EXPORT Family<Gauge>;
template class PROMETHEUS_CPP_CORE_EXPORT Family<Histogram>;
diff --git core/src/registry.cc core/src/registry.cc
index 1a30a23..d3a660d 100644
--- core/src/registry.cc
+++ core/src/registry.cc
@@ -50,6 +50,12 @@ std::vector<MetricFamily> Registry::Collect() const {
diff --git a/core/src/registry.cc b/core/src/registry.cc
index 267bf92..7a365ed 100644
--- a/core/src/registry.cc
+++ b/core/src/registry.cc
@@ -56,6 +56,12 @@ std::vector<MetricFamily> Registry::Collect() const {
return results;
}

@ -1,36 +1,41 @@
diff --git a/pull/include/prometheus/exposer.h b/pull/include/prometheus/exposer.h
index c730360..3d070c5 100644
index 93e0b2b..0e83a7a 100644
--- a/pull/include/prometheus/exposer.h
+++ b/pull/include/prometheus/exposer.h
@@ -5,6 +5,7 @@
#include <memory>
@@ -6,9 +6,12 @@
#include <mutex>
#include <string>
#include <vector>
+#include <functional>
+#include <map>
#include "prometheus/collectable.h"
#include "prometheus/detail/pull_export.h"
@@ -16,6 +17,7 @@ namespace prometheus {
+#include "prometheus/registry.h"
class CivetServer;
struct CivetCallbacks;
@@ -17,6 +20,7 @@ namespace prometheus {
namespace detail {
class MetricsHandler;
class Endpoint;
+class SerialMetricsHandler;
} // namespace detail
class PROMETHEUS_CPP_PULL_EXPORT Exposer {
@@ -34,4 +36,18 @@ class PROMETHEUS_CPP_PULL_EXPORT Exposer {
std::string uri_;
@@ -53,4 +57,18 @@ class PROMETHEUS_CPP_PULL_EXPORT Exposer {
std::mutex mutex_;
};
+class SerialExposer {
+public:
+ public:
+ explicit SerialExposer(const std::function<void()> update_callback = std::function<void()> {});
+ std::pair<std::map<std::string, std::string>, std::string>
+ operator()(const std::map<std::string, std::string>& req_headers);
+ void RegisterCollectable(const std::weak_ptr<Collectable>& collectable);
+ ~SerialExposer();
+
+private:
+ private:
+ std::vector<std::weak_ptr<Collectable>> collectables_;
+ std::shared_ptr<Registry> exposer_registry_;
+ std::unique_ptr<detail::SerialMetricsHandler> metrics_handler_;
@ -38,14 +43,19 @@ index c730360..3d070c5 100644
+
} // namespace prometheus
diff --git a/pull/src/exposer.cc b/pull/src/exposer.cc
index 966d04a..17f7ef3 100644
index 38a28e0..0d62bf3 100644
--- a/pull/src/exposer.cc
+++ b/pull/src/exposer.cc
@@ -30,4 +30,29 @@ void Exposer::RegisterCollectable(
const std::weak_ptr<Collectable>& collectable) {
collectables_.push_back(collectable);
@@ -1,4 +1,5 @@
#include "prometheus/exposer.h"
+#include "handler.h"
#include <algorithm>
#include <iterator>
@@ -63,4 +64,28 @@ detail::Endpoint& Exposer::GetEndpointForUri(const std::string& uri) {
return *endpoints_.back().get();
}
+
+SerialExposer::SerialExposer(
+ const std::function<void()> update_callback
+) :
@ -72,12 +82,12 @@ index 966d04a..17f7ef3 100644
+
} // namespace prometheus
diff --git a/pull/src/handler.cc b/pull/src/handler.cc
index ea94365..d04758f 100644
index 5a55001..b6ffa85 100644
--- a/pull/src/handler.cc
+++ b/pull/src/handler.cc
@@ -150,5 +150,124 @@ std::vector<MetricFamily> MetricsHandler::CollectMetrics() const {
return collected_metrics;
@@ -172,5 +172,124 @@ void MetricsHandler::CleanupStalePointers(
}),
std::end(collectables));
}
+
+//////////////////////////////////////////////////////
@ -201,26 +211,23 @@ index ea94365..d04758f 100644
} // namespace detail
} // namespace prometheus
diff --git a/pull/src/handler.h b/pull/src/handler.h
index 112267a..d603369 100644
index 10c90f9..8b62aab 100644
--- a/pull/src/handler.h
+++ b/pull/src/handler.h
@@ -2,8 +2,9 @@
@@ -3,6 +3,7 @@
#include <memory>
#include <mutex>
#include <vector>
-
+#include <functional>
#include "CivetServer.h"
+
#include "prometheus/counter.h"
#include "prometheus/registry.h"
#include "prometheus/summary.h"
@@ -27,6 +28,35 @@ class MetricsHandler : public CivetHandler {
#include "prometheus/collectable.h"
@@ -34,6 +35,36 @@ class MetricsHandler : public CivetHandler {
Counter& num_scrapes_;
Family<Summary>& request_latencies_family_;
Summary& request_latencies_;
+ std::function<void()> update_callback_ {};
+};
};
+
+//////////////////////////////////////////////////////
+/// Serial Metrics Handler ///
@ -248,6 +255,7 @@ index 112267a..d603369 100644
+ Family<Summary>& request_latencies_family_;
+ Summary& request_latencies_;
+ std::function<void()> update_callback_ {};
};
+};
+
} // namespace detail
} // namespace prometheus

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
deps/re2/re2 vendored

@ -1 +1 @@
re2-2020-07-06
re2-2022-12-01

Binary file not shown.

@ -1 +0,0 @@
2020-07-06.tar.gz

@ -1,6 +1,6 @@
--- sqlite3.c 2017-05-26 00:15:22.000000000 +0200
+++ /tmp/sqlite3.c 2017-05-29 20:12:54.644378605 +0200
@@ -19772,6 +19772,44 @@
--- sqlite-amalgamation-3400100/sqlite3.c 2022-12-28 14:26:39.000000000 +0000
+++ sqlite-amalgamation.patch/sqlite3.c 2023-01-10 16:48:54.793689411 +0000
@@ -24454,6 +24454,44 @@
}
/*
@ -31,7 +31,7 @@
+ return;
+ }
+ }
+ if( z==0 || parseModifier(context, (char*)"unixepoch", 9, &p) ) return;
+ if( z==0 || parseModifier(context, (char*)"unixepoch", 9, &p, 0) ) return;
+ computeJD(&p);
+ if( p.isError || !validJulianDay(p.iJD) ) return;
+ char zBuf[100];
@ -45,11 +45,11 @@
** time( TIMESTRING, MOD, MOD, ...)
**
** Return HH:MM:SS
@@ -20061,6 +20099,7 @@
DFUNCTION(date, -1, 0, 0, dateFunc ),
DFUNCTION(time, -1, 0, 0, timeFunc ),
DFUNCTION(datetime, -1, 0, 0, datetimeFunc ),
@@ -24742,6 +24780,7 @@
PURE_DATE(time, -1, 0, 0, timeFunc ),
PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
+ DFUNCTION(from_unixtime, -1, 0, 0, from_unixtimeFunc ),
DFUNCTION(strftime, -1, 0, 0, strftimeFunc ),
DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
DFUNCTION(current_date, 0, 0, 0, cdateFunc ),

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
sqlite-amalgamation-3190200
sqlite-amalgamation-3400100

@ -323,8 +323,9 @@ pthread_mutex_t test_mysql_firewall_whitelist_mutex = PTHREAD_MUTEX_INITIALIZER;
std::unordered_map<std::string, void *> map_test_mysql_firewall_whitelist_rules;
char rand_del[6];
static int http_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **ptr) {
return GloAdmin->AdminHTTPServer->handler(cls, connection, url, method, version, upload_data, upload_data_size, ptr);
//static int http_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **ptr) {
MHD_Result http_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, long unsigned int *upload_data_size, void **ptr) {
return (MHD_Result) GloAdmin->AdminHTTPServer->handler(cls, connection, url, method, version, upload_data, upload_data_size, ptr);
}
#define LINESIZE 2048

@ -45,10 +45,9 @@ PCRE_LDIR=$(PCRE_PATH)/.libs
SQLITE3_DIR=$(DEPS_PATH)/sqlite3/sqlite3
CLICKHOUSE_CPP_DIR=$(DEPS_PATH)/clickhouse-cpp/clickhouse-cpp
CITYHASH_DIR=$(DEPS_PATH)/cityhash/cityhash/src/.libs
LZ4_DIR=$(DEPS_PATH)/lz4/lz4
LZ4_DIR=$(DEPS_PATH)/lz4/lz4/lib
CLICKHOUSE_CPP_DIR=$(DEPS_PATH)/clickhouse-cpp/clickhouse-cpp

@ -105,25 +105,29 @@ OPT=-O2 $(WGCOV) -Wl,--no-as-needed
debug: OPT=-O0 -DDEBUG -ggdb -Wl,--no-as-needed $(WGCOV) $(WASAN)
debug: tests
tests: $(patsubst %.cpp,%,$(wildcard *-t.cpp)) setparser_test reg_test_3504-change_user_libmariadb_helper reg_test_3504-change_user_libmysql_helper \
set_testing-240.csv test_clickhouse_server_libmysql-t clickhouse_php_conn-t reg_test_stmt_resultset_err_no_rows_libmysql-t \
tests: tests-cpp tests-php tests-py \
setparser_test reg_test_3504-change_user_libmariadb_helper reg_test_3504-change_user_libmysql_helper \
set_testing-240.csv test_clickhouse_server_libmysql-t reg_test_stmt_resultset_err_no_rows_libmysql-t \
prepare_statement_err3024_libmysql-t prepare_statement_err3024_async-t reg_test_mariadb_stmt_store_result_libmysql-t \
reg_test_mariadb_stmt_store_result_async-t
tests-cpp: $(patsubst %.cpp,%,$(wildcard *-t.cpp))
tests-php: $(patsubst %,php-%,$(wildcard *-t.php))
tests-py: $(patsubst %,py-%,$(wildcard *-t.py))
testgalera: galera_1_timeout_count galera_2_timeout_no_count
testaurora: aurora
set_testing-240.csv: generate_set_session_csv
./generate_set_session_csv > set_testing-240.csv
clickhouse_php_conn-t: clickhouse_php_conn-t.php
cp clickhouse_php_conn-t.php clickhouse_php_conn-t
chmod +x clickhouse_php_conn-t
php-%:
cp $(patsubst php-%,%,$@) $(patsubst php-%.php,%,$@)
chmod +x $(patsubst php-%.php,%,$@)
reg_test_3992_fast_forward_malformed_packet-pymysql-t: reg_test_3992_fast_forward_malformed_packet-pymysql-t.py
cp reg_test_3992_fast_forward_malformed_packet-pymysql-t.py reg_test_3992_fast_forward_malformed_packet-pymysql-t
chmod +x reg_test_3992_fast_forward_malformed_packet-pymysql-t
py-%:
cp $(patsubst py-%,%,$@) $(patsubst py-%.py,%,$@)
chmod +x $(patsubst py-%.py,%,$@)
%-t:%-t.cpp $(TAP_LIBDIR)/libtap.a
%-t: %-t.cpp $(TAP_LIBDIR)/libtap.a
$(CXX) $^ $(INCLUDEDIRS) $(LDIRS) $(OPT) $(MYLIBS) -lpthread -ldl -std=c++11 -ltap $(STATIC_LIBS) -o $@
galera_1_timeout_count: galera_1_timeout_count.cpp $(TAP_LIBDIR)/libtap.a

@ -0,0 +1,63 @@
#!/usr/bin/env python3
import pymysql
import time
def open_mysql_conn(host, port=3306, user=None, passwd=None, timeout=60):
conn = None
try:
if user is None and passwd is None:
conn = pymysql.connect( host=host, port=port, read_default_group='client',
connect_timeout=timeout, cursorclass=pymysql.cursors.DictCursor,
defer_connect=True)
else:
conn = pymysql.connect( host=host, port=port, user=user, passwd=passwd,
connect_timeout=timeout, cursorclass=pymysql.cursors.DictCursor,
defer_connect=True)
conn.client_flag |= pymysql.constants.CLIENT.MULTI_STATEMENTS
conn.connect()
conn.autocommit(True)
except Exception as e:
print(e)
raise
return conn
def padmin_command(command, display=False):
with padmin_conn.cursor() as cursor:
cursor.execute(command)
result = cursor.fetchall()
if display:
print(result)
return result
def pmysql_command(command, display=False):
with pmysql_conn.cursor() as cursor:
cursor.execute(command)
result = cursor.fetchall()
if display:
print(result)
return result
admin_conn_args = { 'host':'127.0.0.1', 'port':6032, 'user':'admin', 'passwd':'admin' }
mysql_conn_args = { 'host':'127.0.0.1', 'port':6033, 'user':'root', 'passwd':'root' }
puser_conn_args = { 'host':'127.0.0.1', 'port':6033, 'user':'user', 'passwd':'user' }
if __name__ == '__main__':
padmin_conn = open_mysql_conn(**admin_conn_args)
# test edge cases
assert padmin_command('SELECT from_unixtime();', display=True) == [{'from_unixtime()': None}]
assert padmin_command('SELECT from_unixtime(0);', display=True) == [{'from_unixtime(0)': '1970-01-01 00:00:00'}]
assert padmin_command('SELECT from_unixtime(-1);', display=True) == [{'from_unixtime(-1)': '1969-12-31 23:59:59'}]
assert padmin_command('SELECT from_unixtime(2147483647);', display=True) == [{'from_unixtime(2147483647)': '2038-01-19 03:14:07'}]
assert padmin_command('SELECT from_unixtime(2147483648);', display=True) == [{'from_unixtime(2147483648)': '2038-01-19 03:14:08'}]
# test values from monitor.mysql_server_ping_log
results = padmin_command('SELECT time_start_us/1000000, from_unixtime(time_start_us/1000000) FROM monitor.mysql_server_ping_log;', display=True)
for res in results:
assert time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(int(res['time_start_us/1000000']))) == res['from_unixtime(time_start_us/1000000)']
# PASS
exit(0)
Loading…
Cancel
Save