From ab1141e3ddeef624c71a6909ed4570d4cb8f086b Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 11:38:30 +0300 Subject: [PATCH 01/16] Disable many tests --- .github/workflows/test.yml | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 92da7fb1f82..dc029a99b57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,28 +72,28 @@ jobs: "contrib/fuzzystrmatch:installcheck", "contrib/hstore:installcheck", "contrib/indexscan:installcheck", - "contrib/intagg:installcheck", - "contrib/intarray:installcheck", - "contrib/isn:installcheck", - "contrib/ltree:installcheck", - "contrib/passwordcheck:installcheck", - "contrib/pg_buffecache:installcheck", - "contrib/pg_trgm:installcheck", - "contrib/pgcrypto:installcheck", - "contrib/pgstattuple:installcheck", - "contrib/postgres_fdw:installcheck", - "contrib/sasdemo:installcheck", - "contrib/sepgsql:installcheck", - "contrib/sslinfo:installcheck", - "contrib/tablefunc:installcheck", - "contrib/test_decoding:installcheck", - "contrib/test_parser:installcheck", - "contrib/test_shm_mq:installcheck", - "contrib/try_convert:installcheck", - "contrib/tsearch2:installcheck", - "contrib/unaccent:installcheck", - "contrib/uuid-ossp:installcheck", - "contrib/xml2:installcheck"] + # "contrib/intarray:installcheck", + # "contrib/isn:installcheck", + # "contrib/ltree:installcheck", + # "contrib/passwordcheck:installcheck", + # "contrib/pg_buffecache:installcheck", + # "contrib/pg_trgm:installcheck", + # "contrib/pgcrypto:installcheck", + # "contrib/pgstattuple:installcheck", + # "contrib/postgres_fdw:installcheck", + # "contrib/sasdemo:installcheck", + # "contrib/sepgsql:installcheck", + # "contrib/sslinfo:installcheck", + # "contrib/tablefunc:installcheck", + # "contrib/test_decoding:installcheck", + # "contrib/test_parser:installcheck", + # "contrib/test_shm_mq:installcheck", + # "contrib/try_convert:installcheck", + # "contrib/tsearch2:installcheck", + # "contrib/unaccent:installcheck", + # "contrib/uuid-ossp:installcheck", + # "contrib/xml2:installcheck" + ] }, {"test":"ic-gpcontrib", "make_configs":["gpcontrib/gp_array_agg:installcheck", @@ -110,9 +110,10 @@ jobs: "gpcontrib/gpmapreduce:installcheck", "gpcontrib/orafce:installcheck", "gpcontrib/pgaudit:installcheck", - "gpcontrib/quicklz:installcheck", - "gpcontrib/sr_plan:installcheck", - "gpcontrib/zstd:installcheck"] + # "gpcontrib/quicklz:installcheck", + # "gpcontrib/sr_plan:installcheck", + # "gpcontrib/zstd:installcheck" + ] }, {"test":"ic-parallel-retrieve-cursor", "make_configs":["src/test/isolation2:installcheck-parallel-retrieve-cursor"] From 7e2014f7a965d000fe10649abe001e8e6bda1710 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 11:39:55 +0300 Subject: [PATCH 02/16] Fix --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc029a99b57..977565e0e44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,7 +71,7 @@ jobs: "contrib/formatter_fixedwidth:installcheck", "contrib/fuzzystrmatch:installcheck", "contrib/hstore:installcheck", - "contrib/indexscan:installcheck", + "contrib/indexscan:installcheck" # "contrib/intarray:installcheck", # "contrib/isn:installcheck", # "contrib/ltree:installcheck", @@ -109,7 +109,7 @@ jobs: "gpcontrib/gpcloud:installcheck", "gpcontrib/gpmapreduce:installcheck", "gpcontrib/orafce:installcheck", - "gpcontrib/pgaudit:installcheck", + "gpcontrib/pgaudit:installcheck" # "gpcontrib/quicklz:installcheck", # "gpcontrib/sr_plan:installcheck", # "gpcontrib/zstd:installcheck" From 60d84373a857bfe76540c21c0948cdd2f0da27bb Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 11:41:17 +0300 Subject: [PATCH 03/16] Fix 2 --- .github/workflows/test.yml | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 977565e0e44..f1d863a874f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,29 +71,7 @@ jobs: "contrib/formatter_fixedwidth:installcheck", "contrib/fuzzystrmatch:installcheck", "contrib/hstore:installcheck", - "contrib/indexscan:installcheck" - # "contrib/intarray:installcheck", - # "contrib/isn:installcheck", - # "contrib/ltree:installcheck", - # "contrib/passwordcheck:installcheck", - # "contrib/pg_buffecache:installcheck", - # "contrib/pg_trgm:installcheck", - # "contrib/pgcrypto:installcheck", - # "contrib/pgstattuple:installcheck", - # "contrib/postgres_fdw:installcheck", - # "contrib/sasdemo:installcheck", - # "contrib/sepgsql:installcheck", - # "contrib/sslinfo:installcheck", - # "contrib/tablefunc:installcheck", - # "contrib/test_decoding:installcheck", - # "contrib/test_parser:installcheck", - # "contrib/test_shm_mq:installcheck", - # "contrib/try_convert:installcheck", - # "contrib/tsearch2:installcheck", - # "contrib/unaccent:installcheck", - # "contrib/uuid-ossp:installcheck", - # "contrib/xml2:installcheck" - ] + "contrib/indexscan:installcheck"] }, {"test":"ic-gpcontrib", "make_configs":["gpcontrib/gp_array_agg:installcheck", @@ -109,11 +87,7 @@ jobs: "gpcontrib/gpcloud:installcheck", "gpcontrib/gpmapreduce:installcheck", "gpcontrib/orafce:installcheck", - "gpcontrib/pgaudit:installcheck" - # "gpcontrib/quicklz:installcheck", - # "gpcontrib/sr_plan:installcheck", - # "gpcontrib/zstd:installcheck" - ] + "gpcontrib/pgaudit:installcheck"] }, {"test":"ic-parallel-retrieve-cursor", "make_configs":["src/test/isolation2:installcheck-parallel-retrieve-cursor"] From c31198c522eb05c8cce0312dbd8215bddb20b653 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 12:13:38 +0300 Subject: [PATCH 04/16] Add memory print --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f1d863a874f..6f06991ee1d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -318,6 +318,8 @@ jobs: config_log="build-logs/details/make-${{ matrix.test }}-config$i.log" + df . -h + if ! docker run \ -e TEST_DIR="${dir}" \ -e TEST_TARGET="${target}" \ From aa1f32dbe62091bef55d0c8c825cf8fcc3d48539 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 15:19:03 +0300 Subject: [PATCH 05/16] Add pgaudit to configure --- configure | 711 ++++++++++++++++++++++++++++++++++++++++- src/Makefile.global.in | 1 + 2 files changed, 710 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d676b718692..812ccfd6bb2 100755 --- a/configure +++ b/configure @@ -747,6 +747,7 @@ with_tcl enable_thread_safety INCLUDES enable_ic_proxy +enable_pgaudit enable_sr_plan enable_yezzey HAVE_CXX11 @@ -872,6 +873,7 @@ enable_mapreduce enable_gpcloud enable_yezzey enable_sr_plan +enable_pgaudit enable_ic_proxy enable_thread_safety with_tcl @@ -1559,6 +1561,7 @@ Optional Features: --disable-gpcloud disable gpcloud support --disable-yezzey disable yezzey support --disable-sr_plan disable sr_plan support + --disable-pgaudit disable pgaudit support --enable-ic-proxy enable interconnect proxy mode (requires libuv library) --disable-thread-safety disable thread-safety in client libraries @@ -7856,8 +7859,8 @@ $as_echo "#define USE_SR_PLAN 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with yezzey... $enable_sr_plan" >&5 -$as_echo "checking whether to build with yezzey... $enable_sr_plan" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with sr_plan... $enable_sr_plan" >&5 +$as_echo "checking whether to build with sr_plan... $enable_sr_plan" >&6; } if test "$enable_sr_plan" = yes; then : @@ -8528,6 +8531,710 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h +fi # fi + +# +# pgaudit, enabled by default +# + + +# Check whether --enable-pgaudit was given. +if test "${enable_pgaudit+set}" = set; then : + enableval=$enable_pgaudit; + case $enableval in + yes) + +$as_echo "#define USE_PGAUDIT 1" >>confdefs.h + + ;; + no) + : + ;; + *) + as_fn_error $? "no argument expected for --enable-pgaudit option" "$LINENO" 5 + ;; + esac + +else + enable_pgaudit=yes + +$as_echo "#define USE_PGAUDIT 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with pgaudit... $enable_pgaudit" >&5 +$as_echo "checking whether to build with pgaudit... $enable_pgaudit" >&6; } + + +if test "$enable_pgaudit" = yes; then : + # then + ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + ac_success=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 +$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } +if ${ax_cv_cxx_compile_cxx11+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_cxx_compile_cxx11=yes +else + ax_cv_cxx_compile_cxx11=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 +$as_echo "$ax_cv_cxx_compile_cxx11" >&6; } + if test x$ax_cv_cxx_compile_cxx11 = xyes; then + ac_success=yes + fi + + + + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 +$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } +if eval \${$cachevar+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval $cachevar=yes +else + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXX="$ac_save_CXX" +fi +eval ac_res=\$$cachevar + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + if test x$ac_success = xyes; then + break + fi + done + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 + fi + fi + if test x$ac_success = xno; then + HAVE_CXX11=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 +$as_echo "$as_me: No compiler with C++11 support was found" >&6;} + else + HAVE_CXX11=1 + +$as_echo "#define HAVE_CXX11 1" >>confdefs.h + + fi + + + + fi # fi # diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 8f4c3ddaad7..98b05ca17b5 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -220,6 +220,7 @@ enable_mapreduce = @enable_mapreduce@ enable_gpcloud = @enable_gpcloud@ enable_yezzey = @enable_yezzey@ enable_sr_plan = @enable_sr_plan@ +enable_pgaudit = @enable_pgaudit@ enable_gpperfmon = @enable_gpperfmon@ enable_ic_proxy = @enable_ic_proxy@ From 80884d9b89527a708f8c9192fb96b32d1f170629 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 15:20:34 +0300 Subject: [PATCH 06/16] Add pgaudit in configure.in --- configure.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index c825829067c..a83b06de9db 100644 --- a/configure.in +++ b/configure.in @@ -872,8 +872,8 @@ AS_IF([test "$enable_yezzey" = yes], # PGAC_ARG_BOOL(enable, sr_plan, yes, [disable sr_plan support], [AC_DEFINE([USE_SR_PLAN], 1, - [Define to 1 to build with yezzey (--enable-sr-plan)])]) -AC_MSG_RESULT([checking whether to build with yezzey... $enable_sr_plan]) + [Define to 1 to build with sr_plan (--enable-sr-plan)])]) +AC_MSG_RESULT([checking whether to build with sr_plan... $enable_sr_plan]) AC_SUBST(enable_sr_plan) AS_IF([test "$enable_sr_plan" = yes], @@ -881,6 +881,20 @@ AS_IF([test "$enable_sr_plan" = yes], AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) ]) # fi +# +# pgaudit, enabled by default +# +PGAC_ARG_BOOL(enable, pgaudit, yes, [disable pgaudit support], + [AC_DEFINE([USE_PGAUDIT], 1, + [Define to 1 to build with pgaudit (--enable-pgaudit)])]) +AC_MSG_RESULT([checking whether to build with pgaudit... $enable_sr_plan]) +AC_SUBST(enable_pgaudit) + +AS_IF([test "$enable_pgaudit" = yes], +[ # then + AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) +]) # fi + # # ic-proxy # From f5602d14051eda4c3e4da223d04aab4944b0ad91 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 16:43:07 +0300 Subject: [PATCH 07/16] Fix Makefile --- gpcontrib/pgaudit/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpcontrib/pgaudit/Makefile b/gpcontrib/pgaudit/Makefile index 0bfc790d19d..396f39be6d6 100644 --- a/gpcontrib/pgaudit/Makefile +++ b/gpcontrib/pgaudit/Makefile @@ -18,5 +18,5 @@ else subdir = gpcontrib/pgaudit top_builddir = ../.. include $(top_builddir)/src/Makefile.global -include $(top_srcdir)/gpcontrib/contrib-global.mk +include $(top_srcdir)/contrib/contrib-global.mk endif From 0cb695ece2f8e31eb2bbf277b23eac92f3e3b232 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 20 Feb 2025 16:58:55 +0300 Subject: [PATCH 08/16] Add pgaudit in shared_libraies --- .github/workflows/test.yml | 5 +++-- docker/test/run_tests.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f06991ee1d..6323d98af2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Matrix testing +name: Regression testing on: push: @@ -332,7 +332,8 @@ jobs: echo "::warning::Test execution failed for configuration $((i+1)): make -C $dir $target" overall_status=1 fi - + + df . -h RESULTS_PATH="build-results/results-${{ matrix.test }}-${dir}" mkdir -p $RESULTS_PATH diff --git a/docker/test/run_tests.sh b/docker/test/run_tests.sh index ba058af38c1..b1b322b2089 100755 --- a/docker/test/run_tests.sh +++ b/docker/test/run_tests.sh @@ -69,7 +69,7 @@ make destroy-demo-cluster && make create-demo-cluster export USER=gpadmin source gpAux/gpdemo/gpdemo-env.sh -gpconfig -c shared_preload_libraries -v yezzey +gpconfig -c shared_preload_libraries -v yezzey pgaudit # ADD CGROUPS if [ "${TEST_CGROUP}" = "true" ]; then From 9d05c5851ac6eaf951db56934dc45d69c69d7619 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Fri, 21 Feb 2025 10:02:56 +0300 Subject: [PATCH 09/16] Add accept local connections --- docker/test/run_tests.sh | 10 ++++++++++ gpcontrib/pgaudit/expected/pgaudit.out | 2 ++ 2 files changed, 12 insertions(+) diff --git a/docker/test/run_tests.sh b/docker/test/run_tests.sh index b1b322b2089..19103d5fa30 100755 --- a/docker/test/run_tests.sh +++ b/docker/test/run_tests.sh @@ -76,6 +76,16 @@ if [ "${TEST_CGROUP}" = "true" ]; then gpconfig -c gp_resource_manager -v "group" fi +# Accept local connections for tests +cat >>gpAux/gpdemo/datadirs/qddir/demoDataDir-1/pg_hba.conf < Date: Fri, 21 Feb 2025 11:23:14 +0300 Subject: [PATCH 10/16] Add pgaudit in Makefile targets --- gpcontrib/Makefile | 14 ++++++++++---- gpcontrib/pgaudit/sql/pgaudit.sql | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gpcontrib/Makefile b/gpcontrib/Makefile index f28b2f5623b..88116fa4b8b 100644 --- a/gpcontrib/Makefile +++ b/gpcontrib/Makefile @@ -76,15 +76,13 @@ orafce: fi sr_plan: - @if [ "$(enable_sr_plan)" == "yes" ]; then \ + @if [ "$(enable_sr_plan)" = "yes" ]; then \ $(MAKE) -C sr_plan USE_PGXS=1 && \ - $(MAKE) -C sr_plan USE_PGXS=1 install; \ fi pgaudit: - @if [ "$(enable_pgaudit)" == "yes" ]; then \ + @if [ "$(enable_pgaudit)" = "yes" ]; then \ $(MAKE) -C pgaudit USE_PGXS=1 && \ - $(MAKE) -C pgaudit USE_PGXS=1 install; \ fi @@ -96,6 +94,12 @@ install: @if [ "$(enable_yezzey)" = "yes" ]; then \ $(MAKE) -C yezzey install; \ fi + @if [ "$(enable_pgaudit)" = "yes" ]; then \ + $(MAKE) -C pgaudit USE_PGXS=1 install; \ + fi + @if [ "$(enable_sr_plan)" = "yes" ]; then \ + $(MAKE) -C sr_plan USE_PGXS=1 install; \ + fi @if [ "$(enable_mapreduce)" = "yes" ]; then \ $(MAKE) -C gpmapreduce install; \ fi @@ -117,6 +121,8 @@ distclean: if [ "$(enable_gpcloud)" = "yes" ]; then $(MAKE) -C gpcloud distclean; fi if [ "$(enable_yezzey)" = "yes" ]; then $(MAKE) -C yezzey distclean; fi if [ "${enable_orafce}" = "yes" ]; then $(MAKE) -C orafce NO_PGXS=true distclean; fi + if [ "${enable_sr_plan}" = "yes" ]; then $(MAKE) -C sr_plan distclean; fi + if [ "${enable_pgaudit}" = "yes" ]; then $(MAKE) -C pgaudit distclean; fi installcheck: $(MAKE) -C gp_internal_tools installcheck diff --git a/gpcontrib/pgaudit/sql/pgaudit.sql b/gpcontrib/pgaudit/sql/pgaudit.sql index a1c89a38e79..233cb38c37e 100644 --- a/gpcontrib/pgaudit/sql/pgaudit.sql +++ b/gpcontrib/pgaudit/sql/pgaudit.sql @@ -816,6 +816,7 @@ DROP TABLE wombat; SET pgaudit.log = 'NONE'; DROP EXTENSION pgaudit; +DROP EXTENSION gp_aux_catalog; DROP OPERATOR <> (text, text); DROP FUNCTION my_ne(text, text); From fd016c3933aff4d9cd43843b80c3dd7d026e5b87 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Fri, 21 Feb 2025 11:42:32 +0300 Subject: [PATCH 11/16] Fix Makefile --- gpcontrib/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gpcontrib/Makefile b/gpcontrib/Makefile index 88116fa4b8b..f6bde8c5954 100644 --- a/gpcontrib/Makefile +++ b/gpcontrib/Makefile @@ -77,12 +77,12 @@ orafce: sr_plan: @if [ "$(enable_sr_plan)" = "yes" ]; then \ - $(MAKE) -C sr_plan USE_PGXS=1 && \ + $(MAKE) -C sr_plan && \ fi pgaudit: @if [ "$(enable_pgaudit)" = "yes" ]; then \ - $(MAKE) -C pgaudit USE_PGXS=1 && \ + $(MAKE) -C pgaudit && \ fi @@ -95,10 +95,10 @@ install: $(MAKE) -C yezzey install; \ fi @if [ "$(enable_pgaudit)" = "yes" ]; then \ - $(MAKE) -C pgaudit USE_PGXS=1 install; \ + $(MAKE) -C pgaudit install; \ fi @if [ "$(enable_sr_plan)" = "yes" ]; then \ - $(MAKE) -C sr_plan USE_PGXS=1 install; \ + $(MAKE) -C sr_plan install; \ fi @if [ "$(enable_mapreduce)" = "yes" ]; then \ $(MAKE) -C gpmapreduce install; \ From d9d03b363573c9f2a4b25fd5f24981248531c761 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Fri, 21 Feb 2025 12:18:09 +0300 Subject: [PATCH 12/16] Fix shared_preload_libraries --- .github/workflows/test.yml | 9 ++++++--- docker/test/run_tests.sh | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6323d98af2f..84fa64c8550 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -363,10 +363,13 @@ jobs: if: always() run: | # Search for regression.diffs recursively - found_file=$(find . -type f -name "regression.diffs" | head -n 1) + found_files=$(find . -type f -name "regression.diffs") if [[ -n "$found_file" ]]; then - echo "Found regression.diffs at: $found_file" - cat "$found_file" + for found_file in found_files + do + echo "Found regression.diffs at: $found_file" + cat "$found_file" + done else echo "No regression.diffs file found in the hierarchy." fi diff --git a/docker/test/run_tests.sh b/docker/test/run_tests.sh index 19103d5fa30..ce3c980c0b9 100755 --- a/docker/test/run_tests.sh +++ b/docker/test/run_tests.sh @@ -69,7 +69,7 @@ make destroy-demo-cluster && make create-demo-cluster export USER=gpadmin source gpAux/gpdemo/gpdemo-env.sh -gpconfig -c shared_preload_libraries -v yezzey pgaudit +gpconfig -c shared_preload_libraries -v pgaudit # ADD CGROUPS if [ "${TEST_CGROUP}" = "true" ]; then From ec0fbe4761f1afb868c0c8caf5047ff434fd5498 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Fri, 21 Feb 2025 14:06:55 +0300 Subject: [PATCH 13/16] Add print all diffs --- .github/workflows/test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 84fa64c8550..a12cb50bce3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -363,11 +363,13 @@ jobs: if: always() run: | # Search for regression.diffs recursively - found_files=$(find . -type f -name "regression.diffs") - if [[ -n "$found_file" ]]; then - for found_file in found_files + found_files=$(find . -type f -path "*/regression.diffs") + if [[ "x$found_files" != "x" ]]; then + for found_file in $found_files do + echo "-----------------------------------------------------" echo "Found regression.diffs at: $found_file" + echo "-----------------------------------------------------" cat "$found_file" done else From 7ce3665ee80c5c3a4a55e4fe1c435d9a8622f265 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Fri, 21 Feb 2025 17:23:27 +0300 Subject: [PATCH 14/16] Disable pgaudit hooks for non-master segments --- gpcontrib/pgaudit/expected/pgaudit.out | 1 + gpcontrib/pgaudit/pgaudit.c | 30 +++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gpcontrib/pgaudit/expected/pgaudit.out b/gpcontrib/pgaudit/expected/pgaudit.out index cde1498d960..279356286ad 100644 --- a/gpcontrib/pgaudit/expected/pgaudit.out +++ b/gpcontrib/pgaudit/expected/pgaudit.out @@ -1177,6 +1177,7 @@ DROP TABLE wombat; NOTICE: AUDIT: SESSION,70,1,DDL,DROP TABLE,TABLE,public.wombat,DROP TABLE wombat;, SET pgaudit.log = 'NONE'; DROP EXTENSION pgaudit; +DROP EXTENSION gp_aux_catalog; DROP OPERATOR <> (text, text); ERROR: cannot drop operator <>(text,text) because it is required by the database system DROP FUNCTION my_ne(text, text); diff --git a/gpcontrib/pgaudit/pgaudit.c b/gpcontrib/pgaudit/pgaudit.c index fc9be3c872c..6ea39ae90a5 100644 --- a/gpcontrib/pgaudit/pgaudit.c +++ b/gpcontrib/pgaudit/pgaudit.c @@ -37,6 +37,9 @@ #include "utils/syscache.h" #include "utils/timestamp.h" +// For GpIdentity +#include "cdb/cdbvars.h" + PG_MODULE_MAGIC; void _PG_init(void); @@ -1977,21 +1980,24 @@ _PG_init(void) GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); - /* - * Install our hook functions after saving the existing pointers to - * preserve the chains. - */ - next_ExecutorStart_hook = ExecutorStart_hook; - ExecutorStart_hook = pgaudit_ExecutorStart_hook; - next_ExecutorCheckPerms_hook = ExecutorCheckPerms_hook; - ExecutorCheckPerms_hook = pgaudit_ExecutorCheckPerms_hook; + if (GpIdentity.segindex == -1) { + /* + * Install our hook functions after saving the existing pointers to + * preserve the chains. + */ + next_ExecutorStart_hook = ExecutorStart_hook; + ExecutorStart_hook = pgaudit_ExecutorStart_hook; + + next_ExecutorCheckPerms_hook = ExecutorCheckPerms_hook; + ExecutorCheckPerms_hook = pgaudit_ExecutorCheckPerms_hook; - next_ProcessUtility_hook = ProcessUtility_hook; - ProcessUtility_hook = pgaudit_ProcessUtility_hook; + next_ProcessUtility_hook = ProcessUtility_hook; + ProcessUtility_hook = pgaudit_ProcessUtility_hook; - next_object_access_hook = object_access_hook; - object_access_hook = pgaudit_object_access_hook; + next_object_access_hook = object_access_hook; + object_access_hook = pgaudit_object_access_hook; + } /* Log that the extension has completed initialization */ #ifndef EXEC_BACKEND From bd4e311651d2c0ec90804741899313d930db4182 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Mon, 24 Feb 2025 11:06:16 +0300 Subject: [PATCH 15/16] Add use init_file to pgaudit test --- gpcontrib/pgaudit/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpcontrib/pgaudit/Makefile b/gpcontrib/pgaudit/Makefile index 396f39be6d6..2d2b5baa30e 100644 --- a/gpcontrib/pgaudit/Makefile +++ b/gpcontrib/pgaudit/Makefile @@ -8,7 +8,7 @@ DATA = pgaudit--1.0.9.sql pgaudit--1.0--1.0.6.sql pgaudit--1.0.6--1.0.7.sql pgau PGFILEDESC = "pgAudit - An audit logging extension for PostgreSQL" REGRESS = pgaudit -REGRESS_OPTS = --temp-config=$(top_srcdir)/contrib/pgaudit/pgaudit.conf +REGRESS_OPTS = --init-file=$(top_srcdir)/src/test/regress/init_file ifdef USE_PGXS PG_CONFIG = pg_config From b61004aa4ddbbf9d770d61dfbcd734b13da9be81 Mon Sep 17 00:00:00 2001 From: Vladimir Rachkin Date: Thu, 27 Feb 2025 12:06:49 +0300 Subject: [PATCH 16/16] Fix .out --- gpcontrib/pgaudit/expected/pgaudit.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpcontrib/pgaudit/expected/pgaudit.out b/gpcontrib/pgaudit/expected/pgaudit.out index 279356286ad..95efbb84e16 100644 --- a/gpcontrib/pgaudit/expected/pgaudit.out +++ b/gpcontrib/pgaudit/expected/pgaudit.out @@ -884,7 +884,7 @@ BEGIN id INT ); END $$;", -ERROR: schema "bogus" does not exist at character 14 +ERROR: schema "bogus" does not exist -- -- Test alter table statements ALTER TABLE public.test