Compare commits

..

6 Commits

Author SHA1 Message Date
opengauss-bot ada51c9fea
!1574 修复升级场景下_jsonb类型oid随机分配的问题
Merge pull request !1574 from 胡正超/jsonboid2.1.0
2022-03-14 13:37:12 +00:00
gentle_hu 1f6832d30b fix oid of _jsonb in upgrade case 2022-03-09 19:15:36 +08:00
opengauss-bot d8cd223c53
!1494 fix unique index of column table
Merge pull request !1494 from zhengxue/2.1.0
2022-01-24 03:25:47 +00:00
shirley_zhengx fcad3b1ccd fix unique index of column table 2022-01-21 18:44:23 +08:00
opengauss-bot 1f18fce639
!1458 fix upgrade of gs_encrypted_proc
Merge pull request !1458 from zhengxue/2.1.0_dev
2022-01-11 07:43:53 +00:00
shirley_zhengx 1ded1fec93 fix upgrade of gs_encrypted_proc 2022-01-08 16:41:13 +08:00
3301 changed files with 229292 additions and 734280 deletions

9
.gitignore vendored
View File

@ -1,7 +1,7 @@
/.gitee/
/.vscode/
/.idea/
/cmake-build-debug/
*.a
*.o
*.so
@ -10,15 +10,12 @@
*.sgml
*.log
*.inc
*.rej
objfiles.txt
/tmp_build/
/output/
/mppdb_temp_install/
/GNUmakefile
/config.status
/ereport.txt
/build/script/version.cfg
/build/script/version.cfg
/src/Makefile.global

View File

@ -58,6 +58,7 @@ install:
$(MAKE) -C contrib/hstore $@
$(MAKE) -C $(root_builddir)/distribute/kernel/extension/packages $@
$(MAKE) -C contrib/pagehack $@
$(MAKE) -C contrib/pg_stat_statements $@
$(MAKE) -C contrib/pg_xlogdump $@
$(MAKE) -C $(root_builddir)/contrib/gsredistribute $@
$(MAKE) -C $(root_builddir)/distribute/kernel/extension/dimsearch $@
@ -66,27 +67,17 @@ install:
+@echo "openGauss installation complete."
else
ifeq ($(enable_privategauss), yes)
ifneq ($(enable_lite_mode), yes)
install:
$(MAKE) install_mysql_fdw
$(MAKE) install_oracle_fdw
$(MAKE) install_pldebugger
$(MAKE) -C contrib/postgres_fdw $@
$(MAKE) -C contrib/pg_stat_statements $@
$(MAKE) -C contrib/hstore $@
$(MAKE) -C $(root_builddir)/privategauss/kernel/extension/packages $@
$(MAKE) -C $(root_builddir)/distribute/kernel/extension/packages $@
$(MAKE) -C $(root_builddir)/contrib/gsredistribute $@
+@echo "openGauss installation complete."
else
install:
$(MAKE) install_mysql_fdw
$(MAKE) install_oracle_fdw
$(MAKE) install_pldebugger
$(MAKE) -C contrib/postgres_fdw $@
$(MAKE) -C contrib/hstore $@
$(MAKE) -C $(root_builddir)/privategauss/kernel/extension/packages $@
+@echo "openGauss installation complete."
endif
else
install:
$(MAKE) install_mysql_fdw
$(MAKE) install_oracle_fdw
@ -142,8 +133,6 @@ qunitcheck: all
fastcheck_single: all
upgradecheck_single: all
fastcheck_single_comm_proxy: all
redocheck: all

1233
README.md

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
[overwrite]
CMakeLists.txt
License
GNUmakefile.in
Makefile
README.en.md
README.md
Third_Party_Open_Source_Software_Notice
aclocal.m4
build
build.sh
cmake
config
configure
contrib
doc
docker
escan.txt
package
simpleInstall
src/DEVELOPERS
src/Makefile
src/Makefile.global.in
src/Makefile.shlib
src/bcc32.mak
src/bin
src/common
src/gausskernel
src/get_PlatForm_str.sh
src/include
src/lib
src/makefiles
src/manager
src/mtlocal.pl
src/nls-global.mk
src/test
src/tools
src/win32.mak
Tools/memory_check
[delete]
third_party
contrib/secbox
contrib/carbondata
contrib/gtmtester
src/bin/gds
src/bin/pg_redis
src/include/ssl/openssl_etcd.cnf
src/test/regress/jar
src/test/regress/krbclient
src/test/regress/obstools
src/tools/casedb
build/script/mpp_release_list_centos
build/script/mpp_release_list_centos_aarch64
build/script/mpp_release_list_centos_single
build/script/mpp_release_list_euleros
build/script/mpp_release_list_euleros_aarch64
build/script/mpp_release_list_euleros_aarch64_single
build/script/mpp_release_list_euleros_single
build/script/mpp_release_list_linux_x86_64
build/script/mpp_release_list_openeuler_aarch64
build/script/mpp_release_list_openeuler_aarch64_single
build/script/mpp_release_list_kylin_aarch64

View File

@ -0,0 +1,116 @@
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
use File::Path qw(make_path remove_tree);
use Cwd;
my $gausskernel_dir = $ARGV[0];
my $opengauss_dir = $ARGV[1];
sub usage
{
print " usage:\n";
print " perl port_openGauss.pl GaussDBKernel-server-directory openGauss-server-directory\n";
print " \n";
}
sub valid_line
{
my ($l) = @_;
$l =~ s/^\s+//g;
$l =~ s/\s+$//g;
return 1 if $l;
return 0;
}
sub prepare_parentdir
{
my $dir = $_[0];
$dir =~ s/\/*$//g;
die "there is no such a directory $dir" unless $dir;
my $parentdir = dirname($dir);
make_path $parentdir unless -d $parentdir;
}
if ( !$opengauss_dir || !$gausskernel_dir || $gausskernel_dir eq "-h" || $gausskernel_dir eq "--help" ) {
usage();
exit(-1);
}
if (! -d $opengauss_dir || ! -d $gausskernel_dir ) {
print "ERROR: $opengauss_dir or $gausskernel_dir does not exist!";
}
$opengauss_dir =~ s{/+$}{}g;
$gausskernel_dir =~ s{/+$}{}g;
my $open_assist_dir = dirname(__FILE__);
if ($open_assist_dir !~ m/^\//) {
$open_assist_dir = cwd() . '/' . $open_assist_dir;
}
$open_assist_dir =~ s/\/\.$//;
my $opengauss_fileset = "$open_assist_dir/opengauss_fileset";
my @overwrite_fileset;
my @delete_fileset;
open my $fset, "<", $opengauss_fileset or die "cannot open $opengauss_fileset: $!\n";
my $file_type = "none";
while(my $line=<$fset>) {
chomp $line;
if ($line =~ /\[overwrite\]/) {
$file_type = "overwrite";
next;
}
elsif ($line =~ /\[delete\]/) {
$file_type = "delete";
next;
}
if ($file_type eq "overwrite") {
push @overwrite_fileset, $line;
}
elsif ($file_type eq "delete") {
push @delete_fileset, $line;
}
}
print "[" . localtime() . "] synchronizing directories and files.\n";
foreach my $d(qw/src contrib/) {
if ( -d "$opengauss_dir/$d" ) {
remove_tree("$opengauss_dir/$d");
print "removed $opengauss_dir/$d\n";
}
make_path("$opengauss_dir/$d");
print "created $opengauss_dir/$d\n";
}
foreach my $f(@overwrite_fileset) {
next unless valid_line($f);
if ( -d "$gausskernel_dir/$f") {
prepare_parentdir("$opengauss_dir/$f");
remove_tree("$opengauss_dir/$f") if -d "$opengauss_dir/$f";
system("cp -fr $gausskernel_dir/$f $opengauss_dir/$f") == 0 or print "ERROR: copy $gausskernel_dir/$f failed\n";
print "copied $opengauss_dir/$f\n";
}
elsif ( -f "$gausskernel_dir/$f") {
system("cp -f $gausskernel_dir/$f $opengauss_dir/$f") == 0 or print "ERROR: copy $gausskernel_dir/$f failed\n";
print "copied $opengauss_dir/$f\n";
}
}
foreach my $f(@delete_fileset) {
next unless valid_line($f);
if ( -d "$opengauss_dir/$f") {
remove_tree("$opengauss_dir/$f");
print "deleted $opengauss_dir/$f\n";
}
elsif ( -f "$opengauss_dir/$f") {
unlink "$opengauss_dir/$f";
print "deleted $opengauss_dir/$f\n";
}
}
print "[" . localtime() . "] synchronized directories and files.\n";

View File

@ -1,12 +1,5 @@
#!/bin/bash
#######################################################################
# Copyright (c): 2020-2025, Huawei Tech. Co., Ltd.
# descript: Compile and pack openGauss
# Return 0 means OK.
# Return 1 means failed.
# version: 2.0
# date: 2020-08-08
#######################################################################
declare build_version_mode='release'
declare build_binarylib_dir='None'
declare wrap_binaries='NO'
@ -81,15 +74,10 @@ ROOT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
echo "ROOT_DIR : $ROOT_DIR"
cd build/script
chmod a+x build_opengauss.sh
./build_opengauss.sh -m ${build_version_mode} -3rd ${build_binarylib_dir} ${not_optimized} -pkg server
sh build_opengauss.sh -m ${build_version_mode} -3rd ${build_binarylib_dir} ${not_optimized} -pkg server -mc off
if [ "${wrap_binaries}"X = "YES"X ]
then
chmod a+x package_opengauss.sh
if [ X$config_file = "X" ];then
./package_opengauss.sh -3rd ${build_binarylib_dir} -m ${build_version_mode}
else
./package_opengauss.sh -3rd ${build_binarylib_dir} -m ${build_version_mode} -f ${config_file}
fi
chmod a+x build_opengauss.sh
sh package_opengauss.sh -3rd ${build_binarylib_dir} -m ${build_version_mode} -f ${config_file}
fi
exit 0

View File

@ -12,158 +12,33 @@
# Example: ./build_opengauss.sh -3rd /path/to/your/third_party_binarylibs/
# change it to "N", if you want to build with original build system based on solely Makefiles
declare CMAKE_PKG="N"
declare SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
declare ROOT_DIR=$(dirname "${SCRIPT_DIR}")
declare ROOT_DIR=$(dirname "${ROOT_DIR}")
declare package_type='server'
declare product_mode='opengauss'
declare version_mode='release'
declare binarylib_dir='None'
declare make_check='off'
declare separate_symbol='on'
CMAKE_PKG="N"
function print_help()
{
echo "Usage: $0 [OPTION]
-h|--help show help information.
-V|--version show version information.
-3rd|--binarylib_dir the directory of third party binarylibs.
-pkg|--package provode type of installation packages, values parameter is server.
-m|--version_mode this values of paramenter is debug, release, memcheck, the default value is release.
-pm product mode, values parameter is opengauss.
-mc|--make_check this values of paramenter is on or off, the default value is on.
-s|--symbol_mode whether separate symbol in debug mode, the default value is on.
-co|--cmake_opt more cmake options
"
}
function print_version()
{
echo $(cat ${SCRIPT_DIR}/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}')
}
if [ $# = 0 ] ; then
echo "missing option"
print_help
#(0) pre-check
if [ ! -f opengauss.spec ] || [ ! -f package_internal.sh ]; then
echo "ERROR: there is no opengauss.spec/mpp_package.sh"
exit 1
fi
#########################################################################
##read command line paramenters
#######################################################################
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
print_help
exit 1
;;
-V|--version)
print_version
exit 1
;;
-3rd|--binarylib_dir)
if [ "$2"X = X ]; then
echo "no given binarylib directory values"
exit 1
fi
binarylib_dir=$2
shift 2
;;
-pkg)
if [ "$2"X = X ]; then
echo "no given package type name"
exit 1
fi
package_type=$2
shift 2
;;
-m|--version_mode)
if [ "$2"X = X ]; then
echo "no given version number values"
exit 1
fi
version_mode=$2
shift 2
;;
-pm)
if [ "$2"X = X ]; then
echo "no given product mode"
exit 1
fi
product_mode=$2
shift 2
;;
-mc|--make_check)
if [ "$2"X = X ]; then
echo "no given make check values"
exit 1
fi
make_check=$2
shift 2
;;
-s|--symbol_mode)
if [ "$2"X = X ]; then
echo "no given symbol parameter"
exit 1
fi
separate_symbol=$2
shift 2
;;
--cmake_opt)
if [ "$2"X = X ]; then
echo "no extra configure options provided"
exit 1
fi
extra_cmake_opt=$2
shift 2
;;
--config_opt)
if [ "$2"X = X ]; then
echo "no extra configure options provided"
exit 1
fi
extra_config_opt=$2
shift 2
;;
*)
echo "Internal Error: option processing error: $1" 1>&2
echo "please input right paramtenter, the following command may help you"
echo "${0} --help or ${0} -h"
exit 1
esac
done
#(1) prepare
cp opengauss.spec gauss.spec
if [ -e "$SCRIPT_DIR/utils/common.sh" ];then
source $SCRIPT_DIR/utils/common.sh
else
exit 1
fi
#(1) invoke package_internal.sh
#(2) invoke package_internal.sh
if [ "$CMAKE_PKG" == "N" ]; then
declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install"
source $SCRIPT_DIR/utils/make_compile.sh || exit 1
chmod a+x package_internal.sh
echo "package_internal.sh $@ -nopkg -pm opengauss"
./package_internal.sh $@ -nopkg -pm opengauss
if [ $? != "0" ]; then
echo "failed in build opengauss"
fi
else
echo "begin config cmake options:" >> "$LOG_FILE" 2>&1
declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install"
declare CMAKE_BUILD_DIR=${ROOT_DIR}/tmp_build
declare CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_MOT=ON ${extra_cmake_opt}"
echo "[cmake options] cmake options is:${CMAKE_OPT}" >> "$LOG_FILE" 2>&1
source $SCRIPT_DIR/utils/cmake_compile.sh || exit 1
chmod a+x cmake_package_internal.sh
echo "cmake_package_internal.sh $@ -nopkg -pm opengauss"
./cmake_package_internal.sh $@ -nopkg -pm opengauss
if [ $? != "0" ]; then
echo "failed in build opengauss"
fi
fi
function main()
{
echo "[makegaussdb] $(date +%y-%m-%d' '%T): script dir : ${SCRIPT_DIR}"
echo "[makegaussdb] $(date +%y-%m-%d' '%T): Work root dir : ${ROOT_DIR}"
read_gaussdb_version
read_gaussdb_number
gaussdb_pkg_pre_clean
gaussdb_build
}
main
echo "now, all build has finished!"
exit 0
#(3) remove files which are not necessary
BUILD_DIR="${ROOT_DIR}/mppdb_temp_install"

File diff suppressed because it is too large Load Diff

View File

@ -1,814 +0,0 @@
#!/bin/bash
#######################################################################
# Copyright (c): 2020-2021, Huawei Tech. Co., Ltd.
# descript: Compile and pack MPPDB
# Return 0 means OK.
# Return 1 means failed.
# version: 2.0
# date: 2021-12-12
#######################################################################
##default package type is server
declare package_type='server'
declare install_package_format='tar'
##default version mode is relase
declare version_mode='release'
declare binarylib_dir='None'
declare separate_symbol='on'
#detect platform information.
PLATFORM=32
bit=$(getconf LONG_BIT)
if [ "$bit" -eq 64 ]; then
PLATFORM=64
fi
#get OS distributed version.
kernel=""
version=""
ext_version=""
if [ -f "/etc/euleros-release" ]; then
kernel=$(cat /etc/euleros-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
version=$(cat /etc/euleros-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
ext_version=$version
elif [ -f "/etc/openEuler-release" ]; then
kernel=$(cat /etc/openEuler-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
version=$(cat /etc/openEuler-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
elif [ -f "/etc/centos-release" ]; then
kernel=$(cat /etc/centos-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
version=$(cat /etc/centos-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
else
kernel=$(lsb_release -d | awk -F ' ' '{print $2}'| tr A-Z a-z)
version=$(lsb_release -r | awk -F ' ' '{print $2}')
fi
if [ X"$kernel" == X"euleros" ]; then
dist_version="EULER"
elif [ X"$kernel" == X"centos" ]; then
dist_version="CentOS"
elif [ X"$kernel" == X"openeuler" ]; then
dist_version="openEuler"
else
echo "Only support EulerOS|Centos|openEuler platform."
echo "Kernel is $kernel"
exit 1
fi
show_package=false
gcc_version="7.3.0"
##add platform architecture information
cpus_num=$(grep -w processor /proc/cpuinfo|wc -l)
PLATFORM_ARCH=$(uname -p)
if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then
ARCHITECTURE_EXTRA_FLAG=_euleros2.0_${ext_version}_$PLATFORM_ARCH
release_file_list="aarch64_lite_list"
else
ARCHITECTURE_EXTRA_FLAG=_euleros2.0_sp5_${PLATFORM_ARCH}
release_file_list="x86_64_lite_list"
fi
##default install version storage path
declare mppdb_version='openGauss Lite'
declare mppdb_name_for_package="$(echo ${mppdb_version} | sed 's/ /-/g')"
declare package_path='./'
declare version_number=''
declare make_check='off'
declare zip_package='on'
declare extra_config_opt=''
#######################################################################
##putout the version of mppdb
#######################################################################
function print_version()
{
echo "$version_number"
}
#######################################################################
## print help information
#######################################################################
function print_help()
{
echo "Usage: $0 [OPTION]
-h|--help show help information.
-V|--version show version information.
-f|--file provide the file list released.
-3rd|--binarylib_dir the directory of third party binarylibs.
-pkg|--package provode type of installation packages, values parameter is all, server, jdbc, odbc, agent.
-pm product mode, values parameter is single, multiple or opengauss, default value is multiple.
-p|--path generation package storage path.
-t packaging format, values parameter is tar or rpm, the default value is tar.
-m|--version_mode this values of paramenter is debug, release, memcheck, the default value is release.
-mc|--make_check this values of paramenter is on or off, the default value is on.
-s|--symbol_mode whether separate symbol in debug mode, the default value is on.
-cv|--gcc_version gcc-version option: 7.3.0.
-nopkg|--no_package don't zip binaries into packages
-co|--config_opt more config options
-S|--show_pkg show server package name and Bin name base on current configuration.
"
}
if [ $# = 0 ] ; then
echo "missing option"
print_help
exit 1
fi
SCRIPT_PATH=${0}
FIRST_CHAR=$(expr substr "$SCRIPT_PATH" 1 1)
if [ "$FIRST_CHAR" = "/" ]; then
SCRIPT_PATH=${0}
else
SCRIPT_PATH="$(pwd)/${SCRIPT_PATH}"
fi
SCRIPT_NAME=$(basename $SCRIPT_PATH)
SCRIPT_DIR=$(dirname "${SCRIPT_PATH}")
SCRIPT_DIR=$(dirname "$SCRIPT_DIR")
if [ ! -f "$SCRIPT_DIR/$SCRIPT_NAME" ] ; then
SCRIPT_DIR=$SCRIPT_DIR/script
fi
package_path=$SCRIPT_DIR
#######################################################################
##read version from $release_file_list
#######################################################################
function read_mpp_version()
{
cd $SCRIPT_DIR
local head=$(cat $release_file_list | grep "\[version\]" -n | awk -F: '{print $1}')
if [ ! -n "$head" ]; then
echo "error: no find version in the $release_file_list file "
exit 1
fi
local tail=$(cat $release_file_list | sed "1,$head d" | grep "^\[" -n | sed -n "1p" | awk -F: '{print $1}')
if [ ! -n "$tail" ]; then
local all=$(cat $release_file_list | wc -l)
let tail=$all+1-$head
fi
version_number=$(cat $release_file_list | awk "NR==$head+1,NR==$tail+$head-1")
echo "${mppdb_name_for_package}-${version_number}">version.cfg
#auto read the number from kernal globals.cpp, no need to change it here
}
#########################################################################
##read command line paramenters
#######################################################################
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
print_help
exit 1
;;
-V|--version)
print_version
exit 1
;;
-f|--file)
if [ "$2"X = X ]; then
echo "no given file name"
exit 1
fi
release_file_list=$2
shift 2
;;
-3rd|--binarylib_dir)
if [ "$2"X = X ]; then
echo "no given binarylib directory values"
exit 1
fi
binarylib_dir=$2
shift 2
;;
-p|--path)
if [ "$2"X = X ]; then
echo "no given generration package path"
exit 1
fi
package_path=$2
if [ ! -d "$package_path" ]; then
mkdir -p $package_path
fi
shift 2
;;
-pkg)
if [ "$2"X = X ]; then
echo "no given package type name"
exit 1
fi
package_type=$2
shift 2
;;
-s|--symbol_mode)
if [ "$2"X = X ]; then
echo "no given symbol parameter"
exit 1
fi
separate_symbol=$2
shift 2
;;
-t)
if [ "$2"X = X ]; then
echo "no given installation package format values"
exit 1
fi
if [ "$2" = rpm ]; then
echo "error: do not suport rpm package now!"
exit 1
fi
install_package_format=$2
shift 1
;;
-m|--version_mode)
if [ "$2"X = X ]; then
echo "no given version number values"
exit 1
fi
version_mode=$2
shift 2
;;
-mc|--make_check)
if [ "$2"X = X ]; then
echo "no given make check values"
exit 1
fi
make_check=$2
shift 2
;;
-cv|--gcc_version)
if [ "$2"X = X ]; then
echo "no given gcc version"
exit 1
fi
gcc_version=$2
shift 2
;;
-nopkg|--no_package)
zip_package='off'
shift 1
;;
-co|--config_opt)
if [ "$2"X = X ]; then
echo "no extra configure options provided"
exit 1
fi
extra_config_opt=$2
shift 2
;;
-S|--show_pkg)
show_package=true
shift
;;
*)
echo "Internal Error: option processing error: $1" 1>&2
echo "please input right paramtenter, the following command may help you"
echo "./cmake_package_internal.sh --help or ./cmake_package_internal.sh -h"
exit 1
esac
done
read_mpp_version
if [ "$gcc_version" = "7.3.0" ]; then
gcc_version=${gcc_version:0:3}
else
echo "Unknown gcc version $gcc_version"
exit 1
fi
#######################################################################
## declare all package name
#######################################################################
declare version_string="${mppdb_name_for_package}-${version_number}"
declare package_pre_name="${version_string}-${dist_version}-${PLATFORM_ARCH}"
declare server_package_name="${package_pre_name}.${install_package_format}.gz"
declare libpq_package_name="${package_pre_name}-Libpq.${install_package_format}.gz"
declare symbol_package_name="${package_pre_name}-symbol.${install_package_format}.gz"
echo "[makemppdb] $(date +%y-%m-%d' '%T): script dir : ${SCRIPT_DIR}"
ROOT_DIR=$(dirname "$SCRIPT_DIR")
ROOT_DIR=$(dirname "$ROOT_DIR")
PLAT_FORM_STR=$(sh "${ROOT_DIR}/src/get_PlatForm_str.sh")
if [ "${PLAT_FORM_STR}"x == "Failed"x ]
then
echo "Only support EulerOS openEuler platform."
exit 1
fi
CMAKE_BUILD_DIR=${ROOT_DIR}/tmp_build
declare LOG_FILE="${ROOT_DIR}/build/script/makemppdb_pkg.log"
declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install"
declare ERR_MKGS_FAILED=1
declare MKGS_OK=0
if [ "${binarylib_dir}" != 'None' ] && [ -d "${binarylib_dir}" ]; then
BUILD_TOOLS_PATH="${binarylib_dir}/buildtools/${PLAT_FORM_STR}"
PLATFORM_PATH="${binarylib_dir}/platform/${PLAT_FORM_STR}"
BINARYLIBS_PATH="${binarylib_dir}/dependency"
else
BUILD_TOOLS_PATH="${ROOT_DIR}/buildtools/${PLAT_FORM_STR}"
PLATFORM_PATH="${ROOT_DIR}/platform/${PLAT_FORM_STR}"
BINARYLIBS_PATH="${ROOT_DIR}/binarylibs"
fi
declare UPGRADE_SQL_DIR="${ROOT_DIR}/src/include/catalog/upgrade_sql"
export CC="$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin/gcc"
export CXX="$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin/g++"
export LD_LIBRARY_PATH=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/lib64:$BUILD_TOOLS_PATH/gcc$gcc_version/isl/lib:$BUILD_TOOLS_PATH/gcc$gcc_version/mpc/lib/:$BUILD_TOOLS_PATH/gcc$gcc_version/mpfr/lib/:$BUILD_TOOLS_PATH/gcc$gcc_version/gmp/lib/:$LD_LIBRARY_PATH
export PATH=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin:$PATH
jdkpath=${binarylib_dir}/platform/huaweijdk8/${PLATFORM_ARCH}/jdk
if [ ! -d "${jdkpath}" ]; then
jdkpath=${binarylib_dir}/platform/openjdk8/${PLATFORM_ARCH}/jdk
fi
export JAVA_HOME=${jdkpath}
declare p7zpath="${BUILD_TOOLS_PATH}/p7z/bin"
###################################
# build parameter about enable-llt
##################################
echo "[makemppdb] $(date +%y-%m-%d' '%T): Work root dir : ${ROOT_DIR}"
###################################
# get version number from globals.cpp
##################################
function read_mpp_number()
{
global_kernal="${ROOT_DIR}/src/common/backend/utils/init/globals.cpp"
version_name="GRAND_VERSION_NUM"
version_num=""
line=$(cat $global_kernal | grep ^const* | grep $version_name)
version_num1=${line#*=}
#remove the symbol;
version_num=$(echo $version_num1 | tr -d ";")
#remove the blank
version_num=$(echo $version_num)
if echo $version_num | grep -qE '^92[0-9]+$'
then
# get the last three number
latter=${version_num:2}
echo "92.${latter}" >>${SCRIPT_DIR}/version.cfg
else
echo "Cannot get the version number from globals.cpp."
exit 1
fi
}
read_mpp_number
#######################################################################
# Print log.
#######################################################################
log()
{
echo "[makegaussdb] $(date +%y-%m-%d' '%T): $@"
echo "[makegaussdb] $(date +%y-%m-%d' '%T): $@" >> "$LOG_FILE" 2>&1
}
#######################################################################
# print log and exit.
#######################################################################
die()
{
log "$@"
echo "$@"
exit $ERR_MKGS_FAILED
}
#######################################################################
## Check the installation package production environment
#######################################################################
function mpp_pkg_pre_check()
{
if [ -d "$BUILD_DIR" ]; then
rm -rf $BUILD_DIR
fi
if [ -d "$LOG_FILE" ]; then
rm -rf $LOG_FILE
fi
}
#######################################################################
# Install all SQL files from distribute/include/catalog/upgrade_sql
# to INSTALL_DIR/bin/script/upgrade_sql.
# Package all SQL files and then verify them with SHA256.
#######################################################################
function package_upgrade_sql()
{
echo "Begin to install upgrade_sql files..."
UPGRADE_SQL_TAR="upgrade_sql.tar.gz"
UPGRADE_SQL_SHA256="upgrade_sql.sha256"
MULTIP_IGNORE_VERSION=(289 294 296)
cp -r "${UPGRADE_SQL_DIR}" .
[ $? -ne 0 ] && die "Failed to cp upgrade_sql files"
tar -czf ${UPGRADE_SQL_TAR} upgrade_sql
[ $? -ne 0 ] && die "Failed to package ${UPGRADE_SQL_TAR}"
rm -rf ./upgrade_sql > /dev/null 2>&1
sha256sum ${UPGRADE_SQL_TAR} | awk -F" " '{print $1}' > "${UPGRADE_SQL_SHA256}"
[ $? -ne 0 ] && die "Failed to generate sha256 sum file for ${UPGRADE_SQL_TAR}"
chmod 600 ${UPGRADE_SQL_TAR}
chmod 600 ${UPGRADE_SQL_SHA256}
echo "Successfully packaged upgrade_sql files."
}
#######################################################################
##install gaussdb database and others
##select to install something according to variables package_type need
#######################################################################
function mpp_pkg_bld()
{
install_gaussdb
}
#######################################################################
##install gaussdb database contained server,client and libpq
#######################################################################
function install_gaussdb()
{
# Generate the license control file, and set md5sum string to the code.
echo "Modify gaussdb_version.cpp file." >> "$LOG_FILE" 2>&1
echo "Modify gaussdb_version.cpp file success." >> "$LOG_FILE" 2>&1
cd "$ROOT_DIR/"
if [ $? -ne 0 ]; then
die "change dir to $SRC_DIR failed."
fi
if [ "$version_mode" = "debug" -a "$separate_symbol" = "on" ]; then
echo "WARNING: do not separate symbol in debug mode!"
fi
binarylibs_path=${ROOT_DIR}/binarylibs
if [ "${binarylib_dir}"x != "None"x ]; then
binarylibs_path=${binarylib_dir}
fi
export BUILD_TUPLE=${PLATFORM_ARCH}
export THIRD_BIN_PATH="${binarylibs_path}"
export PREFIX_HOME="${BUILD_DIR}"
if [ "$version_mode"x == "release"x ]; then
CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON"
export DEBUG_TYPE=release
elif [ "$version_mode"x == "memcheck"x ]; then
CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON"
export DEBUG_TYPE=memcheck
else
CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON"
export DEBUG_TYPE=debug
fi
echo "Begin run cmake for gaussdb server" >> "$LOG_FILE" 2>&1
echo "CMake options: ${CMAKE_OPT}" >> "$LOG_FILE" 2>&1
echo "CMake release: ${DEBUG_TYPE}" >> "$LOG_FILE" 2>&1
export GAUSSHOME=${BUILD_DIR}
export LD_LIBRARY_PATH=${BUILD_DIR}/lib:${BUILD_DIR}/lib/postgresql:${LD_LIBRARY_PATH}
cd ${ROOT_DIR}
[ -d "${CMAKE_BUILD_DIR}" ] && rm -rf ${CMAKE_BUILD_DIR}
[ -d "${BUILD_DIR}" ] && rm -rf ${BUILD_DIR}
mkdir -p ${CMAKE_BUILD_DIR}
cd ${CMAKE_BUILD_DIR}
cmake .. ${CMAKE_OPT}
echo "Begin make and install gaussdb server" >> "$LOG_FILE" 2>&1
make VERBOSE=1 -sj ${cpus_num}
if [ $? -ne 0 ]; then
die "make failed."
fi
make install -sj ${cpus_num}
if [ $? -ne 0 ]; then
die "make install failed."
fi
## check build specification
spec="gaussdbkernel"
if ( cat $SCRIPT_DIR/gauss.spec | grep 'PRODUCT' | grep 'GaussDB Kernel' >/dev/null 2>&1 ); then
spec="gaussdbkernel"
elif ( cat $SCRIPT_DIR/gauss.spec | grep 'PRODUCT' | grep 'openGauss' >/dev/null 2>&1 ); then
spec="opengauss"
fi
chmod 444 ${BUILD_DIR}/bin/cluster_guc.conf
dos2unix ${BUILD_DIR}/bin/cluster_guc.conf > /dev/null 2>&1
#back to separate_debug_symbol.sh dir
cd $SCRIPT_DIR
if [ "$version_mode" = "release" -a "$separate_symbol" = "on" -a "$zip_package" = "on" ]; then
chmod +x ./separate_debug_information.sh
./separate_debug_information.sh
cd $SCRIPT_DIR
mv symbols.tar.gz $symbol_package_name
fi
#back to root dir
cd $ROOT_DIR
#insert the commitid to version.cfg as the upgrade app path specification
export PATH=${BUILD_DIR}:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
commitid=$(LD_PRELOAD='' ${BUILD_DIR}/bin/gaussdb -V | cut -d ")" -f 1 | awk '{print $NF}')
echo "${commitid}" >>${SCRIPT_DIR}/version.cfg
echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1
cp ${BINARYLIBS_PATH}/${PLAT_FORM_STR}/iperf/comm/bin/iperf3 ${BUILD_DIR}/bin
if [ $? -ne 0 ]; then
die "cp ${BINARYLIBS_PATH}/${PLAT_FORM_STR}/iperf/comm/bin/iperf3 ${BUILD_DIR}/bin failed"
fi
cp ${BINARYLIBS_PATH}/${PLAT_FORM_STR}/iperf/comm/lib/libiperf.so.0 ${BUILD_DIR}/lib
if [ $? -ne 0 ]; then
die "cp ${BINARYLIBS_PATH}/${PLAT_FORM_STR}/iperf/comm/lib/libiperf.so.0 ${BUILD_DIR}/lib failed"
fi
cp ${BINARYLIBS_PATH}/${PLAT_FORM_STR}/fio/comm/bin/fio ${BUILD_DIR}/bin
if [ $? -ne 0 ]; then
die "cp ${BINARYLIBS_PATH}/${PLAT_FORM_STR}/fio/comm/bin/fio ${BUILD_DIR}/bin failed"
fi
}
#######################################################################
##select package type according to variable package_type
#######################################################################
function mpp_pkg_make()
{
case "$package_type" in
server)
echo "file list: $release_file_list"
make_package $release_file_list 'server'
make_package $release_file_list 'libpq'
;;
libpq)
make_package $release_file_list 'libpq'
;;
esac
}
declare package_command
#######################################################################
##select package command accroding to install_package_format
#######################################################################
function select_package_command()
{
case "$install_package_format" in
tar)
tar='tar'
option=' -zcvf'
package_command="$tar$option"
;;
rpm)
rpm='rpm'
option=' -i'
package_command="$rpm$option"
;;
esac
}
###############################################################
## client tools package
## Roach no
## sslcert no
## Data Studio no
## Database Manager no
## Migration Toolkit no
## Cluster Configuration Assistant (CCA) no
## CAT no
###############################################################
function target_file_copy_for_non_server()
{
for file in $(echo $1)
do
tar -cpf - $file | ( cd $2; tar -xpf - )
done
}
declare bin_name="${package_pre_name}.bin"
declare sha256_name=''
declare script_dir="${ROOT_DIR}/script"
#######################################################################
##copy target file into temporary directory temp
#######################################################################
function target_file_copy()
{
###################################################
# make bin package
###################################################
for file in $(echo $1)
do
tar -cpf - $file | ( cd $2; tar -xpf - )
done
cd $BUILD_DIR
if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then
# do nothing in current version
echo ""
else
sed -i '/^process_cpu_affinity|/d' $2/bin/cluster_guc.conf
fi
if [ "$(ls -A /lib64/libaio.so*)" != "" ]
then
cp /lib64/libaio.so* $2/lib/
elif [ "$(ls -A /lib/libaio.so*)" != "" ]
then
cp /lib/libaio.so* $2/lib/
fi
if [ "$(ls -A /lib64/libnuma.so*)" != "" ]
then
cp /lib64/libnuma.so* $2/lib/
elif [ "$(ls -A /lib/libnuma.so*)" != "" ]
then
cp /lib/libnuma.so* $2/lib/
fi
#generate bin file
echo "Begin generate ${bin_name} bin file..." >> "$LOG_FILE" 2>&1
curpath=$(pwd)
cd $2
tar -zcf ${curpath}/${bin_name} . >> "$LOG_FILE" 2>&1
cd ${curpath}
if [ $? -ne 0 ]; then
echo "Please check and makesure '7z' exist. "
die "generate ${bin_name} failed."
fi
echo "End generate ${bin_name} bin file" >> "$LOG_FILE" 2>&1
#generate sha256 file
sha256_name="${package_pre_name}.sha256"
echo "Begin generate ${sha256_name} sha256 file..." >> "$LOG_FILE" 2>&1
sha256sum "${bin_name}" | awk -F" " '{print $1}' > "$sha256_name"
if [ $? -ne 0 ]; then
die "generate sha256 file failed."
fi
echo "End generate ${sha256_name} sha256 file" >> "$LOG_FILE" 2>&1
cp $2/lib/libstdc++.so.6 ./
###################################################
# make server package
###################################################
if [ -d "${2}" ]; then
rm -rf ${2}
fi
mkdir -p ${2}
mkdir -p $2/dependency
cp libstdc++.so.6 $2/dependency
mv ${bin_name} ${sha256_name} $2
}
#######################################################################
##function make_package have three actions
##1.parse release_file_list variable represent file
##2.copy target file into a newly created temporary directory temp
##3.package all file in the temp directory and renome to destination package_path
#######################################################################
function make_package()
{
cd $SCRIPT_DIR
releasefile=$1
pkgname=$2
local head=$(cat $releasefile | grep "\[$pkgname\]" -n | awk -F: '{print $1}')
if [ ! -n "$head" ]; then
die "error: ono find $pkgname in the $releasefile file "
fi
local tail=$(cat $releasefile | sed "1,$head d" | grep "^\[" -n | sed -n "1p" | awk -F: '{print $1}')
if [ ! -n "$tail" ]; then
local all=$(cat $releasefile | wc -l)
let tail=$all+1-$head
fi
dest=$(cat $releasefile | awk "NR==$head+1,NR==$tail+$head-1")
if [ "$pkgname"x = "libpq"x -a \( "$version_mode" = "debug" -o "$version_mode" = "release" \) ]; then
# copy include file
head=$(cat $releasefile | grep "\[header\]" -n | awk -F: '{print $1}')
if [ ! -n "$head" ]; then
die "error: ono find header in the $releasefile file "
fi
tail=$(cat $releasefile | sed "1,$head d" | grep "^\[" -n | sed -n "1p" | awk -F: '{print $1}')
if [ ! -n "$tail" ]; then
all=$(cat $releasefile | wc -l)
let tail=$all+1-$head
fi
dest1=$(cat $releasefile | awk "NR==$head+1,NR==$tail+$head-1")
dest=$(echo "$dest";echo "$dest1")
fi
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
rm -rf temp
mkdir temp
case "$pkgname" in
server)
mkdir -p ${BUILD_DIR}/temp/etc
target_file_copy "$dest" ${BUILD_DIR}/temp
;;
*)
target_file_copy_for_non_server "$dest" ${BUILD_DIR}/temp $pkgname
;;
esac
cd ${BUILD_DIR}/temp
select_package_command
case "$pkgname" in
server)
echo "packaging server..."
cp ${SCRIPT_DIR}/version.cfg ${BUILD_DIR}/temp
if [ $? -ne 0 ]; then
die "copy ${SCRIPT_DIR}/version.cfg to ${BUILD_DIR}/temp failed"
fi
cp ${ROOT_DIR}/${open_gauss}/liteom/install.sh ./
if [ $? -ne 0 ]
then
die "copy ${ROOT_DIR}/${open_gauss}/liteom/install.sh to ${BUILD_DIR}/temp failed"
fi
cp ${ROOT_DIR}/${open_gauss}/liteom/uninstall.sh ./
if [ $? -ne 0 ]
then
die "copy ${ROOT_DIR}/${open_gauss}/liteom/uninstall.sh to ${BUILD_DIR}/temp failed"
fi
cp ${ROOT_DIR}/${open_gauss}/liteom/opengauss_lite.conf ./
if [ $? -ne 0 ]
then
die "copy ${ROOT_DIR}/${open_gauss}/liteom/opengauss_lite.conf to ${BUILD_DIR}/temp failed"
fi
# pkg upgrade scripts:upgrade_GAUSSV5.sh, upgrade_common.sh, upgrade_config.sh, upgrade_errorcode.sh
for filename in upgrade_GAUSSV5.sh upgrade_common.sh upgrade_config.sh upgrade_errorcode.sh
do
if ! cp ${ROOT_DIR}/${open_gauss}/liteom/${filename} ./ ; then
die "copy ${ROOT_DIR}/${open_gauss}/liteom/${filename} to ${BUILD_DIR}/temp failed"
fi
done
# install upgrade_sql.* files.
package_upgrade_sql
$package_command "${server_package_name}" ./* >>"$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "$package_command ${server_package_name} failed"
fi
mv ${server_package_name} ${package_path}
echo "install $pkgname tools is ${server_package_name} of ${package_path} directory " >> "$LOG_FILE" 2>&1
echo "success!"
;;
libpq)
echo "packaging libpq..."
$package_command "${libpq_package_name}" ./* >>"$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "$package_command ${libpq_package_name} failed"
fi
mv ${libpq_package_name} ${package_path}
echo "install $pkgname tools is ${libpq_package_name} of ${package_path} directory " >> "$LOG_FILE" 2>&1
echo "success!"
;;
esac
}
#############################################################
# show package for hotpatch sdv.
#############################################################
if [ "$show_package" = true ]; then
echo "package: "$server_package_name
echo "bin: "$bin_name
exit 0
fi
#############################################################
# main function
#############################################################
# 1. clean install path and log file
mpp_pkg_pre_check
# 2. chose action
mpp_pkg_bld
if [ "$zip_package" = "off" ]; then
echo "The option 'nopkg' is on, no package will be zipped."
exit 0
fi
# 3. make package
mpp_pkg_make
#clean mpp_install directory
echo "clean enviroment"
echo "[makemppdb] $(date +%y-%m-%d' '%T): remove ${BUILD_DIR}" >>"$LOG_FILE" 2>&1
mkdir ${ROOT_DIR}/output
mv ${ROOT_DIR}/build/script/*.tar.gz ${ROOT_DIR}/output/
echo "now, all packages has finished!"
exit 0

2
build/script/gauss.spec Normal file
View File

@ -0,0 +1,2 @@
PRODUCT=GaussDB Kernel
VERSION=V500R002C00

80
build/script/gsql_env.sh Normal file
View File

@ -0,0 +1,80 @@
#!/bin/bash
#-----------------------------------------------------
#Copyright (c): 2020, Huawei Tech. Co., Ltd.
#FileName : gsql_env.sh
#Version : V500R001C10
#Date : 2020-08-06
#Description : This file is to configure environment variables of gsql
#-----------------------------------------------------
#find the absolute path of this script
LOCAL_PATH=${0}
if [ x${LOCAL_PATH:0:1} = "x-" ] || [ "x${LOCAL_PATH}" = "x/bin/bash" ] || [ "x${LOCAL_PATH}" = "x/bin/sh" ]; then
LOCAL_PATH="$(pwd)"
elif [ x${LOCAL_PATH:0:1} != "x/" ]; then
LOCAL_PATH="$(pwd)/$(dirname ${LOCAL_PATH})";
fi
function logerr()
{
printf "ERROR: $* \n" >&2
}
function loghint()
{
printf "HINT: $* \n" >&2
}
function logwarning()
{
printf "WARNING: $* \n" >&2
}
function doing()
{
length_of_line=60
printf "$1 ";
for ((i=${#1};i<$length_of_line;i++)); do
printf '.';
done;
printf " "
}
#------------------------------
# gsql things
#------------------------------
function cofig_gsql_and_gs_ktool()
{
doing 'Configuring LD_LIBRARY_PATH, PATH and GS_KTOOL_FILE_PATH for gsql and gs_ktool...'
LIB_PATH="${LOCAL_PATH}/lib"
BIN_PATH="${LOCAL_PATH}/bin"
GS_KT_FILE_PATH="${LOCAL_PATH}/gs_ktool_file"
if [ ! -f "${LOCAL_PATH}/bin/gsql" ]; then
logerr "failed to locate ./bin/gsql, please source this file at the path where it is. "
return 1;
fi;
if [ ! -f "${LOCAL_PATH}/bin/gs_ktool" ]; then
logerr "failed to locate ./bin/gs_ktool, please source this file at the path where it is. "
return 1;
fi;
if [ ! -f "${LOCAL_PATH}/gs_ktool_file/gs_ktool_conf.ini" ]; then
logerr "failed to locate ./gs_ktool_file/gs_ktool_con.ini, please source this file at the path where it is. "
return 1;
fi;
export LD_LIBRARY_PATH=${LIB_PATH}:${LD_LIBRARY_PATH}
export PATH=${BIN_PATH}:${PATH}
export GS_KTOOL_FILE_PATH=${GS_KT_FILE_PATH}
echo 'done'
return 0
}
if [ ! -z "$1" ]; then
echo "Usage:"
echo " source $0"
else
cofig_gsql_and_gs_ktool
if [ 0 -eq $? ]; then
echo 'All things done.'
fi
fi

5
build/script/mppdb.ver Normal file
View File

@ -0,0 +1,5 @@
V=100
R=003
C=00
OfficialVersion=
InternalVersion=B100

View File

@ -1,2 +1,2 @@
PRODUCT=openGauss
VERSION=3.0.0
VERSION=2.1.0

View File

@ -35,10 +35,8 @@
./bin/lz4
./bin/kadmind
./bin/dbmind
./bin/gs_dbmind
./bin/server.key.cipher
./bin/server.key.rand
./bin/gs_plan_simulator.sh
./etc/kerberos/kadm5.acl
./etc/kerberos/kdc.conf
./etc/kerberos/krb5.conf
@ -751,7 +749,6 @@
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/postgresql/pgoutput.so
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
@ -825,7 +822,9 @@
./lib/libverto.so
./lib/libverto.so.0
./lib/libverto.so.0.0
./lib/libcurl.so*
./lib/libcurl.so
./lib/libcurl.so.4
./lib/libcurl.so.4.6.0
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libssl.so
@ -838,7 +837,9 @@
./lib/liblz4.so
./lib/liblz4.so.1
./lib/liblz4.so.1.9.2
./lib/libcjson.so*
./lib/libcjson.so
./lib/libcjson.so.1
./lib/libcjson.so.1.7.13
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libpgport_tool.so
@ -846,13 +847,25 @@
./share/llvmir/GaussDB_expr.ir
./lib/libeSDKLogAPI.so
./lib/libeSDKOBS.so
./lib/liblog4cpp.so*
./lib/libcharset.so*
./lib/libiconv.so*
./lib/libnghttp2.so*
./lib/libpcre.so*
./lib/liblog4cpp.so
./lib/liblog4cpp.so.5
./lib/liblog4cpp.so.5.0.6
./lib/libcharset.so
./lib/libcharset.so.1
./lib/libcharset.so.1.0.0
./lib/libiconv.so
./lib/libiconv.so.2
./lib/libiconv.so.2.6.1
./lib/libnghttp2.so
./lib/libnghttp2.so.14
./lib/libnghttp2.so.14.20.0
./lib/libpcre.so
./lib/libpcre.so.1
./lib/libpcre.so.1.2.12
./lib/libsecurec.so
./lib/libxml2.so*
./lib/libxml2.so
./lib/libxml2.so.2
./lib/libxml2.so.2.9.9
./lib/libparquet.so
./lib/libparquet.so.14
./lib/libparquet.so.14.1.0
@ -865,10 +878,9 @@
./lib/libdcf.so
./lib/libzstd.so
./lib/libzstd.so.1
./lib/libzstd.so.1.5.0
./lib/libxgboost.so
./lib/libpagecompression.so
./lib/libpagecompression.so.1
./lib/libzstd.so.1.4.4
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h
./include/postgresql/server/pgtime.h
@ -962,7 +974,6 @@
./include/postgresql/server/utils/aset.h
./include/postgresql/server/utils/catcache.h
./include/postgresql/server/utils/atomic_arm.h
./include/postgresql/server/utils/oidrbtree.h
./include/postgresql/server/datatype/timestamp.h
./include/postgresql/server/access/rmgr.h
./include/postgresql/server/access/xlogreader.h
@ -974,7 +985,6 @@
./include/postgresql/server/access/attnum.h
./include/postgresql/server/access/tupmacs.h
./include/postgresql/server/access/xlogrecord.h
./include/postgresql/server/tde_key_management/data_common.h
./include/postgresql/server/tcop/dest.h
./include/postgresql/server/catalog/pg_type.h
./include/postgresql/server/catalog/pg_attribute.h
@ -996,9 +1006,8 @@
./include/postgresql/server/storage/item/itemptr.h
./include/postgresql/server/storage/lock/s_lock.h
./include/postgresql/server/storage/backendid.h
./include/postgresql/server/storage/lock.h
./include/postgresql/server/storage/lwlock.h
./include/postgresql/server/storage/lwlocknames.h
./include/postgresql/server/storage/lock/lock.h
./include/postgresql/server/storage/lock/lwlock.h
./include/postgresql/server/storage/barrier.h
./include/postgresql/server/storage/shmem.h
./include/postgresql/server/pg_config.h
@ -1160,25 +1169,6 @@
./include/postgresql/server/catalog/namespace.h
./include/postgresql/server/commands/trigger.h
./include/postgresql/server/executor/spi.h
./include/postgresql/server/access/ustore/undo/knl_uundotype.h
./include/postgresql/server/access/ustore/undo/knl_uundoapi.h
./include/postgresql/server/access/ustore/knl_uheap.h
./include/postgresql/server/access/ustore/knl_utuple.h
./include/postgresql/server/access/ustore/knl_utype.h
./include/postgresql/server/access/ustore/knl_upage.h
./include/postgresql/server/access/ustore/knl_uredo.h
./include/postgresql/server/access/ustore/knl_uundovec.h
./include/postgresql/server/access/ustore/knl_uundorecord.h
./include/postgresql/server/access/ustore/undo/knl_uundoxlog.h
./include/postgresql/server/access/ustore/undo/knl_uundotxn.h
./include/postgresql/server/access/ustore/undo/knl_uundozone.h
./include/postgresql/server/access/ustore/undo/knl_uundospace.h
./include/postgresql/server/communication/commproxy_basic.h
./include/postgresql/server/access/parallel_recovery/page_redo.h
./include/postgresql/server/access/parallel_recovery/spsc_blocking_queue.h
./include/postgresql/server/executor/exec/execdesc.h
./include/postgresql/server/db4ai/matrix.h
./include/postgresql/server/db4ai/scores.h
./jre/ASSEMBLY_EXCEPTION
./jre/bin/java
./jre/bin/jjs
@ -1433,6 +1423,8 @@
./include/libpq-fe.h
./include/libpq-events.h
./include/libpq/libpq-fs.h
[version]
V500R002C00
[header]
./include/libpq-fe.h
./include/postgres_ext.h
@ -1444,6 +1436,9 @@
./include/cm_config.h
./include/c.h
./include/port.h
./include/cm_msg.h
./include/cm_c.h
./include/cm_misc.h
./include/libpq-int.h
./include/pqcomm.h
./include/pqexpbuffer.h

View File

@ -35,10 +35,8 @@
./bin/lz4
./bin/kadmind
./bin/dbmind
./bin/gs_dbmind
./bin/server.key.cipher
./bin/server.key.rand
./bin/gs_plan_simulator.sh
./etc/kerberos/kadm5.acl
./etc/kerberos/kdc.conf
./etc/kerberos/krb5.conf
@ -751,7 +749,6 @@
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/postgresql/pgoutput.so
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
@ -825,7 +822,9 @@
./lib/libverto.so
./lib/libverto.so.0
./lib/libverto.so.0.0
./lib/libcurl.so*
./lib/libcurl.so
./lib/libcurl.so.4
./lib/libcurl.so.4.6.0
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libssl.so
@ -838,7 +837,9 @@
./lib/liblz4.so
./lib/liblz4.so.1
./lib/liblz4.so.1.9.2
./lib/libcjson.so*
./lib/libcjson.so
./lib/libcjson.so.1
./lib/libcjson.so.1.7.13
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libpgport_tool.so
@ -846,13 +847,25 @@
./share/llvmir/GaussDB_expr.ir
./lib/libeSDKLogAPI.so
./lib/libeSDKOBS.so
./lib/liblog4cpp.so*
./lib/libcharset.so*
./lib/libiconv.so*
./lib/libnghttp2.so*
./lib/libpcre.so*
./lib/liblog4cpp.so
./lib/liblog4cpp.so.5
./lib/liblog4cpp.so.5.0.6
./lib/libcharset.so
./lib/libcharset.so.1
./lib/libcharset.so.1.0.0
./lib/libiconv.so
./lib/libiconv.so.2
./lib/libiconv.so.2.6.1
./lib/libnghttp2.so
./lib/libnghttp2.so.14
./lib/libnghttp2.so.14.20.0
./lib/libpcre.so
./lib/libpcre.so.1
./lib/libpcre.so.1.2.12
./lib/libsecurec.so
./lib/libxml2.so*
./lib/libxml2.so
./lib/libxml2.so.2
./lib/libxml2.so.2.9.9
./lib/libparquet.so
./lib/libparquet.so.14
./lib/libparquet.so.14.1.0
@ -865,10 +878,7 @@
./lib/libdcf.so
./lib/libzstd.so
./lib/libzstd.so.1
./lib/libzstd.so.1.5.0
./lib/libxgboost.so
./lib/libpagecompression.so
./lib/libpagecompression.so.1
./lib/libzstd.so.1.4.4
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h
@ -963,7 +973,6 @@
./include/postgresql/server/utils/aset.h
./include/postgresql/server/utils/catcache.h
./include/postgresql/server/utils/atomic_arm.h
./include/postgresql/server/utils/oidrbtree.h
./include/postgresql/server/datatype/timestamp.h
./include/postgresql/server/access/rmgr.h
./include/postgresql/server/access/xlogreader.h
@ -975,7 +984,6 @@
./include/postgresql/server/access/attnum.h
./include/postgresql/server/access/tupmacs.h
./include/postgresql/server/access/xlogrecord.h
./include/postgresql/server/tde_key_management/data_common.h
./include/postgresql/server/tcop/dest.h
./include/postgresql/server/catalog/pg_type.h
./include/postgresql/server/catalog/pg_attribute.h
@ -999,7 +1007,6 @@
./include/postgresql/server/storage/backendid.h
./include/postgresql/server/storage/lock/lock.h
./include/postgresql/server/storage/lock/lwlock.h
./include/postgresql/server/storage/lwlocknames.h
./include/postgresql/server/storage/barrier.h
./include/postgresql/server/storage/shmem.h
./include/postgresql/server/pg_config.h
@ -1161,25 +1168,6 @@
./include/postgresql/server/catalog/namespace.h
./include/postgresql/server/commands/trigger.h
./include/postgresql/server/executor/spi.h
./include/postgresql/server/access/ustore/undo/knl_uundotype.h
./include/postgresql/server/access/ustore/undo/knl_uundoapi.h
./include/postgresql/server/access/ustore/knl_uheap.h
./include/postgresql/server/access/ustore/knl_utuple.h
./include/postgresql/server/access/ustore/knl_utype.h
./include/postgresql/server/access/ustore/knl_upage.h
./include/postgresql/server/access/ustore/knl_uredo.h
./include/postgresql/server/access/ustore/knl_uundovec.h
./include/postgresql/server/access/ustore/knl_uundorecord.h
./include/postgresql/server/access/ustore/undo/knl_uundoxlog.h
./include/postgresql/server/access/ustore/undo/knl_uundotxn.h
./include/postgresql/server/access/ustore/undo/knl_uundozone.h
./include/postgresql/server/access/ustore/undo/knl_uundospace.h
./include/postgresql/server/communication/commproxy_basic.h
./include/postgresql/server/access/parallel_recovery/page_redo.h
./include/postgresql/server/access/parallel_recovery/spsc_blocking_queue.h
./include/postgresql/server/executor/exec/execdesc.h
./include/postgresql/server/db4ai/matrix.h
./include/postgresql/server/db4ai/scores.h
./jre/ASSEMBLY_EXCEPTION
./jre/bin/java
./jre/bin/jjs
@ -1434,6 +1422,8 @@
./include/libpq-fe.h
./include/libpq-events.h
./include/libpq/libpq-fs.h
[version]
V500R002C00
[header]
./include/libpq-fe.h
./include/postgres_ext.h
@ -1445,6 +1435,9 @@
./include/cm_config.h
./include/c.h
./include/port.h
./include/cm_msg.h
./include/cm_c.h
./include/cm_misc.h
./include/libpq-int.h
./include/pqcomm.h
./include/pqexpbuffer.h

View File

@ -2,21 +2,46 @@
./bin/gsql
./bin/gaussdb
./bin/gstrace
./bin/gs_basebackup
./bin/gs_probackup
./bin/gs_tar
./bin/gs_encrypt
./bin/gs_dump
./bin/gs_dumpall
./bin/gs_ctl
./bin/gs_initdb
./bin/gs_guc
./bin/encrypt
./bin/openssl
./bin/gs_restore
./bin/gs_cgroup
./bin/openssl
./bin/pg_config
./bin/pg_controldata
./bin/gs_probackup
./bin/pg_format_cu
./bin/pg_resetxlog
./bin/pg_recvlogical
./bin/alarmItem.conf
./bin/retry_errcodes.conf
./bin/cluster_guc.conf
./bin/bind_net_irq.sh
./bin/setArmOptimization.sh
./bin/krb5kdc
./bin/klist
./bin/kinit
./bin/kdestroy
./bin/kdb5_util
./bin/kadmin.local
./bin/lz4
./bin/gs_plan_simulator.sh
./bin/kadmind
./bin/dbmind
./bin/server.key.cipher
./bin/server.key.rand
./etc/kerberos/kadm5.acl
./etc/kerberos/kdc.conf
./etc/kerberos/krb5.conf
./etc/kerberos/mppdb-site.xml
./share/postgresql/tmp/udstools.py
./share/postgresql/db4ai
./share/postgresql/snowball_create.sql
./share/postgresql/pg_hba.conf.sample
@ -28,6 +53,7 @@
./share/postgresql/pg_ident.conf.sample
./share/postgresql/postgres.description
./share/postgresql/postgresql.conf.sample
./share/postgresql/mot.conf.sample
./share/postgresql/extension/plpgsql--1.0.sql
./share/postgresql/extension/hstore.control
./share/postgresql/extension/security_plugin.control
@ -45,6 +71,8 @@
./share/postgresql/extension/hdfs_fdw.control
./share/postgresql/extension/log_fdw--1.0.sql
./share/postgresql/extension/log_fdw.control
./share/postgresql/extension/mot_fdw--1.0.sql
./share/postgresql/extension/mot_fdw.control
./share/postgresql/extension/postgres_fdw--1.0.sql
./share/postgresql/extension/postgres_fdw.control
./share/postgresql/timezone/GB-Eire
@ -253,6 +281,7 @@
./share/postgresql/timezone/Canada/Newfoundland
./share/postgresql/timezone/Canada/Saskatchewan
./share/postgresql/timezone/Canada/Pacific
./share/postgresql/timezone/Canada/East-Saskatchewan
./share/postgresql/timezone/Canada/Mountain
./share/postgresql/timezone/Canada/Central
./share/postgresql/timezone/CST6CDT
@ -634,6 +663,7 @@
./share/postgresql/timezone/Navajo
./share/postgresql/timezone/GMT
./share/postgresql/system_views.sql
./share/postgresql/private_system_views.sql
./share/postgresql/performance_views.sql
./share/postgresql/sql_features.txt
./share/postgresql/pg_cast_oid.txt
@ -672,47 +702,11 @@
./share/postgresql/timezonesets/Default
./share/postgresql/timezonesets/Etc.txt
./share/postgresql/postgres.bki
./share/llvmir/GaussDB_expr.ir
./share/sslcert/gsql/openssl.cnf
./share/sslcert/grpc/openssl.cnf
./lib/libnuma.so
./lib/libnuma.so.1
./lib/libnuma.so.1.0.0
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libcgroup.so
./lib/libcgroup.so.1
./lib/libz.so
./lib/libz.so.1
./lib/libz.so.1.2.11
./lib/liblz4.so
./lib/liblz4.so.1
./lib/liblz4.so.1.9.2
./lib/libcjson.so
./lib/libcjson.so.1
./lib/libcjson.so.1.7.14
./lib/libcjson_utils.so
./lib/libcjson_utils.so.1
./lib/libcjson_utils.so.1.7.14
./lib/libstdc++.so.6
./lib/libgcc_s.so.1
./lib/libgomp.so
./lib/libgomp.so.1
./lib/libgomp.so.1.0.0
./lib/libdcf.so
./lib/libzstd.so
./lib/libzstd.so.1
./lib/libzstd.so.1.5.0
./lib/libcurl.so
./lib/libcurl.so.4
./lib/libcurl.so.4.7.0
./lib/libxgboost.so
./lib/libpagecompression.so
./lib/libpagecompression.so.1
./share/sslcert/om/openssl.cnf
./lib/libsimsearch/
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/postgresql/euc_kr_and_mic.so
@ -721,6 +715,12 @@
./lib/postgresql/cyrillic_and_mic.so
./lib/postgresql/utf8_and_johab.so
./lib/postgresql/utf8_and_gb18030.so
./lib/postgresql/pgxs/src/makefiles/pgxs.mk
./lib/postgresql/pgxs/src/Makefile.shlib
./lib/postgresql/pgxs/src/Makefile.port
./lib/postgresql/pgxs/src/nls-global.mk
./lib/postgresql/pgxs/src/Makefile.global
./lib/postgresql/pgxs/src/get_PlatForm_str.sh
./lib/postgresql/pgxs/config/install-sh
./lib/postgresql/euc_cn_and_mic.so
./lib/postgresql/latin_and_mic.so
@ -746,9 +746,140 @@
./lib/postgresql/pg_plugin
./lib/postgresql/proc_srclib
./lib/postgresql/security_plugin.so
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libpq_ce.so
./lib/libpq_ce.so.5
./lib/libpq_ce.so.5.5
./lib/libgauss_cl_jni.so
./lib/libcgroup.so
./lib/libcgroup.so.1
./lib/libcom_err_gauss.so
./lib/libcom_err_gauss.so.3
./lib/libcom_err_gauss.so.3.0
./lib/libatomic.so
./lib/libatomic.so.1
./lib/libatomic.so.1.2.0
./lib/libmasstree.so
./lib/libupb.so
./lib/libupb.so.9
./lib/libupb.so.9.0.0
./lib/libabsl_str_format_internal.so
./lib/libabsl_strings.so
./lib/libabsl_throw_delegate.so
./lib/libabsl_strings_internal.so
./lib/libabsl_base.so
./lib/libabsl_dynamic_annotations.so
./lib/libabsl_spinlock_wait.so
./lib/libabsl_int128.so
./lib/libabsl_bad_optional_access.so
./lib/libabsl_raw_logging_internal.so
./lib/libabsl_log_severity.so
./lib/libaddress_sorting.so
./lib/libaddress_sorting.so.9
./lib/libgssapi_krb5_gauss.so
./lib/libgssapi_krb5_gauss.so.2
./lib/libgssapi_krb5_gauss.so.2.2
./lib/libgssrpc_gauss.so
./lib/libgssrpc_gauss.so.4
./lib/libgssrpc_gauss.so.4.2
./lib/libk5crypto_gauss.so
./lib/libk5crypto_gauss.so.3
./lib/libk5crypto_gauss.so.3.1
./lib/libkadm5clnt.so
./lib/libkadm5clnt_mit.so
./lib/libkadm5clnt_mit.so.11
./lib/libkadm5clnt_mit.so.11.0
./lib/libkadm5clnt_mit.so.12
./lib/libkadm5clnt_mit.so.12.0
./lib/libkadm5srv.so
./lib/libkadm5srv_mit.so
./lib/libkadm5srv_mit.so.11
./lib/libkadm5srv_mit.so.11.0
./lib/libkadm5srv_mit.so.12
./lib/libkadm5srv_mit.so.12.0
./lib/libkdb5.so
./lib/libkdb5.so.9
./lib/libkdb5.so.9.0
./lib/libkdb5.so.10
./lib/libkdb5.so.10.0
./lib/libkrad.so
./lib/libkrad.so.0
./lib/libkrad.so.0.0
./lib/libkrb5_gauss.so
./lib/libkrb5_gauss.so.3
./lib/libkrb5_gauss.so.3.3
./lib/libkrb5support_gauss.so
./lib/libkrb5support_gauss.so.0
./lib/libkrb5support_gauss.so.0.1
./lib/krb5/plugins/kdb/db2.so
./lib/libverto.so
./lib/libverto.so.0
./lib/libverto.so.0.0
./lib/libcurl.so
./lib/libcurl.so.4
./lib/libcurl.so.4.6.0
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libgcc_s.so.1
./lib/libstdc++.so.6
./lib/libz.so
./lib/libz.so.1
./lib/libz.so.1.2.11
./lib/liblz4.so
./lib/liblz4.so.1
./lib/liblz4.so.1.9.2
./lib/libcjson.so
./lib/libcjson.so.1
./lib/libcjson.so.1.7.13
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libpgport_tool.so
./lib/libpgport_tool.so.1
./share/llvmir/GaussDB_expr.ir
./lib/libeSDKLogAPI.so
./lib/libeSDKOBS.so
./lib/liblog4cpp.so
./lib/liblog4cpp.so.5
./lib/liblog4cpp.so.5.0.6
./lib/libcharset.so
./lib/libcharset.so.1
./lib/libcharset.so.1.0.0
./lib/libiconv.so
./lib/libiconv.so.2
./lib/libiconv.so.2.6.1
./lib/libnghttp2.so
./lib/libnghttp2.so.14
./lib/libnghttp2.so.14.20.0
./lib/libpcre.so
./lib/libpcre.so.1
./lib/libpcre.so.1.2.12
./lib/libsecurec.so
./lib/libxml2.so
./lib/libxml2.so.2
./lib/libxml2.so.2.9.9
./lib/libparquet.so
./lib/libparquet.so.14
./lib/libparquet.so.14.1.0
./lib/libarrow.so
./lib/libarrow.so.14
./lib/libarrow.so.14.1.0
./lib/OBS.ini
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/libxgboost.so
./lib/libdcf.so
./lib/libzstd.so
./lib/libzstd.so.1
./lib/libzstd.so.1.4.4
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h
./include/postgresql/server/pgtime.h
@ -842,7 +973,6 @@
./include/postgresql/server/utils/aset.h
./include/postgresql/server/utils/catcache.h
./include/postgresql/server/utils/atomic_arm.h
./include/postgresql/server/utils/oidrbtree.h
./include/postgresql/server/datatype/timestamp.h
./include/postgresql/server/access/rmgr.h
./include/postgresql/server/access/xlogreader.h
@ -854,7 +984,6 @@
./include/postgresql/server/access/attnum.h
./include/postgresql/server/access/tupmacs.h
./include/postgresql/server/access/xlogrecord.h
./include/postgresql/server/tde_key_management/data_common.h
./include/postgresql/server/tcop/dest.h
./include/postgresql/server/catalog/pg_type.h
./include/postgresql/server/catalog/pg_attribute.h
@ -878,7 +1007,6 @@
./include/postgresql/server/storage/backendid.h
./include/postgresql/server/storage/lock/lock.h
./include/postgresql/server/storage/lock/lwlock.h
./include/postgresql/server/storage/lwlocknames.h
./include/postgresql/server/storage/barrier.h
./include/postgresql/server/storage/shmem.h
./include/postgresql/server/pg_config.h
@ -902,14 +1030,400 @@
./include/postgresql/server/lib/ilist.h
./include/postgresql/server/pgxc/locator.h
./include/postgresql/server/gstrace/gstrace_infra.h
[libpq]
./include/postgresql/server/extension_dependency.h
./include/postgresql/server/libpq/libpq-fe.h
./include/postgresql/server/access/clog.h
./include/postgresql/server/storage/proc.h
./include/postgresql/server/access/xlog.h
./include/postgresql/server/storage/lwlocknames.h
./include/postgresql/server/access/xloginsert.h
./include/postgresql/server/catalog/pg_control.h
./include/postgresql/server/access/parallel_recovery/redo_item.h
./include/postgresql/server/access/parallel_recovery/posix_semaphore.h
./include/postgresql/server/replication/replicainternal.h
./include/postgresql/server/knl/knl_instance.h
./include/postgresql/server/knl/knl_guc.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_sql.h
./include/postgresql/server/knl/knl_guc/knl_guc_common.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_sql.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_storage.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_storage.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_storage.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_security.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_security.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_network.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_network.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_memory.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_memory.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_resource.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_resource.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_common.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_common.h
./include/postgresql/server/lib/circularqueue.h
./include/postgresql/server/access/double_write_basic.h
./include/postgresql/server/knl/knl_thread.h
./include/postgresql/server/access/sdir.h
./include/postgresql/server/gssignal/gs_signal.h
./include/postgresql/server/knl/knl_session.h
./include/postgresql/server/libpq/pqcomm.h
./include/postgresql/server/cipher.h
./include/postgresql/server/portability/instr_time.h
./include/postgresql/server/utils/memgroup.h
./include/postgresql/server/storage/latch.h
./include/postgresql/server/workload/qnode.h
./include/postgresql/server/streaming/init.h
./include/postgresql/server/streaming/launcher.h
./include/postgresql/server/pgxc/barrier.h
./include/postgresql/server/libcomm/libcomm.h
./include/postgresql/server/hotpatch/hotpatch.h
./include/postgresql/server/hotpatch/hotpatch_backend.h
./include/postgresql/server/postmaster/bgwriter.h
./include/postgresql/server/postmaster/pagewriter.h
./include/postgresql/server/replication/heartbeat.h
./include/postgresql/server/access/multi_redo_settings.h
./include/postgresql/server/access/redo_statistic_msg.h
./include/postgresql/server/replication/rto_statistic.h
./include/postgresql/server/replication/walprotocol.h
./include/postgresql/server/storage/mot/jit_def.h
./include/postgresql/server/threadpool/threadpool.h
./include/postgresql/server/threadpool/threadpool_controler.h
./include/postgresql/server/threadpool/threadpool_group.h
./include/postgresql/server/knl/knl_variable.h
./include/postgresql/server/threadpool/threadpool_listener.h
./include/postgresql/server/threadpool/threadpool_sessctl.h
./include/postgresql/server/storage/procsignal.h
./include/postgresql/server/threadpool/threadpool_worker.h
./include/postgresql/server/threadpool/threadpool_scheduler.h
./include/postgresql/server/threadpool/threadpool_stream.h
./include/postgresql/server/replication/dataqueuedefs.h
./include/postgresql/server/gtm/gtm_c.h
./include/postgresql/server/cm/etcdapi.h
./include/postgresql/server/alarm/alarm.h
./include/postgresql/server/access/xact.h
./include/postgresql/server/access/cstore_am.h
./include/postgresql/server/access/cstore_roughcheck_func.h
./include/postgresql/server/access/cstoreskey.h
./include/postgresql/server/storage/cu.h
./include/postgresql/server/vecexecutor/vectorbatch.h
./include/postgresql/server/cstore.h
./include/postgresql/server/storage/cstore/cstore_mem_alloc.h
./include/postgresql/server/access/cstore_minmax_func.h
./include/postgresql/server/storage/custorage.h
./include/postgresql/server/storage/fd.h
./include/postgresql/server/postmaster/aiocompleter.h
./include/postgresql/server/storage/buf/bufmgr.h
./include/postgresql/server/storage/buf/buf_internals.h
./include/postgresql/server/storage/smgr.h
./include/postgresql/server/catalog/pg_am.h
./include/postgresql/server/catalog/pg_class.h
./include/postgresql/server/catalog/pg_index.h
./include/postgresql/server/rewrite/prs2lock.h
./include/postgresql/server/tcop/stmt_retry.h
./include/postgresql/server/catalog/pg_hashbucket_fn.h
./include/postgresql/server/utils/rel_gs.h
./include/postgresql/server/catalog/pg_partition.h
./include/postgresql/server/catalog/pg_hashbucket.h
./include/postgresql/server/catalog/catalog.h
./include/postgresql/server/catalog/catversion.h
./include/postgresql/server/catalog/pg_namespace.h
./include/postgresql/server/utils/partitionmap_gs.h
./include/postgresql/server/access/heapam.h
./include/postgresql/server/storage/pagecompress.h
./include/postgresql/server/replication/bcm.h
./include/postgresql/server/storage/cstore/cstorealloc.h
./include/postgresql/server/storage/cucache_mgr.h
./include/postgresql/server/storage/cache_mgr.h
./include/postgresql/server/nodes/plannodes.h
./include/postgresql/server/foreign/foreign.h
./include/postgresql/server/access/obs/obs_am.h
./include/postgresql/server/storage/buf/buffile.h
./include/postgresql/server/replication/slot.h
./include/postgresql/server/access/obs/eSDKOBS.h
./include/postgresql/server/commands/defrem.h
./include/postgresql/server/optimizer/pruning.h
./include/postgresql/server/nodes/relation.h
./include/postgresql/server/optimizer/bucketinfo.h
./include/postgresql/server/pgxc/nodemgr.h
./include/postgresql/server/bulkload/dist_fdw.h
./include/postgresql/server/bulkload/importerror.h
./include/postgresql/server/commands/gds_stream.h
./include/postgresql/server/bulkload/utils.h
./include/postgresql/server/cjson/cJSON.h
./include/postgresql/server/ssl/gs_openssl_client.h
./include/postgresql/server/funcapi.h
./include/postgresql/server/executor/executor.h
./include/postgresql/server/executor/execdesc.h
./include/postgresql/server/nodes/execnodes.h
./include/postgresql/server/access/genam.h
./include/postgresql/server/nodes/tidbitmap.h
./include/postgresql/server/access/relscan.h
./include/postgresql/server/access/itup.h
./include/postgresql/server/executor/instrument.h
./include/postgresql/server/miscadmin.h
./include/postgresql/server/libpq/libpq-be.h
./include/postgresql/server/libpq/hba.h
./include/postgresql/server/libpq/sha2.h
./include/postgresql/server/utils/anls_opt.h
./include/postgresql/server/pgxc/pgxc.h
./include/postgresql/server/catalog/namespace.h
./include/postgresql/server/commands/trigger.h
./include/postgresql/server/executor/spi.h
./jre/ASSEMBLY_EXCEPTION
./jre/bin/java
./jre/bin/jjs
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
./jre/bin/unpack200
./jre/lib/amd64/jli/libjli.so
./jre/lib/amd64/jvm.cfg
./jre/lib/amd64/libattach.so
./jre/lib/amd64/libavplugin-ffmpeg-58.so
./jre/lib/amd64/libawt_headless.so
./jre/lib/amd64/libawt.so
./jre/lib/amd64/libawt_xawt.so
./jre/lib/amd64/libdecora_sse.so
./jre/lib/amd64/libdt_socket.so
./jre/lib/amd64/libfontmanager.so
./jre/lib/amd64/libfxplugins.so
./jre/lib/amd64/libglassgtk2.so
./jre/lib/amd64/libglassgtk3.so
./jre/lib/amd64/libglass.so
./jre/lib/amd64/libgstreamer-lite.so
./jre/lib/amd64/libhprof.so
./jre/lib/amd64/libinstrument.so
./jre/lib/amd64/libj2gss.so
./jre/lib/amd64/libj2pcsc.so
./jre/lib/amd64/libj2pkcs11.so
./jre/lib/amd64/libjaas_unix.so
./jre/lib/amd64/libjava_crw_demo.so
./jre/lib/amd64/libjavafx_font_freetype.so
./jre/lib/amd64/libjavafx_font_pango.so
./jre/lib/amd64/libjavafx_font.so
./jre/lib/amd64/libjavafx_iio.so
./jre/lib/amd64/libjava.so
./jre/lib/amd64/libjawt.so
./jre/lib/amd64/libjdwp.so
./jre/lib/amd64/libjfxmedia.so
./jre/lib/amd64/libjfxwebkit.so
./jre/lib/amd64/libjpeg.so
./jre/lib/amd64/libjsdt.so
./jre/lib/amd64/libjsig.so
./jre/lib/amd64/libjsoundalsa.so
./jre/lib/amd64/libjsound.so
./jre/lib/amd64/liblcms.so
./jre/lib/amd64/libmanagement.so
./jre/lib/amd64/libmlib_image.so
./jre/lib/amd64/libnet.so
./jre/lib/amd64/libnio.so
./jre/lib/amd64/libnpt.so
./jre/lib/amd64/libprism_common.so
./jre/lib/amd64/libprism_es2.so
./jre/lib/amd64/libprism_sw.so
./jre/lib/amd64/libsaproc.so
./jre/lib/amd64/libsctp.so
./jre/lib/amd64/libsplashscreen.so
./jre/lib/amd64/libsunec.so
./jre/lib/amd64/libunpack.so
./jre/lib/amd64/libverify.so
./jre/lib/amd64/libzip.so
./jre/lib/amd64/server/libjvm.so
./jre/lib/amd64/server/Xusage.txt
./jre/lib/calendars.properties
./jre/lib/charsets.jar
./jre/lib/classlist
./jre/lib/cmm/CIEXYZ.pf
./jre/lib/cmm/GRAY.pf
./jre/lib/cmm/LINEAR_RGB.pf
./jre/lib/cmm/PYCC.pf
./jre/lib/cmm/sRGB.pf
./jre/lib/content-types.properties
./jre/lib/currency.data
./jre/lib/ext/cldrdata.jar
./jre/lib/ext/dnsns.jar
./jre/lib/ext/jaccess.jar
./jre/lib/ext/jfxrt.jar
./jre/lib/ext/localedata.jar
./jre/lib/ext/meta-index
./jre/lib/ext/nashorn.jar
./jre/lib/ext/sunec.jar
./jre/lib/ext/sunjce_provider.jar
./jre/lib/ext/sunpkcs11.jar
./jre/lib/ext/zipfs.jar
./jre/lib/flavormap.properties
./jre/lib/fontconfig.Euler.properties
./jre/lib/fontconfig.properties
./jre/lib/fontconfig.Ubuntu.properties
./jre/lib/fonts/Roboto-Regular.ttf
./jre/lib/hijrah-config-umalqura.properties
./jre/lib/images/cursors/cursors.properties
./jre/lib/images/cursors/invalid32x32.gif
./jre/lib/images/cursors/motif_CopyDrop32x32.gif
./jre/lib/images/cursors/motif_CopyNoDrop32x32.gif
./jre/lib/images/cursors/motif_LinkDrop32x32.gif
./jre/lib/images/cursors/motif_LinkNoDrop32x32.gif
./jre/lib/images/cursors/motif_MoveDrop32x32.gif
./jre/lib/images/cursors/motif_MoveNoDrop32x32.gif
./jre/lib/javafx-mx.jar
./jre/lib/javafx.properties
./jre/lib/jce.jar
./jre/lib/jexec
./jre/lib/jfr/default.jfc
./jre/lib/jfr.jar
./jre/lib/jfr/profile.jfc
./jre/lib/jfxswt.jar
./jre/lib/jsse.jar
./jre/lib/jvm.hprof.txt
./jre/lib/logging.properties
./jre/lib/management-agent.jar
./jre/lib/management/jmxremote.access
./jre/lib/management/jmxremote.password.template
./jre/lib/management/management.properties
./jre/lib/management/snmp.acl.template
./jre/lib/meta-index
./jre/lib/net.properties
./jre/lib/psfontj2d.properties
./jre/lib/psfont.properties.ja
./jre/lib/resources.jar
./jre/lib/rt.jar
./jre/lib/security/blacklisted.certs
./jre/lib/security/cacerts
./jre/lib/security/java.policy
./jre/lib/security/java.security
./jre/lib/security/policy/limited/local_policy.jar
./jre/lib/security/policy/limited/US_export_policy.jar
./jre/lib/security/policy/unlimited/local_policy.jar
./jre/lib/security/policy/unlimited/US_export_policy.jar
./jre/lib/sound.properties
./jre/lib/tzdb.dat
./jre/LICENSE
./jre/THIRD_PARTY_README
[client]
./bin/gsql
./bin/gs_dump
./bin/gs_dumpall
./bin/gs_restore
./bin/gs_basebackup
./bin/gs_probackup
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/postgresql/euc_kr_and_mic.so
./lib/postgresql/utf8_and_uhc.so
./lib/postgresql/euc_tw_and_big5.so
./lib/postgresql/cyrillic_and_mic.so
./lib/postgresql/utf8_and_johab.so
./lib/postgresql/utf8_and_gb18030.so
./lib/postgresql/pgxs/src/makefiles/pgxs.mk
./lib/postgresql/pgxs/src/Makefile.shlib
./lib/postgresql/pgxs/src/Makefile.port
./lib/postgresql/pgxs/src/nls-global.mk
./lib/postgresql/pgxs/src/Makefile.global
./lib/postgresql/pgxs/config/install-sh
./lib/postgresql/euc_cn_and_mic.so
./lib/postgresql/latin_and_mic.so
./lib/postgresql/utf8_and_sjis2004.so
./lib/postgresql/utf8_and_euc_jp.so
./lib/postgresql/utf8_and_sjis.so
./lib/postgresql/utf8_and_cyrillic.so
./lib/postgresql/utf8_and_euc_kr.so
./lib/postgresql/ascii_and_mic.so
./lib/postgresql/utf8_and_iso8859_1.so
./lib/postgresql/euc_jp_and_sjis.so
./lib/postgresql/dict_snowball.so
./lib/postgresql/utf8_and_ascii.so
./lib/postgresql/utf8_and_euc_tw.so
./lib/postgresql/utf8_and_iso8859.so
./lib/postgresql/utf8_and_win.so
./lib/postgresql/utf8_and_euc_cn.so
./lib/postgresql/utf8_and_gbk.so
./lib/postgresql/utf8_and_euc2004.so
./lib/postgresql/utf8_and_big5.so
./lib/postgresql/java/pljava.jar
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libpq_ce.so
./lib/libpq_ce.so.5
./lib/libpq_ce.so.5.5
./lib/libgauss_cl_jni.so
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libstdc++.so.6
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libpgport_tool.so
./lib/libpgport_tool.so.1
./lib/libgssapi_krb5_gauss.so
./lib/libgssapi_krb5_gauss.so.2
./lib/libgssapi_krb5_gauss.so.2.2
./lib/libgssrpc_gauss.so
./lib/libgssrpc_gauss.so.4
./lib/libgssrpc_gauss.so.4.2
./lib/libk5crypto_gauss.so
./lib/libk5crypto_gauss.so.3
./lib/libk5crypto_gauss.so.3.1
./lib/libkrb5support_gauss.so
./lib/libkrb5support_gauss.so.0
./lib/libkrb5support_gauss.so.0.1
./lib/libkrb5_gauss.so
./lib/libkrb5_gauss.so.3
./lib/libkrb5_gauss.so.3.3
./lib/libcom_err_gauss.so
./lib/libcom_err_gauss.so.3
./lib/libcom_err_gauss.so.3.0
[libpq]
./lib/libpq.a
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libpq_ce.so
./lib/libpq_ce.so.5
./lib/libpq_ce.so.5.5
./lib/libgauss_cl_jni.so
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libstdc++.so.6
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libpgport_tool.so
./lib/libpgport_tool.so.1
./lib/libgssapi_krb5_gauss.so
./lib/libgssapi_krb5_gauss.so.2
./lib/libgssapi_krb5_gauss.so.2.2
./lib/libgssrpc_gauss.so
./lib/libgssrpc_gauss.so.4
./lib/libgssrpc_gauss.so.4.2
./lib/libk5crypto_gauss.so
./lib/libk5crypto_gauss.so.3
./lib/libk5crypto_gauss.so.3.1
./lib/libkrb5support_gauss.so
./lib/libkrb5support_gauss.so.0
./lib/libkrb5support_gauss.so.0.1
./lib/libkrb5_gauss.so
./lib/libkrb5_gauss.so.3
./lib/libkrb5_gauss.so.3.3
./lib/libcom_err_gauss.so
./lib/libcom_err_gauss.so.3
./lib/libcom_err_gauss.so.3.0
./include/gs_thread.h
./include/gs_threadlocal.h
./include/postgres_ext.h
./include/libpq-fe.h
./include/libpq-events.h
./include/libpq/libpq-fs.h
[version]
V500R002C00
[header]
./include/libpq-fe.h
./include/postgres_ext.h
@ -918,10 +1432,14 @@
./include/pg_config.h
./include/pg_config_manual.h
./include/pg_config_os.h
./include/cm_config.h
./include/c.h
./include/port.h
./include/cm_msg.h
./include/cm_c.h
./include/cm_misc.h
./include/libpq-int.h
./include/pqcomm.h
./include/pqexpbuffer.h
[version]
3.0.0
./include/xlogdefs.h
./include/cm-libpq-fe.h

File diff suppressed because it is too large Load Diff

View File

@ -865,8 +865,6 @@
./lib/libnghttp2.so
./lib/libnghttp2.so.14
./lib/libnghttp2.so.14.20.0
./lib/libpagecompression.so
./lib/libpagecompression.so.1
./lib/libpcre.so
./lib/libpcre.so.1
./lib/libpcre.so.1.2.12

File diff suppressed because it is too large Load Diff

View File

@ -2,21 +2,46 @@
./bin/gsql
./bin/gaussdb
./bin/gstrace
./bin/gs_basebackup
./bin/gs_probackup
./bin/gs_tar
./bin/gs_encrypt
./bin/gs_dump
./bin/gs_dumpall
./bin/gs_initdb
./bin/gs_ctl
./bin/gs_initdb
./bin/gs_guc
./bin/encrypt
./bin/openssl
./bin/gs_restore
./bin/gs_cgroup
./bin/openssl
./bin/pg_config
./bin/pg_controldata
./bin/pg_format_cu
./bin/pg_resetxlog
./bin/gs_probackup
./bin/pg_recvlogical
./bin/alarmItem.conf
./bin/retry_errcodes.conf
./bin/cluster_guc.conf
./bin/bind_net_irq.sh
./bin/setArmOptimization.sh
./bin/krb5kdc
./bin/klist
./bin/kinit
./bin/kdestroy
./bin/kdb5_util
./bin/kadmin.local
./bin/lz4
./bin/gs_plan_simulator.sh
./bin/kadmind
./bin/dbmind
./bin/server.key.cipher
./bin/server.key.rand
./etc/kerberos/kadm5.acl
./etc/kerberos/kdc.conf
./etc/kerberos/krb5.conf
./etc/kerberos/mppdb-site.xml
./share/postgresql/tmp/udstools.py
./share/postgresql/db4ai
./share/postgresql/snowball_create.sql
./share/postgresql/pg_hba.conf.sample
@ -28,6 +53,7 @@
./share/postgresql/pg_ident.conf.sample
./share/postgresql/postgres.description
./share/postgresql/postgresql.conf.sample
./share/postgresql/mot.conf.sample
./share/postgresql/extension/plpgsql--1.0.sql
./share/postgresql/extension/hstore.control
./share/postgresql/extension/security_plugin.control
@ -45,6 +71,8 @@
./share/postgresql/extension/hdfs_fdw.control
./share/postgresql/extension/log_fdw--1.0.sql
./share/postgresql/extension/log_fdw.control
./share/postgresql/extension/mot_fdw--1.0.sql
./share/postgresql/extension/mot_fdw.control
./share/postgresql/extension/postgres_fdw--1.0.sql
./share/postgresql/extension/postgres_fdw.control
./share/postgresql/timezone/GB-Eire
@ -253,6 +281,7 @@
./share/postgresql/timezone/Canada/Newfoundland
./share/postgresql/timezone/Canada/Saskatchewan
./share/postgresql/timezone/Canada/Pacific
./share/postgresql/timezone/Canada/East-Saskatchewan
./share/postgresql/timezone/Canada/Mountain
./share/postgresql/timezone/Canada/Central
./share/postgresql/timezone/CST6CDT
@ -634,6 +663,7 @@
./share/postgresql/timezone/Navajo
./share/postgresql/timezone/GMT
./share/postgresql/system_views.sql
./share/postgresql/private_system_views.sql
./share/postgresql/performance_views.sql
./share/postgresql/sql_features.txt
./share/postgresql/pg_cast_oid.txt
@ -672,43 +702,11 @@
./share/postgresql/timezonesets/Default
./share/postgresql/timezonesets/Etc.txt
./share/postgresql/postgres.bki
./share/llvmir/GaussDB_expr.ir
./share/sslcert/gsql/openssl.cnf
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libcgroup.so
./lib/libcgroup.so.1
./lib/libz.so
./lib/libz.so.1
./lib/libz.so.1.2.11
./lib/liblz4.so
./lib/liblz4.so.1
./lib/liblz4.so.1.9.2
./lib/libcjson.so
./lib/libcjson.so.1
./lib/libcjson.so.1.7.14
./lib/libcjson_utils.so
./lib/libcjson_utils.so.1
./lib/libcjson_utils.so.1.7.14
./lib/libstdc++.so.6
./lib/libgcc_s.so.1
./lib/libgomp.so
./lib/libgomp.so.1
./lib/libgomp.so.1.0.0
./lib/libdcf.so
./lib/libzstd.so
./lib/libzstd.so.1
./lib/libzstd.so.1.5.0
./lib/libcurl.so
./lib/libcurl.so.4
./lib/libcurl.so.4.7.0
./lib/libxgboost.so
./lib/libpagecompression.so
./lib/libpagecompression.so.1
./share/sslcert/grpc/openssl.cnf
./share/sslcert/om/openssl.cnf
./lib/libsimsearch/
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/postgresql/euc_kr_and_mic.so
@ -717,6 +715,12 @@
./lib/postgresql/cyrillic_and_mic.so
./lib/postgresql/utf8_and_johab.so
./lib/postgresql/utf8_and_gb18030.so
./lib/postgresql/pgxs/src/makefiles/pgxs.mk
./lib/postgresql/pgxs/src/Makefile.shlib
./lib/postgresql/pgxs/src/Makefile.port
./lib/postgresql/pgxs/src/nls-global.mk
./lib/postgresql/pgxs/src/Makefile.global
./lib/postgresql/pgxs/src/get_PlatForm_str.sh
./lib/postgresql/pgxs/config/install-sh
./lib/postgresql/euc_cn_and_mic.so
./lib/postgresql/latin_and_mic.so
@ -742,9 +746,141 @@
./lib/postgresql/pg_plugin
./lib/postgresql/proc_srclib
./lib/postgresql/security_plugin.so
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libpq_ce.so
./lib/libpq_ce.so.5
./lib/libpq_ce.so.5.5
./lib/libgauss_cl_jni.so
./lib/libcgroup.so
./lib/libcgroup.so.1
./lib/libcom_err_gauss.so
./lib/libcom_err_gauss.so.3
./lib/libcom_err_gauss.so.3.0
./lib/libatomic.so
./lib/libatomic.so.1
./lib/libatomic.so.1.2.0
./lib/libmasstree.so
./lib/libupb.so
./lib/libupb.so.9
./lib/libupb.so.9.0.0
./lib/libabsl_str_format_internal.so
./lib/libabsl_strings.so
./lib/libabsl_throw_delegate.so
./lib/libabsl_strings_internal.so
./lib/libabsl_base.so
./lib/libabsl_dynamic_annotations.so
./lib/libabsl_spinlock_wait.so
./lib/libabsl_int128.so
./lib/libabsl_bad_optional_access.so
./lib/libabsl_raw_logging_internal.so
./lib/libabsl_log_severity.so
./lib/libaddress_sorting.so
./lib/libaddress_sorting.so.9
./lib/libgssapi_krb5_gauss.so
./lib/libgssapi_krb5_gauss.so.2
./lib/libgssapi_krb5_gauss.so.2.2
./lib/libgssrpc_gauss.so
./lib/libgssrpc_gauss.so.4
./lib/libgssrpc_gauss.so.4.2
./lib/libk5crypto_gauss.so
./lib/libk5crypto_gauss.so.3
./lib/libk5crypto_gauss.so.3.1
./lib/libkadm5clnt.so
./lib/libkadm5clnt_mit.so
./lib/libkadm5clnt_mit.so.11
./lib/libkadm5clnt_mit.so.11.0
./lib/libkadm5clnt_mit.so.12
./lib/libkadm5clnt_mit.so.12.0
./lib/libkadm5srv.so
./lib/libkadm5srv_mit.so
./lib/libkadm5srv_mit.so.11
./lib/libkadm5srv_mit.so.11.0
./lib/libkadm5srv_mit.so.12
./lib/libkadm5srv_mit.so.12.0
./lib/libkdb5.so
./lib/libkdb5.so.9
./lib/libkdb5.so.9.0
./lib/libkdb5.so.10
./lib/libkdb5.so.10.0
./lib/libkrad.so
./lib/libkrad.so.0
./lib/libkrad.so.0.0
./lib/libkrb5_gauss.so
./lib/libkrb5_gauss.so.3
./lib/libkrb5_gauss.so.3.3
./lib/libkrb5support_gauss.so
./lib/libkrb5support_gauss.so.0
./lib/libkrb5support_gauss.so.0.1
./lib/krb5/plugins/kdb/db2.so
./lib/libverto.so
./lib/libverto.so.0
./lib/libverto.so.0.0
./lib/libcurl.so
./lib/libcurl.so.4
./lib/libcurl.so.4.6.0
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libgcc_s.so.1
./lib/libstdc++.so.6
./lib/libz.so
./lib/libz.so.1
./lib/libz.so.1.2.11
./lib/liblz4.so
./lib/liblz4.so.1
./lib/liblz4.so.1.9.2
./lib/libcjson.so
./lib/libcjson.so.1
./lib/libcjson.so.1.7.13
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libpgport_tool.so
./lib/libpgport_tool.so.1
./share/llvmir/GaussDB_expr.ir
./lib/libeSDKLogAPI.so
./lib/libeSDKOBS.so
./lib/liblog4cpp.so
./lib/liblog4cpp.so.5
./lib/liblog4cpp.so.5.0.6
./lib/libcharset.so
./lib/libcharset.so.1
./lib/libcharset.so.1.0.0
./lib/libiconv.so
./lib/libiconv.so.2
./lib/libiconv.so.2.6.1
./lib/libnghttp2.so
./lib/libnghttp2.so.14
./lib/libnghttp2.so.14.20.0
./lib/libpcre.so
./lib/libpcre.so.1
./lib/libpcre.so.1.2.12
./lib/libsecurec.so
./lib/libxml2.so
./lib/libxml2.so.2
./lib/libxml2.so.2.9.9
./lib/libparquet.so
./lib/libparquet.so.14
./lib/libparquet.so.14.1.0
./lib/libarrow.so
./lib/libarrow.so.14
./lib/libarrow.so.14.1.0
./lib/OBS.ini
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/libxgboost.so
./lib/libdcf.so
./lib/libzstd.so
./lib/libzstd.so.1
./lib/libzstd.so.1.4.4
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h
./include/postgresql/server/pgtime.h
@ -838,7 +974,6 @@
./include/postgresql/server/utils/aset.h
./include/postgresql/server/utils/catcache.h
./include/postgresql/server/utils/atomic_arm.h
./include/postgresql/server/utils/oidrbtree.h
./include/postgresql/server/datatype/timestamp.h
./include/postgresql/server/access/rmgr.h
./include/postgresql/server/access/xlogreader.h
@ -850,7 +985,6 @@
./include/postgresql/server/access/attnum.h
./include/postgresql/server/access/tupmacs.h
./include/postgresql/server/access/xlogrecord.h
./include/postgresql/server/tde_key_management/data_common.h
./include/postgresql/server/tcop/dest.h
./include/postgresql/server/catalog/pg_type.h
./include/postgresql/server/catalog/pg_attribute.h
@ -874,7 +1008,6 @@
./include/postgresql/server/storage/backendid.h
./include/postgresql/server/storage/lock/lock.h
./include/postgresql/server/storage/lock/lwlock.h
./include/postgresql/server/storage/lwlocknames.h
./include/postgresql/server/storage/barrier.h
./include/postgresql/server/storage/shmem.h
./include/postgresql/server/pg_config.h
@ -898,14 +1031,400 @@
./include/postgresql/server/lib/ilist.h
./include/postgresql/server/pgxc/locator.h
./include/postgresql/server/gstrace/gstrace_infra.h
[libpq]
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libssl.so
./lib/libssl.so.1.1
./include/postgresql/server/extension_dependency.h
./include/postgresql/server/libpq/libpq-fe.h
./include/postgresql/server/access/clog.h
./include/postgresql/server/storage/proc.h
./include/postgresql/server/access/xlog.h
./include/postgresql/server/storage/lwlocknames.h
./include/postgresql/server/access/xloginsert.h
./include/postgresql/server/catalog/pg_control.h
./include/postgresql/server/access/parallel_recovery/redo_item.h
./include/postgresql/server/access/parallel_recovery/posix_semaphore.h
./include/postgresql/server/replication/replicainternal.h
./include/postgresql/server/knl/knl_instance.h
./include/postgresql/server/knl/knl_guc.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_sql.h
./include/postgresql/server/knl/knl_guc/knl_guc_common.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_sql.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_storage.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_storage.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_storage.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_security.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_security.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_network.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_network.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_memory.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_memory.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_resource.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_resource.h
./include/postgresql/server/knl/knl_guc/knl_session_attr_common.h
./include/postgresql/server/knl/knl_guc/knl_instance_attr_common.h
./include/postgresql/server/lib/circularqueue.h
./include/postgresql/server/access/double_write_basic.h
./include/postgresql/server/knl/knl_thread.h
./include/postgresql/server/access/sdir.h
./include/postgresql/server/gssignal/gs_signal.h
./include/postgresql/server/knl/knl_session.h
./include/postgresql/server/libpq/pqcomm.h
./include/postgresql/server/cipher.h
./include/postgresql/server/portability/instr_time.h
./include/postgresql/server/utils/memgroup.h
./include/postgresql/server/storage/latch.h
./include/postgresql/server/workload/qnode.h
./include/postgresql/server/streaming/init.h
./include/postgresql/server/streaming/launcher.h
./include/postgresql/server/pgxc/barrier.h
./include/postgresql/server/libcomm/libcomm.h
./include/postgresql/server/hotpatch/hotpatch.h
./include/postgresql/server/hotpatch/hotpatch_backend.h
./include/postgresql/server/postmaster/bgwriter.h
./include/postgresql/server/postmaster/pagewriter.h
./include/postgresql/server/replication/heartbeat.h
./include/postgresql/server/access/multi_redo_settings.h
./include/postgresql/server/access/redo_statistic_msg.h
./include/postgresql/server/replication/rto_statistic.h
./include/postgresql/server/replication/walprotocol.h
./include/postgresql/server/storage/mot/jit_def.h
./include/postgresql/server/threadpool/threadpool.h
./include/postgresql/server/threadpool/threadpool_controler.h
./include/postgresql/server/threadpool/threadpool_group.h
./include/postgresql/server/knl/knl_variable.h
./include/postgresql/server/threadpool/threadpool_listener.h
./include/postgresql/server/threadpool/threadpool_sessctl.h
./include/postgresql/server/storage/procsignal.h
./include/postgresql/server/threadpool/threadpool_worker.h
./include/postgresql/server/threadpool/threadpool_scheduler.h
./include/postgresql/server/threadpool/threadpool_stream.h
./include/postgresql/server/replication/dataqueuedefs.h
./include/postgresql/server/gtm/gtm_c.h
./include/postgresql/server/cm/etcdapi.h
./include/postgresql/server/alarm/alarm.h
./include/postgresql/server/access/xact.h
./include/postgresql/server/access/cstore_am.h
./include/postgresql/server/access/cstore_roughcheck_func.h
./include/postgresql/server/access/cstoreskey.h
./include/postgresql/server/storage/cu.h
./include/postgresql/server/vecexecutor/vectorbatch.h
./include/postgresql/server/cstore.h
./include/postgresql/server/storage/cstore/cstore_mem_alloc.h
./include/postgresql/server/access/cstore_minmax_func.h
./include/postgresql/server/storage/custorage.h
./include/postgresql/server/storage/fd.h
./include/postgresql/server/postmaster/aiocompleter.h
./include/postgresql/server/storage/buf/bufmgr.h
./include/postgresql/server/storage/buf/buf_internals.h
./include/postgresql/server/storage/smgr.h
./include/postgresql/server/catalog/pg_am.h
./include/postgresql/server/catalog/pg_class.h
./include/postgresql/server/catalog/pg_index.h
./include/postgresql/server/rewrite/prs2lock.h
./include/postgresql/server/tcop/stmt_retry.h
./include/postgresql/server/catalog/pg_hashbucket_fn.h
./include/postgresql/server/utils/rel_gs.h
./include/postgresql/server/catalog/pg_partition.h
./include/postgresql/server/catalog/pg_hashbucket.h
./include/postgresql/server/catalog/catalog.h
./include/postgresql/server/catalog/catversion.h
./include/postgresql/server/catalog/pg_namespace.h
./include/postgresql/server/utils/partitionmap_gs.h
./include/postgresql/server/access/heapam.h
./include/postgresql/server/storage/pagecompress.h
./include/postgresql/server/replication/bcm.h
./include/postgresql/server/storage/cstore/cstorealloc.h
./include/postgresql/server/storage/cucache_mgr.h
./include/postgresql/server/storage/cache_mgr.h
./include/postgresql/server/nodes/plannodes.h
./include/postgresql/server/foreign/foreign.h
./include/postgresql/server/access/obs/obs_am.h
./include/postgresql/server/storage/buf/buffile.h
./include/postgresql/server/replication/slot.h
./include/postgresql/server/access/obs/eSDKOBS.h
./include/postgresql/server/commands/defrem.h
./include/postgresql/server/optimizer/pruning.h
./include/postgresql/server/nodes/relation.h
./include/postgresql/server/optimizer/bucketinfo.h
./include/postgresql/server/pgxc/nodemgr.h
./include/postgresql/server/bulkload/dist_fdw.h
./include/postgresql/server/bulkload/importerror.h
./include/postgresql/server/commands/gds_stream.h
./include/postgresql/server/bulkload/utils.h
./include/postgresql/server/cjson/cJSON.h
./include/postgresql/server/ssl/gs_openssl_client.h
./include/postgresql/server/funcapi.h
./include/postgresql/server/executor/executor.h
./include/postgresql/server/executor/execdesc.h
./include/postgresql/server/nodes/execnodes.h
./include/postgresql/server/access/genam.h
./include/postgresql/server/nodes/tidbitmap.h
./include/postgresql/server/access/relscan.h
./include/postgresql/server/access/itup.h
./include/postgresql/server/executor/instrument.h
./include/postgresql/server/miscadmin.h
./include/postgresql/server/libpq/libpq-be.h
./include/postgresql/server/libpq/hba.h
./include/postgresql/server/libpq/sha2.h
./include/postgresql/server/utils/anls_opt.h
./include/postgresql/server/pgxc/pgxc.h
./include/postgresql/server/catalog/namespace.h
./include/postgresql/server/commands/trigger.h
./include/postgresql/server/executor/spi.h
./jre/ASSEMBLY_EXCEPTION
./jre/bin/java
./jre/bin/jjs
./jre/bin/keytool
./jre/bin/orbd
./jre/bin/pack200
./jre/bin/policytool
./jre/bin/rmid
./jre/bin/rmiregistry
./jre/bin/servertool
./jre/bin/tnameserv
./jre/bin/unpack200
./jre/lib/amd64/jli/libjli.so
./jre/lib/amd64/jvm.cfg
./jre/lib/amd64/libattach.so
./jre/lib/amd64/libavplugin-ffmpeg-58.so
./jre/lib/amd64/libawt_headless.so
./jre/lib/amd64/libawt.so
./jre/lib/amd64/libawt_xawt.so
./jre/lib/amd64/libdecora_sse.so
./jre/lib/amd64/libdt_socket.so
./jre/lib/amd64/libfontmanager.so
./jre/lib/amd64/libfxplugins.so
./jre/lib/amd64/libglassgtk2.so
./jre/lib/amd64/libglassgtk3.so
./jre/lib/amd64/libglass.so
./jre/lib/amd64/libgstreamer-lite.so
./jre/lib/amd64/libhprof.so
./jre/lib/amd64/libinstrument.so
./jre/lib/amd64/libj2gss.so
./jre/lib/amd64/libj2pcsc.so
./jre/lib/amd64/libj2pkcs11.so
./jre/lib/amd64/libjaas_unix.so
./jre/lib/amd64/libjava_crw_demo.so
./jre/lib/amd64/libjavafx_font_freetype.so
./jre/lib/amd64/libjavafx_font_pango.so
./jre/lib/amd64/libjavafx_font.so
./jre/lib/amd64/libjavafx_iio.so
./jre/lib/amd64/libjava.so
./jre/lib/amd64/libjawt.so
./jre/lib/amd64/libjdwp.so
./jre/lib/amd64/libjfxmedia.so
./jre/lib/amd64/libjfxwebkit.so
./jre/lib/amd64/libjpeg.so
./jre/lib/amd64/libjsdt.so
./jre/lib/amd64/libjsig.so
./jre/lib/amd64/libjsoundalsa.so
./jre/lib/amd64/libjsound.so
./jre/lib/amd64/liblcms.so
./jre/lib/amd64/libmanagement.so
./jre/lib/amd64/libmlib_image.so
./jre/lib/amd64/libnet.so
./jre/lib/amd64/libnio.so
./jre/lib/amd64/libnpt.so
./jre/lib/amd64/libprism_common.so
./jre/lib/amd64/libprism_es2.so
./jre/lib/amd64/libprism_sw.so
./jre/lib/amd64/libsaproc.so
./jre/lib/amd64/libsctp.so
./jre/lib/amd64/libsplashscreen.so
./jre/lib/amd64/libsunec.so
./jre/lib/amd64/libunpack.so
./jre/lib/amd64/libverify.so
./jre/lib/amd64/libzip.so
./jre/lib/amd64/server/libjvm.so
./jre/lib/amd64/server/Xusage.txt
./jre/lib/calendars.properties
./jre/lib/charsets.jar
./jre/lib/classlist
./jre/lib/cmm/CIEXYZ.pf
./jre/lib/cmm/GRAY.pf
./jre/lib/cmm/LINEAR_RGB.pf
./jre/lib/cmm/PYCC.pf
./jre/lib/cmm/sRGB.pf
./jre/lib/content-types.properties
./jre/lib/currency.data
./jre/lib/ext/cldrdata.jar
./jre/lib/ext/dnsns.jar
./jre/lib/ext/jaccess.jar
./jre/lib/ext/jfxrt.jar
./jre/lib/ext/localedata.jar
./jre/lib/ext/meta-index
./jre/lib/ext/nashorn.jar
./jre/lib/ext/sunec.jar
./jre/lib/ext/sunjce_provider.jar
./jre/lib/ext/sunpkcs11.jar
./jre/lib/ext/zipfs.jar
./jre/lib/flavormap.properties
./jre/lib/fontconfig.Euler.properties
./jre/lib/fontconfig.properties
./jre/lib/fontconfig.Ubuntu.properties
./jre/lib/fonts/Roboto-Regular.ttf
./jre/lib/hijrah-config-umalqura.properties
./jre/lib/images/cursors/cursors.properties
./jre/lib/images/cursors/invalid32x32.gif
./jre/lib/images/cursors/motif_CopyDrop32x32.gif
./jre/lib/images/cursors/motif_CopyNoDrop32x32.gif
./jre/lib/images/cursors/motif_LinkDrop32x32.gif
./jre/lib/images/cursors/motif_LinkNoDrop32x32.gif
./jre/lib/images/cursors/motif_MoveDrop32x32.gif
./jre/lib/images/cursors/motif_MoveNoDrop32x32.gif
./jre/lib/javafx-mx.jar
./jre/lib/javafx.properties
./jre/lib/jce.jar
./jre/lib/jexec
./jre/lib/jfr/default.jfc
./jre/lib/jfr.jar
./jre/lib/jfr/profile.jfc
./jre/lib/jfxswt.jar
./jre/lib/jsse.jar
./jre/lib/jvm.hprof.txt
./jre/lib/logging.properties
./jre/lib/management-agent.jar
./jre/lib/management/jmxremote.access
./jre/lib/management/jmxremote.password.template
./jre/lib/management/management.properties
./jre/lib/management/snmp.acl.template
./jre/lib/meta-index
./jre/lib/net.properties
./jre/lib/psfontj2d.properties
./jre/lib/psfont.properties.ja
./jre/lib/resources.jar
./jre/lib/rt.jar
./jre/lib/security/blacklisted.certs
./jre/lib/security/cacerts
./jre/lib/security/java.policy
./jre/lib/security/java.security
./jre/lib/security/policy/limited/local_policy.jar
./jre/lib/security/policy/limited/US_export_policy.jar
./jre/lib/security/policy/unlimited/local_policy.jar
./jre/lib/security/policy/unlimited/US_export_policy.jar
./jre/lib/sound.properties
./jre/lib/tzdb.dat
./jre/LICENSE
./jre/THIRD_PARTY_README
[client]
./bin/gsql
./bin/gs_dump
./bin/gs_dumpall
./bin/gs_restore
./bin/gs_basebackup
./bin/gs_probackup
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/postgresql/euc_kr_and_mic.so
./lib/postgresql/utf8_and_uhc.so
./lib/postgresql/euc_tw_and_big5.so
./lib/postgresql/cyrillic_and_mic.so
./lib/postgresql/utf8_and_johab.so
./lib/postgresql/utf8_and_gb18030.so
./lib/postgresql/pgxs/src/makefiles/pgxs.mk
./lib/postgresql/pgxs/src/Makefile.shlib
./lib/postgresql/pgxs/src/Makefile.port
./lib/postgresql/pgxs/src/nls-global.mk
./lib/postgresql/pgxs/src/Makefile.global
./lib/postgresql/pgxs/config/install-sh
./lib/postgresql/euc_cn_and_mic.so
./lib/postgresql/latin_and_mic.so
./lib/postgresql/utf8_and_sjis2004.so
./lib/postgresql/utf8_and_euc_jp.so
./lib/postgresql/utf8_and_sjis.so
./lib/postgresql/utf8_and_cyrillic.so
./lib/postgresql/utf8_and_euc_kr.so
./lib/postgresql/ascii_and_mic.so
./lib/postgresql/utf8_and_iso8859_1.so
./lib/postgresql/euc_jp_and_sjis.so
./lib/postgresql/dict_snowball.so
./lib/postgresql/utf8_and_ascii.so
./lib/postgresql/utf8_and_euc_tw.so
./lib/postgresql/utf8_and_iso8859.so
./lib/postgresql/utf8_and_win.so
./lib/postgresql/utf8_and_euc_cn.so
./lib/postgresql/utf8_and_gbk.so
./lib/postgresql/utf8_and_euc2004.so
./lib/postgresql/utf8_and_big5.so
./lib/postgresql/java/pljava.jar
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libpq_ce.so
./lib/libpq_ce.so.5
./lib/libpq_ce.so.5.5
./lib/libgauss_cl_jni.so
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libstdc++.so.6
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libpgport_tool.so
./lib/libpgport_tool.so.1
./lib/libgssapi_krb5_gauss.so
./lib/libgssapi_krb5_gauss.so.2
./lib/libgssapi_krb5_gauss.so.2.2
./lib/libgssrpc_gauss.so
./lib/libgssrpc_gauss.so.4
./lib/libgssrpc_gauss.so.4.2
./lib/libk5crypto_gauss.so
./lib/libk5crypto_gauss.so.3
./lib/libk5crypto_gauss.so.3.1
./lib/libkrb5support_gauss.so
./lib/libkrb5support_gauss.so.0
./lib/libkrb5support_gauss.so.0.1
./lib/libkrb5_gauss.so
./lib/libkrb5_gauss.so.3
./lib/libkrb5_gauss.so.3.3
./lib/libcom_err_gauss.so
./lib/libcom_err_gauss.so.3
./lib/libcom_err_gauss.so.3.0
[libpq]
./lib/libpq.a
./lib/libpq.so
./lib/libpq.so.5
./lib/libpq.so.5.5
./lib/libpq_ce.so
./lib/libpq_ce.so.5
./lib/libpq_ce.so.5.5
./lib/libgauss_cl_jni.so
./lib/libconfig.so
./lib/libconfig.so.4
./lib/libcrypto.so
./lib/libcrypto.so.1.1
./lib/libstdc++.so.6
./lib/libssl.so
./lib/libssl.so.1.1
./lib/libpgport_tool.so
./lib/libpgport_tool.so.1
./lib/libgssapi_krb5_gauss.so
./lib/libgssapi_krb5_gauss.so.2
./lib/libgssapi_krb5_gauss.so.2.2
./lib/libgssrpc_gauss.so
./lib/libgssrpc_gauss.so.4
./lib/libgssrpc_gauss.so.4.2
./lib/libk5crypto_gauss.so
./lib/libk5crypto_gauss.so.3
./lib/libk5crypto_gauss.so.3.1
./lib/libkrb5support_gauss.so
./lib/libkrb5support_gauss.so.0
./lib/libkrb5support_gauss.so.0.1
./lib/libkrb5_gauss.so
./lib/libkrb5_gauss.so.3
./lib/libkrb5_gauss.so.3.3
./lib/libcom_err_gauss.so
./lib/libcom_err_gauss.so.3
./lib/libcom_err_gauss.so.3.0
./include/gs_thread.h
./include/gs_threadlocal.h
./include/postgres_ext.h
./include/libpq-fe.h
./include/libpq-events.h
./include/libpq/libpq-fs.h
[version]
V500R002C00
[header]
./include/libpq-fe.h
./include/postgres_ext.h
@ -914,10 +1433,14 @@
./include/pg_config.h
./include/pg_config_manual.h
./include/pg_config_os.h
./include/cm_config.h
./include/c.h
./include/port.h
./include/cm_msg.h
./include/cm_c.h
./include/cm_misc.h
./include/libpq-int.h
./include/pqcomm.h
./include/pqexpbuffer.h
[version]
3.0.0
./include/xlogdefs.h
./include/cm-libpq-fe.h

View File

@ -40,7 +40,6 @@
./bin/dbmind
./bin/server.key.cipher
./bin/server.key.rand
./bin/gs_plan_simulator.sh
./etc/kerberos/kadm5.acl
./etc/kerberos/kdc.conf
./etc/kerberos/krb5.conf
@ -864,8 +863,6 @@
./lib/libnghttp2.so
./lib/libnghttp2.so.14
./lib/libnghttp2.so.14.20.0
./lib/libpagecompression.so
./lib/libpagecompression.so.1
./lib/libpcre.so
./lib/libpcre.so.1
./lib/libpcre.so.1.2.12
@ -1032,25 +1029,6 @@
./include/postgresql/server/pgxc/locator.h
./include/postgresql/server/gstrace/gstrace_infra.h
./include/postgresql/server/extension_dependency.h
./include/postgresql/server/access/ustore/undo/knl_uundotype.h
./include/postgresql/server/access/ustore/undo/knl_uundoapi.h
./include/postgresql/server/access/ustore/knl_uheap.h
./include/postgresql/server/access/ustore/knl_utuple.h
./include/postgresql/server/access/ustore/knl_utype.h
./include/postgresql/server/access/ustore/knl_upage.h
./include/postgresql/server/access/ustore/knl_uredo.h
./include/postgresql/server/access/ustore/knl_uundovec.h
./include/postgresql/server/access/ustore/knl_uundorecord.h
./include/postgresql/server/access/ustore/undo/knl_uundoxlog.h
./include/postgresql/server/access/ustore/undo/knl_uundotxn.h
./include/postgresql/server/access/ustore/undo/knl_uundozone.h
./include/postgresql/server/access/ustore/undo/knl_uundospace.h
./include/postgresql/server/communication/commproxy_basic.h
./include/postgresql/server/access/parallel_recovery/page_redo.h
./include/postgresql/server/access/parallel_recovery/spsc_blocking_queue.h
./include/postgresql/server/executor/exec/execdesc.h
./include/postgresql/server/db4ai/matrix.h
./include/postgresql/server/db4ai/scores.h
./jre/ASSEMBLY_EXCEPTION
./jre/bin/java
./jre/bin/jjs

1554
build/script/package_internal.sh Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#!/bin/bash
#######################################################################
#############################################################################
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
@ -14,47 +14,65 @@
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# ----------------------------------------------------------------------------
# descript: Compile and pack GaussDB
# Return 0 means OK.
# Return 1 means failed.
# version: 2.0
# date: 2021-02-28
#######################################################################
# Description : gs_backup is a utility to back up or restore binary files and parameter files.
#############################################################################
declare SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
declare ROOT_DIR=$(dirname "${SCRIPT_DIR}")
declare ROOT_DIR=$(dirname "${ROOT_DIR}")
declare package_type='server'
declare product_mode='opengauss'
declare version_mode='release'
declare binarylib_dir='None'
declare om_dir='None'
declare cm_dir='None'
declare show_package='false'
declare install_package_format='tar'
declare config_file=''
#detect platform information.
PLATFORM=32
bit=$(getconf LONG_BIT)
if [ "$bit" -eq 64 ]; then
PLATFORM=64
fi
#get OS distributed version.
kernel=""
version=""
if [ -f "/etc/openEuler-release" ]
then
kernel=$(cat /etc/openEuler-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
version=$(cat /etc/openEuler-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
elif [ -f "/etc/centos-release" ]
then
kernel=$(cat /etc/centos-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
version=$(cat /etc/centos-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
elif [ -f "/etc/euleros-release" ]
then
kernel=$(cat /etc/centos-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
version=$(cat /etc/centos-release | awk -F '(' '{print $2}'| awk -F ')' '{print $1}' | tr A-Z a-z)
else
kernel=$(lsb_release -d | awk -F ' ' '{print $2}'| tr A-Z a-z)
version=$(lsb_release -r | awk -F ' ' '{print $2}')
fi
function print_help()
{
echo "Usage: $0 [OPTION]
-h|--help show help information.
-3rd|--binarylib_dir the directory of third party binarylibs.
-pkg|--package provode type of installation packages, values parameter is server.
-m|--version_mode this values of paramenter is debug, release, memcheck, the default value is release.
-pm|--product_mode this values of paramenter is opengauss or lite, the default value is opengauss.
"
}
## to solve kernel="name=openeuler"
if echo $kernel | grep -q 'openeuler'
then
kernel="openeuler"
fi
if [ $# = 0 ] ; then
echo "missing option"
print_help
if [ X"$kernel" == X"centos" ]; then
dist_version="CentOS"
elif [ X"$kernel" == X"openeuler" ]; then
dist_version="openEuler"
elif [ X"$kernel" == X"euleros" ]; then
dist_version="EulerOS"
elif [ X"$kernel" == X"kylin" ]; then
dist_version="Kylin"
elif [ X"$kernel" = X"ubuntu" ]; then
dist_version="Ubuntu"
else
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64) and Ubuntu(x86) platform."
echo "Kernel is $kernel"
exit 1
fi
declare release_file_list="opengauss_release_list_${kernel}_single"
declare dest_list=""
#########################################################################
##read command line paramenters
#######################################################################
@ -64,29 +82,9 @@ while [ $# -gt 0 ]; do
print_help
exit 1
;;
-3rd|--binarylib_dir)
if [ "$2"X = X ]; then
echo "no given binarylib directory values"
exit 1
fi
binarylib_dir=$2
shift 2
;;
-pkg)
if [ "$2"X = X ]; then
echo "no given package type name"
exit 1
fi
package_type=$2
shift 2
;;
-pm)
if [ "$2"X = X ]; then
echo "no given product mode"
exit 1
fi
product_mode=$2
shift 2
-v|--version)
print_version
exit 1
;;
-m|--version_mode)
if [ "$2"X = X ]; then
@ -96,9 +94,22 @@ while [ $# -gt 0 ]; do
version_mode=$2
shift 2
;;
-S|--show_pkg)
show_package=true
shift
-3rd|--binarylibs_dir)
if [ "$2"X = X ]; then
echo "no given binarylib directory values"
exit 1
fi
binarylib_dir=$2
shift 2
;;
-f|--config_file)
if [ "$2"X = X ]; then
echo "no given config file"
shift 1
else
config_file=$2
shift 2
fi
;;
*)
echo "Internal Error: option processing error: $1" 1>&2
@ -108,37 +119,436 @@ while [ $# -gt 0 ]; do
esac
done
if [ -e "$SCRIPT_DIR/utils/common.sh" ];then
source $SCRIPT_DIR/utils/common.sh
else
exit 1
##add platform architecture information
PLATFORM_ARCH=$(uname -p)
if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then
if [ "$dist_version" != "openEuler" ] && [ "$dist_version" != "EulerOS" ] && [ "$dist_version" != "Kylin" ] ; then
echo "We only support NUMA on openEuler(aarch64), EulerOS(aarch64), Kylin(aarch64) platform."
exit 1
fi
release_file_list="opengauss_release_list_${kernel}_aarch64_single"
fi
#############################################################
# show package for hotpatch sdv.
#############################################################
if [ "$show_package" = true ]; then
echo "package: "$server_package_name
echo "bin: "$bin_name
exit 0
if [ "$version_mode" = "mini" ]; then
release_file_list="opengauss_release_list_mini"
fi
declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install"
declare PKG_TMP_DIR="${BUILD_DIR}/temp"
##default install version storage path
declare server_version='openGauss'
declare server_name_for_package="$(echo ${server_version} | sed 's/ /-/g')" # replace blank with '-' for package name.
declare version_number=''
if [ -e "$SCRIPT_DIR/utils/internal_packages.sh" ];then
source $SCRIPT_DIR/utils/internal_packages.sh
else
exit 1
fi
function main()
#######################################################################
##putout the version of server
#######################################################################
function print_version()
{
echo "[makegaussdb] $(date +%y-%m-%d' '%T): script dir : ${SCRIPT_DIR}"
echo "[makegaussdb] $(date +%y-%m-%d' '%T): Work root dir : ${ROOT_DIR}"
gaussdb_pkg
echo "$version_number"
}
main
#######################################################################
## print help information
#######################################################################
function print_help()
{
echo "Usage: $0 [OPTION]
-h|--help show help information
-V|--version show version information
-m|--version_mode this values of paramenter is debug, release or memcheck, the default value is release
-3rd|--binarylibs_dir the parent directory of binarylibs
"
}
#######################################################################
##version 2.0.0
#######################################################################
function read_srv_version()
{
cd $SCRIPT_DIR
version_number=$(grep 'VERSION' opengauss.spec | awk -F "=" '{print $2}')
echo "${server_name_for_package}-${version_number}">version.cfg
}
###################################
# get version number from globals.cpp
##################################
function read_srv_number()
{
global_kernal="${ROOT_DIR}/src/common/backend/utils/init/globals.cpp"
version_name="GRAND_VERSION_NUM"
version_num=""
line=$(cat $global_kernal | grep ^const* | grep $version_name)
version_num1=${line#*=}
#remove the symbol;
version_num=$(echo $version_num1 | tr -d ";")
#remove the blank
version_num=$(echo $version_num)
if echo $version_num | grep -qE '^92[0-9]+$'
then
# get the last three number
latter=${version_num:2}
echo "92.${latter}" >>${SCRIPT_DIR}/version.cfg
else
echo "Cannot get the version number from globals.cpp."
exit 1
fi
}
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
test -d ${SCRIPT_DIR}/../../output || mkdir -p ${SCRIPT_DIR}/../../output && rm -fr ${SCRIPT_DIR}/../../output/*
output_path=$(cd ${SCRIPT_DIR}/../../output && pwd)
read_srv_version
#######################################################################
## declare all package name
#######################################################################
declare version_string="${server_name_for_package}-${version_number}"
declare package_pre_name="${version_string}-${dist_version}-${PLATFORM}bit"
declare libpq_package_name="${package_pre_name}-Libpq.tar.gz"
declare tools_package_name="${package_pre_name}-tools.tar.gz"
declare kernel_package_name="${package_pre_name}.tar.bz2"
declare kernel_symbol_package_name="${package_pre_name}-symbol.tar.gz"
declare sha256_name="${package_pre_name}.sha256"
echo "[make single db] $(date +%y-%m-%d' '%T): script dir : ${SCRIPT_DIR}"
ROOT_DIR=$(dirname "$SCRIPT_DIR")
ROOT_DIR=$(dirname "$ROOT_DIR")
PLAT_FORM_STR=$(sh "${ROOT_DIR}/src/get_PlatForm_str.sh")
if [ "${PLAT_FORM_STR}"x == "Failed"x ]
then
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64) platform."
exit 1;
fi
PG_REG_TEST_ROOT="${ROOT_DIR}/"
PMK_SCHEMA="${ROOT_DIR}/script/pmk_schema.sql"
declare LOG_FILE="${SCRIPT_DIR}/make_package.log"
declare BUILD_DIR="${ROOT_DIR}/mppdb_temp_install"
BUILD_TOOLS_PATH="${ROOT_DIR}/binarylibs/buildtools/${PLAT_FORM_STR}"
BINARYLIBS_PATH="${ROOT_DIR}/binarylibs/dependency/${PLAT_FORM_STR}"
declare UPGRADE_SQL_DIR="${ROOT_DIR}/src/include/catalog/upgrade_sql"
if [ "${binarylib_dir}"x != "None"x ]
then
echo "binarylib dir : ${binarylib_dir}"
BUILD_TOOLS_PATH="${binarylib_dir}/buildtools/${PLAT_FORM_STR}"
BINARYLIBS_PATH="${binarylib_dir}/dependency/${PLAT_FORM_STR}"
fi
gcc_version="7.3"
export CC=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin/gcc
export CXX=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin/g++
export LD_LIBRARY_PATH=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/lib64:$BUILD_TOOLS_PATH/gcc$gcc_version/isl/lib:$BUILD_TOOLS_PATH/gcc$gcc_version/mpc/lib/:$BUILD_TOOLS_PATH/gcc$gcc_version/mpfr/lib/:$BUILD_TOOLS_PATH/gcc$gcc_version/gmp/lib/:$LD_LIBRARY_PATH
export PATH=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin:$PATH
read_srv_number
#######################################################################
# move pkgs to output directory
#######################################################################
function deploy_pkgs()
{
for pkg in $@; do
if [ -f $pkg ]; then
mv $pkg $output_path/
fi
done
}
#######################################################################
# Print log.
#######################################################################
log()
{
echo "[make single db] $(date +%y-%m-%d' '%T): $@"
echo "[make single db] $(date +%y-%m-%d' '%T): $@" >> "$LOG_FILE" 2>&1
}
#######################################################################
# print log and exit.
#######################################################################
die()
{
log "$@"
echo "$@"
exit 1
}
#######################################################################
##install gaussdb database contained server
#######################################################################
function install_gaussdb()
{
cd $SCRIPT_DIR
if [ "$version_mode" = "release" ] || [ "$version_mode" = "mini" ]; then
chmod +x ./separate_debug_information.sh
./separate_debug_information.sh
cd $SCRIPT_DIR
mv symbols.tar.gz $kernel_symbol_package_name
deploy_pkgs $kernel_symbol_package_name
fi
#insert the commitid to version.cfg as the upgrade app path specification
export PATH=${BUILD_DIR}:$PATH
export LD_LIBRARY_PATH=${BUILD_DIR}/lib:$LD_LIBRARY_PATH
commitid=$(LD_PRELOAD='' ${BUILD_DIR}/bin/gaussdb -V | awk '{print $6}' | cut -d ")" -f 1)
if [ -z "$commitid" ]
then
commitid=$(date "+%Y%m%d%H%M%S")
commitid=${commitid:4:8}
fi
echo "${commitid}" >>${SCRIPT_DIR}/version.cfg
echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1
}
#######################################################################
# copy directory's files list to $2
#######################################################################
function copy_files_list()
{
for file in $(echo $1)
do
test -e $file && tar -cpf - $file | ( cd $2; tar -xpf - )
done
}
#######################################################################
# set postgresql.conf.sample from config_file when packing
#######################################################################
function set_config_sample()
{
if [[ -f $config_file ]]
then
config_sample_file=${BUILD_DIR}/share/postgresql/postgresql.conf.sample
if [[ ! -f "$config_sample_file" ]]
then
echo "postgresql.conf.sample does not exist"
exit 1
else
echo "#------------------------------------------------------------------------------" >> $config_sample_file
echo "# USER SET CONFIG ON COMPILING TIME" >> $config_sample_file
echo "#------------------------------------------------------------------------------" >> $config_sample_file
while IFS= read -r line; do
SUBSTRING=$(echo $line | cut -d'=' -f 1)"= "
if grep -q "$SUBSTRING" $config_sample_file ; then
sed -i "/$SUBSTRING/c$line" $config_sample_file
else
echo $line >> $config_sample_file
fi
done < $config_file
fi
fi
}
#######################################################################
##copy target file into temporary directory temp
#######################################################################
function target_file_copy()
{
cd ${BUILD_DIR}
set_config_sample
copy_files_list "$1" $2
cp ${SCRIPT_DIR}/version.cfg ${BUILD_DIR}/temp
cp -rf ${SCRIPT_DIR}/../../simpleInstall ${BUILD_DIR}/temp
if [ $? -ne 0 ]; then
die "copy ${SCRIPT_DIR}/version.cfg to ${BUILD_DIR}/temp failed"
fi
sed -i '/^process_cpu_affinity|/d' $2/bin/cluster_guc.conf
#generate tar file
echo "Begin generate ${kernel_package_name} tar file..." >> "$LOG_FILE" 2>&1
cd $2
tar -jcvpf "${kernel_package_name}" ./* >> "$LOG_FILE" 2>&1
cd '-'
mv $2/"${kernel_package_name}" ./
if [ $? -ne 0 ]; then
die "generate ${kernel_package_name} failed."
fi
echo "End generate ${kernel_package_name} tar file" >> "$LOG_FILE" 2>&1
#generate sha256 file
sha256_name="${package_pre_name}.sha256"
echo "Begin generate ${sha256_name} sha256 file..." >> "$LOG_FILE" 2>&1
sha256sum "${kernel_package_name}" | awk -F" " '{print $1}' > "$sha256_name"
if [ $? -ne 0 ]; then
die "generate sha256 file failed."
fi
echo "End generate ${sha256_name} sha256 file" >> "$LOG_FILE" 2>&1
###################################################
# make server package
###################################################
if [ -d "${2}" ]; then
rm -rf ${2}
fi
}
function target_file_copy_for_non_server()
{
cd ${BUILD_DIR}
copy_files_list "$1" $2
}
#######################################################################
##function make_package_prep have two actions
##1.parse release_file_list variable represent file
##2.copy target file into a newly created temporary directory temp
#######################################################################
function prep_dest_list()
{
cd $SCRIPT_DIR
releasefile=$1
pkgname=$2
local head=$(cat $releasefile | grep "\[$pkgname\]" -n | awk -F: '{print $1}')
if [ ! -n "$head" ]; then
die "error: ono find $pkgname in the $releasefile file "
fi
local tail=$(cat $releasefile | sed "1,$head d" | grep "^\[" -n | sed -n "1p" | awk -F: '{print $1}')
if [ ! -n "$tail" ]; then
local all=$(cat $releasefile | wc -l)
let tail=$all+1-$head
fi
dest_list=$(cat $releasefile | awk "NR==$head+1,NR==$tail+$head-1")
}
function make_package_srv()
{
echo "Begin package server"
cd $SCRIPT_DIR
prep_dest_list $release_file_list 'server'
rm -rf ${BUILD_DIR}/temp
mkdir -p ${BUILD_DIR}/temp/etc
target_file_copy "$dest_list" ${BUILD_DIR}/temp
deploy_pkgs ${sha256_name} ${kernel_package_name}
echo "make server(all) package success!"
}
#######################################################################
# Install all SQL files from src/distribute/include/catalog/upgrade_sql
# to INSTALL_DIR/bin/script/upgrade_sql.
# Package all SQL files and then verify them with SHA256.
#######################################################################
function make_package_upgrade_sql()
{
echo "Begin to install upgrade_sql files..."
UPGRADE_SQL_TAR="upgrade_sql.tar.gz"
UPGRADE_SQL_SHA256="upgrade_sql.sha256"
cd $SCRIPT_DIR
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
rm -rf temp
mkdir temp
cd ${BUILD_DIR}/temp
cp -r "${UPGRADE_SQL_DIR}" ./upgrade_sql
[ $? -ne 0 ] && die "Failed to cp upgrade_sql files"
tar -czf ${UPGRADE_SQL_TAR} upgrade_sql
[ $? -ne 0 ] && die "Failed to package ${UPGRADE_SQL_TAR}"
rm -rf ./upgrade_sql > /dev/null 2>&1
sha256sum ${UPGRADE_SQL_TAR} | awk -F" " '{print $1}' > "${UPGRADE_SQL_SHA256}"
[ $? -ne 0 ] && die "Failed to generate sha256 sum file for ${UPGRADE_SQL_TAR}"
chmod 600 ${UPGRADE_SQL_TAR}
chmod 600 ${UPGRADE_SQL_SHA256}
deploy_pkgs ${UPGRADE_SQL_TAR} ${UPGRADE_SQL_SHA256}
echo "Successfully packaged upgrade_sql files."
}
function make_package_libpq()
{
cd $SCRIPT_DIR
prep_dest_list $release_file_list 'libpq'
rm -rf ${BUILD_DIR}/temp
mkdir -p ${BUILD_DIR}/temp
target_file_copy_for_non_server "$dest_list" ${BUILD_DIR}/temp
cd ${BUILD_DIR}/temp
echo "packaging libpq..."
tar -zvcf "${libpq_package_name}" ./* >>"$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "$package_command ${libpq_package_name} failed"
fi
deploy_pkgs ${libpq_package_name}
echo "install $pkgname tools is ${libpq_package_name} of ${output_path} directory " >> "$LOG_FILE" 2>&1
echo "success!"
}
function make_package_tools()
{
cd $SCRIPT_DIR
prep_dest_list $release_file_list 'client'
rm -rf ${BUILD_DIR}/temp
mkdir -p ${BUILD_DIR}/temp
cd ${BUILD_DIR}/
target_file_copy_for_non_server "$dest_list" ${BUILD_DIR}/temp
cd ${BUILD_DIR}/temp
echo "packaging tools..."
tar -zvcf "${tools_package_name}" ./* >>"$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "$package_command ${tools_package_name} failed"
fi
deploy_pkgs ${tools_package_name}
echo "install $pkgname tools is ${tools_package_name} of ${output_path} directory " >> "$LOG_FILE" 2>&1
echo "success!"
}
function spec_prep()
{
cp opengauss.spec gauss.spec
}
#######################################################################
## Check the installation package production environment
#######################################################################
function srv_pkg_bld()
{
install_gaussdb
}
function srv_pkg_make()
{
echo "Start package opengauss."
make_package_srv
make_package_libpq
make_package_tools
make_package_upgrade_sql
echo "End package opengauss."
}
#############################################################
# main function
#############################################################
# 0. prepare spec file
spec_prep
# 1. build server
srv_pkg_bld
# 2. make package
srv_pkg_make
echo "now, all packages has finished!"
exit 0

265
build/script/reconstruct.sh Normal file
View File

@ -0,0 +1,265 @@
#!/bin/bash
#######################################################################
# Copyright (c): 2020-2025, Huawei Tech. Co., Ltd.
# descript: recompress package
# version: 2.0
# date: 2021-05-19
#######################################################################
declare server_package_path=""
declare agent_package_path=""
declare product_mode="multiple"
declare unpack_server="unpack_server"
declare unpack_agent="unpack_agent"
declare unpack_psycopg2="unpack_psycopg2"
declare compress_command="tar -zcf"
declare decompress_command="tar -zxf"
function print_help()
{
echo "Usage: $0 [OPTION]
-h|--help show help information.
-pm product mode, values parameter is single, multiple or opengauss, default value is multiple.
--server-pacakge the server pacakge path.
--agent-package the agent package path, only -pm is single or multiple need.
"
}
function log() {
echo "[makegaussdb] $(date +%y-%m-%d' '%T): $@"
}
function error() {
echo -e "\033[31m[makegaussdb] $(date +%y-%m-%d' '%T) Error: $@\033[0m"
}
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
print_help
exit 1
;;
-pm)
if [ X$2 == X"" ]; then
error "no given pm product mode."
exit 1
fi
product_mode=$2
shift 2
;;
--server-package)
if [ X$2 == X"" ]; then
error "no given server compress path"
exit 1
fi
server_package_path=$2
shift 2
;;
--agent-package)
if [ X$2 == X"" ]; then
error "no given agent compress path"
exit 1
fi
agent_package_path=$2
shift 2
;;
*)
echo "Internal Error: option processing error: $1" 1>&2
echo "please input right paramtenter, the following command may help you"
echo "sh reconstruct.sh --help or sh reconstruct.sh -h"
exit 1
esac
done
function standard_path() {
local package_path=$1
local first_char=$(expr substr "${package_path}" 1 1)
if [ "${first_char}" != "/" ]; then
package_path="$(pwd)/${package_path}"
fi
echo "${package_path}"
}
function check_path() {
local package_type=$1
local package_path=$2
if [ X${package_path} = X ]; then
error "the paramtenter --${package_type} can not be empty."
exit 1
fi
if [ ! -f "${package_path}" ]; then
error "the file ${package_path} not exist, please check."
exit 1
fi
}
function check_parameter() {
check_path "server-package" ${server_package_path}
server_package_path=$(standard_path ${server_package_path})
if [ X${product_mode} != X"opengauss" ]; then
check_path "agent-pacakge" ${agent_package_path}
agent_package_path=$(standard_path ${agent_package_path})
fi
}
function backup_compress() {
local compress_name=$1
local bak_package_name="${compress_name%%.*}_old.${compress_name#*.}"
if [ -d "${bak_package_name}" ]; then
rm -rf ${bak_package_name}
fi
cp ${compress_name} ${bak_package_name}
}
function delete_backup_package() {
local compress_name=$1
local bak_package_name="${compress_name%%.*}_old.${compress_name#*.}"
if [ -d "${bak_package_name}" ]; then
rm -rf ${bak_package_name}
fi
}
function final_compress() {
local compress_file=$1
if [ X"${compress_file##*.}" == X"zip" ]; then
zip -q -r ${compress_file} ./*
else
${compress_command} ${compress_file} ./*
fi
}
function begin_decompress() {
local decompress_file=$1
local decompress_dir=$2
if [ X"${decompress_file##*.}" == X"zip" ]; then
unzip -q ${decompress_file} -d ${decompress_dir}
else
${decompress_command} ${decompress_file} -C ${decompress_dir}
fi
}
function distribute_compress() {
server_dir=$(dirname "${server_package_path}")
server_name=$(basename "${server_package_path}")
agent_dir=$(dirname "${agent_package_path}")
agent_name=$(basename "${agent_package_path}")
log "server_name: ${server_name}, agent_name: ${agent_name}"
# decompress server package and copy psycopg2 to lib
cd ${server_dir}
backup_compress ${server_name}
if [ -e "${unpack_server}" ]; then
rm -rf ${unpack_server}
fi
mkdir ${unpack_server}
begin_decompress ${server_name} ${unpack_server}
cd ${unpack_server} && mkdir ${unpack_server} ${unpack_psycopg2}
euler_name=$(basename "$(find . -name "GaussDB-Kernel-V500R00*-64bit.tar.gz")")
psycopg2_name=$(basename "$(find . -name "GaussDB-Kernel-V500R00*-64bit-Python.tar.gz")")
log "euler_name: ${euler_name}, psycopg2_name: ${psycopg2_name}"
${decompress_command} ${euler_name} -C ${unpack_server}
${decompress_command} ${psycopg2_name} -C ${unpack_psycopg2}
chmod -R 700 ${unpack_psycopg2}/psycopg2
cp -r ${unpack_psycopg2}/psycopg2 ${unpack_server}/lib
cp -r ${unpack_psycopg2}/psycopg2 ${unpack_server}/script/gspylib/inspection/lib
log "complete copy psycopg2 to server package."
# decompress agent package and copy psycopg2 to lib, then compress
cd ${agent_dir}
backup_compress ${agent_name}
if [ -e "${unpack_agent}" ]; then
rm -rf ${unpack_agent}
fi
mkdir ${unpack_agent}
begin_decompress ${agent_name} ${unpack_agent}
cd ${unpack_agent} && mkdir ${unpack_agent}
agent_tar_name=$(basename "$(find . -name "GaussDB-Kernel-V500R00*-64bit-AGENT.tar.gz")")
${decompress_command} ${agent_tar_name} -C ${unpack_agent}
cd ${unpack_agent}
cp -r ${server_dir}/${unpack_server}/${unpack_psycopg2}/psycopg2 lib/
${compress_command} ${agent_tar_name} ./*
rm -rf ../${agent_tar_name} && mv ${agent_tar_name} ../ && cd ../ && rm -rf ${unpack_agent}
final_compress ${agent_name}
rm -rf ../${agent_name} && mv ${agent_name} ../ && cd ../ && rm -rf ${unpack_agent}
cd ${agent_dir}
delete_backup_package ${agent_name}
log "complete copy psycopg2 to agent package and compress agent package."
# compress server package
log "begin to compress server package ......"
cd ${server_dir}/${unpack_server}/${unpack_server}
${compress_command} ${euler_name} ./*
rm -rf ../${euler_name} && mv ${euler_name} ../ && cd ../ && rm -rf ${unpack_server}
if [ -d "${unpack_psycopg2}" ]; then
rm -rf ${unpack_psycopg2}
fi
final_compress ${server_name}
rm -rf ../${server_name} && mv ${server_name} ../ && cd ../ && rm -rf ${unpack_server}
cd ${server_dir}
delete_backup_package ${server_name}
log "complete compress server package."
}
function opengauss_compress() {
server_dir=$(dirname "${server_package_path}")
server_name=$(basename "${server_package_path}")
cd ${server_dir}
backup_compress ${server_name}
if [ -e "${unpack_server}" ]; then
rm -rf ${unpack_server}
fi
mkdir ${unpack_server}
${decompress_command} ${server_name} -C ${unpack_server}
cd ${unpack_server} && mkdir ${unpack_agent} ${unpack_psycopg2}
psycopg2_name=$(basename "$(find . -name "openGauss-*-Python.tar.gz")")
agent_name=$(basename "$(find . -name "openGauss-*-om.tar.gz")")
log "agent_name: ${agent_name}, psycopg2_name: ${psycopg2_name}"
${decompress_command} ${agent_name} -C ${unpack_agent}
${decompress_command} ${psycopg2_name} -C ${unpack_psycopg2}
chmod -R 700 ${unpack_psycopg2}/psycopg2
cp -r ${unpack_psycopg2}/psycopg2 ${unpack_agent}/lib
cp -r ${unpack_psycopg2}/psycopg2 ${unpack_agent}/script/gspylib/inspection/lib
log "complete copy psycopg2 to agent package."
# compress agent package
cd ${unpack_agent}
${compress_command} ${agent_name} ./*
rm -rf ../${agent_name} && mv ${agent_name} ../ && cd ../ && rm -rf ${unpack_agent}
log "complete compress agent package."
# recover om sha256
sha256_name="$(echo ${agent_name} | sed 's/\.tar\.gz//').sha256"
if [ -d "${sha256_name}" ]; then
rm -rf ${sha256_name}
fi
sha256sum "${agent_name}" | awk -F" " '{print $1}' > "${sha256_name}"
if [ $? -ne 0 ]; then
die "generate sha256 file failed."
fi
if [ -d "${unpack_psycopg2}" ]; then
rm -rf ${unpack_psycopg2}
fi
${compress_command} ${server_name} ./*
rm -rf ../${server_name} && mv ${server_name} ../ && cd ../ && rm -rf ${unpack_server}
delete_backup_package ${server_name}
log "complete compress server package."
}
check_parameter
if [ X${product_mode} == X"opengauss" ]; then
opengauss_compress
else
distribute_compress
fi

View File

@ -76,14 +76,11 @@ separate_symbol()
echo "$x is a script, do not separate symbol"
elif [[ "$x" = *".dat" ]];then
echo "$x is a license file, do not separate symbol"
# The following second condition judges whether the file is a shell script without a suffix name.
# Usually, executable shell script has a header comment that indicates which interpreter to use,
# e.g., "#!/usr/bin/env bash".
elif [[ "$x" = *".sh" ]] || [[ -f "$x" && -x "$x" && "$(head -c2 $x)" == '#!' ]]; then
elif [[ "$x" = *".sh" ]];then
echo "$x is a shell file, do not separate symbol"
elif [[ "$x" = *".la" ]];then
echo "$x is a la file, do not separate symbol"
elif [[ "$x" = *".crt" ]];then
elif [[ "$x" = *".crt" ]];then
echo "$x is a crt file, do not separate symbol"
elif [[ "$x" = *".ini" ]];then
echo "$x is a ini file, do not separate symbol"

View File

@ -1,187 +0,0 @@
#!/bin/bash
#######################################################################
# Copyright (c): 2020-2021, Huawei Tech. Co., Ltd.
# descript: Compile and pack openGauss
# Return 0 means OK.
# Return 1 means failed.
# version: 2.0
# date: 2020-08-08
#######################################################################
#######################################################################
## Check the installation package production environment
#######################################################################
function gaussdb_pkg_pre_clean()
{
if [ -d "$BUILD_DIR" ]; then
rm -rf $BUILD_DIR
fi
if [ -d "$LOG_FILE" ]; then
rm -rf $LOG_FILE
fi
}
###################################
#######################################################################
##read version from gaussdb.ver
#######################################################################
function read_gaussdb_version()
{
cd ${SCRIPT_DIR}
echo "${gaussdb_name_for_package}-${version_number}" > version.cfg
#auto read the number from kernal globals.cpp, no need to change it here
}
###################################
# get version number from globals.cpp
##################################
function read_gaussdb_number()
{
global_kernal="${ROOT_DIR}/src/common/backend/utils/init/globals.cpp"
version_name="GRAND_VERSION_NUM"
version_num=""
line=$(cat $global_kernal | grep ^const* | grep $version_name)
version_num1=${line#*=}
#remove the symbol;
version_num=$(echo $version_num1 | tr -d ";")
#remove the blank
version_num=$(echo $version_num)
if echo $version_num | grep -qE '^92[0-9]+$'
then
# get the last three number
latter=${version_num:2}
echo "92.${latter}" >>${SCRIPT_DIR}/version.cfg
else
echo "Cannot get the version number from globals.cpp."
exit 1
fi
}
#######################################################################
##insert the commitid to version.cfg as the upgrade app path specification
#######################################################################
function get_kernel_commitid()
{
export PATH=${BUILD_DIR}:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
commitid=$(LD_PRELOAD='' ${BUILD_DIR}/bin/gaussdb -V | awk '{print $5}' | cut -d ")" -f 1)
echo "${commitid}" >>${SCRIPT_DIR}/version.cfg
echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1
}
#######################################################################
## generate the version file.
#######################################################################
function make_license_control()
{
python_exec=$(which python 2>/dev/null)
if [ -x "$python_exec" ]; then
$python_exec ${binarylib_dir}/buildtools/license_control/encrypted_version_file.py >> "$LOG_FILE" 2>&1
fi
if [ $? -ne 0 ]; then
die "create ${binarylib_dir}/buildtools/license_control license file failed."
fi
if [ -f "$gaussdb_200_file" ] && [ -f "$gaussdb_300_file" ]; then
# Get the md5sum.
gaussdb_200_sha256sum=$(sha256sum $gaussdb_200_file | awk '{print $1}')
gaussdb_300_sha256sum=$(sha256sum $gaussdb_300_file | awk '{print $1}')
# Modify the source code.
sed -i "s/^[ \t]*const[ \t]\+char[ \t]*\*[ \t]*sha256_digests[ \t]*\[[ \t]*SHA256_DIGESTS_COUNT[ \t]*\][ \t]*=[ \t]*{[ \t]*NULL[ \t]*,[ \t]*NULL[ \t]*}[ \t]*;[ \t]*$/const char \*sha256_digests\[SHA256_DIGESTS_COUNT\] = {\"$gaussdb_200_sha256sum\", \"$gaussdb_300_sha256sum\"};/g" $gaussdb_version_file
fi
if [ $? -ne 0 ]; then
die "modify '$gaussdb_version_file' failed."
fi
}
function make_gaussdb_kernel()
{
export BUILD_TUPLE=${PLATFORM_ARCH}
export THIRD_BIN_PATH="${binarylib_dir}"
export PREFIX_HOME="${BUILD_DIR}"
export DEBUG_TYPE=${version_mode}
echo "Begin make install gaussdb server" >> "$LOG_FILE" 2>&1
export GAUSSHOME=${BUILD_DIR}
export LD_LIBRARY_PATH=${BUILD_DIR}/lib:${BUILD_DIR}/lib/postgresql:${LD_LIBRARY_PATH}
[ -d "${CMAKE_BUILD_DIR}" ] && rm -rf ${CMAKE_BUILD_DIR}
[ -d "${BUILD_DIR}" ] && rm -rf ${BUILD_DIR}
mkdir -p ${CMAKE_BUILD_DIR}
cd ${CMAKE_BUILD_DIR}
cmake .. ${CMAKE_OPT}
if [ $? -ne 0 ]; then
die "cmake failed."
fi
cpus_num=$(grep -w processor /proc/cpuinfo|wc -l)
make -sj ${cpus_num}
if [ $? -ne 0 ]; then
die "make failed."
fi
make install -sj ${cpus_num}
if [ $? -ne 0 ]; then
die "make install failed."
fi
echo "End make install gaussdb server" >> "$LOG_FILE" 2>&1
}
#######################################################################
##install gaussdb database contained server,client and libpq
#######################################################################
function install_gaussdb()
{
# Generate the license control file, and set md5sum string to the code.
echo "Modify gaussdb_version.cpp file." >> "$LOG_FILE" 2>&1
make_license_control
echo "Modify gaussdb_version.cpp file success." >> "$LOG_FILE" 2>&1
cd "$ROOT_DIR/"
if [ $? -ne 0 ]; then
die "change dir to $ROOT_DIR failed."
fi
if [ "$version_mode" = "debug" -a "$separate_symbol" = "on" ]; then
echo "WARNING: do not separate symbol in debug mode!"
fi
if [ "$product_mode" != "opengauss" ]; then
die "the product mode can only be opengauss!"
fi
echo "build gaussdb kernel." >> "$LOG_FILE" 2>&1
make_gaussdb_kernel
echo "build gaussdb kernel success." >> "$LOG_FILE" 2>&1
chmod 444 ${BUILD_DIR}/bin/cluster_guc.conf
dos2unix ${BUILD_DIR}/bin/cluster_guc.conf > /dev/null 2>&1
#insert the commitid to version.cfg as the upgrade app path specification
get_kernel_commitid
}
#######################################################################
##install gaussdb database and others
##select to install something according to variables package_type need
#######################################################################
function gaussdb_build()
{
case "$package_type" in
server)
install_gaussdb
;;
libpq)
install_gaussdb
;;
*)
echo "Internal Error: option processing error: $package_type"
echo "please input right paramenter values server or libpq "
exit 1
esac
}

View File

@ -1,169 +0,0 @@
#!/bin/bash
#######################################################################
# Copyright (c): 2020-2025, Huawei Tech. Co., Ltd.
# descript: Compile and pack openGauss
# Return 0 means OK.
# Return 1 means failed.
# version: 2.0
# date: 2020-08-08
#######################################################################
declare LOG_FILE="${SCRIPT_DIR}/makemppdb_pkg.log"
declare gaussdb_version='openGauss'
declare PLATFORM_ARCH=$(uname -p)
declare package_path=${ROOT_DIR}/output
declare install_package_format="tar"
declare PLATFORM=32
bit=$(getconf LONG_BIT)
if [ "$bit" -eq 64 ]; then
declare PLATFORM=64
fi
# 公共方法
#######################################################################
##putout the version of gaussdb
#######################################################################
function print_version()
{
echo "$version_number"
}
#######################################################################
# Print log.
#######################################################################
function log()
{
echo "[makegaussdb] $(date +%y-%m-%d' '%T): $@"
echo "[makegaussdb] $(date +%y-%m-%d' '%T): $@" >> "$LOG_FILE" 2>&1
}
#######################################################################
# print log and exit.
#######################################################################
function die()
{
log "$@"
echo "$@"
exit $ERR_MKGS_FAILED
}
#######################################################################
##select package command accroding to install_package_format
#######################################################################
function select_package_command()
{
case "$install_package_format" in
tar)
tar='tar'
option=' -zcvf'
package_command="$tar$option"
;;
esac
}
select_package_command
#######################################################################
##get os dist version
#######################################################################
export PLAT_FORM_STR=$(sh "${ROOT_DIR}/src/get_PlatForm_str.sh")
if [ "${PLAT_FORM_STR}"x == "Failed"x -o "${PLAT_FORM_STR}"x == ""x ]
then
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64), Asianux platform."
exit 1;
fi
if [[ "$PLAT_FORM_STR" =~ "euleros" ]]; then
dist_version="EulerOS"
if [ "$PLATFORM_ARCH"X == "aarch64"X ];then
GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA"
fi
elif [[ "$PLAT_FORM_STR" =~ "centos" ]]; then
dist_version="CentOS"
if [ "$PLATFORM_ARCH"X == "aarch64"X ];then
GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA"
fi
elif [[ "$PLAT_FORM_STR" =~ "openeuler" ]]; then
dist_version="openEuler"
if [ "$PLATFORM_ARCH"X == "aarch64"X ];then
GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA -D__ARM_LSE"
fi
elif [[ "$PLAT_FORM_STR" =~ "kylin" ]]; then
dist_version="Kylin"
if [ "$PLATFORM_ARCH"X == "aarch64"X ];then
GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA"
fi
elif [[ "$PLAT_FORM_STR" =~ "asianux" ]]; then
dist_version="Asianux"
if [ "$PLATFORM_ARCH"X == "aarch64"X ];then
GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA"
fi
else
echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64), Asianux platform."
echo "Kernel is $kernel"
exit 1
fi
##add platform architecture information
if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then
if [ "$dist_version" != "openEuler" ] && [ "$dist_version" != "EulerOS" ] && [ "$dist_version" != "Kylin" ] && [ "$dist_version" != "Asianux" ]; then
echo "We only support NUMA on openEuler(aarch64), EulerOS(aarch64), Kylin(aarch64), Asianux platform."
exit 1
fi
fi
if [ "${binarylib_dir}" != 'None' ] && [ -d "${binarylib_dir}" ]; then
BUILD_TOOLS_PATH="${binarylib_dir}/buildtools/${PLAT_FORM_STR}"
PLATFORM_PATH="${binarylib_dir}/platform/${PLAT_FORM_STR}"
BINARYLIBS_PATH="${binarylib_dir}/dependency"
else
die "${binarylib_dir} not exist"
fi
declare INSTALL_TOOLS_DIR=${BINARYLIBS_PATH}/install_tools_${PLAT_FORM_STR}
declare UNIX_ODBC="${BINARYLIBS_PATH}/${PLAT_FORM_STR}/unixodbc"
# Comment 编译相关
gcc_version="7.3"
ccache -V >/dev/null 2>&1 && USE_CCACHE="ccache " ENABLE_CCACHE="--enable-ccache"
export CC="${USE_CCACHE}$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin/gcc"
export CXX="${USE_CCACHE}$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin/g++"
export LD_LIBRARY_PATH=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/lib64:$BUILD_TOOLS_PATH/gcc$gcc_version/isl/lib:$BUILD_TOOLS_PATH/gcc$gcc_version/mpc/lib/:$BUILD_TOOLS_PATH/gcc$gcc_version/mpfr/lib/:$BUILD_TOOLS_PATH/gcc$gcc_version/gmp/lib/:$LD_LIBRARY_PATH
export PATH=$BUILD_TOOLS_PATH/gcc$gcc_version/gcc/bin:$PATH
export JAVA_HOME=${binarylib_dir}/platform/huaweijdk8/${PLATFORM_ARCH}/jdk
declare ERR_MKGS_FAILED=1
declare MKGS_OK=0
gaussdb_200_file="${binarylib_dir}/buildtools/license_control/gaussdb.version.GaussDB200"
gaussdb_300_file="${binarylib_dir}/buildtools/license_control/gaussdb.version.GaussDB300"
gaussdb_200_standard_file="${binarylib_dir}/buildtools/license_control/gaussdb.license.GaussDB200_Standard"
gaussdb_version_file="${ROOT_DIR}/src/gausskernel/process/postmaster/gaussdb_version.cpp"
if [ -f "$SCRIPT_DIR/gaussdb.ver" ];then
declare version_number=$(cat ${SCRIPT_DIR}/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}')
else
echo "gaussdb.ver not found!"
exit 1
fi
declare release_file_list="${PLATFORM_ARCH}_${product_mode}_list"
#######################################################################
## declare all package name
#######################################################################
declare gaussdb_name_for_package="$(echo ${gaussdb_version} | sed 's/ /-/g')"
declare version_string="${gaussdb_name_for_package}-${version_number}"
declare package_pre_name="${version_string}-${dist_version}-${PLATFORM}bit"
declare libpq_package_name="${package_pre_name}-Libpq.tar.gz"
declare tools_package_name="${package_pre_name}-tools.tar.gz"
declare kernel_package_name="${package_pre_name}.tar.bz2"
declare symbol_package_name="${package_pre_name}-symbol.tar.gz"
declare sha256_name="${package_pre_name}.sha256"

View File

@ -1,242 +0,0 @@
#!/bin/bash
#############################################################################
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# ----------------------------------------------------------------------------
# Description : gs_backup is a utility to back up or restore binary files and parameter files.
#############################################################################
declare UPGRADE_SQL_DIR="${ROOT_DIR}/src/include/catalog/upgrade_sql"
#######################################################################
# move pkgs to output directory
#######################################################################
function deploy_pkgs()
{
mkdir -p $package_path
for pkg in $@; do
if [ -f "$pkg" ]; then
mv $pkg $package_path/
fi
done
}
#######################################################################
# copy directory's files list to $2
#######################################################################
function copy_files_list()
{
for file in $(echo $1)
do
test -e $file && tar -cpf - $file | ( cd $2; tar -xpf - )
done
}
#######################################################################
##copy target file into temporary directory temp
#######################################################################
function target_file_copy()
{
cd ${BUILD_DIR}
copy_files_list "$1" $2
cp ${SCRIPT_DIR}/version.cfg ${BUILD_DIR}/temp
# package simpleInstall dir
cp -rf ${SCRIPT_DIR}/../../simpleInstall ${BUILD_DIR}/temp
if [ $? -ne 0 ]; then
die "copy ${SCRIPT_DIR}/version.cfg to ${BUILD_DIR}/temp failed"
fi
sed -i '/^process_cpu_affinity|/d' $2/bin/cluster_guc.conf
#generate tar file
echo "Begin generate ${kernel_package_name} tar file..." >> "$LOG_FILE" 2>&1
cd $2
tar -jcvpf "${kernel_package_name}" ./* >> "$LOG_FILE" 2>&1
cd '-'
mv $2/"${kernel_package_name}" ./
if [ $? -ne 0 ]; then
die "generate ${kernel_package_name} failed."
fi
echo "End generate ${kernel_package_name} tar file" >> "$LOG_FILE" 2>&1
#generate sha256 file
sha256_name="${package_pre_name}.sha256"
echo "Begin generate ${sha256_name} sha256 file..." >> "$LOG_FILE" 2>&1
sha256sum "${kernel_package_name}" | awk -F" " '{print $1}' > "$sha256_name"
if [ $? -ne 0 ]; then
die "generate sha256 file failed."
fi
echo "End generate ${sha256_name} sha256 file" >> "$LOG_FILE" 2>&1
###################################################
# make server package
###################################################
if [ -d "${2}" ]; then
rm -rf ${2}
fi
}
function target_file_copy_for_non_server()
{
cd ${BUILD_DIR}
copy_files_list "$1" $2
}
#######################################################################
##function make_package_prep have two actions
##1.parse release_file_list variable represent file
##2.copy target file into a newly created temporary directory temp
#######################################################################
function prep_dest_list()
{
cd $SCRIPT_DIR
releasefile=$1
pkgname=$2
local head=$(cat $releasefile | grep "\[$pkgname\]" -n | awk -F: '{print $1}')
if [ ! -n "$head" ]; then
die "error: ono find $pkgname in the $releasefile file "
fi
local tail=$(cat $releasefile | sed "1,$head d" | grep "^\[" -n | sed -n "1p" | awk -F: '{print $1}')
if [ ! -n "$tail" ]; then
local all=$(cat $releasefile | wc -l)
let tail=$all+1-$head
fi
dest_list=$(cat $releasefile | awk "NR==$head+1,NR==$tail+$head-1")
}
#######################################################################
##back to separate_debug_symbol.sh dir
#######################################################################
function separate_symbol()
{
cd $SCRIPT_DIR
if [ "$version_mode" = "release" ]; then
chmod +x ./separate_debug_information.sh
./separate_debug_information.sh
cd $SCRIPT_DIR
mv symbols.tar.gz $symbol_package_name
deploy_pkgs $symbol_package_name
fi
}
function make_package_srv()
{
echo "Begin package server"
cd $SCRIPT_DIR
prep_dest_list $release_file_list 'server'
rm -rf ${BUILD_DIR}/temp
mkdir -p ${BUILD_DIR}/temp/etc
target_file_copy "$dest_list" ${BUILD_DIR}/temp
deploy_pkgs ${sha256_name} ${kernel_package_name}
echo "make server(all) package success!"
}
#######################################################################
# Install all SQL files from src/distribute/include/catalog/upgrade_sql
# to INSTALL_DIR/bin/script/upgrade_sql.
# Package all SQL files and then verify them with SHA256.
#######################################################################
function make_package_upgrade_sql()
{
echo "Begin to install upgrade_sql files..."
UPGRADE_SQL_TAR="upgrade_sql.tar.gz"
UPGRADE_SQL_SHA256="upgrade_sql.sha256"
cd $SCRIPT_DIR
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
rm -rf temp
mkdir temp
cd ${BUILD_DIR}/temp
cp -r "${UPGRADE_SQL_DIR}" ./upgrade_sql
[ $? -ne 0 ] && die "Failed to cp upgrade_sql files"
tar -czf ${UPGRADE_SQL_TAR} upgrade_sql
[ $? -ne 0 ] && die "Failed to package ${UPGRADE_SQL_TAR}"
rm -rf ./upgrade_sql > /dev/null 2>&1
sha256sum ${UPGRADE_SQL_TAR} | awk -F" " '{print $1}' > "${UPGRADE_SQL_SHA256}"
[ $? -ne 0 ] && die "Failed to generate sha256 sum file for ${UPGRADE_SQL_TAR}"
chmod 600 ${UPGRADE_SQL_TAR}
chmod 600 ${UPGRADE_SQL_SHA256}
deploy_pkgs ${UPGRADE_SQL_TAR} ${UPGRADE_SQL_SHA256}
echo "Successfully packaged upgrade_sql files."
}
function make_package_libpq()
{
cd $SCRIPT_DIR
prep_dest_list $release_file_list 'libpq'
rm -rf ${BUILD_DIR}/temp
mkdir -p ${BUILD_DIR}/temp
target_file_copy_for_non_server "$dest_list" ${BUILD_DIR}/temp
cd ${BUILD_DIR}/temp
echo "packaging libpq..."
tar -zvcf "${libpq_package_name}" ./* >>"$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "$package_command ${libpq_package_name} failed"
fi
deploy_pkgs ${libpq_package_name}
echo "install $pkgname tools is ${libpq_package_name} of ${package_path} directory " >> "$LOG_FILE" 2>&1
echo "success!"
}
function make_package_tools()
{
cd $SCRIPT_DIR
prep_dest_list $release_file_list 'client'
rm -rf ${BUILD_DIR}/temp
mkdir -p ${BUILD_DIR}/temp
cd ${BUILD_DIR}/
target_file_copy_for_non_server "$dest_list" ${BUILD_DIR}/temp
cd ${BUILD_DIR}/temp
echo "packaging tools..."
tar -zvcf "${tools_package_name}" ./* >>"$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "$package_command ${tools_package_name} failed"
fi
deploy_pkgs ${tools_package_name}
echo "install $pkgname tools is ${tools_package_name} of ${package_path} directory " >> "$LOG_FILE" 2>&1
echo "success!"
}
function gaussdb_pkg()
{
echo "Start package opengauss."
separate_symbol
make_package_srv
make_package_libpq
make_package_tools
make_package_upgrade_sql
echo "End package opengauss."
}

View File

@ -1,286 +0,0 @@
#!/bin/bash
#######################################################################
# Copyright (c): 2020-2025, Huawei Tech. Co., Ltd.
# descript: Compile and pack openGauss
# Return 0 means OK.
# Return 1 means failed.
# version: 2.0
# date: 2020-08-08
#######################################################################
#######################################################################
## Check the installation package production environment
#######################################################################
function gaussdb_pkg_pre_clean()
{
if [ -d "$BUILD_DIR" ]; then
rm -rf $BUILD_DIR
fi
if [ -d "$LOG_FILE" ]; then
rm -rf $LOG_FILE
fi
}
###################################
#######################################################################
##read version from gaussdb.ver
#######################################################################
function read_gaussdb_version()
{
cd ${SCRIPT_DIR}
echo "${gaussdb_name_for_package}-${version_number}" > version.cfg
#auto read the number from kernal globals.cpp, no need to change it here
}
PG_REG_TEST_ROOT="${ROOT_DIR}"
ROACH_DIR="${ROOT_DIR}/distribute/bin/roach"
MPPDB_DECODING_DIR="${ROOT_DIR}/contrib/mppdb_decoding"
###################################
# get version number from globals.cpp
##################################
function read_gaussdb_number()
{
global_kernal="${ROOT_DIR}/src/common/backend/utils/init/globals.cpp"
version_name="GRAND_VERSION_NUM"
version_num=""
line=$(cat $global_kernal | grep ^const* | grep $version_name)
version_num1=${line#*=}
#remove the symbol;
version_num=$(echo $version_num1 | tr -d ";")
#remove the blank
version_num=$(echo $version_num)
if echo $version_num | grep -qE '^92[0-9]+$'
then
# get the last three number
latter=${version_num:2}
echo "92.${latter}" >>${SCRIPT_DIR}/version.cfg
else
echo "Cannot get the version number from globals.cpp."
exit 1
fi
}
#######################################################################
##insert the commitid to version.cfg as the upgrade app path specification
#######################################################################
function get_kernel_commitid()
{
export PATH=${BUILD_DIR}:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
commitid=$(LD_PRELOAD='' ${BUILD_DIR}/bin/gaussdb -V | awk '{print $5}' | cut -d ")" -f 1)
echo "${commitid}" >>${SCRIPT_DIR}/version.cfg
echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1
}
#######################################################################
## generate the version file.
#######################################################################
function make_license_control()
{
python_exec=$(which python 2>/dev/null)
if [ -x "$python_exec" ]; then
$python_exec ${binarylib_dir}/buildtools/license_control/encrypted_version_file.py >> "$LOG_FILE" 2>&1
fi
if [ $? -ne 0 ]; then
die "create ${binarylib_dir}/buildtools/license_control license file failed."
fi
if [ -f "$gaussdb_200_file" ] && [ -f "$gaussdb_300_file" ]; then
# Get the md5sum.
gaussdb_200_sha256sum=$(sha256sum $gaussdb_200_file | awk '{print $1}')
gaussdb_300_sha256sum=$(sha256sum $gaussdb_300_file | awk '{print $1}')
# Modify the source code.
sed -i "s/^[ \t]*const[ \t]\+char[ \t]*\*[ \t]*sha256_digests[ \t]*\[[ \t]*SHA256_DIGESTS_COUNT[ \t]*\][ \t]*=[ \t]*{[ \t]*NULL[ \t]*,[ \t]*NULL[ \t]*}[ \t]*;[ \t]*$/const char \*sha256_digests\[SHA256_DIGESTS_COUNT\] = {\"$gaussdb_200_sha256sum\", \"$gaussdb_300_sha256sum\"};/g" $gaussdb_version_file
fi
if [ $? -ne 0 ]; then
die "modify '$gaussdb_version_file' failed."
fi
}
#######################################################################
##back to separate_debug_symbol.sh dir
#######################################################################
function separate_symbol()
{
cd $SCRIPT_DIR
if [ "$version_mode" = "release" -a "$separate_symbol" = "on" ]; then
chmod +x ./separate_debug_information.sh
./separate_debug_information.sh
cd $SCRIPT_DIR
mkdir -p $package_path
mv symbols.tar.gz $package_path/$symbol_package_name
fi
}
#######################################################################
##install gaussdb database contained server,client and libpq
#######################################################################
function install_gaussdb()
{
# Generate the license control file, and set md5sum string to the code.
echo "Modify gaussdb_version.cpp file." >> "$LOG_FILE" 2>&1
make_license_control
echo "Modify gaussdb_version.cpp file success." >> "$LOG_FILE" 2>&1
#putinto to Code dir
cd "$ROOT_DIR"
#echo "$ROOT_DIR/Code"
if [ $? -ne 0 ]; then
die "change dir to $ROOT_DIR failed."
fi
if [ "$version_mode" = "debug" -a "$separate_symbol" = "on" ]; then
echo "WARNING: do not separate symbol in debug mode!"
fi
if [ "$product_mode" != "opengauss" ]; then
die "the product mode can only be opengauss!"
fi
#configure
make distclean -sj >> "$LOG_FILE" 2>&1
echo "Begin configure." >> "$LOG_FILE" 2>&1
chmod 755 configure
if [ "$product_mode"x == "opengauss"x ]; then
enable_readline="--with-readline"
else
enable_readline="--without-readline"
fi
shared_opt="--gcc-version=${gcc_version}.0 --prefix="${BUILD_DIR}" --3rd=${binarylib_dir} --enable-thread-safety ${enable_readline} --without-zlib"
if [ "$product_mode"x == "opengauss"x ]; then
if [ "$version_mode"x == "release"x ]; then
# configure -D__USE_NUMA -D__ARM_LSE with arm opengauss mode
if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then
echo "configure -D__USE_NUMA -D__ARM_LSE with arm opengauss mode"
GAUSSDB_EXTRA_FLAGS=" -D__USE_NUMA -D__ARM_LSE"
fi
./configure $shared_opt CFLAGS="-O2 -g3 ${GAUSSDB_EXTRA_FLAGS}" --enable-mot CC=g++ $extra_config_opt >> "$LOG_FILE" 2>&1
elif [ "$version_mode"x == "memcheck"x ]; then
./configure $shared_opt CFLAGS="-O0" --enable-mot --enable-debug --enable-cassert --enable-memory-check CC=g++ $extra_config_opt >> "$LOG_FILE" 2>&1
elif [ "$version_mode"x == "fiurelease"x ]; then
./configure $shared_opt CFLAGS="-O2 -g3 ${GAUSSDB_EXTRA_FLAGS}" --enable-mot --disable-jemalloc CC=g++ $extra_config_opt >> "$LOG_FILE" 2>&1
elif [ "$version_mode"x == "fiudebug"x ]; then
./configure $shared_opt CFLAGS="-O0 ${GAUSSDB_EXTRA_FLAGS}" --enable-mot --enable-debug --enable-cassert --disable-jemalloc CC=g++ $extra_config_opt >> "$LOG_FILE" 2>&1
else
./configure $shared_opt CFLAGS="-O0 ${GAUSSDB_EXTRA_FLAGS}" --enable-mot --enable-debug --enable-cassert CC=g++ $extra_config_opt >> "$LOG_FILE" 2>&1
fi
fi
if [ $? -ne 0 ]; then
die "configure failed."
fi
echo "End configure" >> "$LOG_FILE" 2>&1
echo "Begin make install MPPDB server" >> "$LOG_FILE" 2>&1
make clean >> "$LOG_FILE" 2>&1
export GAUSSHOME=${BUILD_DIR}
export LD_LIBRARY_PATH=${BUILD_DIR}/lib:${BUILD_DIR}/lib/postgresql:${LD_LIBRARY_PATH}
make -sj 20 >> "$LOG_FILE" 2>&1
make install -sj 8>> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
make install -sj 8>> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
make install -sj 8>> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "make install failed."
fi
fi
fi
cd "$ROOT_DIR/contrib/pg_upgrade_support"
make clean >> "$LOG_FILE" 2>&1
make -sj >> "$LOG_FILE" 2>&1
make install -sj >> "$LOG_FILE" 2>&1
echo "End make install MPPDB" >> "$LOG_FILE" 2>&1
cd "$ROOT_DIR"
if [ "${make_check}" = 'on' ]; then
echo "Begin make check MPPDB..." >> "$LOG_FILE" 2>&1
cd ${PG_REG_TEST_ROOT}
make check -sj >> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "make check MPPDB failed."
fi
echo "End make check MPPDB success." >> "$LOG_FILE" 2>&1
fi
echo "Begin make install mpp_decoding..." >> "$LOG_FILE" 2>&1
#copy mppdb_decoding form clienttools to bin
if [ "$version_mode"x == "release"x ]; then
cd "$MPPDB_DECODING_DIR"
make >> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "make install mppdb_decoding failed."
fi
echo "End make install mppdb_decoding success." >> "$LOG_FILE" 2>&1
echo "Begin pack mppdb_decoding..." >> "$LOG_FILE" 2>&1
cp ${MPPDB_DECODING_DIR}/mppdb_decoding.so ${BUILD_DIR}/lib/postgresql/mppdb_decoding.so
elif [ "$version_mode"x == "memcheck"x ]; then
cd "$MPPDB_DECODING_DIR"
make >> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "make install mppdb_decoding failed."
fi
echo "End make install mppdb_decoding success." >> "$LOG_FILE" 2>&1
echo "Begin pack mppdb_decoding..." >> "$LOG_FILE" 2>&1
cp ${MPPDB_DECODING_DIR}/mppdb_decoding.so ${BUILD_DIR}/lib/postgresql/mppdb_decoding.so
else
cd "$MPPDB_DECODING_DIR"
make >> "$LOG_FILE" 2>&1
if [ $? -ne 0 ]; then
die "make install mppdb_decoding failed."
fi
echo "End make install mppdb_decoding success." >> "$LOG_FILE" 2>&1
echo "Begin pack mppdb_decoding..." >> "$LOG_FILE" 2>&1
cp ${MPPDB_DECODING_DIR}/mppdb_decoding.so ${BUILD_DIR}/lib/postgresql/mppdb_decoding.so
fi
if [ $? -ne 0 ]; then
if [ "$version_mode"x == "release"x ]; then
die "cp ${MPPDB_DECODING_DIR}/mppdb_decoding ${MPPDB_DECODING_DIR}/bin/mppdb_decoding failed"
else
die "cp ${MPPDB_DECODING_DIR}/mppdb_decoding ${MPPDB_DECODING_DIR}/bin/mppdb_decoding failed"
fi
fi
chmod 444 ${BUILD_DIR}/bin/cluster_guc.conf
dos2unix ${BUILD_DIR}/bin/cluster_guc.conf > /dev/null 2>&1
separate_symbol
get_kernel_commitid
}
#######################################################################
##install gaussdb database and others
##select to install something according to variables package_type need
#######################################################################
function gaussdb_build()
{
case "$package_type" in
server)
install_gaussdb
;;
libpq)
install_gaussdb
;;
*)
echo "Internal Error: option processing error: $package_type"
echo "please input right paramenter values server or libpq "
exit 1
esac
}

View File

@ -198,15 +198,18 @@ ENDMACRO(CHECK_CC_ENABLE)
function(GET_VERSIONSTR_FROMGIT ret)
set(PG_VERSION "9.2.4")
set(OPENGAUSS_VERSION "3.0.0")
set(OPENGAUSS_VERSION "2.1.0")
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/${openGauss}/cmake/src/buildfunction.sh --d ${PROJECT_TRUNK_DIR} OUTPUT_VARIABLE KERNEL_VERSION_STR)
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/${openGauss}/cmake/src/buildfunction.sh --s ${PROJECT_TRUNK_DIR} OUTPUT_VARIABLE GS_VERSION_STR)
set(PG_VERSION "${PG_VERSION}" PARENT_SCOPE)
set(${ret} "${GS_VERSION_STR}" PARENT_SCOPE)
set(OPENGAUSS_VERSION_NUM_STR, "${OPENGAUSS_VERSION}" PARENT_SCOPE)
if(NOT ${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
set(PG_VERSION_STR "openGauss ${OPENGAUSS_VERSION} ${GS_VERSION_STR}")
set(${ret} "${KERNEL_VERSION_STR}" PARENT_SCOPE)
set(PG_VERSION_STR "openGauss ${OPENGAUSS_VERSION} ${KERNEL_VERSION_STR}")
else()
set(${ret} "${GS_VERSION_STR}" PARENT_SCOPE)
set(PG_VERSION_STR "${GS_VERSION_STR}")
endif()
set(PG_VERSION_STR "${PG_VERSION_STR}" PARENT_SCOPE)

View File

@ -49,7 +49,6 @@ option(ENABLE_LCOV "enable lcov, the old is --enable-lcov" OFF)
# new add
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_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_MYSQL_FDW "enable export or import data with mysql,the old is --enable-mysql-fdw" OFF)
@ -126,12 +125,6 @@ if(${BUILD_TUPLE} STREQUAL "aarch64")
endif()
endif()
if(${ENABLE_LITE_MODE} STREQUAL "ON")
set(ENABLE_LLVM_COMPILE OFF)
set(ENABLE_GSS OFF)
set(KRB5 OFF)
endif()
set(PROTECT_OPTIONS -fwrapv -std=c++14 -fnon-call-exceptions ${OPTIMIZE_LEVEL})
set(WARNING_OPTIONS -Wall -Wendif-labels -Werror -Wformat-security)
set(OPTIMIZE_OPTIONS -pipe -pthread -fno-aggressive-loop-optimizations -fno-expensive-optimizations -fno-omit-frame-pointer -fno-strict-aliasing -freg-struct-return)
@ -244,8 +237,8 @@ add_definitions(-Wno-builtin-macro-redefined)
SET_GCC_FLAGS(DB_COMMON_FLAGS "")
#hotpatch
set(HOTPATCH_PLATFORM_LIST suse11_sp1_x86_64 suse12_sp5_x86_64 euleros2.0_sp8_aarch64 euleros2.0_sp9_aarch64 euleros2.0_sp10_aarch64 euleros2.0_sp2_x86_64 euleros2.0_sp5_x86_64 euleros2.0_sp10_x86_64 kylinv10_sp1_aarch64 kylinv10_sp1_x86_64_intel)
set(HOTPATCH_ARM_LIST euleros2.0_sp8_aarch64 euleros2.0_sp9_aarch64 euleros2.0_sp10_aarch64 kylinv10_sp1_aarch64)
set(HOTPATCH_PLATFORM_LIST suse11_sp1_x86_64 euleros2.0_sp8_aarch64 euleros2.0_sp9_aarch64 euleros2.0_sp2_x86_64 euleros2.0_sp5_x86_64 kylinv10_sp1_aarch64 kylinv10_sp1_x86_64_intel)
set(HOTPATCH_ARM_LIST euleros2.0_sp8_aarch64 euleros2.0_sp9_aarch64 kylinv10_sp1_aarch64)
list(FIND HOTPATCH_PLATFORM_LIST "${PLAT_FORM_NAME}" RET_HOTPATCH)
list(FIND HOTPATCH_ARM_LIST "${PLAT_FORM_NAME}" RET_ARM_HOTPATCH)
if(NOT ${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
@ -253,7 +246,11 @@ if(NOT ${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
if("${GCC_VERSION}" STREQUAL "7.3.0")
set(SUPPORT_HOTPATCH "yes")
if(NOT ${RET_ARM_HOTPATCH} EQUAL -1)
set(HOTPATCH_ATOMIC_LDS -Wl,-T${LIBHOTPATCH_TOOL_PATH}/atomic.lds)
if("$ENV{DEBUG_TYPE}" STREQUAL "debug")
set(HOTPATCH_ATOMIC_LDS -Wl,-T${LIBHOTPATCH_TOOL_PATH}/atomic_debug.lds)
else()
set(HOTPATCH_ATOMIC_LDS -Wl,-T${LIBHOTPATCH_TOOL_PATH}/atomic.lds)
endif()
endif()
else()
set(SUPPORT_HOTPATCH "no")
@ -265,17 +262,11 @@ else()
set(SUPPORT_HOTPATCH "no")
endif()
if(${ENABLE_LITE_MODE} STREQUAL "ON")
set(SUPPORT_HOTPATCH "no")
endif()
if(${ENABLE_LLVM_COMPILE} STREQUAL "ON")
# LLVM version
execute_process(COMMAND ${LLVM_CONFIG} --version OUTPUT_VARIABLE LLVM_VERSION_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "." ";" LLVM_VERSION_LIST ${LLVM_VERSION_STR})
list(GET LLVM_VERSION_LIST 0 LLVM_MAJOR_VERSION)
list(GET LLVM_VERSION_LIST 1 LLVM_MINOR_VERSION)
endif()
# LLVM version
execute_process(COMMAND ${LLVM_CONFIG} --version OUTPUT_VARIABLE LLVM_VERSION_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "." ";" LLVM_VERSION_LIST ${LLVM_VERSION_STR})
list(GET LLVM_VERSION_LIST 0 LLVM_MAJOR_VERSION)
list(GET LLVM_VERSION_LIST 1 LLVM_MINOR_VERSION)
if(${NO_CHECK_CONFIG})
string(SUBSTRING "${BUILD_TUPLE}" 0 6 BUILD_HOST_PLATFORM)
@ -314,9 +305,6 @@ SET(EC_CONFIG_IN_FILE ecpg_config.h.in)
build_mppdb_config_paths_h(PG_CONFIG_PATH_H)
configure_file(${openGauss}/cmake/src/config-in/${CONFIG_IN_FILE} ${CMAKE_BINARY_DIR}/pg_config.h @ONLY)
configure_file(${openGauss}/cmake/src/config-in/${EC_CONFIG_IN_FILE} ${CMAKE_BINARY_DIR}/ecpg_config.h @ONLY)
#set host_cpu for pgxs.mk
set(HOST_CPU ${BUILD_TUPLE})
configure_file(${openGauss}/src/makefiles/pgxs.mk ${CMAKE_BINARY_DIR}/${openGauss}/src/makefiles/pgxs.mk @ONLY)
SET(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR} ${CMAKE_BINARY_DIR})
#
@ -324,6 +312,3 @@ if("${ENABLE_MULTIPLE_NODES}" STREQUAL "ON" AND "${ENABLE_MOT}" STREQUAL "ON")
message(FATAL_ERROR "error: --enable-mot option is not supported with --enable-multiple-nodes option")
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()

View File

@ -114,17 +114,34 @@ function get_gs_version()
commits=$(git log | grep "See merge request" | wc -l)
mrid=$(git log | grep "See merge request" | head -1 | awk -F! '{print $2}' | grep -o '[0-9]\+')
debug_str="$DEBUG_TYPE"
product=$(cat build/script/gaussdb.ver | grep 'PRODUCT' | awk -F "=" '{print $2}')
version=$(cat build/script/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}')
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"
default_gs_version="(openGauss 2.0.0 build 1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug"
else
date_time=$(date -d today +"%Y-%m-%d %H:%M:%S")
default_gs_version="(${product} ${version} build ${csv_version}) compiled at $date_time commit $commits last mr $mrid $debug_str"
default_gs_version="(openGauss 2.1.0 build $csv_version) compiled at $date_time commit $commits last mr $mrid $debug_str"
fi
printf "${default_gs_version}"
}
function get_kernel_version()
{
cd $1
csv_version=$(git log | grep commit | head -1 | awk '{print $2}' | cut -b 1-8)
commits=$(git log | grep "See merge request" | wc -l)
mrid=$(git log | grep "See merge request" | head -1 | awk -F! '{print $2}' | grep -o '[0-9]\+')
debug_str="$DEBUG_TYPE"
product=$(cat build/script/gauss.spec | grep 'PRODUCT' | awk -F "=" '{print $2}')
version=$(cat build/script/gauss.spec | grep 'VERSION' | awk -F "=" '{print $2}')
if test "$enable_ccache" = yes; then
default_kernel_version="(GaussDB Kernel V500R002C00 build 1f1f1f1f1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug"
else
date_time=$(date -d today +"%Y-%m-%d %H:%M:%S")
default_kernel_version="($product $version build $csv_version) compiled at $date_time commit $commits last mr $mrid $debug_str"
fi
printf "${default_kernel_version}"
}
function get_time_for_roach()
{
tmp=$(date +'%d %b %Y %H:%M:%S')
@ -149,6 +166,8 @@ case "${DO_CMD}" in
create_conversionfile ;;
--create_snowballfile|snowball)
create_snowballfile ;;
--get_kernel_versionstr|--d)
get_kernel_version "$2";;
--get_gs_versionstr|--s)
get_gs_version "$2";;
--get_time_for_roach)

View File

@ -714,7 +714,7 @@
#define PGXC_VERSION_NUM
/* openGauss version as a number string */
#define OPENGAUSS_VERSION_NUM_STR "3.0.0"
#define OPENGAUSS_VERSION_NUM_STR "2.1.0"
/* A string containing the version number, platform, and C compiler */
#define PG_VERSION_STR "@PG_VERSION_STR@"
@ -913,10 +913,6 @@
* * (--enable-privategauss) */
#cmakedefine ENABLE_PRIVATEGAUSS
/* Define to 1 if you want to generate gauss product as lite mode.
* * (--enable-lite-mode) */
#cmakedefine ENABLE_LITE_MODE
/* Define to 1 if you want to use mot
* --enable-mot */
#cmakedefine ENABLE_MOT
@ -935,7 +931,3 @@
/* Define to on if you want to collect USTORE statistics */
#cmakedefine DEBUG_UHEAP
/* Define to 1 if you want to build opengauss rpm package on openeuler os.
* (--with-openeuler-os) */
#cmakedefine WITH_OPENEULER_OS

View File

@ -695,7 +695,7 @@
#define PG_VERSION "9.2.4"
/* openGauss version as a string */
#define OPENGAUSS_VERSION "3.0.0"
#define OPENGAUSS_VERSION "2.1.0"
/* Gaussdb version as a string*/
#define DEF_GS_VERSION "(GaussDB A 8.0.0 build 21f07aff) compiled at 2020-03-17 10:59:07 commit 7431 last mr 12039 debug"
@ -903,4 +903,5 @@
* code using `volatile' can become incorrect without. Disable with care. */
/* #undef volatile */
#define ENABLE_LLVM_COMPILE 1

View File

@ -3,7 +3,6 @@ set(3RD_PATH $ENV{THIRD_BIN_PATH})
set(VERSION_TYPE $ENV{DEBUG_TYPE})
option(ENABLE_LLT "enable llt, current value is --enable-llt" OFF)
option(ENABLE_UT "enable ut, current value is --enable-ut" OFF)
option(WITH_OPENEULER_OS "Build openGauss rpm package on openEuler os" OFF)
execute_process(COMMAND sh ${PROJECT_SRC_DIR}/get_PlatForm_str.sh OUTPUT_VARIABLE PLAT_FORM_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
@ -14,7 +13,7 @@ execute_process(COMMAND sh ${PROJECT_SRC_DIR}/get_PlatForm_str.sh OUTPUT_VARIABL
# $(LIB_SUPPORT_LLT)
# 2. Huawei_Secure_C, gtest, mockcpp, unixodbc, libstd
# and openssl not support parameter --enable-llt and --enable-ut;
# $(LIB_UNIFIED_SUPPORT)
# $(LIB_NOT_SUPPORT_LLT)
#############################################################################
set(SUPPORT_LLT "")
set(JEMALLOC_SUPPORT_LLT "")
@ -35,7 +34,7 @@ else()
set(HOST_TUPLE aarch64-unknown-linux-gnu)
endif()
set(LIB_UNIFIED_SUPPORT comm)
set(LIB_NOT_SUPPORT_LLT comm)
set(MEMCHECK_BUILD_TYPE debug)
set(DEPENDENCY_PATH ${3RD_PATH}/dependency/${PLAT_FORM_STR})
set(PLATFORM_PATH ${3RD_PATH}/platform/${PLAT_FORM_STR})
@ -44,55 +43,50 @@ set(COMPONENT_PATH ${3RD_PATH}/component/${PLAT_FORM_STR})
set(MEMCHECK_HOME ${DEPENDENCY_PATH}/memcheck/${MEMCHECK_BUILD_TYPE})
set(CJSON_HOME ${DEPENDENCY_PATH}/cjson/${SUPPORT_LLT})
set(ETCD_HOME ${DEPENDENCY_PATH}/etcd/${LIB_UNIFIED_SUPPORT})
set(EVENT_HOME ${DEPENDENCY_PATH}/event/${LIB_UNIFIED_SUPPORT})
set(ETCD_HOME ${DEPENDENCY_PATH}/etcd/${LIB_NOT_SUPPORT_LLT})
set(EVENT_HOME ${DEPENDENCY_PATH}/event/${LIB_NOT_SUPPORT_LLT})
set(FIO_HOME ${DEPENDENCY_PATH}/fio/${SUPPORT_LLT})
set(IPERF_HOME ${DEPENDENCY_PATH}/iperf/${LIB_UNIFIED_SUPPORT})
set(IPERF_HOME ${DEPENDENCY_PATH}/iperf/${LIB_NOT_SUPPORT_LLT})
if("${VERSION_TYPE}" STREQUAL "debug" OR "${VERSION_TYPE}" STREQUAL "memcheck")
set(JEMALLOC_HOME ${DEPENDENCY_PATH}/jemalloc/debug${JEMALLOC_SUPPORT_LLT})
else()
set(JEMALLOC_HOME ${DEPENDENCY_PATH}/jemalloc/${VERSION_TYPE}${JEMALLOC_SUPPORT_LLT})
endif()
set(KERBEROS_HOME ${DEPENDENCY_PATH}/kerberos/${SUPPORT_LLT})
set(KMC_HOME ${PLATFORM_PATH}/kmc/${LIB_UNIFIED_SUPPORT})
set(KMC_HOME ${PLATFORM_PATH}/kmc/${LIB_NOT_SUPPORT_LLT})
set(CGROUP_HOME ${DEPENDENCY_PATH}/libcgroup/${SUPPORT_LLT})
set(CURL_HOME ${DEPENDENCY_PATH}/libcurl/${SUPPORT_LLT})
set(EDIT_HOME ${DEPENDENCY_PATH}/libedit/${SUPPORT_LLT})
set(OBS_HOME ${DEPENDENCY_PATH}/libobs/${LIB_UNIFIED_SUPPORT})
set(OBS_HOME ${DEPENDENCY_PATH}/libobs/${LIB_NOT_SUPPORT_LLT})
set(ORC_HOME ${DEPENDENCY_PATH}/liborc/${SUPPORT_LLT})
set(PARQUET_HOME ${DEPENDENCY_PATH}/libparquet/${SUPPORT_LLT})
set(XML2_HOME ${DEPENDENCY_PATH}/libxml2/${SUPPORT_LLT})
set(LLVM_HOME ${DEPENDENCY_PATH}/llvm/${LIB_UNIFIED_SUPPORT})
set(LLVM_HOME ${DEPENDENCY_PATH}/llvm/${LIB_NOT_SUPPORT_LLT})
set(LZ4_HOME ${DEPENDENCY_PATH}/lz4/${SUPPORT_LLT})
set(NANOMSG_HOME ${DEPENDENCY_PATH}/nanomsg/${LIB_UNIFIED_SUPPORT})
set(NANOMSG_HOME ${DEPENDENCY_PATH}/nanomsg/${LIB_NOT_SUPPORT_LLT})
set(NCURSES_HOME ${DEPENDENCY_PATH}/ncurses/${SUPPORT_LLT})
set(OPENSSL_HOME ${DEPENDENCY_PATH}/openssl/${LIB_UNIFIED_SUPPORT})
set(PLJAVA_HOME ${DEPENDENCY_PATH}/pljava/${LIB_UNIFIED_SUPPORT})
if (EXISTS "${3RD_PATH}/platform/openjdk8/${BUILD_TUPLE}/jdk")
set(JAVA_HOME ${3RD_PATH}/platform/openjdk8/${BUILD_TUPLE}/jdk)
else()
set(JAVA_HOME ${3RD_PATH}/platform/huaweijdk8/${BUILD_TUPLE}/jdk)
endif()
set(OPENSSL_HOME ${DEPENDENCY_PATH}/openssl/${LIB_NOT_SUPPORT_LLT})
set(PLJAVA_HOME ${DEPENDENCY_PATH}/pljava/${LIB_NOT_SUPPORT_LLT})
set(JAVA_HOME ${3RD_PATH}/platform/openjdk8/${BUILD_TUPLE}/jdk)
set(PROTOBUF_HOME ${DEPENDENCY_PATH}/protobuf/${SUPPORT_LLT})
set(THRIFT_HOME ${DEPENDENCY_PATH}/thrift)
set(SNAPPY_HOME ${DEPENDENCY_PATH}/snappy/${LIB_UNIFIED_SUPPORT})
set(SNAPPY_HOME ${DEPENDENCY_PATH}/snappy/${SUPPORT_LLT})
set(ZLIB_HOME ${DEPENDENCY_PATH}/zlib1.2.11/${SUPPORT_LLT})
set(XGBOOST_HOME ${DEPENDENCY_PATH}/xgboost/${SUPPORT_LLT})
set(ZSTD_HOME ${DEPENDENCY_PATH}/zstd)
set(LICENSE_HOME ${PLATFORM_PATH}/AdaptiveLM_C_V100R005C01SPC002/${SUPPORT_LLT})
set(HOTPATCH_HOME ${PLATFORM_PATH}/hotpatch)
set(SECURE_HOME ${PLATFORM_PATH}/Huawei_Secure_C/${LIB_UNIFIED_SUPPORT})
set(SECURE_HOME ${PLATFORM_PATH}/Huawei_Secure_C/${LIB_NOT_SUPPORT_LLT})
set(DCF_HOME ${COMPONENT_PATH}/dcf)
set(MOCKCPP_HOME ${BUILDTOOLS_PATH}/mockcpp/${LIB_UNIFIED_SUPPORT})
set(GTEST_HOME ${BUILDTOOLS_PATH}/gtest/${LIB_UNIFIED_SUPPORT})
set(LIBSTD_HOME ${BUILDTOOLS_PATH}/gcc${GCC_VERSION_LIT}/${LIB_UNIFIED_SUPPORT})
set(MASSTREE_HOME ${BUILDTOOLS_PATH}/masstree/${LIB_UNIFIED_SUPPORT})
set(MOCKCPP_HOME ${BUILDTOOLS_PATH}/mockcpp/${LIB_NOT_SUPPORT_LLT})
set(GTEST_HOME ${BUILDTOOLS_PATH}/gtest/${LIB_NOT_SUPPORT_LLT})
set(LIBSTD_HOME ${BUILDTOOLS_PATH}/gcc${GCC_VERSION_LIT}/${LIB_NOT_SUPPORT_LLT})
set(MASSTREE_HOME ${BUILDTOOLS_PATH}/masstree/${LIB_NOT_SUPPORT_LLT})
set(NUMA_HOME ${DEPENDENCY_PATH}/numactl/${SUPPORT_LLT})
set(ARROW_HOME ${DEPENDENCY_PATH}/libparquet/${SUPPORT_LLT})
set(BOOST_HOME ${DEPENDENCY_PATH}/boost/${SUPPORT_LLT})
set(ODBC_HOME ${3RD_PATH}/dependency/${PLAT_FORM_STR}/unixodbc)
set(MASSTREE_HOME ${DEPENDENCY_PATH}/masstree/${LIB_UNIFIED_SUPPORT})
set(MASSTREE_HOME ${DEPENDENCY_PATH}/masstree/${LIB_NOT_SUPPORT_LLT})
set(LCOV_HOME ${BUILDTOOLS_PATH}/gcc${GCC_VERSION_LIT}/gcc/lib/gcc/${HOST_TUPLE})
#############################################################################
@ -161,12 +155,6 @@ else()
endif()
endif()
if(${WITH_OPENEULER_OS} STREQUAL "ON")
set(SECURE_C_CHECK boundscheck)
else()
set(SECURE_C_CHECK securec)
endif()
#############################################################################
# kerberos component
#############################################################################
@ -263,6 +251,15 @@ set(LIBOPENSSL_INCLUDE_PATH ${OPENSSL_HOME}/include)
#############################################################################
set(PROTOBUF_INCLUDE_PATH ${PROTOBUF_HOME}/include)
set(PROTOBUF_LIB_PATH ${PROTOBUF_HOME}/lib)
if(${ENABLE_LLT} STREQUAL "ON")
set(PROTOBUF_LIB_NAME protobuf_pic)
else()
if("${ENABLE_UT}" STREQUAL "ON")
set(PROTOBUF_LIB_NAME protobuf_pic)
else()
set(PROTOBUF_LIB_NAME protobuf)
endif()
endif()
#############################################################################
# thrift component
@ -276,6 +273,15 @@ set(LIBTHRIFT_BIN_PATH ${THRIFT_HOME}/bin)
#############################################################################
set(SNAPPY_INCLUDE_PATH ${SNAPPY_HOME}/include)
set(SNAPPY_LIB_PATH ${SNAPPY_HOME}/lib)
if(${ENABLE_LLT} STREQUAL "ON")
set(SNAPPY_LIB_NAME snappy_pic)
else()
if("${ENABLE_UT}" STREQUAL "ON")
set(SNAPPY_LIB_NAME snappy_pic)
else()
set(SNAPPY_LIB_NAME snappy)
endif()
endif()
#############################################################################
# zlib component
@ -283,12 +289,6 @@ set(SNAPPY_LIB_PATH ${SNAPPY_HOME}/lib)
set(ZLIB_INCLUDE_PATH ${ZLIB_HOME}/include)
set(ZLIB_LIB_PATH ${ZLIB_HOME}/lib)
#############################################################################
# xgboost component
#############################################################################
set(XGBOOST_INCLUDE_PATH ${XGBOOST_HOME}/include)
set(XGBOOST_LIB_PATH ${XGBOOST_HOME}/lib64)
#############################################################################
# zstd component
#############################################################################
@ -360,15 +360,3 @@ set(MOCKCPP_3RDPARTY_PATH ${MOCKCPP_HOME}/3rdparty)
set(MASSTREE_INCLUDE_PATH ${MASSTREE_HOME}/include)
set(MASSTREE_LIB_PATH ${MASSTREE_HOME}/lib)
############################################################################
# gtest component
############################################################################
set(GTEST_INCLUDE_PATH ${GTEST_HOME}/include)
set(GTEST_LIB_PATH ${GTEST_HOME}/lib)
############################################################################
# mockcpp component
############################################################################
set(MOCKCPP_INCLUDE_PATH ${MOCKCPP_HOME}/include)
set(MOCKCPP_LIB_PATH ${MOCKCPP_HOME}/lib)
set(MOCKCPP_3RDPARTY_PATH ${MOCKCPP_HOME}/3rdparty)

177
configure vendored
View File

@ -708,7 +708,6 @@ with_ossp_uuid
with_selinux
krb_srvtab
with_python
with_openeuler_os
enable_thread_safety
INCLUDES
TAS
@ -742,15 +741,12 @@ enable_llt
enable_llvm
llvm_major_version
llvm_minor_version
flex_major_version
flex_minor_version
enable_ut
enable_qunit
enable_jemalloc
enable_jemalloc_debug
enable_privategauss
enable_multiple_nodes
enable_lite_mode
enable_mot
enable_memory_check
enable_mysql_fdw
@ -758,6 +754,7 @@ enable_oracle_fdw
enable_thread_check
enable_shared
default_gs_version
default_kernel_version
default_port
WANTED_LANGUAGES
enable_nls
@ -827,14 +824,12 @@ enable_integer_datetimes
enable_nls
with_pgport
with_gs_version
with_openeuler_os
enable_shared
enable_rpath
enable_jemalloc
enable_jemalloc_debug
enable_privategauss
enable_multiple_nodes
enable_lite_mode
enable_mot
enable_memory_check
enable_mysql_fdw
@ -1316,11 +1311,6 @@ Try \`$0 --help' for more information." >&2
esac
done
# if compile with_openeuler_os. it should use gcc on os.
if test "${with_openeuler_os+set}" = set; then
gcc_version=$(gcc --version | sed q | awk -F')' '{print $2}' | awk '{print $1}')
fi
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ $as_echo "$as_me: error: missing argument to $ac_option" >&2
@ -1559,7 +1549,6 @@ Optional Features:
--disable-float4-byval disable float4 passed by value
--disable-float8-byval disable float8 passed by value
--enable-ccache build with ccache reducing compile time
--enable-lite-mode generate the gauss product as lite mode
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -2195,7 +2184,7 @@ PACKAGE_VERSION='9.2.4'
# Postgres-XC 1.1devel is based on PostgreSQL 9.2.4
PACKAGE_XC_VERSION='1.1'
# openGauss is based on PostgreSQL 9.2.4 and it will be the Kernel of GaussDB database
OPENGAUSS_VERSION='3.0.0'
OPENGAUSS_VERSION='2.1.0'
cat >>confdefs.h <<_ACEOF
#define PG_VERSION "$PACKAGE_VERSION"
@ -2666,8 +2655,8 @@ $as_echo "$as_me: error: argument required for --with-gs-version option" >&2;}
esac
else
product=$(cat build/script/gaussdb.ver | grep 'PRODUCT' | awk -F "=" '{print $2}')
version=$(cat build/script/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}')
product=$(cat build/script/gauss.spec | grep 'PRODUCT' | awk -F "=" '{print $2}')
version=$(cat build/script/gauss.spec | grep 'VERSION' | awk -F "=" '{print $2}')
gitversion=$(git log 2>/dev/null | grep commit | head -1 | awk '{print $2}' | cut -b 1-8)
commits=$(git log 2>/dev/null | grep "See in merge request" | wc -l)
debug_str=""
@ -2677,9 +2666,11 @@ else
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"
default_gs_version="(openGauss 2.1.0 build 1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug"
default_kernel_version="(GaussDB Kernel V500R002C00 build 1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug"
else
default_gs_version="($product $version build $gitversion) compiled at `date -d today +\"%Y-%m-%d %H:%M:%S\"` commit $commits last mr $mrid $debug_str"
default_kernel_version="($product $version build $gitversion) compiled at `date -d today +\"%Y-%m-%d %H:%M:%S\"` commit $commits last mr $mrid $debug_str"
fi
fi
@ -2688,7 +2679,7 @@ fi
$as_echo "$default_gs_version" >&6; }
cat >>confdefs.h <<_ACEOF
#define DEF_GS_VERSION "${default_gs_version}"
#define DEF_GS_VERSION "${default_kernel_version}"
_ACEOF
@ -2885,6 +2876,14 @@ if test "${enable_mot+set}" = set; then
$as_echo "$as_me: error: --enable-mot option is not supported with --enable-multiple-nodes option" >&2;}
{ (exit 1); exit 1; }; }
fi
if test "$enable_llvm" = no; then
{ { $as_echo "$as_me:$LINENO: error: --enable-mot option is not supported with --disable-llvm option" >&5
$as_echo "$as_me: error: --enable-mot option is not supported with --disable-llvm option" >&2;}
{ (exit 1); exit 1; }; }
fi
;;
no)
@ -3186,91 +3185,6 @@ else
fi
#
# --enable-lite-mode enables
#
# Check whether --enable-lite-mode was given.
if test "${enable_lite_mode+set}" = set; then
enableval=$enable_lite_mode;
case $enableval in
yes)
if test "$enable_multiple_nodes" = yes; then
{ { $as_echo "$as_me:$LINENO: error: --enable-lite-mode option is not supported with --enable-multiple-nodes option" >&5
$as_echo "$as_me: error: --enable-lite-mode 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-lite-mode option" >&5
$as_echo "$as_me: error: no argument expected for --enable-lite-mode option" >&2;}
{ (exit 1); exit 1; }; }
;;
esac
else
enable_lite_mode=no
fi
if test "$enable_multiple_nodes" = yes; then
enable_lite_mode=no
fi
if test "$enable_lite_mode" = yes; then
cat >>confdefs.h <<\_ACEOF
#define ENABLE_LITE_MODE 1
_ACEOF
fi
#
# --with-openeuler-os enable
#
# Check whether --with-openeuler-os was given.
if test "${with_openeuler_os+set}" = set; then
enableval=$with_openeuler_os;
case $enableval in
yes)
if test "$enable_multiple_nodes" = yes; then
{ { $as_echo "$as_me:$LINENO: error: --with-openeuler-os option is not supported with --enable-multiple-nodes option" >&5
$as_echo "$as_me: error: --with-openeuler-os 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 --with-openeuler-os option" >&5
$as_echo "$as_me: error: no argument expected for --with-openeuler-os option" >&2;}
{ (exit 1); exit 1; }; }
;;
esac
else
with_openeuler_os=no
fi
if test "$enable_multiple_nodes" = yes; then
with_openeuler_os=no
fi
if test "$with_openeuler_os" = yes; then
cat >>confdefs.h <<\_ACEOF
#define WITH_OPENEULER_OS 1
_ACEOF
fi
#
@ -5857,14 +5771,10 @@ if test "${enable_llvm+set}" = set; then
case $enableval in
yes)
if test "$enable_lite_mode" = yes; then
{ $as_echo "$as_me:$LINENO: enable_lite_mode is open, llvm will close" >&5
$as_echo "$as_me: enable_lite_mode is open, llvm will close" >&2;}
else
cat >>confdefs.h <<\_ACEOF
#define ENABLE_LLVM_COMPILE 1
_ACEOF
fi
;;
no)
:
@ -5876,20 +5786,16 @@ $as_echo "$as_me: error: no argument expected for --enable-llvm option" >&2;}
;;
esac
else
if test "$enable_lite_mode" = yes; then
{ $as_echo "$as_me:$LINENO: enable_lite_mode is open, llvm will close" >&5
$as_echo "$as_me: enable_lite_mode is open, llvm will close" >&2;}
else
cat >>confdefs.h <<\_ACEOF
#define ENABLE_LLVM_COMPILE 1
_ACEOF
fi
enable_llvm=yes
fi
llvm_version_str='10.0.0'
if [[ ! -z "${with_3rdpartydir}" ]] && [[ "$enable_lite_mode" != yes ]]; then
if [ ! -z "${with_3rdpartydir}" ]; then
platstr=$(sh src/get_PlatForm_str.sh)
llvm_version_str=`${with_3rdpartydir}/dependency/${platstr}/llvm/comm/bin/llvm-config --version`
fi
@ -6621,28 +6527,9 @@ fi
# JDK
#
with_jdk=''
if [[ ! -z "${with_3rdpartydir}" ]] && [[ "$with_openeuler_os" != yes ]]; then
if [ ! -z "${with_3rdpartydir}" ]; then
platstr=$(sh src/get_PlatForm_str.sh)
cpuarch=$(uname -m)
for d in "openjdk8" "huaweijdk8"; do
$as_echo "$as_me:$LINENO: checking for jdk in ${with_3rdpartydir}/platform/${d}/${cpuarch}" >&5
if [ ! -d "${with_3rdpartydir}/platform/${d}/${cpuarch}" ]; then
$as_echo "$as_me:$LINENO: result: no" >&5
continue
fi
for d2 in $(ls "${with_3rdpartydir}/platform/${d}/${cpuarch}" | sort -r 2>/dev/null); do
if [ -f "${with_3rdpartydir}/platform/${d}/${cpuarch}/${d2}/jre/bin/java" ]; then
with_jdk="${with_3rdpartydir}/platform/${d}/${cpuarch}/${d2}"
break;
fi
done
if [ ! -z "$with_jdk" ]; then
$as_echo "$as_me:$LINENO: result: yes" >&5
break;
fi
$as_echo "$as_me:$LINENO: checking for jdk in ${with_3rdpartydir}/platform/${platstr}/${d}" >&5
if [ ! -d "${with_3rdpartydir}/platform/${platstr}/${d}" ]; then
$as_echo "$as_me:$LINENO: result: no" >&5
@ -7916,14 +7803,6 @@ else
pgac_flex_version=`$FLEX --version 2>/dev/null`
{ $as_echo "$as_me:$LINENO: using $pgac_flex_version" >&5
$as_echo "$as_me: using $pgac_flex_version" >&6;}
flex_major_version=$(echo $pgac_flex_version | awk '{print $2}' | awk -F "." '{print $1}')
flex_minor_version=$(echo $pgac_flex_version | awk '{print $2}' | awk -F "." '{print $2}')
cat >>confdefs.h <<_ACEOF
#define FLEX_MAJOR_VERSION $flex_major_version
#define FLEX_MINOR_VERSION $flex_minor_version
_ACEOF
fi
@ -9360,7 +9239,7 @@ $as_echo "$as_me: WARNING:
*** Not using spinlocks will cause poor performance." >&2;}
fi
if test "$with_gssapi_" = no ; then
if test "$with_gssapi" = no ; then
if test "$PORTNAME" != "win32"; then
{ $as_echo "$as_me:$LINENO: checking for library containing gss_init_sec_context" >&5
$as_echo_n "checking for library containing gss_init_sec_context... " >&6; }
@ -12654,7 +12533,7 @@ fi
fi
if test "$with_gssapi_" = no ; then
if test "$with_gssapi" = no ; then
for ac_header in gssapi/gssapi.h
do
@ -29789,7 +29668,7 @@ fi
if test "$enable_multiple_nodes" = yes; then
cat >>confdefs.h <<_ACEOF
#define PG_VERSION_STR "openGauss $OPENGAUSS_VERSION ${default_gs_version} on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
#define PG_VERSION_STR "openGauss $OPENGAUSS_VERSION ${default_kernel_version} on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
_ACEOF
else
cat >>confdefs.h <<_ACEOF
@ -31258,10 +31137,8 @@ find src/gausskernel/ -name "*.y" | sort >> ./ereport.txt
find src/common/backend -name "*.cpp" | sort >> ./ereport.txt
find src/gausskernel/ -name "*.cpp" | sort >> ./ereport.txt
if [[ "$enable_lite_mode" != yes ]]; then
if [[ "$enable_multiple_nodes" != no ]] || [[ "$enable_privategauss" != no ]]; then
find ../distribute/cm -name "*.l" | sort > ./cm_ereport.txt
find ../distribute/cm -name "*.y" | sort >> ./cm_ereport.txt
find ../distribute/cm -name "*.cpp" | sort >> ./cm_ereport.txt
fi
if [[ "$enable_multiple_nodes" != no ]] || [[ "$enable_privategauss" != no ]]; then
find ../distribute/cm -name "*.l" | sort > ./cm_ereport.txt
find ../distribute/cm -name "*.y" | sort >> ./cm_ereport.txt
find ../distribute/cm -name "*.cpp" | sort >> ./cm_ereport.txt
fi

3
contrib/.gitignore vendored
View File

@ -21,6 +21,3 @@
/pg_xlogdump/xlogdesc.cpp
/pg_xlogdump/xlogreader.cpp
/pg_xlogdump/xlogreader_common.cpp
/pg_xlogdump/segpagedesc.cpp
/pg_xlogdump/uheapdesc.cpp
/pg_xlogdump/undologdesc.cpp

View File

@ -12,7 +12,6 @@ set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/hstore
${CMAKE_CURRENT_SOURCE_DIR}/test_decoding
${CMAKE_CURRENT_SOURCE_DIR}/mppdb_decoding
${CMAKE_CURRENT_SOURCE_DIR}/sql_decoding
${CMAKE_CURRENT_SOURCE_DIR}/spi
${CMAKE_CURRENT_SOURCE_DIR}/pg_upgrade_support
${CMAKE_CURRENT_SOURCE_DIR}/postgres_fdw
@ -29,7 +28,6 @@ set(CMAKE_MODULE_PATH
add_subdirectory(hstore)
add_subdirectory(test_decoding)
add_subdirectory(mppdb_decoding)
add_subdirectory(sql_decoding)
add_subdirectory(spi)
if("${ENABLE_MULTIPLE_NODES}" STREQUAL "ON" OR "${ENABLE_PRIVATEGAUSS}" STREQUAL "ON")
add_subdirectory(pg_upgrade_support)

View File

@ -3,7 +3,7 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION file_fdw" to load this file. \quit
CREATE FUNCTION pg_catalog.file_fdw_handler()
CREATE FUNCTION file_fdw_handler()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;

View File

@ -158,14 +158,6 @@ Datum file_fdw_handler(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(fdwroutine);
}
void check_file_fdw_permission()
{
if ((!initialuser()) && !(isOperatoradmin(GetUserId()) && u_sess->attr.attr_security.operation_mode)) {
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("Dist fdw are only available for the supper user and Operatoradmin")));
}
}
/*
* Validate the generic options given to a FOREIGN DATA WRAPPER, SERVER,
* USER MAPPING or FOREIGN TABLE that uses file_fdw.
@ -181,7 +173,6 @@ Datum file_fdw_validator(PG_FUNCTION_ARGS)
List* other_options = NIL;
ListCell* cell = NULL;
check_file_fdw_permission();
if (catalog == UserMappingRelationId) {
ereport(
ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("file_fdw doesn't support in USER MAPPING.")));
@ -201,8 +192,9 @@ Datum file_fdw_validator(PG_FUNCTION_ARGS)
* security hole.
*/
if (catalog == ForeignTableRelationId && !superuser())
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("only superuser can change options of a file_fdw foreign table")));
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("only superuser can change options of a file_fdw foreign table")));
/*
* Check that only options supported by file_fdw, and allowed for the
@ -250,8 +242,7 @@ Datum file_fdw_validator(PG_FUNCTION_ARGS)
} else if (strcmp(def->defname, "format") == 0) {
char* fmt = defGetString(def);
if (strcasecmp(fmt, "fixed") == 0) {
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("file_fdw doesn't support fixed option in format")));
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("file_fdw doesn't support fixed option in format")));
}
other_options = lappend(other_options, def);
} else {

View File

@ -57,18 +57,7 @@ CREATE FOREIGN TABLE tbl (a int) SERVER file_server OPTIONS (format 'csv', delim
CREATE FOREIGN TABLE tbl (a int) SERVER file_server OPTIONS (format 'csv', null '
'); -- ERROR
CREATE FOREIGN TABLE tbl (a int) SERVER file_server; -- ERROR
CREATE FOREIGN TABLE tbl (a int2,b float4) SERVER file_server OPTIONS (format 'text', filename '', delimiter ' ', null '\n'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '', format 'text'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '', format 'binary'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '', format 'csv'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '',format 'text', header 'false'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '',format 'binary', header 'off'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE agg_text (
a int2,
b float4

View File

@ -75,18 +75,6 @@ CREATE FOREIGN TABLE tbl (a int) SERVER file_server OPTIONS (format 'csv', null
ERROR: COPY null representation cannot use newline or carriage return
CREATE FOREIGN TABLE tbl (a int) SERVER file_server; -- ERROR
ERROR: filename is required for file_fdw foreign tables
CREATE FOREIGN TABLE tbl (a int2,b float4) SERVER file_server OPTIONS (format 'text', filename '', delimiter ' ', null '\n'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '', format 'text'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '', format 'binary'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '', format 'csv'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '',format 'text', header 'false'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE tbl (id int) SERVER file_server OPTIONS (filename '',format 'binary', header 'off'); -- SUCCESS
DROP FOREIGN TABLE tbl;
CREATE FOREIGN TABLE agg_text (
a int2,
b float4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,12 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION gc_fdw" to load this file. \quit
CREATE FUNCTION pg_catalog.gc_fdw_handler()
CREATE FUNCTION gc_fdw_handler()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;
CREATE FUNCTION pg_catalog.gc_fdw_validator(text[], oid)
CREATE FUNCTION gc_fdw_validator(text[], oid)
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;

View File

@ -3,12 +3,12 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION hdfs_fdw" to load this file. \quit
CREATE FUNCTION pg_catalog.hdfs_fdw_handler()
CREATE FUNCTION hdfs_fdw_handler()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;
CREATE FUNCTION pg_catalog.hdfs_fdw_validator(text[], oid)
CREATE FUNCTION hdfs_fdw_validator(text[], oid)
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;

View File

@ -363,12 +363,8 @@ void serverOptionValidator(List* ServerOptionList)
*/
switch (serverType) {
case T_OBS_SERVER: {
#ifndef ENABLE_LITE_MODE
checkOptionNameValidity(ServerOptionList, OBS_SERVER_OPTION);
break;
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
#endif
}
case T_HDFS_SERVER: {
FEATURE_NOT_PUBLIC_ERROR("HDFS is not yet supported.");
@ -409,7 +405,6 @@ void serverOptionValidator(List* ServerOptionList)
ServerOptionCheckSet(ServerOptionList, serverType, addressFound, cfgPathFound, akFound, sakFound,
encrypt, userNameFound, passWordFound, regionFound, hostName, ak, sk, regionStr);
#ifndef ENABLE_LITE_MODE
if (T_OBS_SERVER == serverType) {
if (addressFound && regionFound) {
ereport(ERROR,
@ -447,8 +442,6 @@ void serverOptionValidator(List* ServerOptionList)
checkOBSServerValidity(URL, ak, sk, encrypt);
}
}
#endif
if (T_HDFS_SERVER == serverType && !cfgPathFound) {
ereport(ERROR,
(errcode(ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED),
@ -1441,7 +1434,6 @@ static void HdfsEndForeignScan(ForeignScanState* scanState)
}
}
#ifdef ENABLE_LLVM_COMPILE
/*
* LLVM optimization information should be shown. We check the query
* uses LLVM optimization or not.
@ -1510,7 +1502,6 @@ static void HdfsEndForeignScan(ForeignScanState* scanState)
}
}
}
#endif
/* clears all file related memory */
if (NULL != executionState->fileReader) {

View File

@ -716,11 +716,7 @@ List* CNSchedulingForAnalyze(unsigned int* totalFilesNum, unsigned int* numOfDns
if (isglbstats) {
if (IS_OBS_CSV_TXT_FOREIGN_TABLE(foreignTableId)) {
/* for dist obs foreign table.*/
#ifndef ENABLE_LITE_MODE
allTask = CNSchedulingForDistOBSFt(foreignTableId);
#else
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
#endif
} else {
if (rel_loc_info == NULL) {
ereport(ERROR,
@ -1680,7 +1676,7 @@ static List* GetAllFiles(
delete (conn);
conn = NULL;
ereport(ERROR,
(errcode(ERRCODE_FDW_INVALID_OPTION_DATA),
(errcode(ERRCODE_FDW_INVALID_OPTOIN_DATA),
errmodule(MOD_HDFS),
errmsg("The foldername option cannot be a file path.")));
}
@ -1695,7 +1691,7 @@ static List* GetAllFiles(
delete (conn);
conn = NULL;
ereport(ERROR,
(errcode(ERRCODE_FDW_INVALID_OPTION_DATA),
(errcode(ERRCODE_FDW_INVALID_OPTOIN_DATA),
errmodule(MOD_HDFS),
errmsg("The entries in the options fileNames must be file!")));
}
@ -1774,7 +1770,7 @@ static List* GetHdfsAllFiles(dfs::DFSConnector* conn, Oid foreignTableId, List*
delete (conn);
conn = NULL;
ereport(ERROR,
(errcode(ERRCODE_FDW_INVALID_OPTION_DATA),
(errcode(ERRCODE_FDW_INVALID_OPTOIN_DATA),
errmodule(MOD_HDFS),
errmsg("The foldername option cannot be a file path.")));
}
@ -1789,7 +1785,7 @@ static List* GetHdfsAllFiles(dfs::DFSConnector* conn, Oid foreignTableId, List*
delete (conn);
conn = NULL;
ereport(ERROR,
(errcode(ERRCODE_FDW_INVALID_OPTION_DATA),
(errcode(ERRCODE_FDW_INVALID_OPTOIN_DATA),
errmodule(MOD_HDFS),
errmsg("The entries in the options fileNames must be file!")));
}
@ -2207,7 +2203,7 @@ static bool PartitionFilterClause(SplitInfo* split, List* scanClauses, Var* valu
partValue = strchr(fileName, '=');
if (NULL == partValue) {
ereport(ERROR,
(errcode(ERRCODE_FDW_INVALID_OPTION_DATA),
(errcode(ERRCODE_FDW_INVALID_OPTOIN_DATA),
errmodule(MOD_HDFS),
errmsg("Something wrong with the partition directory name of file %s.", split->filePath)));
}

View File

@ -5,22 +5,22 @@
CREATE TYPE hstore;
CREATE FUNCTION pg_catalog.hstore_in(cstring)
CREATE FUNCTION hstore_in(cstring)
RETURNS hstore
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.hstore_out(hstore)
CREATE FUNCTION hstore_out(hstore)
RETURNS cstring
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.hstore_recv(internal)
CREATE FUNCTION hstore_recv(internal)
RETURNS hstore
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.hstore_send(hstore)
CREATE FUNCTION hstore_send(hstore)
RETURNS bytea
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -34,12 +34,12 @@ CREATE TYPE hstore (
STORAGE = extended
);
CREATE FUNCTION pg_catalog.hstore_version_diag(hstore)
CREATE FUNCTION hstore_version_diag(hstore)
RETURNS integer
AS 'MODULE_PATHNAME','hstore_version_diag'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.fetchval(hstore,text)
CREATE FUNCTION fetchval(hstore,text)
RETURNS text
AS 'MODULE_PATHNAME','hstore_fetchval'
LANGUAGE C STRICT IMMUTABLE;
@ -50,7 +50,7 @@ CREATE OPERATOR -> (
PROCEDURE = fetchval
);
CREATE FUNCTION pg_catalog.slice_array(hstore,text[])
CREATE FUNCTION slice_array(hstore,text[])
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_slice_to_array'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -61,17 +61,17 @@ CREATE OPERATOR -> (
PROCEDURE = slice_array
);
CREATE FUNCTION pg_catalog.slice(hstore,text[])
CREATE FUNCTION slice(hstore,text[])
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.isexists(hstore,text)
CREATE FUNCTION isexists(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.exist(hstore,text)
CREATE FUNCTION exist(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -84,7 +84,7 @@ CREATE OPERATOR ? (
JOIN = contjoinsel
);
CREATE FUNCTION pg_catalog.exists_any(hstore,text[])
CREATE FUNCTION exists_any(hstore,text[])
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists_any'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -97,7 +97,7 @@ CREATE OPERATOR ?| (
JOIN = contjoinsel
);
CREATE FUNCTION pg_catalog.exists_all(hstore,text[])
CREATE FUNCTION exists_all(hstore,text[])
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists_all'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -110,27 +110,27 @@ CREATE OPERATOR ?& (
JOIN = contjoinsel
);
CREATE FUNCTION pg_catalog.isdefined(hstore,text)
CREATE FUNCTION isdefined(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_defined'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.defined(hstore,text)
CREATE FUNCTION defined(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_defined'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.delete(hstore,text)
CREATE FUNCTION delete(hstore,text)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_delete'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.delete(hstore,text[])
CREATE FUNCTION delete(hstore,text[])
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_delete_array'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.delete(hstore,hstore)
CREATE FUNCTION delete(hstore,hstore)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_delete_hstore'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -153,7 +153,7 @@ CREATE OPERATOR - (
PROCEDURE = delete
);
CREATE FUNCTION pg_catalog.hs_concat(hstore,hstore)
CREATE FUNCTION hs_concat(hstore,hstore)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_concat'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -164,12 +164,12 @@ CREATE OPERATOR || (
PROCEDURE = hs_concat
);
CREATE FUNCTION pg_catalog.hs_contains(hstore,hstore)
CREATE FUNCTION hs_contains(hstore,hstore)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_contains'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.hs_contained(hstore,hstore)
CREATE FUNCTION hs_contained(hstore,hstore)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_contained'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -211,12 +211,12 @@ CREATE OPERATOR ~ (
JOIN = contjoinsel
);
CREATE FUNCTION pg_catalog.tconvert(text,text)
CREATE FUNCTION tconvert(text,text)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_from_text'
LANGUAGE C IMMUTABLE NOT FENCED; -- not STRICT; needs to allow (key,NULL)
CREATE FUNCTION pg_catalog.hstore(text,text)
CREATE FUNCTION hstore(text,text)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_from_text'
LANGUAGE C IMMUTABLE; -- not STRICT; needs to allow (key,NULL)
@ -227,25 +227,25 @@ CREATE OPERATOR => (
PROCEDURE = hstore
);
CREATE FUNCTION pg_catalog.hstore(text[],text[])
CREATE FUNCTION hstore(text[],text[])
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_arrays'
LANGUAGE C IMMUTABLE NOT FENCED; -- not STRICT; allows (keys,null)
CREATE FUNCTION pg_catalog.hstore(text[])
CREATE FUNCTION hstore(text[])
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_array'
LANGUAGE C IMMUTABLE STRICT NOT FENCED;
CREATE CAST (text[] AS hstore)
WITH FUNCTION pg_catalog.hstore(text[]);
WITH FUNCTION hstore(text[]);
CREATE FUNCTION pg_catalog.hstore(record)
CREATE FUNCTION hstore(record)
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_record'
LANGUAGE C IMMUTABLE NOT FENCED; -- not STRICT; allows (null::recordtype)
CREATE FUNCTION pg_catalog.hstore_to_array(hstore)
CREATE FUNCTION hstore_to_array(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_to_array'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -255,7 +255,7 @@ CREATE OPERATOR %% (
PROCEDURE = hstore_to_array
);
CREATE FUNCTION pg_catalog.hstore_to_matrix(hstore)
CREATE FUNCTION hstore_to_matrix(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_to_matrix'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
@ -265,27 +265,27 @@ CREATE OPERATOR %# (
PROCEDURE = hstore_to_matrix
);
CREATE FUNCTION pg_catalog.akeys(hstore)
CREATE FUNCTION akeys(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_akeys'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.avals(hstore)
CREATE FUNCTION avals(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_avals'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.skeys(hstore)
CREATE FUNCTION skeys(hstore)
RETURNS setof text
AS 'MODULE_PATHNAME','hstore_skeys'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.svals(hstore)
CREATE FUNCTION svals(hstore)
RETURNS setof text
AS 'MODULE_PATHNAME','hstore_svals'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.each(IN hs hstore,
CREATE FUNCTION each(IN hs hstore,
OUT key text,
OUT value text)
RETURNS SETOF record
@ -521,7 +521,7 @@ AS
OPERATOR 9 ?(hstore,text),
OPERATOR 10 ?|(hstore,text[]),
OPERATOR 11 ?&(hstore,text[]),
FUNCTION 1 pg_catalog.bttextcmp(text,text),
FUNCTION 1 bttextcmp(text,text),
FUNCTION 2 gin_extract_hstore(internal, internal),
FUNCTION 3 gin_extract_hstore_query(internal, internal, int2, internal, internal),
FUNCTION 4 gin_consistent_hstore(internal, int2, internal, int4, internal, internal),

View File

@ -5,22 +5,22 @@
CREATE TYPE hstore;
CREATE FUNCTION pg_catalog.hstore_in(cstring)
CREATE FUNCTION hstore_in(cstring)
RETURNS hstore
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.hstore_out(hstore)
CREATE FUNCTION hstore_out(hstore)
RETURNS cstring
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;
CREATE FUNCTION pg_catalog.hstore_recv(internal)
CREATE FUNCTION hstore_recv(internal)
RETURNS hstore
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.hstore_send(hstore)
CREATE FUNCTION hstore_send(hstore)
RETURNS bytea
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
@ -34,145 +34,145 @@ CREATE TYPE hstore (
STORAGE = extended
);
CREATE FUNCTION pg_catalog.hstore_version_diag(hstore)
CREATE FUNCTION hstore_version_diag(hstore)
RETURNS integer
AS 'MODULE_PATHNAME','hstore_version_diag'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.fetchval(hstore,text)
CREATE FUNCTION fetchval(hstore,text)
RETURNS text
AS 'MODULE_PATHNAME','hstore_fetchval'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.slice_array(hstore,text[])
CREATE FUNCTION slice_array(hstore,text[])
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_slice_to_array'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.slice(hstore,text[])
CREATE FUNCTION slice(hstore,text[])
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.isexists(hstore,text)
CREATE FUNCTION isexists(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.exist(hstore,text)
CREATE FUNCTION exist(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.exists_any(hstore,text[])
CREATE FUNCTION exists_any(hstore,text[])
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists_any'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.exists_all(hstore,text[])
CREATE FUNCTION exists_all(hstore,text[])
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists_all'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.isdefined(hstore,text)
CREATE FUNCTION isdefined(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_defined'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.defined(hstore,text)
CREATE FUNCTION defined(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_defined'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.delete(hstore,text)
CREATE FUNCTION delete(hstore,text)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_delete'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.delete(hstore,text[])
CREATE FUNCTION delete(hstore,text[])
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_delete_array'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.delete(hstore,hstore)
CREATE FUNCTION delete(hstore,hstore)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_delete_hstore'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.hs_concat(hstore,hstore)
CREATE FUNCTION hs_concat(hstore,hstore)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_concat'
LANGUAGE C IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.hs_contains(hstore,hstore)
CREATE FUNCTION hs_contains(hstore,hstore)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_contains'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.hs_contained(hstore,hstore)
CREATE FUNCTION hs_contained(hstore,hstore)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_contained'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.tconvert(text,text)
CREATE FUNCTION tconvert(text,text)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_from_text'
LANGUAGE C IMMUTABLE NOT FENCED;; -- not STRICT; needs to allow (key,NULL)
CREATE FUNCTION pg_catalog.hstore(text,text)
CREATE FUNCTION hstore(text,text)
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_from_text'
LANGUAGE C IMMUTABLE NOT FENCED;; -- not STRICT; needs to allow (key,NULL)
CREATE FUNCTION pg_catalog.hstore(text[],text[])
CREATE FUNCTION hstore(text[],text[])
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_arrays'
LANGUAGE C IMMUTABLE NOT FENCED;; -- not STRICT; allows (keys,null)
CREATE FUNCTION pg_catalog.hstore(text[])
CREATE FUNCTION hstore(text[])
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_array'
LANGUAGE C IMMUTABLE STRICT NOT FENCED;;
CREATE CAST (text[] AS hstore)
WITH FUNCTION pg_catalog.hstore(text[]);
WITH FUNCTION hstore(text[]);
CREATE FUNCTION pg_catalog.hstore(record)
CREATE FUNCTION hstore(record)
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_record'
LANGUAGE C IMMUTABLE NOT FENCED;; -- not STRICT; allows (null::recordtype)
CREATE FUNCTION pg_catalog.hstore_to_array(hstore)
CREATE FUNCTION hstore_to_array(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_to_array'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.hstore_to_matrix(hstore)
CREATE FUNCTION hstore_to_matrix(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_to_matrix'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.akeys(hstore)
CREATE FUNCTION akeys(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_akeys'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.avals(hstore)
CREATE FUNCTION avals(hstore)
RETURNS text[]
AS 'MODULE_PATHNAME','hstore_avals'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.skeys(hstore)
CREATE FUNCTION skeys(hstore)
RETURNS setof text
AS 'MODULE_PATHNAME','hstore_skeys'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.svals(hstore)
CREATE FUNCTION svals(hstore)
RETURNS setof text
AS 'MODULE_PATHNAME','hstore_svals'
LANGUAGE C STRICT IMMUTABLE NOT FENCED;;
CREATE FUNCTION pg_catalog.each(IN hs hstore,
CREATE FUNCTION each(IN hs hstore,
OUT key text,
OUT value text)
RETURNS SETOF record

View File

@ -4,55 +4,55 @@
\echo Use "CREATE EXTENSION hstore" to load this file. \quit
ALTER EXTENSION hstore ADD type hstore;
ALTER EXTENSION hstore ADD function pg_catalog.hstore_in(cstring);
ALTER EXTENSION hstore ADD function pg_catalog.hstore_out(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hstore_recv(internal);
ALTER EXTENSION hstore ADD function pg_catalog.hstore_send(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hstore_version_diag(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.fetchval(hstore,text);
ALTER EXTENSION hstore ADD function hstore_in(cstring);
ALTER EXTENSION hstore ADD function hstore_out(hstore);
ALTER EXTENSION hstore ADD function hstore_recv(internal);
ALTER EXTENSION hstore ADD function hstore_send(hstore);
ALTER EXTENSION hstore ADD function hstore_version_diag(hstore);
ALTER EXTENSION hstore ADD function fetchval(hstore,text);
ALTER EXTENSION hstore ADD operator ->(hstore,text);
ALTER EXTENSION hstore ADD function pg_catalog.slice_array(hstore,text[]);
ALTER EXTENSION hstore ADD function slice_array(hstore,text[]);
ALTER EXTENSION hstore ADD operator ->(hstore,text[]);
ALTER EXTENSION hstore ADD function pg_catalog.slice(hstore,text[]);
ALTER EXTENSION hstore ADD function pg_catalog.isexists(hstore,text);
ALTER EXTENSION hstore ADD function pg_catalog.exist(hstore,text);
ALTER EXTENSION hstore ADD function slice(hstore,text[]);
ALTER EXTENSION hstore ADD function isexists(hstore,text);
ALTER EXTENSION hstore ADD function exist(hstore,text);
ALTER EXTENSION hstore ADD operator ?(hstore,text);
ALTER EXTENSION hstore ADD function pg_catalog.exists_any(hstore,text[]);
ALTER EXTENSION hstore ADD function exists_any(hstore,text[]);
ALTER EXTENSION hstore ADD operator ?|(hstore,text[]);
ALTER EXTENSION hstore ADD function pg_catalog.exists_all(hstore,text[]);
ALTER EXTENSION hstore ADD function exists_all(hstore,text[]);
ALTER EXTENSION hstore ADD operator ?&(hstore,text[]);
ALTER EXTENSION hstore ADD function pg_catalog.isdefined(hstore,text);
ALTER EXTENSION hstore ADD function pg_catalog.defined(hstore,text);
ALTER EXTENSION hstore ADD function pg_catalog.delete(hstore,text);
ALTER EXTENSION hstore ADD function pg_catalog.delete(hstore,text[]);
ALTER EXTENSION hstore ADD function pg_catalog.delete(hstore,hstore);
ALTER EXTENSION hstore ADD function isdefined(hstore,text);
ALTER EXTENSION hstore ADD function defined(hstore,text);
ALTER EXTENSION hstore ADD function delete(hstore,text);
ALTER EXTENSION hstore ADD function delete(hstore,text[]);
ALTER EXTENSION hstore ADD function delete(hstore,hstore);
ALTER EXTENSION hstore ADD operator -(hstore,text);
ALTER EXTENSION hstore ADD operator -(hstore,text[]);
ALTER EXTENSION hstore ADD operator -(hstore,hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hs_concat(hstore,hstore);
ALTER EXTENSION hstore ADD function hs_concat(hstore,hstore);
ALTER EXTENSION hstore ADD operator ||(hstore,hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hs_contains(hstore,hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hs_contained(hstore,hstore);
ALTER EXTENSION hstore ADD function hs_contains(hstore,hstore);
ALTER EXTENSION hstore ADD function hs_contained(hstore,hstore);
ALTER EXTENSION hstore ADD operator <@(hstore,hstore);
ALTER EXTENSION hstore ADD operator @>(hstore,hstore);
ALTER EXTENSION hstore ADD operator ~(hstore,hstore);
ALTER EXTENSION hstore ADD operator @(hstore,hstore);
ALTER EXTENSION hstore ADD function pg_catalog.tconvert(text,text);
ALTER EXTENSION hstore ADD function pg_catalog.hstore(text,text);
ALTER EXTENSION hstore ADD function tconvert(text,text);
ALTER EXTENSION hstore ADD function hstore(text,text);
ALTER EXTENSION hstore ADD operator =>(text,text);
ALTER EXTENSION hstore ADD function pg_catalog.hstore(text[],text[]);
ALTER EXTENSION hstore ADD function pg_catalog.hstore(text[]);
ALTER EXTENSION hstore ADD function hstore(text[],text[]);
ALTER EXTENSION hstore ADD function hstore(text[]);
ALTER EXTENSION hstore ADD cast (text[] as hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hstore(record);
ALTER EXTENSION hstore ADD function pg_catalog.hstore_to_array(hstore);
ALTER EXTENSION hstore ADD function hstore(record);
ALTER EXTENSION hstore ADD function hstore_to_array(hstore);
ALTER EXTENSION hstore ADD operator %%(NONE,hstore);
ALTER EXTENSION hstore ADD function pg_catalog.hstore_to_matrix(hstore);
ALTER EXTENSION hstore ADD function hstore_to_matrix(hstore);
ALTER EXTENSION hstore ADD operator %#(NONE,hstore);
ALTER EXTENSION hstore ADD function pg_catalog.akeys(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.avals(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.skeys(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.svals(hstore);
ALTER EXTENSION hstore ADD function pg_catalog.each(hstore);
ALTER EXTENSION hstore ADD function akeys(hstore);
ALTER EXTENSION hstore ADD function avals(hstore);
ALTER EXTENSION hstore ADD function skeys(hstore);
ALTER EXTENSION hstore ADD function svals(hstore);
ALTER EXTENSION hstore ADD function each(hstore);
ALTER EXTENSION hstore ADD function populate_record(anyelement,hstore);
ALTER EXTENSION hstore ADD operator #=(anyelement,hstore);
ALTER EXTENSION hstore ADD function hstore_eq(hstore,hstore);

View File

@ -50,99 +50,99 @@ select ' '::hstore;
-- -> operator
select pg_catalog.fetchval('aa=>b, c=>d , b=>16'::hstore, 'c');
select pg_catalog.fetchval('aa=>b, c=>d , b=>16'::hstore, 'b');
select pg_catalog.fetchval('aa=>b, c=>d , b=>16'::hstore, 'aa');
select (pg_catalog.fetchval('aa=>b, c=>d , b=>16'::hstore, 'gg')) is null;
select (pg_catalog.fetchval('aa=>NULL, c=>d , b=>16'::hstore, 'aa')) is null;
select (pg_catalog.fetchval('aa=>"NULL", c=>d , b=>16'::hstore, 'aa')) is null;
select fetchval('aa=>b, c=>d , b=>16'::hstore, 'c');
select fetchval('aa=>b, c=>d , b=>16'::hstore, 'b');
select fetchval('aa=>b, c=>d , b=>16'::hstore, 'aa');
select (fetchval('aa=>b, c=>d , b=>16'::hstore, 'gg')) is null;
select (fetchval('aa=>NULL, c=>d , b=>16'::hstore, 'aa')) is null;
select (fetchval('aa=>"NULL", c=>d , b=>16'::hstore, 'aa')) is null;
-- -> array operator
select pg_catalog.slice_array('aa=>"NULL", c=>d , b=>16'::hstore, ARRAY['aa','c']);
select pg_catalog.slice_array('aa=>"NULL", c=>d , b=>16'::hstore, ARRAY['c','aa']);
select pg_catalog.slice_array('aa=>NULL, c=>d , b=>16'::hstore, ARRAY['aa','c',null]);
select pg_catalog.slice_array('aa=>1, c=>3, b=>2, d=>4'::hstore, ARRAY[['b','d'],['aa','c']]);
select slice_array('aa=>"NULL", c=>d , b=>16'::hstore, ARRAY['aa','c']);
select slice_array('aa=>"NULL", c=>d , b=>16'::hstore, ARRAY['c','aa']);
select slice_array('aa=>NULL, c=>d , b=>16'::hstore, ARRAY['aa','c',null]);
select slice_array('aa=>1, c=>3, b=>2, d=>4'::hstore, ARRAY[['b','d'],['aa','c']]);
-- exists/defined
select pg_catalog.exist('a=>NULL, b=>qq', 'a');
select pg_catalog.exist('a=>NULL, b=>qq', 'b');
select pg_catalog.exist('a=>NULL, b=>qq', 'c');
select pg_catalog.exist('a=>"NULL", b=>qq', 'a');
select pg_catalog.defined('a=>NULL, b=>qq', 'a');
select pg_catalog.defined('a=>NULL, b=>qq', 'b');
select pg_catalog.defined('a=>NULL, b=>qq', 'c');
select pg_catalog.defined('a=>"NULL", b=>qq', 'a');
select exist('a=>NULL, b=>qq', 'a');
select exist('a=>NULL, b=>qq', 'b');
select exist('a=>NULL, b=>qq', 'c');
select exist('a=>"NULL", b=>qq', 'a');
select defined('a=>NULL, b=>qq', 'a');
select defined('a=>NULL, b=>qq', 'b');
select defined('a=>NULL, b=>qq', 'c');
select defined('a=>"NULL", b=>qq', 'a');
-- delete
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, 'a');
select pg_catalog.delete('a=>null , b=>2, c=>3'::hstore, 'a');
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, 'b');
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, 'c');
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, 'd');
select pg_catalog.pg_column_size(pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, 'b'::text))
= pg_catalog.pg_column_size('a=>1, b=>2'::hstore);
select delete('a=>1 , b=>2, c=>3'::hstore, 'a');
select delete('a=>null , b=>2, c=>3'::hstore, 'a');
select delete('a=>1 , b=>2, c=>3'::hstore, 'b');
select delete('a=>1 , b=>2, c=>3'::hstore, 'c');
select delete('a=>1 , b=>2, c=>3'::hstore, 'd');
select pg_column_size(delete('a=>1 , b=>2, c=>3'::hstore, 'b'::text))
= pg_column_size('a=>1, b=>2'::hstore);
-- delete (array)
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['d','e']);
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['d','b']);
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['a','c']);
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, ARRAY[['b'],['c'],['a']]);
select pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, '{}'::text[]);
select pg_catalog.pg_column_size(pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['a','c']))
= pg_catalog.pg_column_size('b=>2'::hstore);
select pg_catalog.pg_column_size(pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, '{}'::text[]))
= pg_catalog.pg_column_size('a=>1, b=>2, c=>3'::hstore);
select delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['d','e']);
select delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['d','b']);
select delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['a','c']);
select delete('a=>1 , b=>2, c=>3'::hstore, ARRAY[['b'],['c'],['a']]);
select delete('a=>1 , b=>2, c=>3'::hstore, '{}'::text[]);
select pg_column_size(delete('a=>1 , b=>2, c=>3'::hstore, ARRAY['a','c']))
= pg_column_size('b=>2'::hstore);
select pg_column_size(delete('a=>1 , b=>2, c=>3'::hstore, '{}'::text[]))
= pg_column_size('a=>1, b=>2, c=>3'::hstore);
-- delete (hstore)
select pg_catalog.delete('aa=>1 , b=>2, c=>3'::hstore, 'aa=>4, b=>2'::hstore);
select pg_catalog.delete('aa=>1 , b=>2, c=>3'::hstore, 'aa=>NULL, c=>3'::hstore);
select pg_catalog.delete('aa=>1 , b=>2, c=>3'::hstore, 'aa=>1, b=>2, c=>3'::hstore);
select pg_catalog.delete('aa=>1 , b=>2, c=>3'::hstore, 'b=>2'::hstore);
select pg_catalog.delete('aa=>1 , b=>2, c=>3'::hstore, ''::hstore);
select pg_catalog.pg_column_size(pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, 'b=>2'::hstore))
= pg_catalog.pg_column_size('a=>1, c=>3'::hstore);
select pg_catalog.pg_column_size(pg_catalog.delete('a=>1 , b=>2, c=>3'::hstore, ''::hstore))
= pg_catalog.pg_column_size('a=>1, b=>2, c=>3'::hstore);
select delete('aa=>1 , b=>2, c=>3'::hstore, 'aa=>4, b=>2'::hstore);
select delete('aa=>1 , b=>2, c=>3'::hstore, 'aa=>NULL, c=>3'::hstore);
select delete('aa=>1 , b=>2, c=>3'::hstore, 'aa=>1, b=>2, c=>3'::hstore);
select delete('aa=>1 , b=>2, c=>3'::hstore, 'b=>2'::hstore);
select delete('aa=>1 , b=>2, c=>3'::hstore, ''::hstore);
select pg_column_size(delete('a=>1 , b=>2, c=>3'::hstore, 'b=>2'::hstore))
= pg_column_size('a=>1, c=>3'::hstore);
select pg_column_size(delete('a=>1 , b=>2, c=>3'::hstore, ''::hstore))
= pg_column_size('a=>1, b=>2, c=>3'::hstore);
-- hs_concat
select pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f');
select pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'aq=>l');
select pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'aa=>l');
select pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, '');
select pg_catalog.hs_concat(''::hstore, 'cq=>l, b=>g, fg=>f');
select pg_catalog.pg_column_size(pg_catalog.hs_concat(''::hstore, ''::hstore)) = pg_catalog.pg_column_size(''::hstore);
select pg_catalog.pg_column_size(pg_catalog.hs_concat('aa=>1'::hstore, 'b=>2'::hstore))
= pg_catalog.pg_column_size('aa=>1, b=>2'::hstore);
select pg_catalog.pg_column_size(pg_catalog.hs_concat('aa=>1, b=>2'::hstore, ''::hstore))
= pg_catalog.pg_column_size('aa=>1, b=>2'::hstore);
select pg_catalog.pg_column_size(pg_catalog.hs_concat(''::hstore, 'aa=>1, b=>2'::hstore))
= pg_catalog.pg_column_size('aa=>1, b=>2'::hstore);
select hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f');
select hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'aq=>l');
select hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'aa=>l');
select hs_concat('aa=>1 , b=>2, cq=>3'::hstore, '');
select hs_concat(''::hstore, 'cq=>l, b=>g, fg=>f');
select pg_column_size(hs_concat(''::hstore, ''::hstore)) = pg_column_size(''::hstore);
select pg_column_size(hs_concat('aa=>1'::hstore, 'b=>2'::hstore))
= pg_column_size('aa=>1, b=>2'::hstore);
select pg_column_size(hs_concat('aa=>1, b=>2'::hstore, ''::hstore))
= pg_column_size('aa=>1, b=>2'::hstore);
select pg_column_size(hs_concat(''::hstore, 'aa=>1, b=>2'::hstore))
= pg_column_size('aa=>1, b=>2'::hstore);
-- hstore(text,text)
select pg_catalog.hs_concat('a=>g, b=>c'::hstore, pg_catalog.hstore('asd', 'gf'));
select pg_catalog.hs_concat('a=>g, b=>c'::hstore, pg_catalog.hstore('b', 'gf'));
select pg_catalog.hs_concat('a=>g, b=>c'::hstore, pg_catalog.hstore('b', 'NULL'));
select pg_catalog.hs_concat('a=>g, b=>c'::hstore, pg_catalog.hstore('b', NULL));
select (pg_catalog.hs_concat('a=>g, b=>c'::hstore, pg_catalog.hstore(NULL, 'b'))) is null;
select pg_catalog.pg_column_size(pg_catalog.hstore('b', 'gf'))
= pg_catalog.pg_column_size('b=>gf'::hstore);
select pg_catalog.pg_column_size(pg_catalog.hs_concat('a=>g, b=>c'::hstore, pg_catalog.hstore('b', 'gf')))
= pg_catalog.pg_column_size('a=>g, b=>gf'::hstore);
select hs_concat('a=>g, b=>c'::hstore, hstore('asd', 'gf'));
select hs_concat('a=>g, b=>c'::hstore, hstore('b', 'gf'));
select hs_concat('a=>g, b=>c'::hstore, hstore('b', 'NULL'));
select hs_concat('a=>g, b=>c'::hstore, hstore('b', NULL));
select (hs_concat('a=>g, b=>c'::hstore, hstore(NULL, 'b'))) is null;
select pg_column_size(hstore('b', 'gf'))
= pg_column_size('b=>gf'::hstore);
select pg_column_size(hs_concat('a=>g, b=>c'::hstore, hstore('b', 'gf')))
= pg_column_size('a=>g, b=>gf'::hstore);
-- slice()
select pg_catalog.slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['g','h','i']);
select pg_catalog.slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
select pg_catalog.slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
select pg_catalog.slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']);
select pg_catalog.pg_column_size(pg_catalog.slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']))
= pg_catalog.pg_column_size('b=>2, c=>3'::hstore);
select pg_catalog.pg_column_size(pg_catalog.slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']))
= pg_catalog.pg_column_size('aa=>1, b=>2, c=>3'::hstore);
select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['g','h','i']);
select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']);
select pg_column_size(slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']))
= pg_column_size('b=>2, c=>3'::hstore);
select pg_column_size(slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']))
= pg_column_size('aa=>1, b=>2, c=>3'::hstore);
-- array input
select '{}'::text[]::hstore;
@ -151,66 +151,66 @@ select ARRAY['a','g','b','h','asd','i']::hstore;
select ARRAY[['a','g'],['b','h'],['asd','i']]::hstore;
select ARRAY[['a','g','b'],['h','asd','i']]::hstore;
select ARRAY[[['a','g'],['b','h'],['asd','i']]]::hstore;
select pg_catalog.hstore('{}'::text[]);
select pg_catalog.hstore(ARRAY['a','g','b','h','asd']);
select pg_catalog.hstore(ARRAY['a','g','b','h','asd','i']);
select pg_catalog.hstore(ARRAY[['a','g'],['b','h'],['asd','i']]);
select pg_catalog.hstore(ARRAY[['a','g','b'],['h','asd','i']]);
select pg_catalog.hstore(ARRAY[[['a','g'],['b','h'],['asd','i']]]);
select pg_catalog.hstore('[0:5]={a,g,b,h,asd,i}'::text[]);
select pg_catalog.hstore('[0:2][1:2]={{a,g},{b,h},{asd,i}}'::text[]);
select hstore('{}'::text[]);
select hstore(ARRAY['a','g','b','h','asd']);
select hstore(ARRAY['a','g','b','h','asd','i']);
select hstore(ARRAY[['a','g'],['b','h'],['asd','i']]);
select hstore(ARRAY[['a','g','b'],['h','asd','i']]);
select hstore(ARRAY[[['a','g'],['b','h'],['asd','i']]]);
select hstore('[0:5]={a,g,b,h,asd,i}'::text[]);
select hstore('[0:2][1:2]={{a,g},{b,h},{asd,i}}'::text[]);
-- pairs of arrays
select pg_catalog.hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']);
select pg_catalog.hstore(ARRAY['a','b','asd'], ARRAY['g','h',NULL]);
select pg_catalog.hstore(ARRAY['z','y','x'], ARRAY['1','2','3']);
select pg_catalog.hstore(ARRAY['aaa','bb','c','d'], ARRAY[null::text,null,null,null]);
select pg_catalog.hstore(ARRAY['aaa','bb','c','d'], null);
select pg_catalog.quote_literal(pg_catalog.hstore('{}'::text[], '{}'::text[]));
select pg_catalog.quote_literal(pg_catalog.hstore('{}'::text[], null));
select pg_catalog.hstore(ARRAY['a'], '{}'::text[]); -- error
select pg_catalog.hstore('{}'::text[], ARRAY['a']); -- error
select pg_catalog.pg_column_size(pg_catalog.hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']))
= pg_catalog.pg_column_size('a=>g, b=>h, asd=>i'::hstore);
select hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']);
select hstore(ARRAY['a','b','asd'], ARRAY['g','h',NULL]);
select hstore(ARRAY['z','y','x'], ARRAY['1','2','3']);
select hstore(ARRAY['aaa','bb','c','d'], ARRAY[null::text,null,null,null]);
select hstore(ARRAY['aaa','bb','c','d'], null);
select quote_literal(hstore('{}'::text[], '{}'::text[]));
select quote_literal(hstore('{}'::text[], null));
select hstore(ARRAY['a'], '{}'::text[]); -- error
select hstore('{}'::text[], ARRAY['a']); -- error
select pg_column_size(hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']))
= pg_column_size('a=>g, b=>h, asd=>i'::hstore);
-- keys/values
select pg_catalog.akeys(pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select pg_catalog.akeys('""=>1');
select pg_catalog.akeys('');
select pg_catalog.avals(pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select pg_catalog.avals(pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>NULL'));
select pg_catalog.avals('""=>1');
select pg_catalog.avals('');
select akeys(hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select akeys('""=>1');
select akeys('');
select avals(hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select avals(hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>NULL'));
select avals('""=>1');
select avals('');
select pg_catalog.hstore_to_array('aa=>1, cq=>l, b=>g, fg=>NULL'::hstore);
select hstore_to_array('aa=>1, cq=>l, b=>g, fg=>NULL'::hstore);
select pg_catalog.hstore_to_matrix('aa=>1, cq=>l, b=>g, fg=>NULL'::hstore);
select hstore_to_matrix('aa=>1, cq=>l, b=>g, fg=>NULL'::hstore);
select * from pg_catalog.skeys(pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select * from pg_catalog.skeys('""=>1');
select * from pg_catalog.skeys('');
select * from pg_catalog.svals(pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select *, svals is null from pg_catalog.svals(pg_catalog.hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>NULL'));
select * from pg_catalog.svals('""=>1');
select * from pg_catalog.svals('');
select * from skeys(hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select * from skeys('""=>1');
select * from skeys('');
select * from svals(hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>f'));
select *, svals is null from svals(hs_concat('aa=>1 , b=>2, cq=>3'::hstore, 'cq=>l, b=>g, fg=>NULL'));
select * from svals('""=>1');
select * from svals('');
select * from pg_catalog.each('aaa=>bq, b=>NULL, ""=>1 ');
select * from each('aaa=>bq, b=>NULL, ""=>1 ');
-- hs_contains
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b'::hstore);
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b, c=>NULL'::hstore);
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b, g=>NULL'::hstore);
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'g=>NULL'::hstore);
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>c'::hstore);
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b'::hstore);
select pg_catalog.hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b, c=>q'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b, c=>NULL'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b, g=>NULL'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'g=>NULL'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>c'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b'::hstore);
select hs_contains('a=>b, b=>1, c=>NULL'::hstore, 'a=>b, c=>q'::hstore);
CREATE TABLE testhstore (h hstore);
\copy testhstore from 'data/hstore.data'
select pg_catalog.count(*) from testhstore where pg_catalog.hs_contains(h, 'wait=>NULL'::hstore);
select pg_catalog.count(*) from testhstore where pg_catalog.hs_contains(h, 'wait=>CC'::hstore);
select pg_catalog.count(*) from testhstore where pg_catalog.hs_contains(h, 'wait=>CC, public=>t'::hstore);
select pg_catalog.count(*) from testhstore where pg_catalog.exist(h, 'public');
select pg_catalog.count(*) from testhstore where pg_catalog.exists_any(h, ARRAY['public','disabled']);
select pg_catalog.count(*) from testhstore where pg_catalog.exists_all(h, ARRAY['public','disabled']);
select count(*) from testhstore where hs_contains(h, 'wait=>NULL'::hstore);
select count(*) from testhstore where hs_contains(h, 'wait=>CC'::hstore);
select count(*) from testhstore where hs_contains(h, 'wait=>CC, public=>t'::hstore);
select count(*) from testhstore where exist(h, 'public');
select count(*) from testhstore where exists_any(h, ARRAY['public','disabled']);
select count(*) from testhstore where exists_all(h, ARRAY['public','disabled']);

View File

@ -10,12 +10,12 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION log_fdw" to load this file. \quit
CREATE FUNCTION pg_catalog.log_fdw_handler()
CREATE FUNCTION log_fdw_handler()
RETURNS fdw_handler
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;
CREATE FUNCTION pg_catalog.log_fdw_validator(text[], oid)
CREATE FUNCTION log_fdw_validator(text[], oid)
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT NOT FENCED;
@ -26,7 +26,7 @@ CREATE FOREIGN DATA WRAPPER log_fdw
CREATE SERVER log_srv FOREIGN DATA WRAPPER log_fdw;
create or replace function pg_catalog.gs_create_log_tables()
create or replace function gs_create_log_tables()
RETURNS void
AS $$
declare

View File

@ -54,15 +54,21 @@ PG_MODULE_MAGIC;
extern "C" void _PG_init(void);
extern "C" void _PG_output_plugin_init(OutputPluginCallbacks* cb);
typedef struct {
MemoryContext context;
bool include_xids;
bool include_timestamp;
bool skip_empty_xacts;
bool xact_wrote_changes;
bool only_local;
} TestDecodingData;
static void pg_decode_startup(LogicalDecodingContext* ctx, OutputPluginOptions* opt, bool is_init);
static void pg_decode_shutdown(LogicalDecodingContext* ctx);
static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_output_begin(
LogicalDecodingContext* ctx, PluginTestDecodingData* data, ReorderBufferTXN* txn, bool last_write);
LogicalDecodingContext* ctx, TestDecodingData* data, ReorderBufferTXN* txn, bool last_write);
static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn, XLogRecPtr commit_lsn);
static void pg_decode_abort_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_decode_prepare_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_decode_change(
LogicalDecodingContext* ctx, ReorderBufferTXN* txn, Relation rel, ReorderBufferChange* change);
static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id);
@ -81,8 +87,6 @@ void _PG_output_plugin_init(OutputPluginCallbacks* cb)
cb->begin_cb = pg_decode_begin_txn;
cb->change_cb = pg_decode_change;
cb->commit_cb = pg_decode_commit_txn;
cb->abort_cb = pg_decode_abort_txn;
cb->prepare_cb = pg_decode_prepare_txn;
cb->filter_by_origin_cb = pg_decode_filter;
cb->shutdown_cb = pg_decode_shutdown;
}
@ -91,33 +95,84 @@ void _PG_output_plugin_init(OutputPluginCallbacks* cb)
static void pg_decode_startup(LogicalDecodingContext* ctx, OutputPluginOptions* opt, bool is_init)
{
ListCell* option = NULL;
PluginTestDecodingData* data = NULL;
TestDecodingData* data = NULL;
data = (PluginTestDecodingData*)palloc0(sizeof(PluginTestDecodingData));
data = (TestDecodingData*)palloc0(sizeof(TestDecodingData));
data->context = AllocSetContextCreate(ctx->context,
"text conversion context",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
data->include_xids = true;
data->include_timestamp = true;
data->include_timestamp = false;
data->skip_empty_xacts = false;
data->only_local = true;
data->tableWhiteList = NIL;
ctx->output_plugin_private = data;
opt->output_type = OUTPUT_PLUGIN_TEXTUAL_OUTPUT;
foreach (option, ctx->output_plugin_options) {
ParseDecodingOptionPlugin(option, data, opt);
DefElem* elem = (DefElem*)lfirst(option);
Assert(elem->arg == NULL || IsA(elem->arg, String));
if (strcmp(elem->defname, "include-xids") == 0) {
/* if option does not provide a value, it means its value is true */
if (elem->arg == NULL)
data->include_xids = true;
else if (!parse_bool(strVal(elem->arg), &data->include_xids))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else if (strcmp(elem->defname, "include-timestamp") == 0) {
if (elem->arg == NULL)
data->include_timestamp = true;
else if (!parse_bool(strVal(elem->arg), &data->include_timestamp))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else if (strcmp(elem->defname, "force-binary") == 0) {
bool force_binary = false;
if (elem->arg == NULL)
continue;
else if (!parse_bool(strVal(elem->arg), &force_binary))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
if (force_binary)
opt->output_type = OUTPUT_PLUGIN_BINARY_OUTPUT;
} else if (strcmp(elem->defname, "skip-empty-xacts") == 0) {
if (elem->arg == NULL)
data->skip_empty_xacts = true;
else if (!parse_bool(strVal(elem->arg), &data->skip_empty_xacts))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else if (strcmp(elem->defname, "only-local") == 0) {
if (elem->arg == NULL)
data->only_local = true;
else if (!parse_bool(strVal(elem->arg), &data->only_local))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else {
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg(
"option \"%s\" = \"%s\" is unknown", elem->defname, elem->arg ? strVal(elem->arg) : "(null)")));
}
}
}
/* cleanup this plugin's resources */
static void pg_decode_shutdown(LogicalDecodingContext* ctx)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
/* cleanup our own resources via memory context reset */
MemoryContextDelete(data->context);
@ -126,7 +181,7 @@ static void pg_decode_shutdown(LogicalDecodingContext* ctx)
/* BEGIN callback */
static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
data->xact_wrote_changes = false;
if (data->skip_empty_xacts)
@ -135,8 +190,7 @@ static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* t
pg_output_begin(ctx, data, txn, true);
}
static void pg_output_begin(LogicalDecodingContext* ctx, PluginTestDecodingData* data, ReorderBufferTXN* txn,
bool last_write)
static void pg_output_begin(LogicalDecodingContext* ctx, TestDecodingData* data, ReorderBufferTXN* txn, bool last_write)
{
OutputPluginPrepareWrite(ctx, last_write);
if (data->include_xids)
@ -149,7 +203,7 @@ static void pg_output_begin(LogicalDecodingContext* ctx, PluginTestDecodingData*
/* COMMIT callback */
static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn, XLogRecPtr commit_lsn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes)
return;
@ -167,57 +221,65 @@ static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN*
OutputPluginWrite(ctx, true);
}
/* ABORT callback */
static void pg_decode_abort_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes)
return;
OutputPluginPrepareWrite(ctx, true);
if (data->include_xids)
appendStringInfo(ctx->out, "ABORT %lu", txn->xid);
else
appendStringInfoString(ctx->out, "ABORT");
if (data->include_timestamp)
appendStringInfo(ctx->out, " (at %s)", timestamptz_to_str(txn->commit_time));
OutputPluginWrite(ctx, true);
}
/* PREPARE callback */
static void pg_decode_prepare_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes)
return;
OutputPluginPrepareWrite(ctx, true);
if (data->include_xids)
appendStringInfo(ctx->out, "PREPARE %lu", txn->xid);
else
appendStringInfoString(ctx->out, "PREPARE");
if (data->include_timestamp)
appendStringInfo(ctx->out, " (at %s)", timestamptz_to_str(txn->commit_time));
OutputPluginWrite(ctx, true);
}
static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->only_local && origin_id != InvalidRepOriginId)
return true;
return false;
}
/*
* Print literal `outputstr' already represented as string of type `typid'
* into stringbuf `s'.
*
* Some builtin types aren't quoted, the rest is quoted. Escaping is done as
* if u_sess->parser_cxt.standard_conforming_strings were enabled.
*/
static void print_literal(StringInfo s, Oid typid, char* outputstr)
{
const char* valptr = NULL;
switch (typid) {
case INT1OID:
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
/* NB: We don't care about Inf, NaN et al. */
appendStringInfoString(s, outputstr);
break;
case BITOID:
case VARBITOID:
appendStringInfo(s, "B'%s'", outputstr);
break;
case BOOLOID:
if (strcmp(outputstr, "t") == 0)
appendStringInfoString(s, "true");
else
appendStringInfoString(s, "false");
break;
default:
appendStringInfoChar(s, '\'');
for (valptr = outputstr; *valptr; valptr++) {
char ch = *valptr;
if (SQL_STR_DOUBLE(ch, false))
appendStringInfoChar(s, ch);
appendStringInfoChar(s, ch);
}
appendStringInfoChar(s, '\'');
break;
}
}
/* print the tuple 'tuple' into the StringInfo s */
static void TupleToJsoninfo(
cJSON* cols_name, cJSON* cols_type, cJSON* cols_val, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
@ -286,11 +348,11 @@ static void TupleToJsoninfo(
if (isnull)
appendStringInfoString(val_str, "null");
else if (!typisvarlena)
PrintLiteral(val_str, typid, OidOutputFunctionCall(typoutput, origval));
print_literal(val_str, typid, OidOutputFunctionCall(typoutput, origval));
else {
Datum val; /* definitely detoasted Datum */
val = PointerGetDatum(PG_DETOAST_DATUM(origval));
PrintLiteral(val_str, typid, OidOutputFunctionCall(typoutput, val));
print_literal(val_str, typid, OidOutputFunctionCall(typoutput, val));
}
cJSON* col_val = cJSON_CreateString(val_str->data);
cJSON_AddItemToArray(cols_val, col_val);
@ -303,12 +365,13 @@ static void TupleToJsoninfo(
static void pg_decode_change(
LogicalDecodingContext* ctx, ReorderBufferTXN* txn, Relation relation, ReorderBufferChange* change)
{
PluginTestDecodingData* data = NULL;
TestDecodingData* data = NULL;
Form_pg_class class_form;
TupleDesc tupdesc;
MemoryContext old;
char* res = NULL;
data = (PluginTestDecodingData*)ctx->output_plugin_private;
data = (TestDecodingData*)ctx->output_plugin_private;
u_sess->attr.attr_common.extra_float_digits = 0;
/* output BEGIN if we haven't yet */
if (data->skip_empty_xacts && !data->xact_wrote_changes) {
@ -322,18 +385,11 @@ static void pg_decode_change(
/* Avoid leaking memory by using and resetting our own context */
old = MemoryContextSwitchTo(data->context);
char *schema = get_namespace_name(class_form->relnamespace);
char *table = NameStr(class_form->relname);
if (data->tableWhiteList != NIL && !CheckWhiteList(data->tableWhiteList, schema, table)) {
(void)MemoryContextSwitchTo(old);
MemoryContextReset(data->context);
return;
}
OutputPluginPrepareWrite(ctx, true);
cJSON* root = cJSON_CreateObject();
cJSON* table_name = cJSON_CreateString(quote_qualified_identifier(schema, table));
cJSON* table_name = cJSON_CreateString(quote_qualified_identifier(
get_namespace_name(get_rel_namespace(RelationGetRelid(relation))), NameStr(class_form->relname)));
cJSON_AddItemToObject(root, "table_name", table_name);
cJSON* op_type = NULL;

View File

@ -2,22 +2,21 @@
# pagehack
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} TGT_pagehack_SRC)
set(TGT_pagehack_INC
${TGT_pq_INC} ${ZSTD_INCLUDE_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SRC_DIR}/lib/gstrace ${PROJECT_SRC_DIR}/lib/page_compression
${TGT_pq_INC} ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SRC_DIR}/lib/gstrace
)
set(pagehack_DEF_OPTIONS ${MACRO_OPTIONS})
if(${ENABLE_DEBUG} STREQUAL "ON")
set(pagehack_DEF_OPTIONS ${pagehack_DEF_OPTIONS} -DDEBUG -DFRONTEND)
set(pagehack_DEF_OPTIONS ${pagehack_DEF_OPTIONS} -DDEBUG)
endif()
set(pagehack_COMPILE_OPTIONS ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${CHECK_OPTIONS} ${BIN_SECURE_OPTIONS} ${OPTIMIZE_OPTIONS})
set(pagehack_LINK_OPTIONS ${BIN_LINK_OPTIONS})
set(pagehack_LINK_LIBS -lpgport -lcrypt -ldl -lm -ledit -lssl -lcrypto -lsecurec -lrt -lz -lminiunz -lzstd -lpagecompression)
set(pagehack_LINK_LIBS -lpgport -lcrypt -ldl -lm -ledit -lssl -lcrypto -lsecurec -lrt -lz -lminiunz)
add_bintarget(pagehack TGT_pagehack_SRC TGT_pagehack_INC "${pagehack_DEF_OPTIONS}" "${pagehack_COMPILE_OPTIONS}" "${pagehack_LINK_OPTIONS}" "${pagehack_LINK_LIBS}")
add_dependencies(pagehack pgport_static pagecompression)
add_dependencies(pagehack pgport_static)
target_link_directories(pagehack PUBLIC
${LIBOPENSSL_LIB_PATH} ${PROTOBUF_LIB_PATH} ${LIBPARQUET_LIB_PATH} ${LIBCURL_LIB_PATH} ${SECURE_LIB_PATH}
${ZLIB_LIB_PATH} ${LIBOBS_LIB_PATH} ${LIBEDIT_LIB_PATH} ${LIBCGROUP_LIB_PATH} ${CMAKE_BINARY_DIR}/lib
${ZSTD_LIB_PATH} ${PROJECT_SRC_DIR}/lib/page_compression
)
install(TARGETS pagehack RUNTIME DESTINATION bin)

View File

@ -4,7 +4,6 @@ OBJS = pagehack.o
# executable program, even there is no database server/client
PROGRAM = pagehack
all: submake-pagecompression
ifdef USE_PGXS
PG_CONFIG = pg_config
@ -14,9 +13,8 @@ else
subdir = contrib/pagehack
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
override CPPFLAGS += -I${top_builddir}/src/lib/page_compression
override LDFLAGS += -L${top_builddir}/src/lib/page_compression
override CFLAGS += -lpagecompression -lzstd
enable_shared = false
ifeq ($(enable_debug), yes)
PG_CPPFLAGS += -DDEBUG
endif

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,11 @@ static void GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat* st
/* page type (flags) */
if (P_ISDELETED(opaque)) {
stat->type = 'd';
stat->btpo.xact = ((BTPageOpaque)opaque)->xact;
if (PageIs4BXidVersion(page))
stat->btpo.xact = opaque->btpo.xact_old;
else
stat->btpo.xact = ((BTPageOpaque)opaque)->xact;
return;
} else if (P_IGNORE(opaque))
stat->type = 'e';
@ -208,45 +212,44 @@ Datum bt_page_stats(PG_FUNCTION_ARGS)
elog(ERROR, "return type must be a row type");
j = 0;
errno_t ret = 0;
const int charLen = 32;
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.blkno);
int ret = 0;
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.blkno);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%c", stat.type);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%c", stat.type);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.live_items);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.live_items);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.dead_items);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.dead_items);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.avg_item_size);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.avg_item_size);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.page_size);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.page_size);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.free_size);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.free_size);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.btpo_prev);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.btpo_prev);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.btpo_next);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.btpo_next);
securec_check_ss(ret, "", "");
if (stat.type == 'd') {
values[j] = (char*)palloc(charLen * 2);
ret = snprintf_s(values[j++], charLen * 2, charLen * 2 - 1, XID_FMT, stat.btpo.xact);
values[j] = (char*)palloc(32);
if (stat.type == 'd'){
ret = snprintf_s(values[j++], 64, 63, XID_FMT, stat.btpo.xact);
securec_check_ss(ret, "", "");
} else {
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.btpo.level);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.btpo.level);
securec_check_ss(ret, "", "");
}
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(charLen);
ret = snprintf_s(values[j++], charLen, charLen - 1, "%d", stat.btpo_flags);
values[j] = (char*)palloc(32);
ret = snprintf_s(values[j++], 32, 31, "%d", stat.btpo_flags);
securec_check_ss(ret, "", "");
tuple = BuildTupleFromCStrings(TupleDescGetAttInMetadata(tupleDesc), values);
@ -283,7 +286,6 @@ Datum bt_page_items(PG_FUNCTION_ARGS)
FuncCallContext* fctx = NULL;
MemoryContext mctx;
struct user_args* uargs;
errno_t rc;
if (!superuser())
ereport(ERROR,
@ -331,7 +333,8 @@ Datum bt_page_items(PG_FUNCTION_ARGS)
uargs = (user_args*)palloc(sizeof(struct user_args));
uargs->page = (char*)palloc(BLCKSZ);
rc = memcpy_s(uargs->page, BLCKSZ, BufferGetPage(buffer), BLCKSZ);
int rc = memcpy_s(uargs->page, BLCKSZ, BufferGetPage(buffer), BLCKSZ);
securec_check_c(rc, "\0", "\0");
UnlockReleaseBuffer(buffer);
relation_close(rel, AccessShareLock);
@ -377,21 +380,21 @@ Datum bt_page_items(PG_FUNCTION_ARGS)
j = 0;
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", uargs->offset);
securec_check_ss(rc, "", "");
int ret = 0;
ret = snprintf_s(values[j++], 32, 31, "%d", uargs->offset);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "(%u,%u)",
BlockIdGetBlockNumber(&(itup->t_tid.ip_blkid)), itup->t_tid.ip_posid);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "(%u,%u)", BlockIdGetBlockNumber(&(itup->t_tid.ip_blkid)), itup->t_tid.ip_posid);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", (int)IndexTupleSize(itup));
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", (int)IndexTupleSize(itup));
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%c", IndexTupleHasNulls(itup) ? 't' : 'f');
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%c", IndexTupleHasNulls(itup) ? 't' : 'f');
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%c", IndexTupleHasVarwidths(itup) ? 't' : 'f');
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%c", IndexTupleHasVarwidths(itup) ? 't' : 'f');
securec_check_ss(ret, "", "");
ptr = (char*)itup + IndexInfoFindDataOffset(itup->t_info);
dlen = IndexTupleSize(itup) - IndexInfoFindDataOffset(itup->t_info);
@ -403,8 +406,8 @@ Datum bt_page_items(PG_FUNCTION_ARGS)
*dump++ = ' ';
length--;
}
rc = sprintf_s(dump, length, "%02x", *(ptr + off) & 0xff);
securec_check_ss(rc, "", "");
ret = sprintf_s(dump, length, "%02x", *(ptr + off) & 0xff);
securec_check_ss(ret, "", "");
dump += 2;
length -= 2;
}
@ -474,25 +477,26 @@ Datum bt_metap(PG_FUNCTION_ARGS)
elog(ERROR, "return type must be a row type");
j = 0;
errno_t rc;
int ret = 0;
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", metad->btm_magic);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", metad->btm_magic);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", metad->btm_version);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", metad->btm_version);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", metad->btm_root);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", metad->btm_root);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", metad->btm_level);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", metad->btm_level);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", metad->btm_fastroot);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", metad->btm_fastroot);
securec_check_ss(ret, "", "");
values[j] = (char*)palloc(32);
rc = snprintf_s(values[j++], 32, 31, "%d", metad->btm_fastlevel);
securec_check_ss(rc, "", "");
ret = snprintf_s(values[j++], 32, 31, "%d", metad->btm_fastlevel);
securec_check_ss(ret, "", "");
tuple = BuildTupleFromCStrings(TupleDescGetAttInMetadata(tupleDesc), values);

View File

@ -67,8 +67,9 @@ Datum gin_metapage_info(PG_FUNCTION_ARGS)
metadata = GinPageGetMeta(page);
errno_t rc = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(rc, "\0", "\0");
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(nRet, "\0", "\0");
values[0] = Int64GetDatum(metadata->head);
values[1] = Int64GetDatum(metadata->tail);
@ -145,8 +146,9 @@ Datum gin_page_opaque_info(PG_FUNCTION_ARGS)
flags[nflags++] = DirectFunctionCall1(to_hex32, Int32GetDatum(flagbits));
}
errno_t rc = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(rc, "\0", "\0");
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(nRet, "\0", "\0");
values[0] = Int64GetDatum(opaq->rightlink);
values[1] = Int64GetDatum(opaq->maxoff);
@ -236,8 +238,9 @@ Datum gin_leafpage_items(PG_FUNCTION_ARGS)
ItemPointer tids;
Datum* tids_datum = NULL;
errno_t rc = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(rc, "\0", "\0");
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(nRet, "\0", "\0");
values[0] = ItemPointerGetDatum(&cur->first);
values[1] = UInt16GetDatum(cur->nbytes);

View File

@ -121,8 +121,9 @@ Datum heap_page_items(PG_FUNCTION_ARGS)
uint16 lp_flags;
uint16 lp_len;
errno_t rc = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(rc, "\0", "\0");
int nRet = 0;
nRet = memset_s(nulls, sizeof(nulls), 0, sizeof(nulls));
securec_check_c(nRet, "\0", "\0");
/* Extract information from the line pointer */

View File

@ -154,7 +154,7 @@ static bytea* get_raw_page_internal(text* relname, ForkNumber forknum, BlockNumb
buf = ReadBufferExtended(rel, forknum, blkno, RBM_NORMAL, NULL);
LockBuffer(buf, BUFFER_LOCK_SHARE);
errno_t rc = memcpy_s(raw_page_data, BLCKSZ, BufferGetPage(buf), BLCKSZ);
int rc = memcpy_s(raw_page_data, BLCKSZ, BufferGetPage(buf), BLCKSZ);
securec_check_c(rc, "\0", "\0");
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
@ -306,7 +306,7 @@ Datum page_compress_meta(PG_FUNCTION_ARGS)
bytea* dumpVal = (bytea*)palloc(VARHDRSZ + output->len);
SET_VARSIZE(dumpVal, VARHDRSZ + output->len);
errno_t rc = memcpy_s(VARDATA(dumpVal), output->len, output->data, output->len);
int rc = memcpy_s(VARDATA(dumpVal), output->len, output->data, output->len);
securec_check_c(rc, "\0", "\0");
pfree(output->data);
pfree(output);
@ -326,7 +326,7 @@ Datum page_compress_meta_usage(PG_FUNCTION_ARGS)
bytea* dumpVal = (bytea*)palloc(VARHDRSZ + help_size);
SET_VARSIZE(dumpVal, VARHDRSZ + help_size);
errno_t rc = memcpy_s(VARDATA(dumpVal), help_size, help, help_size);
int rc = memcpy_s(VARDATA(dumpVal), help_size, help, help_size);
securec_check_c(rc, "\0", "\0");
PG_RETURN_TEXT_P(dumpVal);
@ -413,7 +413,7 @@ static char* read_raw_page(Relation rel, ForkNumber forknum, BlockNumber blkno)
raw_page = (char*)palloc(BLCKSZ);
buf = ReadBufferExtended(rel, forknum, blkno, RBM_NORMAL, NULL);
LockBuffer(buf, BUFFER_LOCK_SHARE);
errno_t rc = memcpy_s(raw_page, BLCKSZ, BufferGetPage(buf), BLCKSZ);
int rc = memcpy_s(raw_page, BLCKSZ, BufferGetPage(buf), BLCKSZ);
securec_check_c(rc, "\0", "\0");
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buf);

View File

@ -177,7 +177,6 @@ static void SetWALFileNameForCleanup(void)
{
bool fnameOK = false;
errno_t errorno = EOK;
int segLen = 32;
TrimExtension(restartWALFileName, additional_ext);
@ -205,7 +204,7 @@ static void SetWALFileNameForCleanup(void)
* Use just the prefix of the filename, ignore everything after
* first period
*/
XLogFileName(exclusiveCleanupFileName, MAXFNAMELEN, tli, ((uint64)log) << segLen | seg);
XLogFileName(exclusiveCleanupFileName, tli, ((uint64)log) << 32 | seg);
}
}

View File

@ -125,9 +125,9 @@ struct stat stat_buf;
#define XLOG_DATA_FNAME_LEN 24
/* Reworked from access/xlog_internal.h */
#define XLogFileName(fname, len, tli, logSegNo) \
#define XLogFileName(fname, tli, logSegNo) \
snprintf(fname, \
len, \
XLOG_DATA_FNAME_LEN + 1, \
"%08X%08X%08X", \
tli, \
(uint32)((logSegNo) / XLogSegmentsPerXLogId), \
@ -345,7 +345,7 @@ static bool SetWALFileNameForCleanup(void)
}
}
XLogFileName(exclusiveCleanupFileName, MAXFNAMELEN, tli, (((uint32)log) << 32) | seg);
XLogFileName(exclusiveCleanupFileName, tli, (((uint32)log) << 32) | seg);
return cleanup;
}

View File

@ -17,3 +17,6 @@ top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
exclude_option=-fPIE
override CPPFLAGS := $(filter-out $(exclude_option),$(CPPFLAGS))

View File

@ -135,7 +135,7 @@ typedef struct pgssEntry {
* Global shared state
*/
typedef struct pgssSharedState {
LWLockId lock; /* protects hashtable search/modification */
LWLock* lock; /* protects hashtable search/modification */
int query_size; /* max query length in bytes */
double cur_median_usage; /* current median usage in hashtable */
} pgssSharedState;
@ -172,20 +172,20 @@ typedef struct pgssJumbleState {
/*---- Local variables ----*/
/* Current nesting depth of ExecutorRun+ProcessUtility calls */
static int nested_level = 0;
static THR_LOCAL int nested_level = 0;
/* Saved hook values in case of unload */
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
static post_parse_analyze_hook_type prev_post_parse_analyze_hook = NULL;
static ExecutorStart_hook_type prev_ExecutorStart = NULL;
static ExecutorRun_hook_type prev_ExecutorRun = NULL;
static ExecutorFinish_hook_type prev_ExecutorFinish = NULL;
static ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
static ProcessUtility_hook_type prev_ProcessUtility = NULL;
static THR_LOCAL shmem_startup_hook_type prev_shmem_startup_hook = NULL;
static THR_LOCAL post_parse_analyze_hook_type prev_post_parse_analyze_hook = NULL;
static THR_LOCAL ExecutorStart_hook_type prev_ExecutorStart = NULL;
static THR_LOCAL ExecutorRun_hook_type prev_ExecutorRun = NULL;
static THR_LOCAL ExecutorFinish_hook_type prev_ExecutorFinish = NULL;
static THR_LOCAL ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
static THR_LOCAL ProcessUtility_hook_type prev_ProcessUtility = NULL;
/* Links to shared memory state */
static pgssSharedState* pgss = NULL;
static HTAB* pgss_hash = NULL;
static THR_LOCAL pgssSharedState* pgss = NULL;
static THR_LOCAL HTAB* pgss_hash = NULL;
/*---- GUC variables ----*/
@ -210,8 +210,8 @@ static bool pgss_save; /* whether to save stats across shutdown */
void _PG_init(void);
void _PG_fini(void);
Datum pg_stat_statements_reset(PG_FUNCTION_ARGS);
Datum pg_stat_statements(PG_FUNCTION_ARGS);
extern "C" Datum pg_stat_statements_reset(PG_FUNCTION_ARGS);
extern "C" Datum pg_stat_statements(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(pg_stat_statements_reset);
PG_FUNCTION_INFO_V1(pg_stat_statements);
@ -260,7 +260,7 @@ void _PG_init(void)
* module isn't active. The functions must protect themselves against
* being called then, however.)
*/
if (!process_shared_preload_libraries_in_progress)
if (!u_sess->misc_cxt.process_shared_preload_libraries_in_progress)
return;
/*
@ -389,7 +389,7 @@ static void pgss_shmem_startup(void)
if (!found) {
/* First time through ... */
pgss->lock = LWLockAssign();
pgss->lock = LWLockAssign(LWTRANCHE_BUFFER_CONTENT);
pgss->query_size = g_instance.attr.attr_common.pgstat_track_activity_query_size;
pgss->cur_median_usage = ASSUMED_MEDIAN_INIT;
}
@ -456,7 +456,7 @@ static void pgss_shmem_startup(void)
buffer_size = temp.query_len + 1;
}
if (fread(buffer, 1, temp.query_len, file) != temp.query_len)
if (fread(buffer, 1, temp.query_len, file) != (size_t)temp.query_len)
goto error;
buffer[temp.query_len] = '\0';
@ -536,7 +536,7 @@ static void pgss_shmem_shutdown(int code, Datum arg)
while ((entry = (pgssEntry*)hash_seq_search(&hash_seq)) != NULL) {
int len = entry->query_len;
if (fwrite(entry, offsetof(pgssEntry, mutex), 1, file) != 1 || fwrite(entry->query, 1, len, file) != len)
if (fwrite(entry, offsetof(pgssEntry, mutex), 1, file) != 1 || fwrite(entry->query, 1, len, file) != (size_t)len)
goto error;
}
@ -748,8 +748,8 @@ static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamL
BufferUsage bufusage_start, bufusage;
uint32 queryId;
bufusage_start = u_sess->instr_cxt.pg_buffer_usage->INSTR_TIME_SET_CURRENT(start);
bufusage_start = *(u_sess->instr_cxt.pg_buffer_usage);
INSTR_TIME_SET_CURRENT(start);
nested_level++;
PG_TRY();
{
@ -1661,6 +1661,12 @@ static void JumbleExpr(pgssJumbleState* jstate, Node* node)
JumbleExpr(jstate, (Node*)lfirst(temp));
}
break;
case T_IntList:
foreach(temp, (List *) node)
{
APP_JUMB(lfirst_int(temp));
}
break;
case T_SortGroupClause: {
SortGroupClause* sgc = (SortGroupClause*)node;
@ -1674,6 +1680,7 @@ static void JumbleExpr(pgssJumbleState* jstate, Node* node)
JumbleExpr(jstate, (Node*)gsnode->content);
}
break;
case T_WindowClause: {
WindowClause* wc = (WindowClause*)node;

View File

@ -25,7 +25,6 @@ execute_process(
COMMAND ln -fs ${PROJECT_SRC_DIR}/gausskernel/storage/access/transam/xlogreader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xlogreader.cpp
COMMAND ln -fs ${PROJECT_SRC_DIR}/gausskernel/storage/access/rmgrdesc/uheapdesc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/uheapdesc.cpp
COMMAND ln -fs ${PROJECT_SRC_DIR}/gausskernel/storage/access/rmgrdesc/undologdesc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/undologdesc.cpp
COMMAND ln -fs ${PROJECT_SRC_DIR}/gausskernel/storage/access/rmgrdesc/replorigindesc.cpp ${CMAKE_CURRENT_SOURCE_DIR}/replorigindesc.cpp
)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} TGT_xlogdump_SRC)
@ -35,7 +34,7 @@ SET(TGT_xlogdump_INC
SET(xlogdump_DEF_OPTIONS ${MACRO_OPTIONS} -DFRONTEND)
SET(xlogdump_COMPILE_OPTIONS ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${CHECK_OPTIONS} ${BIN_SECURE_OPTIONS} ${OPTIMIZE_OPTIONS})
SET(xlogdump_LINK_OPTIONS ${BIN_LINK_OPTIONS})
SET(xlogdump_LINK_LIBS libpgcommon.a -lpgport -lcrypt -ldl -lm -ledit -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
SET(xlogdump_LINK_LIBS libpgcommon.a -lpgport -lcrypt -ldl -lm -ledit -lssl -lcrypto -lsecurec -lrt -lz -lminiunz)
add_bintarget(pg_xlogdump TGT_xlogdump_SRC TGT_xlogdump_INC "${xlogdump_DEF_OPTIONS}" "${xlogdump_COMPILE_OPTIONS}" "${xlogdump_LINK_OPTIONS}" "${xlogdump_LINK_LIBS}")
add_dependencies(pg_xlogdump pgport_static pgcommon_static)
target_link_directories(pg_xlogdump PUBLIC

View File

@ -41,8 +41,6 @@ typedef struct XLogDumpPrivate {
XLogRecPtr startptr;
XLogRecPtr endptr;
bool endptr_reached;
char* shareStorageXlogFilePath;
long shareStorageXlogSize;
} XLogDumpPrivate;
typedef struct XLogDumpConfig {
@ -78,7 +76,7 @@ typedef struct XLogDumpStats {
static void XLogDumpTablePage(XLogReaderState* record, int block_id, RelFileNode rnode, BlockNumber blk);
static void XLogDumpXLogRead(const char* directory, TimeLineID timeline_id, XLogRecPtr startptr, char* buf, Size count);
static int XLogDumpReadPage(XLogReaderState* state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetPtr,
char* readBuff, TimeLineID* curFileTLI, char* xlog_path = NULL);
char* readBuff, TimeLineID* curFileTLI);
static void XLogDumpCountRecord(XLogDumpConfig* config, XLogDumpStats* stats, XLogReaderState* record);
static void XLogDumpDisplayRecord(XLogDumpConfig* config, XLogReaderState* record);
static void XLogDumpStatsRow(const char* name, uint64 n, uint64 total_count, uint64 rec_len, uint64 total_rec_len,
@ -256,71 +254,6 @@ static void XLogDumpTablePage(XLogReaderState* record, int block_id, RelFileNode
printf(" write FPW page %s to disk", block_path);
}
// for dorado storage
static void XLogDumpReadSharedStorage(char* directory, XLogRecPtr startptr, long xlogSize, char* buf, Size count)
{
char* p = buf;
XLogRecPtr recptr;
Size nbytes;
static int sendFile = -1;
static uint64 sendOff = 0;
recptr = startptr;
nbytes = count;
while (nbytes > 0) {
int segbytes;
int readbytes;
uint64 startoff = (recptr % xlogSize) + XLogSegSize;
if (sendFile < 0) {
canonicalize_path(directory);
sendFile = open(directory, O_RDONLY | PG_BINARY, 0);
if (sendFile < 0) {
fatal_error("could not find file \"%s\": %s", directory, strerror(errno));
}
sendOff = 0;
}
/* Need to seek in the file? */
if (sendOff != startoff) {
if (lseek(sendFile, (off_t)startoff, SEEK_SET) < 0) {
int err = errno;
fatal_error("could not seek in log segment %s to offset %lu: %s", directory, startoff, strerror(err));
}
sendOff = startoff;
}
/* How many bytes are within this segment? */
if (nbytes > (xlogSize - startoff)) {
segbytes = xlogSize - startoff;
} else {
segbytes = nbytes;
}
readbytes = read(sendFile, p, segbytes);
if (readbytes <= 0) {
int err = errno;
fatal_error("could not read from log segment %s, offset %ld, length %d: %s",
directory,
sendOff,
segbytes,
strerror(err));
}
/* Update state for read */
XLByteAdvance(recptr, readbytes);
sendOff += readbytes;
nbytes -= readbytes;
p += readbytes;
}
}
/*
* Read count bytes from a segment file in the specified directory, for the
* given timeline, containing the specified record pointer; store the data in
@ -356,7 +289,7 @@ static void XLogDumpXLogRead(const char* directory, TimeLineID timeline_id, XLog
XLByteToSeg(recptr, sendSegNo);
XLogFileName(fname, MAXFNAMELEN, timeline_id, sendSegNo);
XLogFileName(fname, timeline_id, sendSegNo);
sendFile = fuzzy_open_file(directory, fname);
@ -371,7 +304,7 @@ static void XLogDumpXLogRead(const char* directory, TimeLineID timeline_id, XLog
int err = errno;
char fname[MAXPGPATH];
XLogFileName(fname, MAXFNAMELEN, timeline_id, sendSegNo);
XLogFileName(fname, timeline_id, sendSegNo);
fatal_error("could not seek in log segment %s to offset %u: %s", fname, startoff, strerror(err));
}
@ -389,7 +322,7 @@ static void XLogDumpXLogRead(const char* directory, TimeLineID timeline_id, XLog
int err = errno;
char fname[MAXPGPATH];
XLogFileName(fname, MAXFNAMELEN, timeline_id, sendSegNo);
XLogFileName(fname, timeline_id, sendSegNo);
fatal_error("could not read from log segment %s, offset %d, length %d: %s",
fname,
@ -411,13 +344,14 @@ static void XLogDumpXLogRead(const char* directory, TimeLineID timeline_id, XLog
* XLogReader read_page callback
*/
static int XLogDumpReadPage(XLogReaderState* state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetPtr,
char* readBuff, TimeLineID* curFileTLI, char* xlog_path)
char* readBuff, TimeLineID* curFileTLI)
{
XLogDumpPrivate* dumpprivate = (XLogDumpPrivate*)state->private_data;
int count = XLOG_BLCKSZ;
if (!XLByteEQ(dumpprivate->endptr, InvalidXLogRecPtr)) {
int recptrdiff = XLByteDifference(dumpprivate->endptr, targetPagePtr);
if (XLOG_BLCKSZ <= recptrdiff)
count = XLOG_BLCKSZ;
else if (reqLen <= recptrdiff)
@ -428,12 +362,7 @@ static int XLogDumpReadPage(XLogReaderState* state, XLogRecPtr targetPagePtr, in
}
}
if (dumpprivate->shareStorageXlogFilePath == NULL) {
XLogDumpXLogRead(dumpprivate->inpath, dumpprivate->timeline, targetPagePtr, readBuff, count);
} else {
XLogDumpReadSharedStorage(dumpprivate->shareStorageXlogFilePath, targetPagePtr,
dumpprivate->shareStorageXlogSize, readBuff, count);
}
XLogDumpXLogRead(dumpprivate->inpath, dumpprivate->timeline, targetPagePtr, readBuff, count);
return count;
}
@ -786,8 +715,6 @@ static void usage(void)
printf(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n");
printf(" use --rmgr=list to list valid resource manager names\n");
printf(" -s, --start=RECPTR start reading at log position RECPTR\n");
printf(" -S, --size=n for share storage, the length of xlog file size(not include ctl info length)\n");
printf(" default: 512*1024*1024*1024(512GB)\n");
printf(" -t, --timeline=TLI timeline from which to read log records\n");
printf(" (default: 1 or the value used in STARTSEG)\n");
printf(" -V, --version output version information, then exit\n");
@ -821,7 +748,6 @@ int main(int argc, char** argv)
{"timeline", required_argument, NULL, 't'},
{"write-fpw", no_argument, NULL, 'w'},
{"xid", required_argument, NULL, 'x'},
{"size", required_argument, NULL, 'S'},
{"version", no_argument, NULL, 'V'},
{"verbose", no_argument, NULL, 'v'},
{"stats", no_argument, NULL, 'z'},
@ -840,9 +766,6 @@ int main(int argc, char** argv)
dumpprivate.startptr = InvalidXLogRecPtr;
dumpprivate.endptr = InvalidXLogRecPtr;
dumpprivate.endptr_reached = false;
dumpprivate.shareStorageXlogFilePath = NULL;
const long defaultShareStorageXlogSize = 512 * 1024 * 1024 * 1024L;
dumpprivate.shareStorageXlogSize = defaultShareStorageXlogSize;
config.bkp_details = false;
config.write_fpw = false;
@ -860,7 +783,7 @@ int main(int argc, char** argv)
goto bad_argument;
}
while ((option = getopt_long(argc, argv, "be:?fn:p:r:s:S:t:Vvwx:z", long_options, &optindex)) != -1) {
while ((option = getopt_long(argc, argv, "be:?fn:p:r:s:t:Vvwx:z", long_options, &optindex)) != -1) {
switch (option) {
case 'b':
config.bkp_details = true;
@ -915,13 +838,6 @@ int main(int argc, char** argv)
}
dumpprivate.startptr = (((uint64)hi) << 32) | lo;
break;
case 'S':
dumpprivate.shareStorageXlogSize = atol(optarg);
if (dumpprivate.shareStorageXlogSize == 0) {
fprintf(stderr, "%s: could not parse share storage xlog size \"%s\"\n", progname, optarg);
goto bad_argument;
}
break;
case 't':
if (sscanf(optarg, "%d", &dumpprivate.timeline) != 1) {
fprintf(stderr, "%s: could not parse timeline \"%s\"\n", progname, optarg);
@ -975,11 +891,6 @@ int main(int argc, char** argv)
split_path(argv[optind], &directory, &fname);
if (strspn(fname, "0123456789ABCDEFabcdef") != strlen(fname)) {
dumpprivate.shareStorageXlogFilePath = strdup(argv[optind]);
goto begin_read;
}
if (dumpprivate.inpath == NULL && directory != NULL) {
dumpprivate.inpath = directory;
@ -1038,9 +949,7 @@ int main(int argc, char** argv)
targetsegno = endsegno;
}
bool reachEnd = !XLByteInSeg(dumpprivate.endptr, targetsegno) &&
(dumpprivate.endptr != (targetsegno + 1) * XLogSegSize);
if (reachEnd) {
if (!XLByteInSeg(dumpprivate.endptr, targetsegno) && dumpprivate.endptr != (targetsegno + 1) * XLogSegSize) {
fprintf(stderr,
"%s: end log position %X/%X is not inside file \"%s\"\n",
progname,
@ -1051,7 +960,6 @@ int main(int argc, char** argv)
}
}
begin_read:
/* we don't know what to print */
if (XLogRecPtrIsInvalid(dumpprivate.startptr)) {
fprintf(stderr, "%s: no start log position given.\n", progname);
@ -1088,7 +996,7 @@ begin_read:
for (;;) {
/* try to read the next record */
record = XLogReadRecord(xlogreader_state, first_record, &errormsg);
record = XLogReadRecord(xlogreader_state, first_record, &errormsg, false);
if (!record) {
if (!config.follow || dumpprivate.endptr_reached)
break;

View File

@ -29,7 +29,6 @@
#include "commands/sequence.h"
#include "commands/tablespace.h"
#include "replication/slot.h"
#include "replication/origin.h"
#ifdef PGXC
#include "pgxc/barrier.h"
#endif
@ -43,8 +42,7 @@
#include "access/ustore/knl_uredo.h"
#define PG_RMGR(symname, name, redo, desc, startup, cleanup, safe_restartpoint, undo, undo_desc, type_name) \
{name, desc},
#define PG_RMGR(symname, name, redo, desc, startup, cleanup, safe_restartpoint, undo, undo_desc) {name, desc},
const RmgrDescData RmgrDescTable[RM_MAX_ID + 1] = {
#include "access/rmgrlist.h"

View File

@ -2,7 +2,6 @@
* contrib/pgstattuple/pgstattuple.c
*
* Copyright (c) 2001,2002 Tatsuo Ishii
* Portions Copyright (c) 2021, openGauss Contributors
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without a
@ -197,7 +196,6 @@ static Datum pgstat_relation(Relation rel, FunctionCallInfo fcinfo)
case RELKIND_TOASTVALUE:
case RELKIND_UNCATALOGED:
case RELKIND_SEQUENCE:
case RELKIND_LARGE_SEQUENCE:
return pgstat_heap(rel, fcinfo);
case RELKIND_INDEX:
switch (rel->rd_rel->relam) {

View File

@ -158,8 +158,8 @@ PGconn *GetConnection(ForeignServer *server, UserMapping *user, bool will_prep_s
RegisterXactCallback(pgfdw_xact_callback, NULL);
RegisterSubXactCallback(pgfdw_subxact_callback, NULL);
CacheRegisterSessionSyscacheCallback(FOREIGNSERVEROID, pgfdw_inval_callback, (Datum)0);
CacheRegisterSessionSyscacheCallback(USERMAPPINGOID, pgfdw_inval_callback, (Datum)0);
CacheRegisterSyscacheCallback(FOREIGNSERVEROID, pgfdw_inval_callback, (Datum)0);
CacheRegisterSyscacheCallback(USERMAPPINGOID, pgfdw_inval_callback, (Datum)0);
if (IS_THREAD_POOL_SESSION) {
u_sess->ext_fdw_ctx[POSTGRES_TYPE_FDW].fdwExitFunc = pg_fdw_exit;

View File

@ -46,7 +46,6 @@
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "libpq/pqexpbuffer.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/var.h"
@ -1179,36 +1178,6 @@ static void deparseRelation(StringInfo buf, Relation rel)
relname = RelationGetRelationName(rel);
}
/* In current version, there are some unpredictable operations (delete/update, etc.) of foreign table built on
* partitioned table. We forbid all operations in this condition by default. */
if (!ENABLE_SQL_BETA_FEATURE(PARTITION_FDW_ON)) {
char parttype = PARTTYPE_NON_PARTITIONED_RELATION;
UserMapping* user = GetUserMapping(GetUserId(), table->serverid);
ForeignServer *server = GetForeignServer(table->serverid);
PGconn* conn = GetConnection(server, user, false);
PQExpBuffer query = createPQExpBuffer();
appendPQExpBuffer(query,
"SELECT c.parttype FROM pg_class c, pg_namespace n "
"WHERE c.relname = '%s' and c.relnamespace = n.oid and n.nspname = '%s'",
quote_identifier(relname), quote_identifier(nspname));
PGresult* res = pgfdw_exec_query(conn, query->data);
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
pgfdw_report_error(ERROR, res, conn, true, query->data);
}
/* res may be empty as the relname/nspname validation is not checked */
if (PQntuples(res) > 0) {
parttype = *PQgetvalue(res, 0, 0);
}
PQclear(res);
destroyPQExpBuffer(query);
if ((parttype == PARTTYPE_PARTITIONED_RELATION || parttype == PARTTYPE_SUBPARTITIONED_RELATION)) {
ereport(ERROR, (errmsg("could not operate foreign table on partitioned table")));
}
}
appendStringInfo(buf, "%s.%s", quote_identifier(nspname), quote_identifier(relname));
}

View File

@ -654,18 +654,10 @@ static ForeignScan *postgresGetForeignPlan(PlannerInfo *root, RelOptInfo *basere
* complete information about, and (b) it wouldn't work anyway on
* older remote servers. Likewise, we don't worry about NOWAIT.
*/
switch (rc->strength) {
case LCS_FORKEYSHARE:
case LCS_FORSHARE:
appendStringInfoString(&sql, " FOR SHARE");
break;
case LCS_FORNOKEYUPDATE:
case LCS_FORUPDATE:
appendStringInfoString(&sql, " FOR UPDATE");
break;
default:
ereport(ERROR, (errmsg("unknown lock type: %d", rc->strength)));
break;
if (rc->forUpdate) {
appendStringInfoString(&sql, " FOR UPDATE");
} else {
appendStringInfoString(&sql, " FOR SHARE");
}
}
}

View File

@ -37,17 +37,17 @@ CREATE TABLE "S 1"."T 2" (
INSERT INTO "S 1"."T 1"
SELECT id,
id % 10,
pg_catalog.to_char(id, 'FM00000'),
to_char(id, 'FM00000'),
'1970-01-01'::timestamptz + ((id % 100) || ' days')::interval,
'1970-01-01'::timestamp + ((id % 100) || ' days')::interval,
id % 10,
id % 10,
'foo'::user_enum
FROM pg_catalog.generate_series(1, 1000) id;
FROM generate_series(1, 1000) id;
INSERT INTO "S 1"."T 2"
SELECT id,
'AAA' || pg_catalog.to_char(id, 'FM000')
FROM pg_catalog.generate_series(1, 100) id;
'AAA' || to_char(id, 'FM000')
FROM generate_series(1, 100) id;
ANALYZE "S 1"."T 1";
ANALYZE "S 1"."T 2";
@ -188,7 +188,7 @@ SELECT 'fixed', NULL FROM ft1 t1 WHERE c1 = 1;
-- user-defined operator/function
CREATE FUNCTION postgres_fdw_abs(int) RETURNS int AS $$
BEGIN
RETURN pg_catalog.abs($1);
RETURN abs($1);
END
$$ LANGUAGE plpgsql IMMUTABLE;
CREATE OPERATOR === (
@ -200,7 +200,7 @@ CREATE OPERATOR === (
);
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 = postgres_fdw_abs(t1.c2);
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2;
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 = pg_catalog.abs(t1.c2);
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 = abs(t1.c2);
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 = t1.c2;
-- ===================================================================
@ -210,7 +210,7 @@ EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 = 1; --
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE t1.c1 = 100 AND t1.c2 = 0; -- BoolExpr
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE c1 IS NULL; -- NullTest
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE c1 IS NOT NULL; -- NullTest
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE pg_catalog.round(pg_catalog.abs(c1), 0) = 1; -- FuncExpr
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE round(abs(c1), 0) = 1; -- FuncExpr
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE c1 = -c1; -- OpExpr(l)
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE 1 = c1!; -- OpExpr(r)
EXPLAIN (VERBOSE, COSTS false) SELECT * FROM ft1 t1 WHERE (c1 IS NOT NULL) IS DISTINCT FROM (c1 IS NOT NULL); -- DistinctExpr
@ -225,9 +225,9 @@ SELECT * FROM ft2 a, ft2 b WHERE a.c1 = 47 AND b.c1 = a.c2;
-- check both safe and unsafe join conditions
EXPLAIN (VERBOSE, COSTS false)
SELECT * FROM ft2 a, ft2 b
WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = pg_catalog.upper(a.c7);
WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = upper(a.c7);
SELECT * FROM ft2 a, ft2 b
WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = pg_catalog.upper(a.c7);
WHERE a.c2 = 6 AND b.c1 = a.c1 AND a.c8 = 'foo' AND b.c7 = upper(a.c7);
-- bug before 9.3.5 due to sloppy handling of remote-estimate parameters
SELECT * FROM ft1 WHERE c1 = ANY (ARRAY(SELECT c1 FROM ft2 WHERE c1 < 5));
SELECT * FROM ft2 WHERE c1 = ANY (ARRAY(SELECT c1 FROM ft1 WHERE c1 < 5));
@ -267,12 +267,12 @@ EXPLAIN (VERBOSE, COSTS false) EXECUTE st1(1, 2);
EXECUTE st1(1, 1);
EXECUTE st1(101, 101);
-- subquery using stable function (can't be sent to remote)
PREPARE st2(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 < $2 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 > $1 AND pg_catalog.date(c4) = '1970-01-17'::date) ORDER BY c1;
PREPARE st2(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 < $2 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 > $1 AND date(c4) = '1970-01-17'::date) ORDER BY c1;
EXPLAIN (VERBOSE, COSTS false) EXECUTE st2(10, 20);
EXECUTE st2(10, 20);
EXECUTE st2(101, 121);
-- subquery using immutable function (can be sent to remote)
PREPARE st3(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 < $2 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 > $1 AND pg_catalog.date(c5) = '1970-01-17'::date) ORDER BY c1;
PREPARE st3(int) AS SELECT * FROM ft1 t1 WHERE t1.c1 < $2 AND t1.c3 IN (SELECT c3 FROM ft2 t2 WHERE c1 > $1 AND date(c5) = '1970-01-17'::date) ORDER BY c1;
EXPLAIN (VERBOSE, COSTS false) EXECUTE st3(10, 20);
EXECUTE st3(10, 20);
EXECUTE st3(20, 30);
@ -448,34 +448,34 @@ INSERT INTO ft1(c1, c2) VALUES(1111, -2); -- c2positive
UPDATE ft1 SET c2 = -c2 WHERE c1 = 1; -- c2positive
-- Test savepoint/rollback behavior
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, pg_catalog.count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
begin;
update ft2 set c2 = 42 where c2 = 0;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
savepoint s1;
update ft2 set c2 = 44 where c2 = 4;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
release savepoint s1;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
savepoint s2;
update ft2 set c2 = 46 where c2 = 6;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
rollback to savepoint s2;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
release savepoint s2;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
savepoint s3;
update ft2 set c2 = -2 where c2 = 42 and c1 = 10; -- fail on remote side
rollback to savepoint s3;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
release savepoint s3;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
-- none of the above is committed yet remotely
select c2, pg_catalog.count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
commit;
select c2, pg_catalog.count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, pg_catalog.count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
select c2, count(*) from ft2 where c2 < 500 group by 1 order by 1;
select c2, count(*) from "S 1"."T 1" where c2 < 500 group by 1 order by 1;
-- ===================================================================
-- test serial columns (ie, sequence-based defaults)
@ -530,14 +530,14 @@ begin
tg_name, argstr, TG_when, TG_level, TG_OP, relid;
oldnew := '{}'::text[];
if TG_OP != 'INSERT' then
oldnew := pg_catalog.array_append(oldnew, pg_catalog.format('OLD: %s', OLD));
oldnew := array_append(oldnew, format('OLD: %s', OLD));
end if;
if TG_OP != 'DELETE' then
oldnew := pg_catalog.array_append(oldnew, pg_catalog.format('NEW: %s', NEW));
oldnew := array_append(oldnew, format('NEW: %s', NEW));
end if;
RAISE NOTICE '%', pg_catalog.array_to_string(oldnew, ',');
RAISE NOTICE '%', array_to_string(oldnew, ',');
if TG_OP = 'DELETE' then
return OLD;

View File

@ -240,11 +240,8 @@ void check_access_table(const policy_set *policy_ids, RangeVar *rel, int access_
if (rel == NULL) {
return;
}
/* PolicyLabelItem construction will append schema oid by relid */
PolicyLabelItem item;
PolicyLabelItem item(rel->schemaname, rel->relname, "", object_type);
PolicyLabelItem view_item(0, 0, O_VIEW);
gen_policy_labelitem(item, (const ListCell *)rel, object_type);
policy_result pol_result;
int block_behaviour = 0;
check_audit_policy_access(&item, &view_item, access_type, policy_ids, &pol_result,
@ -260,17 +257,18 @@ void audit_open_relation(List *list, Var *col_att, PolicyLabelItem *full_column,
}
RangeTblEntry *rte = (RangeTblEntry *)list_nth(list, relation_pos);
if (rte && rte->relid > 0) {
Relation tbl_rel = relation_open(rte->relid, AccessShareLock);
if (tbl_rel->rd_rel) {
/* schema */
full_column->m_schema = tbl_rel->rd_rel->relnamespace;
if (rte->relid > 0) {
Relation tbl_rel = relation_open(rte->relid, AccessShareLock);
if (tbl_rel) {
/* schema */
if (tbl_rel->rd_rel) {
full_column->m_schema = tbl_rel->rd_rel->relnamespace;
}
relation_close(tbl_rel, AccessShareLock);
}
}
relation_close(tbl_rel, AccessShareLock);
if (rte->rtekind == RTE_REMOTE_DUMMY) {
return;
} else if (rte->rtekind == RTE_SUBQUERY) {
/* subquery in from */
/* subquery in from */
if (rte->rtekind == RTE_SUBQUERY) {
if (rte->subquery) {
audit_open_relation(rte->subquery->rtable, col_att, full_column, is_found);
}
@ -288,8 +286,8 @@ void audit_open_relation(List *list, Var *col_att, PolicyLabelItem *full_column,
}
}
static void audit_cursor_view(RuleLock *rules, Var *col_att, PolicyLabelItem *full_column,
PolicyLabelItem *view_full_column)
static void audit_open_view(RuleLock *rules, Var *col_att, PolicyLabelItem* full_column,
PolicyLabelItem *view_full_column)
{
if (col_att == NULL)
return;
@ -364,7 +362,7 @@ void get_fqdn_by_relid(RangeTblEntry *rte, PolicyLabelItem *full_column, Var *co
/* schema */
full_column->m_schema = tbl_rel->rd_rel->relnamespace;
if (tbl_rel->rd_rules) { /* view */
audit_cursor_view(tbl_rel->rd_rules, col_att, full_column, view_full_column);
audit_open_view(tbl_rel->rd_rules, col_att, full_column, view_full_column);
if (view_full_column) {
view_full_column->m_schema = tbl_rel->rd_rel->relnamespace;
view_full_column->set_object(rte->relid, O_VIEW);
@ -452,15 +450,12 @@ void handle_subquery(RangeTblEntry *rte, int commandType, policy_result *pol_res
}
ListCell *lc = NULL;
foreach(lc, rte->subquery->rtable) {
RangeTblEntry *sub_rte = (RangeTblEntry *)lfirst(lc);
if (sub_rte == NULL) {
RangeTblEntry *sub_rte = (RangeTblEntry *) lfirst(lc);
if (sub_rte == NULL)
break;
}
if (sub_rte->rtekind == RTE_REMOTE_DUMMY) {
continue;
} else if (sub_rte->rtekind == RTE_SUBQUERY && sub_rte->subquery) {
/* recursive call handle_subquery till find a table object */
/* recursive call handle_subquery till find a table object */
if (sub_rte->rtekind == RTE_SUBQUERY && sub_rte->subquery) {
handle_subquery(sub_rte, commandType, pol_result, checked_tables, policy_ids,
security_policy_ids, &(++(*recursion_deep)));
} else if (sub_rte->relname) {
@ -470,67 +465,12 @@ void handle_subquery(RangeTblEntry *rte, int commandType, policy_result *pol_res
if (checked_tables->insert(sub_rte->relname).second) {
CmdType cmd_type = get_rte_commandtype(rte);
cmd_type = (cmd_type == CMD_UNKNOWN) ? (CmdType)commandType : cmd_type;
if (!handle_table_entry(sub_rte, cmd_type, policy_ids, security_policy_ids, pol_result)) {
if (!handle_table_entry(sub_rte, cmd_type, policy_ids,
security_policy_ids, pol_result))
continue;
}
flush_policy_result(pol_result, cmd_type);
}
}
}
}
void access_audit_policy_run(const List* rtable, CmdType cmd_type)
{
if (rtable == NULL) {
return;
}
/* filt audit policys by application info */
policy_set policy_ids;
IPV6 ip;
get_remote_addr(&ip);
FilterData filter_item(get_session_app_name(), ip);
check_audit_policy_filter(&filter_item, &policy_ids);
ListCell *lc = NULL;
policy_set security_policy_ids;
_checked_tables checked_tables;
foreach (lc, rtable) {
/* table object */
RangeTblEntry *rte = (RangeTblEntry *)lfirst(lc);
policy_result pol_result;
if (rte == NULL || rte->rtekind == RTE_REMOTE_DUMMY) {
continue;
}
if (rte->rtekind == RTE_SUBQUERY && rte->subquery) { /* relation is subquery */
int recursion_deep = 0;
handle_subquery(rte, rte->subquery->commandType, &pol_result, &checked_tables, &policy_ids,
&security_policy_ids, &recursion_deep);
} else if (rte->relname != NULL &&
checked_tables.insert(rte->relname).second) { /* verify if table object already checked */
/* use query plan commandtype here but not get it from rte directly */
if (!handle_table_entry(rte, cmd_type, &policy_ids, &security_policy_ids, &pol_result)) {
continue;
}
flush_policy_result(&pol_result, cmd_type);
}
}
flush_access_logs(AUDIT_OK);
}
void opfusion_unified_audit_executor(const PlannedStmt *plannedstmt)
{
/* verify parameter and audit policy */
if (!u_sess->attr.attr_security.Enable_Security_Policy || u_sess->proc_cxt.IsInnerMaintenanceTools ||
IsConnFromCoord() || !is_audit_policy_exist_load_policy_info()) {
return;
}
ereport(DEBUG1, (errmsg("opfusion_unified_audit_executor routine enter")));
if (!plannedstmt) {
return;
}
access_audit_policy_run(plannedstmt->rtable, plannedstmt->commandType);
}

View File

@ -52,6 +52,5 @@ void open_relation(List *list, Var *col_att, PolicyLabelItem *full_column, bool
void handle_subquery(RangeTblEntry *rte, int commandType, policy_result *pol_result, _checked_tables *checked_tables,
const policy_set *policy_ids, const policy_set *security_policy_ids, int *recursion_deep);
void audit_open_relation(List *list, Var *col_att, PolicyLabelItem *full_column, bool *is_found);
void access_audit_policy_run(const List* rtable, CmdType cmd_type);
void opfusion_unified_audit_executor(const PlannedStmt *plannedstmt);
#endif /* ACCESS_AUDIT_H_ */

View File

@ -491,80 +491,77 @@ bool check_audit_policy_access(const PolicyLabelItem *item, const PolicyLabelIte
}
}
PolicyLabelItem view_object_item(view_item->m_schema, view_item->m_object,
O_COLUMN, view_item->m_column);
/*
* walk through all the access audit label info to match with label of object
*/
if (labels.empty()) {
return false;
}
bool has_column = false;
PolicyLabelItem view_object_item(view_item->m_schema, view_item->m_object,
O_COLUMN, view_item->m_column);
AccessPair object_item("", item->m_obj_type);
{
gs_stl::gs_string value;
item->get_fqdn_value(&value);
object_item.first = value.c_str();
}
loaded_labels *tmp_labels = get_policy_labels();
policy_label_map::const_iterator lit = labels.begin();
policy_label_map::const_iterator elit = labels.end();
for (; lit != elit; ++lit) {
const PolicyPair &pol_item = *(lit.first);
loaded_labels::const_iterator it;
if (tmp_labels != NULL) {
it = tmp_labels->find(lit->second->c_str());
if (labels.size()) {
AccessPair object_item("", item->m_obj_type);
{
gs_stl::gs_string value;
item->get_fqdn_value(&value);
object_item.first = value.c_str();
}
if ((tmp_labels == NULL || it == tmp_labels->end()) && *(lit->second) == "all") {
(*pol_result)[pol_item.m_id][object_item];
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
loaded_labels *tmp_labels = get_policy_labels();
policy_label_map::const_iterator lit = labels.begin();
policy_label_map::const_iterator elit = labels.end();
for (; lit != elit; ++lit) {
const PolicyPair& pol_item = *(lit.first);
loaded_labels::const_iterator it;
if (tmp_labels != NULL) {
it = tmp_labels->find(lit->second->c_str());
}
} else if (it != tmp_labels->end()) {
/* <label_type, PolicyLabelItem> */
typed_labels::const_iterator fit = it->second->begin();
typed_labels::const_iterator feit = it->second->end();
for (; fit != feit; ++fit) {
bool is_columnn = (*(fit->first) == O_COLUMN);
has_column = has_column || is_columnn;
if (*(fit->first) != item->m_obj_type && (*fit->first) != O_SCHEMA) {
continue;
if ((tmp_labels == NULL || it == tmp_labels->end()) && *(lit->second) == "all") {
(*pol_result)[pol_item.m_id][object_item];
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
}
const gs_policy_label_set &objects = *(fit->second);
if (is_columnn) {
if (view_object_item.m_object && !view_object_item.empty() &&
objects.find(view_object_item) != objects.end()) {
gs_stl::gs_string value;
view_object_item.get_fqdn_value(&value);
object_item.first = value.c_str();
(*pol_result)[pol_item.m_id][object_item].insert(view_object_item.m_column);
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
}
} else if (it != tmp_labels->end()) {
typed_labels::const_iterator fit = it->second->begin();
typed_labels::const_iterator feit = it->second->end();
for (; fit != feit; ++fit) {
bool is_columnn = (*(fit->first) == O_COLUMN);
has_column = has_column || is_columnn;
if (*(fit->first) != item->m_obj_type && (*fit->first) != O_SCHEMA) {
continue;
}
if (objects.find(*item) != objects.end()) {
(*pol_result)[pol_item.m_id][object_item].insert(item->m_column);
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
const gs_policy_label_set& objects = *(fit->second);
if (is_columnn) {
if (view_object_item.m_object && !view_object_item.empty() &&
objects.find(view_object_item) != objects.end()) {
gs_stl::gs_string value;
view_object_item.get_fqdn_value(&value);
object_item.first = value.c_str();
(*pol_result)[pol_item.m_id][object_item].insert(view_object_item.m_column);
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
}
}
}
} else if (*(fit->first) == O_SCHEMA) {
PolicyLabelItem sch_item;
sch_item.m_schema = item->m_schema;
if (objects.find(sch_item) != objects.end()) {
if (objects.find(*item) != objects.end()) {
(*pol_result)[pol_item.m_id][object_item].insert(item->m_column);
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
}
}
} else if (*(fit->first) == O_SCHEMA) {
PolicyLabelItem sch_item;
sch_item.m_schema = item->m_schema;
if (objects.find(sch_item) != objects.end()) {
(*pol_result)[pol_item.m_id][object_item];
}
} else if (objects.find(*item) != objects.end()) {
(*pol_result)[pol_item.m_id][object_item];
}
} else if (objects.find(*item) != objects.end()) {
(*pol_result)[pol_item.m_id][object_item];
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
if (pol_item.m_block_type > 0) {
*block_behaviour = pol_item.m_block_type;
return has_column;
}
}
}
}

View File

@ -113,6 +113,8 @@ typedef void (*Reset_security_privilige_hook_type)();
typedef bool (*CheckSecurityPolicyFilter_hook_type)(const FilterData arg, policy_set *policy_ids);
typedef bool (*Security_isRoleInUse_hook_type)(Oid roleid);
typedef bool (*Security_Check_acl_privilige_hook_type)(int privilige);
typedef bool (*Security_LoginHandle_access_hook_type)(const char *dbname, const char *username,
bool success, bool login);
typedef bool (*Reload_security_policy_hook_type)();
#endif

View File

@ -177,16 +177,7 @@ static bool is_valid_language(Oid lang_oid)
static bool is_valid_for_masking(const char* func_name, Oid funcnsp, int& funcid,
const char* func_parameters, bool* invalid_params)
{
CatCList *catlist = NULL;
#ifndef ENABLE_MULTIPLE_NODES
if (t_thrd.proc->workingVersionNum < 92470) {
catlist = SearchSysCacheList1(PROCNAMEARGSNSP, CStringGetDatum(func_name));
} else {
catlist = SearchSysCacheList1(PROCALLARGS, CStringGetDatum(func_name));
}
#else
catlist = SearchSysCacheList1(PROCNAMEARGSNSP, CStringGetDatum(func_name));
#endif
CatCList *catlist = SearchSysCacheList1(PROCNAMEARGSNSP, CStringGetDatum(func_name));
bool is_found = false;
if (catlist != NULL) {
func_params f_params;
@ -196,7 +187,7 @@ static bool is_valid_for_masking(const char* func_name, Oid funcnsp, int& funcid
bool is_valid = true;
/* try to find function on pg_proc */
for (int i = 0; i < catlist->n_members && is_valid; ++i) {
HeapTuple proctup = t_thrd.lsc_cxt.FetchTupleFromCatCList(catlist, i);
HeapTuple proctup = &catlist->members[i]->tuple;
Form_pg_proc procform = (Form_pg_proc) GETSTRUCT(proctup);
/* verify namespace */
if (procform->pronamespace != funcnsp) {

View File

@ -36,8 +36,6 @@
#include "utils/snapmgr.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"
#include "gs_mask_policy.h"
#include "gs_policy_plugin.h"
static THR_LOCAL loaded_labels *all_labels = NULL;
@ -194,13 +192,13 @@ bool check_label_has_object(const PolicyLabelItem *object,
return false;
}
Assert(CheckLabelBoundPolicy != NULL);
loaded_labels *cur_all_labels = get_policy_labels();
if (cur_all_labels == NULL) {
loaded_labels *all_labels = get_policy_labels();
if (all_labels == NULL) {
return false;
}
loaded_labels::const_iterator it = cur_all_labels->begin();
loaded_labels::const_iterator eit = cur_all_labels->end();
loaded_labels::const_iterator it = all_labels->begin();
loaded_labels::const_iterator eit = all_labels->end();
for (; it != eit; ++it) {
/* for each item of loaded existing labels, and match labels */
if (labels != NULL && labels->find(*(it->first)) == labels->end()) {
@ -240,41 +238,4 @@ void clear_thread_local_label()
delete all_labels;
all_labels = NULL;
}
}
void verify_drop_column(AlterTableStmt *stmt)
{
ListCell *lcmd = NULL;
foreach (lcmd, stmt->cmds) {
AlterTableCmd *cmd = (AlterTableCmd *)lfirst(lcmd);
switch (cmd->subtype) {
case AT_DropColumn: {
/* check by column */
PolicyLabelItem find_obj(stmt->relation->schemaname, stmt->relation->relname, cmd->name, O_COLUMN);
if (check_label_has_object(&find_obj, is_masking_has_object)) {
char buff[512] = {0};
int rc = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
"Column: %s is part of some resource label, can not be renamed.", find_obj.m_column);
securec_check_ss(rc, "\0", "\0");
gs_audit_issue_syslog_message("PGAUDIT", buff, AUDIT_POLICY_EVENT, AUDIT_FAILED);
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\"", buff)));
}
break;
}
case AT_AlterColumnType: {
PolicyLabelItem find_obj(stmt->relation->schemaname, stmt->relation->relname, cmd->name, O_COLUMN);
if (check_label_has_object(&find_obj, is_masking_has_object, true)) {
char buff[512] = {0};
int ret = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
"Column: %s is part of some masking policy, can not be changed.", find_obj.m_column);
securec_check_ss(ret, "\0", "\0");
gs_audit_issue_syslog_message("PGAUDIT", buff, AUDIT_POLICY_EVENT, AUDIT_FAILED);
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\"", buff)));
}
break;
}
default:
break;
}
}
}

View File

@ -56,5 +56,4 @@ bool update_label_value(const gs_stl::gs_string object_name,
void reset_policy_labels();
void clear_thread_local_label();
void verify_drop_column(AlterTableStmt *stmt);
#endif /* GS_POLICY_GS_POLICY_LABELS_H_ */

View File

@ -22,7 +22,6 @@
*
* -------------------------------------------------------------------------
*/
#include "parser/parse_func.h"
#include "postgres.h"
#include "access/htup.h"
#include "access/heapam.h"
@ -32,12 +31,10 @@
#include "catalog/pg_proc.h"
#include "commands/user.h"
#include "gs_policy_object_types.h"
#include "gs_policy_plugin.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"
#include "utils/builtins.h"
#include "utils/acl.h"
#include "catalog/objectaddress.h"
/*
* get_relation_schema
@ -544,19 +541,6 @@ typedef struct ObjectTypeInfo
const char* object_name;
} ObjectTypeInfo;
typedef struct CmdCursorInfo {
CmdType cmd_type;
const char *object_name;
} CmdCursorInfo;
static CmdCursorInfo cmd_cursorinfo[] = {
{CMD_SELECT, "FOR SELECT FROM"},
{CMD_INSERT, "FOR INSERT TO"},
{CMD_UPDATE, "FOR UPDATE FROM"},
{CMD_DELETE, "FOR DELETE FROM"},
{CMD_UNKNOWN, NULL}
};
static OperInfo oper_infos[] = {
{"create", T_CREATE},
{"alter", T_ALTER},
@ -573,7 +557,7 @@ static OperInfo oper_infos[] = {
{"login_success", T_LOGIN_SUCCESS},
{"login_failure", T_LOGIN_FAILURE},
{"copy", T_COPY},
{"cursor", T_CURSOR},
{"open", T_OPEN},
{"fetch", T_FETCH},
{"close", T_CLOSE},
{"all", T_ALL},
@ -634,20 +618,6 @@ static ObjectTypeInfo object_type_infos[] =
{O_UNKNOWN, NULL}
};
/*
* get_cursorinfo
* return cursor operation object
*/
const char *get_cursorinfo(CmdType type)
{
for (int i = 0; cmd_cursorinfo[i].object_name != NULL; ++i) {
if (cmd_cursorinfo[i].cmd_type == type) {
return cmd_cursorinfo[i].object_name;
}
}
return "UNKNOWN";
}
/*
* get_privilege_type
* return privilege type in enum PrivType by its name
@ -822,156 +792,4 @@ bool verify_proc_params(const func_params* func_params, const func_types* proc_t
}
}
return true;
}
void load_function_label(const Query *query, bool audit_exist)
{
if (audit_exist && query->rtable != NIL) {
ListCell *lc = NULL;
foreach (lc, query->rtable) {
RangeTblEntry *rte = (RangeTblEntry *)lfirst(lc);
if (rte->rtekind == RTE_REMOTE_DUMMY) {
continue;
} else if (rte && rte->rtekind == RTE_FUNCTION && rte->funcexpr) {
FuncExpr *fe = (FuncExpr *)rte->funcexpr;
PolicyLabelItem func_label;
get_function_name(fe->funcid, &func_label);
set_result_set_function(func_label);
}
}
}
}
/*
* ListCell could be RangeVar nodes, FuncWithArgs nodes,
* or plain names (as Value strings) according to objtype
*/
void gen_policy_labelitem(PolicyLabelItem &item, const ListCell *rel, int objtype)
{
if (rel == NULL) {
return;
}
switch (objtype) {
case O_VIEW:
case O_TABLE: {
Oid relid = RangeVarGetRelid((RangeVar *)rel, NoLock, false);
if (!OidIsValid(relid)) {
return;
}
item = PolicyLabelItem(0, relid, objtype, "");
break;
}
case O_FUNCTION: {
FuncWithArgs *func = (FuncWithArgs *)(rel);
Oid funcid = LookupFuncNameTypeNames(func->funcname, func->funcargs, false);
if (!OidIsValid(funcid)) {
return;
}
item = PolicyLabelItem(0, funcid, objtype, "");
break;
}
case O_SCHEMA: {
char *nspname = strVal(rel);
item = PolicyLabelItem(nspname, NULL, NULL, objtype);
break;
}
default:
break;
}
return;
}
void gen_policy_label_for_commentstmt(PolicyLabelItem &item, const CommentStmt *commentstmt)
{
ObjectAddress address;
Relation relation;
address = get_object_address(commentstmt->objtype, commentstmt->objname, commentstmt->objargs, &relation,
ShareUpdateExclusiveLock, false);
switch (commentstmt->objtype) {
case OBJECT_COLUMN: {
item = PolicyLabelItem(0, address.objectId, O_COLUMN, strVal(lfirst(list_tail(commentstmt->objname))));
break;
}
case OBJECT_TABLE: {
item = PolicyLabelItem(0, address.objectId, O_TABLE, "");
break;
}
case OBJECT_FUNCTION: {
item = PolicyLabelItem(0, address.objectId, O_FUNCTION, "");
break;
}
case OBJECT_SCHEMA: {
item = PolicyLabelItem(address.objectId, 0, O_SCHEMA, "");
}
default:
break;
}
if (relation != NULL) {
relation_close(relation, NoLock);
}
}
int get_objtype(int object_type)
{
int objtype = O_UNKNOWN;
switch (object_type) {
case OBJECT_ROLE:
objtype = O_ROLE;
break;
case OBJECT_USER:
objtype = O_USER;
break;
case OBJECT_SCHEMA:
objtype = O_SCHEMA;
break;
case OBJECT_SEQUENCE:
objtype = O_SEQUENCE;
break;
case OBJECT_DATABASE:
objtype = O_DATABASE;
break;
case OBJECT_FOREIGN_SERVER:
objtype = O_SERVER;
break;
case OBJECT_FOREIGN_TABLE:
case OBJECT_STREAM:
case OBJECT_TABLE:
objtype = (object_type == OBJECT_TABLE) ? O_TABLE : O_FOREIGNTABLE;
break;
case OBJECT_COLUMN:
objtype = O_COLUMN;
break;
case OBJECT_FUNCTION:
objtype = O_FUNCTION;
break;
case OBJECT_CONTQUERY:
case OBJECT_VIEW:
objtype = O_VIEW;
break;
case OBJECT_INDEX:
objtype = O_INDEX;
break;
case OBJECT_TABLESPACE:
objtype = O_TABLESPACE;
break;
default:
break;
}
return objtype;
}
CmdType get_rte_commandtype(RangeTblEntry *rte)
{
if (rte->selectedCols) {
return CMD_SELECT;
} else if (rte->insertedCols) {
return CMD_INSERT;
} else if (rte->updatedCols) {
return CMD_UPDATE;
} else {
return CMD_UNKNOWN;
}
}

View File

@ -66,7 +66,7 @@ enum PrivType {
T_LOGIN_SUCCESS,
T_LOGIN_FAILURE,
T_COPY,
T_CURSOR,
T_OPEN,
T_FETCH,
T_CLOSE,
T_ALL
@ -266,16 +266,8 @@ bool get_function_name(long long funcid, PolicyLabelItem *name);
int get_privilege_type(const char *name);
int get_privilege_object_type(const char *name);
const char *get_privilege_object_name(int type);
void load_function_label(const Query *query, bool audit_exist);
bool name_list_to_string(List *names, gs_stl::gs_string *name, int max_const_count = -1 /* unlimited */);
bool name_list_to_label(PolicyLabelItem *item, List *names, char *name = NULL, size_t name_size = 0);
/* build PolicyLabelItem helper function*/
void gen_policy_labelitem(PolicyLabelItem &item, const ListCell *rel, int objtype);
void gen_policy_label_for_commentstmt(PolicyLabelItem &item, const CommentStmt *commentstmt);
int get_objtype(int object_type);
CmdType get_rte_commandtype(RangeTblEntry *rte);
const char *get_cursorinfo(CmdType type);
#endif /* GS_POLICY_OBJECT_TYPES_H_ */

View File

@ -97,7 +97,6 @@ PG_MODULE_MAGIC;
extern "C" void _PG_init(void);
extern "C" void _PG_fini(void);
extern "C" void set_gsaudit_prehook(ProcessUtility_hook_type func);
#define POLICY_STR_BUFF_LEN 512
#define POLICY_TMP_BUFF_LEN 256
@ -138,7 +137,10 @@ static THR_LOCAL char original_query[256];
static THR_LOCAL MngEventsVector *mng_events = NULL;
using StrMap = gs_stl::gs_map<gs_stl::gs_string, masking_result>;
static THR_LOCAL StrMap* masked_prepared_stmts = NULL;
static THR_LOCAL StrMap* masked_cursor_stmts = NULL;
static void process_masking(ParseState *pstate, Query *query, const policy_set *policy_ids, bool audit_exist);
static void gsaudit_next_PostParseAnalyze_hook(ParseState *pstate, Query *query);
static void destroy_local_parameter();
static void destory_thread_variables()
@ -180,22 +182,13 @@ static void set_view_query_state(bool state)
query_inside_view = state;
}
/*
* parse remote host ip to IPV6 struct including local/ipv4/ipv6
*/
void get_remote_addr(IPV6 *ip)
{
char ip_str[MAX_IP_LEN] = { 0 };
get_session_ip(ip_str, MAX_IP_LEN);
// format local unix
errno_t rc = EOK;
char *local = "127.0.0.1";
if (!strcmp("local", ip_str)) {
rc = memcpy_s(ip_str, MAX_IP_LEN, local, strlen(local));
securec_check_c(rc, "\0", "\0");
}
struct sockaddr* remote_addr = (struct sockaddr *)&u_sess->proc_cxt.MyProcPort->raddr.addr;
const int MAX_IP_ADDRESS_LEN = 129;
char ip_str[MAX_IP_ADDRESS_LEN] = { 0 };
/* parse the remote ip address */
get_client_ip(remote_addr, ip_str);
IPRange iprange;
iprange.str_to_ip(ip_str, ip);
return;
@ -283,12 +276,12 @@ static void destroy_local_parameter()
mng_events = NULL;
}
free_masked_cursor_stmts();
if (masked_cursor_stmts != NULL) {
delete masked_cursor_stmts;
masked_cursor_stmts = NULL;
}
}
/*
* append object name, the format is: schema.table
*/
void get_name_range_var(const RangeVar *rangevar, gs_stl::gs_string *buffer, bool enforce)
{
if (rangevar == NULL) {
@ -509,6 +502,77 @@ bool verify_copy_command_is_reparsed(List* parsetree_list, const char* query_str
return false;
}
static void free_masked_prepared_stmts()
{
if (masked_prepared_stmts) {
delete masked_prepared_stmts;
masked_prepared_stmts = NULL;
}
}
template< class T>
static inline void flush_stmt_masking_result(const char* name, T* stmts)
{
if (stmts) {
StrMap::const_iterator it = stmts->find(name);
if (it != stmts->end()) {
flush_masking_result(it->second);
}
}
}
static void flush_cursor_stmt_masking_result(const char* name)
{
flush_stmt_masking_result(name, masked_cursor_stmts);
}
static void flush_prepare_stmt_masking_result(const char* name)
{
flush_stmt_masking_result(name, masked_prepared_stmts);
}
static void close_cursor_stmt_as_masked(const char* name)
{
if (masked_cursor_stmts == NULL) {
return;
}
masked_cursor_stmts->erase(name);
if (masked_cursor_stmts->empty() || (strcasecmp(name, "all") == 0)) {
delete masked_cursor_stmts;
masked_cursor_stmts = NULL;
}
}
static void unprepare_stmt_as_masked(const char* name)
{
unprepare_stmt(name);
if (!masked_prepared_stmts) {
return;
}
masked_prepared_stmts->erase(name);
if (masked_prepared_stmts->empty() || !strcasecmp(name, "all")) {
delete masked_prepared_stmts;
masked_prepared_stmts = NULL;
}
}
static inline void set_prepare_stmt_as_masked(const char* name, const masking_result *result)
{
if (!masked_prepared_stmts) {
masked_prepared_stmts = new StrMap;
}
(*masked_prepared_stmts)[name] = (*result);
}
static inline void set_cursor_stmt_as_masked(const char* name, const masking_result *result)
{
if (!masked_cursor_stmts) {
masked_cursor_stmts = new StrMap;
}
(*masked_cursor_stmts)[name] = (*result);
}
void set_result_set_function(const PolicyLabelItem &func)
{
if (result_set_functions == NULL) {
@ -519,6 +583,146 @@ void set_result_set_function(const PolicyLabelItem &func)
}
}
/*
* Do masking for given target list
* this function will parse each RTE of the list
* and then will check wether each node need to do mask.
*/
static bool handle_masking(List* targetList, ParseState *pstate,
const policy_set *policy_ids, List* rtable, Node* utilityNode)
{
if (targetList == NIL || policy_ids->empty()) {
return false;
}
ListCell* temp = NULL;
masking_result masking_result;
foreach(temp, targetList) {
TargetEntry *old_tle = (TargetEntry *) lfirst(temp);
/* Shuffle masking columns can only select directly with out other operations */
parser_target_entry(pstate, old_tle, policy_ids, &masking_result, rtable, true);
}
if (masking_result.size() > 0) {
if (strlen(t_thrd.security_policy_cxt.prepare_stmt_name) > 0) {
/* prepare statement was masked */
set_prepare_stmt_as_masked(t_thrd.security_policy_cxt.prepare_stmt_name,
&masking_result); /* save masking event for executing case */
} else if (utilityNode != NULL) {
switch (nodeTag(utilityNode)) {
case T_DeclareCursorStmt:
{
DeclareCursorStmt* stmt = (DeclareCursorStmt *)utilityNode;
/* save masking event for fetching case */
set_cursor_stmt_as_masked(stmt->portalname, &masking_result);
}
break;
default:
flush_masking_result(&masking_result); /* invoke masking event */
}
} else {
flush_masking_result(&masking_result); /* invoke masking event */
}
return true;
}
return false;
}
static void select_PostParseAnalyze(ParseState *pstate, Query *&query, const policy_set *policy_ids, bool audit_exist)
{
if (query == NULL) {
return;
}
List *targetList = NIL;
if (query->targetList != NIL) {
targetList = query->targetList;
} else {
targetList = pstate->p_target_list;
}
handle_masking(targetList, pstate, policy_ids, query->rtable, query->utilityStmt);
/* deal with function type label */
if (audit_exist && query->rtable != NIL) {
ListCell *lc = NULL;
foreach(lc, query->rtable) {
RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc);
if (rte && rte->rtekind == RTE_FUNCTION && rte->funcexpr) {
FuncExpr* fe = (FuncExpr *)rte->funcexpr;
PolicyLabelItem func_label;
get_function_name(fe->funcid, &func_label);
set_result_set_function(func_label);
}
}
}
}
static bool process_union_masking(Node *union_node,
ParseState *pstate, const Query *query, const policy_set *policy_ids, bool audit_exist)
{
if (union_node == NULL) {
return false;
}
switch (nodeTag(union_node)) {
/* For each union, we get its query recursively for masking until it doesn't have any union query */
case T_SetOperationStmt:
{
SetOperationStmt *stmt = (SetOperationStmt *)union_node;
if (stmt->op != SETOP_UNION) {
return false;
}
process_union_masking((Node *)(stmt->larg), pstate, query, policy_ids, audit_exist);
process_union_masking((Node *)(stmt->rarg), pstate, query, policy_ids, audit_exist);
}
break;
case T_RangeTblRef:
{
RangeTblRef *ref = (RangeTblRef *)union_node;
if (ref->rtindex <= 0 || ref->rtindex > list_length(query->rtable)) {
return false;
}
Query* mostQuery = rt_fetch(ref->rtindex, query->rtable)->subquery;
process_masking(pstate, mostQuery, policy_ids, audit_exist);
}
break;
default:
break;
}
return true;
}
/*
* Main entrance for masking
* Identify components in query tree that need to do masking.
* This function will find all parts which need masking of select query,
* mainly includes CTE / setOperation / normal select columns.
*/
static void process_masking(ParseState *pstate, Query *query, const policy_set *policy_ids, bool audit_exist)
{
if (query == NULL) {
return;
}
/* set-operation tree UNION query */
if (!process_union_masking(query->setOperations, pstate, query, policy_ids, audit_exist)) {
ListCell *lc = NULL;
/* For each Cte, we get its query recursively for masking, and then handle this query in normal way */
if (query->cteList != NIL) {
foreach(lc, query->cteList) {
CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc);
Query *cte_query = (Query *)cte->ctequery;
process_masking(pstate, cte_query, policy_ids, audit_exist);
}
}
/* find subquery and process each subquery node */
if (query->rtable != NULL) {
foreach(lc, query->rtable) {
RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc);
Query *subquery = (Query *)rte->subquery;
process_masking(pstate, subquery, policy_ids, audit_exist);
}
}
select_PostParseAnalyze(pstate, query, policy_ids, audit_exist);
}
}
/*
* check exchange partition list contains masked table.
* For given AlterTableCmd list, check whether ordinary
@ -640,9 +844,7 @@ static void gsaudit_next_PostParseAnalyze_hook(ParseState *pstate, Query *query)
foreach (lc, query->rtable) {
RangeTblEntry *rte = (RangeTblEntry *)lfirst(lc);
if (rte->rtekind == RTE_REMOTE_DUMMY) {
continue;
} else if (rte->rtekind == RTE_SUBQUERY && rte->subquery != NULL) { /* check masking */
if (rte->rtekind == RTE_SUBQUERY && rte->subquery != NULL) { /* check masking */
reset_node_location();
handle_masking(rte->subquery->targetList, pstate,
&masking_policy_ids, rte->subquery->rtable, rte->subquery->utilityStmt);
@ -761,6 +963,44 @@ static void verify_drop_user(const char *rolename)
}
}
static void verify_drop_column(AlterTableStmt *stmt)
{
ListCell *lcmd = NULL;
foreach (lcmd, stmt->cmds) {
AlterTableCmd *cmd = (AlterTableCmd *)lfirst(lcmd);
switch (cmd->subtype) {
case AT_DropColumn: {
/* check by column */
PolicyLabelItem find_obj(stmt->relation->schemaname, stmt->relation->relname, cmd->name, O_COLUMN);
if (check_label_has_object(&find_obj, is_masking_has_object)) {
char buff[512] = {0};
int rc = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
"Column: %s is part of some resource label, can not be renamed.", find_obj.m_column);
securec_check_ss(rc, "\0", "\0");
gs_audit_issue_syslog_message("PGAUDIT", buff, AUDIT_POLICY_EVENT, AUDIT_FAILED);
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\"", buff)));
}
break;
}
case AT_AlterColumnType: {
PolicyLabelItem find_obj(stmt->relation->schemaname, stmt->relation->relname, cmd->name, O_COLUMN);
if (check_label_has_object(&find_obj, is_masking_has_object, true))
{
char buff[512] = {0};
int ret = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
"Column: %s is part of some masking policy, can not be changed.", find_obj.m_column);
securec_check_ss(ret, "\0", "\0");
gs_audit_issue_syslog_message("PGAUDIT", buff, AUDIT_POLICY_EVENT, AUDIT_FAILED);
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\"", buff)));
}
break;
}
default:
break;
}
}
}
/*
* Hook ProcessUtility to do session auditing for DDL and utility commands.
*/
@ -787,7 +1027,7 @@ static inline void get_copy_table_name(CopyStmt *stmt, gs_stl::gs_string *name)
}
}
bool is_audit_policy_exist_load_policy_info()
static bool is_audit_policy_exist_load_policy_info()
{
load_database_policy_info();
gs_policy_set *policies = get_audit_policies();
@ -803,12 +1043,24 @@ static void light_unified_audit_executor(const Query *query)
return;
}
ereport(DEBUG1, (errmsg("light_unified_audit_executor routine enter")));
IPV6 ip;
get_remote_addr(&ip);
FilterData filter_item(u_sess->attr.attr_common.application_name, ip);
policy_set audit_policy_ids;
check_audit_policy_filter(&filter_item, &audit_policy_ids);
if (!query->rtable) {
return;
ListCell *lc = NULL;
foreach (lc, query->rtable) {
RangeTblEntry *rte = (RangeTblEntry*)lfirst(lc);
char *object_name = rte->relname ? rte->relname : rte->eref->aliasname;
if (object_name == NULL) {
break;
}
check_access_table(&audit_policy_ids, object_name, query->commandType, O_UNKNOWN, object_name);
}
access_audit_policy_run(query->rtable, query->commandType);
flush_access_logs(AUDIT_OK);
}
static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString, ParamListInfoData *params,
@ -840,13 +1092,13 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
if (parsetree != NULL) {
switch (nodeTag(parsetree)) {
case T_PlannedStmt: {
if (!check_audited_privilige(T_CURSOR) && !SECURITY_CHECK_ACL_PRIV(T_CURSOR)) {
if (!check_audited_privilige(T_OPEN) && !SECURITY_CHECK_ACL_PRIV(T_OPEN)) {
break;
}
char buff[POLICY_STR_BUFF_LEN] = {0};
PlannedStmt *stmt = (PlannedStmt *)parsetree;
get_open_cursor_info(stmt, buff, sizeof(buff));
internal_audit_str(&security_policy_ids, &audit_policy_ids, buff, T_CURSOR, "OPEN", O_CURSOR);
internal_audit_str(&security_policy_ids, &audit_policy_ids, buff, T_OPEN, "OPEN", O_CURSOR);
break;
}
case T_FetchStmt: {
@ -860,12 +1112,12 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
gs_stl::gs_vector<PolicyLabelItem> cursor_objects;
if (portal && portal->queryDesc && portal->queryDesc->plannedstmt &&
portal->queryDesc->plannedstmt->rtable) {
get_cursor_tables(portal->queryDesc->plannedstmt->rtable, buff, sizeof(buff), printed_size,
&cursor_objects);
get_cursor_tables(portal->queryDesc->plannedstmt->rtable, buff, sizeof(buff),
printed_size, &cursor_objects);
}
for (const PolicyLabelItem item : cursor_objects) {
internal_audit_object_str(&security_policy_ids, &audit_policy_ids, &item, T_FETCH, "FETCH",
stmt->portalname);
internal_audit_object_str(&security_policy_ids, &audit_policy_ids, &item, T_FETCH,
"FETCH", stmt->portalname);
}
flush_cursor_stmt_masking_result(stmt->portalname); /* invoke masking event in this case */
}
@ -949,8 +1201,14 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
case T_DeallocateStmt: {
DeallocateStmt *stmt = (DeallocateStmt *)parsetree;
char tmp[POLICY_TMP_BUFF_LEN] = {0};
int rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "%s", stmt->name == NULL ? "ALL" : stmt->name);
securec_check_ss(rc, "\0", "\0");
int rc;
if (stmt->name == NULL) {
rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "ALL");
securec_check_ss(rc, "\0", "\0");
} else {
rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "%s", stmt->name);
securec_check_ss(rc, "\0", "\0");
}
check_access_table(&audit_policy_ids, tmp, CMD_DEALLOCATE, O_UNKNOWN, tmp);
unprepare_stmt_as_masked(tmp);
break;
@ -1074,15 +1332,14 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
forboth(lc1, stmt->grantees, lc2, stmt->objects)
{
PrivGrantee *rte1 = (PrivGrantee *)lfirst(lc1);
ListCell *rel2 = (ListCell *)lfirst(lc2);
gs_stl::gs_string tmp;
const char *granted_name = ACL_get_object_name(stmt->targtype, stmt->objtype, lc2, &tmp);
if (granted_name != NULL) {
acl_audit_object(&security_policy_ids, &audit_policy_ids, rel2,
acl_audit_object(&security_policy_ids, &audit_policy_ids,
names_pair(granted_name,
rte1->rolname ? rte1->rolname : "ALL" /* grantee_name */),
stmt->is_grant ? T_GRANT : T_REVOKE, stmt->is_grant ? "GRANT" : "REVOKE",
stmt->objtype, stmt->targtype);
stmt->objtype);
}
}
}
@ -1102,32 +1359,10 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
PrivGrantee *rte1 = (PrivGrantee *)lfirst(lc1);
PrivGrantee *rte2 = (PrivGrantee *)lfirst(lc2);
internal_audit_object_str(&security_policy_ids, &audit_policy_ids, NULL,
internal_audit_object_str(&security_policy_ids, &audit_policy_ids,
names_pair(rte2->rolname /* granted_name */, rte1->rolname /* grantee_name */),
grantrolestmt->is_grant ? T_GRANT : T_REVOKE, grantrolestmt->is_grant ? "GRANT" : "REVOKE",
O_ROLE, ACL_TARGET_OBJECT, true, true);
}
}
break;
}
case T_GrantDbStmt: {
if (!check_audited_privilige(T_GRANT) && !check_audited_privilige(T_REVOKE) &&
!SECURITY_CHECK_ACL_PRIV(T_GRANT) && !SECURITY_CHECK_ACL_PRIV(T_REVOKE)) {
break;
}
GrantDbStmt *grantdbstmt = (GrantDbStmt *)(parsetree);
ListCell *lc1 = NULL;
ListCell *lc2 = NULL;
if (grantdbstmt && grantdbstmt->grantees && grantdbstmt->privileges) {
forboth(lc1, grantdbstmt->grantees, lc2, grantdbstmt->privileges)
{
PrivGrantee *rte1 = (PrivGrantee *)lfirst(lc1);
DbPriv *rte2 = (DbPriv*)lfirst(lc2);
internal_audit_object_str(&security_policy_ids, &audit_policy_ids, NULL,
names_pair(rte2->db_priv_name, rte1->rolname /* grantee_name */),
grantdbstmt->is_grant ? T_GRANT : T_REVOKE, grantdbstmt->is_grant ? "GRANT" : "REVOKE",
O_UNKNOWN, ACL_TARGET_OBJECT, true, false);
O_ROLE, true);
}
}
break;
@ -1139,8 +1374,7 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
VacuumStmt *stmt = (VacuumStmt *)parsetree;
if (stmt) {
if (stmt->relation) {
PolicyLabelItem item;
gen_policy_labelitem(item, (const ListCell *)stmt->relation, O_TABLE);
PolicyLabelItem item(stmt->relation->schemaname, stmt->relation->relname);
if (stmt->va_cols) {
ListCell *citem = NULL;
foreach (citem, stmt->va_cols) {
@ -1168,18 +1402,14 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
break;
}
case T_CommentStmt: {
if (!check_audited_privilige(T_COMMENT)) {
if (!check_audited_privilige(T_COMMENT) && !SECURITY_CHECK_ACL_PRIV(T_COMMENT)) {
break;
}
CommentStmt *commentstmt = (CommentStmt *)(parsetree);
PolicyLabelItem item(0, 0, get_objtype(commentstmt->objtype), "");
gen_policy_label_for_commentstmt(item, commentstmt);
gs_stl::gs_string objectname;
add_current_path(commentstmt->objtype, commentstmt->objname, &objectname);
internal_audit_object_str(&security_policy_ids, &audit_policy_ids, &item, T_COMMENT, "COMMENT",
objectname.c_str());
audit_object(&security_policy_ids, &audit_policy_ids, objectname.c_str(), T_COMMENT,
"COMMENT", commentstmt->objtype);
break;
}
case T_VariableSetStmt: {
@ -1331,32 +1561,14 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
break;
}
IndexStmt *stmt = (IndexStmt *)parsetree;
if (stmt && stmt->relation && stmt->idxname) {
if (stmt && stmt->relation) {
gs_stl::gs_string objectname;
get_name_range_var(stmt->relation, &objectname);
if (!objectname.empty()) {
objectname.push_back('.');
}
objectname.append(stmt->idxname);
internal_audit_str(&security_policy_ids, &audit_policy_ids, objectname.c_str(), T_CREATE,
"CREATE", O_INDEX);
}
break;
}
case T_CreateDataSourceStmt:
{
if (!check_audited_privilige(T_CREATE) && !SECURITY_CHECK_ACL_PRIV(T_CREATE)) {
break;
}
CreateDataSourceStmt *stmt = (CreateDataSourceStmt *)parsetree;
gs_stl::gs_string objectname;
if (stmt && stmt->srcname) {
objectname.append(stmt->srcname);
}
internal_audit_str(&security_policy_ids, &audit_policy_ids, objectname.c_str(), T_CREATE,
"CREATE", O_DATA_SOURCE);
break;
}
case T_ViewStmt: /* create View */
{
if (!check_audited_privilige(T_CREATE) && !SECURITY_CHECK_ACL_PRIV(T_CREATE)) {
@ -1476,10 +1688,6 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
break;
}
case T_TruncateStmt: {
/*
* truncate is dml sql but go through the processutility routine
* so that use access function to deal with it in privilege hook entrance
*/
if (!check_audited_access(CMD_TRUNCATE)) {
break;
}
@ -1497,9 +1705,11 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
break;
}
CreateTableAsStmt *createtablestmt = (CreateTableAsStmt *)(parsetree);
if (createtablestmt != NULL && createtablestmt->into != NULL) {
audit_table(&security_policy_ids, &audit_policy_ids, createtablestmt->into->rel, T_CREATE, "CREATE",
O_TABLE);
if (createtablestmt != NULL) {
IntoClause *intoclause = createtablestmt->into;
if (intoclause != NULL)
audit_table(&security_policy_ids, &audit_policy_ids, intoclause->rel, T_CREATE,
"CREATE", O_TABLE);
}
break;
}
@ -1690,12 +1900,24 @@ static const char *ACL_get_object_name(int targetype, int objtype, ListCell *obj
return NULL;
}
CmdType get_rte_commandtype(RangeTblEntry *rte)
{
if (rte->selectedCols) {
return CMD_SELECT;
} else if (rte->insertedCols) {
return CMD_INSERT;
} else if (rte->updatedCols) {
return CMD_UPDATE;
} else {
return CMD_UNKNOWN;
}
}
static void gs_audit_executor_start_hook(QueryDesc *queryDesc, int eflags)
{
/* verify parameter and audit policy */
if (!u_sess->attr.attr_security.Enable_Security_Policy ||
u_sess->proc_cxt.IsInnerMaintenanceTools || IsConnFromCoord() ||
!is_audit_policy_exist_load_policy_info() || queryDesc == NULL) {
!is_audit_policy_exist_load_policy_info()) {
if (next_ExecutorStart_hook) {
next_ExecutorStart_hook(queryDesc, eflags);
} else {
@ -1704,13 +1926,45 @@ static void gs_audit_executor_start_hook(QueryDesc *queryDesc, int eflags)
return;
}
/* execute audit policy by target application info/object/operation */
const PlannedStmt *plannedstmt = queryDesc->plannedstmt;
if (plannedstmt != NULL) {
access_audit_policy_run(plannedstmt->rtable, plannedstmt->commandType);
}
if (queryDesc != NULL) {
IPV6 ip;
get_remote_addr(&ip);
FilterData filter_item(get_session_app_name(), ip);
policy_set policy_ids;
check_audit_policy_filter(&filter_item, &policy_ids);
policy_set security_policy_ids;
if (checkSecurityPolicyFilter_hook != NULL) {
checkSecurityPolicyFilter_hook(filter_item, &security_policy_ids);
}
/* flush the audit logs with result flag */
if (queryDesc->plannedstmt && queryDesc->plannedstmt->rtable) {
ListCell *lc = NULL;
_checked_tables checked_tables;
foreach (lc, queryDesc->plannedstmt->rtable) {
/* table object */
RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc);
policy_result pol_result;
if (rte && rte->relname) {
if (rte->rtekind == RTE_SUBQUERY && rte->subquery) { /* relation is subquery */
int recursion_deep = 0;
handle_subquery(rte, rte->subquery->commandType, &pol_result, &checked_tables,
&policy_ids, &security_policy_ids, &recursion_deep);
/* verify if table object already checked */
} else if (checked_tables.insert(rte->relname).second) {
CmdType cmd_type = get_rte_commandtype(rte);
cmd_type = (cmd_type == CMD_UNKNOWN) ? queryDesc->plannedstmt->commandType : cmd_type;
if (!handle_table_entry(rte, cmd_type, &policy_ids,
&security_policy_ids, &pol_result)) {
continue;
}
flush_policy_result(&pol_result, cmd_type);
}
}
}
}
}
PG_TRY();
{
if (next_ExecutorStart_hook) {
@ -1782,7 +2036,7 @@ void install_audit_hook()
* preserve the chains.
*/
next_ExecutorStart_hook = ExecutorStart_hook;
set_gsaudit_prehook(ProcessUtility_hook);
next_ProcessUtility_hook = ProcessUtility_hook;
/*
* Install audit hooks, the interface for GaussDB kernel user as below
@ -1790,15 +2044,11 @@ void install_audit_hook()
* ExecutorStart_hook: hook when ExecutorStart is called, which will run the audit process for DML subtables
* ProcessUtility_hook: hook when when ProcessUtility is called, which will run the DDL auti process
* light_unified_audit_executor_hook : hook when cn light proxy
* opfusion_unified_audit_executor_hook: hook for sqlbypass
* opfusion_unified_audit_flush_logs_hook: hook for sqlbypass
*/
user_login_hook = NULL;
ExecutorStart_hook = gs_audit_executor_start_hook;
ProcessUtility_hook = gsaudit_ProcessUtility_hook;
light_unified_audit_executor_hook = light_unified_audit_executor;
opfusion_unified_audit_executor_hook = opfusion_unified_audit_executor;
opfusion_unified_audit_flush_logs_hook = flush_access_logs;
}
void install_masking_hook()
@ -1822,15 +2072,6 @@ void install_label_hook()
}
}
/*
* This function is used for setting prev_ProcessUtility to rewrite
* standard_ProcessUtility by other extension.
*/
void set_gsaudit_prehook(ProcessUtility_hook_type func)
{
next_ProcessUtility_hook = func;
}
/*
* Define GUC variables and install hooks upon module load.
* NOTE: _PG_init will be invoked(installed) many times
@ -1863,9 +2104,15 @@ void _PG_init(void)
/*
* Uninstall hooks and release local memory context
* NOTE: Now the uninstall hooks process is disabled referring funciton internal_unload_library
* we just put the release function here to adapt the uninstall process in the feature.
* we just put the release function pointers here to adapt the uninstall process in the feature.
*/
void _PG_fini(void)
{
user_login_hook = NULL;
ExecutorStart_hook = next_ExecutorStart_hook;
ProcessUtility_hook = next_ProcessUtility_hook;
post_parse_analyze_hook = next_post_parse_analyze_hook;
copy_need_to_be_reparse = NULL;
light_unified_audit_executor_hook = NULL;
ereport(LOG, (errmsg("Gsaudit extension finished")));
}

View File

@ -46,9 +46,9 @@ void get_remote_addr(IPV6 *ip);
const char* get_session_app_name();
const char* GetUserName(char* user_name, size_t user_name_size);
bool get_ipaddress(gs_stl::gs_string& ipaddress);
extern void set_result_set_function(const PolicyLabelItem &func);
void set_result_set_function(const PolicyLabelItem &func);
void get_name_range_var(const RangeVar *rangevar, gs_stl::gs_string *buffer, bool enforce = true);
CmdType get_rte_commandtype(RangeTblEntry *rte);
extern void load_database_policy_info();
bool is_audit_policy_exist_load_policy_info();
#endif /* GS_POLICY_PLUGIN_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,39 @@
/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* -------------------------------------------------------------------------
*
* masking.h
*
* IDENTIFICATION
* contrib/security_plugin/masking.h
*
* -------------------------------------------------------------------------
*/
#ifndef MASKING_H_
#define MASKING_H_
#include <string>
#include "parser/parse_node.h"
#include "nodes/primnodes.h"
#include "gs_mask_policy.h"
bool parser_target_entry(ParseState *pstate, TargetEntry*& old_tle, const policy_set *policy_ids,
masking_result *result, List* rtable, bool can_mask = true);
void reset_node_location();
/* col_type for integer should be int8, int4, int2, int1 */
Node* create_integer_node(ParseState *pstate, int value, int location, int col_type = INT4OID, bool make_cast = true);
void free_masked_cursor_stmts();
void free_masked_prepared_stmts();
void close_cursor_stmt_as_masked(const char* name);
void unprepare_stmt_as_masked(const char* name);
void set_prepare_stmt_as_masked(const char* name, const masking_result *result);
void set_cursor_stmt_as_masked(const char* name, const masking_result *result);
void flush_cursor_stmt_masking_result(const char* name);
void flush_prepare_stmt_masking_result(const char* name);
bool process_union_masking(Node *union_node,
ParseState *pstate, const Query *query, const policy_set *policy_ids, bool audit_exist);
void process_masking(ParseState *pstate, Query *query, const policy_set *policy_ids, bool audit_exist);
void select_PostParseAnalyze(ParseState *pstate, Query *&query, const policy_set *policy_ids, bool audit_exist);
bool handle_masking(List* targetList, ParseState *pstate,
const policy_set *policy_ids, List* rtable, Node* utilityNode);
#endif /* MASKING_H_ */
/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* -------------------------------------------------------------------------
*
* masking.h
*
* IDENTIFICATION
* contrib/security_plugin/masking.h
*
* -------------------------------------------------------------------------
*/
#ifndef MASKING_H_
#define MASKING_H_
#include <string>
#include "parser/parse_node.h"
#include "nodes/primnodes.h"
#include "gs_mask_policy.h"
bool parser_target_entry(ParseState *pstate, TargetEntry*& old_tle, const policy_set *policy_ids,
masking_result *result, List* rtable, bool can_mask = true);
void reset_node_location();
/* col_type for integer should be int8, int4, int2, int1 */
Node* create_integer_node(ParseState *pstate, int value, int location, int col_type = INT4OID, bool make_cast = true);
#endif /* MASKING_H_ */

View File

@ -25,7 +25,6 @@
#include "gs_audit_policy.h"
#include <memory>
#include "access_audit.h"
#include "parser/parse_func.h"
#include "postgres.h"
#include "catalog/namespace.h"
#include "commands/dbcommands.h"
@ -49,63 +48,24 @@
#define ACCESS_CONTROL_CHECK_ACL_PRIVILIGE(type) \
((check_acl_privilige_hook == NULL) ? true : check_acl_privilige_hook(type))
typedef struct AclObjectType {
GrantObjectType grant_type;
PrivObject privi_type;
} AclObjectType;
static AclObjectType aclobject_infos[] = {
{ACL_OBJECT_COLUMN, O_COLUMN},
{ACL_OBJECT_RELATION, O_TABLE},
{ACL_OBJECT_SEQUENCE, O_SEQUENCE},
{ACL_OBJECT_DATABASE, O_DATABASE},
{ACL_OBJECT_DOMAIN, O_DOMAIN},
{ACL_OBJECT_FOREIGN_SERVER, O_SERVER},
{ACL_OBJECT_FUNCTION, O_FUNCTION},
{ACL_OBJECT_LANGUAGE, O_LANGUAGE},
{ACL_OBJECT_NAMESPACE, O_SCHEMA},
{ACL_OBJECT_TABLESPACE, O_TABLESPACE},
{ACL_OBJECT_DATA_SOURCE, O_DATA_SOURCE},
};
static Security_LoginHandle_access_hook_type security_LoginHandle_access_hook = NULL;
void add_current_path(int objtype, List *fqdn, gs_stl::gs_string *buffer);
/*
* grant/revoke sql audit routine
* policy_ids: policy ids after filt by app
* rel: ListCell object
* priv_type: privilege type, grant or revoke
* priv_name: grant or revoke
* objtype: object type, table...
* ignore_db: whether ignore database
*/
void internal_audit_object_str(const policy_set *security_policy_ids, const policy_set *policy_ids, const ListCell *rel,
const names_pair names, int priv_type, const char *priv_name, int objtype,
int target_type, bool is_rolegrant, bool ignore_db)
/* function overloading, notice - different implementation */
void internal_audit_object_str(const policy_set *security_policy_ids, const policy_set *policy_ids,
const names_pair names, int priv_type, const char *priv_name, int objtype, bool ignore_db)
{
/*
* Note PolicyLabelItem just support table/function/view/column
* so that only "all" label will work for other object type
*/
PolicyLabelItem item;
if (target_type == ACL_TARGET_OBJECT) {
gen_policy_labelitem(item, rel, objtype);
}
/* PolicyLabelItem construction will append schema oid by relid */
policy_simple_set policy_result;
PolicyLabelItem item(0, 0, objtype);
bool security_auditobject_res = (accesscontrol_securityAuditObject_hook != NULL) ?
accesscontrol_securityAuditObject_hook(security_policy_ids, &item, priv_type, priv_name) :
true;
if (security_auditobject_res && check_audit_policy_privileges(policy_ids, &policy_result, priv_type, &item)) {
if (security_auditobject_res && check_audit_policy_privileges(policy_ids, &policy_result, priv_type,&item)) {
char buff[2048] = {0};
char user_name[USERNAME_LEN];
const char *direction = (priv_type == T_GRANT) ? "TO" : "FROM";
const char *dbname = get_database_name(u_sess->proc_cxt.MyDatabaseId);
gs_stl::gs_string obj_value;
item.get_fqdn_value(&obj_value);
policy_simple_set::iterator it = policy_result.begin();
policy_simple_set::iterator eit = policy_result.end();
int rc;
@ -118,9 +78,8 @@ void internal_audit_object_str(const policy_set *security_policy_ids, const poli
"%s], "
"policy id: [%lld]",
GetUserName(user_name, sizeof(user_name)), get_session_app_name(), session_ip, priv_name,
get_privilege_object_name(objtype),
(is_rolegrant || obj_value == "") ? names.first.c_str() : obj_value.c_str(), direction,
names.second.c_str(), *it);
get_privilege_object_name(item.m_obj_type), names.first.c_str(), direction, names.second.c_str(),
*it);
securec_check_ss(rc, "\0", "\0");
} else {
rc = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
@ -128,8 +87,7 @@ void internal_audit_object_str(const policy_set *security_policy_ids, const poli
"%s], "
"policy id: [%lld]",
GetUserName(user_name, sizeof(user_name)), get_session_app_name(), session_ip, priv_name,
get_privilege_object_name(objtype), dbname,
(is_rolegrant || obj_value == "") ? names.first.c_str() : obj_value.c_str(), direction,
get_privilege_object_name(item.m_obj_type), dbname, names.first.c_str(), direction,
names.second.c_str(), *it);
securec_check_ss(rc, "\0", "\0");
}
@ -139,6 +97,58 @@ void internal_audit_object_str(const policy_set *security_policy_ids, const poli
}
}
void login_object_audit(const policy_set security_policy_ids, const policy_set policy_ids,
const char *login_str, int priv_type, const char *priv_name, const char *dbname)
{
policy_simple_set policy_result;
PolicyLabelItem item(0, 0, T_LOGIN);
if (check_audit_policy_privileges(&policy_ids, &policy_result, priv_type, &item, dbname)) {
char buff[2048] = {0};
policy_simple_set::iterator it = policy_result.begin();
policy_simple_set::iterator eit = policy_result.end();
for (; it != eit; ++it) {
char session_ip[MAX_IP_LEN] = {0};
get_session_ip(session_ip, MAX_IP_LEN);
int rc = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
"AUDIT EVENT: app_name: [%s], client_ip: [%s], privilege type: [%s], policy id: [%lld]",
get_session_app_name(), session_ip, login_str, *it);
securec_check_ss(rc, "\0", "\0");
save_access_logs(AUDIT_POLICY_EVENT, buff);
}
}
return;
}
void login_handle_audit(const char *dbname, const char *username, bool success, bool login)
{
IPV6 ip;
get_remote_addr(&ip);
FilterData filter_item(u_sess->attr.attr_common.application_name, ip);
policy_set audit_policy_ids, security_policy_ids;
check_audit_policy_filter(&filter_item, &audit_policy_ids, dbname);
char tmp[512] = {0};
int rc;
if (login && success) {
rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "LOGIN SUCCESS: [%s] to DATABASE: [%s]", username, dbname);
securec_check_ss(rc, "\0", "\0");
login_object_audit(security_policy_ids, audit_policy_ids, tmp, T_LOGIN_SUCCESS, "LOGIN SUCCESS", dbname);
} else if (login && !success) {
rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "LOGIN FAILED: [%s] to DATABASE: [%s]", username, dbname);
securec_check_ss(rc, "\0", "\0");
login_object_audit(security_policy_ids, audit_policy_ids, tmp, T_LOGIN_FAILURE, "LOGIN FAILED", dbname);
} else if (!login && success) {
rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "LOGOUT: [%s] to DATABASE: [%s]", username, dbname);
securec_check_ss(rc, "\0", "\0");
login_object_audit(security_policy_ids, audit_policy_ids, tmp, T_LOGOUT, "LOGOUT", dbname);
} else { /* !login && !success */
rc = snprintf_s(tmp, sizeof(tmp), sizeof(tmp) - 1, "LOGOUT: [%s] to DATABASE: [%s]", username, dbname);
securec_check_ss(rc, "\0", "\0");
login_object_audit(security_policy_ids, audit_policy_ids, tmp, T_LOGOUT, "LOGOUT", dbname);
}
}
static void gen_priv_audit_logs(policy_simple_set& policy_result, bool ignore_db, const char* priv_name, const PolicyLabelItem* item,
const char *obj_value)
{
@ -208,42 +218,124 @@ bool internal_audit_object_str(const policy_set* security_policy_ids, const poli
bool is_found = false;
policy_simple_set policy_result;
if (!check_audit_policy_privileges(policy_ids, &policy_result, priv_type, item)) {
return is_found;
}
gs_stl::gs_string obj_value;
switch (item->m_obj_type) {
case O_DATABASE:
case O_ROLE:
obj_value = objname;
break;
case O_SCHEMA:
item->get_fqdn_value(&obj_value);
break;
default:
item->get_fqdn_value(&obj_value);
if (!item->m_object && strlen(objname) > 0) {
if (!obj_value.empty()) {
bool security_auditobject_res = (accesscontrol_securityAuditObject_hook != NULL) ?
accesscontrol_securityAuditObject_hook(security_policy_ids, item, priv_type, priv_name) :
true;
if (security_auditobject_res && check_audit_policy_privileges(policy_ids, &policy_result, priv_type, item)) {
gs_stl::gs_string obj_value;
switch (item->m_obj_type) {
case O_DATABASE:
case O_ROLE:
obj_value = objname;
break;
case O_SCHEMA:
item->get_fqdn_value(&obj_value);
break;
default:
item->get_fqdn_value(&obj_value);
if (!item->m_object && strlen(objname) > 0) {
obj_value.push_back('.');
obj_value.append(objname);
}
obj_value.append(objname);
}
break;
break;
}
is_found = !policy_result.empty();
gen_priv_audit_logs(policy_result, ignore_db, priv_name, item, obj_value.c_str());
}
is_found = !policy_result.empty();
gen_priv_audit_logs(policy_result, ignore_db, priv_name, item, obj_value.c_str());
return is_found;
}
void acl_audit_object(const policy_set *security_policy_ids, const policy_set *policy_ids, const ListCell *rel,
const names_pair names, int priv_type, const char *priv_name, int objtype, int target_type)
void audit_object(const policy_set *security_policy_ids, const policy_set *policy_ids, const char *relname,
int priv_type, const char *priv_name, int objtype)
{
PrivObject type = get_privtype_from_aclobject((GrantObjectType)objtype);
if (type == O_DATABASE) {
internal_audit_object_str(security_policy_ids, policy_ids, rel, names, priv_type, priv_name, type, target_type,
false, true);
} else {
internal_audit_object_str(security_policy_ids, policy_ids, rel, names, priv_type, priv_name, type, target_type);
switch (objtype) {
case OBJECT_ROLE:
internal_audit_str(security_policy_ids, policy_ids, relname, priv_type, priv_name, O_ROLE);
break;
case OBJECT_USER:
internal_audit_str(security_policy_ids, policy_ids, relname, priv_type, priv_name, O_USER);
break;
case OBJECT_SCHEMA:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_SCHEMA);
break;
case OBJECT_SEQUENCE:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_SEQUENCE);
break;
case OBJECT_DATABASE:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_DATABASE);
break;
case OBJECT_FOREIGN_SERVER:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_SERVER);
break;
case OBJECT_FOREIGN_TABLE:
case OBJECT_STREAM:
case OBJECT_TABLE:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name,
(objtype == OBJECT_TABLE) ? O_TABLE : O_FOREIGNTABLE);
break;
case OBJECT_COLUMN:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_COLUMN);
break;
case OBJECT_TRIGGER:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_TRIGGER);
break;
case OBJECT_FUNCTION:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_FUNCTION);
break;
case OBJECT_CONTQUERY:
case OBJECT_VIEW:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_VIEW);
break;
case OBJECT_INDEX:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_INDEX);
break;
case OBJECT_TABLESPACE:
internal_audit_str(policy_ids, policy_ids, relname, priv_type, priv_name, O_TABLESPACE);
break;
default:
break;
}
}
void acl_audit_object(const policy_set *security_policy_ids, const policy_set *policy_ids,
const names_pair names, int priv_type, const char *priv_name, int objtype)
{
switch (objtype) {
case ACL_OBJECT_COLUMN:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_COLUMN);
break;
case ACL_OBJECT_RELATION:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_RELATION);
break;
case ACL_OBJECT_SEQUENCE:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_SEQUENCE);
break;
case ACL_OBJECT_DATABASE:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_DATABASE, true);
break;
case ACL_OBJECT_DOMAIN:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_DOMAIN);
break;
case ACL_OBJECT_FOREIGN_SERVER:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_SERVER);
break;
case ACL_OBJECT_FUNCTION:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_FUNCTION);
break;
case ACL_OBJECT_LANGUAGE:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_LANGUAGE);
break;
case ACL_OBJECT_NAMESPACE:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_SCHEMA);
break;
case ACL_OBJECT_TABLESPACE:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_TABLESPACE);
break;
case ACL_OBJECT_DATA_SOURCE:
internal_audit_object_str(security_policy_ids, policy_ids, names, priv_type, priv_name, O_DATA_SOURCE);
break;
default:
break;
}
}
@ -258,12 +350,7 @@ void audit_table(const policy_set *security_policy_ids, const policy_set *policy
{
if (rel->relname == NULL)
return;
PolicyLabelItem item;
if (priv_type == T_CREATE) {
item = PolicyLabelItem(rel->schemaname, rel->relname, "", objtype);
} else {
gen_policy_labelitem(item, (const ListCell *)rel, objtype);
}
PolicyLabelItem item(rel->schemaname, rel->relname, "", objtype);
char buff[2048] = {0};
if (priv_type == T_DROP) {
if (check_label_has_object(&item, is_masking_has_object)) {
@ -273,7 +360,7 @@ void audit_table(const policy_set *security_policy_ids, const policy_set *policy
"Table: %s is part of some resource label, can not be dropped.", table_name.c_str());
securec_check_ss(rc, "\0", "\0");
gs_audit_issue_syslog_message("PGAUDIT", buff, AUDIT_POLICY_EVENT, AUDIT_FAILED);
ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), errmsg("\"%s\"", buff)));
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\"", buff)));
return;
}
}
@ -313,16 +400,6 @@ void audit_schema(const policy_set security_policy_ids, const policy_set policy_
policy_simple_set policy_result;
int check_type = (priv_type == T_RENAME) ? T_ALTER : priv_type;
PolicyLabelItem item(schemaname, "", "", O_SCHEMA);
if (priv_type == T_DROP) {
if (check_label_has_object(&item, is_masking_has_object)) {
int rc = snprintf_s(buff, sizeof(buff), sizeof(buff) - 1,
"Schema: %s is part of some resource label, can not be dropped.", schemaname);
securec_check_ss(rc, "\0", "\0");
gs_audit_issue_syslog_message("PGAUDIT", buff, AUDIT_POLICY_EVENT, AUDIT_FAILED);
ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), errmsg("\"%s\"", buff)));
return;
}
}
bool security_auditobject_res = (accesscontrol_securityAuditObject_hook != NULL) ?
accesscontrol_securityAuditObject_hook(&security_policy_ids, &item, check_type, priv_name) :
true;
@ -593,6 +670,10 @@ void rename_object(RenameStmt *stmt, const policy_set policy_ids, const policy_s
item.m_obj_type = O_TRIGGER;
objectname = stmt->subname;
break;
case OBJECT_FOREIGN_SERVER:
objectname = stmt->subname;
item.m_obj_type = O_SERVER;
break;
case OBJECT_FUNCTION: {
item.m_obj_type = O_FUNCTION;
name_list_to_label(&item, stmt->object);
@ -729,7 +810,7 @@ void get_cursor_tables(List *rtable, char *buff, size_t buff_size, int _printed_
int printed_size = _printed_size;
foreach (lc, rtable) {
RangeTblEntry *rte = (RangeTblEntry *)lfirst(lc);
if (rte != NULL && rte->relname && rte->rtekind == RTE_RELATION) {
if (rte->relname && rte->rtekind == RTE_RELATION) {
PolicyLabelItem item;
get_fqdn_by_relid(rte, &item);
if (cursor_objects) {
@ -769,21 +850,71 @@ void get_open_cursor_info(PlannedStmt *stmt, char *buff, size_t buff_size)
printed_size = snprintf_s(buff, buff_size, buff_size - 1, "%s ", cstmt->portalname);
securec_check_ss(printed_size, "\0", "\0");
}
rc = snprintf_s(buff + printed_size, buff_size - printed_size, buff_size - printed_size - 1,
get_cursorinfo(stmt->commandType));
securec_check_ss(rc, "\0", "\0");
printed_size += rc;
switch (stmt->commandType) {
case CMD_SELECT: {
rc = snprintf_s(buff + printed_size, buff_size - printed_size, buff_size - printed_size - 1,
"FOR SELECT FROM");
securec_check_ss(rc, "\0", "\0");
printed_size += rc;
break;
}
case CMD_INSERT: {
rc = snprintf_s(buff + printed_size, buff_size - printed_size, buff_size - printed_size - 1,
"FOR INSERT TO");
securec_check_ss(rc, "\0", "\0");
printed_size += rc;
break;
}
case CMD_UPDATE: {
rc = snprintf_s(buff + printed_size, buff_size - printed_size, buff_size - printed_size - 1,
"FOR UPDATE FROM");
securec_check_ss(rc, "\0", "\0");
printed_size += rc;
break;
}
case CMD_DELETE: {
rc = snprintf_s(buff + printed_size, buff_size - printed_size, buff_size - printed_size - 1,
"FOR DELETE FROM");
securec_check_ss(rc, "\0", "\0");
printed_size += rc;
break;
}
default:
break;
}
get_cursor_tables(stmt->rtable, buff, buff_size, printed_size);
}
PrivObject get_privtype_from_aclobject(GrantObjectType acl_type)
void login_handle(const char *dbname, const char *username, bool success, bool login)
{
for (unsigned int i = 0; i < (sizeof(aclobject_infos) / sizeof(aclobject_infos[0])); ++i) {
if (aclobject_infos[i].grant_type == acl_type) {
return aclobject_infos[i].privi_type;
}
/* do nothing when enable_security_policy is off */
if (!u_sess->attr.attr_security.Enable_Security_Policy ||
!IsConnFromApp() || !OidIsValid(u_sess->proc_cxt.MyDatabaseId)) {
return;
}
return O_UNKNOWN;
ResourceOwnerData *old_owner = NULL;
if (t_thrd.utils_cxt.CurrentResourceOwner == NULL) {
old_owner = create_temp_resourceowner();
}
/* dbname is necessary for login hook as u_sess info may not be ok now so that invalid oid */
if (!is_database_valid(dbname) || !is_audit_policy_exist(dbname)) {
return;
}
/* if access control policy worked, no need to run the audit policy
* related audit logs would be recorded in LoginHandle_access
*/
if ((security_LoginHandle_access_hook != NULL) ?
security_LoginHandle_access_hook(dbname, username, success, login) : true) {
login_handle_audit(dbname, username, success, login);
}
if (old_owner != NULL) {
release_temp_resourceowner(old_owner);
}
flush_access_logs(success ? AUDIT_OK : AUDIT_FAILED);
}

View File

@ -26,14 +26,13 @@
#include "nodes/primnodes.h"
#include "nodes/parsenodes.h"
#include "gs_policy/gs_vector.h"
#include "gs_policy_object_types.h"
#define SET_DB_SCHEMA_TABLE buffer->append(schemaname); \
buffer->push_back('.');
typedef std::pair<gs_stl::gs_string, gs_stl::gs_string> names_pair;
void acl_audit_object(const policy_set *security_policy_ids, const policy_set *policy_ids, const ListCell *rel,
const names_pair names, int priv_type, const char *priv_name, int objtype, int target_type);
void acl_audit_object(const policy_set *security_policy_ids, const policy_set *policy_ids,
const names_pair names, int priv_type, const char *priv_name, int objtype);
bool internal_audit_object_str(const policy_set* security_policy_ids, const policy_set* policy_ids,
const PolicyLabelItem* item, int priv_type, const char* priv_name, const char* objname = "",
bool ignore_db = false);
@ -41,8 +40,10 @@ void internal_audit_str(const policy_set *security_policy_ids, const policy_set
int priv_type, const char *priv_name, int objtype, bool ignore_db = false);
void login_object(const policy_set *security_policy_ids, const policy_set *policy_ids, const char *login_str,
int priv_type, const char *priv_name);
void internal_audit_object_str(const policy_set *security_policy_ids, const policy_set *policy_ids, const ListCell *rel,
const names_pair names, int priv_type, const char *priv_name, int objtype, int target_type = ACL_TARGET_OBJECT, bool is_rolegrant = false, bool ignore_db = false);
void internal_audit_object_str(const policy_set *security_policy_ids, const policy_set *policy_ids,
const names_pair names, int priv_type, const char *priv_name, int objtype, bool ignore_db = false);
void audit_object(const policy_set *security_policy_ids, const policy_set *policy_ids,
const char *relname, int priv_type, const char *priv_name, int objtype);
void audit_table(const policy_set *security_policy_ids, const policy_set *policy_ids,
RangeVar *rel, int priv_type, const char *priv_name, int objtype);
void alter_table(const policy_set *security_policy_ids, const policy_set *policy_ids,
@ -56,9 +57,12 @@ void alter_owner(AlterOwnerStmt *stmt, const policy_set policy_ids, const policy
void add_current_path(int objtype, List *fqdn, gs_stl::gs_string *buffer);
void fill_label_item(PolicyLabelItem *item, int objtype, List *fqdn);
void destroy_logs();
void login_object_audit(const policy_set security_policy_ids, const policy_set policy_ids, const char *login_str,
int priv_type, const char *priv_name, const char *dbname = NULL);
void login_handle_audit(const char *dbname, const char *username, bool success, bool login);
void get_cursor_tables(List *rtable, char *buff, size_t buff_size, int _printed_size,
gs_stl::gs_vector<PolicyLabelItem> *cursor_objects = nullptr);
void get_open_cursor_info(PlannedStmt *stmt, char *buff, size_t buff_size);
PrivObject get_privtype_from_aclobject(GrantObjectType acl_type);
void login_handle(const char *dbname, const char *username, bool success, bool logino);
#endif /* PRIVILEGES_AUDIT_H_ */

View File

@ -3,8 +3,8 @@ create or replace function pg_catalog.creditcardmasking(col text,letter char def
declare
size INTEGER := 4;
begin
return CASE WHEN pg_catalog.length(col) >= size THEN
pg_catalog.REGEXP_REPLACE(pg_catalog.left(col, size*(-1)), '[\d+]', letter, 'g') || pg_catalog.right(col, size)
return CASE WHEN length(col) >= size THEN
REGEXP_REPLACE(left(col, size*(-1)), '[\d+]', letter, 'g') || right(col, size)
ELSE
col
end;
@ -16,7 +16,7 @@ declare
pos INTEGER := position('@' in col);
begin
return CASE WHEN pos > 1 THEN
pg_catalog.repeat(letter, pos - 1) || pg_catalog.substring(col, pos, pg_catalog.length(col) - pos +1)
repeat(letter, pos - 1) || substring(col, pos, length(col) - pos +1)
ELSE
col
end;
@ -26,10 +26,10 @@ $$ LANGUAGE plpgsql;
create or replace function pg_catalog.fullemailmasking(col text, letter char default 'x') RETURNS text AS $$
declare
pos INTEGER := position('@' in col);
dot_pos INTEGER := pg_catalog.length(col) - position('.' in pg_catalog.reverse(col)) + 1;
dot_pos INTEGER := length(col) - position('.' in reverse(col)) + 1;
begin
return CASE WHEN pos > 2 and dot_pos > pos THEN
pg_catalog.repeat(letter, pos - 1) || '@' || pg_catalog.repeat(letter, dot_pos - pos - 1) || pg_catalog.substring(col, dot_pos, pg_catalog.length(col) - dot_pos +1)
repeat(letter, pos - 1) || '@' || repeat(letter, dot_pos - pos - 1) || substring(col, dot_pos, length(col) - dot_pos +1)
ELSE
col
end;
@ -38,7 +38,7 @@ $$ LANGUAGE plpgsql;
create or replace function pg_catalog.alldigitsmasking(col text, letter char default '0') RETURNS text AS $$
begin
return pg_catalog.REGEXP_REPLACE(col, '[\d+]', letter, 'g');
return REGEXP_REPLACE(col, '[\d+]', letter, 'g');
end;
$$ LANGUAGE plpgsql;
@ -46,14 +46,14 @@ create or replace function pg_catalog.shufflemasking(col text) RETURNS text AS $
declare
index INTEGER := 0;
rd INTEGER;
size INTEGER := pg_catalog.length(col);
size INTEGER := length(col);
tmp text := col;
res text;
begin
while size > 0 loop
rd := pg_catalog.floor(pg_catalog.random() * pg_catalog.length(tmp) + 1);
res := res || pg_catalog.right(pg_catalog.left(tmp, rd), 1);
tmp := pg_catalog.left(tmp, rd - 1) || pg_catalog.right(tmp, pg_catalog.length(tmp) - rd);
rd := floor(random() * length(tmp) + 1);
res := res || right(left(tmp, rd), 1);
tmp := left(tmp, rd - 1) || right(tmp, length(tmp) - rd);
size := size - 1;
END loop;
return res;
@ -62,13 +62,13 @@ $$ LANGUAGE plpgsql;
create or replace function pg_catalog.randommasking(col text) RETURNS text AS $$
begin
return pg_catalog.left(pg_catalog.MD5(pg_catalog.random()::text), pg_catalog.length(col));
return left(MD5(random()::text), length(col));
end;
$$ LANGUAGE plpgsql;
create or replace function pg_catalog.regexpmasking(col text, reg text, replace_text text, pos INTEGER default 0, reg_len INTEGER default -1) RETURNS text AS $$
declare
size INTEGER := pg_catalog.length(col);
size INTEGER := length(col);
endpos INTEGER;
startpos INTEGER;
lstr text;
@ -81,9 +81,9 @@ begin
endpos := reg_len + startpos - 1;
IF reg_len < 0 THEN endpos := size - 1; END IF;
IF reg_len + startpos >= size THEN endpos := size - 1; END IF;
lstr := pg_catalog.left(col, startpos);
rstr := pg_catalog.right(col, size - endpos - 1);
ltarget := pg_catalog.substring(col, startpos+1, endpos - startpos + 1);
lstr := left(col, startpos);
rstr := right(col, size - endpos - 1);
ltarget := substring(col, startpos+1, endpos - startpos + 1);
ltarget := pg_catalog.REGEXP_REPLACE(ltarget, reg, replace_text, 'g');
return lstr || ltarget || rstr;
end;

View File

@ -5,7 +5,6 @@
* Routines to handle DML permission checks
*
* Copyright (c) 2010-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 2021, openGauss Contributors
*
* -------------------------------------------------------------------------
*/
@ -182,7 +181,6 @@ static bool check_relation_privileges(Oid relOid, Bitmapset* selected, Bitmapset
break;
case RELKIND_SEQUENCE:
case RELKIND_LARGE_SEQUENCE:
Assert((required & ~SEPG_DB_TABLE__SELECT) == 0);
if (required & SEPG_DB_TABLE__SELECT)

View File

@ -5,7 +5,6 @@
* Routines to support SELinux labels (security context)
*
* Copyright (c) 2010-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 2021, openGauss Contributors
*
* -------------------------------------------------------------------------
*/
@ -681,7 +680,7 @@ static void exec_object_restorecon(struct selabel_handle* sehnd, Oid catalogId)
if (relForm->relkind == RELKIND_RELATION)
objtype = SELABEL_DB_TABLE;
else if (RELKIND_IS_SEQUENCE(relForm->relkind))
else if (relForm->relkind == RELKIND_SEQUENCE)
objtype = SELABEL_DB_SEQUENCE;
else if (relForm->relkind == RELKIND_VIEW || (relForm->relkind == RELKIND_CONTQUERY)
objtype = SELABEL_DB_VIEW;

View File

@ -346,7 +346,7 @@ void sepgsql_relation_drop(Oid relOid)
attrList = SearchSysCacheList1(ATTNUM, ObjectIdGetDatum(relOid));
for (i = 0; i < attrList->n_members; i++) {
atttup = t_thrd.lsc_cxt.FetchTupleFromCatCList(attrList, i);
atttup = &attrList->members[i]->tuple;
attForm = (Form_pg_attribute)GETSTRUCT(atttup);
if (attForm->attisdropped)
@ -360,7 +360,7 @@ void sepgsql_relation_drop(Oid relOid)
sepgsql_avc_check_perms(&object, SEPG_CLASS_DB_COLUMN, SEPG_DB_COLUMN__DROP, audit_name, true);
pfree(audit_name);
}
ReleaseSysCacheList(attrList);
ReleaseCatCacheList(attrList);
}
}

View File

@ -1,11 +0,0 @@
#This is the main CMAKE for build all components.
AUX_SOURCE_DIRECTORY(${PROJECT_OPENGS_DIR}/contrib/sql_decoding TGT_sql_decoding_SRC)
set(sql_decoding_DEF_OPTIONS -D_GLIBCXX_USE_CXX11_ABI=0 -DSTREAMPLAN -DPGXC -DENABLE_GSTRACE -D_GNU_SOURCE)
set(sql_decoding_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${LIB_SECURE_OPTIONS} ${CHECK_OPTIONS} -fstack-protector-all)
list(REMOVE_ITEM sql_decoding_COMPILE_OPTIONS -fstack-protector)
set(sql_decoding_LINK_OPTIONS ${LIB_LINK_OPTIONS})
add_shared_libtarget(sql_decoding TGT_sql_decoding_SRC "" "${sql_decoding_DEF_OPTIONS}" "${sql_decoding_COMPILE_OPTIONS}" "${sql_decoding_LINK_OPTIONS}")
set_target_properties(sql_decoding PROPERTIES PREFIX "")
install(TARGETS sql_decoding LIBRARY DESTINATION lib/postgresql)

View File

@ -1,2 +0,0 @@
wal_level = logical
max_replication_slots = 8

View File

@ -1,5 +0,0 @@
# roach_api extension
comment = 'sql_decoding wrapper'
default_version = '1.0'
module_pathname = '$libdir/sql_decoding'
relocatable = true

View File

@ -1,516 +0,0 @@
/*
* Portions Copyright (c) 2020 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 2012-2014, PostgreSQL Global Development Group
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* ---------------------------------------------------------------------------------------
*
* sql_decoding.cpp
* logical decoding output plugin (sql)
*
*
*
* IDENTIFICATION
* contrib/sql_decoding/sql_decoding.cpp
*
* ---------------------------------------------------------------------------------------
*/
#include "postgres.h"
#include "knl/knl_variable.h"
#include "access/sysattr.h"
#include "access/ustore/knl_utuple.h"
#include "catalog/pg_class.h"
#include "catalog/pg_type.h"
#include "nodes/parsenodes.h"
#include "replication/logical.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/relcache.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
#include "replication/output_plugin.h"
#include "replication/logical.h"
PG_MODULE_MAGIC;
/* These must be available to pg_dlsym() */
extern "C" void _PG_init(void);
extern "C" void _PG_output_plugin_init(OutputPluginCallbacks* cb);
static void pg_decode_startup(LogicalDecodingContext* ctx, OutputPluginOptions* opt, bool is_init);
static void pg_decode_shutdown(LogicalDecodingContext* ctx);
static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn, XLogRecPtr commit_lsn);
static void pg_decode_abort_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_decode_change(
LogicalDecodingContext* ctx, ReorderBufferTXN* txn, Relation rel, ReorderBufferChange* change);
static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id);
typedef struct {
MemoryContext context;
bool include_xids;
bool include_timestamp;
bool skip_empty_xacts;
bool xact_wrote_changes;
bool only_local;
} TestDecodingData;
/* specify output plugin callbacks */
void _PG_output_plugin_init(OutputPluginCallbacks* cb)
{
AssertVariableIsOfType(&_PG_output_plugin_init, LogicalOutputPluginInit);
cb->startup_cb = pg_decode_startup;
cb->begin_cb = pg_decode_begin_txn;
cb->change_cb = pg_decode_change;
cb->commit_cb = pg_decode_commit_txn;
cb->abort_cb = pg_decode_abort_txn;
cb->filter_by_origin_cb = pg_decode_filter;
cb->shutdown_cb = pg_decode_shutdown;
}
void _PG_init(void)
{
/* other plugins can perform things here */
}
/* initialize this plugin */
static void pg_decode_startup(LogicalDecodingContext* ctx, OutputPluginOptions* opt, bool is_init = true)
{
ListCell* option = NULL;
TestDecodingData *data = (TestDecodingData*)palloc0(sizeof(TestDecodingData));
data->context = AllocSetContextCreate(ctx->context,
"text conversion context", ALLOCSET_DEFAULT_SIZES);
data->include_xids = true;
data->include_timestamp = false;
data->skip_empty_xacts = false;
data->only_local = true;
ctx->output_plugin_private = data;
opt->output_type = OUTPUT_PLUGIN_TEXTUAL_OUTPUT;
foreach (option, ctx->output_plugin_options) {
DefElem* elem = (DefElem*)lfirst(option);
Assert(elem->arg == NULL || IsA(elem->arg, String));
if (strcmp(elem->defname, "include-xids") == 0) {
/* if option does not provide a value, it means its value is true */
if (elem->arg == NULL) {
data->include_xids = true;
} else if (!parse_bool(strVal(elem->arg), &data->include_xids)) {
ereport(ERROR, (errmodule(MOD_LOGICAL_DECODE), errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname),
errdetail("N/A"), errcause("Wrong input value"), erraction("Input \"on\" or \"off\"")));
}
} else if (strcmp(elem->defname, "include-timestamp") == 0) {
if (elem->arg == NULL) {
data->include_timestamp = true;
} else if (!parse_bool(strVal(elem->arg), &data->include_timestamp)) {
ereport(ERROR, (errmodule(MOD_LOGICAL_DECODE), errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname),
errdetail("N/A"), errcause("Wrong input value"), erraction("Input \"on\" or \"off\"")));
}
} else if (strcmp(elem->defname, "skip-empty-xacts") == 0) {
if (elem->arg == NULL) {
data->skip_empty_xacts = true;
} else if (!parse_bool(strVal(elem->arg), &data->skip_empty_xacts)) {
ereport(ERROR, (errmodule(MOD_LOGICAL_DECODE), errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname),
errdetail("N/A"), errcause("Wrong input value"), erraction("Input \"on\" or \"off\"")));
}
} else if (strcmp(elem->defname, "only-local") == 0) {
if (elem->arg == NULL) {
data->only_local = true;
} else if (!parse_bool(strVal(elem->arg), &data->only_local)) {
ereport(ERROR, (errmodule(MOD_LOGICAL_DECODE), errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname),
errdetail("N/A"), errcause("Wrong input value"), erraction("Input \"on\" or \"off\"")));
}
} else {
ereport(ERROR, (errmodule(MOD_LOGICAL_DECODE), errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("option \"%s\" = \"%s\" is unknown", elem->defname, elem->arg ? strVal(elem->arg) : "(null)"),
errdetail("N/A"), errcause("Wrong input option"),
erraction("Check the product documentation for legal options")));
}
}
}
/* cleanup this plugin's resources */
static void pg_decode_shutdown(LogicalDecodingContext* ctx)
{
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
/* cleanup our own resources via memory context reset */
MemoryContextDelete(data->context);
}
/*
* Prepare output plugin.
*/
void pg_output_begin(LogicalDecodingContext* ctx, TestDecodingData* data, ReorderBufferTXN* txn, bool last_write)
{
OutputPluginPrepareWrite(ctx, last_write);
appendStringInfo(ctx->out, "BEGIN %lu", txn->csn);
OutputPluginWrite(ctx, last_write);
}
/* BEGIN callback */
static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
data->xact_wrote_changes = false;
if (data->skip_empty_xacts) {
return;
}
pg_output_begin(ctx, data, txn, true);
}
/* COMMIT callback */
static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn, XLogRecPtr commit_lsn)
{
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes) {
return;
}
OutputPluginPrepareWrite(ctx, true);
appendStringInfoString(ctx->out, "COMMIT");
appendStringInfo(ctx->out, " (at %s)", timestamptz_to_str(txn->commit_time));
appendStringInfo(ctx->out, " %lu", txn->csn);
OutputPluginWrite(ctx, true);
}
/* ABORT callback */
static void pg_decode_abort_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes) {
return;
}
OutputPluginPrepareWrite(ctx, true);
if (data->include_xids) {
appendStringInfo(ctx->out, "ABORT %lu", txn->xid);
} else {
appendStringInfoString(ctx->out, "ABORT");
}
if (data->include_timestamp) {
appendStringInfo(ctx->out, " (at %s)", timestamptz_to_str(txn->commit_time));
}
OutputPluginWrite(ctx, true);
}
static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
{
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->only_local && origin_id != InvalidRepOriginId) {
return true;
}
return false;
}
/*
* Print literal `outputstr' already represented as string of type `typid'
* into stringbuf `s'.
*
* Some builtin types aren't quoted, the rest is quoted. Escaping is done as
* if u_sess->parser_cxt.standard_conforming_strings were enabled.
*/
static void print_literal(StringInfo s, Oid typid, char* outputstr)
{
const char* valptr = NULL;
switch (typid) {
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
case INT1OID:
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
/* NB: We don't care about Inf, NaN et al. */
appendStringInfoString(s, outputstr);
break;
case BITOID:
case VARBITOID:
appendStringInfo(s, "B'%s'", outputstr);
break;
case BOOLOID:
if (strcmp(outputstr, "t") == 0) {
appendStringInfoString(s, "true");
} else {
appendStringInfoString(s, "false");
}
break;
default:
appendStringInfoChar(s, '\'');
for (valptr = outputstr; *valptr; valptr++) {
char ch = *valptr;
if (SQL_STR_DOUBLE(ch, false)) {
appendStringInfoChar(s, ch);
}
appendStringInfoChar(s, ch);
}
appendStringInfoChar(s, '\'');
break;
}
}
/*
* Decode tuple into stringinfo.
*/
static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
{
Assert(tuple != NULL);
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
return;
}
appendStringInfoChar(s, '(');
/* print all columns individually */
for (int natt = 0; natt < tupdesc->natts; natt++) {
bool isnull = false; /* column is null? */
bool typisvarlena = false;
Oid typoutput = 0; /* output function */
Datum origval = 0; /* possibly toasted Datum */
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
if (attr->attisdropped || attr->attnum < 0) {
continue;
}
/* get Datum from tuple */
if (tuple->tupTableType == HEAP_TUPLE) {
origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
} else {
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
}
if (skip_nulls && isnull) {
continue;
}
/* query output function */
Oid typid = attr->atttypid; /* type of current attribute */
getTypeOutputInfo(typid, &typoutput, &typisvarlena);
/* print data */
if (isnull) {
appendStringInfoString(s, "null");
} else if (!typisvarlena) {
print_literal(s, typid, OidOutputFunctionCall(typoutput, origval));
} else {
Datum val = PointerGetDatum(PG_DETOAST_DATUM(origval));
print_literal(s, typid, OidOutputFunctionCall(typoutput, val));
}
if (natt < tupdesc->natts - 1) {
appendStringInfoString(s, ", ");
}
}
appendStringInfoChar(s, ')');
}
/*
* Decode tuple into stringinfo.
* This function is used for UPDATE or DELETE statements.
*/
static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
{
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
return;
}
bool isFirstAtt = true;
/* print all columns individually */
for (int natt = 0; natt < tupdesc->natts; natt++) {
Oid typoutput = 0; /* output function */
Datum origval = 0; /* possibly toasted Datum */
bool isnull = false; /* column is null? */
bool typisvarlena = false;
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
if (attr->attisdropped || attr->attnum < 0) {
continue;
}
/* get Datum from tuple */
if (tuple->tupTableType == HEAP_TUPLE) {
origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
} else {
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
}
if (isnull && skip_nulls) {
continue;
}
if (!isFirstAtt) {
appendStringInfoString(s, " and ");
} else {
isFirstAtt = false;
}
/* print attribute name */
appendStringInfoString(s, quote_identifier(NameStr(attr->attname)));
appendStringInfoString(s, " = ");
/* query output function */
Oid typid = attr->atttypid;
getTypeOutputInfo(typid, &typoutput, &typisvarlena);
/* print data */
if (isnull) {
appendStringInfoString(s, "null");
} else if (!typisvarlena) {
print_literal(s, typid, OidOutputFunctionCall(typoutput, origval));
} else {
Datum val = PointerGetDatum(PG_DETOAST_DATUM(origval));
print_literal(s, typid, OidOutputFunctionCall(typoutput, val));
}
}
}
/*
* Callback for handle decoded tuple.
* Additional info will be added if the tuple is found null.
*/
static void TupleHandler(StringInfo s, TupleDesc tupdesc, ReorderBufferChange* change, bool isHeap, bool isNewTuple)
{
if (isHeap && isNewTuple) {
if (change->data.tp.newtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfo(s, tupdesc, &change->data.tp.newtuple->tuple, false);
}
} else if (isHeap && !isNewTuple) {
if (change->data.tp.oldtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfoUpd(s, tupdesc, &change->data.tp.oldtuple->tuple, true);
}
} else if (!isHeap && isNewTuple) {
if (change->data.utp.newtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfo(s, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
}
} else {
if (change->data.utp.oldtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfoUpd(s, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
}
}
}
/*
* Callback for individual changed tuples.
*/
static void pg_decode_change(
LogicalDecodingContext* ctx, ReorderBufferTXN* txn, Relation relation, ReorderBufferChange* change)
{
Form_pg_class class_form = NULL;
TupleDesc tupdesc = NULL;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
u_sess->attr.attr_common.extra_float_digits = 0;
bool isHeap = true;
/* output BEGIN if we haven't yet */
if (txn != NULL && data->skip_empty_xacts && !data->xact_wrote_changes) {
pg_output_begin(ctx, data, txn, false);
}
data->xact_wrote_changes = true;
class_form = RelationGetForm(relation);
tupdesc = RelationGetDescr(relation);
/* Avoid leaking memory by using and resetting our own context */
MemoryContext old = MemoryContextSwitchTo(data->context);
char *schema = NULL;
char *table = NULL;
schema = get_namespace_name(class_form->relnamespace);
table = NameStr(class_form->relname);
OutputPluginPrepareWrite(ctx, true);
switch (change->action) {
case REORDER_BUFFER_CHANGE_INSERT:
case REORDER_BUFFER_CHANGE_UINSERT:
appendStringInfoString(ctx->out, "insert into ");
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
if (change->action == REORDER_BUFFER_CHANGE_UINSERT) {
isHeap = false;
}
appendStringInfoString(ctx->out, " values ");
TupleHandler(ctx->out, tupdesc, change, isHeap, true);
break;
case REORDER_BUFFER_CHANGE_UPDATE:
case REORDER_BUFFER_CHANGE_UUPDATE:
appendStringInfoString(ctx->out, "delete from ");
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
if (change->action == REORDER_BUFFER_CHANGE_UUPDATE) {
isHeap = false;
}
appendStringInfoString(ctx->out, " where ");
TupleHandler(ctx->out, tupdesc, change, isHeap, false);
appendStringInfoChar(ctx->out, ';');
appendStringInfoString(ctx->out, "insert into ");
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
appendStringInfoString(ctx->out, " values ");
TupleHandler(ctx->out, tupdesc, change, isHeap, true);
break;
case REORDER_BUFFER_CHANGE_DELETE:
case REORDER_BUFFER_CHANGE_UDELETE:
appendStringInfoString(ctx->out, "delete from ");
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
if (change->action == REORDER_BUFFER_CHANGE_UDELETE) {
isHeap = false;
}
appendStringInfoString(ctx->out, " where ");
TupleHandler(ctx->out, tupdesc, change, isHeap, false);
break;
default:
Assert(false);
}
appendStringInfoChar(ctx->out, ';');
MemoryContextSwitchTo(old);
MemoryContextReset(data->context);
OutputPluginWrite(ctx, true);
}

View File

@ -707,6 +707,7 @@ static HTAB* load_categories_hash(char* cats_sql, MemoryContext per_query_ctx)
MemoryContextSwitchTo(SPIcontext);
}
}
if (SPI_finish() != SPI_OK_FINISH)
/* internal error */
elog(ERROR, "load_categories_hash: SPI_finish() failed");

View File

@ -36,15 +36,21 @@ PG_MODULE_MAGIC;
extern "C" void _PG_init(void);
extern "C" void _PG_output_plugin_init(OutputPluginCallbacks* cb);
typedef struct {
MemoryContext context;
bool include_xids;
bool include_timestamp;
bool skip_empty_xacts;
bool xact_wrote_changes;
bool only_local;
} TestDecodingData;
static void pg_decode_startup(LogicalDecodingContext* ctx, OutputPluginOptions* opt, bool is_init);
static void pg_decode_shutdown(LogicalDecodingContext* ctx);
static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_output_begin(
LogicalDecodingContext* ctx, PluginTestDecodingData* data, ReorderBufferTXN* txn, bool last_write);
LogicalDecodingContext* ctx, TestDecodingData* data, ReorderBufferTXN* txn, bool last_write);
static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn, XLogRecPtr commit_lsn);
static void pg_decode_abort_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_decode_prepare_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn);
static void pg_decode_change(
LogicalDecodingContext* ctx, ReorderBufferTXN* txn, Relation rel, ReorderBufferChange* change);
static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id);
@ -63,8 +69,6 @@ void _PG_output_plugin_init(OutputPluginCallbacks* cb)
cb->begin_cb = pg_decode_begin_txn;
cb->change_cb = pg_decode_change;
cb->commit_cb = pg_decode_commit_txn;
cb->abort_cb = pg_decode_abort_txn;
cb->prepare_cb = pg_decode_prepare_txn;
cb->filter_by_origin_cb = pg_decode_filter;
cb->shutdown_cb = pg_decode_shutdown;
}
@ -73,33 +77,84 @@ void _PG_output_plugin_init(OutputPluginCallbacks* cb)
static void pg_decode_startup(LogicalDecodingContext* ctx, OutputPluginOptions* opt, bool is_init)
{
ListCell* option = NULL;
PluginTestDecodingData* data = NULL;
TestDecodingData* data = NULL;
data = (PluginTestDecodingData*)palloc0(sizeof(PluginTestDecodingData));
data = (TestDecodingData*)palloc0(sizeof(TestDecodingData));
data->context = AllocSetContextCreate(ctx->context,
"text conversion context",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
data->include_xids = true;
data->include_timestamp = true;
data->include_timestamp = false;
data->skip_empty_xacts = false;
data->only_local = true;
data->tableWhiteList = NIL;
ctx->output_plugin_private = data;
opt->output_type = OUTPUT_PLUGIN_TEXTUAL_OUTPUT;
foreach (option, ctx->output_plugin_options) {
ParseDecodingOptionPlugin(option, data, opt);
DefElem* elem = (DefElem*)lfirst(option);
Assert(elem->arg == NULL || IsA(elem->arg, String));
if (strcmp(elem->defname, "include-xids") == 0) {
/* if option does not provide a value, it means its value is true */
if (elem->arg == NULL)
data->include_xids = true;
else if (!parse_bool(strVal(elem->arg), &data->include_xids))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else if (strcmp(elem->defname, "include-timestamp") == 0) {
if (elem->arg == NULL)
data->include_timestamp = true;
else if (!parse_bool(strVal(elem->arg), &data->include_timestamp))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else if (strcmp(elem->defname, "force-binary") == 0) {
bool force_binary = false;
if (elem->arg == NULL)
continue;
else if (!parse_bool(strVal(elem->arg), &force_binary))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
if (force_binary)
opt->output_type = OUTPUT_PLUGIN_BINARY_OUTPUT;
} else if (strcmp(elem->defname, "skip-empty-xacts") == 0) {
if (elem->arg == NULL)
data->skip_empty_xacts = true;
else if (!parse_bool(strVal(elem->arg), &data->skip_empty_xacts))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else if (strcmp(elem->defname, "only-local") == 0) {
if (elem->arg == NULL)
data->only_local = true;
else if (!parse_bool(strVal(elem->arg), &data->only_local))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not parse value \"%s\" for parameter \"%s\"", strVal(elem->arg), elem->defname)));
} else {
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg(
"option \"%s\" = \"%s\" is unknown", elem->defname, elem->arg ? strVal(elem->arg) : "(null)")));
}
}
}
/* cleanup this plugin's resources */
static void pg_decode_shutdown(LogicalDecodingContext* ctx)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
/* cleanup our own resources via memory context reset */
MemoryContextDelete(data->context);
@ -108,18 +163,16 @@ static void pg_decode_shutdown(LogicalDecodingContext* ctx)
/* BEGIN callback */
static void pg_decode_begin_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
data->xact_wrote_changes = false;
if (data->skip_empty_xacts) {
if (data->skip_empty_xacts)
return;
}
pg_output_begin(ctx, data, txn, true);
}
static void pg_output_begin(LogicalDecodingContext* ctx, PluginTestDecodingData* data, ReorderBufferTXN* txn,
bool last_write)
static void pg_output_begin(LogicalDecodingContext* ctx, TestDecodingData* data, ReorderBufferTXN* txn, bool last_write)
{
OutputPluginPrepareWrite(ctx, last_write);
if (data->include_xids)
@ -132,7 +185,7 @@ static void pg_output_begin(LogicalDecodingContext* ctx, PluginTestDecodingData*
/* COMMIT callback */
static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn, XLogRecPtr commit_lsn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes)
return;
@ -150,55 +203,65 @@ static void pg_decode_commit_txn(LogicalDecodingContext* ctx, ReorderBufferTXN*
OutputPluginWrite(ctx, true);
}
/* ABORT callback */
static void pg_decode_abort_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes)
return;
OutputPluginPrepareWrite(ctx, true);
if (data->include_xids)
appendStringInfo(ctx->out, "ABORT %lu", txn->xid);
else
appendStringInfoString(ctx->out, "ABORT");
if (data->include_timestamp)
appendStringInfo(ctx->out, " (at %s)", timestamptz_to_str(txn->commit_time));
OutputPluginWrite(ctx, true);
}
/* PREPARE callback */
static void pg_decode_prepare_txn(LogicalDecodingContext* ctx, ReorderBufferTXN* txn)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
if (data->skip_empty_xacts && !data->xact_wrote_changes)
return;
OutputPluginPrepareWrite(ctx, true);
if (data->include_xids)
appendStringInfo(ctx->out, "PREPARE %lu", txn->xid);
else
appendStringInfoString(ctx->out, "PREPARE");
if (data->include_timestamp)
appendStringInfo(ctx->out, " (at %s)", timestamptz_to_str(txn->commit_time));
OutputPluginWrite(ctx, true);
}
static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
{
PluginTestDecodingData* data = (PluginTestDecodingData*)ctx->output_plugin_private;
TestDecodingData* data = (TestDecodingData*)ctx->output_plugin_private;
if (data->only_local && origin_id != InvalidRepOriginId)
return true;
return false;
}
/*
* Print literal `outputstr' already represented as string of type `typid'
* into stringbuf `s'.
*
* Some builtin types aren't quoted, the rest is quoted. Escaping is done as
* if u_sess->parser_cxt.standard_conforming_strings were enabled.
*/
static void print_literal(StringInfo s, Oid typid, char* outputstr)
{
const char* valptr = NULL;
switch (typid) {
case INT1OID:
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
/* NB: We don't care about Inf, NaN et al. */
appendStringInfoString(s, outputstr);
break;
case BITOID:
case VARBITOID:
appendStringInfo(s, "B'%s'", outputstr);
break;
case BOOLOID:
if (strcmp(outputstr, "t") == 0)
appendStringInfoString(s, "true");
else
appendStringInfoString(s, "false");
break;
default:
appendStringInfoChar(s, '\'');
for (valptr = outputstr; *valptr; valptr++) {
char ch = *valptr;
if (SQL_STR_DOUBLE(ch, false))
appendStringInfoChar(s, ch);
appendStringInfoChar(s, ch);
}
appendStringInfoChar(s, '\'');
break;
}
}
static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
{
if (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data))
@ -274,11 +337,11 @@ static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple
else if (typisvarlena && VARATT_IS_EXTERNAL_ONDISK_B(origval))
appendStringInfoString(s, "unchanged-toast-datum");
else if (!typisvarlena)
PrintLiteral(s, typid, OidOutputFunctionCall(typoutput, origval));
print_literal(s, typid, OidOutputFunctionCall(typoutput, origval));
else {
Datum val; /* definitely detoasted Datum */
val = PointerGetDatum(PG_DETOAST_DATUM(origval));
PrintLiteral(s, typid, OidOutputFunctionCall(typoutput, val));
print_literal(s, typid, OidOutputFunctionCall(typoutput, val));
}
}
}
@ -288,12 +351,13 @@ static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple
static void pg_decode_change(
LogicalDecodingContext* ctx, ReorderBufferTXN* txn, Relation relation, ReorderBufferChange* change)
{
PluginTestDecodingData* data = NULL;
TestDecodingData* data = NULL;
Form_pg_class class_form;
TupleDesc tupdesc;
MemoryContext old;
data = (PluginTestDecodingData*)ctx->output_plugin_private;
data = (TestDecodingData*)ctx->output_plugin_private;
u_sess->attr.attr_common.extra_float_digits = 0;
/* output BEGIN if we haven't yet */
if (data->skip_empty_xacts && !data->xact_wrote_changes) {
@ -307,18 +371,12 @@ static void pg_decode_change(
/* Avoid leaking memory by using and resetting our own context */
old = MemoryContextSwitchTo(data->context);
char *schema = get_namespace_name(class_form->relnamespace);
char *table = NameStr(class_form->relname);
if (data->tableWhiteList != NIL && !CheckWhiteList(data->tableWhiteList, schema, table)) {
(void)MemoryContextSwitchTo(old);
MemoryContextReset(data->context);
return;
}
OutputPluginPrepareWrite(ctx, true);
appendStringInfoString(ctx->out, "table ");
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
appendStringInfoString(ctx->out,
quote_qualified_identifier(
get_namespace_name(get_rel_namespace(RelationGetRelid(relation))), NameStr(class_form->relname)));
appendStringInfoString(ctx->out, ":");
switch (change->action) {

View File

@ -5,73 +5,63 @@
<repoType>Generic</repoType>
<id>
<offering>${offering}</offering>
<version>${version}</version>
<snapshot>${snapshot}</snapshot>
<version>${BVersion}</version>
</id>
<isClear>N</isClear>
<isClear>Y</isClear>
<copies>
<copy>
<source></source>
<DEL></DEL>
</copy>
</copies>
</artifact>
</artifact>
<dependencies>
<dependency>
<dependency>
<versionType>BVersion</versionType>
<repoType>Generic</repoType>
<id>
<offering>Huawei Secure C</offering>
<version>Huawei Secure C V100R001C01SPC010B002</version>
</id>
<isClear>Y</isClear>
<copies>
<copy>
<source></source>
<dest></dest>
</copy>
</copies>
</dependency>
<dependency>
</dependency>
<dependency>
<versionType>BVersion</versionType>
<repoType>Generic</repoType>
<id>
<offering>DOPRA SSP</offering>
<version>DOPRA SSP V300R021C10SPC010B100</version>
</id>
<copies>
<copy>
<source></source>
<dest>dopra_ssp</dest>
</copy>
</copies>
</dependency>
<dependency>
<versionType>BVersion</versionType>
<repoType>Generic</repoType>
<id>
<offering>BiSheng JDK Enterprise</offering>
<version>BiSheng JDK Enterprise 2.1.0.320.B001</version>
</id>
<copies>
<copy>
<source></source>
<dest>huaweijdk</dest>
</copy>
</copies>
</dependency>
<dependency>
<versionType>BVersion</versionType>
<repoType>Generic</repoType>
<id>
<offering>KMC</offering>
<version>KMC 21.1.0.B006</version>
<version>DOPRA SSP V300R005C10SPC102B500</version>
</id>
<isClear>Y</isClear>
<copies>
<copy>
<source></source>
<dest></dest>
<DEL>Y</DEL>
</copy>
</copies>
</dependency>
</dependency>
<dependency>
<versionType>BVersion</versionType>
<repoType>Generic</repoType>
<id>
<offering>Huawei JDK</offering>
<version>Huawei_JDK_V100R001C00SPC290B001</version>
</id>
<isClear>Y</isClear>
<copies>
<copy>
<source></source>
<dest></dest>
<DEL>Y</DEL>
</copy>
</copies>
</dependency>
</dependencies>
</project>
</project>

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More