From 8d085df3746d5378be24d3753b68f04980d37eaa Mon Sep 17 00:00:00 2001 From: z00793368 Date: Tue, 29 Aug 2023 15:21:40 +0800 Subject: [PATCH] add openGauss-finance with open features --- build/script/build_opengauss.sh | 2 + build/script/cmake_package_mini.sh | 1 + build/script/utils/make_compile.sh | 15 ++ cmake/src/build_options.cmake | 5 + cmake/src/buildfunction.sh | 3 + cmake/src/config-in/pg_config.h.in | 4 + configure | 131 ++++++++++++------ src/Makefile.global.in | 1 + .../optimizer/commands/tablespace.cpp | 2 +- src/include/pg_config.h.in | 3 + 10 files changed, 125 insertions(+), 42 deletions(-) diff --git a/build/script/build_opengauss.sh b/build/script/build_opengauss.sh index 2c673d6ba7..8cdc492b2b 100755 --- a/build/script/build_opengauss.sh +++ b/build/script/build_opengauss.sh @@ -144,6 +144,8 @@ else declare CMAKE_BUILD_DIR=${ROOT_DIR}/tmp_build if [ "$product_mode"x == "lite"x ]; then declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON ${extra_cmake_opt}" + elif [ "$product_mode"x == "finance"x ]; then + declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_FINANCE_MODE=ON ${extra_cmake_opt}" else declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_MOT=ON ${extra_cmake_opt}" fi diff --git a/build/script/cmake_package_mini.sh b/build/script/cmake_package_mini.sh index 1695230e4a..6e253bbc49 100644 --- a/build/script/cmake_package_mini.sh +++ b/build/script/cmake_package_mini.sh @@ -443,6 +443,7 @@ function install_gaussdb() export THIRD_BIN_PATH="${binarylibs_path}" export PREFIX_HOME="${BUILD_DIR}" export ENABLE_LITE_MODE=ON + export ENABLE_FINANCE_MODE=ON if [ "$version_mode"x == "release"x ]; then CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON" diff --git a/build/script/utils/make_compile.sh b/build/script/utils/make_compile.sh index 8263828526..339a03883d 100644 --- a/build/script/utils/make_compile.sh +++ b/build/script/utils/make_compile.sh @@ -183,6 +183,21 @@ function install_gaussdb() ./configure $shared_opt CFLAGS="-O0 ${GAUSSDB_EXTRA_FLAGS}" --enable-debug --enable-cassert CC=g++ $extra_config_opt --enable-lite-mode>> "$LOG_FILE" 2>&1 fi fi + elif [ "$product_mode"x == "finance"x ]; then + shared_opt="--gcc-version=${gcc_version}.${gcc_sub_version} --prefix="${BUILD_DIR}" --3rd=${binarylib_dir} --enable-thread-safety ${enable_readline} ${with_tassl} --without-zlib --without-gssapi --without-krb5" + if [ "$version_mode"x == "release"x ]; then + # configure -D__USE_NUMA -D__ARM_LSE with arm single mode + if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then + echo "configure -D__USE_NUMA -D__ARM_LSE with arm single mode" + GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA -D__ARM_LSE" + fi + ./configure $shared_opt CFLAGS="-O2 -g3 ${GAUSSDB_EXTRA_FLAGS}" CC=g++ $extra_config_opt --enable-finance-mode >> "$LOG_FILE" 2>&1 + elif [ "$version_mode"x == "memcheck"x ]; then + ./configure $shared_opt CFLAGS='-O0' --enable-debug --enable-cassert --enable-memory-check CC=g++ $extra_config_opt --enable-finance-mode >> "$LOG_FILE" 2>&1 + else + ./configure $shared_opt CFLAGS="-O0 ${GAUSSDB_EXTRA_FLAGS}" --enable-debug --enable-cassert CC=g++ $extra_config_opt --enable-finance-mode>> "$LOG_FILE" 2>&1 + fi + fi if [ $? -ne 0 ]; then die "configure failed." diff --git a/cmake/src/build_options.cmake b/cmake/src/build_options.cmake index 3b709d49b3..ad154fe9fc 100755 --- a/cmake/src/build_options.cmake +++ b/cmake/src/build_options.cmake @@ -56,6 +56,7 @@ option(ENABLE_LCOV "enable lcov, the old is --enable-lcov" OFF) option(ENABLE_MULTIPLE_NODES "enable distribute,the old is --enable-multiple-nodes" OFF) option(ENABLE_PRIVATEGAUSS "enable privategauss,the old is --enable-pribategauss" OFF) option(ENABLE_LITE_MODE "enable lite in single_node mode,the old is --enable-lite-mode" OFF) +option(ENABLE_FINANCE_MODE "enable finance in single_node mode,the old is --enable-finance-mode" OFF) option(ENABLE_DEBUG "enable privategauss,the old is --enable-pribategauss" OFF) option(ENABLE_MOT "enable mot in single_node mode,the old is --enable-mot" OFF) option(ENABLE_NUMA "enable numa,the old is --enable-numa" ON) @@ -355,3 +356,7 @@ endif() if("${ENABLE_MULTIPLE_NODES}" STREQUAL "ON" AND "${ENABLE_LITE_MODE}" STREQUAL "ON") message(FATAL_ERROR "error: --enable-lite-mode option is not supported with --enable-multiple-nodes option") endif() + +if("${ENABLE_FINANCE_NODES}" STREQUAL "ON" AND "${ENABLE_LITE_MODE}" STREQUAL "ON") + message(FATAL_ERROR "error: --enable-lite-mode option is not supported with --enable-finance-nodes option") +endif() diff --git a/cmake/src/buildfunction.sh b/cmake/src/buildfunction.sh index 61a7145376..63a1697e2e 100755 --- a/cmake/src/buildfunction.sh +++ b/cmake/src/buildfunction.sh @@ -119,6 +119,9 @@ function get_gs_version() if [ "${ENABLE_LITE_MODE}" == "ON" ]; then product="$product-lite" fi + if [ "${ENABLE_FINANCE_MODE}" == "ON" ]; then + product="$product-finance" + fi if test "$enable_ccache" = yes; then default_gs_version="(${product} ${version} build 1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug" else diff --git a/cmake/src/config-in/pg_config.h.in b/cmake/src/config-in/pg_config.h.in index 6011eb82bc..62792839e0 100755 --- a/cmake/src/config-in/pg_config.h.in +++ b/cmake/src/config-in/pg_config.h.in @@ -920,6 +920,10 @@ * * (--enable-lite-mode) */ #cmakedefine ENABLE_LITE_MODE +/* Define to 1 if you want to generate gauss product as finance mode. + * * (--enable-lite-mode) */ +#cmakedefine ENABLE_FINANCE_MODE + /* Define to 1 if you want to use mot * --enable-mot */ #cmakedefine ENABLE_MOT diff --git a/configure b/configure index d00bbb59e7..fcdfac309b 100755 --- a/configure +++ b/configure @@ -752,6 +752,7 @@ enable_jemalloc_debug enable_privategauss enable_multiple_nodes enable_lite_mode +enable_finance_mode enable_mot enable_memory_check enable_mysql_fdw @@ -837,6 +838,7 @@ enable_jemalloc_debug enable_privategauss enable_multiple_nodes enable_lite_mode +enable_finance_mode enable_mot enable_memory_check enable_mysql_fdw @@ -2876,47 +2878,6 @@ _ACEOF fi -# Check whether --enable-mot was given. -if test "${enable_mot+set}" = set; then - enableval=$enable_mot; - case $enableval in - yes) - if test "$enable_multiple_nodes" = yes; then - - { { $as_echo "$as_me:$LINENO: error: --enable-mot option is not supported with --enable-multiple-nodes option" >&5 - $as_echo "$as_me: error: --enable-mot option is not supported with --enable-multiple-nodes option" >&2;} - { (exit 1); exit 1; }; } - - fi - ;; - no) - : - ;; - *) - { { $as_echo "$as_me:$LINENO: error: no argument expected for --enable-mot option" >&5 -$as_echo "$as_me: error: no argument expected for --enable-mot option" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - -else - enable_mot=no - -fi - -if test "$enable_multiple_nodes" = yes; then - - enable_mot=no -fi - -if test "$enable_mot" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define ENABLE_MOT 1 -_ACEOF - -fi - # # '-memory-check'-like feature can be enabled # @@ -3231,6 +3192,94 @@ _ACEOF fi +# +# --enable-finance-mode enables +# + +# Check whether --enable-finance-mode was given. +if test "${enable_finance_mode+set}" = set; then + enableval=$enable_finance_mode; + case $enableval in + yes) + if test "$enable_lite_nodes" = yes; then + { { $as_echo "$as_me:$LINENO: error: --enable-finance-mode option is not supported with --enable-lite-nodes option" >&5 + $as_echo "$as_me: error: --enable-finance-mode option is not supported with --enable-lite-nodes option" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + no) + : + ;; + *) + { { $as_echo "$as_me:$LINENO: error: no argument expected for --enable-finance-mode option" >&5 +$as_echo "$as_me: error: no argument expected for --enable-finance-mode option" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + +else + enable_finance_mode=no + +fi + +if test "$enable_lite_nodes" = yes; then + + enable_finance_mode=no +fi + +if test "$enable_finance_mode" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_FINANCE_MODE 1 +_ACEOF + +fi + +# Check whether --enable-mot was given. +if test "${enable_mot+set}" = set; then + enableval=$enable_mot; + case $enableval in + yes) + if test "$enable_multiple_nodes" = yes; then + + { { $as_echo "$as_me:$LINENO: error: --enable-mot option is not supported with --enable-multiple-nodes option" >&5 + $as_echo "$as_me: error: --enable-mot option is not supported with --enable-multiple-nodes option" >&2;} + { (exit 1); exit 1; }; } + + fi + ;; + no) + : + ;; + *) + { { $as_echo "$as_me:$LINENO: error: no argument expected for --enable-mot option" >&5 +$as_echo "$as_me: error: no argument expected for --enable-mot option" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + +else + enable_mot=no + +fi + +if test "$enable_multiple_nodes" = yes; then + + enable_mot=no +fi + +if test "$enable_finance_mode" = yes; then + + enable_mot=no +fi + +if test "$enable_mot" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_MOT 1 +_ACEOF + +fi # # --with-openeuler-os enable diff --git a/src/Makefile.global.in b/src/Makefile.global.in index e6c9beb216..afc9bfa272 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -173,6 +173,7 @@ enable_jemalloc_debug = @enable_jemalloc_debug@ enable_privategauss = @enable_privategauss@ enable_multiple_nodes = @enable_multiple_nodes@ enable_lite_mode = @enable_lite_mode@ +enable_finance_mode = @enable_finance_mode@ enable_mot = @enable_mot@ enable_mysql_fdw = @enable_mysql_fdw@ enable_oracle_fdw = @enable_oracle_fdw@ diff --git a/src/gausskernel/optimizer/commands/tablespace.cpp b/src/gausskernel/optimizer/commands/tablespace.cpp index 316bf02c84..15e6f4785d 100644 --- a/src/gausskernel/optimizer/commands/tablespace.cpp +++ b/src/gausskernel/optimizer/commands/tablespace.cpp @@ -843,7 +843,7 @@ Oid CreateTableSpace(CreateTableSpaceStmt* stmt) errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("tablespaces are not supported on this platform"))); #endif /* HAVE_SYMLINK */ - return tablespaceoid; + return tablespaceoid; } /* diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 71598f793e..17694ca146 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -67,6 +67,9 @@ /* Define to 1 if you want to generate gauss product as lite mode. (--enable-lite-mode) */ #undef ENABLE_LITE_MODE +/* Define to 1 if you want to generate gauss product as finance mode. (--enable-finance-mode) */ +#undef ENABLE_FINANCE_MODE + /* Define to 1 if you want MOT support. (--enable-mot). Supported only in single_node mode, not supported with (--enable-multiple-nodes) */ #undef ENABLE_MOT -- Gitee