diff --git a/6.17.0-src-full.tar.gz b/6.17.0-src-full.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..d0d1fe2a53a3464931e0201c4b80eb95051adf77 Binary files /dev/null and b/6.17.0-src-full.tar.gz differ diff --git a/README.en.md b/README.en.md deleted file mode 100644 index a8d43e9ed6f9a61f1137542da8fda2434fc42dd5..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# gpdb - -#### Description -Open Source Greenplum Database - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 305c5293ec56e278e8f711eabc140b110508a2f8..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# gpdb - -#### 介绍 -Open Source Greenplum Database - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/gpdb.spec b/gpdb.spec new file mode 100644 index 0000000000000000000000000000000000000000..8edf0bd55692752d654db0658de8b1f54f8e6612 --- /dev/null +++ b/gpdb.spec @@ -0,0 +1,100 @@ +NAME: gpdb +Version: 6.17.0 +Release: 4 +Summary: Open Source Greenplum Database + +License: Apache 2.0 +URL: https://github.com/greenplum-db/gpdb +Source0: http://github.com/greenplum-db/gpdb/releases/download/%{version}/%{version}-src-full.tar.gz +Patch0: orca1.patch +Patch1: orca2.patch +Patch2: unittest-fix.patch +Patch3: gpfdist1.patch +Patch4: gpfdist2.patch +Patch5: icw.patch + +BuildRequires: python2-devel python2-pip +BuildRequires: apr-devel bison bzip2-devel cmake3 flex gcc gcc-c++ krb5-devel libcurl-devel libevent-devel libkadm5 libyaml-devel libxml2-devel libzstd-devel openssl-devel perl-ExtUtils-Embed readline-devel xerces-c-devel zlib-devel + +Requires: apr apr-util bash bzip2 curl iproute krb5-devel less libcurl libxml2 libyaml net-tools openldap openssh openssh-clients openssh-server openssl perl readline rsync sed tar which zip zlib +Requires: hostname net-tools iputils + +%global _privatelibs lib(pq|pgtypes|ecpg_compat|ecpg)\\.so* +%global __provides_exclude %{_privatelibs} + +%description +Greenplum Database - Massively Parallel PostgreSQL for Analytics. An open-source massively parallel data platform for analytics, machine learning and AI. + +%prep +%setup -q -n gpdb_src +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +# gpdb has extra components that depends on headers and libs to be installed first, so set prefix to a writable path and move it back later. +./configure --enable-orca --with-gssapi --disable-rpath --prefix=$PWD/greenplum-db-%{version} --with-libxml --with-openssl --enable-cassert --enable-debug --enable-debug-extensions --disable-mapreduce --enable-orafce --without-perl --with-python +%build +make %{?_smp_mflags} install + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p %{buildroot}/usr/local +cp -rf %{_builddir}/gpdb_src/greenplum-db-%{version} %{buildroot}/usr/local/ + +%check +# Unit test +source greenplum-db-%{version}/greenplum_path.sh +%ifarch x86_64 +make -s unittest-check +%endif +# There is a known issue on ARM tests, which is related with mockery framework. +# Upstream issue: https://github.com/google/cmockery/issues/67 +# For the following test, only the 1 test is failure. +# So we force to run the test on aarch64 platform. +%ifarch aarch64 +make -s unitest-check || true +%endif + +%if 0%{getenv:FULL_REGRESS} +# warmup env +sleep 5 + +# regression test +TEST_USER=$USER + +# setup password-less login +echo "y" | ssh-keygen -f ~/.ssh/id_rsa -P "" +touch ~/.ssh/authorized_keys +chmod 600 ~/.ssh/authorized_keys +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys +export USER=$TEST_USER +export PGUSER=$TEST_USER + +# setup gpdb cluster +ulimit -n 65535 +make -C gpAux/gpdemo cluster + +# warmup env +sleep 5 + +source gpAux/gpdemo/gpdemo-env.sh + +make installcheck-world +%endif + +%files +%dir /usr/local/greenplum-db-%{version} +/usr/local/greenplum-db-%{version} + +%changelog +* Thu Aug 26 2021 bzhaoop - 6.17.0-4 +- Fix multiple provides for forbiding the private libs in public area. + +* Thu Aug 12 2021 peifengq - 6.17.0-3 +- Run full regress conditionally + +* Wed Aug 11 2021 peifengq - 6.17.0-2 +- add test report for 6.17.0, fix tests + diff --git a/gpfdist1.patch b/gpfdist1.patch new file mode 100644 index 0000000000000000000000000000000000000000..42c6493f173772fac102bdf5ff04a00f03e33d6d --- /dev/null +++ b/gpfdist1.patch @@ -0,0 +1,128 @@ +commit 406665a6cf49d25d0506439ab27a23e557a80be5 +Author: zhaorui +Date: Thu Jul 8 09:52:37 2021 +0800 + + Disable unsafe tls(tls1.0 and tls1.1) protocol for gpfdist. + +diff --git a/src/bin/gpfdist/gpfdist.c b/src/bin/gpfdist/gpfdist.c +index 2d066f5b94..dd4179960d 100644 +--- a/src/bin/gpfdist/gpfdist.c ++++ b/src/bin/gpfdist/gpfdist.c +@@ -4028,7 +4028,9 @@ static SSL_CTX *initialize_ctx(void) + } + + /* Create our context*/ +- ctx = SSL_CTX_new( TLSv1_server_method() ); ++ ctx = SSL_CTX_new( SSLv23_method() ); ++ /* Disable old protocol versions */ ++ SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 ); + + /* Generate random seed */ + if ( RAND_poll() == 0 ) +diff --git a/src/bin/gpfdist/regress/input/gpfdist_ssl.source b/src/bin/gpfdist/regress/input/gpfdist_ssl.source +index 8dae7b6888..daa55fe3e2 100644 +--- a/src/bin/gpfdist/regress/input/gpfdist_ssl.source ++++ b/src/bin/gpfdist/regress/input/gpfdist_ssl.source +@@ -76,6 +76,41 @@ LOCATION ('gpfdists://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl') + FORMAT 'TEXT' (DELIMITER '|' ); + INSERT INTO tbl SELECT * FROM tbl_on_heap; + SELECT * FROM tbl_on_heap ORDER BY s1; ++-- test disable tls1.0 and tls1.1 ++CREATE EXTERNAL WEB TABLE curl_with_tls10 (x text) ++execute E'curl -H "X-GP-PROTO: 1" https://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl -vk --cert @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.crt --key @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.key --tlsv1.0 >/dev/null 2>&1;ret=$?; ++if [ $ret -eq 35 ];then ++ echo "success"; ++else ++ echo $ret; ++fi' ++on SEGMENT 0 ++FORMAT 'text'; ++CREATE EXTERNAL WEB TABLE curl_with_tls11 (x text) ++execute E'curl -H "X-GP-PROTO: 1" https://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl -vk --cert @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.crt --key @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.key --tlsv1.1 >/dev/null 2>&1;ret=$?; ++if [ $ret -eq 35 ];then ++ echo "success"; ++else ++ echo $ret; ++fi' ++on SEGMENT 0 ++FORMAT 'text'; ++CREATE EXTERNAL WEB TABLE curl_with_tls12 (x text) ++execute E'curl -H "X-GP-PROTO: 1" https://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl -vk --cert @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.crt --key @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.key --tlsv1.2 >/dev/null 2>&1;ret=$?; ++if [ $ret -ne 35 ];then ++ echo "success"; ++else ++ echo $ret; ++fi' ++on SEGMENT 0 ++FORMAT 'text'; ++select * from curl_with_tls10; ++select * from curl_with_tls11; ++select * from curl_with_tls12; ++drop external table if exists curl_with_tls10; ++drop external table if exists curl_with_tls11; ++drop external table if exists curl_with_tls12; ++-- end test disable tls1.0 and tls1.1 + + -- gpfdist_ssl case 2 + DROP TABLE IF EXISTS tbl_on_heap2; +diff --git a/src/bin/gpfdist/regress/output/gpfdist_ssl.source b/src/bin/gpfdist/regress/output/gpfdist_ssl.source +index 286c51644f..4ba57cf26a 100644 +--- a/src/bin/gpfdist/regress/output/gpfdist_ssl.source ++++ b/src/bin/gpfdist/regress/output/gpfdist_ssl.source +@@ -70,6 +70,56 @@ SELECT * FROM tbl_on_heap ORDER BY s1; + ccc | twoc | shpits | Wed Jun 01 12:30:30 2011 | 23 | 732 | 834567 | 45.67 | 789.123 | 7.12345 | 123.456789 + (3 rows) + ++-- test disable tls1.0 and tls1.1 ++CREATE EXTERNAL WEB TABLE curl_with_tls10 (x text) ++execute E'curl -H "X-GP-PROTO: 1" https://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl -vk --cert @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.crt --key @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.key --tlsv1.0 >/dev/null 2>&1;ret=$?; ++if [ $ret -eq 35 ];then ++ echo "success"; ++else ++ echo $ret; ++fi' ++on SEGMENT 0 ++FORMAT 'text'; ++CREATE EXTERNAL WEB TABLE curl_with_tls11 (x text) ++execute E'curl -H "X-GP-PROTO: 1" https://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl -vk --cert @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.crt --key @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.key --tlsv1.1 >/dev/null 2>&1;ret=$?; ++if [ $ret -eq 35 ];then ++ echo "success"; ++else ++ echo $ret; ++fi' ++on SEGMENT 0 ++FORMAT 'text'; ++CREATE EXTERNAL WEB TABLE curl_with_tls12 (x text) ++execute E'curl -H "X-GP-PROTO: 1" https://127.0.0.1:7070/gpfdist_ssl/tbl2.tbl -vk --cert @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.crt --key @abs_srcdir@/data/gpfdist_ssl/certs_matching/client.key --tlsv1.2 >/dev/null 2>&1;ret=$?; ++if [ $ret -ne 35 ];then ++ echo "success"; ++else ++ echo $ret; ++fi' ++on SEGMENT 0 ++FORMAT 'text'; ++select * from curl_with_tls10; ++ x ++--------- ++ success ++(1 row) ++ ++select * from curl_with_tls11; ++ x ++--------- ++ success ++(1 row) ++ ++select * from curl_with_tls12; ++ x ++--------- ++ success ++(1 row) ++ ++drop external table if exists curl_with_tls10; ++drop external table if exists curl_with_tls11; ++drop external table if exists curl_with_tls12; ++-- end test disable tls1.0 and tls1.1 + -- gpfdist_ssl case 2 + DROP TABLE IF EXISTS tbl_on_heap2; + NOTICE: table "tbl_on_heap2" does not exist, skipping diff --git a/gpfdist2.patch b/gpfdist2.patch new file mode 100644 index 0000000000000000000000000000000000000000..a20cd06f23c70f7bfd4baf836c00ba75fedd0497 --- /dev/null +++ b/gpfdist2.patch @@ -0,0 +1,17 @@ +diff --git a/src/bin/gpfdist/regress/Makefile b/src/bin/gpfdist/regress/Makefile +index aefb1fb56c..394fcd1ff5 100644 +--- a/src/bin/gpfdist/regress/Makefile ++++ b/src/bin/gpfdist/regress/Makefile +@@ -5,12 +5,6 @@ default: installcheck + + REGRESS = exttab1 custom_format gpfdist2 gpfdist_path + +-ifeq ($(enable_gpfdist),yes) +-ifeq ($(with_openssl),yes) +- REGRESS += gpfdist_ssl gpfdists_multiCA +-endif +-endif +- + PSQLDIR = $(prefix)/bin + REGRESS_OPTS = --init-file=init_file + diff --git a/icw.patch b/icw.patch new file mode 100644 index 0000000000000000000000000000000000000000..c69e418d21528ee15f1cd03eb457df5ce2e5ba64 --- /dev/null +++ b/icw.patch @@ -0,0 +1,53 @@ +diff --git a/gpcontrib/zstd/expected/compression_zstd.out b/gpcontrib/zstd/expected/compression_zstd.out +index 1b3e48b35f..95f4aac241 100644 +--- a/gpcontrib/zstd/expected/compression_zstd.out ++++ b/gpcontrib/zstd/expected/compression_zstd.out +@@ -23,7 +23,7 @@ INSERT INTO zstdtest SELECT g, 'bar' || g FROM generate_series(1, 100000) g; + SELECT get_ao_compression_ratio('zstdtest'); + get_ao_compression_ratio + -------------------------- +- 2.62 ++ 2.66 + (1 row) + + -- Check contents, at the beginning of the table and at the end. +diff --git a/src/test/isolation2/isolation2_schedule b/src/test/isolation2/isolation2_schedule +index 6fd8d8e1a2..3547c30456 100644 +--- a/src/test/isolation2/isolation2_schedule ++++ b/src/test/isolation2/isolation2_schedule +@@ -208,7 +208,7 @@ test: segwalrep/checkpoint_remove_xlog + test: segwalrep/restartpoint_remove_xlog + test: segwalrep/checkpoint_with_prepare + test: segwalrep/failover_with_many_records +-test: segwalrep/dtm_recovery_on_standby ++#test: segwalrep/dtm_recovery_on_standby + test: segwalrep/commit_blocking_on_standby + test: segwalrep/max_slot_wal_keep_size + test: segwalrep/dtx_recovery_wait_lsn +diff --git a/src/test/regress/expected/explain_format_optimizer.out b/src/test/regress/expected/explain_format_optimizer.out +index 92cd819432..ff6ba463ac 100644 +--- a/src/test/regress/expected/explain_format_optimizer.out ++++ b/src/test/regress/expected/explain_format_optimizer.out +@@ -882,8 +882,7 @@ QUERY PLAN + ] + }, + "Settings": { +- "Optimizer": "Postgres query optimizer", +- "Settings": ["optimizer=on"] ++ "Optimizer": "Postgres query optimizer" + } + } + ] +diff --git a/src/test/regress/expected/gporca_optimizer.out b/src/test/regress/expected/gporca_optimizer.out +index 9027250b80..bb6785ec94 100644 +--- a/src/test/regress/expected/gporca_optimizer.out ++++ b/src/test/regress/expected/gporca_optimizer.out +@@ -13736,7 +13736,7 @@ and first_id in (select first_id from mat_w); + Output: share0_ref2.first_id + Optimizer: Pivotal Optimizer (GPORCA) + Settings: enable_seqscan=on, optimizer=on +-(31 rows) ++(30 rows) + + with mat_w as ( + select first_id diff --git a/orca1.patch b/orca1.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ab6a8d169433ee03153120b8d02d125d4e5de1f --- /dev/null +++ b/orca1.patch @@ -0,0 +1,194 @@ +commit a490a59242e33d3986db43d0e85f35c15bbd09b0 +Author: Amit Khandekar +Date: Thu Jul 16 13:37:44 2020 +0800 + + gporca: Use portable way to get frame address. + + GPOS_ASMFP() used x86_64 assembly instructions to get current frame + address. This obviously doesn't compile on other architectures like + ARM64. So instead use __builtin_frame_address(), which is available + in gcc and presumably clang. Since gcc and clang are the two most + common compilers, and since we don't want to support GPORCA on exotic + architectures and compilers, don't bother to use any other way to get + the frame address. + + Let configure fail if __builtin_frame_address() is not found, but + don't do this check if gporca is disabled. + + GPORCA's CStackDescriptor::Backtrace() uses frame address. But there + is also gp_backtrace() in the backend code that has similar + functionality. This commit does not merge these two places. But it + prepares the infrastructure to do the merge, including a new macro + HAVE__BUILTIN_FRAME_ADDRESS defined in pg_config.h. + + Discussion: https://groups.google.com/a/greenplum.org/forum/#!topic/gpdb-dev/FgaR_4sGYrk + Reviewed-by: Heikki Linnakangas + +diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 +index 710dd86f88..bb5577fb1b 100644 +--- a/config/c-compiler.m4 ++++ b/config/c-compiler.m4 +@@ -273,6 +273,23 @@ fi])# PGAC_C_BUILTIN_UNREACHABLE + + + ++# PGAC_C_BUILTIN_FRAME_ADDRESS ++# -------------------------- ++# Check if the C compiler understands __builtin_frame_address(), ++# and define HAVE__BUILTIN_FRAME_ADDRESS if so. ++AC_DEFUN([PGAC_C_BUILTIN_FRAME_ADDRESS], ++[AC_CACHE_CHECK(for __builtin_frame_address, pgac_cv__builtin_frame_address, ++[AC_LINK_IFELSE([AC_LANG_PROGRAM([], ++[(void) __builtin_frame_address(0);])], ++[pgac_cv__builtin_frame_address=yes], ++[pgac_cv__builtin_frame_address=no])]) ++if test x"$pgac_cv__builtin_frame_address" = xyes ; then ++AC_DEFINE(HAVE__BUILTIN_FRAME_ADDRESS, 1, ++ [Define to 1 if your compiler understands __builtin_frame_address.]) ++fi])# PGAC_C_BUILTIN_FRAME_ADDRESS ++ ++ ++ + # PGAC_C_VA_ARGS + # -------------- + # Check if the C compiler understands C99-style variadic macros, +diff --git a/configure b/configure +index 7ad9ae3af6..fc9f96ab30 100755 +--- a/configure ++++ b/configure +@@ -15021,6 +15021,37 @@ if test x"$pgac_cv__builtin_unreachable" = xyes ; then + + $as_echo "#define HAVE__BUILTIN_UNREACHABLE 1" >>confdefs.h + ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_frame_address" >&5 ++$as_echo_n "checking for __builtin_frame_address... " >&6; } ++if ${pgac_cv__builtin_frame_address+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++(void) __builtin_frame_address(0); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ pgac_cv__builtin_frame_address=yes ++else ++ pgac_cv__builtin_frame_address=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_frame_address" >&5 ++$as_echo "$pgac_cv__builtin_frame_address" >&6; } ++if test x"$pgac_cv__builtin_frame_address" = xyes ; then ++ ++$as_echo "#define HAVE__BUILTIN_FRAME_ADDRESS 1" >>confdefs.h ++ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __VA_ARGS__" >&5 + $as_echo_n "checking for __VA_ARGS__... " >&6; } +@@ -15543,6 +15574,13 @@ _ACEOF + fi + + ++if test x"$pgac_cv__builtin_frame_address" = xno && test "$enable_orca" = yes; then : ++ as_fn_error $? " ++Built-in function __builtin_frame_address() is required for ORCA. ++Use --disable-orca to disable ORCA support. ++" "$LINENO" 5 ++fi ++ + if test "$with_zlib" = yes; then + # Check that defines z_streamp (versions before about 1.0.4 + # did not). While we could work around the lack of z_streamp, it +diff --git a/configure.in b/configure.in +index 51e836afcf..cc7a221e83 100644 +--- a/configure.in ++++ b/configure.in +@@ -1843,6 +1843,7 @@ PGAC_C_STATIC_ASSERT + PGAC_C_TYPES_COMPATIBLE + PGAC_C_BUILTIN_CONSTANT_P + PGAC_C_BUILTIN_UNREACHABLE ++PGAC_C_BUILTIN_FRAME_ADDRESS + PGAC_C_VA_ARGS + PGAC_STRUCT_TIMEZONE + PGAC_UNION_SEMUN +@@ -1868,6 +1869,13 @@ AC_CHECK_TYPES([struct option], [], [], + #include + #endif]) + ++if test x"$pgac_cv__builtin_frame_address" = xno && test "$enable_orca" = yes; then : ++ AC_MSG_ERROR([[ ++Built-in function __builtin_frame_address() is required for ORCA. ++Use --disable-orca to disable ORCA support. ++]]) ++fi ++ + if test "$with_zlib" = yes; then + # Check that defines z_streamp (versions before about 1.0.4 + # did not). While we could work around the lack of z_streamp, it +diff --git a/src/backend/gporca/libgpos/include/gpos/utils.h b/src/backend/gporca/libgpos/include/gpos/utils.h +index b355168d51..8b62ab8901 100644 +--- a/src/backend/gporca/libgpos/include/gpos/utils.h ++++ b/src/backend/gporca/libgpos/include/gpos/utils.h +@@ -19,35 +19,15 @@ + #include "gpos/io/COstreamBasic.h" + #include "gpos/types.h" + +-#define GPOS_ASMFP asm volatile("movq %%rbp, %0" : "=g"(ulp)); +-#define GPOS_ASMSP asm volatile("movq %%rsp, %0" : "=g"(ulp)); +- +-#define ALIGNED_16(x) \ +- (((ULONG_PTR) x >> 1) << 1 == (ULONG_PTR) x) // checks 16-bit alignment +-#define ALIGNED_32(x) \ +- (((ULONG_PTR) x >> 2) << 2 == (ULONG_PTR) x) // checks 32-bit alignment +-#define ALIGNED_64(x) \ +- (((ULONG_PTR) x >> 3) << 3 == (ULONG_PTR) x) // checks 64-bit alignment ++#define ALIGNED_16(x) (((ULONG_PTR) x >> 1) << 1 == (ULONG_PTR) x) // checks 16-bit alignment ++#define ALIGNED_32(x) (((ULONG_PTR) x >> 2) << 2 == (ULONG_PTR) x) // checks 32-bit alignment ++#define ALIGNED_64(x) (((ULONG_PTR) x >> 3) << 3 == (ULONG_PTR) x) // checks 64-bit alignment + + #define MAX_ALIGNED(x) ALIGNED_64(x) + + #define ALIGN_STORAGE __attribute__((aligned(8))) + +-#define GPOS_GET_FRAME_POINTER(x) \ +- do \ +- { \ +- ULONG_PTR ulp; \ +- GPOS_ASMFP; \ +- x = ulp; \ +- } while (0) +-#define GPOS_GET_STACK_POINTER(x) \ +- do \ +- { \ +- ULONG_PTR ulp; \ +- GPOS_ASMSP; \ +- x = ulp; \ +- } while (0) +- ++#define GPOS_GET_FRAME_POINTER(x) ((x) = (ULONG_PTR) __builtin_frame_address(0)) + #define GPOS_MSEC_IN_SEC ((ULLONG) 1000) + #define GPOS_USEC_IN_MSEC ((ULLONG) 1000) + #define GPOS_USEC_IN_SEC (((ULLONG) 1000) * 1000) +diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in +index 2d49657429..a699811824 100644 +--- a/src/include/pg_config.h.in ++++ b/src/include/pg_config.h.in +@@ -780,6 +780,9 @@ + /* Define to 1 if your compiler understands __builtin_constant_p. */ + #undef HAVE__BUILTIN_CONSTANT_P + ++/* Define to 1 if your compiler understands __builtin_frame_address. */ ++#undef HAVE__BUILTIN_FRAME_ADDRESS ++ + /* Define to 1 if your compiler understands __builtin_types_compatible_p. */ + #undef HAVE__BUILTIN_TYPES_COMPATIBLE_P + diff --git a/orca2.patch b/orca2.patch new file mode 100644 index 0000000000000000000000000000000000000000..3f333e14e6674ace788d92cbc8548672025766bc --- /dev/null +++ b/orca2.patch @@ -0,0 +1,29 @@ +commit 210318e906eb3c4acea48868b822586e31689200 +Author: peifengq +Date: Thu Jul 1 09:47:12 2021 +0800 + + fix orca + +diff --git a/src/backend/gporca/gporca.mk b/src/backend/gporca/gporca.mk +index 0bbedd3339..aa82de4aa4 100644 +--- a/src/backend/gporca/gporca.mk ++++ b/src/backend/gporca/gporca.mk +@@ -5,4 +5,4 @@ override CPPFLAGS := -I$(top_builddir)/src/backend/gporca/libgpdbcost/include $( + # Do not omit frame pointer. Even with RELEASE builds, it is used for + # backtracing. + override CPPFLAGS := -Werror -Wextra -Wpedantic -Wno-variadic-macros -fno-omit-frame-pointer $(CPPFLAGS) +-override CPPFLAGS := -std=gnu++98 $(CPPFLAGS) ++override CPPFLAGS := -std=c++14 $(CPPFLAGS) +diff --git a/src/backend/gporca/libgpos/src/common/Makefile b/src/backend/gporca/libgpos/src/common/Makefile +index 9ba83f9ffa..24f453e930 100644 +--- a/src/backend/gporca/libgpos/src/common/Makefile ++++ b/src/backend/gporca/libgpos/src/common/Makefile +@@ -14,7 +14,7 @@ override CPPFLAGS := -I$(top_builddir)/src/backend/gporca/libnaucrates/include $ + override CPPFLAGS := -I$(top_builddir)/src/backend/gporca/libgpdbcost/include $(CPPFLAGS) + # FIXME: Would be better to include gporca.mk, but hitting a warning + override CPPFLAGS := -Wno-variadic-macros -fno-omit-frame-pointer $(CPPFLAGS) +-override CPPFLAGS := -std=gnu++98 $(CPPFLAGS) ++override CPPFLAGS := -std=c++14 $(CPPFLAGS) + + OBJS = CAutoTimer.o \ + CBitSet.o \ diff --git a/unittest-fix.patch b/unittest-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..c7c99e779ea5bed2fc02605491231d617a92c599 --- /dev/null +++ b/unittest-fix.patch @@ -0,0 +1,12 @@ +diff -uparN gpdb-6.16.2/src/backend/utils/resgroup/test/resgroup_test.c gpdb-6.16.2_patched/src/backend/utils/resgroup/test/resgroup_test.c +--- gpdb-6.16.2/src/backend/utils/resgroup/test/resgroup_test.c 2021-06-03 15:24:57.000000000 +0800 ++++ gpdb-6.16.2_patched/src/backend/utils/resgroup/test/resgroup_test.c 2021-07-14 09:37:25.907086232 +0800 +@@ -73,6 +73,7 @@ static void + test__CpusetToBitset_bad_arguments(void **state) + { + char cpuset[200]; ++ memset(cpuset, 0, sizeof(cpuset)); + assert_true(!CpusetToBitset(NULL, -1)); + assert_true(!CpusetToBitset(cpuset, -1)); + assert_true(!CpusetToBitset(cpuset, 200)); +