forked from huawei/openGauss-server
Compare commits
6 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
ada51c9fea | |
|
|
1f6832d30b | |
|
|
d8cd223c53 | |
|
|
fcad3b1ccd | |
|
|
1f18fce639 | |
|
|
1ded1fec93 |
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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";
|
||||
20
build.sh
20
build.sh
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -12,162 +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 name: print_help
|
||||
# Note: this function is used to show the command if you forget
|
||||
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 name: print_version
|
||||
# Note: this function is used to show the version the user is using
|
||||
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
|
|
@ -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
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
PRODUCT=GaussDB Kernel
|
||||
VERSION=V500R002C00
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
V=100
|
||||
R=003
|
||||
C=00
|
||||
OfficialVersion=
|
||||
InternalVersion=B100
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
PRODUCT=openGauss
|
||||
VERSION=3.0.0
|
||||
VERSION=2.1.0
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
@ -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."
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* contrib/adminpack/adminpack--1.0.sql */
|
||||
|
||||
-- check if the script runs in psql, or remind user to use "CREATE EXTENSION adminpack" to run
|
||||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
||||
\echo Use "CREATE EXTENSION adminpack" to load this file. \quit
|
||||
|
||||
/* ***********************************************
|
||||
|
|
@ -8,31 +8,27 @@
|
|||
* *********************************************** */
|
||||
|
||||
/* generic file access functions */
|
||||
-- check the file whether is coverd
|
||||
|
||||
CREATE FUNCTION pg_catalog.pg_file_write(text, text, bool)
|
||||
RETURNS bigint
|
||||
AS 'MODULE_PATHNAME', 'pg_file_write'
|
||||
LANGUAGE C VOLATILE STRICT;
|
||||
|
||||
-- change the name of file
|
||||
CREATE FUNCTION pg_catalog.pg_file_rename(text, text, text)
|
||||
RETURNS bool
|
||||
AS 'MODULE_PATHNAME', 'pg_file_rename'
|
||||
LANGUAGE C VOLATILE;
|
||||
|
||||
-- an overloaded version of the definition function
|
||||
CREATE FUNCTION pg_catalog.pg_file_rename(text, text)
|
||||
RETURNS bool
|
||||
AS 'SELECT pg_catalog.pg_file_rename($1, $2, NULL::pg_catalog.text);'
|
||||
LANGUAGE SQL VOLATILE STRICT;
|
||||
|
||||
-- delete the file
|
||||
CREATE FUNCTION pg_catalog.pg_file_unlink(text)
|
||||
RETURNS bool
|
||||
AS 'MODULE_PATHNAME', 'pg_file_unlink'
|
||||
LANGUAGE C VOLATILE STRICT;
|
||||
|
||||
-- list files in the log directory.
|
||||
CREATE FUNCTION pg_catalog.pg_logdir_ls()
|
||||
RETURNS setof record
|
||||
AS 'MODULE_PATHNAME', 'pg_logdir_ls'
|
||||
|
|
@ -41,19 +37,16 @@ LANGUAGE C VOLATILE STRICT;
|
|||
|
||||
/* Renaming of existing backend functions for pgAdmin compatibility */
|
||||
|
||||
-- read the contents of the file
|
||||
CREATE FUNCTION pg_catalog.pg_file_read(text, bigint, bigint)
|
||||
RETURNS text
|
||||
AS 'pg_read_file'
|
||||
LANGUAGE INTERNAL VOLATILE STRICT;
|
||||
|
||||
-- get the size of the file
|
||||
CREATE FUNCTION pg_catalog.pg_file_length(text)
|
||||
RETURNS bigint
|
||||
AS 'SELECT size FROM pg_catalog.pg_stat_file($1)'
|
||||
LANGUAGE SQL VOLATILE STRICT;
|
||||
|
||||
-- manually starting log file rotation.
|
||||
CREATE FUNCTION pg_catalog.pg_logfile_rotate()
|
||||
RETURNS int4
|
||||
AS 'pg_rotate_logfile'
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ PG_FUNCTION_INFO_V1(pg_file_unlink);
|
|||
PG_FUNCTION_INFO_V1(pg_logdir_ls);
|
||||
|
||||
typedef struct {
|
||||
char *location;
|
||||
DIR *dirdesc;
|
||||
char* location;
|
||||
DIR* dirdesc;
|
||||
} directory_fctx;
|
||||
|
||||
/*-----------------------
|
||||
|
|
@ -65,30 +65,30 @@ typedef struct {
|
|||
* Filename may be absolute or relative to the t_thrd.proc_cxt.DataDir, but we only allow
|
||||
* absolute paths that match t_thrd.proc_cxt.DataDir or u_sess->attr.attr_common.Log_directory.
|
||||
*/
|
||||
static char *convert_and_check_filename(text *arg, bool logAllowed)
|
||||
static char* convert_and_check_filename(text* arg, bool logAllowed)
|
||||
{
|
||||
char *filename = text_to_cstring(arg);
|
||||
char* filename = text_to_cstring(arg);
|
||||
|
||||
canonicalize_path(filename); /* May change the length of 'filename' */
|
||||
canonicalize_path(filename); /* filename can change length here */
|
||||
|
||||
if (is_absolute_path(filename)) {
|
||||
/* Disallow '/a/b/data/..' */
|
||||
if (path_contains_parent_reference(filename))
|
||||
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
(errmsg("reference to parent directory (\"..\") not allowed"))));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
(errmsg("reference to parent directory (\"..\") not allowed"))));
|
||||
|
||||
/*
|
||||
* Allow absolute paths if they are within t_thrd.proc_cxt.DataDir or u_sess->attr.attr_common.Log_directory.
|
||||
* However, if 'logAllowed' is false, absolute paths outside u_sess->attr.attr_common.Log_directory are
|
||||
* disallowed.
|
||||
* Allow absolute paths if within t_thrd.proc_cxt.DataDir or u_sess->attr.attr_common.Log_directory, even
|
||||
* though u_sess->attr.attr_common.Log_directory might be outside t_thrd.proc_cxt.DataDir.
|
||||
*/
|
||||
if (!path_is_prefix_of_path(t_thrd.proc_cxt.DataDir, filename) &&
|
||||
(!logAllowed || !is_absolute_path(u_sess->attr.attr_common.Log_directory) ||
|
||||
!path_is_prefix_of_path(u_sess->attr.attr_common.Log_directory, filename)))
|
||||
!path_is_prefix_of_path(u_sess->attr.attr_common.Log_directory, filename)))
|
||||
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("absolute path not allowed"))));
|
||||
} else if (!path_is_relative_and_below_cwd(filename))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("path must be in or below the current directory"))));
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("path must be in or below the current directory"))));
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
|
@ -99,9 +99,8 @@ static char *convert_and_check_filename(text *arg, bool logAllowed)
|
|||
static void requireSuperuser(void)
|
||||
{
|
||||
if (!superuser())
|
||||
// print the ERROR_REPORT
|
||||
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
(errmsg("only system admin may access generic file functions"))));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("only system admin may access generic file functions"))));
|
||||
}
|
||||
|
||||
/* ------------------------------------
|
||||
|
|
@ -110,67 +109,56 @@ static void requireSuperuser(void)
|
|||
|
||||
Datum pg_file_write(PG_FUNCTION_ARGS)
|
||||
{
|
||||
FILE *f = NULL; // File pointer for file operations
|
||||
char *filename = NULL; // File name
|
||||
text *data = NULL; // Data content
|
||||
int64 count = 0; // Number of bytes written
|
||||
FILE* f = NULL;
|
||||
char* filename = NULL;
|
||||
text* data = NULL;
|
||||
int64 count = 0;
|
||||
|
||||
requireSuperuser(); // Check if the current user is a superuser, and raise an error if not
|
||||
requireSuperuser();
|
||||
|
||||
filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false); // Get and validate the file name
|
||||
data = PG_GETARG_TEXT_P(1); // Get the data to be written
|
||||
filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false);
|
||||
data = PG_GETARG_TEXT_P(1);
|
||||
|
||||
if (!PG_GETARG_BOOL(2)) {
|
||||
struct stat fst;
|
||||
|
||||
// Check if the file already exists, and raise an error if it does
|
||||
if (stat(filename, &fst) >= 0)
|
||||
ereport(ERROR, (ERRCODE_DUPLICATE_FILE, errmsg("file \"%s\" exists", filename)));
|
||||
|
||||
// Open the file in write mode
|
||||
f = fopen(filename, "wb");
|
||||
} else {
|
||||
// Open the file in append mode
|
||||
} else
|
||||
f = fopen(filename, "ab");
|
||||
}
|
||||
|
||||
// Check if the file opening is successful, and raise an error if not
|
||||
if (!f)
|
||||
ereport(ERROR, (errcode_for_file_access(), errmsg("could not open file \"%s\" for writing: %m", filename)));
|
||||
|
||||
// If the data content is not empty, write the data to the file
|
||||
if (VARSIZE(data) != 0) {
|
||||
// Write the data content to the file and record the number of bytes written
|
||||
count = fwrite(VARDATA(data), 1, VARSIZE(data) - VARHDRSZ, f);
|
||||
|
||||
// Check if the write operation is successful, and raise an error if not
|
||||
if (count != VARSIZE(data) - VARHDRSZ)
|
||||
ereport(ERROR, (errcode_for_file_access(), errmsg("could not write file \"%s\": %m", filename)));
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
fclose(f); // Close the file
|
||||
|
||||
// Return the number of bytes successfully written
|
||||
PG_RETURN_INT64(count);
|
||||
}
|
||||
|
||||
Datum pg_file_rename(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *fn1, *fn2, *fn3; // File name variables
|
||||
int rc; // Return code for access operation
|
||||
char *fn1, *fn2, *fn3;
|
||||
int rc;
|
||||
|
||||
requireSuperuser(); // Check if the current user is a superuser, and raise an error if not
|
||||
requireSuperuser();
|
||||
|
||||
if (PG_ARGISNULL(0) || PG_ARGISNULL(1))
|
||||
PG_RETURN_NULL();
|
||||
|
||||
fn1 = convert_and_check_filename(PG_GETARG_TEXT_P(0), false); // Get and validate the source file name
|
||||
fn2 = convert_and_check_filename(PG_GETARG_TEXT_P(1), false); // Get and validate the destination file name
|
||||
|
||||
fn1 = convert_and_check_filename(PG_GETARG_TEXT_P(0), false);
|
||||
fn2 = convert_and_check_filename(PG_GETARG_TEXT_P(1), false);
|
||||
if (PG_ARGISNULL(2))
|
||||
fn3 = 0;
|
||||
else
|
||||
fn3 = convert_and_check_filename(PG_GETARG_TEXT_P(2), false); // Get and validate the backup file name
|
||||
fn3 = convert_and_check_filename(PG_GETARG_TEXT_P(2), false);
|
||||
|
||||
if (access(fn1, W_OK) < 0) {
|
||||
ereport(WARNING, (errcode_for_file_access(), errmsg("file \"%s\" is not accessible: %m", fn1)));
|
||||
|
|
@ -184,7 +172,7 @@ Datum pg_file_rename(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_BOOL(false);
|
||||
}
|
||||
|
||||
rc = access(fn3 ? fn3 : fn2, 2); // Check if the target file exists
|
||||
rc = access(fn3 ? fn3 : fn2, 2);
|
||||
if (rc >= 0 || errno != ENOENT) {
|
||||
ereport(ERROR, (ERRCODE_DUPLICATE_FILE, errmsg("cannot rename to target file \"%s\"", fn3 ? fn3 : fn2)));
|
||||
}
|
||||
|
|
@ -197,8 +185,8 @@ Datum pg_file_rename(PG_FUNCTION_ARGS)
|
|||
ereport(WARNING, (errcode_for_file_access(), errmsg("could not rename \"%s\" to \"%s\": %m", fn1, fn2)));
|
||||
|
||||
if (rename(fn3, fn2) != 0) {
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(), errmsg("could not rename \"%s\" back to \"%s\": %m", fn3, fn2)));
|
||||
ereport(
|
||||
ERROR, (errcode_for_file_access(), errmsg("could not rename \"%s\" back to \"%s\": %m", fn3, fn2)));
|
||||
} else {
|
||||
ereport(ERROR, (ERRCODE_UNDEFINED_FILE, errmsg("renaming \"%s\" to \"%s\" was reverted", fn2, fn3)));
|
||||
}
|
||||
|
|
@ -212,116 +200,111 @@ Datum pg_file_rename(PG_FUNCTION_ARGS)
|
|||
|
||||
Datum pg_file_unlink(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *filename = NULL; // File name variable
|
||||
char* filename = NULL;
|
||||
|
||||
requireSuperuser(); // Check if the current user is a superuser, and raise an error if not
|
||||
requireSuperuser();
|
||||
|
||||
filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false); // Get and validate the file name
|
||||
filename = convert_and_check_filename(PG_GETARG_TEXT_P(0), false);
|
||||
|
||||
if (access(filename, W_OK) < 0) {
|
||||
if (errno == ENOENT)
|
||||
PG_RETURN_BOOL(false); // Return false if the file does not exist
|
||||
PG_RETURN_BOOL(false);
|
||||
else
|
||||
ereport(ERROR, (errcode_for_file_access(), errmsg("file \"%s\" is not accessible: %m", filename)));
|
||||
// Raise an error if the file is not accessible
|
||||
}
|
||||
|
||||
if (unlink(filename) < 0) {
|
||||
ereport(WARNING, (errcode_for_file_access(), errmsg("could not unlink file \"%s\": %m", filename)));
|
||||
// Raise a warning with an error code if the file unlinking fails
|
||||
|
||||
PG_RETURN_BOOL(false); // Return false indicating the unlinking operation failed
|
||||
PG_RETURN_BOOL(false);
|
||||
}
|
||||
|
||||
PG_RETURN_BOOL(true); // Return true to indicate a successful unlinking operation
|
||||
PG_RETURN_BOOL(true);
|
||||
}
|
||||
|
||||
Datum pg_logdir_ls(PG_FUNCTION_ARGS)
|
||||
{
|
||||
FuncCallContext *funcctx = NULL; // Function call context
|
||||
struct dirent *de; // Directory entry
|
||||
directory_fctx *fctx = NULL; // Directory context
|
||||
FuncCallContext* funcctx = NULL;
|
||||
struct dirent* de;
|
||||
directory_fctx* fctx = NULL;
|
||||
|
||||
if (!superuser())
|
||||
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("only system admin can list the log directory"))));
|
||||
|
||||
ereport(
|
||||
ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("only system admin can list the log directory"))));
|
||||
|
||||
if (strcmp(u_sess->attr.attr_common.Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0)
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
(errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'"))));
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
(errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'"))));
|
||||
|
||||
if (SRF_IS_FIRSTCALL()) {
|
||||
MemoryContext oldcontext;
|
||||
TupleDesc tupdesc;
|
||||
|
||||
/* Initialize function call context and memory */
|
||||
|
||||
funcctx = SRF_FIRSTCALL_INIT();
|
||||
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
|
||||
|
||||
fctx = (directory_fctx *)palloc(sizeof(directory_fctx));
|
||||
|
||||
/* Create tuple descriptor */
|
||||
|
||||
fctx = (directory_fctx*)palloc(sizeof(directory_fctx));
|
||||
|
||||
tupdesc = CreateTemplateTupleDesc(2, false);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber)1, "starttime", TIMESTAMPOID, -1, 0);
|
||||
TupleDescInitEntry(tupdesc, (AttrNumber)2, "filename", TEXTOID, -1, 0);
|
||||
|
||||
|
||||
funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);
|
||||
|
||||
|
||||
fctx->location = pstrdup(u_sess->attr.attr_common.Log_directory);
|
||||
fctx->dirdesc = AllocateDir(fctx->location);
|
||||
|
||||
|
||||
if (!fctx->dirdesc)
|
||||
ereport(ERROR, (errcode_for_file_access(), errmsg("could not read directory \"%s\": %m", fctx->location)));
|
||||
|
||||
|
||||
funcctx->user_fctx = fctx;
|
||||
(void)MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
|
||||
/* Set up the function call context and directory context */
|
||||
|
||||
funcctx = SRF_PERCALL_SETUP();
|
||||
fctx = (directory_fctx *)funcctx->user_fctx;
|
||||
|
||||
/* Loop through directory entries */
|
||||
fctx = (directory_fctx*)funcctx->user_fctx;
|
||||
|
||||
while ((de = ReadDir(fctx->dirdesc, fctx->location)) != NULL) {
|
||||
char *values[2];
|
||||
char* values[2];
|
||||
HeapTuple tuple;
|
||||
char timestampbuf[32];
|
||||
char *field[MAXDATEFIELDS];
|
||||
char* field[MAXDATEFIELDS];
|
||||
char lowstr[MAXDATELEN + 1];
|
||||
int dtype;
|
||||
int nf, ftype[MAXDATEFIELDS];
|
||||
fsec_t fsec;
|
||||
int tz = 0;
|
||||
struct pg_tm date;
|
||||
|
||||
|
||||
/*
|
||||
* Default format: postgresql-YYYY-MM-DD_HHMMSS.log
|
||||
*/
|
||||
if (strlen(de->d_name) != 32 || strncmp(de->d_name, "postgresql-", 11) != 0 ||
|
||||
de->d_name[21] != '_' || strcmp(de->d_name + 28, ".log") != 0)
|
||||
if (strlen(de->d_name) != 32 || strncmp(de->d_name, "postgresql-", 11) != 0 || de->d_name[21] != '_' ||
|
||||
strcmp(de->d_name + 28, ".log") != 0)
|
||||
continue;
|
||||
|
||||
/* Extract timestamp portion of filename */
|
||||
|
||||
/* extract timestamp portion of filename */
|
||||
strcpy(timestampbuf, de->d_name + 11);
|
||||
timestampbuf[17] = '\0';
|
||||
|
||||
/* Parse and decode expected timestamp to verify it's a valid format */
|
||||
|
||||
/* parse and decode expected timestamp to verify it's OK format */
|
||||
if (ParseDateTime(timestampbuf, lowstr, MAXDATELEN, field, ftype, MAXDATEFIELDS, &nf))
|
||||
continue;
|
||||
|
||||
|
||||
if (DecodeDateTime(field, ftype, nf, &dtype, &date, &fsec, &tz))
|
||||
continue;
|
||||
|
||||
/* Timestamp is valid; prepare and return tuple */
|
||||
|
||||
/* Seems the timestamp is OK; prepare and return tuple */
|
||||
|
||||
values[0] = timestampbuf;
|
||||
values[1] = (char *)palloc(strlen(fctx->location) + strlen(de->d_name) + 2);
|
||||
values[1] = (char*)palloc(strlen(fctx->location) + strlen(de->d_name) + 2);
|
||||
sprintf(values[1], "%s/%s", fctx->location, de->d_name);
|
||||
|
||||
|
||||
tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
|
||||
|
||||
|
||||
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
|
||||
}
|
||||
|
||||
/* Clean up and return */
|
||||
|
||||
FreeDir(fctx->dirdesc);
|
||||
SRF_RETURN_DONE(funcctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ void _PG_init(void)
|
|||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
// Define common Boolean variables
|
||||
|
||||
DefineCustomBoolVariable("auto_explain.log_analyze",
|
||||
"Use EXPLAIN ANALYZE for plan logging.",
|
||||
NULL,
|
||||
|
|
@ -84,7 +84,6 @@ void _PG_init(void)
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
// Define common Boolean variables of auto_explain.log_verbose
|
||||
DefineCustomBoolVariable("auto_explain.log_verbose",
|
||||
"Use EXPLAIN VERBOSE for plan logging.",
|
||||
NULL,
|
||||
|
|
@ -96,7 +95,6 @@ void _PG_init(void)
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
// Define common Boolean variables of auto_explain.log_buffers
|
||||
DefineCustomBoolVariable("auto_explain.log_buffers",
|
||||
"Log buffers usage.",
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -87,13 +87,10 @@ static GBT_VARKEY* gbt_bit_l2n(GBT_VARKEY* leaf)
|
|||
static const gbtree_vinfo tinfo = {
|
||||
gbt_t_bit, 0, TRUE, gbt_bitgt, gbt_bitge, gbt_biteq, gbt_bitle, gbt_bitlt, gbt_bitcmp, gbt_bit_l2n};
|
||||
|
||||
/*
|
||||
* This function compresses a GIST entry using variable-length bitstrings.
|
||||
* The input is a pointer to a GISTENTRY struct.
|
||||
* The output is a pointer to the compressed data, which is obtained by calling
|
||||
* the gbt_var_compress function with the GISTENTRY pointer and a pointer to
|
||||
* the tinfo struct.
|
||||
*/
|
||||
/**************************************************
|
||||
* Bit ops
|
||||
**************************************************/
|
||||
|
||||
Datum gbt_bit_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -101,20 +98,6 @@ Datum gbt_bit_compress(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo));
|
||||
}
|
||||
|
||||
/*
|
||||
* This function checks if a GIST entry is consistent with a query using
|
||||
* variable-length bitstrings. The input is a pointer to a GISTENTRY struct,
|
||||
* a pointer to the query data, and a strategy number. The output is a boolean
|
||||
* value indicating whether the entry is consistent with the query.
|
||||
*
|
||||
* The function also sets a flag indicating whether a recheck is needed, but
|
||||
* this flag is always set to false for all cases served by this function.
|
||||
*
|
||||
* If the entry is a leaf node, the function calls gbt_var_consistent with
|
||||
* the readable key of the entry and the query data. Otherwise, the function
|
||||
* transforms the query data using gbt_bit_xfrm and calls gbt_var_consistent
|
||||
* with the readable key of the entry and the transformed query data.
|
||||
*/
|
||||
Datum gbt_bit_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -139,15 +122,6 @@ Datum gbt_bit_consistent(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_BOOL(retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function performs a union of a set of GIST entries using
|
||||
* variable-length bitstrings. The input is a pointer to a GistEntryVector
|
||||
* struct and a pointer to an integer that will hold the size of the resulting
|
||||
* union. The output is a pointer to the union of the entries.
|
||||
*
|
||||
* The function calls gbt_var_union with the GistEntryVector, the collation,
|
||||
* and a pointer to the tinfo struct.
|
||||
*/
|
||||
Datum gbt_bit_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -156,16 +130,6 @@ Datum gbt_bit_union(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(), &tinfo));
|
||||
}
|
||||
|
||||
/*
|
||||
* This function performs a picksplit operation on a set of GIST entries using
|
||||
* variable-length bitstrings. The input is a pointer to a GistEntryVector
|
||||
* struct and a pointer to a GIST_SPLITVEC struct that will hold the results
|
||||
* of the picksplit operation. The output is a pointer to the GIST_SPLITVEC
|
||||
* struct.
|
||||
*
|
||||
* The function calls gbt_var_picksplit with the GistEntryVector, the GIST_SPLITVEC
|
||||
* struct, the collation, and a pointer to the tinfo struct.
|
||||
*/
|
||||
Datum gbt_bit_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -175,16 +139,6 @@ Datum gbt_bit_picksplit(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(v);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function checks if two variable-length bitstrings are the same. The input
|
||||
* is two Datums representing the bitstrings and a pointer to a boolean variable
|
||||
* that will hold the result of the comparison. The output is a pointer to the
|
||||
* boolean variable.
|
||||
*
|
||||
* The function calls gbt_var_same with the two Datums, the collation, and a
|
||||
* pointer to the tinfo struct. The result of the comparison is stored in the
|
||||
* boolean variable pointed to by the input argument.
|
||||
*/
|
||||
Datum gbt_bit_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Datum d1 = PG_GETARG_DATUM(0);
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
/*
|
||||
* contrib/btree_gist/btree_gist.c
|
||||
*/
|
||||
#include "postgres.h" // Include the PostgreSQL database header file
|
||||
#include "knl/knl_variable.h" // Include the knl_variable.h header file, which may contain internal variable definitions
|
||||
|
||||
#include "btree_gist.h" // Include the btree_gist.h header file, which defines the data structures and function prototypes required for B-tree GiST indexing
|
||||
|
||||
PG_MODULE_MAGIC; // Macro definition to identify this as a PostgreSQL module
|
||||
|
||||
PG_FUNCTION_INFO_V1(gbt_decompress); // Macro definition to declare a PostgreSQL function, gbt_decompress, with version 1 information
|
||||
PG_FUNCTION_INFO_V1(gbtreekey_in); // Macro definition to declare a PostgreSQL function, gbtreekey_in, with version 1 information
|
||||
PG_FUNCTION_INFO_V1(gbtreekey_out); // Macro definition to declare a PostgreSQL function, gbtreekey_out, with version 1 information
|
||||
|
||||
extern "C" Datum gbt_decompress(PG_FUNCTION_ARGS); // Define a C function named gbt_decompress that returns a Datum type and accepts PG_FUNCTION_ARGS parameters
|
||||
|
||||
/**************************************************
|
||||
* In/Out for keys
|
||||
**************************************************/
|
||||
|
||||
Datum gbtreekey_in(PG_FUNCTION_ARGS) // Define a function named gbtreekey_in that returns a Datum type and accepts PG_FUNCTION_ARGS parameters
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("<datatype>key_in() not implemented"))); // If the function is called, output an error message indicating that the feature is not supported
|
||||
|
||||
PG_RETURN_POINTER(NULL); // Return a null pointer, indicating that there is no return value
|
||||
}
|
||||
|
||||
#include "btree_utils_var.h" // Include the btree_utils_var.h header file, which may contain auxiliary functions and variables related to B-trees
|
||||
#include "utils/builtins.h" // Include the builtins.h header file, which may contain definitions related to built-in functions
|
||||
Datum gbtreekey_out(PG_FUNCTION_ARGS) // Define the gbtreekey_out function, which converts internal keys to output form and returns a Datum type result
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("<datatype>key_out() not implemented"))); // If the function is called, output an error message indicating that the feature is not supported
|
||||
PG_RETURN_POINTER(NULL); // Return a null pointer, indicating that there is no return value
|
||||
}
|
||||
|
||||
/*
|
||||
** GiST DeCompress methods
|
||||
** do not do anything.
|
||||
*/
|
||||
Datum gbt_decompress(PG_FUNCTION_ARGS) // Define the gbt_decompress function, which decompresses GiST keys and returns a Datum type result
|
||||
{
|
||||
PG_RETURN_POINTER(PG_GETARG_POINTER(0)); // Directly return the pointer to the input argument as the result, without performing any decompression operations
|
||||
}
|
||||
/*
|
||||
* contrib/btree_gist/btree_gist.c
|
||||
*/
|
||||
#include "postgres.h"
|
||||
#include "knl/knl_variable.h"
|
||||
|
||||
#include "btree_gist.h"
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
PG_FUNCTION_INFO_V1(gbt_decompress);
|
||||
PG_FUNCTION_INFO_V1(gbtreekey_in);
|
||||
PG_FUNCTION_INFO_V1(gbtreekey_out);
|
||||
|
||||
extern "C" Datum gbt_decompress(PG_FUNCTION_ARGS);
|
||||
|
||||
/**************************************************
|
||||
* In/Out for keys
|
||||
**************************************************/
|
||||
|
||||
Datum gbtreekey_in(PG_FUNCTION_ARGS)
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("<datatype>key_in() not implemented")));
|
||||
|
||||
PG_RETURN_POINTER(NULL);
|
||||
}
|
||||
|
||||
#include "btree_utils_var.h"
|
||||
#include "utils/builtins.h"
|
||||
Datum gbtreekey_out(PG_FUNCTION_ARGS)
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("<datatype>key_out() not implemented")));
|
||||
PG_RETURN_POINTER(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** GiST DeCompress methods
|
||||
** do not do anything.
|
||||
*/
|
||||
Datum gbt_decompress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(PG_GETARG_POINTER(0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,17 +138,6 @@ Datum gbt_inet_picksplit(PG_FUNCTION_ARGS)
|
|||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
/*
|
||||
function name: gbt_inet_same
|
||||
description:
|
||||
This function checks whether two inet keys are equal. The input is two
|
||||
inetKEY pointers representing the keys to compare, and a pointer to a boolean
|
||||
to hold the result. The output is a pointer to the boolean result.
|
||||
The function calls gbt_num_same with the two keys and a pointer to the tinfo
|
||||
struct. The result of the comparison is stored in the result pointer and
|
||||
returned.
|
||||
|
||||
*/
|
||||
Datum gbt_inet_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
inetKEY* b1 = (inetKEY*)PG_GETARG_POINTER(0);
|
||||
|
|
|
|||
|
|
@ -132,21 +132,6 @@ Datum gbt_int2_consistent(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
/*
|
||||
function name: gbt_int2_distance
|
||||
description:
|
||||
This function calculates the distance between an int2 key and a query value.
|
||||
The input is a GISTENTRY pointer representing the key, and an int16 value
|
||||
representing the query. The output is a float8 value representing the
|
||||
distance between the key and the query.
|
||||
|
||||
The function extracts the lower and upper bounds of the int2 key and stores
|
||||
them in a GBT_NUMKEY_R struct. It then calls gbt_num_distance with the key,
|
||||
the query value, a boolean indicating whether the key is a leaf node, and a
|
||||
pointer to the tinfo struct. The result of the distance calculation is
|
||||
returned as a float8 value.
|
||||
|
||||
*/
|
||||
Datum gbt_int2_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -187,18 +172,6 @@ Datum gbt_int2_picksplit(PG_FUNCTION_ARGS)
|
|||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
/*
|
||||
function name: gbt_int2_same
|
||||
description:
|
||||
This function checks whether two int2 keys are the same.
|
||||
The input is two pointers to int16KEY structs representing the keys,
|
||||
and a pointer to a boolean variable to store the result.
|
||||
The output is a pointer to the boolean variable.
|
||||
|
||||
The function calls gbt_num_same with the two keys, and a pointer to the tinfo
|
||||
struct. The result of the comparison is stored in the boolean variable
|
||||
pointed to by the result argument, and a pointer to this variable is returned.
|
||||
*/
|
||||
Datum gbt_int2_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int16KEY* b1 = (int16KEY*)PG_GETARG_POINTER(0);
|
||||
|
|
|
|||
|
|
@ -15,211 +15,169 @@ typedef struct int32key {
|
|||
/*
|
||||
** int32 ops
|
||||
*/
|
||||
// Define a set of function info macros for the different GiST functions.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_compress); // Compress function for GiST index.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_union); // Union function for GiST index.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_picksplit); // Picksplit function for GiST index.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_consistent);// Consistent function for GiST index.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_distance); // Distance function for GiST index.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_penalty); // Penalty function for GiST index.
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_same); // Same function for GiST index.
|
||||
|
||||
// Declare the different GiST functions.
|
||||
extern "C" Datum gbt_int4_compress(PG_FUNCTION_ARGS); // Compress function.
|
||||
extern "C" Datum gbt_int4_union(PG_FUNCTION_ARGS); // Union function.
|
||||
extern "C" Datum gbt_int4_picksplit(PG_FUNCTION_ARGS); // Picksplit function.
|
||||
extern "C" Datum gbt_int4_consistent(PG_FUNCTION_ARGS);// Consistent function.
|
||||
extern "C" Datum gbt_int4_distance(PG_FUNCTION_ARGS); // Distance function.
|
||||
extern "C" Datum gbt_int4_penalty(PG_FUNCTION_ARGS); // Penalty function.
|
||||
extern "C" Datum gbt_int4_same(PG_FUNCTION_ARGS); // Same function.
|
||||
|
||||
// Define a set of comparison functions for integers.
|
||||
static bool gbt_int4gt(const void* a, const void* b) // Greater than comparison.
|
||||
{
|
||||
return (*((const int32*)a) > *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4ge(const void* a, const void* b) // Greater than or equal to comparison.
|
||||
{
|
||||
return (*((const int32*)a) >= *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4eq(const void* a, const void* b) // Equal to comparison.
|
||||
{
|
||||
return (*((const int32*)a) == *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4le(const void* a, const void* b) // Less than or equal to comparison.
|
||||
{
|
||||
return (*((const int32*)a) <= *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4lt(const void* a, const void* b) // Less than comparison.
|
||||
{
|
||||
return (*((const int32*)a) < *((const int32*)b));
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_compress);
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_union);
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_picksplit);
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_consistent);
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_distance);
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_penalty);
|
||||
PG_FUNCTION_INFO_V1(gbt_int4_same);
|
||||
|
||||
extern "C" Datum gbt_int4_compress(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int4_union(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int4_picksplit(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int4_consistent(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int4_distance(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int4_penalty(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int4_same(PG_FUNCTION_ARGS);
|
||||
|
||||
static bool gbt_int4gt(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int32*)a) > *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4ge(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int32*)a) >= *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4eq(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int32*)a) == *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4le(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int32*)a) <= *((const int32*)b));
|
||||
}
|
||||
static bool gbt_int4lt(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int32*)a) < *((const int32*)b));
|
||||
}
|
||||
|
||||
// Define a function that compares two integer keys.
|
||||
static int gbt_int4key_cmp(const void* a, const void* b)
|
||||
{
|
||||
// Cast the input pointers to their actual types.
|
||||
int32KEY* ia = (int32KEY*)(((const Nsrt*)a)->t);
|
||||
int32KEY* ib = (int32KEY*)(((const Nsrt*)b)->t);
|
||||
|
||||
// Compare the lower bounds first. If they are equal...
|
||||
if (ia->lower == ib->lower) {
|
||||
// Compare the upper bounds. If they are equal...
|
||||
if (ia->upper == ib->upper)
|
||||
return 0; // Return 0 if both are equal.
|
||||
|
||||
// Return 1 or -1 depending on which upper bound is greater.
|
||||
return (ia->upper > ib->upper) ? 1 : -1;
|
||||
}
|
||||
|
||||
// Return 1 or -1 depending on which lower bound is greater.
|
||||
return (ia->lower > ib->lower) ? 1 : -1;
|
||||
}
|
||||
|
||||
// Define a function that calculates the distance between two integer keys.
|
||||
static float8 gbt_int4_dist(const void* a, const void* b)
|
||||
{
|
||||
// Use a macro to calculate the distance between the two integers.
|
||||
return GET_FLOAT_DISTANCE(int4, a, b);
|
||||
}
|
||||
|
||||
// Define a structure with information about the integer keys.
|
||||
static const gbtree_ninfo tinfo = {gbt_t_int4,
|
||||
sizeof(int32),
|
||||
gbt_int4gt,
|
||||
gbt_int4ge,
|
||||
gbt_int4eq,
|
||||
gbt_int4le,
|
||||
gbt_int4lt,
|
||||
gbt_int4key_cmp,
|
||||
gbt_int4_dist};
|
||||
|
||||
// Declare the function that will calculate the distance between two integers.
|
||||
PG_FUNCTION_INFO_V1(int4_dist);
|
||||
extern "C" Datum int4_dist(PG_FUNCTION_ARGS);
|
||||
Datum int4_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the two integer arguments.
|
||||
int4 a = PG_GETARG_INT32(0);
|
||||
int4 b = PG_GETARG_INT32(1);
|
||||
int4 r;
|
||||
int4 ra;
|
||||
|
||||
// Calculate the difference between the two integers.
|
||||
r = a - b;
|
||||
ra = Abs(r); // Calculate the absolute value of the difference.
|
||||
|
||||
/* Check for overflow. */
|
||||
if (ra < 0 || (!SAMESIGN(a, b) && !SAMESIGN(r, a)))
|
||||
ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("integer out of range"))); // Report an error if there is an overflow.
|
||||
|
||||
// Return the absolute value of the difference.
|
||||
PG_RETURN_INT32(ra);
|
||||
static int gbt_int4key_cmp(const void* a, const void* b)
|
||||
{
|
||||
int32KEY* ia = (int32KEY*)(((const Nsrt*)a)->t);
|
||||
int32KEY* ib = (int32KEY*)(((const Nsrt*)b)->t);
|
||||
|
||||
if (ia->lower == ib->lower) {
|
||||
if (ia->upper == ib->upper)
|
||||
return 0;
|
||||
|
||||
return (ia->upper > ib->upper) ? 1 : -1;
|
||||
}
|
||||
|
||||
return (ia->lower > ib->lower) ? 1 : -1;
|
||||
}
|
||||
|
||||
static float8 gbt_int4_dist(const void* a, const void* b)
|
||||
{
|
||||
return GET_FLOAT_DISTANCE(int4, a, b);
|
||||
}
|
||||
|
||||
static const gbtree_ninfo tinfo = {gbt_t_int4,
|
||||
sizeof(int32),
|
||||
gbt_int4gt,
|
||||
gbt_int4ge,
|
||||
gbt_int4eq,
|
||||
gbt_int4le,
|
||||
gbt_int4lt,
|
||||
gbt_int4key_cmp,
|
||||
gbt_int4_dist};
|
||||
|
||||
PG_FUNCTION_INFO_V1(int4_dist);
|
||||
extern "C" Datum int4_dist(PG_FUNCTION_ARGS);
|
||||
Datum int4_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int4 a = PG_GETARG_INT32(0);
|
||||
int4 b = PG_GETARG_INT32(1);
|
||||
int4 r;
|
||||
int4 ra;
|
||||
|
||||
r = a - b;
|
||||
ra = Abs(r);
|
||||
|
||||
/* Overflow check. */
|
||||
if (ra < 0 || (!SAMESIGN(a, b) && !SAMESIGN(r, a)))
|
||||
ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("integer out of range")));
|
||||
|
||||
PG_RETURN_INT32(ra);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* int32 ops
|
||||
**************************************************/
|
||||
|
||||
// Define a function that compresses a GiST entry.
|
||||
Datum gbt_int4_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the GiST entry from the function arguments.
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
// Compress the GiST entry and return the result.
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
// Define a function that checks if a GiST entry is consistent with a query value.
|
||||
Datum gbt_int4_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the GiST entry, query value, strategy number, and output buffer from the function arguments.
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
int32 query = PG_GETARG_INT32(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
int32KEY* kkk = (int32KEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
// Set the recheck flag to false, indicating that all cases served by this function are exact.
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
// Check if the GiST entry is consistent with the query value and return the result.
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
Datum gbt_int4_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
// Define a function that calculates the distance between two GiST entries.
|
||||
Datum gbt_int4_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the GiST entry and query value from the function arguments.
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
int32 query = PG_GETARG_INT32(1);
|
||||
|
||||
// Extract the lower and upper bounds from the GiST entry.
|
||||
int32KEY* kkk = (int32KEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
// Calculate and return the distance between the GiST entry and the query value.
|
||||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
// Define a function that calculates the union of a set of GiST entries.
|
||||
Datum gbt_int4_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the vector of GiST entries and output buffer from the function arguments.
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(int32KEY));
|
||||
|
||||
// Set the size of the output buffer.
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(int32KEY);
|
||||
|
||||
// Calculate and return the union of the set of GiST entries.
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
// Define a function that calculates the penalty for splitting a set of GiST entries.
|
||||
Datum gbt_int4_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the original and new GiST entries, as well as the output buffer, from the function arguments.
|
||||
int32KEY* origentry = (int32KEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
int32KEY* newentry = (int32KEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Calculate the penalty for splitting the set of GiST entries.
|
||||
penalty_num(result, origentry->lower, origentry->upper, newentry->lower, newentry->upper);
|
||||
|
||||
// Return the calculated penalty.
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Define a function that selects which GiST entries to split.
|
||||
Datum gbt_int4_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Select which GiST entries to split and return the result.
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
// Define a function that checks if two GiST entries are equal.
|
||||
Datum gbt_int4_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the two GiST entries and output buffer from the function arguments.
|
||||
int32KEY* b1 = (int32KEY*)PG_GETARG_POINTER(0);
|
||||
int32KEY* b2 = (int32KEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Check if the two GiST entries are equal and store the result in the output buffer.
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
|
||||
// Return the output buffer.
|
||||
PG_RETURN_POINTER(result);
|
||||
Datum gbt_int4_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
int32 query = PG_GETARG_INT32(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
int32KEY* kkk = (int32KEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_int4_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
int32 query = PG_GETARG_INT32(1);
|
||||
|
||||
int32KEY* kkk = (int32KEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_int4_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(int32KEY));
|
||||
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(int32KEY);
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_int4_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int32KEY* origentry = (int32KEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
int32KEY* newentry = (int32KEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
penalty_num(result, origentry->lower, origentry->upper, newentry->lower, newentry->upper);
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
Datum gbt_int4_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_int4_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int32KEY* b1 = (int32KEY*)PG_GETARG_POINTER(0);
|
||||
int32KEY* b2 = (int32KEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,130 +1,110 @@
|
|||
/*
|
||||
* contrib/btree_gist/btree_int8.c
|
||||
*/
|
||||
// Include the PostgreSQL header file, which contains all the basic PostgreSQL data types and function definitions.
|
||||
#include "postgres.h"
|
||||
// Include the knl/knl_variable.h header file, which is part of the PostgreSQL kernel and contains the definitions of some internal variables and functions.
|
||||
#include "knl/knl_variable.h"
|
||||
|
||||
// Include the btree_gist.h header file, which defines the B-tree structure used to implement the GiST index.
|
||||
#include "btree_gist.h"
|
||||
// Include the btree_utils_num.h header file, which contains some utility functions for operating on B-trees.
|
||||
#include "btree_utils_num.h"
|
||||
|
||||
// Define a structure int64key for storing the lower and upper bounds of a 64-bit integer.
|
||||
typedef struct int64key {
|
||||
// The lower bound of the 64-bit integer.
|
||||
int64 lower;
|
||||
// The upper bound of the 64-bit integer.
|
||||
int64 upper;
|
||||
} int64KEY;
|
||||
|
||||
/*
|
||||
** int64 ops
|
||||
*/
|
||||
// Define a series of function info macros, which are used to register functions in PostgreSQL.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_compress); // Compression function.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_union); // Merging function.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_picksplit); // Splitting function.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_consistent);// Consistency check function.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_distance); // Distance function.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_penalty); // Penalty function.
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_same); // Sameness check function.
|
||||
|
||||
// Define a series of function prototypes, which are used to implement different operations on the GiST index.
|
||||
extern "C" Datum gbt_int8_compress(PG_FUNCTION_ARGS); // Compression function.
|
||||
extern "C" Datum gbt_int8_union(PG_FUNCTION_ARGS); // Merging function.
|
||||
extern "C" Datum gbt_int8_picksplit(PG_FUNCTION_ARGS); // Splitting function.
|
||||
extern "C" Datum gbt_int8_consistent(PG_FUNCTION_ARGS);// Consistency check function.
|
||||
extern "C" Datum gbt_int8_distance(PG_FUNCTION_ARGS); // Distance function.
|
||||
extern "C" Datum gbt_int8_penalty(PG_FUNCTION_ARGS); // Penalty function.
|
||||
extern "C" Datum gbt_int8_same(PG_FUNCTION_ARGS); // Sameness check function.
|
||||
|
||||
// Define a series of comparison functions, which are used to compare the sizes of two 64-bit integers.
|
||||
static bool gbt_int8gt(const void* a, const void* b) // Greater than comparison.
|
||||
{
|
||||
return (*((const int64*)a) > *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8ge(const void* a, const void* b) // Greater than or equal to comparison.
|
||||
{
|
||||
return (*((const int64*)a) >= *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8eq(const void* a, const void* b) // Equal to comparison.
|
||||
{
|
||||
return (*((const int64*)a) == *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8le(const void* a, const void* b) // Less than or equal to comparison.
|
||||
{
|
||||
return (*((const int64*)a) <= *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8lt(const void* a, const void* b) // Less than comparison.
|
||||
{
|
||||
return (*((const int64*)a) < *((const int64*)b));
|
||||
#include "postgres.h"
|
||||
#include "knl/knl_variable.h"
|
||||
|
||||
#include "btree_gist.h"
|
||||
#include "btree_utils_num.h"
|
||||
|
||||
typedef struct int64key {
|
||||
int64 lower;
|
||||
int64 upper;
|
||||
} int64KEY;
|
||||
|
||||
/*
|
||||
** int64 ops
|
||||
*/
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_compress);
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_union);
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_picksplit);
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_consistent);
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_distance);
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_penalty);
|
||||
PG_FUNCTION_INFO_V1(gbt_int8_same);
|
||||
|
||||
extern "C" Datum gbt_int8_compress(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int8_union(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int8_picksplit(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int8_consistent(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int8_distance(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int8_penalty(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_int8_same(PG_FUNCTION_ARGS);
|
||||
|
||||
static bool gbt_int8gt(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int64*)a) > *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8ge(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int64*)a) >= *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8eq(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int64*)a) == *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8le(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int64*)a) <= *((const int64*)b));
|
||||
}
|
||||
static bool gbt_int8lt(const void* a, const void* b)
|
||||
{
|
||||
return (*((const int64*)a) < *((const int64*)b));
|
||||
}
|
||||
|
||||
// Define a function to compare two 64-bit integers.
|
||||
static int gbt_int8key_cmp(const void* a, const void* b)
|
||||
{
|
||||
// Cast the input pointers to their original types.
|
||||
int64KEY* ia = (int64KEY*)(((const Nsrt*)a)->t);
|
||||
int64KEY* ib = (int64KEY*)(((const Nsrt*)b)->t);
|
||||
|
||||
// Compare the lower bounds first. If they are equal, compare the upper bounds.
|
||||
if (ia->lower == ib->lower) {
|
||||
if (ia->upper == ib->upper)
|
||||
return 0; // Return 0 if both are equal.
|
||||
|
||||
return (ia->upper > ib->upper) ? 1 : -1; // Return 1 if ia->upper is greater than ib->upper, else return -1.
|
||||
}
|
||||
|
||||
return (ia->lower > ib->lower) ? 1 : -1; // Return 1 if ia->lower is greater than ib->lower, else return -1.
|
||||
}
|
||||
|
||||
// Define a function to calculate the distance between two 64-bit integers.
|
||||
static float8 gbt_int8_dist(const void* a, const void* b)
|
||||
{
|
||||
// Use the macro GET_FLOAT_DISTANCE to calculate the distance.
|
||||
return GET_FLOAT_DISTANCE(int64, a, b);
|
||||
}
|
||||
|
||||
// Define a structure to store the information about the GiST index.
|
||||
static const gbtree_ninfo tinfo = {gbt_t_int8,
|
||||
sizeof(int64),
|
||||
gbt_int8gt,
|
||||
gbt_int8ge,
|
||||
gbt_int8eq,
|
||||
gbt_int8le,
|
||||
gbt_int8lt,
|
||||
gbt_int8key_cmp,
|
||||
gbt_int8_dist};
|
||||
|
||||
// Register the int8_dist function in PostgreSQL.
|
||||
PG_FUNCTION_INFO_V1(int8_dist);
|
||||
extern "C" Datum int8_dist(PG_FUNCTION_ARGS);
|
||||
Datum int8_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the input arguments.
|
||||
int64 a = PG_GETARG_INT64(0);
|
||||
int64 b = PG_GETARG_INT64(1);
|
||||
int64 r;
|
||||
int64 ra;
|
||||
|
||||
// Calculate the difference between a and b.
|
||||
r = a - b;
|
||||
ra = Abs(r); // Calculate the absolute value of r.
|
||||
|
||||
/* Check for overflow. */
|
||||
if (ra < 0 || (!SAMESIGN(a, b) && !SAMESIGN(r, a)))
|
||||
ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range"))); // Report an error if there is an overflow.
|
||||
|
||||
// Return the absolute value of the difference.
|
||||
PG_RETURN_INT64(ra);
|
||||
static int gbt_int8key_cmp(const void* a, const void* b)
|
||||
{
|
||||
int64KEY* ia = (int64KEY*)(((const Nsrt*)a)->t);
|
||||
int64KEY* ib = (int64KEY*)(((const Nsrt*)b)->t);
|
||||
|
||||
if (ia->lower == ib->lower) {
|
||||
if (ia->upper == ib->upper)
|
||||
return 0;
|
||||
|
||||
return (ia->upper > ib->upper) ? 1 : -1;
|
||||
}
|
||||
|
||||
return (ia->lower > ib->lower) ? 1 : -1;
|
||||
}
|
||||
|
||||
static float8 gbt_int8_dist(const void* a, const void* b)
|
||||
{
|
||||
return GET_FLOAT_DISTANCE(int64, a, b);
|
||||
}
|
||||
|
||||
static const gbtree_ninfo tinfo = {gbt_t_int8,
|
||||
sizeof(int64),
|
||||
gbt_int8gt,
|
||||
gbt_int8ge,
|
||||
gbt_int8eq,
|
||||
gbt_int8le,
|
||||
gbt_int8lt,
|
||||
gbt_int8key_cmp,
|
||||
gbt_int8_dist};
|
||||
|
||||
PG_FUNCTION_INFO_V1(int8_dist);
|
||||
extern "C" Datum int8_dist(PG_FUNCTION_ARGS);
|
||||
Datum int8_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int64 a = PG_GETARG_INT64(0);
|
||||
int64 b = PG_GETARG_INT64(1);
|
||||
int64 r;
|
||||
int64 ra;
|
||||
|
||||
r = a - b;
|
||||
ra = Abs(r);
|
||||
|
||||
/* Overflow check. */
|
||||
if (ra < 0 || (!SAMESIGN(a, b) && !SAMESIGN(r, a)))
|
||||
ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range")));
|
||||
|
||||
PG_RETURN_INT64(ra);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* int64 ops
|
||||
**************************************************/
|
||||
|
||||
/* gbt_int8_compress - compresses a GIST entry containing an int8 key */
|
||||
Datum gbt_int8_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -133,7 +113,6 @@ Datum gbt_int8_compress(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
/* gbt_int8_consistent - checks if a query is consistent with an int8 key */
|
||||
Datum gbt_int8_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -153,7 +132,6 @@ Datum gbt_int8_consistent(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
/* gbt_int8_distance - calculates the distance between an int8 key and a query */
|
||||
Datum gbt_int8_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -168,7 +146,6 @@ Datum gbt_int8_distance(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
/* gbt_int8_union - performs a union on a vector of int8 keys */
|
||||
Datum gbt_int8_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -178,7 +155,6 @@ Datum gbt_int8_union(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
/* gbt_int8_penalty - calculates the penalty for splitting an int8 key */
|
||||
Datum gbt_int8_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int64KEY* origentry = (int64KEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
|
|
@ -190,14 +166,12 @@ Datum gbt_int8_penalty(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
/* gbt_int8_picksplit - performs a picksplit on a GIST entry vector */
|
||||
Datum gbt_int8_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
/* gbt_int8_same - checks if two int8 keys are the same */
|
||||
Datum gbt_int8_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int64KEY* b1 = (int64KEY*)PG_GETARG_POINTER(0);
|
||||
|
|
@ -206,4 +180,4 @@ Datum gbt_int8_same(PG_FUNCTION_ARGS)
|
|||
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,169 +31,134 @@ extern "C" Datum gbt_macad_consistent(PG_FUNCTION_ARGS);
|
|||
extern "C" Datum gbt_macad_penalty(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_macad_same(PG_FUNCTION_ARGS);
|
||||
|
||||
// Define a function to compare two macaddr values.
|
||||
static bool gbt_macadgt(const void* a, const void* b)
|
||||
{
|
||||
// Use the macaddr_gt function to compare the input pointers and return the result as a boolean value.
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_gt, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a function to compare two macaddr values.
|
||||
static bool gbt_macadge(const void* a, const void* b)
|
||||
{
|
||||
// Use the macaddr_ge function to compare the input pointers and return the result as a boolean value.
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_ge, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a function to compare two macaddr values.
|
||||
static bool gbt_macadeq(const void* a, const void* b)
|
||||
{
|
||||
// Use the macaddr_eq function to compare the input pointers and return the result as a boolean value.
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_eq, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a function to compare two macaddr values.
|
||||
static bool gbt_macadle(const void* a, const void* b)
|
||||
{
|
||||
// Use the macaddr_le function to compare the input pointers and return the result as a boolean value.
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_le, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a function to compare two macaddr values.
|
||||
static bool gbt_macadlt(const void* a, const void* b)
|
||||
{
|
||||
// Use the macaddr_lt function to compare the input pointers and return the result as a boolean value.
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_lt, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a function to compare two macaddr keys.
|
||||
static int gbt_macadkey_cmp(const void* a, const void* b)
|
||||
{
|
||||
// Cast the input pointers to their original types.
|
||||
macKEY* ia = (macKEY*)(((const Nsrt*)a)->t);
|
||||
macKEY* ib = (macKEY*)(((const Nsrt*)b)->t);
|
||||
int res;
|
||||
|
||||
// Compare the lower bounds first. If they are equal, compare the upper bounds.
|
||||
res = DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->lower), MacaddrPGetDatum(&ib->lower)));
|
||||
if (res == 0)
|
||||
return DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->upper), MacaddrPGetDatum(&ib->upper)));
|
||||
|
||||
return res; // Return the result of the comparison.
|
||||
static bool gbt_macadgt(const void* a, const void* b)
|
||||
{
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_gt, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
static bool gbt_macadge(const void* a, const void* b)
|
||||
{
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_ge, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a structure to store the information about the GiST index.
|
||||
static const gbtree_ninfo tinfo = {gbt_t_macad,
|
||||
sizeof(macaddr),
|
||||
gbt_macadgt,
|
||||
gbt_macadge,
|
||||
gbt_macadeq,
|
||||
gbt_macadle,
|
||||
gbt_macadlt,
|
||||
gbt_macadkey_cmp,
|
||||
NULL};
|
||||
|
||||
/**************************************************
|
||||
* macaddr ops
|
||||
**************************************************/
|
||||
|
||||
// Define a function to convert a macaddr to a uint64.
|
||||
static uint64 mac_2_uint64(macaddr* m)
|
||||
{
|
||||
unsigned char* mi = (unsigned char*)m;
|
||||
uint64 res = 0;
|
||||
int i;
|
||||
|
||||
// Loop through each byte of the macaddr and shift it to the correct position.
|
||||
for (i = 0; i < 6; i++)
|
||||
res += (((uint64)mi[i]) << ((uint64)((5 - i) * 8)));
|
||||
return res;
|
||||
}
|
||||
|
||||
// Define a function to compress a GiST entry.
|
||||
Datum gbt_macad_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
// Use the gbt_num_compress function to compress the entry and return it.
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
// Define a function to check the consistency of a GiST entry.
|
||||
Datum gbt_macad_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
macaddr* query = (macaddr*)PG_GETARG_POINTER(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
macKEY* kkk = (macKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
// All cases served by this function are exact, so set *recheck to false.
|
||||
*recheck = false;
|
||||
|
||||
// Set the lower and upper bounds of the key.
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
// Use the gbt_num_consistent function to check the consistency of the entry and return the result.
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
static bool gbt_macadeq(const void* a, const void* b)
|
||||
{
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_eq, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
// Define a function to union GiST entries.
|
||||
Datum gbt_macad_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(macKEY));
|
||||
|
||||
// Set the size of the output to the size of a macKEY.
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(macKEY);
|
||||
|
||||
// Use the gbt_num_union function to union the entries and return the result.
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
// Define a function to calculate the penalty of GiST entries.
|
||||
Datum gbt_macad_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
macKEY* origentry = (macKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
macKEY* newentry = (macKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
uint64 iorg[2], inew[2];
|
||||
|
||||
// Convert the original and new entries to uint64.
|
||||
iorg[0] = mac_2_uint64(&origentry->lower);
|
||||
iorg[1] = mac_2_uint64(&origentry->upper);
|
||||
inew[0] = mac_2_uint64(&newentry->lower);
|
||||
inew[1] = mac_2_uint64(&newentry->upper);
|
||||
|
||||
// Calculate the penalty and store it in the result.
|
||||
penalty_num(result, iorg[0], iorg[1], inew[0], inew[1]);
|
||||
|
||||
// Return the result.
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Define a function to pick a split point for GiST entries.
|
||||
Datum gbt_macad_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Use the gbt_num_picksplit function to pick a split point and return the result.
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
// Define a function to check if two GiST entries are the same.
|
||||
Datum gbt_macad_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
macKEY* b1 = (macKEY*)PG_GETARG_POINTER(0);
|
||||
macKEY* b2 = (macKEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Use the gbt_num_same function to check if the two entries are the same and store the result.
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
|
||||
// Return the result.
|
||||
PG_RETURN_POINTER(result);
|
||||
static bool gbt_macadle(const void* a, const void* b)
|
||||
{
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_le, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
static bool gbt_macadlt(const void* a, const void* b)
|
||||
{
|
||||
return DatumGetBool(DirectFunctionCall2(macaddr_lt, PointerGetDatum(a), PointerGetDatum(b)));
|
||||
}
|
||||
|
||||
static int gbt_macadkey_cmp(const void* a, const void* b)
|
||||
{
|
||||
macKEY* ia = (macKEY*)(((const Nsrt*)a)->t);
|
||||
macKEY* ib = (macKEY*)(((const Nsrt*)b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->lower), MacaddrPGetDatum(&ib->lower)));
|
||||
if (res == 0)
|
||||
return DatumGetInt32(
|
||||
DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->upper), MacaddrPGetDatum(&ib->upper)));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static const gbtree_ninfo tinfo = {gbt_t_macad,
|
||||
sizeof(macaddr),
|
||||
gbt_macadgt,
|
||||
gbt_macadge,
|
||||
gbt_macadeq,
|
||||
gbt_macadle,
|
||||
gbt_macadlt,
|
||||
gbt_macadkey_cmp,
|
||||
NULL};
|
||||
|
||||
/**************************************************
|
||||
* macaddr ops
|
||||
**************************************************/
|
||||
|
||||
static uint64 mac_2_uint64(macaddr* m)
|
||||
{
|
||||
unsigned char* mi = (unsigned char*)m;
|
||||
uint64 res = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
res += (((uint64)mi[i]) << ((uint64)((5 - i) * 8)));
|
||||
return res;
|
||||
}
|
||||
|
||||
Datum gbt_macad_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_macad_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
macaddr* query = (macaddr*)PG_GETARG_POINTER(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
macKEY* kkk = (macKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_macad_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(macKEY));
|
||||
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(macKEY);
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_macad_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
macKEY* origentry = (macKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
macKEY* newentry = (macKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
uint64 iorg[2], inew[2];
|
||||
|
||||
iorg[0] = mac_2_uint64(&origentry->lower);
|
||||
iorg[1] = mac_2_uint64(&origentry->upper);
|
||||
inew[0] = mac_2_uint64(&newentry->lower);
|
||||
inew[1] = mac_2_uint64(&newentry->upper);
|
||||
|
||||
penalty_num(result, iorg[0], iorg[1], inew[0], inew[1]);
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
Datum gbt_macad_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_macad_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
macKEY* b1 = (macKEY*)PG_GETARG_POINTER(0);
|
||||
macKEY* b2 = (macKEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,159 +87,95 @@ Datum gbt_numeric_compress(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo));
|
||||
}
|
||||
|
||||
// Function to check consistency of a numeric value with a GIST entry
|
||||
Datum gbt_numeric_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Pointer to the GIST entry
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
||||
// The numeric value to be checked
|
||||
void* query = (void*)DatumGetNumeric(PG_GETARG_DATUM(1));
|
||||
|
||||
// The strategy number representing the strategy to be used
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
// Pointer to a boolean variable that indicates whether a recheck is necessary
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
|
||||
// The return value, initialized to false
|
||||
bool retval = false;
|
||||
|
||||
// Pointer to the key of the GIST entry, converted to a GBT_VARKEY*
|
||||
GBT_VARKEY* key = (GBT_VARKEY*)DatumGetPointer(entry->key);
|
||||
|
||||
// The readable representation of the GBT_VARKEY
|
||||
GBT_VARKEY_R r = gbt_var_key_readable(key);
|
||||
|
||||
// All cases served by this function are exact, so set *recheck to false
|
||||
*recheck = false;
|
||||
|
||||
// Check consistency using the gbt_var_consistent function and store the result in retval
|
||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(), GIST_LEAF(entry), &tinfo);
|
||||
|
||||
// Return the result of the consistency check as a boolean value
|
||||
PG_RETURN_BOOL(retval);
|
||||
Datum gbt_numeric_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
void* query = (void*)DatumGetNumeric(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
bool retval = false;
|
||||
GBT_VARKEY* key = (GBT_VARKEY*)DatumGetPointer(entry->key);
|
||||
GBT_VARKEY_R r = gbt_var_key_readable(key);
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(), GIST_LEAF(entry), &tinfo);
|
||||
PG_RETURN_BOOL(retval);
|
||||
}
|
||||
|
||||
// Function to perform a union operation on numeric values using GBT
|
||||
Datum gbt_numeric_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Pointer to the GistEntryVector containing the GIST entries
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
|
||||
// Pointer to an integer representing the size of the union
|
||||
int32* size = (int*)PG_GETARG_POINTER(1);
|
||||
|
||||
// Perform the union operation using gbt_var_union and return the result as a pointer
|
||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(), &tinfo));
|
||||
Datum gbt_numeric_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
int32* size = (int*)PG_GETARG_POINTER(1);
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(), &tinfo));
|
||||
}
|
||||
|
||||
// Function to check if two numeric values are the same using GBT
|
||||
Datum gbt_numeric_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// The first numeric value
|
||||
Datum d1 = PG_GETARG_DATUM(0);
|
||||
|
||||
// The second numeric value
|
||||
Datum d2 = PG_GETARG_DATUM(1);
|
||||
|
||||
// Pointer to a boolean variable that will store the result
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Check if the two numeric values are the same using gbt_var_same and store the result in *result
|
||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
||||
|
||||
// Return the result as a pointer
|
||||
PG_RETURN_POINTER(result);
|
||||
Datum gbt_numeric_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Datum d1 = PG_GETARG_DATUM(0);
|
||||
Datum d2 = PG_GETARG_DATUM(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Function to calculate the penalty for a numeric value using GBT
|
||||
Datum gbt_numeric_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Pointer to the original GIST entry
|
||||
GISTENTRY* o = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
||||
// Pointer to the new GIST entry
|
||||
GISTENTRY* n = (GISTENTRY*)PG_GETARG_POINTER(1);
|
||||
|
||||
// Pointer to a float variable that will store the result
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
Numeric us, os, ds;
|
||||
|
||||
// Pointers to the keys of the original and new GIST entries
|
||||
GBT_VARKEY* org = (GBT_VARKEY*)DatumGetPointer(o->key);
|
||||
GBT_VARKEY* newe = (GBT_VARKEY*)DatumGetPointer(n->key);
|
||||
|
||||
// The union of the original and new keys
|
||||
Datum uni;
|
||||
GBT_VARKEY_R rk, ok, uk;
|
||||
|
||||
// Make the original key readable and store it in rk
|
||||
rk = gbt_var_key_readable(org);
|
||||
|
||||
// Create a copy of the original key and store it in uni
|
||||
uni = PointerGetDatum(gbt_var_key_copy(&rk, TRUE));
|
||||
|
||||
// Perform a union operation on the original and new keys and update uni
|
||||
gbt_var_bin_union(&uni, newe, PG_GET_COLLATION(), &tinfo);
|
||||
|
||||
// Make the original key readable and store it in ok
|
||||
ok = gbt_var_key_readable(org);
|
||||
|
||||
// Make the union key readable and store it in uk
|
||||
uk = gbt_var_key_readable((GBT_VARKEY*)DatumGetPointer(uni));
|
||||
|
||||
// Calculate the upper and lower bounds of the union and store them in us
|
||||
us = DatumGetNumeric(DirectFunctionCall2(numeric_sub, PointerGetDatum(uk.upper), PointerGetDatum(uk.lower)));
|
||||
|
||||
// Calculate the upper and lower bounds of the original key and store them in os
|
||||
os = DatumGetNumeric(DirectFunctionCall2(numeric_sub, PointerGetDatum(ok.upper), PointerGetDatum(ok.lower)));
|
||||
|
||||
// Calculate the difference between us and os and store it in ds
|
||||
ds = DatumGetNumeric(DirectFunctionCall2(numeric_sub, NumericGetDatum(us), NumericGetDatum(os)));
|
||||
|
||||
// Check if us is NaN (Not a Number)
|
||||
if (numeric_is_nan(us)) {
|
||||
// If os is also NaN, set the result to 0.0; otherwise, set it to 1.0
|
||||
if (numeric_is_nan(os))
|
||||
*result = 0.0;
|
||||
else
|
||||
*result = 1.0;
|
||||
} else {
|
||||
// Create a numeric value representing 0 and store it in nul
|
||||
Numeric nul = DatumGetNumeric(DirectFunctionCall1(int4_numeric, Int32GetDatum(0)));
|
||||
|
||||
// Initialize the result to 0.0
|
||||
*result = 0.0;
|
||||
|
||||
// Check if ds is greater than nul and, if so, update the result accordingly
|
||||
if (DirectFunctionCall2(numeric_gt, NumericGetDatum(ds), NumericGetDatum(nul))) {
|
||||
*result += FLT_MIN;
|
||||
os = DatumGetNumeric(DirectFunctionCall2(numeric_div, NumericGetDatum(ds), NumericGetDatum(us)));
|
||||
*result += (float4)DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow, NumericGetDatum(os)));
|
||||
}
|
||||
}
|
||||
|
||||
// If the result is greater than 0, scale it by a certain factor and return it as a pointer; otherwise, return it as-is
|
||||
if (*result > 0)
|
||||
*result *= (FLT_MAX / (((GISTENTRY*)PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
Datum gbt_numeric_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* o = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* n = (GISTENTRY*)PG_GETARG_POINTER(1);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
Numeric us, os, ds;
|
||||
|
||||
GBT_VARKEY* org = (GBT_VARKEY*)DatumGetPointer(o->key);
|
||||
GBT_VARKEY* newe = (GBT_VARKEY*)DatumGetPointer(n->key);
|
||||
Datum uni;
|
||||
GBT_VARKEY_R rk, ok, uk;
|
||||
|
||||
rk = gbt_var_key_readable(org);
|
||||
uni = PointerGetDatum(gbt_var_key_copy(&rk, TRUE));
|
||||
gbt_var_bin_union(&uni, newe, PG_GET_COLLATION(), &tinfo);
|
||||
ok = gbt_var_key_readable(org);
|
||||
uk = gbt_var_key_readable((GBT_VARKEY*)DatumGetPointer(uni));
|
||||
|
||||
us = DatumGetNumeric(DirectFunctionCall2(numeric_sub, PointerGetDatum(uk.upper), PointerGetDatum(uk.lower)));
|
||||
|
||||
os = DatumGetNumeric(DirectFunctionCall2(numeric_sub, PointerGetDatum(ok.upper), PointerGetDatum(ok.lower)));
|
||||
|
||||
ds = DatumGetNumeric(DirectFunctionCall2(numeric_sub, NumericGetDatum(us), NumericGetDatum(os)));
|
||||
|
||||
if (numeric_is_nan(us)) {
|
||||
if (numeric_is_nan(os))
|
||||
*result = 0.0;
|
||||
else
|
||||
*result = 1.0;
|
||||
} else {
|
||||
Numeric nul = DatumGetNumeric(DirectFunctionCall1(int4_numeric, Int32GetDatum(0)));
|
||||
|
||||
*result = 0.0;
|
||||
|
||||
if (DirectFunctionCall2(numeric_gt, NumericGetDatum(ds), NumericGetDatum(nul))) {
|
||||
*result += FLT_MIN;
|
||||
os = DatumGetNumeric(DirectFunctionCall2(numeric_div, NumericGetDatum(ds), NumericGetDatum(us)));
|
||||
*result += (float4)DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow, NumericGetDatum(os)));
|
||||
}
|
||||
}
|
||||
|
||||
if (*result > 0)
|
||||
*result *= (FLT_MAX / (((GISTENTRY*)PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Function to perform a picksplit operation on numeric values using GBT
|
||||
Datum gbt_numeric_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Pointer to the GistEntryVector containing the GIST entries
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
|
||||
// Pointer to the GIST_SPLITVEC that will store the result of the picksplit operation
|
||||
GIST_SPLITVEC* v = (GIST_SPLITVEC*)PG_GETARG_POINTER(1);
|
||||
|
||||
// Perform the picksplit operation using gbt_var_picksplit and store the result in v
|
||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(), &tinfo);
|
||||
|
||||
// Return the result as a pointer
|
||||
PG_RETURN_POINTER(v);
|
||||
Datum gbt_numeric_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
GIST_SPLITVEC* v = (GIST_SPLITVEC*)PG_GETARG_POINTER(1);
|
||||
|
||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(), &tinfo);
|
||||
PG_RETURN_POINTER(v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,199 +15,164 @@ typedef struct {
|
|||
/*
|
||||
** OID ops
|
||||
*/
|
||||
// These macros define the function information for each of the GiST functions.
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_compress);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_union);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_picksplit);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_consistent);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_distance);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_penalty);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_same);
|
||||
|
||||
// These functions are defined as extern "C" because they are called from C code.
|
||||
// Each function takes PG_FUNCTION_ARGS as parameters and returns a Datum.
|
||||
extern "C" Datum gbt_oid_compress(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_union(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_picksplit(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_consistent(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_distance(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_penalty(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_same(PG_FUNCTION_ARGS);
|
||||
|
||||
// These functions are used to compare Oids. They take two void pointers and return a bool.
|
||||
static bool gbt_oidgt(const void* a, const void* b)
|
||||
{
|
||||
// Compare the Oids and return true if the first is greater than the second.
|
||||
return (*((const Oid*)a) > *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oidge(const void* a, const void* b)
|
||||
{
|
||||
// Compare the Oids and return true if the first is greater than or equal to the second.
|
||||
return (*((const Oid*)a) >= *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oideq(const void* a, const void* b)
|
||||
{
|
||||
// Compare the Oids and return true if they are equal.
|
||||
return (*((const Oid*)a) == *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oidle(const void* a, const void* b)
|
||||
{
|
||||
// Compare the Oids and return true if the first is less than or equal to the second.
|
||||
return (*((const Oid*)a) <= *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oidlt(const void* a, const void* b)
|
||||
{
|
||||
// Compare the Oids and return true if the first is less than the second.
|
||||
return (*((const Oid*)a) < *((const Oid*)b));
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_compress);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_union);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_picksplit);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_consistent);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_distance);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_penalty);
|
||||
PG_FUNCTION_INFO_V1(gbt_oid_same);
|
||||
|
||||
extern "C" Datum gbt_oid_compress(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_union(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_picksplit(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_consistent(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_distance(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_penalty(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum gbt_oid_same(PG_FUNCTION_ARGS);
|
||||
|
||||
static bool gbt_oidgt(const void* a, const void* b)
|
||||
{
|
||||
return (*((const Oid*)a) > *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oidge(const void* a, const void* b)
|
||||
{
|
||||
return (*((const Oid*)a) >= *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oideq(const void* a, const void* b)
|
||||
{
|
||||
return (*((const Oid*)a) == *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oidle(const void* a, const void* b)
|
||||
{
|
||||
return (*((const Oid*)a) <= *((const Oid*)b));
|
||||
}
|
||||
static bool gbt_oidlt(const void* a, const void* b)
|
||||
{
|
||||
return (*((const Oid*)a) < *((const Oid*)b));
|
||||
}
|
||||
|
||||
// Define a function to compare two oidKEYs.
|
||||
static int gbt_oidkey_cmp(const void* a, const void* b)
|
||||
{
|
||||
oidKEY* ia = (oidKEY*)(((const Nsrt*)a)->t);
|
||||
oidKEY* ib = (oidKEY*)(((const Nsrt*)b)->t);
|
||||
|
||||
// Compare the lower and upper bounds of the oidKEYs.
|
||||
if (ia->lower == ib->lower) {
|
||||
if (ia->upper == ib->upper)
|
||||
return 0;
|
||||
|
||||
return (ia->upper > ib->upper) ? 1 : -1;
|
||||
}
|
||||
|
||||
return (ia->lower > ib->lower) ? 1 : -1;
|
||||
}
|
||||
|
||||
// Define a function to calculate the distance between two Oids.
|
||||
static float8 gbt_oid_dist(const void* a, const void* b)
|
||||
{
|
||||
Oid aa = *(const Oid*)a;
|
||||
Oid bb = *(const Oid*)b;
|
||||
|
||||
// Calculate the distance between the two Oids.
|
||||
if (aa < bb)
|
||||
return (float8)(bb - aa);
|
||||
else
|
||||
return (float8)(aa - bb);
|
||||
}
|
||||
|
||||
// Define the tree information for the GiST index.
|
||||
static const gbtree_ninfo tinfo = {
|
||||
gbt_t_oid, sizeof(Oid), gbt_oidgt, gbt_oidge, gbt_oideq, gbt_oidle, gbt_oidlt, gbt_oidkey_cmp, gbt_oid_dist};
|
||||
|
||||
// Define the function information for the oid_dist function.
|
||||
PG_FUNCTION_INFO_V1(oid_dist);
|
||||
extern "C" Datum oid_dist(PG_FUNCTION_ARGS);
|
||||
Datum oid_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid a = PG_GETARG_OID(0);
|
||||
Oid b = PG_GETARG_OID(1);
|
||||
Oid res;
|
||||
|
||||
// Calculate the distance between the two Oids.
|
||||
if (a < b)
|
||||
res = b - a;
|
||||
else
|
||||
res = a - b;
|
||||
PG_RETURN_OID(res);
|
||||
static int gbt_oidkey_cmp(const void* a, const void* b)
|
||||
{
|
||||
oidKEY* ia = (oidKEY*)(((const Nsrt*)a)->t);
|
||||
oidKEY* ib = (oidKEY*)(((const Nsrt*)b)->t);
|
||||
|
||||
if (ia->lower == ib->lower) {
|
||||
if (ia->upper == ib->upper)
|
||||
return 0;
|
||||
|
||||
return (ia->upper > ib->upper) ? 1 : -1;
|
||||
}
|
||||
|
||||
return (ia->lower > ib->lower) ? 1 : -1;
|
||||
}
|
||||
|
||||
static float8 gbt_oid_dist(const void* a, const void* b)
|
||||
{
|
||||
Oid aa = *(const Oid*)a;
|
||||
Oid bb = *(const Oid*)b;
|
||||
|
||||
if (aa < bb)
|
||||
return (float8)(bb - aa);
|
||||
else
|
||||
return (float8)(aa - bb);
|
||||
}
|
||||
|
||||
static const gbtree_ninfo tinfo = {
|
||||
gbt_t_oid, sizeof(Oid), gbt_oidgt, gbt_oidge, gbt_oideq, gbt_oidle, gbt_oidlt, gbt_oidkey_cmp, gbt_oid_dist};
|
||||
|
||||
PG_FUNCTION_INFO_V1(oid_dist);
|
||||
extern "C" Datum oid_dist(PG_FUNCTION_ARGS);
|
||||
Datum oid_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid a = PG_GETARG_OID(0);
|
||||
Oid b = PG_GETARG_OID(1);
|
||||
Oid res;
|
||||
|
||||
if (a < b)
|
||||
res = b - a;
|
||||
else
|
||||
res = a - b;
|
||||
PG_RETURN_OID(res);
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Oid ops
|
||||
**************************************************/
|
||||
|
||||
// Function to compress a GiST entry.
|
||||
// It takes a single argument of type GISTENTRY* and returns a pointer to the compressed entry.
|
||||
Datum gbt_oid_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
// Function to check if an Oid is consistent with a GiST entry.
|
||||
// It takes four arguments: a GISTENTRY*, an Oid, a StrategyNumber, and a bool*.
|
||||
// The function sets the bool* to false, indicating that all cases served by this function are exact.
|
||||
// It returns a bool indicating if the Oid is consistent with the GiST entry.
|
||||
Datum gbt_oid_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
Oid query = PG_GETARG_OID(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
oidKEY* kkk = (oidKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
// Function to calculate the distance between an Oid and a GiST entry.
|
||||
// It takes two arguments: a GISTENTRY* and an Oid.
|
||||
// The function returns a float8 representing the distance between the Oid and the GiST entry.
|
||||
Datum gbt_oid_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
Oid query = PG_GETARG_OID(1);
|
||||
|
||||
oidKEY* kkk = (oidKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
Datum gbt_oid_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
// Function to union a GiST entry vector.
|
||||
// It takes a single argument of type GistEntryVector* and returns a pointer to the unioned entry.
|
||||
Datum gbt_oid_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(oidKEY));
|
||||
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(oidKEY);
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
// Function to calculate the penalty of merging two GiST entries.
|
||||
// It takes two arguments of type oidKEY* and a float*.
|
||||
// The function calls penalty_num to calculate the penalty and returns a pointer to the result.
|
||||
Datum gbt_oid_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
oidKEY* origentry = (oidKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
oidKEY* newentry = (oidKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
penalty_num(result, origentry->lower, origentry->upper, newentry->lower, newentry->upper);
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Function to pick a split point for a GiST entry vector.
|
||||
// It takes two arguments of type GistEntryVector* and GIST_SPLITVEC*.
|
||||
// The function returns a pointer to the split point.
|
||||
Datum gbt_oid_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
// Function to check if two GiST entries are the same.
|
||||
// It takes two arguments of type oidKEY* and a bool*.
|
||||
// The function calls gbt_num_same to check if the entries are the same and returns a pointer to the result.
|
||||
Datum gbt_oid_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
oidKEY* b1 = (oidKEY*)PG_GETARG_POINTER(0);
|
||||
oidKEY* b2 = (oidKEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
Datum gbt_oid_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
Oid query = PG_GETARG_OID(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
oidKEY* kkk = (oidKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_oid_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
Oid query = PG_GETARG_OID(1);
|
||||
|
||||
oidKEY* kkk = (oidKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_oid_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(oidKEY));
|
||||
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(oidKEY);
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_oid_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
oidKEY* origentry = (oidKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
oidKEY* newentry = (oidKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
penalty_num(result, origentry->lower, origentry->upper, newentry->lower, newentry->upper);
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
Datum gbt_oid_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_oid_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
oidKEY* b1 = (oidKEY*)PG_GETARG_POINTER(0);
|
||||
oidKEY* b2 = (oidKEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,158 +68,118 @@ static gbtree_vinfo tinfo = {
|
|||
* Text ops
|
||||
**************************************************/
|
||||
|
||||
// Function to compress a GiST entry for text type.
|
||||
// It takes a single argument of type GISTENTRY* and returns a pointer to the compressed entry.
|
||||
// If the tinfo.eml is 0, it sets it to the maximum length of the database encoding.
|
||||
Datum gbt_text_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo));
|
||||
}
|
||||
|
||||
// Function to compress a GiST entry for bpchar type.
|
||||
// It takes a single argument of type GISTENTRY* and returns a pointer to the compressed entry.
|
||||
// If the tinfo.eml is 0, it sets it to the maximum length of the database encoding.
|
||||
// If the entry is a leafkey, it trims the key and compresses the trimmed entry. Otherwise, it returns the entry as it is.
|
||||
Datum gbt_bpchar_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
if (entry->leafkey) {
|
||||
Datum d = DirectFunctionCall1(rtrim1, entry->key);
|
||||
GISTENTRY trim;
|
||||
|
||||
gistentryinit(trim, d, entry->rel, entry->page, entry->offset, TRUE);
|
||||
retval = gbt_var_compress(&trim, &tinfo);
|
||||
} else
|
||||
retval = entry;
|
||||
|
||||
PG_RETURN_POINTER(retval);
|
||||
}
|
||||
|
||||
// Function to check if a text is consistent with a GiST entry for text type.
|
||||
// It takes four arguments: a GISTENTRY*, a void* representing the text, a StrategyNumber, and a bool*.
|
||||
// The function sets the bool* to false, indicating that all cases served by this function are exact.
|
||||
// It returns a bool indicating if the text is consistent with the GiST entry.
|
||||
// If the tinfo.eml is 0, it sets it to the maximum length of the database encoding.
|
||||
Datum gbt_text_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
void* query = (void*)DatumGetTextP(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
bool retval = false;
|
||||
GBT_VARKEY* key = (GBT_VARKEY*)DatumGetPointer(entry->key);
|
||||
GBT_VARKEY_R r = gbt_var_key_readable(key);
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(), GIST_LEAF(entry), &tinfo);
|
||||
|
||||
PG_RETURN_BOOL(retval);
|
||||
Datum gbt_text_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_compress(entry, &tinfo));
|
||||
}
|
||||
|
||||
// Check if a bpchar is consistent with a GiST entry for bpchar type.
|
||||
Datum gbt_bpchar_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the GiST entry.
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
// Get the query.
|
||||
void* query = (void*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
|
||||
// Get the strategy.
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
// Get the recheck boolean.
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
// Initialize the return value.
|
||||
bool retval = false;
|
||||
// Get the key.
|
||||
GBT_VARKEY* key = (GBT_VARKEY*)DatumGetPointer(entry->key);
|
||||
// Make the key readable.
|
||||
GBT_VARKEY_R r = gbt_var_key_readable(key);
|
||||
// Trim the query.
|
||||
void* trim = (void*)DatumGetPointer(DirectFunctionCall1(rtrim1, PointerGetDatum(query)));
|
||||
|
||||
// All cases served by this function are exact.
|
||||
*recheck = false;
|
||||
|
||||
// If the tinfo.eml is 0, set it to the maximum length of the database encoding.
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
// Check if the query is consistent with the GiST entry.
|
||||
retval = gbt_var_consistent(&r, trim, strategy, PG_GET_COLLATION(), GIST_LEAF(entry), &tinfo);
|
||||
// Return the result.
|
||||
PG_RETURN_BOOL(retval);
|
||||
}
|
||||
|
||||
// Union GiST entries for text type.
|
||||
Datum gbt_text_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the GiST entry vector.
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
// Get the size.
|
||||
int32* size = (int*)PG_GETARG_POINTER(1);
|
||||
|
||||
// Union the entries and return the result.
|
||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(), &tinfo));
|
||||
}
|
||||
|
||||
// Split GiST entries for text type.
|
||||
Datum gbt_text_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the GiST entry vector.
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
// Get the split vector.
|
||||
GIST_SPLITVEC* v = (GIST_SPLITVEC*)PG_GETARG_POINTER(1);
|
||||
|
||||
// Split the entries.
|
||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(), &tinfo);
|
||||
// Return the split vector.
|
||||
PG_RETURN_POINTER(v);
|
||||
}
|
||||
|
||||
// Check if two text values are the same.
|
||||
Datum gbt_text_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the two text values.
|
||||
Datum d1 = PG_GETARG_DATUM(0);
|
||||
Datum d2 = PG_GETARG_DATUM(1);
|
||||
// Get the result boolean.
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Check if the two text values are the same.
|
||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
||||
// Return the result.
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Calculate the penalty for GiST entries for text type.
|
||||
Datum gbt_text_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the two GiST entries.
|
||||
GISTENTRY* o = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* n = (GISTENTRY*)PG_GETARG_POINTER(1);
|
||||
// Get the result float.
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Calculate the penalty
|
||||
PG_RETURN_POINTER(gbt_var_penalty(result,o,n,PG_GET_COLLATION(),&tinfo));
|
||||
Datum gbt_bpchar_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
if (entry->leafkey) {
|
||||
|
||||
Datum d = DirectFunctionCall1(rtrim1, entry->key);
|
||||
GISTENTRY trim;
|
||||
|
||||
gistentryinit(trim, d, entry->rel, entry->page, entry->offset, TRUE);
|
||||
retval = gbt_var_compress(&trim, &tinfo);
|
||||
} else
|
||||
retval = entry;
|
||||
|
||||
PG_RETURN_POINTER(retval);
|
||||
}
|
||||
|
||||
Datum gbt_text_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
void* query = (void*)DatumGetTextP(PG_GETARG_DATUM(1));
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
bool retval = false;
|
||||
GBT_VARKEY* key = (GBT_VARKEY*)DatumGetPointer(entry->key);
|
||||
GBT_VARKEY_R r = gbt_var_key_readable(key);
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(), GIST_LEAF(entry), &tinfo);
|
||||
|
||||
PG_RETURN_BOOL(retval);
|
||||
}
|
||||
|
||||
Datum gbt_bpchar_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
void* query = (void*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
bool retval = false;
|
||||
GBT_VARKEY* key = (GBT_VARKEY*)DatumGetPointer(entry->key);
|
||||
GBT_VARKEY_R r = gbt_var_key_readable(key);
|
||||
void* trim = (void*)DatumGetPointer(DirectFunctionCall1(rtrim1, PointerGetDatum(query)));
|
||||
|
||||
/* All cases served by this function are exact */
|
||||
*recheck = false;
|
||||
|
||||
if (tinfo.eml == 0) {
|
||||
tinfo.eml = pg_database_encoding_max_length();
|
||||
}
|
||||
|
||||
retval = gbt_var_consistent(&r, trim, strategy, PG_GET_COLLATION(), GIST_LEAF(entry), &tinfo);
|
||||
PG_RETURN_BOOL(retval);
|
||||
}
|
||||
|
||||
Datum gbt_text_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
int32* size = (int*)PG_GETARG_POINTER(1);
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_union(entryvec, size, PG_GET_COLLATION(), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_text_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
GIST_SPLITVEC* v = (GIST_SPLITVEC*)PG_GETARG_POINTER(1);
|
||||
|
||||
gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(), &tinfo);
|
||||
PG_RETURN_POINTER(v);
|
||||
}
|
||||
|
||||
Datum gbt_text_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Datum d1 = PG_GETARG_DATUM(0);
|
||||
Datum d2 = PG_GETARG_DATUM(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
Datum gbt_text_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* o = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* n = (GISTENTRY*)PG_GETARG_POINTER(1);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
|
||||
PG_RETURN_POINTER(gbt_var_penalty(result, o, n, PG_GET_COLLATION(), &tinfo));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,180 +43,133 @@ extern "C" Datum gbt_time_same(PG_FUNCTION_ARGS);
|
|||
#define TimeADTGetDatumFast(X) PointerGetDatum(&(X))
|
||||
#endif
|
||||
|
||||
// Compare if time a is greater than time b
|
||||
static bool gbt_timegt(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a; // Cast void pointer a to TimeADT pointer
|
||||
const TimeADT* bb = (const TimeADT*)b; // Cast void pointer b to TimeADT pointer
|
||||
|
||||
// Use the function time_gt to compare the two time objects, and return the result as a boolean value
|
||||
return DatumGetBool(DirectFunctionCall2(time_gt, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
// Compare if time a is greater than or equal to time b
|
||||
static bool gbt_timege(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a; // Cast void pointer a to TimeADT pointer
|
||||
const TimeADT* bb = (const TimeADT*)b; // Cast void pointer b to TimeADT pointer
|
||||
|
||||
// Use the function time_ge to compare the two time objects, and return the result as a boolean value
|
||||
return DatumGetBool(DirectFunctionCall2(time_ge, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
// Compare if time a is equal to time b
|
||||
static bool gbt_timeeq(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a; // Cast void pointer a to TimeADT pointer
|
||||
const TimeADT* bb = (const TimeADT*)b; // Cast void pointer b to TimeADT pointer
|
||||
|
||||
// Use the function time_eq to compare the two time objects, and return the result as a boolean value
|
||||
return DatumGetBool(DirectFunctionCall2(time_eq, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
// Compare if time a is less than or equal to time b
|
||||
static bool gbt_timele(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a; // Cast void pointer a to TimeADT pointer
|
||||
const TimeADT* bb = (const TimeADT*)b; // Cast void pointer b to TimeADT pointer
|
||||
|
||||
// Use the function time_le to compare the two time objects, and return the result as a boolean value
|
||||
return DatumGetBool(DirectFunctionCall2(time_le, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
// Compare if time a is less than time b
|
||||
static bool gbt_timelt(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a; // Cast void pointer a to TimeADT pointer
|
||||
const TimeADT* bb = (const TimeADT*)b; // Cast void pointer b to TimeADT pointer
|
||||
|
||||
// Use the function time_lt to compare the two time objects, and return the result as a boolean value
|
||||
return DatumGetBool(DirectFunctionCall2(time_lt, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
static bool gbt_timegt(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
|
||||
return DatumGetBool(DirectFunctionCall2(time_gt, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
// Compare two timeKEY objects a and b
|
||||
static int gbt_timekey_cmp(const void* a, const void* b)
|
||||
{
|
||||
// Cast void pointers a and b to timeKEY pointers
|
||||
timeKEY* ia = (timeKEY*)(((const Nsrt*)a)->t);
|
||||
timeKEY* ib = (timeKEY*)(((const Nsrt*)b)->t);
|
||||
int res;
|
||||
|
||||
// Compare the lower bounds of the timeKEY objects
|
||||
res = DatumGetInt32(DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->lower), TimeADTGetDatumFast(ib->lower)));
|
||||
// If the lower bounds are equal, compare the upper bounds
|
||||
if (res == 0)
|
||||
return DatumGetInt32(
|
||||
DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->upper), TimeADTGetDatumFast(ib->upper)));
|
||||
|
||||
// Return the result of the comparison of the lower bounds
|
||||
return res;
|
||||
}
|
||||
|
||||
// Calculate the distance between two time objects a and b
|
||||
static float8 gbt_time_dist(const void* a, const void* b)
|
||||
{
|
||||
// Cast void pointers a and b to TimeADT pointers
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
Interval* i = NULL;
|
||||
|
||||
// Call the function time_mi_time to get the interval between the two time objects
|
||||
i = DatumGetIntervalP(DirectFunctionCall2(time_mi_time, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
// Return the absolute value of the interval converted to seconds
|
||||
return (float8)Abs(INTERVAL_TO_SEC(i));
|
||||
}
|
||||
|
||||
// Define the information about the time type for the generalized binary tree (gbtree)
|
||||
static const gbtree_ninfo tinfo = {gbt_t_time,
|
||||
sizeof(TimeADT),
|
||||
gbt_timegt,
|
||||
gbt_timege,
|
||||
gbt_timeeq,
|
||||
gbt_timele,
|
||||
gbt_timelt,
|
||||
gbt_timekey_cmp,
|
||||
gbt_time_dist};
|
||||
|
||||
// Define the information about the time_dist function for PostgreSQL
|
||||
PG_FUNCTION_INFO_V1(time_dist);
|
||||
extern "C" Datum time_dist(PG_FUNCTION_ARGS);
|
||||
// Define the time_dist function for PostgreSQL
|
||||
Datum time_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Call the function time_mi_time to get the interval between the two time objects passed as arguments
|
||||
Datum diff = DirectFunctionCall2(time_mi_time, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1));
|
||||
|
||||
// Return the absolute value of the interval as a PostgreSQL interval object
|
||||
PG_RETURN_INTERVAL_P(abs_interval(DatumGetIntervalP(diff)));
|
||||
static bool gbt_timege(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
|
||||
return DatumGetBool(DirectFunctionCall2(time_ge, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
static bool gbt_timeeq(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
|
||||
return DatumGetBool(DirectFunctionCall2(time_eq, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
static bool gbt_timele(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
|
||||
return DatumGetBool(DirectFunctionCall2(time_le, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
static bool gbt_timelt(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
|
||||
return DatumGetBool(DirectFunctionCall2(time_lt, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
}
|
||||
|
||||
static int gbt_timekey_cmp(const void* a, const void* b)
|
||||
{
|
||||
timeKEY* ia = (timeKEY*)(((const Nsrt*)a)->t);
|
||||
timeKEY* ib = (timeKEY*)(((const Nsrt*)b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->lower), TimeADTGetDatumFast(ib->lower)));
|
||||
if (res == 0)
|
||||
return DatumGetInt32(
|
||||
DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->upper), TimeADTGetDatumFast(ib->upper)));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static float8 gbt_time_dist(const void* a, const void* b)
|
||||
{
|
||||
const TimeADT* aa = (const TimeADT*)a;
|
||||
const TimeADT* bb = (const TimeADT*)b;
|
||||
Interval* i = NULL;
|
||||
|
||||
i = DatumGetIntervalP(DirectFunctionCall2(time_mi_time, TimeADTGetDatumFast(*aa), TimeADTGetDatumFast(*bb)));
|
||||
return (float8)Abs(INTERVAL_TO_SEC(i));
|
||||
}
|
||||
|
||||
static const gbtree_ninfo tinfo = {gbt_t_time,
|
||||
sizeof(TimeADT),
|
||||
gbt_timegt,
|
||||
gbt_timege,
|
||||
gbt_timeeq,
|
||||
gbt_timele,
|
||||
gbt_timelt,
|
||||
gbt_timekey_cmp,
|
||||
gbt_time_dist};
|
||||
|
||||
PG_FUNCTION_INFO_V1(time_dist);
|
||||
extern "C" Datum time_dist(PG_FUNCTION_ARGS);
|
||||
Datum time_dist(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Datum diff = DirectFunctionCall2(time_mi_time, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1));
|
||||
|
||||
PG_RETURN_INTERVAL_P(abs_interval(DatumGetIntervalP(diff)));
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* time ops
|
||||
**************************************************/
|
||||
|
||||
// Compress the time data
|
||||
Datum gbt_time_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the entry from the argument
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
// Initialize the return value
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
// Return the compressed value
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
// Compress the time zone data
|
||||
Datum gbt_timetz_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the entry from the argument
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
// Initialize the return value
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
// If the entry is a leaf key
|
||||
if (entry->leafkey) {
|
||||
// Allocate memory for the timeKEY object
|
||||
timeKEY* r = (timeKEY*)palloc(sizeof(timeKEY));
|
||||
// Get the time zone data from the entry
|
||||
TimeTzADT* tz = DatumGetTimeTzADTP(entry->key);
|
||||
// Initialize a temporary time object
|
||||
TimeADT tmp;
|
||||
|
||||
// Allocate memory for the return entry
|
||||
retval = (GISTENTRY*)palloc(sizeof(GISTENTRY));
|
||||
|
||||
// Use the time and zone to compress the data
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
tmp = tz->time + (tz->zone * INT64CONST(1000000));
|
||||
#else
|
||||
tmp = (tz->time + tz->zone);
|
||||
#endif
|
||||
// Set the lower and upper bounds of the timeKEY object to the compressed time value
|
||||
r->lower = r->upper = tmp;
|
||||
// Initialize the return entry with the compressed timeKEY object and other information from the original entry
|
||||
gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, entry->offset, FALSE);
|
||||
} else {
|
||||
// If the entry is not a leaf key, return the original entry
|
||||
retval = entry;
|
||||
}
|
||||
// Return the compressed entry or the original entry if it is not a leaf key
|
||||
PG_RETURN_POINTER(retval);
|
||||
}
|
||||
|
||||
// Check if the query is consistent with the compressed time data
|
||||
Datum gbt_time_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the entry from the argument
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
// Get the query time from the argument
|
||||
TimeADT query = PG_GETARG_TIMEADT(1);
|
||||
// Get the strategy number from the argument
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
// Get a pointer to the recheck boolean from the argument
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
|
||||
Datum gbt_time_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
PG_RETURN_POINTER(gbt_num_compress(retval, entry, &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_timetz_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
GISTENTRY* retval = NULL;
|
||||
|
||||
if (entry->leafkey) {
|
||||
timeKEY* r = (timeKEY*)palloc(sizeof(timeKEY));
|
||||
TimeTzADT* tz = DatumGetTimeTzADTP(entry->key);
|
||||
TimeADT tmp;
|
||||
|
||||
retval = (GISTENTRY*)palloc(sizeof(GISTENTRY));
|
||||
|
||||
/* We are using the time + zone only to compress */
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
tmp = tz->time + (tz->zone * INT64CONST(1000000));
|
||||
#else
|
||||
tmp = (tz->time + tz->zone);
|
||||
#endif
|
||||
r->lower = r->upper = tmp;
|
||||
gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, entry->offset, FALSE);
|
||||
} else
|
||||
retval = entry;
|
||||
PG_RETURN_POINTER(retval);
|
||||
}
|
||||
|
||||
Datum gbt_time_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
TimeADT query = PG_GETARG_TIMEADT(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
timeKEY* kkk = (timeKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
|
|
@ -229,142 +182,101 @@ Datum gbt_time_consistent(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&query, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
// Calculate the distance between the time data and the query
|
||||
Datum gbt_time_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the entry from the argument
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
// Get the query time from the argument
|
||||
TimeADT query = PG_GETARG_TIMEADT(1);
|
||||
|
||||
// Get the timeKEY object from the entry's key datum object
|
||||
timeKEY* kkk = (timeKEY*)DatumGetPointer(entry->key);
|
||||
// Initialize the key structure with the lower and upper bounds of the timeKEY object
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
// Return the distance between the time data and the query
|
||||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
// Check if the query is consistent with the time zone data
|
||||
Datum gbt_timetz_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the entry from the argument
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
// Get the query time zone from the argument
|
||||
TimeTzADT* query = PG_GETARG_TIMETZADT_P(1);
|
||||
// Get the strategy number from the argument
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
// Get a pointer to the recheck boolean from the argument
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
// Get the timeKEY object from the entry's key datum object
|
||||
timeKEY* kkk = (timeKEY*)DatumGetPointer(entry->key);
|
||||
// Initialize a temporary time object
|
||||
TimeADT qqq;
|
||||
// Initialize the key structure with the lower and upper bounds of the timeKEY object
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
/* All cases served by this function are inexact */
|
||||
*recheck = true;
|
||||
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
qqq = query->time + (query->zone * INT64CONST(1000000));
|
||||
#else
|
||||
qqq = (query->time + query->zone);
|
||||
#endif
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
// Return if the query is consistent with the time zone data
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&qqq, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
// Union the time data
|
||||
Datum gbt_time_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the entry vector from the argument
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
Datum gbt_time_distance(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
TimeADT query = PG_GETARG_TIMEADT(1);
|
||||
|
||||
timeKEY* kkk = (timeKEY*)DatumGetPointer(entry->key);
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_FLOAT8(gbt_num_distance(&key, (void*)&query, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_timetz_consistent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY* entry = (GISTENTRY*)PG_GETARG_POINTER(0);
|
||||
TimeTzADT* query = PG_GETARG_TIMETZADT_P(1);
|
||||
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
|
||||
|
||||
bool* recheck = (bool*)PG_GETARG_POINTER(4);
|
||||
timeKEY* kkk = (timeKEY*)DatumGetPointer(entry->key);
|
||||
TimeADT qqq;
|
||||
GBT_NUMKEY_R key;
|
||||
|
||||
/* All cases served by this function are inexact */
|
||||
*recheck = true;
|
||||
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
qqq = query->time + (query->zone * INT64CONST(1000000));
|
||||
#else
|
||||
qqq = (query->time + query->zone);
|
||||
#endif
|
||||
|
||||
key.lower = (GBT_NUMKEY*)&kkk->lower;
|
||||
key.upper = (GBT_NUMKEY*)&kkk->upper;
|
||||
|
||||
PG_RETURN_BOOL(gbt_num_consistent(&key, (void*)&qqq, &strategy, GIST_LEAF(entry), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_time_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GistEntryVector* entryvec = (GistEntryVector*)PG_GETARG_POINTER(0);
|
||||
void* out = palloc(sizeof(timeKEY));
|
||||
|
||||
*(int*)PG_GETARG_POINTER(1) = sizeof(timeKEY);
|
||||
PG_RETURN_POINTER(gbt_num_union((GBT_NUMKEY*)out, entryvec, &tinfo));
|
||||
}
|
||||
|
||||
// Calculate the penalty for the time data
|
||||
Datum gbt_time_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the original and new entries' timeKEY objects from the arguments
|
||||
timeKEY* origentry = (timeKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
timeKEY* newentry = (timeKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
// Get a pointer to the result float from the argument
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
// Initialize an interval object
|
||||
Interval* intr = NULL;
|
||||
// Initialize result variables
|
||||
double res;
|
||||
double res2;
|
||||
|
||||
// Calculate the time interval between the new and original entries' upper bounds
|
||||
intr = DatumGetIntervalP(
|
||||
DirectFunctionCall2(time_mi_time, TimeADTGetDatumFast(newentry->upper), TimeADTGetDatumFast(origentry->upper)));
|
||||
// Convert the interval to seconds and take the maximum value as 0
|
||||
res = INTERVAL_TO_SEC(intr);
|
||||
res = Max(res, 0);
|
||||
|
||||
// Calculate the time interval between the new and original entries' lower bounds
|
||||
intr = DatumGetIntervalP(
|
||||
DirectFunctionCall2(time_mi_time, TimeADTGetDatumFast(origentry->lower), TimeADTGetDatumFast(newentry->lower)));
|
||||
// Convert the interval to seconds and take the maximum value as 0
|
||||
res2 = INTERVAL_TO_SEC(intr);
|
||||
res2 = Max(res2, 0);
|
||||
|
||||
// Add the two intervals together
|
||||
res += res2;
|
||||
|
||||
// Initialize the result to 0.0
|
||||
*result = 0.0;
|
||||
|
||||
// If the total interval is greater than 0, calculate the penalty
|
||||
if (res > 0) {
|
||||
// Calculate the time interval between the original entry's upper and lower bounds
|
||||
intr = DatumGetIntervalP(DirectFunctionCall2(
|
||||
time_mi_time, TimeADTGetDatumFast(origentry->upper), TimeADTGetDatumFast(origentry->lower)));
|
||||
// Add a small value to the result
|
||||
*result += FLT_MIN;
|
||||
// Calculate the ratio of the total interval to the original entry's upper and lower bounds' interval
|
||||
*result += (float)(res / (res + INTERVAL_TO_SEC(intr)));
|
||||
// Scale the result by a maximum value divided by the number of attributes plus 1
|
||||
*result *= (FLT_MAX / (((GISTENTRY*)PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
|
||||
}
|
||||
|
||||
// Return a pointer to the result float
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
// Pick a split point for the time data
|
||||
Datum gbt_time_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Return a pointer to the result of picking a split point for the time data
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
// Check if two time data are the same
|
||||
Datum gbt_time_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the two timeKEY objects from the arguments
|
||||
timeKEY* b1 = (timeKEY*)PG_GETARG_POINTER(0);
|
||||
timeKEY* b2 = (timeKEY*)PG_GETARG_POINTER(1);
|
||||
// Get a pointer to the result boolean from the argument
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
// Check if the two time data are the same and store the result in the result boolean
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
// Return a pointer to the result boolean
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
Datum gbt_time_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
timeKEY* origentry = (timeKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
|
||||
timeKEY* newentry = (timeKEY*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
|
||||
float* result = (float*)PG_GETARG_POINTER(2);
|
||||
Interval* intr = NULL;
|
||||
double res;
|
||||
double res2;
|
||||
|
||||
intr = DatumGetIntervalP(
|
||||
DirectFunctionCall2(time_mi_time, TimeADTGetDatumFast(newentry->upper), TimeADTGetDatumFast(origentry->upper)));
|
||||
res = INTERVAL_TO_SEC(intr);
|
||||
res = Max(res, 0);
|
||||
|
||||
intr = DatumGetIntervalP(
|
||||
DirectFunctionCall2(time_mi_time, TimeADTGetDatumFast(origentry->lower), TimeADTGetDatumFast(newentry->lower)));
|
||||
res2 = INTERVAL_TO_SEC(intr);
|
||||
res2 = Max(res2, 0);
|
||||
|
||||
res += res2;
|
||||
|
||||
*result = 0.0;
|
||||
|
||||
if (res > 0) {
|
||||
intr = DatumGetIntervalP(DirectFunctionCall2(
|
||||
time_mi_time, TimeADTGetDatumFast(origentry->upper), TimeADTGetDatumFast(origentry->lower)));
|
||||
*result += FLT_MIN;
|
||||
*result += (float)(res / (res + INTERVAL_TO_SEC(intr)));
|
||||
*result *= (FLT_MAX / (((GISTENTRY*)PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
|
||||
}
|
||||
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
Datum gbt_time_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_POINTER(
|
||||
gbt_num_picksplit((GistEntryVector*)PG_GETARG_POINTER(0), (GIST_SPLITVEC*)PG_GETARG_POINTER(1), &tinfo));
|
||||
}
|
||||
|
||||
Datum gbt_time_same(PG_FUNCTION_ARGS)
|
||||
{
|
||||
timeKEY* b1 = (timeKEY*)PG_GETARG_POINTER(0);
|
||||
timeKEY* b2 = (timeKEY*)PG_GETARG_POINTER(1);
|
||||
bool* result = (bool*)PG_GETARG_POINTER(2);
|
||||
|
||||
*result = gbt_num_same((GBT_NUMKEY*)b1, (GBT_NUMKEY*)b2, &tinfo);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,38 +240,26 @@ Datum citext_ge(PG_FUNCTION_ARGS)
|
|||
* ===================
|
||||
*/
|
||||
|
||||
// Declare a function named citext_smaller, which is an internal function of PostgreSQL, used to compare whether the first citext value is smaller than the second.
|
||||
PG_FUNCTION_INFO_V1(citext_smaller);
|
||||
|
||||
// Implement the citext_smaller function. This function takes two parameters (two text* pointers) and returns a text* value.
|
||||
Datum citext_smaller(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the first and second text* pointers from the function parameters and assign them to left and right respectively.
|
||||
text* left = PG_GETARG_TEXT_PP(0);
|
||||
text* right = PG_GETARG_TEXT_PP(1);
|
||||
// Initialize a text* variable result, which will store the result of the comparison.
|
||||
text* result = NULL;
|
||||
|
||||
// Use the citextcmp function to compare left and right. If left is smaller than right, assign left to result; otherwise, assign right to result.
|
||||
result = (citextcmp(left, right, PG_GET_COLLATION()) < 0) ? left : right;
|
||||
// Return the result of the comparison.
|
||||
PG_RETURN_TEXT_P(result);
|
||||
}
|
||||
|
||||
// Declare a function named citext_larger, which is an internal function of PostgreSQL, used to compare whether the first citext value is larger than the second.
|
||||
PG_FUNCTION_INFO_V1(citext_larger);
|
||||
|
||||
// Implement the citext_larger function. This function takes two parameters (two text* pointers) and returns a text* value.
|
||||
Datum citext_larger(PG_FUNCTION_ARGS)
|
||||
{
|
||||
// Get the first and second text* pointers from the function parameters and assign them to left and right respectively.
|
||||
text* left = PG_GETARG_TEXT_PP(0);
|
||||
text* right = PG_GETARG_TEXT_PP(1);
|
||||
// Initialize a text* variable result, which will store the result of the comparison.
|
||||
text* result = NULL;
|
||||
|
||||
// Use the citextcmp function to compare left and right. If left is larger than right, assign left to result; otherwise, assign right to result.
|
||||
result = (citextcmp(left, right, PG_GET_COLLATION()) > 0) ? left : right;
|
||||
// Return the result of the comparison.
|
||||
PG_RETURN_TEXT_P(result);
|
||||
}
|
||||
PG_FUNCTION_INFO_V1(citext_smaller);
|
||||
|
||||
Datum citext_smaller(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text* left = PG_GETARG_TEXT_PP(0);
|
||||
text* right = PG_GETARG_TEXT_PP(1);
|
||||
text* result = NULL;
|
||||
|
||||
result = (citextcmp(left, right, PG_GET_COLLATION()) < 0) ? left : right;
|
||||
PG_RETURN_TEXT_P(result);
|
||||
}
|
||||
|
||||
PG_FUNCTION_INFO_V1(citext_larger);
|
||||
|
||||
Datum citext_larger(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text* left = PG_GETARG_TEXT_PP(0);
|
||||
text* right = PG_GETARG_TEXT_PP(1);
|
||||
text* result = NULL;
|
||||
|
||||
result = (citextcmp(left, right, PG_GET_COLLATION()) > 0) ? left : right;
|
||||
PG_RETURN_TEXT_P(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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']);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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")));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue