forked from opengaussexamples/examples
开源之夏2025-SUSE操作系统集成openGauss 6.0.0 LTS
Co-authored-by: JaleShaw<enjoy-success@qq.com>
This commit is contained in:
parent
0b0c36df87
commit
680adc8c2d
|
|
@ -0,0 +1,2 @@
|
|||
openGauss-server-6.0.0.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||
aws-sdk-cpp-1.11.327.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' DCF-6.0.0/CMakeLists.txt DCF-6.0.0-edit/CMakeLists.txt
|
||||
*** DCF-6.0.0/CMakeLists.txt 2024-11-02 17:04:54.937886579 +0800
|
||||
--- DCF-6.0.0-edit/CMakeLists.txt 2024-11-02 17:04:05.634252331 +0800
|
||||
***************
|
||||
*** 84,89 ****
|
||||
--- 84,91 ----
|
||||
add_compile_options(-mtune=cortex-a72 -fsigned-char -g -ggdb3 -march=armv8-a+crc -funwind-tables)
|
||||
elseif (OS_ARCH STREQUAL "x86_64")
|
||||
add_compile_options(-msse4.2 )
|
||||
+ else ()
|
||||
+ add_compile_options()
|
||||
endif ()
|
||||
Add_Definitions(-DWSEC_COMPILE_CAC_OPENSSL -DWSEC_AES_GCM_SUPPORT -DWSEC_USE_OPENSSL_110)
|
||||
else ()
|
||||
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' DCF-6.0.0/src/common/cm_concurrency/cm_spinlock.h DCF-6.0.0-edit/src/common/cm_concurrency/cm_spinlock.h
|
||||
*** DCF-6.0.0/src/common/cm_concurrency/cm_spinlock.h 2025-09-09 11:35:06.205098732 +0800
|
||||
--- DCF-6.0.0-edit/src/common/cm_concurrency/cm_spinlock.h 2025-09-09 11:37:37.272606843 +0800
|
||||
***************
|
||||
*** 63,77 ****
|
||||
uint64 fails;
|
||||
} spin_statis_t;
|
||||
|
||||
! #if defined(__arm__) || defined(__aarch64__) || defined(__loongarch__)
|
||||
#define fas_cpu_pause() \
|
||||
{ \
|
||||
! __asm__ volatile("nop"); \
|
||||
}
|
||||
#else
|
||||
#define fas_cpu_pause() \
|
||||
{ \
|
||||
! __asm__ volatile("pause"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
--- 63,77 ----
|
||||
uint64 fails;
|
||||
} spin_statis_t;
|
||||
|
||||
! #if defined(__i386__) || defined(__x86_64__)
|
||||
#define fas_cpu_pause() \
|
||||
{ \
|
||||
! __asm__ volatile("pause"); \
|
||||
}
|
||||
#else
|
||||
#define fas_cpu_pause() \
|
||||
{ \
|
||||
! __asm__ volatile("nop"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
diff -crN DCF-6.0.0/src/common/cm_utils/cm_memory.h DCF-6.0.0-edit/src/common/cm_utils/cm_memory.h
|
||||
*** DCF-6.0.0/src/common/cm_utils/cm_memory.h 2024-11-02 17:38:45.539451623 +0800
|
||||
--- DCF-6.0.0-edit/src/common/cm_utils/cm_memory.h 2024-11-02 17:37:19.781567264 +0800
|
||||
***************
|
||||
*** 62,68 ****
|
||||
__asm__ volatile("mfence" :: \
|
||||
: "memory"); \
|
||||
}
|
||||
! #elif defined(__loongarch__)
|
||||
#define CM_MFENCE \
|
||||
{ \
|
||||
__asm__ volatile("" :: \
|
||||
--- 62,68 ----
|
||||
__asm__ volatile("mfence" :: \
|
||||
: "memory"); \
|
||||
}
|
||||
! #elif defined(__loongarch__) || defined(__riscv) || defined(_ARCH_PPC64) || defined(__s390x__)
|
||||
#define CM_MFENCE \
|
||||
{ \
|
||||
__asm__ volatile("" :: \
|
||||
diff -crN DCF-6.0.0/src/common/cm_utils/cm_checksum.h DCF-6.0.0-edit/src/common/cm_utils/cm_checksum.h
|
||||
*** DCF-6.0.0/src/common/cm_utils/cm_checksum.h 2025-09-08 16:39:54.805517026 +0800
|
||||
--- DCF-6.0.0-edit/src/common/cm_utils/cm_checksum.h 2025-09-08 16:40:03.269468694 +0800
|
||||
***************
|
||||
*** 38,44 ****
|
||||
#define CM_HAVE_SSE4_2
|
||||
#include <intrin.h>
|
||||
#define CM_HAVE__CPUID
|
||||
! #elif defined(__i386__) || defined(__x86_64__)
|
||||
#include <nmmintrin.h>
|
||||
#define CM_HAVE_SSE4_2
|
||||
#include <cpuid.h>
|
||||
--- 38,44 ----
|
||||
#define CM_HAVE_SSE4_2
|
||||
#include <intrin.h>
|
||||
#define CM_HAVE__CPUID
|
||||
! #elif defined(__x86_64__)
|
||||
#include <nmmintrin.h>
|
||||
#define CM_HAVE_SSE4_2
|
||||
#include <cpuid.h>
|
||||
Binary file not shown.
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/src/election/elc_msg_proc.c b/src/election/elc_msg_proc.c
|
||||
index 9aa9552..7c3df3d 100644
|
||||
--- a/src/election/elc_msg_proc.c
|
||||
+++ b/src/election/elc_msg_proc.c
|
||||
@@ -179,7 +179,7 @@ bool32 elc_need_demote_follow(uint32 stream_id, timespec_t now, uint32 elc_timeo
|
||||
uint32 voter_num = 0;
|
||||
dcf_node_role_t node_list[CM_MAX_NODE_COUNT];
|
||||
uint32 node_count;
|
||||
- uint32 local_node_id = md_get_cur_node(stream_id);
|
||||
+ uint32 local_node_id = md_get_cur_node();
|
||||
dcf_role_t default_role;
|
||||
if (elc_stream_get_work_mode(stream_id) != WM_NORMAL) {
|
||||
return CM_FALSE;
|
||||
diff --git a/src/common/cm_concurrency/cm_thread.c b/src/common/cm_concurrency/cm_thread.c
|
||||
index 723b1de..92e0895 100644
|
||||
--- a/src/common/cm_concurrency/cm_thread.c
|
||||
+++ b/src/common/cm_concurrency/cm_thread.c
|
||||
@@ -296,7 +296,7 @@ uint32 cm_get_current_thread_id(void)
|
||||
#define __SYS_GET_SPID 186
|
||||
#elif (defined __aarch64__)
|
||||
#define __SYS_GET_SPID 178
|
||||
-#elif (defined __loongarch__)
|
||||
+#else
|
||||
#include<sys/syscall.h>
|
||||
#define __SYS_GET_SPID SYS_gettid
|
||||
#endif
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
|
||||
ANSI_OBJS = fscanf_s.o gets_s.o memcpy_s.o memmove_s.o memset_s.o scanf_s.o securecutil.o secureinput_a.o secureprintoutput_a.o snprintf_s.o sprintf_s.o sscanf_s.o strcat_s.o strcpy_s.o strncat_s.o strncpy_s.o strtok_s.o vfscanf_s.o vscanf_s.o vsnprintf_s.o vsprintf_s.o vsscanf_s.o
|
||||
|
||||
UNICODE_OBJS = secureinput_w.o vswscanf_s.o vwscanf_s.o fwscanf_s.o swprintf_s.o swscanf_s.o vfwscanf_s.o vswprintf_s.o wcscat_s.o wcscpy_s.o wcsncat_s.o wcsncpy_s.o wcstok_s.o wmemcpy_s.o wmemmove_s.o wscanf_s.o secureprintoutput_w.o
|
||||
|
||||
ALL_OBJS = $(ANSI_OBJS) $(UNICODE_OBJS)
|
||||
|
||||
TESTOBJS = $(ALL_OBJS) test.o
|
||||
|
||||
CC = gcc
|
||||
|
||||
FLAGS = -I ../include -Wall -DNDEBUG -DSECUREC_WARP_OUTPUT -s -fstack-protector-strong -Wl,-z,relro,-z,now -O2
|
||||
#FLAGS = -Wall -W -I ../include -I. -g -D_DEBUG
|
||||
|
||||
ARCH:=$(shell getconf LONG_BIT)
|
||||
|
||||
ifeq ($(ARCH), 64)
|
||||
FLAGS += -fPIC
|
||||
endif
|
||||
|
||||
|
||||
securecshare: $(ALL_OBJS)
|
||||
$(CC) $(FLAGS) -shared -Wl,-soname=libsecurec.so -o libsecurec.so $(ALL_OBJS)
|
||||
ansisecurecshare: $(ANSI_OBJS)
|
||||
$(CC) $(FLAGS) -shared -Wl,-soname=libsecurec.so -o libsecurec.so $(ANSI_OBJS)
|
||||
securecstatic: $(ALL_OBJS)
|
||||
ar crv libsecurec.a $(ALL_OBJS)
|
||||
ranlib libsecurec.a
|
||||
ansisecurecstatic: $(ANSI_OBJS)
|
||||
ar crv libsecurec.a $(ANSI_OBJS)
|
||||
ranlib libsecurec.a
|
||||
secureinput_a.o : secureinput_a.c secinput.h input.inl
|
||||
$(CC) $(FLAGS) -c secureinput_a.c
|
||||
secureinput_w.o : secureinput_w.c secinput.h input.inl
|
||||
$(CC) $(FLAGS) -c secureinput_w.c
|
||||
fscanf_s.o : fscanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c fscanf_s.c
|
||||
fwscanf_s.o : fwscanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c fwscanf_s.c
|
||||
gets_s.o : gets_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c gets_s.c
|
||||
memcpy_s.o : memcpy_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c memcpy_s.c
|
||||
memmove_s.o : memmove_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c memmove_s.c
|
||||
memset_s.o : memset_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c memset_s.c
|
||||
scanf_s.o : scanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c scanf_s.c
|
||||
securecutil.o : securecutil.c securecutil.h secureprintoutput.h
|
||||
$(CC) $(FLAGS) -c securecutil.c
|
||||
secureprintoutput_a.o : secureprintoutput_a.c securecutil.h secureprintoutput.h output.inl
|
||||
$(CC) $(FLAGS) -c secureprintoutput_a.c
|
||||
secureprintoutput_w.o : secureprintoutput_w.c securecutil.h secureprintoutput.h output.inl
|
||||
$(CC) $(FLAGS) -c secureprintoutput_w.c
|
||||
snprintf_s.o : snprintf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c snprintf_s.c
|
||||
sprintf_s.o : sprintf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c sprintf_s.c
|
||||
sscanf_s.o : sscanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c sscanf_s.c
|
||||
strcat_s.o : strcat_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c strcat_s.c
|
||||
strcpy_s.o : strcpy_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c strcpy_s.c
|
||||
strncat_s.o : strncat_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c strncat_s.c
|
||||
strncpy_s.o : strncpy_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c strncpy_s.c
|
||||
strtok_s.o : strtok_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c strtok_s.c
|
||||
swprintf_s.o : swprintf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c swprintf_s.c
|
||||
swscanf_s.o : swscanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c swscanf_s.c
|
||||
vfscanf_s.o : vfscanf_s.c securecutil.h input.inl
|
||||
$(CC) $(FLAGS) -c vfscanf_s.c
|
||||
vfwscanf_s.o : vfwscanf_s.c securecutil.h input.inl
|
||||
$(CC) $(FLAGS) -c vfwscanf_s.c
|
||||
vscanf_s.o : vscanf_s.c securecutil.h input.inl
|
||||
$(CC) $(FLAGS) -c vscanf_s.c
|
||||
vsnprintf_s.o : vsnprintf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c vsnprintf_s.c
|
||||
vsprintf_s.o : vsprintf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c vsprintf_s.c
|
||||
vsscanf_s.o : vsscanf_s.c securecutil.h input.inl
|
||||
$(CC) $(FLAGS) -c vsscanf_s.c
|
||||
vswprintf_s.o : vswprintf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c vswprintf_s.c
|
||||
vswscanf_s.o : vswscanf_s.c securecutil.h input.inl
|
||||
$(CC) $(FLAGS) -c vswscanf_s.c
|
||||
vwscanf_s.o : vwscanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c vwscanf_s.c
|
||||
wcscat_s.o : wcscat_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wcscat_s.c
|
||||
wcscpy_s.o : wcscpy_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wcscpy_s.c
|
||||
wcsncat_s.o : wcsncat_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wcsncat_s.c
|
||||
wcsncpy_s.o : wcsncpy_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wcsncpy_s.c
|
||||
wcstok_s.o : wcstok_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wcstok_s.c
|
||||
wmemcpy_s.o : wmemcpy_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wmemcpy_s.c
|
||||
wmemmove_s.o : wmemmove_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wmemmove_s.c
|
||||
wscanf_s.o : wscanf_s.c securecutil.h
|
||||
$(CC) $(FLAGS) -c wscanf_s.c
|
||||
maketest: $(TESTOBJS)
|
||||
$(CC) $(FLAGS) -o tst $(TESTOBJS)
|
||||
test.o : test.c
|
||||
$(CC) $(FLAGS) -c test.c
|
||||
|
||||
staticlink: $(TESTOBJS)
|
||||
$(CC) $(FLAGS) -o tst test.c -L. -lsecurec.a
|
||||
dynLink:
|
||||
gcc -g -o tst test.c -L. -l/home/l00254400/sec -lsecurec
|
||||
gcc -g -o tst test.c -L. -lsecurec
|
||||
gcc -g -o tst test.c -L. -l./securec
|
||||
clean:
|
||||
rm *.o
|
||||
|
||||
Binary file not shown.
|
|
@ -0,0 +1,416 @@
|
|||
<div style="text-align: center;font-weight: bold;font-size: xx-large;">openGauss 6.0打包脚本—— SUSE 系操作系统</div>
|
||||
|
||||
# 概述
|
||||
|
||||
## 项目成果
|
||||
|
||||
本项目已成功在openSUSE Leap 15.6,openSUSE Tumbleweed,SUSE Linux Enterprise Server 15 SP7三个发行版,以及四种支持架构(x86_64, aarch64, ppc64le, s390x)上完成了openGauss 6.0.0软件包的构建、运行和测试工作。
|
||||
|
||||
此外,项目构建仓库(含完整的打包脚本、源码和补丁)已被提交至openSUSE Build Service平台,并顺利通过在线验证。同时本项目已被官方运营的`server:database`类顺利接收通过。具体详情如下:
|
||||
1. 提交`server:database`申请请求通过:https://build.opensuse.org/requests/1305598
|
||||
2. 本项目在openSUSE Build Service上的托管地址:https://build.opensuse.org/package/show/server:database/opengauss
|
||||
3. openSUSE官方提供构建输出的下载页面:https://software.opensuse.org/download.html?project=server%3Adatabase&package=opengauss
|
||||
|
||||
## 项目部署与测试
|
||||
|
||||
### 本地编译(可选)
|
||||
|
||||
#### openSUSE Leap 15.6 打包编译方法
|
||||
|
||||
1. 进行必要的软件源配置([opensuse | 镜像站使用帮助](https://mirrors.tuna.tsinghua.edu.cn/help/opensuse/)),运行以下命令安装必要软件包:
|
||||
|
||||
```bash
|
||||
$ sudo zypper install git git-lfs rpm-build rpmdevtools cmake gcc gcc-c++ openssl-devel python tar unzip liblz4-devel libzstd-devel libboost_headers-devel cJSON-devel libcgroup-devel libcurl-devel bison flex autoconf java-1_8_0-openjdk-devel libedit-devel libaio-devel libxerces-c-devel libxml2-devel unixODBC-devel jemalloc-devel ncurses-devel libboost_thread-devel libboost_atomic-devel libboost_system-devel libboost_chrono-devel
|
||||
```
|
||||
|
||||
2. 运行`rpmdev-setuptree`设置RPM编译环境
|
||||
|
||||
3. 下载并部署本项目(注意有git lfs文件)至系统中,将项目中全部文件移动至`~/rpmbuild/SOURCES`文件夹下。
|
||||
|
||||
4. 启动编译:
|
||||
|
||||
```bash
|
||||
$ cd ~/rpmbuild/SOURCES
|
||||
$ rpmbuild -ba opengauss-server.spec
|
||||
```
|
||||
编译结束后的RPM包位于`~/rpmbuild/RPMS/$(uname -m)/opengauss-6.0.0-24.$(uname -m).rpm`
|
||||
|
||||
5. 安装编译好的软件包(可在另外的机器上安装,也可在编译机上安装):
|
||||
|
||||
```bash
|
||||
$ sudo zypper install ~/rpmbuild/RPMS/$(uname -m)/opengauss-6.0.0-24.$(uname -m).rpm
|
||||
```
|
||||
|
||||
#### SUSE Linux Enterprise Server 15(SLES)打包编译方法
|
||||
|
||||
1. 激活系统,启用相关软件源,命令行中的版本号和架构请根据实际情况替换
|
||||
```
|
||||
SUSEConnect --product PackageHub/15.7/x86_64
|
||||
SUSEConnect --product sle-module-legacy/15.7/x86_64
|
||||
SUSEConnect --product sle-module-desktop-applications/15.7/x86_64
|
||||
SUSEConnect --product sle-module-development-tools/15.7/x86_64
|
||||
```
|
||||
|
||||
2. 安装软件包
|
||||
```
|
||||
sudo zypper install git-core git-lfs rpm-build rpmdevtools cmake gcc gcc-c++ openssl-devel python tar unzip liblz4-devel libzstd-devel libboost_headers-devel cJSON-devel libcgroup-devel libcurl-devel bison flex autoconf java-1_8_0-openjdk-devel libedit-devel libaio-devel libxerces-c-devel libxml2-devel unixODBC-devel jemalloc-devel ncurses-devel libboost_thread-devel libboost_atomic-devel libboost_system-devel libboost_chrono-devel
|
||||
```
|
||||
|
||||
3. 后续步骤与openSUSE无异
|
||||
|
||||
### 安装
|
||||
|
||||
搭建openSUSE Leap 15.6 x86_64虚拟机,目前安装openGauss数据库软件包有两种方式:
|
||||
1. 在线安装:按照 [官方指引](https://software.opensuse.org/download.html?project=server%3Adatabase&package=opengauss),输入合适的命令,即可通过`zypper`在线安装。
|
||||
2. 离线安装:若因网络原因无法在线安装,可先获取到离线安装包,传输至虚拟机中后,通过`zypper in opengauss-6.0.0.x86_64.rpm`进行安装,由于签名密钥未被信任,安装过程需输入`i`,继续安装。
|
||||
|
||||
安装完成后输入`systemctl status opengauss`即可启动openGauss数据库
|
||||
|
||||
### 测试
|
||||
|
||||
在另一台机器上部署`benchmarksql-5.0`与opengauss专用的JDBC驱动,进行简单压力测试。其中简单的benchmarksql任务配置如下:
|
||||
```
|
||||
conn=jdbc:postgresql://192.168.33.130:7654/tpcctest
|
||||
user=bot
|
||||
password=Gaussdba@Mpp
|
||||
|
||||
warehouses=5
|
||||
loadWorkers=10
|
||||
|
||||
terminals=20
|
||||
runTxnsPerTerminal=0
|
||||
runMins=5
|
||||
limitTxnsPerMin=0
|
||||
```
|
||||
在服务端创建好所需的用户、数据库,并添加相应的远程访问规则。然后在测试机上运行测试,测试过程中在openGauss服务部署的虚拟机上可以观察到数据库进程的正常运行。最终测试结果如下(2虚拟核心,5GB RAM):
|
||||
|
||||
```
|
||||
Term-00, Running Average tpmTOTAL: 28250.90 Current tpmTOTAL: 935592 Memory Usage: 44MB / 129MB
|
||||
18:32:30,078 [Thread-5] INFO jTPCC : Term-00,
|
||||
18:32:30,078 [Thread-5] INFO jTPCC : Term-00,
|
||||
18:32:30,078 [Thread-5] INFO jTPCC : Term-00, Measured tpmC (NewOrders) = 12695.42
|
||||
18:32:30,078 [Thread-5] INFO jTPCC : Term-00, Measured tpmTOTAL = 28244.63
|
||||
```
|
||||
|
||||
综合来看,本项目编译打包的openGauss 6.0.0顺利通过5分钟压力测试,具备实际可用性。
|
||||
|
||||
# 项目细节
|
||||
|
||||
|
||||
在适配openSUSE的过程中,遇到许多兼容性和规范性问题。为解决这些问题,本项目在基于openEuler原版打包编译脚本的基础上,进行了大量修改,本章主要阐述不断优化打包过程的具体技术细节。
|
||||
|
||||
## RPM SPEC攥写与rpmlint检查
|
||||
|
||||
openSUSE为了确保软件打包的规范性,制定了一系列严格的规则,通过rpmlint工具实施检查。根据RPM SPEC规范,提交openSUSE社区时的审核意见,本项目在SPEC攥写规范上进行了针对性适配,主要包括:
|
||||
+ BuildRequires,Requires标签单行排列,一行只描述一个依赖包
|
||||
+ 大幅削减SPEC指出的Requires数量,减少不必要的运行时依赖,主要通过rpm自带的依赖分析推理得到Requires数据。
|
||||
+ `__requires_exclude`变量仅排除掉内部自带动态库,而不是所有库。
|
||||
+ 在编译依赖库时,去除了不常用的编译、链接选项,现在使用编译器默认选项进行。
|
||||
+ 获取编译打包的目标架构时,应通过内置宏`%{_arch}`获取。
|
||||
+ 使用`%cmake, %cmake_build, %cmake_install`内置宏进行openGauss源码编译,而不是直接调用`cmake, make, make install`命令。
|
||||
+ 在单独的`%install`环节处理安装,`%build`环节仅处理依赖库及openGauss的编译工作。
|
||||
+ 根据rpmlint检查结果,编写rpmlint过滤规则集:
|
||||
```py
|
||||
addFilter(r'(non-standard-gid|non-standard-uid) .* opengauss')
|
||||
addFilter(r'(postin-without-ldconfig|postun-without-ldconfig) /var/lib/opengauss/pkg_6.0.0/lib/.*')
|
||||
addFilter(r'shared-lib-calls-exit /var/lib/opengauss/pkg_6.0.0/lib/.*')
|
||||
addFilter(r'binary-or-shlib-calls-gethostbyname')
|
||||
addFilter(r'non-standard-group')
|
||||
addFilter(r'devel-file-in-non-devel-package.* /var/lib/opengauss/pkg_6.0.0/lib/.*.so')
|
||||
```
|
||||
|
||||
## 引入外部编译依赖
|
||||
|
||||
经过实际调查分析,在openSUSE上编译openGauss,系统软件源无法提供的依赖模块有:xgboost, Huawei Secure C, DCF, aws-sdk-cpp, Kerberos 5,其中Kerberos 5库为openGauss修改定制版。
|
||||
|
||||
Kerberos 5的编译过程主要改动点在于,为了支持高版本GCC,单独加上了`-std=gnu11`选项,以避免编译出错,同时删除不需要安装的目录。具体编译过程如下:
|
||||
```
|
||||
pushd %{krb5_name}-%{krb5_name}-%{krb5_version}
|
||||
krb5_dir=${dependency_loc}/kerberos/comm
|
||||
|
||||
cd src
|
||||
rm -rf configure; cp %{SOURCE20} ./configure
|
||||
autoheader; chmod +x configure
|
||||
./configure CFLAGS='-std=gnu11' --prefix=${krb5_dir} --disable-rpath --disable-pkinit --with-system-verto=no
|
||||
|
||||
make %{?_smp_mflags}
|
||||
make install %{?_smp_mflags}
|
||||
|
||||
cd ${krb5_dir}
|
||||
rm -rf lib/pkgconfig share var
|
||||
popd
|
||||
```
|
||||
|
||||
xgboost库的编译过程如下:
|
||||
```
|
||||
pushd %{xgboost_name}-%{xgboost_version}
|
||||
xgboost_dir=${dependency_loc}/xgboost/comm
|
||||
|
||||
rm -rf dmlc-core
|
||||
cp -r ../dmlc-core-%{dmlc_version}/ ./dmlc-core
|
||||
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=${xgboost_dir}
|
||||
make %{?_smp_mflags}
|
||||
make install
|
||||
cp -r ${xgboost_dir} ${dependency_loc}/xgboost/llt
|
||||
popd
|
||||
```
|
||||
|
||||
Huawei Securec的编译使用了[openGauss-third_party](https://gitcode.com/opengauss/openGauss-third_party/tree/6.0.0/platform/Huawei_Secure_C)给出的Makefile,为了符合规范,本项目在该Makefile的链接动态库处加入了额外选项:`-Wl,-soname=libsecurec.so`,确保输出的动态库中包含`soname`字段。该组件编译过程如下:
|
||||
```
|
||||
pushd %{securec_name}_%{securec_version}
|
||||
securec_dir=${dependency_loc}/../platform/Huawei_Secure_C/comm
|
||||
cp %{SOURCE30} ./src/Makefile
|
||||
|
||||
make -C src securecstatic securecshare %{?_smp_mflags}
|
||||
|
||||
mkdir -p ${securec_dir}
|
||||
cp -arf include ${securec_dir}
|
||||
mkdir ${securec_dir}/lib
|
||||
cp src/libsecurec.a ${securec_dir}/lib/
|
||||
cp src/libsecurec.a ${securec_dir}/lib/libboundscheck.a
|
||||
mkdir ${securec_dir}/../Dynamic_Lib
|
||||
cp src/libsecurec.so ${securec_dir}/../Dynamic_Lib
|
||||
popd
|
||||
```
|
||||
|
||||
DCF为openGaus自研组件,主要参考[openEular DCF 编译过程](https://gitee.com/src-openeuler/opengauss-dcf)实现。在openSUSE编译时遇到编译错误,需合入以下补丁方可解决:
|
||||
```patch
|
||||
diff --git a/src/election/elc_msg_proc.c b/src/election/elc_msg_proc.c
|
||||
index 9aa9552..7c3df3d 100644
|
||||
--- a/src/election/elc_msg_proc.c
|
||||
+++ b/src/election/elc_msg_proc.c
|
||||
@@ -179,7 +179,7 @@ bool32 elc_need_demote_follow(uint32 stream_id, timespec_t now, uint32 elc_timeo
|
||||
uint32 voter_num = 0;
|
||||
dcf_node_role_t node_list[CM_MAX_NODE_COUNT];
|
||||
uint32 node_count;
|
||||
- uint32 local_node_id = md_get_cur_node(stream_id);
|
||||
+ uint32 local_node_id = md_get_cur_node();
|
||||
dcf_role_t default_role;
|
||||
if (elc_stream_get_work_mode(stream_id) != WM_NORMAL) {
|
||||
return CM_FALSE;
|
||||
diff --git a/src/common/cm_concurrency/cm_thread.c b/src/common/cm_concurrency/cm_thread.c
|
||||
index 723b1de..92e0895 100644
|
||||
--- a/src/common/cm_concurrency/cm_thread.c
|
||||
+++ b/src/common/cm_concurrency/cm_thread.c
|
||||
@@ -296,7 +296,7 @@ uint32 cm_get_current_thread_id(void)
|
||||
#define __SYS_GET_SPID 186
|
||||
#elif (defined __aarch64__)
|
||||
#define __SYS_GET_SPID 178
|
||||
-#elif (defined __loongarch__)
|
||||
+#else
|
||||
#include<sys/syscall.h>
|
||||
#define __SYS_GET_SPID SYS_gettid
|
||||
#endif
|
||||
```
|
||||
该组件具体编译过程如下:
|
||||
```
|
||||
pushd %{dcf_name}-%{dcf_version}
|
||||
dcf_dir=${dependency_loc}/../component/dcf
|
||||
mkdir library
|
||||
cp -r ${securec_dir} ./library/huawei_security
|
||||
mkdir -p library/cJSON/include
|
||||
cp /usr/include/cjson/cJSON.h library/cJSON/include
|
||||
|
||||
cmake -S . -B tmp_build -DCMAKE_INSTALL_PREFIX=${dcf_dir} -DCMAKE_BUILD_TYPE=Release -DENABLE_EXPORT_API=OFF -DTEST=OFF
|
||||
make -C tmp_build %{?_smp_mflags}
|
||||
|
||||
mkdir -p ${dcf_dir}
|
||||
cp -arf ./output/lib ${dcf_dir}/
|
||||
cp -arf ./src/interface ${dcf_dir}/include
|
||||
popd
|
||||
```
|
||||
aws-sdk-cpp库主要[openEular aws-sdk-cpp 编译过程](https://gitee.com/src-openeuler/aws-sdk-cpp)实现,具体过程如下:
|
||||
```
|
||||
pushd %{awssdk_name}-%{awssdk_version}
|
||||
awssdk_dir=${dependency_loc}/aws-sdk-cpp/comm
|
||||
mkdir tmp_build && cd tmp_build
|
||||
|
||||
cmake .. -DBUILD_ONLY="s3" \
|
||||
-DCMAKE_SKIP_RPATH=TRUE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_INSTALL_PREFIX=${awssdk_dir} \
|
||||
-DENABLE_TESTING=OFF
|
||||
make %{?_smp_mflags}
|
||||
make install
|
||||
mv ${awssdk_dir}/lib64 ${awssdk_dir}/lib || true
|
||||
popd
|
||||
```
|
||||
|
||||
## 优化openGauss编译过程
|
||||
|
||||
在openGaus本体编译打包过程中,为解决openSUSE上特有的编译、运行问题,本项目对原版openGaus 6.0.0代码进行了针对性修改,确保能够在openSUSE上编译、运行通过。
|
||||
|
||||
### 修复CMake配置中的头文件冲突
|
||||
|
||||
在openSUSE Tumbleweed系统中,由于使用了高版本的GCC编译器,造成`editline/history.h`, `editline/readline.h`头文件与`readline.h`, `readline/history.h`, `readline/readline.h`头文件冲突,导致CMake配置过程中的重要函数`CHECK_FOR_MPPDB`无法正常运行,进而影响编译。应当将此处的`editline/history.h editline/readline.h`头文件移除,补丁(og-susebuild.path)节选如下:
|
||||
```patch
|
||||
diff --git a/cmake/src/build_function.cmake b/cmake/src/build_function.cmake
|
||||
index fc114c9f2..f22208259 100755
|
||||
--- a/cmake/src/build_function.cmake
|
||||
+++ b/cmake/src/build_function.cmake
|
||||
@@ -395,7 +395,7 @@ function(check_headers_func_c check_include_files check_functions check_decl che
|
||||
endfunction(check_headers_func_c)
|
||||
|
||||
function(CHECK_FOR_MPPDB)
|
||||
- set(CHECK_INC_FILES crtdefs.h crypt.h dld.h editline/history.h editline/readline.h fp_class.h …… readline.h readline/history.h readline/readline.h …… errno.h)
|
||||
+ set(CHECK_INC_FILES crtdefs.h crypt.h dld.h fp_class.h …… readline.h readline/history.h readline/readline.h …… errno.h)
|
||||
set(STDC_HEADERS 1 PARENT_SCOPE)
|
||||
|
||||
set(CHECK_FUNCTIONS append_history cbrt ……)
|
||||
```
|
||||
|
||||
### dolphin组件编译
|
||||
在原版openGaus编译描述文件`CMakeLists.txt`中,存在如下行:
|
||||
```
|
||||
install(CODE "execute_process(COMMAND bash cmake.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/contrib/dolphin)")
|
||||
```
|
||||
这意味着,dolphin组件是在install阶段通过执行一个脚本进行编译的,由于install过程在单独的环节中执行,且该环节下不应出现编译过程,因而这种策略并不合适。
|
||||
|
||||
合理做法是将位于`contrib`目录下的dolphin组件通过`add_subdirectory`加入CMakeLists,使之与项目顶层一同配置和编译,具体如下:
|
||||
```patch
|
||||
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
|
||||
index 7777f062..8b827394 100644
|
||||
--- a/contrib/CMakeLists.txt
|
||||
+++ b/contrib/CMakeLists.txt
|
||||
@@ -58,3 +65,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/datavec)
|
||||
add_subdirectory(datavec)
|
||||
endif()
|
||||
add_subdirectory(gms_profiler)
|
||||
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/dolphin)
|
||||
+ add_subdirectory(dolphin)
|
||||
+endif()
|
||||
\ No newline at end of file
|
||||
```
|
||||
同时修改了`contrib/dolphin/CMakeLists.txt`的目录变量,将`CMAKE_SOURCE_DIR`全部修改为`CMAKE_CURRENT_SOURCE_DIR`,确保相关变量能够正确指向openGauss源代码根目录,具体如下:
|
||||
```patch
|
||||
diff --git a/contrib/dolphin/CMakeLists.txt b/contrib/dolphin/CMakeLists.txt
|
||||
index 4a606c78..b9a87a76 100755
|
||||
--- a/contrib/dolphin/CMakeLists.txt
|
||||
+++ b/contrib/dolphin/CMakeLists.txt
|
||||
@@ -38,11 +38,11 @@ if("${ENABLE_PRIVATEGAUSS}" STREQUAL "ON")
|
||||
endif()
|
||||
|
||||
#FIXME: make it an argument
|
||||
-set(openGauss "../..")
|
||||
-set(ENV{openGauss} "../..")
|
||||
+set(openGauss ".")
|
||||
+set(ENV{openGauss} ".")
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
-set(PROJECT_TRUNK_DIR ${CMAKE_SOURCE_DIR}/../..)
|
||||
+set(PROJECT_TRUNK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
set(PROJECT_OPENGS_DIR ${PROJECT_TRUNK_DIR} CACHE INTERNAL "")
|
||||
|
||||
# PROJECT_TRUNK_DIR: ./
|
||||
@@ -75,7 +75,7 @@ endif()
|
||||
|
||||
message(WARNING "dolphin cmake begin")
|
||||
|
||||
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../cmake/src)
|
||||
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/src)
|
||||
|
||||
include(build_function)
|
||||
include(set_thirdparty_path)
|
||||
```
|
||||
针对dolphin编译修改的更多内容汇总在构建仓下的`og-dolphin.patch`补丁中。全部修改到位后,可实现dolphin组件在`%build`阶段与openGaus一起配置和编译。
|
||||
|
||||
### 多架构支持
|
||||
|
||||
对于非`x86_64`和`aarch64`架构而言,需在原版openGaus代码中修改部分内容,才能确保在openSUSE支持的`ppc64le, s390x`架构上编译运行通过。该部分所有修改汇总于补丁`og-more-arch-support.patch`中。
|
||||
|
||||
特殊指令兼容性问题。在CRC32计算过程中使用了SSE4.2指令集,需在CMakeFiles中移除使用该指令集的源代码文件,具体补丁节选如下:
|
||||
```patch
|
||||
diff --git a/src/common/port/CMakeLists.txt b/src/common/port/CMakeLists.txt
|
||||
index b9a6a28..e511eb0 100755
|
||||
--- a/src/common/port/CMakeLists.txt
|
||||
+++ b/src/common/port/CMakeLists.txt
|
||||
@@ -90,10 +90,31 @@ if("${BUILD_TUPLE}" STREQUAL "aarch64")
|
||||
set(TGT_crc32_arm_parallel_SRC ${CMAKE_CURRENT_SOURCE_DIR}/crc32_arm_parallel.S)
|
||||
endif()
|
||||
|
||||
+if("${BUILD_TUPLE}" STREQUAL "ppc64le")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "s390x")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
SET(TGT_pgport_INC
|
||||
${PROJECT_SRC_DIR}/common/backend
|
||||
${PROJECT_SRC_DIR}/common/port
|
||||
```
|
||||
大小端字节序适配问题。由于s390x平台为大端字节序(其余架构都为小端序),而openGaus在开发过程中未针对大端序进行充分考量,导致服务程序`gaussdb`在运行中会因为锁(LWLock)而卡死。在SPEC中,当目标架构为s390x时,会向CMake命令传入`-DWORDS_BIGENDIAN=ON`选项,强制指定当前为大端序运行平台,随后还需修改以下操作锁(LWLock,BufferDesc)的代码,具体补丁节选如下:
|
||||
```patch
|
||||
diff --git a/src/gausskernel/storage/lmgr/lwlock.cpp b/src/gausskernel/storage/lmgr/lwlock.cpp
|
||||
index d84b4334..7b547c4d 100644
|
||||
--- a/src/gausskernel/storage/lmgr/lwlock.cpp
|
||||
+++ b/src/gausskernel/storage/lmgr/lwlock.cpp
|
||||
@@ -893,7 +893,13 @@ static bool LWLockAttemptLock(LWLock *lock, LWLockMode mode)
|
||||
if ((desired_state & (LW_VAL_EXCLUSIVE)) != 0) {
|
||||
return true;
|
||||
}
|
||||
- } while (!pg_atomic_compare_exchange_u8((((volatile uint8*)&lock->state) + maskId), ((uint8*)&old_state) + maskId, (desired_state >> (8 * maskId))));
|
||||
+ } while (!pg_atomic_compare_exchange_u8(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ (((volatile uint8*)&lock->state) + maskId), ((uint8*)&old_state) + maskId,
|
||||
+#else
|
||||
+ (((volatile uint8*)&lock->state) + sizeof(lock->state) - maskId - 1), ((uint8*)&old_state) + sizeof(lock->state) - maskId - 1,
|
||||
+#endif
|
||||
+ (desired_state >> (8 * maskId))));
|
||||
} else if (mode == LW_EXCLUSIVE) {
|
||||
old_state = pg_atomic_read_u64(&lock->state);
|
||||
do {
|
||||
diff --git a/src/gausskernel/storage/buffer/bufmgr.cpp b/src/gausskernel/storage/buffer/bufmgr.cpp
|
||||
index c6a4c2c2..3b71a381 100644
|
||||
--- a/src/gausskernel/storage/buffer/bufmgr.cpp
|
||||
+++ b/src/gausskernel/storage/buffer/bufmgr.cpp
|
||||
@@ -1962,7 +1962,13 @@ Buffer ReadBuffer_common_for_localbuf(RelFileNode rnode, char relpersistence, Fo
|
||||
|
||||
Assert(buf_state & BM_VALID);
|
||||
buf_state &= ~BM_VALID;
|
||||
- pg_atomic_write_u32(((volatile uint32 *)&bufHdr->state) + 1, buf_state >> 32);
|
||||
+ pg_atomic_write_u32(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ ((volatile uint32 *)&bufHdr->state) + 1,
|
||||
+#else
|
||||
+ ((volatile uint32 *)&bufHdr->state),
|
||||
+#endif
|
||||
+ buf_state >> 32);
|
||||
}
|
||||
|
||||
/*
|
||||
```
|
||||
该问题的根源是使用8bit的读写操作去尝试读/写64bit(或32bit)长度内存数据的低8位时,由于大小端字节序的低8位数据的内存地址计算方式不同,进而产生意料之外的内存读写。
|
||||
|
||||
全部应用以上修改后,openGaus可以在`ppc64le, s390x`架构上顺利运行。
|
||||
|
||||
## 打包安装脚本
|
||||
|
||||
根据在openSUSE Build Service上给出的rpmlint检查结果,进一步优化SPEC文件中的`%install`环节,具体如下:
|
||||
+ 优化文件权限分配,仅对`bin, lib`文件夹下的程序和库分配可执行权限,其余文件不再赋予可执行权限。
|
||||
+ 优化重复文件,主要通过`%fdupes`宏将重复文件互相链接,降低空间占用。
|
||||
+ 删除无用的静态库和头文件,降低空间占用。
|
||||
+ 去除以下调用separate_debug_symbol.sh分离符号的过程,该过程由rpm在编译、安装后可自动完成。
|
||||
```sh
|
||||
cd ${opengauss_source_dir}/build/script
|
||||
chmod +x ./separate_debug_information.sh
|
||||
sed -i '/"$BIN_DIR\/gaussdb\.map"/d' ./separate_debug_information.sh
|
||||
./separate_debug_information.sh
|
||||
```
|
||||
+ 去除以下将编译产物整体压缩的过程:
|
||||
```sh
|
||||
cd ${opengauss_source_dir}/mppdb_temp_install
|
||||
tar -zcf ${kernel_package_name}.tar.bz2 *
|
||||
sha256sum ${kernel_package_name}.tar.bz2 | awk '{print $1}' > ${kernel_package_name}.sha256
|
||||
```
|
||||
由于openSUSE Build Service平台会对`%post`脚本进行重复执行,还需修改升级脚本,确保同版本升级时不会报错导致异常退出。
|
||||
|
||||
# 总结与展望
|
||||
|
||||
本项目聚焦于将openGauss 6.0.0集成至openSUSE生态系统,旨在提升openGauss在SUSE系发行版中的可访问性与部署效率。
|
||||
|
||||
在项目周期内,已成功在openSUSE Leap 15.6、openSUSE Tumbleweed及SUSE Linux Enterprise Server 15 SP7三大主流SUSE系发行版上完成openGauss 6.0.0的软件包构建、安装、运行与功能验证。通过对软件源代码的分析与调试,实现了对x86_64、aarch64、ppc64le和s390x四种关键架构的全面支持,确保了openGauss在不同硬件平台上的兼容性与可用性。
|
||||
|
||||
项目构建仓库(含完整的打包脚本、源码和补丁)已成功提交至openSUSE Build Service(OBS)平台,并通过了OBS的在线构建与验证流程(如图1所示),确保了构建过程的自动化与可复现性。且项目成果已通过openSUSE官方server:database项目组的审核与接纳(如图2所示),这将为openGauss在SUSE生态系统下的维护与推广奠定了坚实基础。
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
result=`su - opengauss -c "source ~/.bash_profile; gs_ctl start -D /var/lib/opengauss/data"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Start openGauss database failed."
|
||||
echo $result
|
||||
else
|
||||
echo "Start openGauss database success."
|
||||
fi
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2ab891848a54479566031a7ae97b4da3625682994367be2e2f91345bdcd28ded
|
||||
size 104004384
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
--- dmlc-core-0.5/CMakeLists.txt.orig 2025-03-12 09:50:11.043991872 +0800
|
||||
+++ dmlc-core-0.5/CMakeLists.txt 2025-03-12 09:50:18.250094059 +0800
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 3.2)
|
||||
+cmake_minimum_required(VERSION 3.2...${CMAKE_VERSION})
|
||||
|
||||
project(dmlc VERSION 0.3 LANGUAGES C CXX)
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
|
@ -0,0 +1,35 @@
|
|||
diff -Naur a/src/lib/kadm5/kadm_rpc_xdr.c b/src/lib/kadm5/kadm_rpc_xdr.c
|
||||
--- a/src/lib/kadm5/kadm_rpc_xdr.c 2023-09-01 16:16:12.843658117 +0800
|
||||
+++ b/src/lib/kadm5/kadm_rpc_xdr.c 2023-09-01 16:12:03.704811364 +0800
|
||||
@@ -390,6 +390,7 @@
|
||||
int v)
|
||||
{
|
||||
unsigned int n;
|
||||
+ bool_t r;
|
||||
|
||||
if (!xdr_krb5_principal(xdrs, &objp->principal)) {
|
||||
return (FALSE);
|
||||
@@ -443,6 +444,9 @@
|
||||
if (!xdr_krb5_int16(xdrs, &objp->n_key_data)) {
|
||||
return (FALSE);
|
||||
}
|
||||
+ if (xdrs->x_op == XDR_DECODE && objp->n_key_data < 0) {
|
||||
+ return (FALSE);
|
||||
+ }
|
||||
if (!xdr_krb5_int16(xdrs, &objp->n_tl_data)) {
|
||||
return (FALSE);
|
||||
}
|
||||
@@ -451,9 +455,10 @@
|
||||
return FALSE;
|
||||
}
|
||||
n = objp->n_key_data;
|
||||
- if (!xdr_array(xdrs, (caddr_t *) &objp->key_data,
|
||||
- &n, ~0, sizeof(krb5_key_data),
|
||||
- xdr_krb5_key_data_nocontents)) {
|
||||
+ r = xdr_array(xdrs, (caddr_t *) &objp->key_data, &n, objp->n_key_data,
|
||||
+ sizeof(krb5_key_data), xdr_krb5_key_data_nocontents);
|
||||
+ objp->n_key_data = n;
|
||||
+ if (!r) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
From 548da160b52b25a106e9f6077d6a42c2c049586c Mon Sep 17 00:00:00 2001
|
||||
From: Greg Hudson <ghudson@mit.edu>
|
||||
Date: Tue, 7 Mar 2023 00:19:33 -0500
|
||||
Subject: [PATCH] Add a simple DER support header
|
||||
|
||||
Reference: https://github.com/krb5/krb5/commit/548da160b52b25a106e9f6077d6a42c2c049586c
|
||||
Conflict: NA
|
||||
|
||||
---
|
||||
src/include/k5-der.h | 149 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 149 insertions(+)
|
||||
create mode 100644 src/include/k5-der.h
|
||||
|
||||
diff --git a/src/include/k5-der.h b/src/include/k5-der.h
|
||||
new file mode 100644
|
||||
index 0000000..b8371d9
|
||||
--- /dev/null
|
||||
+++ b/src/include/k5-der.h
|
||||
@@ -0,0 +1,149 @@
|
||||
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
+/* include/k5-der.h - Distinguished Encoding Rules (DER) declarations */
|
||||
+/*
|
||||
+ * Copyright (C) 2023 by the Massachusetts Institute of Technology.
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * * Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * * Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in
|
||||
+ * the documentation and/or other materials provided with the
|
||||
+ * distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * Most ASN.1 encoding and decoding is done using the table-driven framework in
|
||||
+ * libkrb5. When that is not an option, these helpers can be used to encode
|
||||
+ * and decode simple types.
|
||||
+ */
|
||||
+
|
||||
+#ifndef K5_DER_H
|
||||
+#define K5_DER_H
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <stdbool.h>
|
||||
+#include "k5-buf.h"
|
||||
+#include "k5-input.h"
|
||||
+
|
||||
+/* Return the number of bytes needed to encode len as a DER encoding length. */
|
||||
+static inline size_t
|
||||
+k5_der_len_len(size_t len)
|
||||
+{
|
||||
+ size_t llen;
|
||||
+
|
||||
+ if (len < 128)
|
||||
+ return 1;
|
||||
+ llen = 1;
|
||||
+ while (len > 0) {
|
||||
+ len >>= 8;
|
||||
+ llen++;
|
||||
+ }
|
||||
+ return llen;
|
||||
+}
|
||||
+
|
||||
+/* Return the number of bytes needed to encode a DER value (with identifier
|
||||
+ * byte and length) for a given contents length. */
|
||||
+static inline size_t
|
||||
+k5_der_value_len(size_t contents_len)
|
||||
+{
|
||||
+ return 1 + k5_der_len_len(contents_len) + contents_len;
|
||||
+}
|
||||
+
|
||||
+/* Add a DER identifier byte (composed by the caller, including the ASN.1
|
||||
+ * class, tag, and constructed bit) and length. */
|
||||
+static inline void
|
||||
+k5_der_add_taglen(struct k5buf *buf, uint8_t idbyte, size_t len)
|
||||
+{
|
||||
+ uint8_t *p;
|
||||
+ size_t llen = k5_der_len_len(len);
|
||||
+
|
||||
+ p = k5_buf_get_space(buf, 1 + llen);
|
||||
+ if (p == NULL)
|
||||
+ return;
|
||||
+ *p++ = idbyte;
|
||||
+ if (len < 128) {
|
||||
+ *p = len;
|
||||
+ } else {
|
||||
+ *p = 0x80 | (llen - 1);
|
||||
+ /* Encode the length bytes backwards so the most significant byte is
|
||||
+ * first. */
|
||||
+ p += llen;
|
||||
+ while (len > 0) {
|
||||
+ *--p = len & 0xFF;
|
||||
+ len >>= 8;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Add a DER value (identifier byte, length, and contents). */
|
||||
+static inline void
|
||||
+k5_der_add_value(struct k5buf *buf, uint8_t idbyte, const void *contents,
|
||||
+ size_t len)
|
||||
+{
|
||||
+ k5_der_add_taglen(buf, idbyte, len);
|
||||
+ k5_buf_add_len(buf, contents, len);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * If the next byte in in matches idbyte and the subsequent DER length is
|
||||
+ * valid, advance in past the value, set *contents_out to the value contents,
|
||||
+ * and return true. Otherwise return false. Only set an error on in if the
|
||||
+ * next bytes matches idbyte but the ensuing length is invalid. contents_out
|
||||
+ * may be aliased to in; it will only be written to on successful decoding of a
|
||||
+ * value.
|
||||
+ */
|
||||
+static inline bool
|
||||
+k5_der_get_value(struct k5input *in, uint8_t idbyte,
|
||||
+ struct k5input *contents_out)
|
||||
+{
|
||||
+ uint8_t lenbyte, i;
|
||||
+ size_t len;
|
||||
+ const void *bytes;
|
||||
+
|
||||
+ /* Do nothing if in is empty or the next byte doesn't match idbyte. */
|
||||
+ if (in->status || in->len == 0 || *in->ptr != idbyte)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Advance past the identifier byte and decode the length. */
|
||||
+ (void)k5_input_get_byte(in);
|
||||
+ lenbyte = k5_input_get_byte(in);
|
||||
+ if (lenbyte < 128) {
|
||||
+ len = lenbyte;
|
||||
+ } else {
|
||||
+ len = 0;
|
||||
+ for (i = 0; i < (lenbyte & 0x7F); i++) {
|
||||
+ if (len > (SIZE_MAX >> 8)) {
|
||||
+ k5_input_set_status(in, EOVERFLOW);
|
||||
+ return false;
|
||||
+ }
|
||||
+ len = (len << 8) | k5_input_get_byte(in);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ bytes = k5_input_get_bytes(in, len);
|
||||
+ if (bytes == NULL)
|
||||
+ return false;
|
||||
+ k5_input_init(contents_out, bytes, len);
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+#endif /* K5_DER_H */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
|
@ -0,0 +1,536 @@
|
|||
From b0a2f8a5365f2eec3e27d78907de9f9d2c80505a Mon Sep 17 00:00:00 2001
|
||||
From: Greg Hudson <ghudson@mit.edu>
|
||||
Date: Fri, 14 Jun 2024 10:56:12 -0400
|
||||
Subject: [PATCH] Fix vulnerabilities in GSS message token handling
|
||||
|
||||
In gss_krb5int_unseal_token_v3() and gss_krb5int_unseal_v3_iov(),
|
||||
verify the Extra Count field of CFX wrap tokens against the encrypted
|
||||
header. Reported by Jacob Champion.
|
||||
|
||||
In gss_krb5int_unseal_token_v3(), check for a decrypted plaintext
|
||||
length too short to contain the encrypted header and extra count
|
||||
bytes. Reported by Jacob Champion.
|
||||
|
||||
In kg_unseal_iov_token(), separately track the header IOV length and
|
||||
complete token length when parsing the token's ASN.1 wrapper. This
|
||||
fix contains modified versions of functions from k5-der.h and
|
||||
util_token.c; this duplication will be cleaned up in a future commit.
|
||||
|
||||
CVE-2024-37370:
|
||||
|
||||
In MIT krb5 release 1.3 and later, an attacker can modify the
|
||||
plaintext Extra Count field of a confidential GSS krb5 wrap token,
|
||||
causing the unwrapped token to appear truncated to the application.
|
||||
|
||||
CVE-2024-37371:
|
||||
|
||||
In MIT krb5 release 1.3 and later, an attacker can cause invalid
|
||||
memory reads by sending message tokens with invalid length fields.
|
||||
|
||||
ticket: 9128 (new)
|
||||
tags: pullup
|
||||
target_version: 1.21-next
|
||||
|
||||
Reference: https://github.com/krb5/krb5/commit/b0a2f8a5365f2eec3e27d78907de9f9d2c80505a
|
||||
Conflict: src/tests/gssapi/t_invalid.c
|
||||
|
||||
---
|
||||
src/lib/gssapi/krb5/k5sealv3.c | 5 +
|
||||
src/lib/gssapi/krb5/k5sealv3iov.c | 3 +-
|
||||
src/lib/gssapi/krb5/k5unsealiov.c | 80 +++++++++-
|
||||
src/tests/gssapi/t_invalid.c | 233 +++++++++++++++++++++++++-----
|
||||
4 files changed, 275 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/src/lib/gssapi/krb5/k5sealv3.c b/src/lib/gssapi/krb5/k5sealv3.c
|
||||
index e881eee..d3210c1 100644
|
||||
--- a/src/lib/gssapi/krb5/k5sealv3.c
|
||||
+++ b/src/lib/gssapi/krb5/k5sealv3.c
|
||||
@@ -400,10 +400,15 @@ gss_krb5int_unseal_token_v3(krb5_context *contextptr,
|
||||
/* Don't use bodysize here! Use the fact that
|
||||
cipher.ciphertext.length has been adjusted to the
|
||||
correct length. */
|
||||
+ if (plain.length < 16 + ec) {
|
||||
+ free(plain.data);
|
||||
+ goto defective;
|
||||
+ }
|
||||
althdr = (unsigned char *)plain.data + plain.length - 16;
|
||||
if (load_16_be(althdr) != KG2_TOK_WRAP_MSG
|
||||
|| althdr[2] != ptr[2]
|
||||
|| althdr[3] != ptr[3]
|
||||
+ || load_16_be(althdr+4) != ec
|
||||
|| memcmp(althdr+8, ptr+8, 8)) {
|
||||
free(plain.data);
|
||||
goto defective;
|
||||
diff --git a/src/lib/gssapi/krb5/k5sealv3iov.c b/src/lib/gssapi/krb5/k5sealv3iov.c
|
||||
index 333ee12..f8e90c3 100644
|
||||
--- a/src/lib/gssapi/krb5/k5sealv3iov.c
|
||||
+++ b/src/lib/gssapi/krb5/k5sealv3iov.c
|
||||
@@ -402,9 +402,10 @@ gss_krb5int_unseal_v3_iov(krb5_context context,
|
||||
if (load_16_be(althdr) != KG2_TOK_WRAP_MSG
|
||||
|| althdr[2] != ptr[2]
|
||||
|| althdr[3] != ptr[3]
|
||||
+ || load_16_be(althdr + 4) != ec
|
||||
|| memcmp(althdr + 8, ptr + 8, 8) != 0) {
|
||||
*minor_status = 0;
|
||||
- return GSS_S_BAD_SIG;
|
||||
+ return GSS_S_DEFECTIVE_TOKEN;
|
||||
}
|
||||
} else {
|
||||
/* Verify checksum: note EC is checksum size here, not padding */
|
||||
diff --git a/src/lib/gssapi/krb5/k5unsealiov.c b/src/lib/gssapi/krb5/k5unsealiov.c
|
||||
index 3ce2a90..6a6585d 100644
|
||||
--- a/src/lib/gssapi/krb5/k5unsealiov.c
|
||||
+++ b/src/lib/gssapi/krb5/k5unsealiov.c
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "k5-int.h"
|
||||
+#include "k5-der.h"
|
||||
#include "gssapiP_krb5.h"
|
||||
|
||||
static OM_uint32
|
||||
@@ -247,6 +248,73 @@ cleanup:
|
||||
return retval;
|
||||
}
|
||||
|
||||
+/* Similar to k5_der_get_value(), but output an unchecked content length
|
||||
+ * instead of a k5input containing the contents. */
|
||||
+static inline bool
|
||||
+get_der_tag(struct k5input *in, uint8_t idbyte, size_t *len_out)
|
||||
+{
|
||||
+ uint8_t lenbyte, i;
|
||||
+ size_t len;
|
||||
+
|
||||
+ /* Do nothing if in is empty or the next byte doesn't match idbyte. */
|
||||
+ if (in->status || in->len == 0 || *in->ptr != idbyte)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Advance past the identifier byte and decode the length. */
|
||||
+ (void)k5_input_get_byte(in);
|
||||
+ lenbyte = k5_input_get_byte(in);
|
||||
+ if (lenbyte < 128) {
|
||||
+ len = lenbyte;
|
||||
+ } else {
|
||||
+ len = 0;
|
||||
+ for (i = 0; i < (lenbyte & 0x7F); i++) {
|
||||
+ if (len > (SIZE_MAX >> 8)) {
|
||||
+ k5_input_set_status(in, EOVERFLOW);
|
||||
+ return false;
|
||||
+ }
|
||||
+ len = (len << 8) | k5_input_get_byte(in);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (in->status)
|
||||
+ return false;
|
||||
+
|
||||
+ *len_out = len;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Similar to g_verify_token_header() without toktype or flags, but do not read
|
||||
+ * more than *header_len bytes of ASN.1 wrapper, and on output set *header_len
|
||||
+ * to the remaining number of header bytes. Verify the outer DER tag's length
|
||||
+ * against token_len, which may be larger (but not smaller) than *header_len.
|
||||
+ */
|
||||
+static gss_int32
|
||||
+verify_detached_wrapper(const gss_OID_desc *mech, size_t *header_len,
|
||||
+ uint8_t **header_in, size_t token_len)
|
||||
+{
|
||||
+ struct k5input in, mech_der;
|
||||
+ gss_OID_desc toid;
|
||||
+ size_t len;
|
||||
+
|
||||
+ k5_input_init(&in, *header_in, *header_len);
|
||||
+
|
||||
+ if (get_der_tag(&in, 0x60, &len)) {
|
||||
+ if (len != token_len - (in.ptr - *header_in))
|
||||
+ return G_BAD_TOK_HEADER;
|
||||
+ if (!k5_der_get_value(&in, 0x06, &mech_der))
|
||||
+ return G_BAD_TOK_HEADER;
|
||||
+ toid.elements = (uint8_t *)mech_der.ptr;
|
||||
+ toid.length = mech_der.len;
|
||||
+ if (!g_OID_equal(&toid, mech))
|
||||
+ return G_WRONG_MECH;
|
||||
+ }
|
||||
+
|
||||
+ *header_in = (uint8_t *)in.ptr;
|
||||
+ *header_len = in.len;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Caller must provide TOKEN | DATA | PADDING | TRAILER, except
|
||||
* for DCE in which case it can just provide TOKEN | DATA (must
|
||||
@@ -267,8 +335,7 @@ kg_unseal_iov_token(OM_uint32 *minor_status,
|
||||
gss_iov_buffer_t header;
|
||||
gss_iov_buffer_t padding;
|
||||
gss_iov_buffer_t trailer;
|
||||
- size_t input_length;
|
||||
- unsigned int bodysize;
|
||||
+ size_t input_length, hlen;
|
||||
int toktype2;
|
||||
|
||||
header = kg_locate_header_iov(iov, iov_count, toktype);
|
||||
@@ -298,15 +365,14 @@ kg_unseal_iov_token(OM_uint32 *minor_status,
|
||||
input_length += trailer->buffer.length;
|
||||
}
|
||||
|
||||
- code = g_verify_token_header(ctx->mech_used,
|
||||
- &bodysize, &ptr, -1,
|
||||
- input_length, 0);
|
||||
+ hlen = header->buffer.length;
|
||||
+ code = verify_detached_wrapper(ctx->mech_used, &hlen, &ptr, input_length);
|
||||
if (code != 0) {
|
||||
*minor_status = code;
|
||||
return GSS_S_DEFECTIVE_TOKEN;
|
||||
}
|
||||
|
||||
- if (bodysize < 2) {
|
||||
+ if (hlen < 2) {
|
||||
*minor_status = (OM_uint32)G_BAD_TOK_HEADER;
|
||||
return GSS_S_DEFECTIVE_TOKEN;
|
||||
}
|
||||
@@ -314,7 +380,7 @@ kg_unseal_iov_token(OM_uint32 *minor_status,
|
||||
toktype2 = load_16_be(ptr);
|
||||
|
||||
ptr += 2;
|
||||
- bodysize -= 2;
|
||||
+ hlen -= 2;
|
||||
|
||||
switch (toktype2) {
|
||||
case KG2_TOK_MIC_MSG:
|
||||
diff --git a/src/tests/gssapi/t_invalid.c b/src/tests/gssapi/t_invalid.c
|
||||
index fb8fe55..d1f019f 100644
|
||||
--- a/src/tests/gssapi/t_invalid.c
|
||||
+++ b/src/tests/gssapi/t_invalid.c
|
||||
@@ -36,31 +36,41 @@
|
||||
*
|
||||
* 1. A pre-CFX wrap or MIC token processed with a CFX-only context causes a
|
||||
* null pointer dereference. (The token must use SEAL_ALG_NONE or it will
|
||||
- * be rejected.)
|
||||
+ * be rejected.) This vulnerability also applies to IOV unwrap.
|
||||
*
|
||||
- * 2. A pre-CFX wrap or MIC token with fewer than 24 bytes after the ASN.1
|
||||
+ * 2. A CFX wrap token with a different value of EC between the plaintext and
|
||||
+ * encrypted copies will be erroneously accepted, which allows a message
|
||||
+ * truncation attack. This vulnerability also applies to IOV unwrap.
|
||||
+ *
|
||||
+ * 3. A CFX wrap token with a plaintext length fewer than 16 bytes causes an
|
||||
+ * access before the beginning of the input buffer, possibly leading to a
|
||||
+ * crash.
|
||||
+ *
|
||||
+ * 4. A CFX wrap token with a plaintext EC value greater than the plaintext
|
||||
+ * length - 16 causes an integer underflow when computing the result length,
|
||||
+ * likely causing a crash.
|
||||
+ *
|
||||
+ * 5. An IOV unwrap operation will overrun the header buffer if an ASN.1
|
||||
+ * wrapper longer than the header buffer is present.
|
||||
+ *
|
||||
+ * 6. A pre-CFX wrap or MIC token with fewer than 24 bytes after the ASN.1
|
||||
* header causes an input buffer overrun, usually leading to either a segv
|
||||
* or a GSS_S_DEFECTIVE_TOKEN error due to garbage algorithm, filler, or
|
||||
- * sequence number values.
|
||||
+ * sequence number values. This vulnerability also applies to IOV unwrap.
|
||||
*
|
||||
- * 3. A pre-CFX wrap token with fewer than 16 + cksumlen bytes after the ASN.1
|
||||
+ * 7. A pre-CFX wrap token with fewer than 16 + cksumlen bytes after the ASN.1
|
||||
* header causes an integer underflow when computing the ciphertext length,
|
||||
* leading to an allocation error on 32-bit platforms or a segv on 64-bit
|
||||
* platforms. A pre-CFX MIC token of this size causes an input buffer
|
||||
* overrun when comparing the checksum, perhaps leading to a segv.
|
||||
*
|
||||
- * 4. A pre-CFX wrap token with fewer than conflen + padlen bytes in the
|
||||
+ * 8. A pre-CFX wrap token with fewer than conflen + padlen bytes in the
|
||||
* ciphertext (where padlen is the last byte of the decrypted ciphertext)
|
||||
* causes an integer underflow when computing the original message length,
|
||||
* leading to an allocation error.
|
||||
*
|
||||
- * 5. In the mechglue, truncated encapsulation in the initial context token can
|
||||
+ * 9. In the mechglue, truncated encapsulation in the initial context token can
|
||||
* cause input buffer overruns in gss_accept_sec_context().
|
||||
- *
|
||||
- * Vulnerabilities #1 and #2 also apply to IOV unwrap, although tokens with
|
||||
- * fewer than 16 bytes after the ASN.1 header will be rejected.
|
||||
- * Vulnerabilities #2 and #5 can only be robustly detected using a
|
||||
- * memory-checking environment such as valgrind.
|
||||
*/
|
||||
|
||||
#include "k5-int.h"
|
||||
@@ -98,16 +108,24 @@ struct test {
|
||||
};
|
||||
|
||||
/* Fake up enough of a CFX GSS context for gss_unwrap, using an AES key. */
|
||||
+static void *
|
||||
+ealloc(size_t len)
|
||||
+{
|
||||
+ void *ptr = calloc(len, 1);
|
||||
+
|
||||
+ if (ptr == NULL)
|
||||
+ abort();
|
||||
+ return ptr;
|
||||
+}
|
||||
+
|
||||
+/* Fake up enough of a CFX GSS context for gss_unwrap, using an AES key.
|
||||
+ * The context takes ownership of subkey. */
|
||||
static gss_ctx_id_t
|
||||
-make_fake_cfx_context()
|
||||
+make_fake_cfx_context(krb5_key subkey)
|
||||
{
|
||||
gss_union_ctx_id_t uctx;
|
||||
krb5_gss_ctx_id_t kgctx;
|
||||
- krb5_keyblock kb;
|
||||
-
|
||||
- kgctx = calloc(1, sizeof(*kgctx));
|
||||
- if (kgctx == NULL)
|
||||
- abort();
|
||||
+ kgctx = ealloc(sizeof(*kgctx));
|
||||
kgctx->established = 1;
|
||||
kgctx->proto = 1;
|
||||
if (g_seqstate_init(&kgctx->seqstate, 0, 0, 0, 0) != 0)
|
||||
@@ -116,15 +134,10 @@ make_fake_cfx_context()
|
||||
kgctx->sealalg = -1;
|
||||
kgctx->signalg = -1;
|
||||
|
||||
- kb.enctype = ENCTYPE_AES128_CTS_HMAC_SHA1_96;
|
||||
- kb.length = 16;
|
||||
- kb.contents = (unsigned char *)"1234567887654321";
|
||||
- if (krb5_k_create_key(NULL, &kb, &kgctx->subkey) != 0)
|
||||
- abort();
|
||||
+ kgctx->subkey = subkey;
|
||||
+ kgctx->cksumtype = CKSUMTYPE_HMAC_SHA1_96_AES128;
|
||||
|
||||
- uctx = calloc(1, sizeof(*uctx));
|
||||
- if (uctx == NULL)
|
||||
- abort();
|
||||
+ uctx = ealloc(sizeof(*uctx));
|
||||
uctx->mech_type = &mech_krb5;
|
||||
uctx->internal_ctx_id = (gss_ctx_id_t)kgctx;
|
||||
return (gss_ctx_id_t)uctx;
|
||||
@@ -138,9 +151,7 @@ make_fake_context(const struct test *test)
|
||||
krb5_gss_ctx_id_t kgctx;
|
||||
krb5_keyblock kb;
|
||||
|
||||
- kgctx = calloc(1, sizeof(*kgctx));
|
||||
- if (kgctx == NULL)
|
||||
- abort();
|
||||
+ kgctx = ealloc(sizeof(*kgctx));
|
||||
kgctx->established = 1;
|
||||
if (g_seqstate_init(&kgctx->seqstate, 0, 0, 0, 0) != 0)
|
||||
abort();
|
||||
@@ -162,9 +173,7 @@ make_fake_context(const struct test *test)
|
||||
if (krb5_k_create_key(NULL, &kb, &kgctx->enc) != 0)
|
||||
abort();
|
||||
|
||||
- uctx = calloc(1, sizeof(*uctx));
|
||||
- if (uctx == NULL)
|
||||
- abort();
|
||||
+ uctx = ealloc(sizeof(*uctx));
|
||||
uctx->mech_type = &mech_krb5;
|
||||
uctx->internal_ctx_id = (gss_ctx_id_t)kgctx;
|
||||
return (gss_ctx_id_t)uctx;
|
||||
@@ -194,9 +203,7 @@ make_token(unsigned char *token, size_t len, gss_buffer_t out)
|
||||
|
||||
assert(mech_krb5.length == 9);
|
||||
assert(len + 11 < 128);
|
||||
- wrapped = malloc(len + 13);
|
||||
- if (wrapped == NULL)
|
||||
- abort();
|
||||
+ wrapped = ealloc(len + 13);
|
||||
wrapped[0] = 0x60;
|
||||
wrapped[1] = len + 11;
|
||||
wrapped[2] = 0x06;
|
||||
@@ -207,6 +214,18 @@ make_token(unsigned char *token, size_t len, gss_buffer_t out)
|
||||
out->value = wrapped;
|
||||
}
|
||||
|
||||
+/* Create a 16-byte header for a CFX confidential wrap token to be processed by
|
||||
+ * the fake CFX context. */
|
||||
+static void
|
||||
+write_cfx_header(uint16_t ec, uint8_t *out)
|
||||
+{
|
||||
+ memset(out, 0, 16);
|
||||
+ store_16_be(KG2_TOK_WRAP_MSG, out);
|
||||
+ out[2] = FLAG_WRAP_CONFIDENTIAL;
|
||||
+ out[3] = 0xFF;
|
||||
+ store_16_be(ec, out + 4);
|
||||
+}
|
||||
+
|
||||
/* Unwrap a superficially valid RFC 1964 token with a CFX-only context, with
|
||||
* regular and IOV unwrap. */
|
||||
static void
|
||||
@@ -238,6 +257,134 @@ test_bogus_1964_token(gss_ctx_id_t ctx)
|
||||
free(in.value);
|
||||
}
|
||||
|
||||
+static void
|
||||
+test_cfx_altered_ec(gss_ctx_id_t ctx, krb5_key subkey)
|
||||
+{
|
||||
+ OM_uint32 major, minor;
|
||||
+ uint8_t tokbuf[128], plainbuf[24];
|
||||
+ krb5_data plain;
|
||||
+ krb5_enc_data cipher;
|
||||
+ gss_buffer_desc in, out;
|
||||
+ gss_iov_buffer_desc iov[2];
|
||||
+
|
||||
+ /* Construct a header with a plaintext EC value of 3. */
|
||||
+ write_cfx_header(3, tokbuf);
|
||||
+
|
||||
+ /* Encrypt a plaintext and a copy of the header with the EC value 0. */
|
||||
+ memcpy(plainbuf, "truncate", 8);
|
||||
+ memcpy(plainbuf + 8, tokbuf, 16);
|
||||
+ store_16_be(0, plainbuf + 12);
|
||||
+ plain = make_data(plainbuf, 24);
|
||||
+ cipher.ciphertext.data = (char *)tokbuf + 16;
|
||||
+ cipher.ciphertext.length = sizeof(tokbuf) - 16;
|
||||
+ cipher.enctype = subkey->keyblock.enctype;
|
||||
+ if (krb5_k_encrypt(NULL, subkey, KG_USAGE_INITIATOR_SEAL, NULL,
|
||||
+ &plain, &cipher) != 0)
|
||||
+ abort();
|
||||
+
|
||||
+ /* Verify that the token is rejected by gss_unwrap(). */
|
||||
+ in.value = tokbuf;
|
||||
+ in.length = 16 + cipher.ciphertext.length;
|
||||
+ major = gss_unwrap(&minor, ctx, &in, &out, NULL, NULL);
|
||||
+ if (major != GSS_S_DEFECTIVE_TOKEN)
|
||||
+ abort();
|
||||
+ (void)gss_release_buffer(&minor, &out);
|
||||
+
|
||||
+ /* Verify that the token is rejected by gss_unwrap_iov(). */
|
||||
+ iov[0].type = GSS_IOV_BUFFER_TYPE_STREAM;
|
||||
+ iov[0].buffer = in;
|
||||
+ iov[1].type = GSS_IOV_BUFFER_TYPE_DATA;
|
||||
+ major = gss_unwrap_iov(&minor, ctx, NULL, NULL, iov, 2);
|
||||
+ if (major != GSS_S_DEFECTIVE_TOKEN)
|
||||
+ abort();
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+test_cfx_short_plaintext(gss_ctx_id_t ctx, krb5_key subkey)
|
||||
+{
|
||||
+ OM_uint32 major, minor;
|
||||
+ uint8_t tokbuf[128], zerobyte = 0;
|
||||
+ krb5_data plain;
|
||||
+ krb5_enc_data cipher;
|
||||
+ gss_buffer_desc in, out;
|
||||
+
|
||||
+ write_cfx_header(0, tokbuf);
|
||||
+
|
||||
+ /* Encrypt a single byte, with no copy of the header. */
|
||||
+ plain = make_data(&zerobyte, 1);
|
||||
+ cipher.ciphertext.data = (char *)tokbuf + 16;
|
||||
+ cipher.ciphertext.length = sizeof(tokbuf) - 16;
|
||||
+ cipher.enctype = subkey->keyblock.enctype;
|
||||
+ if (krb5_k_encrypt(NULL, subkey, KG_USAGE_INITIATOR_SEAL, NULL,
|
||||
+ &plain, &cipher) != 0)
|
||||
+ abort();
|
||||
+
|
||||
+ /* Verify that the token is rejected by gss_unwrap(). */
|
||||
+ in.value = tokbuf;
|
||||
+ in.length = 16 + cipher.ciphertext.length;
|
||||
+ major = gss_unwrap(&minor, ctx, &in, &out, NULL, NULL);
|
||||
+ if (major != GSS_S_DEFECTIVE_TOKEN)
|
||||
+ abort();
|
||||
+ (void)gss_release_buffer(&minor, &out);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+test_cfx_large_ec(gss_ctx_id_t ctx, krb5_key subkey)
|
||||
+{
|
||||
+ OM_uint32 major, minor;
|
||||
+ uint8_t tokbuf[128] = { 0 }, plainbuf[20];
|
||||
+ krb5_data plain;
|
||||
+ krb5_enc_data cipher;
|
||||
+ gss_buffer_desc in, out;
|
||||
+
|
||||
+ /* Construct a header with an EC value of 5. */
|
||||
+ write_cfx_header(5, tokbuf);
|
||||
+
|
||||
+ /* Encrypt a 4-byte plaintext plus the header. */
|
||||
+ memcpy(plainbuf, "abcd", 4);
|
||||
+ memcpy(plainbuf + 4, tokbuf, 16);
|
||||
+ plain = make_data(plainbuf, 20);
|
||||
+ cipher.ciphertext.data = (char *)tokbuf + 16;
|
||||
+ cipher.ciphertext.length = sizeof(tokbuf) - 16;
|
||||
+ cipher.enctype = subkey->keyblock.enctype;
|
||||
+ if (krb5_k_encrypt(NULL, subkey, KG_USAGE_INITIATOR_SEAL, NULL,
|
||||
+ &plain, &cipher) != 0)
|
||||
+ abort();
|
||||
+
|
||||
+ /* Verify that the token is rejected by gss_unwrap(). */
|
||||
+ in.value = tokbuf;
|
||||
+ in.length = 16 + cipher.ciphertext.length;
|
||||
+ major = gss_unwrap(&minor, ctx, &in, &out, NULL, NULL);
|
||||
+ if (major != GSS_S_DEFECTIVE_TOKEN)
|
||||
+ abort();
|
||||
+ (void)gss_release_buffer(&minor, &out);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+test_iov_large_asn1_wrapper(gss_ctx_id_t ctx)
|
||||
+{
|
||||
+ OM_uint32 minor, major;
|
||||
+ uint8_t databuf[10] = { 0 };
|
||||
+ gss_iov_buffer_desc iov[2];
|
||||
+
|
||||
+ /*
|
||||
+ * In this IOV array, the header contains a DER tag with a dangling eight
|
||||
+ * bytes of length field. The data IOV indicates a total token length
|
||||
+ * sufficient to contain the length bytes.
|
||||
+ */
|
||||
+ iov[0].type = GSS_IOV_BUFFER_TYPE_HEADER;
|
||||
+ iov[0].buffer.value = ealloc(2);
|
||||
+ iov[0].buffer.length = 2;
|
||||
+ memcpy(iov[0].buffer.value, "\x60\x88", 2);
|
||||
+ iov[1].type = GSS_IOV_BUFFER_TYPE_DATA;
|
||||
+ iov[1].buffer.value = databuf;
|
||||
+ iov[1].buffer.length = 10;
|
||||
+ major = gss_unwrap_iov(&minor, ctx, NULL, NULL, iov, 2);
|
||||
+ if (major != GSS_S_DEFECTIVE_TOKEN)
|
||||
+ abort();
|
||||
+ free(iov[0].buffer.value);
|
||||
+}
|
||||
+
|
||||
/* Process wrap and MIC tokens with incomplete headers. */
|
||||
static void
|
||||
test_short_header(gss_ctx_id_t ctx)
|
||||
@@ -387,9 +534,7 @@ try_accept(void *value, size_t len)
|
||||
gss_ctx_id_t ctx = GSS_C_NO_CONTEXT;
|
||||
|
||||
/* Copy the provided value to make input overruns more obvious. */
|
||||
- in.value = malloc(len);
|
||||
- if (in.value == NULL)
|
||||
- abort();
|
||||
+ in.value = ealloc(len);
|
||||
memcpy(in.value, value, len);
|
||||
in.length = len;
|
||||
(void)gss_accept_sec_context(&minor, &ctx, GSS_C_NO_CREDENTIAL, &in,
|
||||
@@ -424,11 +569,23 @@ test_short_encapsulation()
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
+ krb5_keyblock kb;
|
||||
+ krb5_key cfx_subkey;
|
||||
gss_ctx_id_t ctx;
|
||||
size_t i;
|
||||
|
||||
- ctx = make_fake_cfx_context();
|
||||
+ kb.enctype = ENCTYPE_AES128_CTS_HMAC_SHA1_96;
|
||||
+ kb.length = 16;
|
||||
+ kb.contents = (unsigned char *)"1234567887654321";
|
||||
+ if (krb5_k_create_key(NULL, &kb, &cfx_subkey) != 0)
|
||||
+ abort();
|
||||
+
|
||||
+ ctx = make_fake_cfx_context(cfx_subkey);
|
||||
test_bogus_1964_token(ctx);
|
||||
+ test_cfx_altered_ec(ctx, cfx_subkey);
|
||||
+ test_cfx_short_plaintext(ctx, cfx_subkey);
|
||||
+ test_cfx_large_ec(ctx, cfx_subkey);
|
||||
+ test_iov_large_asn1_wrapper(ctx);
|
||||
free_fake_context(ctx);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
From ea92d2f0fcceb54a70910fa32e9a0d7a5afc3583 Mon Sep 17 00:00:00 2001
|
||||
From: Greg Hudson <ghudson@mit.edu>
|
||||
Date: Mon, 17 Oct 2022 20:25:11 -0400
|
||||
Subject: [PATCH] Fix integer overflows in PAC parsing
|
||||
|
||||
In krb5_parse_pac(), check for buffer counts large enough to threaten
|
||||
integer overflow in the header length and memory length calculations.
|
||||
Avoid potential integer overflows when checking the length of each
|
||||
buffer. Credit to OSS-Fuzz for discovering one of the issues.
|
||||
|
||||
CVE-2022-42898:
|
||||
|
||||
In MIT krb5 releases 1.8 and later, an authenticated attacker may be
|
||||
able to cause a KDC or kadmind process to crash by reading beyond the
|
||||
bounds of allocated memory, creating a denial of service. A
|
||||
privileged attacker may similarly be able to cause a Kerberos or GSS
|
||||
application service to crash. On 32-bit platforms, an attacker can
|
||||
also cause insufficient memory to be allocated for the result,
|
||||
potentially leading to remote code execution in a KDC, kadmind, or GSS
|
||||
or Kerberos application server process. An attacker with the
|
||||
privileges of a cross-realm KDC may be able to extract secrets from a
|
||||
KDC process's memory by having them copied into the PAC of a new
|
||||
ticket.
|
||||
|
||||
ticket: 9074 (new)
|
||||
tags: pullup
|
||||
target_version: 1.20-next
|
||||
target_version: 1.19-next
|
||||
---
|
||||
src/lib/krb5/krb/pac.c | 9 +++++++--
|
||||
src/lib/krb5/krb/t_pac.c | 18 ++++++++++++++++++
|
||||
2 files changed, 25 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/lib/krb5/krb/pac.c b/src/lib/krb5/krb/pac.c
|
||||
index 2f1df8d42..f6c4373de 100644
|
||||
--- a/src/lib/krb5/krb/pac.c
|
||||
+++ b/src/lib/krb5/krb/pac.c
|
||||
*** 26,31 ****
|
||||
--- 26,32 ----
|
||||
|
||||
#include "k5-int.h"
|
||||
#include "authdata.h"
|
||||
+ #define MAX_BUFFERS 4096
|
||||
|
||||
/* draft-brezak-win2k-krb-authz-00 */
|
||||
diff --git a/src/lib/krb5/krb/t_pac.c b/src/lib/krb5/krb/t_pac.c
|
||||
index 0b1b1f056..173bde7ba 100644
|
||||
--- a/src/lib/krb5/krb/t_pac.c
|
||||
+++ b/src/lib/krb5/krb/t_pac.c
|
||||
@@ -431,6 +431,16 @@ static const unsigned char s4u_pac_ent_xrealm[] = {
|
||||
0x8a, 0x81, 0x9c, 0x9c, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
+static const unsigned char fuzz1[] = {
|
||||
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x06, 0xff, 0xff, 0xff, 0x00, 0x00, 0xf5
|
||||
+};
|
||||
+
|
||||
+static const unsigned char fuzz2[] = {
|
||||
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x20, 0x20
|
||||
+};
|
||||
+
|
||||
static const char *s4u_principal = "w2k8u@ACME.COM";
|
||||
static const char *s4u_enterprise = "w2k8u@abc@ACME.COM";
|
||||
|
||||
@@ -828,6 +838,14 @@ main(int argc, char **argv)
|
||||
krb5_free_principal(context, sep);
|
||||
}
|
||||
|
||||
+ /* Check problematic PACs found by fuzzing. */
|
||||
+ ret = krb5_pac_parse(context, fuzz1, sizeof(fuzz1), &pac);
|
||||
+ if (!ret)
|
||||
+ err(context, ret, "krb5_pac_parse should have failed");
|
||||
+ ret = krb5_pac_parse(context, fuzz2, sizeof(fuzz2), &pac);
|
||||
+ if (!ret)
|
||||
+ err(context, ret, "krb5_pac_parse should have failed");
|
||||
+
|
||||
/*
|
||||
* Test empty free
|
||||
*/
|
||||
--
|
||||
2.32.0.windows.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,555 @@
|
|||
diff --git a/cmake/src/set_thirdparty_path.cmake b/cmake/src/set_thirdparty_path.cmake
|
||||
index 6b0bb651..0246d8a3 100755
|
||||
--- a/cmake/src/set_thirdparty_path.cmake
|
||||
+++ b/cmake/src/set_thirdparty_path.cmake
|
||||
@@ -37,30 +37,14 @@ set(LIB_UNIFIED_SUPPORT comm)
|
||||
set(MEMCHECK_BUILD_TYPE debug)
|
||||
set(DEPENDENCY_PATH ${3RD_PATH}/kernel/dependency)
|
||||
set(PLATFORM_PATH ${3RD_PATH}/kernel/platform)
|
||||
-set(BUILDTOOLS_PATH ${3RD_PATH}/buildtools)
|
||||
set(COMPONENT_PATH ${3RD_PATH}/kernel/component)
|
||||
|
||||
-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(FIO_HOME ${DEPENDENCY_PATH}/fio/${SUPPORT_LLT})
|
||||
-set(IPERF_HOME ${DEPENDENCY_PATH}/iperf/${LIB_UNIFIED_SUPPORT})
|
||||
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(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(XML2_HOME ${DEPENDENCY_PATH}/libxml2/${SUPPORT_LLT})
|
||||
-set(LLVM_HOME ${DEPENDENCY_PATH}/llvm/${LIB_UNIFIED_SUPPORT})
|
||||
-set(LZ4_HOME ${DEPENDENCY_PATH}/lz4/${SUPPORT_LLT})
|
||||
-set(NANOMSG_HOME ${DEPENDENCY_PATH}/nng/${LIB_UNIFIED_SUPPORT})
|
||||
-set(NCURSES_HOME ${DEPENDENCY_PATH}/ncurses/${SUPPORT_LLT})
|
||||
set(AWSSDK_HOME ${DEPENDENCY_PATH}/aws-sdk-cpp/${SUPPORT_LLT})
|
||||
if(($ENV{WITH_TASSL}) STREQUAL "YES")
|
||||
set(OPENSSL_HOME ${DEPENDENCY_PATH}/tassl/${LIB_UNIFIED_SUPPORT})
|
||||
@@ -68,38 +52,21 @@ else()
|
||||
set(OPENSSL_HOME ${DEPENDENCY_PATH}/openssl/${LIB_UNIFIED_SUPPORT})
|
||||
endif()
|
||||
|
||||
-set(PLJAVA_HOME ${DEPENDENCY_PATH}/pljava/${LIB_UNIFIED_SUPPORT})
|
||||
-if (EXISTS "${PLATFORM_PATH}/openjdk8/${BUILD_TUPLE}/jdk")
|
||||
- set(JAVA_HOME ${PLATFORM_PATH}/openjdk8/${BUILD_TUPLE}/jdk)
|
||||
+execute_process(
|
||||
+ COMMAND bash -c "readlink -f $(which java) | sed 's:/jre/bin/java::'"
|
||||
+ OUTPUT_VARIABLE JAVA_HOME_PATH
|
||||
+ OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
+)
|
||||
+if(JAVA_HOME_PATH)
|
||||
+ message(STATUS "Detected JAVA_HOME: ${JAVA_HOME_PATH}")
|
||||
+ set(JAVA_HOME ${JAVA_HOME_PATH})
|
||||
else()
|
||||
- set(JAVA_HOME ${PLATFORM_PATH}/huaweijdk8/${BUILD_TUPLE}/jdk)
|
||||
+ message(FATAL_ERROR "Unable to detect JAVA_HOME")
|
||||
endif()
|
||||
-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(SECUREDYNAMICLIB_HOME ${PLATFORM_PATH}/Huawei_Secure_C/Dynamic_Lib)
|
||||
set(DCF_HOME ${COMPONENT_PATH}/dcf)
|
||||
-set(DMS_HOME ${COMPONENT_PATH}/dms)
|
||||
-set(DSS_HOME ${COMPONENT_PATH}/dss)
|
||||
-
|
||||
-set(MOCKCPP_HOME ${BUILDTOOLS_PATH}/mockcpp/${LIB_UNIFIED_SUPPORT})
|
||||
-set(GTEST_HOME ${BUILDTOOLS_PATH}/gtest/${LIB_UNIFIED_SUPPORT})
|
||||
-set(MASSTREE_HOME ${BUILDTOOLS_PATH}/masstree/${LIB_UNIFIED_SUPPORT})
|
||||
-set(NUMA_HOME ${DEPENDENCY_PATH}/numactl/${SUPPORT_LLT})
|
||||
-set(BOOST_HOME ${DEPENDENCY_PATH}/boost/${SUPPORT_LLT})
|
||||
-set(ODBC_HOME ${DEPENDENCY_PATH}/unixodbc)
|
||||
-set(MASSTREE_HOME ${DEPENDENCY_PATH}/masstree/${LIB_UNIFIED_SUPPORT})
|
||||
-set(LCOV_HOME ${BUILDTOOLS_PATH}/gcc${GCC_VERSION_LIT}/gcc/lib/gcc/${HOST_TUPLE})
|
||||
-set(GCC_LIB_PATH $ENV{GCC_INSTALL_HOME})
|
||||
-set(MEMCHECK_LIB_PATH $ENV{GCC_INSTALL_HOME}/lib64/)
|
||||
-if("${GCC_LIB_PATH}" STREQUAL "")
|
||||
- set(GCC_LIB_PATH ${BUILDTOOLS_PATH}/gcc${GCC_VERSION_LIT}/gcc)
|
||||
- set(MEMCHECK_HOME ${DEPENDENCY_PATH}/memcheck/${MEMCHECK_BUILD_TYPE})
|
||||
- set(MEMCHECK_LIB_PATH ${MEMCHECK_HOME}/gcc${GCC_VERSION}/lib/)
|
||||
-endif()
|
||||
|
||||
#############################################################################
|
||||
# lcov
|
||||
@@ -209,22 +176,17 @@ set(LIBEDIT_LIB_PATH ${EDIT_HOME}/lib)
|
||||
#############################################################################
|
||||
# obs component
|
||||
#############################################################################
|
||||
-set(LIBOBS_INCLUDE_PATH ${OBS_HOME}/include)
|
||||
-set(LIBOBS_LIB_PATH ${OBS_HOME}/lib)
|
||||
|
||||
#############################################################################
|
||||
# xml2 component
|
||||
#############################################################################
|
||||
-set(LIBXML_INCLUDE_PATH ${XML2_HOME}/include)
|
||||
-set(LIBXML_LIB_PATH ${XML2_HOME}/lib)
|
||||
+set(LIBXML_INCLUDE_PATH /usr/include)
|
||||
+set(LIBXML_LIB_PATH /usr/lib64)
|
||||
|
||||
#############################################################################
|
||||
# llvm component
|
||||
#############################################################################
|
||||
-set(LIBLLVM_BIN_PATH ${LLVM_HOME}/bin)
|
||||
-set(LIBLLVM_INCLUDE_PATH ${LLVM_HOME}/include)
|
||||
-set(LIBLLVM_LIB_PATH ${LLVM_HOME}/lib)
|
||||
-set(LLVM_CONFIG ${LIBLLVM_BIN_PATH}/llvm-config)
|
||||
+
|
||||
|
||||
#############################################################################
|
||||
# lz4 component
|
||||
@@ -256,8 +218,7 @@ set(LIBOPENSSL_INCLUDE_PATH ${OPENSSL_HOME}/include)
|
||||
#############################################################################
|
||||
# zlib component
|
||||
#############################################################################
|
||||
-set(ZLIB_INCLUDE_PATH ${ZLIB_HOME}/include)
|
||||
-set(ZLIB_LIB_PATH ${ZLIB_HOME}/lib)
|
||||
+set(ZLIB_INCLUDE_PATH /usr/include/minizip)
|
||||
|
||||
#############################################################################
|
||||
# xgboost component
|
||||
diff --git a/contrib/pagehack/CMakeLists.txt b/contrib/pagehack/CMakeLists.txt
|
||||
index b15bee10..e517b490 100644
|
||||
--- a/contrib/pagehack/CMakeLists.txt
|
||||
+++ b/contrib/pagehack/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@ if(${ENABLE_DEBUG} STREQUAL "ON")
|
||||
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 -l${SECURE_C_CHECK} -lrt -lz -lminiunz -lzstd -lpagecompression -llz4)
|
||||
+set(pagehack_LINK_LIBS -lpgport -lcrypt -ldl -lm -ledit -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -lzstd -lpagecompression -llz4)
|
||||
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)
|
||||
target_link_directories(pagehack PUBLIC
|
||||
diff --git a/contrib/pg_xlogdump/CMakeLists.txt b/contrib/pg_xlogdump/CMakeLists.txt
|
||||
index d53590b2..5751a1b9 100644
|
||||
--- a/contrib/pg_xlogdump/CMakeLists.txt
|
||||
+++ b/contrib/pg_xlogdump/CMakeLists.txt
|
||||
@@ -40,7 +40,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 -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
|
||||
list(APPEND xlogdump_LINK_DIRS ${LIBUWAL_LINK_DIRS})
|
||||
list(APPEND xlogdump_LINK_OPTIONS ${LIBUWAL_LINK_OPTIONS})
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index d9a73aee..a87caa54 100755
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -176,121 +176,18 @@ install_file(${CMAKE_CURRENT_SOURCE_DIR}/include include)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/common/config/cm_config.h DESTINATION include)
|
||||
|
||||
# special
|
||||
-install(CODE "execute_process(
|
||||
- COMMAND rm ${prefix_home}/include/pg_config_os.h
|
||||
- COMMAND rm ${prefix_home}/include/postgresql/server/pg_config_os.h)"
|
||||
-)
|
||||
-install(CODE "execute_process(
|
||||
- COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/include/port/linux.h ${prefix_home}/include/pg_config_os.h
|
||||
- COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/include/port/linux.h ${prefix_home}/include/postgresql/server/pg_config_os.h
|
||||
- COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/include/cm/libpq-fe.h ${prefix_home}/include/cm-libpq-fe.h)"
|
||||
-)
|
||||
-
|
||||
# open source install part
|
||||
-if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- install(DIRECTORY ${JAVA_HOME}/jre/ DESTINATION jre FILE_PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE OWNER_READ GROUP_READ)
|
||||
-endif()
|
||||
-
|
||||
if("${ENABLE_MULTIPLE_NODES}" STREQUAL "OFF")
|
||||
install(DIRECTORY ${DCF_LIB_PATH} DESTINATION .)
|
||||
endif()
|
||||
-if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF AND NOT ${ENABLE_LITE_MODE} STREQUAL ON)
|
||||
- if(EXISTS ${DMS_LIB_PATH})
|
||||
- install(DIRECTORY ${DMS_LIB_PATH} DESTINATION .)
|
||||
- endif()
|
||||
- if(EXISTS ${DSS_LIB_PATH})
|
||||
- install(DIRECTORY ${DSS_LIB_PATH} DESTINATION .)
|
||||
- endif()
|
||||
- if(EXISTS ${DSS_BIN_PATH})
|
||||
- install(DIRECTORY ${DSS_BIN_PATH} DESTINATION . FILE_PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
-install(DIRECTORY ${ZSTD_LIB_PATH} DESTINATION . PATTERN "*.a" EXCLUDE)
|
||||
-if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- install(DIRECTORY ${LIBOBS_LIB_PATH} DESTINATION .)
|
||||
- install(DIRECTORY ${LIBOBS_INCLUDE_PATH} DESTINATION include/postgresql/server/access/obs)
|
||||
-endif()
|
||||
-install(DIRECTORY ${CJSON_LIB_PATH} DESTINATION .)
|
||||
-install(DIRECTORY ${CJSON_INCLUDE_PATH}/cjson DESTINATION include/postgresql/server)
|
||||
-if(NOT ${ENABLE_LITE_MODE} STREQUAL ON)
|
||||
- install(DIRECTORY ${ETCD_BIN_PATH} DESTINATION .)
|
||||
- install(DIRECTORY ${IPERF_LIB_PATH} DESTINATION .)
|
||||
-endif()
|
||||
-if(NOT ${ENABLE_LITE_MODE} STREQUAL ON)
|
||||
-if(NOT ${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
|
||||
- install(DIRECTORY ${KMC_LIB_PATH} DESTINATION .)
|
||||
-endif()
|
||||
-endif()
|
||||
-install(DIRECTORY ${LIBCURL_LIB_PATH} DESTINATION .)
|
||||
-install(DIRECTORY ${AWSSDK_LIB_PATH} DESTINATION .)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
install(DIRECTORY ${KERBEROS_SBIN_PATH}/ DESTINATION bin)
|
||||
install(DIRECTORY ${KERBEROS_BIN_PATH} DESTINATION .)
|
||||
install(DIRECTORY ${KERBEROS_LIB_PATH} DESTINATION .)
|
||||
endif()
|
||||
-install(DIRECTORY ${LZ4_LIB_PATH} DESTINATION .)
|
||||
-install(DIRECTORY ${LZ4_BIN_PATH} DESTINATION .)
|
||||
-install(DIRECTORY ${LIBOPENSSL_BIN_PATH} DESTINATION .)
|
||||
-install(DIRECTORY ${LIBOPENSSL_LIB_PATH} DESTINATION . PATTERN "*.a" EXCLUDE )
|
||||
-install(DIRECTORY ${ZLIB_LIB_PATH} DESTINATION . FILES_MATCHING PATTERN "libz.*")
|
||||
-
|
||||
-list(FIND MACRO_OPTIONS "-D__USE_NUMA" RET_NUMA)
|
||||
-if(NOT ${RET_NUMA} EQUAL -1)
|
||||
- install(DIRECTORY ${NUMA_LIB_PATH} DESTINATION .)
|
||||
-endif()
|
||||
-
|
||||
-if("${ENABLE_MOT}" STREQUAL "ON")
|
||||
-install(DIRECTORY ${MASSTREE_LIB_PATH} DESTINATION .)
|
||||
-install(CODE "execute_process(
|
||||
- COMMAND cp ${GCC_LIB_PATH}/lib64/libatomic.so.1.2.0 ${prefix_home}/lib/libatomic.so.1.2.0
|
||||
- COMMAND ln -fs libatomic.so.1.2.0 libatomic.so
|
||||
- COMMAND ln -fs libatomic.so.1.2.0 libatomic.so.1
|
||||
- WORKING_DIRECTORY ${prefix_home}/lib)"
|
||||
-)
|
||||
-install(CODE "message(\"-- Created symlink: libatomic.so -> libatomic.so.1.2.0\")")
|
||||
-install(CODE "message(\"-- Created symlink: libatomic.so.1 -> libatomic.so.1.2.0\")")
|
||||
-endif()
|
||||
-
|
||||
+install(DIRECTORY ${AWSSDK_LIB_PATH} DESTINATION .)
|
||||
install(FILES ${SECUREDYNAMICLIB_HOME}/libsecurec.so DESTINATION lib)
|
||||
-install(FILES ${GCC_LIB_PATH}/lib64/libgcc_s.so.1 DESTINATION lib)
|
||||
-install(FILES ${GCC_LIB_PATH}/lib64/libgomp.so DESTINATION lib)
|
||||
-install(FILES ${GCC_LIB_PATH}/lib64/libgomp.so.1 DESTINATION lib)
|
||||
-install(FILES ${GCC_LIB_PATH}/lib64/libgomp.so.1.0.0 DESTINATION lib)
|
||||
install(FILES ${XGBOOST_LIB_PATH}/libxgboost.so DESTINATION lib)
|
||||
-if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- install(FILES ${PLJAVA_HOME}/lib/libpljava.so DESTINATION lib)
|
||||
- install(FILES ${PLJAVA_HOME}/java/pljava.jar DESTINATION lib/postgresql/java)
|
||||
- install(FILES ${PLJAVA_HOME}/udstools.py DESTINATION share/postgresql/tmp)
|
||||
-endif()
|
||||
-if(NOT ${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
|
||||
- if("${SUPPORT_HOTPATCH}" STREQUAL "yes")
|
||||
- install(FILES ${LIBHOTPATCH_LIB_PATH}/libdoprapatch.a DESTINATION lib)
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
-if("${ENABLE_MOT}" STREQUAL "ON")
|
||||
- install(DIRECTORY ${MASSTREE_LIB_PATH} DESTINATION .)
|
||||
- install(DIRECTORY ${GCC_LIB_PATH}/lib64/ DESTINATION lib
|
||||
- FILES_MATCHING PATTERN "libatomic.so*")
|
||||
-endif()
|
||||
-
|
||||
-install(FILES ${GCC_LIB_PATH}/lib64/libgcc_s.so.1 DESTINATION lib)
|
||||
-install(DIRECTORY ${GCC_LIB_PATH}/lib64/ DESTINATION lib
|
||||
- FILES_MATCHING PATTERN "libgomp.so*")
|
||||
-
|
||||
-install(CODE "execute_process(
|
||||
- COMMAND cp ${GCC_LIB_PATH}/lib64/libstdc++.so.6.0.${LIBSTD_SUB_VERSION} ${prefix_home}/lib/libstdc++.so.6
|
||||
- WORKING_DIRECTORY ${prefix_home}/lib)"
|
||||
-)
|
||||
-
|
||||
-# install(DIRECTORY ${LIBCGROUP_LIB_PATH} DESTINATION . FILES_MATCHING PATTERN "libcgroup.so*")
|
||||
-install(CODE "execute_process(
|
||||
-COMMAND cp ${LIBCGROUP_LIB_PATH}/libcgroup.so.1.0.42 ${prefix_home}/lib/libcgroup.so
|
||||
-COMMAND ln -fs libcgroup.so libcgroup.so.1
|
||||
-WORKING_DIRECTORY ${prefix_home}/lib)"
|
||||
-)
|
||||
-install(CODE "message(\"-- Created symlink: libcgroup.so.1 -> libcgroup.so\")")
|
||||
|
||||
# fastcheck part
|
||||
install(FILES ${PROJECT_SRC_DIR}/test/regress/stub/roach_api_stub/roach_api_stub.control
|
||||
diff --git a/src/bin/gs_cgroup/CMakeLists.txt b/src/bin/gs_cgroup/CMakeLists.txt
|
||||
index 3203cb54..78aa3372 100755
|
||||
--- a/src/bin/gs_cgroup/CMakeLists.txt
|
||||
+++ b/src/bin/gs_cgroup/CMakeLists.txt
|
||||
@@ -18,7 +18,7 @@ set(TGT_cgroup_INC
|
||||
set(cgroup_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(cgroup_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(cgroup_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(cgroup_LINK_LIBS libelog.a -lpgport -lcrypt -ldl -lm -l${SECURE_C_CHECK} -pthread -lrt -lminiunz -lcgroup)
|
||||
+set(cgroup_LINK_LIBS libelog.a -lpgport -lcrypt -ldl -lm -l${SECURE_C_CHECK} -pthread -lrt -lminizip -lcgroup)
|
||||
add_bintarget(gs_cgroup TGT_cgroup_SRC TGT_cgroup_INC "${cgroup_DEF_OPTIONS}" "${cgroup_COMPILE_OPTIONS}" "${cgroup_LINK_OPTIONS}" "${cgroup_LINK_LIBS}")
|
||||
add_dependencies(gs_cgroup elog_static pgport_static)
|
||||
target_link_directories(gs_cgroup PUBLIC
|
||||
diff --git a/src/bin/gs_guc/CMakeLists.txt b/src/bin/gs_guc/CMakeLists.txt
|
||||
index 285a6e11..b520892f 100755
|
||||
--- a/src/bin/gs_guc/CMakeLists.txt
|
||||
+++ b/src/bin/gs_guc/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ set(TGT_guc_INC
|
||||
set(guc_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(guc_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(guc_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(guc_LINK_LIBS libelog.a libconfig.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(guc_LINK_LIBS libelog.a libconfig.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
set(guc_LINK_DEPEND elog_static config_static pgport_static)
|
||||
set(guc_LINK_DIRS ${LIBOPENSSL_LIB_PATH} ${KERBEROS_LIB_PATH} ${CMAKE_BINARY_DIR}/lib
|
||||
${LIBCURL_LIB_PATH} ${ZLIB_LIB_PATH} ${LIBCGROUP_LIB_PATH} ${LIBEDIT_LIB_PATH} ${SECURE_LIB_PATH})
|
||||
@@ -54,7 +54,7 @@ set(TGT_encrypt_INC
|
||||
set(encrypt_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(encrypt_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(encrypt_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(encrypt_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(encrypt_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(encrypt TGT_encrypt_SRC TGT_encrypt_INC "${encrypt_DEF_OPTIONS}" "${encrypt_COMPILE_OPTIONS}" "${encrypt_LINK_OPTIONS}" "${encrypt_LINK_LIBS}")
|
||||
add_dependencies(encrypt elog_static pgport_static)
|
||||
target_link_directories(encrypt PUBLIC
|
||||
diff --git a/src/bin/gs_log/CMakeLists.txt b/src/bin/gs_log/CMakeLists.txt
|
||||
index 675c3035..773b44ac 100755
|
||||
--- a/src/bin/gs_log/CMakeLists.txt
|
||||
+++ b/src/bin/gs_log/CMakeLists.txt
|
||||
@@ -21,7 +21,7 @@ set(TGT_log_INC
|
||||
set(log_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(log_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(log_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(log_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(log_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(gs_log TGT_log_SRC TGT_log_INC "${log_DEF_OPTIONS}" "${log_COMPILE_OPTIONS}" "${log_LINK_OPTIONS}" "${log_LINK_LIBS}")
|
||||
add_dependencies(gs_log elog_static pgport_static)
|
||||
target_link_directories(gs_log PUBLIC
|
||||
diff --git a/src/bin/initdb/CMakeLists.txt b/src/bin/initdb/CMakeLists.txt
|
||||
index 5a5aa668..a551cda6 100755
|
||||
--- a/src/bin/initdb/CMakeLists.txt
|
||||
+++ b/src/bin/initdb/CMakeLists.txt
|
||||
@@ -31,7 +31,7 @@ set(TGT_initdb_INC
|
||||
set(initdb_DEF_OPTIONS ${MACRO_OPTIONS} -DFRONTEND)
|
||||
set(initdb_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(initdb_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(initdb_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(initdb_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(gs_initdb TGT_initdb_SRC TGT_initdb_INC "${initdb_DEF_OPTIONS}" "${initdb_COMPILE_OPTIONS}" "${initdb_LINK_OPTIONS}" "${initdb_LINK_LIBS}")
|
||||
add_dependencies(gs_initdb elog_static pgport_static)
|
||||
target_link_directories(gs_initdb PUBLIC
|
||||
diff --git a/src/bin/pg_basebackup/CMakeLists.txt b/src/bin/pg_basebackup/CMakeLists.txt
|
||||
index dc5efefb..bc2da1cd 100755
|
||||
--- a/src/bin/pg_basebackup/CMakeLists.txt
|
||||
+++ b/src/bin/pg_basebackup/CMakeLists.txt
|
||||
@@ -33,7 +33,7 @@ set(TGT_basebackup_INC
|
||||
set(basebackup_DEF_OPTIONS ${MACRO_OPTIONS} -DHAVE_LIBZ -DFRONTEND)
|
||||
set(basebackup_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(basebackup_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(basebackup_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -llz4 -lzstd -lpagecompression)
|
||||
+set(basebackup_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -llz4 -lzstd -lpagecompression)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND basebackup_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
@@ -79,7 +79,7 @@ set(TGT_receivexlog_INC
|
||||
set(receivexlog_DEF_OPTIONS ${MACRO_OPTIONS} -DHAVE_LIBZ -DFRONTEND)
|
||||
set(receivexlog_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(receivexlog_LINK_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS} -pie)
|
||||
-set(receivexlog_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -llz4)
|
||||
+set(receivexlog_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -llz4)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND receivexlog_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
@@ -126,7 +126,7 @@ set(TGT_recvlogical_INC
|
||||
set(recvlogical_DEF_OPTIONS ${MACRO_OPTIONS} -DHAVE_LIBZ -DFRONTEND)
|
||||
set(recvlogical_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(recvlogical_LINK_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS} -pie)
|
||||
-set(recvlogical_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -llz4)
|
||||
+set(recvlogical_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -llz4)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND recvlogical_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
diff --git a/src/bin/pg_config/CMakeLists.txt b/src/bin/pg_config/CMakeLists.txt
|
||||
index 1bf4f96a..b8e8d863 100755
|
||||
--- a/src/bin/pg_config/CMakeLists.txt
|
||||
+++ b/src/bin/pg_config/CMakeLists.txt
|
||||
@@ -17,7 +17,7 @@ SET(TGT_pgconfig_INC
|
||||
SET(pgconfig_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
SET(pgconfig_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS} -fstack-protector-all)
|
||||
SET(pgconfig_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-SET(pgconfig_LINK_LIBS libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+SET(pgconfig_LINK_LIBS libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(pg_config TGT_pgconfig_SRC TGT_pgconfig_INC "${pgconfig_DEF_OPTIONS}" "${pgconfig_COMPILE_OPTIONS}" "${pgconfig_LINK_OPTIONS}" "${pgconfig_LINK_LIBS}")
|
||||
add_dependencies(pg_config pgport_static)
|
||||
target_link_directories(pg_config PUBLIC
|
||||
diff --git a/src/bin/pg_controldata/CMakeLists.txt b/src/bin/pg_controldata/CMakeLists.txt
|
||||
index 0da485c3..eaf4646c 100755
|
||||
--- a/src/bin/pg_controldata/CMakeLists.txt
|
||||
+++ b/src/bin/pg_controldata/CMakeLists.txt
|
||||
@@ -19,7 +19,7 @@ set(TGT_controldata_INC
|
||||
set(controldata_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(controldata_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(controldata_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(controldata_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(controldata_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(pg_controldata TGT_controldata_SRC TGT_controldata_INC "${controldata_DEF_OPTIONS}" "${controldata_COMPILE_OPTIONS}" "${controldata_LINK_OPTIONS}" "${controldata_LINK_LIBS}")
|
||||
add_dependencies(pg_controldata elog_static pgport_static)
|
||||
target_link_directories(pg_controldata PUBLIC
|
||||
diff --git a/src/bin/pg_ctl/CMakeLists.txt b/src/bin/pg_ctl/CMakeLists.txt
|
||||
index 7268a150..1bfdab75 100755
|
||||
--- a/src/bin/pg_ctl/CMakeLists.txt
|
||||
+++ b/src/bin/pg_ctl/CMakeLists.txt
|
||||
@@ -30,7 +30,7 @@ set(TGT_gsctl_INC
|
||||
set(gsctl_DEF_OPTIONS ${MACRO_OPTIONS} -DHAVE_LIBZ -DFRONTEND)
|
||||
set(gsctl_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(gsctl_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(gsctl_LINK_LIBS libelog.a libbuildquery.a pg_rewind.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz -lpagecompression -lzstd -llz4)
|
||||
+set(gsctl_LINK_LIBS libelog.a libbuildquery.a pg_rewind.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip -lpagecompression -lzstd -llz4)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND gsctl_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
diff --git a/src/bin/pg_dump/CMakeLists.txt b/src/bin/pg_dump/CMakeLists.txt
|
||||
index b65f7f69..9d3652a9 100755
|
||||
--- a/src/bin/pg_dump/CMakeLists.txt
|
||||
+++ b/src/bin/pg_dump/CMakeLists.txt
|
||||
@@ -72,9 +72,9 @@ endif()
|
||||
set(dump_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(dump_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- set(dump_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -lpq_ce -lcurl -lcjson)
|
||||
+ set(dump_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -lpq_ce -lcurl -lcjson)
|
||||
else()
|
||||
- set(dump_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -lpq -lcurl -lcjson)
|
||||
+ set(dump_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -lpq -lcurl -lcjson)
|
||||
endif()
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND dump_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
diff --git a/src/bin/pg_probackup/CMakeLists.txt b/src/bin/pg_probackup/CMakeLists.txt
|
||||
index 062d37c3..05e8cd1f 100755
|
||||
--- a/src/bin/pg_probackup/CMakeLists.txt
|
||||
+++ b/src/bin/pg_probackup/CMakeLists.txt
|
||||
@@ -22,7 +22,7 @@ set(TGT_probackup_INC ${ZLIB_INCLUDE_PATH} ${LZ4_INCLUDE_PATH} ${ZSTD_INCLUDE_PA
|
||||
set(probackup_DEF_OPTIONS ${MACRO_OPTIONS} -DFRONTEND -DHAVE_LIBZ)
|
||||
set(probackup_COMPILE_OPTIONS ${PROTECT_OPTIONS} ${BIN_SECURE_OPTIONS} ${OS_OPTIONS} ${WARNING_OPTIONS} ${OPTIMIZE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(probackup_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(probackup_LINK_LIBS libpgcommon.a libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -llz4 -lpq -lpagecompression -lzstd -laws-cpp-sdk-core -laws-cpp-sdk-s3)
|
||||
+set(probackup_LINK_LIBS libpgcommon.a libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -llz4 -lpq -lpagecompression -lzstd -laws-cpp-sdk-core -laws-cpp-sdk-s3)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND probackup_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
diff --git a/src/bin/pg_resetxlog/CMakeLists.txt b/src/bin/pg_resetxlog/CMakeLists.txt
|
||||
index f8b1a889..15af6cb2 100755
|
||||
--- a/src/bin/pg_resetxlog/CMakeLists.txt
|
||||
+++ b/src/bin/pg_resetxlog/CMakeLists.txt
|
||||
@@ -17,7 +17,7 @@ set(TGT_resetxlog_INC
|
||||
set(resetxlog_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(resetxlog_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(resetxlog_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(resetxlog_LINK_LIBS libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(resetxlog_LINK_LIBS libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(pg_resetxlog TGT_resetxlog_SRC TGT_resetxlog_INC "${resetxlog_DEF_OPTIONS}" "${resetxlog_COMPILE_OPTIONS}" "${resetxlog_LINK_OPTIONS}" "${resetxlog_LINK_LIBS}")
|
||||
add_dependencies(pg_resetxlog pgport_static)
|
||||
target_link_directories(pg_resetxlog PUBLIC
|
||||
diff --git a/src/bin/pg_upgrade/CMakeLists.txt b/src/bin/pg_upgrade/CMakeLists.txt
|
||||
index 6ac9de77..c7d1e1aa 100755
|
||||
--- a/src/bin/pg_upgrade/CMakeLists.txt
|
||||
+++ b/src/bin/pg_upgrade/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ set(TGT_format_INC
|
||||
set(format_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(format_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(format_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(format_LINK_LIBS libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz)
|
||||
+set(format_LINK_LIBS libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip)
|
||||
add_bintarget(pg_format_cu TGT_format_SRC TGT_format_INC "${format_DEF_OPTIONS}" "${format_COMPILE_OPTIONS}" "${format_LINK_OPTIONS}" "${format_LINK_LIBS}")
|
||||
add_dependencies(pg_format_cu pgport_static)
|
||||
target_link_directories(pg_format_cu PUBLIC
|
||||
diff --git a/src/bin/pgxc_clean/CMakeLists.txt b/src/bin/pgxc_clean/CMakeLists.txt
|
||||
index 31ee01cd..d1ca8327 100755
|
||||
--- a/src/bin/pgxc_clean/CMakeLists.txt
|
||||
+++ b/src/bin/pgxc_clean/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ set(TGT_clean_INC
|
||||
set(clean_DEF_OPTIONS ${MACRO_OPTIONS} -D_FORTIFY_SOURCE=2)
|
||||
set(clean_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS} -O2)
|
||||
set(clean_LINK_OPTIONS ${BIN_LINK_OPTIONS} -s)
|
||||
-set(clean_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminiunz -lpq)
|
||||
+set(clean_LINK_LIBS libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -lpq)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND clean_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
diff --git a/src/bin/psql/CMakeLists.txt b/src/bin/psql/CMakeLists.txt
|
||||
index 3b69e494..cc8bf488 100755
|
||||
--- a/src/bin/psql/CMakeLists.txt
|
||||
+++ b/src/bin/psql/CMakeLists.txt
|
||||
@@ -72,9 +72,9 @@ endif()
|
||||
set(gsql_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(gsql_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- set(gsql_LINK_LIBS utils_aes_aes libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz -ledit -lcjson -lcurl -lpq_ce -lncurses)
|
||||
+ set(gsql_LINK_LIBS utils_aes_aes libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip -ledit -lcjson -lcurl -lpq_ce -lncurses)
|
||||
else()
|
||||
- set(gsql_LINK_LIBS utils_aes_aes libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz -ledit -lcjson -lcurl -lpq -lncurses)
|
||||
+ set(gsql_LINK_LIBS utils_aes_aes libelog.a libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip -ledit -lcjson -lcurl -lpq -lncurses)
|
||||
endif()
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND gsql_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
diff --git a/src/bin/scripts/CMakeLists.txt b/src/bin/scripts/CMakeLists.txt
|
||||
index da7a0616..794918ee 100755
|
||||
--- a/src/bin/scripts/CMakeLists.txt
|
||||
+++ b/src/bin/scripts/CMakeLists.txt
|
||||
@@ -95,7 +95,7 @@ set(TGT_scripts_INC
|
||||
set(scripts_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(scripts_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(scripts_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(scripts_LINK_LIBS libelog.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz)
|
||||
+set(scripts_LINK_LIBS libelog.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND scripts_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
diff --git a/src/common/timezone/CMakeLists.txt b/src/common/timezone/CMakeLists.txt
|
||||
index 491fae5f..ac0166a2 100755
|
||||
--- a/src/common/timezone/CMakeLists.txt
|
||||
+++ b/src/common/timezone/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@ set(TGT_zic_INC
|
||||
set(zic_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(zic_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(zic_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(zic_LINK_LIBS libpgport.a -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz)
|
||||
+set(zic_LINK_LIBS libpgport.a -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip)
|
||||
add_bintarget(zic TGT_zic_SRC TGT_zic_INC "${zic_DEF_OPTIONS}" "${zic_COMPILE_OPTIONS}" "${zic_LINK_OPTIONS}" "${zic_LINK_LIBS}")
|
||||
add_dependencies(zic pgport_static)
|
||||
target_link_directories(zic PUBLIC
|
||||
diff --git a/src/gausskernel/CMakeLists.txt b/src/gausskernel/CMakeLists.txt
|
||||
index 0d1aefda..668d8c32 100755
|
||||
--- a/src/gausskernel/CMakeLists.txt
|
||||
+++ b/src/gausskernel/CMakeLists.txt
|
||||
@@ -300,9 +300,9 @@ if(${USE_LIBXML})
|
||||
endif()
|
||||
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- list(APPEND gaussdb_LINK_LIBS -lz -lminiunz -leSDKOBS -leSDKLogAPI -lpcre -liconv -lnghttp2 -llog4cpp -lcurl -llz4 -lcjson -l${JEMALLOC_LIB_NAME} -lcgroup -lzstd -lcom_err_gauss -lgssapi_krb5_gauss -lkrb5_gauss -lgssrpc_gauss -lk5crypto_gauss -lkadm5clnt_mit -lkadm5srv_mit -lkdb5 -lkrb5support_gauss -lstdc++ -lboost_thread -lboost_chrono -lboost_system -lboost_atomic -lxml2 -laio -lncurses -ltinfo -latomic)
|
||||
+ list(APPEND gaussdb_LINK_LIBS -lz -lminizip -leSDKOBS -leSDKLogAPI -lpcre -liconv -lnghttp2 -llog4cpp -lcurl -llz4 -lcjson -l${JEMALLOC_LIB_NAME} -lcgroup -lzstd -lcom_err_gauss -lgssapi_krb5_gauss -lkrb5_gauss -lgssrpc_gauss -lk5crypto_gauss -lkadm5clnt_mit -lkadm5srv_mit -lkdb5 -lkrb5support_gauss -lstdc++ -lboost_thread -lboost_chrono -lboost_system -lboost_atomic -lxml2 -laio -lncurses -ltinfo -latomic)
|
||||
else()
|
||||
- list(APPEND gaussdb_LINK_LIBS -lz -lminiunz -lcurl -llz4 -lcjson -l${JEMALLOC_LIB_NAME} -lcgroup -lzstd -lncurses -ltinfo -lboost_thread -lboost_chrono -lboost_system -lboost_atomic)
|
||||
+ list(APPEND gaussdb_LINK_LIBS -lz -lminizip -lcurl -llz4 -lcjson -l${JEMALLOC_LIB_NAME} -lcgroup -lzstd -lncurses -ltinfo -lboost_thread -lboost_chrono -lboost_system -lboost_atomic)
|
||||
endif()
|
||||
|
||||
if(NOT "${ENABLE_JEMALLOC}" STREQUAL "ON")
|
||||
diff --git a/src/lib/gstrace/CMakeLists.txt b/src/lib/gstrace/CMakeLists.txt
|
||||
index 803f369e..6e79d4e5 100755
|
||||
--- a/src/lib/gstrace/CMakeLists.txt
|
||||
+++ b/src/lib/gstrace/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ set(TGT_trace_INC
|
||||
set(trace_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(trace_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(trace_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(trace_LINK_LIBS libgstrace.a -lcgroup libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz)
|
||||
+set(trace_LINK_LIBS libgstrace.a -lcgroup libpgport.a -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND trace_LINK_LIBS -lgssapi_krb5_gauss -lkrb5_gauss -lk5crypto_gauss -lcom_err_gauss -lkrb5support_gauss)
|
||||
endif()
|
||||
diff --git a/src/test/regress/CMakeLists.txt b/src/test/regress/CMakeLists.txt
|
||||
index 1bc95c51..6928d4d7 100755
|
||||
--- a/src/test/regress/CMakeLists.txt
|
||||
+++ b/src/test/regress/CMakeLists.txt
|
||||
@@ -15,7 +15,7 @@ set(pg_regress_single_DEF_OPTIONS ${MACRO_OPTIONS} -DHOST_TUPLE="${HOST_TUPLE}"
|
||||
set(pg_regress_single_main_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
set(pg_regress_single_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(pg_regress_single_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(pg_regress_single_LINK_LIBS pg_regress_single_obj -lpgport -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminiunz)
|
||||
+set(pg_regress_single_LINK_LIBS pg_regress_single_obj -lpgport -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -pthread -lrt -lz -lminizip)
|
||||
add_static_objtarget(pg_regress_single_obj TGT_pg_regress_single_SRC TGT_pg_regress_single_INC "${pg_regress_single_DEF_OPTIONS}" "${pg_regress_single_COMPILE_OPTIONS}" "${pg_regress_single_LINK_OPTIONS}")
|
||||
add_bintarget(pg_regress_single TGT_pg_regress_single_main_SRC TGT_pg_regress_single_INC "${pg_regress_single_main_DEF_OPTIONS}" "${pg_regress_single_COMPILE_OPTIONS}" "${pg_regress_single_LINK_OPTIONS}" "${pg_regress_single_LINK_LIBS}")
|
||||
add_dependencies(pg_regress_single pg_regress_single_obj pgport_static)
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,227 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5aab533a..bedf55aa 100755
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -37,6 +37,13 @@ if("${ENABLE_PRIVATEGAUSS}" STREQUAL "ON")
|
||||
MESSAGE(FATAL_ERROR " The option ENABLE_PRIVATEGAUSS is not supported thus should be turned off.")
|
||||
endif()
|
||||
|
||||
+if("${ENABLE_LITE_MODE}" STREQUAL "")
|
||||
+ set(ENABLE_LITE_MODE "OFF")
|
||||
+endif()
|
||||
+if("${ENABLE_MOT}" STREQUAL "")
|
||||
+ set(ENABLE_MOT "OFF")
|
||||
+endif()
|
||||
+
|
||||
#FIXME: make it an argument
|
||||
set(openGauss ".")
|
||||
set(ENV{openGauss} ".")
|
||||
@@ -107,7 +114,7 @@ install(DIRECTORY ${CMAKE_BINARY_DIR}/pg_plugin DESTINATION lib/postgresql)
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/libsimsearch DESTINATION lib)
|
||||
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/contrib/dolphin)
|
||||
- install(CODE "execute_process(COMMAND bash cmake.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/contrib/dolphin)")
|
||||
+ execute_process(COMMAND bash cmake.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/contrib/dolphin)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/contrib/dolphin/dolphin.control
|
||||
DESTINATION share/postgresql/extension/
|
||||
)
|
||||
@@ -153,7 +160,4 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/contrib/dolphin)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/contrib/dolphin/openGauss_expr_dolphin.ir
|
||||
DESTINATION share/postgresql/extension/
|
||||
)
|
||||
- install(FILES ${CMAKE_SOURCE_DIR}/contrib/dolphin/tmp_build/lib/dolphin.so
|
||||
- DESTINATION lib/postgresql
|
||||
- )
|
||||
endif()
|
||||
\ No newline at end of file
|
||||
diff --git a/cmake/src/build_options.cmake b/cmake/src/build_options.cmake
|
||||
index f079789b..57fbc28e 100755
|
||||
--- a/cmake/src/build_options.cmake
|
||||
+++ b/cmake/src/build_options.cmake
|
||||
@@ -367,11 +367,11 @@ endif()
|
||||
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)
|
||||
+configure_file(${CMAKE_SOURCE_DIR}/${openGauss}/cmake/src/config-in/${CONFIG_IN_FILE} ${CMAKE_BINARY_DIR}/pg_config.h @ONLY)
|
||||
+configure_file(${CMAKE_SOURCE_DIR}/${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)
|
||||
+configure_file(${CMAKE_SOURCE_DIR}/${openGauss}/src/makefiles/pgxs.mk ${CMAKE_BINARY_DIR}/${openGauss}/src/makefiles/pgxs.mk @ONLY)
|
||||
SET(PROJECT_INCLUDE_DIR ${PROJECT_INCLUDE_DIR} ${CMAKE_BINARY_DIR})
|
||||
|
||||
# 排斥项
|
||||
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
|
||||
index 7777f062..8b827394 100644
|
||||
--- a/contrib/CMakeLists.txt
|
||||
+++ b/contrib/CMakeLists.txt
|
||||
@@ -30,6 +30,13 @@ set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gms_profiler
|
||||
)
|
||||
|
||||
+if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
+ INCLUDE_DIRECTORIES(${LIBODBC_INCLUDE_PATH})
|
||||
+ INCLUDE_DIRECTORIES(${LIBODBC_LIB_PATH})
|
||||
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dblink)
|
||||
+ add_subdirectory(dblink)
|
||||
+endif()
|
||||
+
|
||||
add_subdirectory(hstore)
|
||||
add_subdirectory(test_decoding)
|
||||
add_subdirectory(mppdb_decoding)
|
||||
@@ -58,3 +65,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/datavec)
|
||||
add_subdirectory(datavec)
|
||||
endif()
|
||||
add_subdirectory(gms_profiler)
|
||||
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/dolphin)
|
||||
+ add_subdirectory(dolphin)
|
||||
+endif()
|
||||
diff --git a/contrib/dblink/CMakeLists.txt b/contrib/dblink/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 00000000..c1fe4237
|
||||
--- /dev/null
|
||||
+++ b/contrib/dblink/CMakeLists.txt
|
||||
@@ -0,0 +1,23 @@
|
||||
+#This is the main CMAKE for build all gms_stats.
|
||||
+# gms_stats
|
||||
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} TGT_dblink_SRC)
|
||||
+set(TGT_dblink_INC
|
||||
+ ${PROJECT_OPENGS_DIR}/contrib/dblink
|
||||
+ ${PROJECT_OPENGS_DIR}/contrib
|
||||
+)
|
||||
+
|
||||
+set(dblink_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
+set(dblink_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${LIB_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
+set(dblink_LINK_OPTIONS ${LIB_LINK_OPTIONS})
|
||||
+add_shared_libtarget(dblink TGT_dblink_SRC TGT_dblink_INC "${dblink_DEF_OPTIONS}" "${dblink_COMPILE_OPTIONS}" "${dblink_LINK_OPTIONS}")
|
||||
+target_link_libraries(dblink PUBLIC -lodbc)
|
||||
+target_link_directories(dblink PUBLIC ${ODBC_HOME}/lib)
|
||||
+set_target_properties(dblink PROPERTIES PREFIX "")
|
||||
+
|
||||
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dblink.control
|
||||
+ DESTINATION share/postgresql/extension/
|
||||
+)
|
||||
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dblink--1.0.sql
|
||||
+ DESTINATION share/postgresql/extension/
|
||||
+)
|
||||
+install(TARGETS dblink DESTINATION lib/postgresql)
|
||||
\ No newline at end of file
|
||||
diff --git a/contrib/dolphin/CMakeLists.txt b/contrib/dolphin/CMakeLists.txt
|
||||
index 4a606c78..b9a87a76 100755
|
||||
--- a/contrib/dolphin/CMakeLists.txt
|
||||
+++ b/contrib/dolphin/CMakeLists.txt
|
||||
@@ -38,11 +38,11 @@ if("${ENABLE_PRIVATEGAUSS}" STREQUAL "ON")
|
||||
endif()
|
||||
|
||||
#FIXME: make it an argument
|
||||
-set(openGauss "../..")
|
||||
-set(ENV{openGauss} "../..")
|
||||
+set(openGauss ".")
|
||||
+set(ENV{openGauss} ".")
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
-set(PROJECT_TRUNK_DIR ${CMAKE_SOURCE_DIR}/../..)
|
||||
+set(PROJECT_TRUNK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
set(PROJECT_OPENGS_DIR ${PROJECT_TRUNK_DIR} CACHE INTERNAL "")
|
||||
|
||||
# PROJECT_TRUNK_DIR: ./
|
||||
@@ -75,7 +75,7 @@ endif()
|
||||
|
||||
message(WARNING "dolphin cmake begin")
|
||||
|
||||
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../cmake/src)
|
||||
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/src)
|
||||
|
||||
include(build_function)
|
||||
include(set_thirdparty_path)
|
||||
diff --git a/contrib/dolphin/cmake.sh b/contrib/dolphin/cmake.sh
|
||||
index 217b0844..8364f6bd 100644
|
||||
--- a/contrib/dolphin/cmake.sh
|
||||
+++ b/contrib/dolphin/cmake.sh
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
-CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON"
|
||||
-cpus_num=$(grep -w processor /proc/cpuinfo|wc -l)
|
||||
rm -f dolphin--4.0.sql
|
||||
touch dolphin--4.0.sql
|
||||
for i in `ls sql_script`; do cat sql_script/$i >> dolphin--4.0.sql; done
|
||||
@@ -30,10 +28,3 @@ rm -f dolphin--4.0.1--4.0.sql dolphin--4.0--4.0.1.sql
|
||||
cp dolphin--2.0--2.0.1.sql dolphin--4.0--4.0.1.sql
|
||||
cp dolphin--2.0.1--2.0.sql dolphin--4.0.1--4.0.sql
|
||||
cp llvmir/openGauss_expr_dolphin_${BUILD_TUPLE}.ir openGauss_expr_dolphin.ir
|
||||
-DOLPHIN_CMAKE_BUILD_DIR=`pwd`/tmp_build
|
||||
-[ -d "${DOLPHIN_CMAKE_BUILD_DIR}" ] && rm -rf ${DOLPHIN_CMAKE_BUILD_DIR}
|
||||
-mkdir -p ${DOLPHIN_CMAKE_BUILD_DIR}
|
||||
-cd ${DOLPHIN_CMAKE_BUILD_DIR}
|
||||
-cmake .. ${CMAKE_OPT}
|
||||
-make VERBOSE=1 -sj ${cpus_num}
|
||||
-make install -sj ${cpus_num}
|
||||
diff --git a/contrib/dolphin/plugin_optimizer/commands/copy.cpp b/contrib/dolphin/plugin_optimizer/commands/copy.cpp
|
||||
index f48b1f9c..840be4f3 100644
|
||||
--- a/contrib/dolphin/plugin_optimizer/commands/copy.cpp
|
||||
+++ b/contrib/dolphin/plugin_optimizer/commands/copy.cpp
|
||||
@@ -7089,12 +7089,14 @@ retry:
|
||||
if (cstate->mode == MODE_NORMAL) {
|
||||
if (cstate->filename && is_obs_protocol(cstate->filename)) {
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
+#ifdef ENABLE_OBS
|
||||
if (getNextOBS(cstate)) {
|
||||
cstate->eol_type = EOL_UNKNOWN;
|
||||
goto retry;
|
||||
}
|
||||
#else
|
||||
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
|
||||
+#endif
|
||||
#endif
|
||||
} else {
|
||||
if (getNextGDS<true>(cstate)) {
|
||||
@@ -10060,6 +10062,7 @@ void bulkloadFuncFactory(CopyState cstate)
|
||||
case MODE_NORMAL: /* for GDS oriented dist import */
|
||||
if (is_obs_protocol(cstate->filename)) {
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
+#ifdef ENABLE_OBS
|
||||
/* Attache working house routines for OBS oriented dist import */
|
||||
func.initBulkLoad = initOBSModeState;
|
||||
func.endBulkLoad = endOBSModeBulkLoad;
|
||||
@@ -10068,6 +10071,7 @@ void bulkloadFuncFactory(CopyState cstate)
|
||||
getNextCopyFunc = getNextOBS;
|
||||
#else
|
||||
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
|
||||
+#endif
|
||||
#endif
|
||||
} else {
|
||||
/* Attache working house routines for GDS oriented dist import */
|
||||
@@ -10135,6 +10139,7 @@ CopyState beginExport(
|
||||
|
||||
if (is_obs_protocol(filename)) {
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
+#ifdef ENABLE_OBS
|
||||
/* Fetch OBS write only table related attribtues */
|
||||
getOBSOptions(&cstate->obs_copy_options, options);
|
||||
|
||||
@@ -10153,6 +10158,7 @@ CopyState beginExport(
|
||||
initOBSModeState(cstate, object_path, tasklist);
|
||||
#else
|
||||
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
|
||||
+#endif
|
||||
#endif
|
||||
} else {
|
||||
initNormalModeState<false>(cstate, filename, tasklist);
|
||||
@@ -10317,6 +10323,7 @@ void endExport(CopyState cstate)
|
||||
}
|
||||
} else if (cstate->copy_dest == COPY_OBS) {
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
+#ifdef ENABLE_OBS
|
||||
if (IS_PGXC_DATANODE) {
|
||||
if (cstate->outBuffer->len > 0)
|
||||
RemoteExportFlushData(cstate);
|
||||
@@ -10326,6 +10333,7 @@ void endExport(CopyState cstate)
|
||||
}
|
||||
#else
|
||||
FEATURE_ON_LITE_MODE_NOT_SUPPORTED();
|
||||
+#endif
|
||||
#endif
|
||||
} else
|
||||
exportDeinitOutBuffer(cstate);
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
diff --git a/src/common/port/CMakeLists.txt b/src/common/port/CMakeLists.txt
|
||||
index b9a6a28..e511eb0 100755
|
||||
--- a/src/common/port/CMakeLists.txt
|
||||
+++ b/src/common/port/CMakeLists.txt
|
||||
@@ -90,10 +90,31 @@ if("${BUILD_TUPLE}" STREQUAL "aarch64")
|
||||
set(TGT_crc32_arm_parallel_SRC ${CMAKE_CURRENT_SOURCE_DIR}/crc32_arm_parallel.S)
|
||||
endif()
|
||||
|
||||
+if("${BUILD_TUPLE}" STREQUAL "armv7l")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sb8.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+ set(TGT_crc32_arm_parallel_SRC ${CMAKE_CURRENT_SOURCE_DIR}/crc32_arm_parallel.S)
|
||||
+endif()
|
||||
+
|
||||
if("${BUILD_TUPLE}" STREQUAL "loongarch64")
|
||||
list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
endif()
|
||||
|
||||
+if("${BUILD_TUPLE}" STREQUAL "riscv64")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "ppc64le")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "s390x")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "i586")
|
||||
+ list(REMOVE_ITEM TGT_port_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
SET(TGT_pgport_INC
|
||||
${PROJECT_SRC_DIR}/common/backend
|
||||
${PROJECT_SRC_DIR}/common/port
|
||||
@@ -163,10 +184,31 @@ if("${BUILD_TUPLE}" STREQUAL "aarch64")
|
||||
set(TGT_crc32_arm_parallel_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/crc32_arm_parallel.S)
|
||||
endif()
|
||||
|
||||
+if("${BUILD_TUPLE}" STREQUAL "armv7l")
|
||||
+ list(REMOVE_ITEM TGT_pgport_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sb8.cpp ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sse42.cpp)
|
||||
+ set(TGT_crc32_arm_parallel_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/crc32_arm_parallel.S)
|
||||
+endif()
|
||||
+
|
||||
if("${BUILD_TUPLE}" STREQUAL "loongarch64")
|
||||
list(REMOVE_ITEM TGT_pgport_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sse42.cpp)
|
||||
endif()
|
||||
|
||||
+if("${BUILD_TUPLE}" STREQUAL "riscv64")
|
||||
+ list(REMOVE_ITEM TGT_pgport_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "ppc64le")
|
||||
+ list(REMOVE_ITEM TGT_pgport_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "s390x")
|
||||
+ list(REMOVE_ITEM TGT_pgport_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
+if("${BUILD_TUPLE}" STREQUAL "i586")
|
||||
+ list(REMOVE_ITEM TGT_pgport_srv_SRC ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_choose.cpp ${CMAKE_CURRENT_SOURCE_DIR}/port_srv/pg_crc32c_sse42.cpp)
|
||||
+endif()
|
||||
+
|
||||
SET(TGT_pgport_srv_INC
|
||||
${PROJECT_SRC_DIR}/common/backend
|
||||
${PROJECT_SRC_DIR}/common/port
|
||||
|
||||
diff --git a/src/include/storage/lock/s_lock.h b/src/include/storage/lock/s_lock.h
|
||||
index 715d84a..bf7b041 100644
|
||||
--- a/src/include/storage/lock/s_lock.h
|
||||
+++ b/src/include/storage/lock/s_lock.h
|
||||
@@ -283,7 +283,7 @@ static __inline__ int tas(volatile slock_t* lock)
|
||||
* the int-width variant of the builtin works on more chips than other widths.
|
||||
*/
|
||||
|
||||
-#if defined(__aarch64__) || defined(__aarch64)
|
||||
+#if defined(__aarch64__) || defined(__aarch64) || defined(__riscv)
|
||||
|
||||
#ifdef ENABLE_THREAD_CHECK
|
||||
extern "C" {
|
||||
diff --git a/src/gausskernel/storage/buffer/bufmgr.cpp b/src/gausskernel/storage/buffer/bufmgr.cpp
|
||||
index c6a4c2c2..3b71a381 100644
|
||||
--- a/src/gausskernel/storage/buffer/bufmgr.cpp
|
||||
+++ b/src/gausskernel/storage/buffer/bufmgr.cpp
|
||||
@@ -1962,7 +1962,13 @@ Buffer ReadBuffer_common_for_localbuf(RelFileNode rnode, char relpersistence, Fo
|
||||
|
||||
Assert(buf_state & BM_VALID);
|
||||
buf_state &= ~BM_VALID;
|
||||
- pg_atomic_write_u32(((volatile uint32 *)&bufHdr->state) + 1, buf_state >> 32);
|
||||
+ pg_atomic_write_u32(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ ((volatile uint32 *)&bufHdr->state) + 1,
|
||||
+#else
|
||||
+ ((volatile uint32 *)&bufHdr->state),
|
||||
+#endif
|
||||
+ buf_state >> 32);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1986,7 +1992,13 @@ Buffer ReadBuffer_common_for_localbuf(RelFileNode rnode, char relpersistence, Fo
|
||||
|
||||
uint64 buf_state = pg_atomic_read_u64(&bufHdr->state);
|
||||
buf_state |= BM_VALID;
|
||||
- pg_atomic_write_u32(((volatile uint32 *)&bufHdr->state) + 1, buf_state >> 32);
|
||||
+ pg_atomic_write_u32(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ ((volatile uint32 *)&bufHdr->state) + 1,
|
||||
+#else
|
||||
+ ((volatile uint32 *)&bufHdr->state),
|
||||
+#endif
|
||||
+ buf_state >> 32);
|
||||
|
||||
return BufferDescriptorGetBuffer(bufHdr);
|
||||
}
|
||||
@@ -2703,7 +2715,13 @@ found_branch:
|
||||
|
||||
Assert(buf_state & BM_VALID);
|
||||
buf_state &= ~BM_VALID;
|
||||
- pg_atomic_write_u32(((volatile uint32 *)&bufHdr->state) + 1, buf_state >> 32);
|
||||
+ pg_atomic_write_u32(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ ((volatile uint32 *)&bufHdr->state) + 1,
|
||||
+#else
|
||||
+ ((volatile uint32 *)&bufHdr->state),
|
||||
+#endif
|
||||
+ buf_state >> 32);
|
||||
} else {
|
||||
/*
|
||||
* Loop to handle the very small possibility that someone re-sets
|
||||
@@ -2856,7 +2874,13 @@ found_branch:
|
||||
uint64 buf_state = pg_atomic_read_u64(&bufHdr->state);
|
||||
|
||||
buf_state |= BM_VALID;
|
||||
- pg_atomic_write_u32(((volatile uint32 *)&bufHdr->state) + 1, buf_state >> 32);
|
||||
+ pg_atomic_write_u32(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ ((volatile uint32 *)&bufHdr->state) + 1,
|
||||
+#else
|
||||
+ ((volatile uint32 *)&bufHdr->state),
|
||||
+#endif
|
||||
+ buf_state >> 32);
|
||||
} else {
|
||||
bufHdr->extra->lsn_on_disk = PageGetLSN(bufBlock);
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
diff --git a/src/gausskernel/storage/lmgr/lwlock.cpp b/src/gausskernel/storage/lmgr/lwlock.cpp
|
||||
index d84b4334..7b547c4d 100644
|
||||
--- a/src/gausskernel/storage/lmgr/lwlock.cpp
|
||||
+++ b/src/gausskernel/storage/lmgr/lwlock.cpp
|
||||
@@ -893,7 +893,13 @@ static bool LWLockAttemptLock(LWLock *lock, LWLockMode mode)
|
||||
if ((desired_state & (LW_VAL_EXCLUSIVE)) != 0) {
|
||||
return true;
|
||||
}
|
||||
- } while (!pg_atomic_compare_exchange_u8((((volatile uint8*)&lock->state) + maskId), ((uint8*)&old_state) + maskId, (desired_state >> (8 * maskId))));
|
||||
+ } while (!pg_atomic_compare_exchange_u8(
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
+ (((volatile uint8*)&lock->state) + maskId), ((uint8*)&old_state) + maskId,
|
||||
+#else
|
||||
+ (((volatile uint8*)&lock->state) + sizeof(lock->state) - maskId - 1), ((uint8*)&old_state) + sizeof(lock->state) - maskId - 1,
|
||||
+#endif
|
||||
+ (desired_state >> (8 * maskId))));
|
||||
} else if (mode == LW_EXCLUSIVE) {
|
||||
old_state = pg_atomic_read_u64(&lock->state);
|
||||
do {
|
||||
diff --git a/src/include/port/pg_bswap.h b/src/include/port/pg_bswap.h
|
||||
index e82cb6be..51107e71 100644
|
||||
--- a/src/include/port/pg_bswap.h
|
||||
+++ b/src/include/port/pg_bswap.h
|
||||
@@ -24,6 +24,11 @@
|
||||
#ifndef PG_BSWAP_H
|
||||
#define PG_BSWAP_H
|
||||
|
||||
+#ifdef __s390x__
|
||||
+#define HAVE__BUILTIN_BSWAP32
|
||||
+#define HAVE__BUILTIN_BSWAP64
|
||||
+#endif // __s390x__
|
||||
+
|
||||
#ifdef HAVE__BUILTIN_BSWAP32
|
||||
#define BSWAP32(x) __builtin_bswap32(x)
|
||||
#else
|
||||
diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h
|
||||
index 1801e35e..a1519813 100644
|
||||
--- a/src/include/port/pg_crc32c.h
|
||||
+++ b/src/include/port/pg_crc32c.h
|
||||
@@ -91,7 +91,7 @@ extern pg_crc32c (*pg_comp_crc32c)(pg_crc32c crc, const void* data, size_t len);
|
||||
*/
|
||||
#define COMP_CRC32C(crc, data, len) ((crc) = pg_comp_crc32c_sb8((crc), (data), (len)))
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
-#define FIN_CRC32C(crc) ((crc) = pg_bswap32(crc) ^ 0xFFFFFFFF)
|
||||
+#define FIN_CRC32C(crc) ((crc) = BSWAP32(crc) ^ 0xFFFFFFFF)
|
||||
#else
|
||||
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
|
||||
#endif
|
||||
diff --git a/src/include/postgres.h b/src/include/postgres.h
|
||||
index 15d4ade6..04cb1198 100644
|
||||
--- a/src/include/postgres.h
|
||||
+++ b/src/include/postgres.h
|
||||
@@ -343,6 +343,7 @@ typedef enum {
|
||||
#define VARSIZE_4B(PTR) (((varattrib_4b*)(PTR))->va_4byte.va_header & 0x3FFFFFFF)
|
||||
#define VARSIZE_1B(PTR) (((varattrib_1b*)(PTR))->va_header & 0x7F)
|
||||
#define VARSIZE_1B_E(PTR) (((varattrib_1b_e*)(PTR))->va_len_1be)
|
||||
+#define VARTAG_1B_E(PTR) (((varattrib_1b_e*) (PTR))->va_tag)
|
||||
|
||||
#define SET_VARSIZE_4B(PTR, len) (((varattrib_4b*)(PTR))->va_4byte.va_header = (len)&0x3FFFFFFF)
|
||||
#define SET_VARSIZE_4B_C(PTR, len) (((varattrib_4b*)(PTR))->va_4byte.va_header = ((len)&0x3FFFFFFF) | 0x40000000)
|
||||
diff --git a/src/include/storage/buf/buf_internals.h b/src/include/storage/buf/buf_internals.h
|
||||
index 10063fa2..95e26e0c 100644
|
||||
--- a/src/include/storage/buf/buf_internals.h
|
||||
+++ b/src/include/storage/buf/buf_internals.h
|
||||
@@ -282,6 +282,7 @@ extern "C" {
|
||||
#define TsAnnotateHappensBefore(addr)
|
||||
#endif
|
||||
|
||||
+#ifndef WORDS_BIGENDIAN
|
||||
#define UnlockBufHdr(desc, s) \
|
||||
do { \
|
||||
/* ENABLE_THREAD_CHECK only, release semantic */ \
|
||||
@@ -289,6 +290,15 @@ extern "C" {
|
||||
pg_write_barrier(); \
|
||||
pg_atomic_write_u32((((volatile uint32 *)&(desc)->state) + 1), ( ( (s) & (~BM_LOCKED) ) >> 32) ); \
|
||||
} while (0)
|
||||
+#else
|
||||
+#define UnlockBufHdr(desc, s) \
|
||||
+ do { \
|
||||
+ /* ENABLE_THREAD_CHECK only, release semantic */ \
|
||||
+ TsAnnotateHappensBefore(&desc->state); \
|
||||
+ pg_write_barrier(); \
|
||||
+ pg_atomic_write_u32((((volatile uint32 *)&(desc)->state)), ( ( (s) & (~BM_LOCKED) ) >> 32) ); \
|
||||
+ } while (0)
|
||||
+#endif
|
||||
|
||||
#define FIX_SEG_BUFFER_TAG(node, tag, rel_node, block_num) \
|
||||
do { \
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' opengauss_server_600/src/common/interfaces/libpq/fe-secure.cpp opengauss_server_600_edit/src/common/interfaces/libpq/fe-secure.cpp
|
||||
*** opengauss_server_600/src/common/interfaces/libpq/fe-secure.cpp 2024-11-19 20:01:27.697621300 +0800
|
||||
--- opengauss_server_600_edit/src/common/interfaces/libpq/fe-secure.cpp 2024-11-19 20:04:07.461621300 +0800
|
||||
***************
|
||||
*** 446,451 ****
|
||||
--- 446,454 ----
|
||||
libpq_gettext("SSL error: %s, remote datanode %s, error: %s\n"),
|
||||
errm, conn->remote_nodename, strerror(errno));
|
||||
SSLerrfree(errm);
|
||||
+ #ifdef ENABLE_OPENSSL3
|
||||
+ REMEMBER_EPIPE(spinfo, errno == EPIPE);
|
||||
+ #endif
|
||||
/* assume the connection is broken */
|
||||
result_errno = ECONNRESET;
|
||||
n = -1;
|
||||
***************
|
||||
*** 596,601 ****
|
||||
--- 599,607 ----
|
||||
libpq_gettext("SSL error: %s, remote datanode %s, error: %s\n"), errm,
|
||||
conn->remote_nodename, strerror(errno));
|
||||
SSLerrfree(errm);
|
||||
+ #ifdef ENABLE_OPENSSL3
|
||||
+ REMEMBER_EPIPE(spinfo, errno == EPIPE);
|
||||
+ #endif
|
||||
/* assume the connection is broken */
|
||||
result_errno = ECONNRESET;
|
||||
n = -1;
|
||||
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' opengauss_server_600/src/gausskernel/security/keymgr/encrypt/security_aead_aes_hmac_enc_key.cpp opengauss_server_600_edit/src/gausskernel/security/keymgr/encrypt/security_aead_aes_hmac_enc_key.cpp
|
||||
*** opengauss_server_600/src/gausskernel/security/keymgr/encrypt/security_aead_aes_hmac_enc_key.cpp 2024-11-19 20:01:27.705621300 +0800
|
||||
--- opengauss_server_600_edit/src/gausskernel/security/keymgr/encrypt/security_aead_aes_hmac_enc_key.cpp 2024-11-19 20:04:07.773621300 +0800
|
||||
***************
|
||||
*** 47,52 ****
|
||||
--- 47,62 ----
|
||||
|
||||
const int RAND_COUNT = 100;
|
||||
|
||||
+ #ifdef ENABLE_OPENSSL3
|
||||
+ void HmacCtxGroup::free_hmac_ctx(HMAC_CTX** ctx_tmp) const
|
||||
+ {
|
||||
+ if (*ctx_tmp != NULL) {
|
||||
+ HMAC_CTX_free(*ctx_tmp);
|
||||
+ *ctx_tmp = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ #endif
|
||||
+
|
||||
/* Derives all the required keys from the given root key */
|
||||
AeadAesHamcEncKey::AeadAesHamcEncKey(unsigned char *root_key, size_t root_key_size)
|
||||
{
|
||||
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' opengauss_server_600/src/gausskernel/security/keymgr/encrypt/security_sm2_enc_key.cpp opengauss_server_600_edit/src/gausskernel/security/keymgr/encrypt/security_sm2_enc_key.cpp
|
||||
*** opengauss_server_600/src/gausskernel/security/keymgr/encrypt/security_sm2_enc_key.cpp 2024-11-19 20:01:27.705621300 +0800
|
||||
--- opengauss_server_600_edit/src/gausskernel/security/keymgr/encrypt/security_sm2_enc_key.cpp 2024-11-19 20:04:07.773621300 +0800
|
||||
***************
|
||||
*** 163,174 ****
|
||||
--- 163,176 ----
|
||||
return CMKEM_EVP_ERR;
|
||||
}
|
||||
|
||||
+ #ifndef ENABLE_OPENSSL3
|
||||
ret = EVP_PKEY_set_alias_type(public_evp_key, EVP_PKEY_SM2);
|
||||
if (ret != 1) {
|
||||
cmkem_errmsg("EVP_PKEY_set_alias_type to EVP_PKEY_SM2 failed!");
|
||||
EVP_PKEY_free(public_evp_key);
|
||||
return CMKEM_EVP_ERR;
|
||||
}
|
||||
+ #endif
|
||||
|
||||
/* do cipher. */
|
||||
ctx = EVP_PKEY_CTX_new(public_evp_key, NULL);
|
||||
***************
|
||||
*** 253,264 ****
|
||||
--- 255,268 ----
|
||||
return CMKEM_EVP_ERR;
|
||||
}
|
||||
|
||||
+ #ifndef ENABLE_OPENSSL3
|
||||
ret = EVP_PKEY_set_alias_type(private_evp_key, EVP_PKEY_SM2);
|
||||
if (ret != 1) {
|
||||
cmkem_errmsg("EVP_PKEY_set_alias_type to EVP_PKEY_SM2 failed!");
|
||||
EVP_PKEY_free(private_evp_key);
|
||||
return CMKEM_EVP_ERR;
|
||||
}
|
||||
+ #endif
|
||||
|
||||
/* do cipher. */
|
||||
ctx = EVP_PKEY_CTX_new(private_evp_key, NULL);
|
||||
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' opengauss_server_600/src/include/keymgr/encrypt/security_aead_aes_hamc_enc_key.h opengauss_server_600_edit/src/include/keymgr/encrypt/security_aead_aes_hamc_enc_key.h
|
||||
*** opengauss_server_600/src/include/keymgr/encrypt/security_aead_aes_hamc_enc_key.h 2024-11-19 20:01:27.721621300 +0800
|
||||
--- opengauss_server_600_edit/src/include/keymgr/encrypt/security_aead_aes_hamc_enc_key.h 2024-11-19 20:04:08.037621300 +0800
|
||||
***************
|
||||
*** 49,54 ****
|
||||
--- 49,57 ----
|
||||
HMAC_CTX* ctx_worker;
|
||||
HMAC_CTX* ctx_template;
|
||||
private:
|
||||
+ #ifdef ENABLE_OPENSSL3
|
||||
+ void free_hmac_ctx(HMAC_CTX** ctx_tmp) const;
|
||||
+ #else
|
||||
void free_hmac_ctx(HMAC_CTX** ctx_tmp)
|
||||
{
|
||||
if (*ctx_tmp != NULL) {
|
||||
***************
|
||||
*** 56,61 ****
|
||||
--- 59,65 ----
|
||||
*ctx_tmp = NULL;
|
||||
}
|
||||
}
|
||||
+ #endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -0,0 +1,326 @@
|
|||
diff --git a/cmake/src/build_function.cmake b/cmake/src/build_function.cmake
|
||||
index fc114c9f2..f22208259 100755
|
||||
--- a/cmake/src/build_function.cmake
|
||||
+++ b/cmake/src/build_function.cmake
|
||||
@@ -395,7 +395,7 @@ function(check_headers_func_c check_include_files check_functions check_decl che
|
||||
endfunction(check_headers_func_c)
|
||||
|
||||
function(CHECK_FOR_MPPDB)
|
||||
- set(CHECK_INC_FILES crtdefs.h crypt.h dld.h editline/history.h editline/readline.h fp_class.h getopt.h gssapi/gssapi.h gssapi.h history.h ieeefp.h ifaddrs.h inttypes.h langinfo.h ldap.h memory.h netinet/in.h netinet/tcp.h net/if.h ossp/uuid.h pam/pam_appl.h poll.h pwd.h readline.h readline/history.h readline/readline.h security/pam_appl.h stdint.h stdlib.h strings.h string.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/stat.h sys/tas.h sys/time.h sys/wait.h sys/types.h sys/ucred.h sys/un.h termios.h ucred.h unistd.h utime.h uuid.h wchar.h wctype.h winldap.h stdio.h stddef.h stdarg.h ac_nonexistent.h float.h zlib.h krb5.h libxml/parser.h libxslt/xslt.h windows.h dns_sd.h sys/param.h limits.h netdb.h locale.h xlocale.h fcntl.h machine/vmparam.h sys/exec.h math.h dbghelp.h setjmp.h signal.h syslog.h pthread.h cpuid.h intrin.h nmmintrin.h libintl.h tcl.h Python.h dlfcn.h errno.h)
|
||||
+ set(CHECK_INC_FILES crtdefs.h crypt.h dld.h fp_class.h getopt.h gssapi/gssapi.h gssapi.h history.h ieeefp.h ifaddrs.h inttypes.h langinfo.h ldap.h memory.h netinet/in.h netinet/tcp.h net/if.h ossp/uuid.h pam/pam_appl.h poll.h pwd.h readline.h readline/history.h readline/readline.h security/pam_appl.h stdint.h stdlib.h strings.h string.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/stat.h sys/tas.h sys/time.h sys/wait.h sys/types.h sys/ucred.h sys/un.h termios.h ucred.h unistd.h utime.h uuid.h wchar.h wctype.h winldap.h stdio.h stddef.h stdarg.h ac_nonexistent.h float.h zlib.h krb5.h libxml/parser.h libxslt/xslt.h windows.h dns_sd.h sys/param.h limits.h netdb.h locale.h xlocale.h fcntl.h machine/vmparam.h sys/exec.h math.h dbghelp.h setjmp.h signal.h syslog.h pthread.h cpuid.h intrin.h nmmintrin.h libintl.h tcl.h Python.h dlfcn.h errno.h)
|
||||
set(STDC_HEADERS 1 PARENT_SCOPE)
|
||||
|
||||
set(CHECK_FUNCTIONS append_history cbrt class crypt dlopen fdatasync fls fpclass fp_class fp_class_d getaddrinfo gethostbyname_r getifaddrs getopt getopt_long getpeereid getpeerucred getpwuid_r getrlimit getrusage gettimeofday history_truncate_file inet_aton mbstowcs_l memmove poll posix_fadvise pstat random readlink rint rl_completion_matches rl_filename_completion_function setproctitle setsid sigprocmask snprintf srandom strerror strerror_r strlcat strlcpy strtoll strtoq strtoull strtouq symlink sync_file_range towlower unsetenv utime utimes vsnprintf waitpid wcstombs wcstombs_l fseeko rl_completion_append_character isinf sigsetjmp syslog)
|
||||
diff --git a/src/common/interfaces/libpq/CMakeLists.txt b/src/common/interfaces/libpq/CMakeLists.txt
|
||||
index b899d1bde..de20fce00 100755
|
||||
--- a/src/common/interfaces/libpq/CMakeLists.txt
|
||||
+++ b/src/common/interfaces/libpq/CMakeLists.txt
|
||||
@@ -279,9 +279,9 @@ if(NOT "${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS}" STREQUAL "OFF_OFF")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
- target_link_libraries(pq_ce PRIVATE ${pq_ce_LINK_LIBS} libkeymgr.a -lcurl -lcjson -lssl -lcrypto -l${SECURE_C_CHECK} -lpthread -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
+ target_link_libraries(pq_ce PRIVATE ${pq_ce_LINK_LIBS} keymgr_static -lcurl -lcjson -lssl -lcrypto -l${SECURE_C_CHECK} -lpthread -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
else()
|
||||
- target_link_libraries(pq_ce PRIVATE ${pq_ce_LINK_LIBS} libkeymgr.a -lcurl -lcjson -lssl -lcrypto -l${SECURE_C_CHECK} -lpthread)
|
||||
+ target_link_libraries(pq_ce PRIVATE ${pq_ce_LINK_LIBS} keymgr_static -lcurl -lcjson -lssl -lcrypto -l${SECURE_C_CHECK} -lpthread)
|
||||
endif()
|
||||
add_dependencies(pq_ce libpq_ce encryption_hooks client_logic_common client_logic_expressions client_logic_cache client_logic_processor client_logic_fmt client_logic_hooks client_logic_data_fetcher frontend_parser)
|
||||
target_link_directories(pq_ce PUBLIC
|
||||
diff --git a/src/gausskernel/cbb/bbox/bbox_elf_dump.h b/src/gausskernel/cbb/bbox/bbox_elf_dump.h
|
||||
index acdf5ede4..8b9065ab6 100644
|
||||
--- a/src/gausskernel/cbb/bbox/bbox_elf_dump.h
|
||||
+++ b/src/gausskernel/cbb/bbox/bbox_elf_dump.h
|
||||
@@ -31,11 +31,7 @@
|
||||
#include <sys/poll.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/socket.h>
|
||||
-#if (defined WITH_OPENEULER_OS) || (defined OPENEULER_MAJOR)
|
||||
#include <linux/sysctl.h>
|
||||
-#else
|
||||
-#include <sys/sysctl.h>
|
||||
-#endif
|
||||
#include <sys/ptrace.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <sys/time.h>
|
||||
diff --git a/src/gausskernel/cbb/bbox/bbox_syscall_support.h b/src/gausskernel/cbb/bbox/bbox_syscall_support.h
|
||||
index 12adc5728..6db7840ea 100644
|
||||
--- a/src/gausskernel/cbb/bbox/bbox_syscall_support.h
|
||||
+++ b/src/gausskernel/cbb/bbox/bbox_syscall_support.h
|
||||
@@ -54,11 +54,7 @@
|
||||
#include <sys/poll.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/socket.h>
|
||||
-#if (defined WITH_OPENEULER_OS) || (defined OPENEULER_MAJOR)
|
||||
#include <linux/sysctl.h>
|
||||
-#else
|
||||
-#include <sys/sysctl.h>
|
||||
-#endif
|
||||
#include <sys/uio.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
diff --git a/src/common/backend/utils/adt/xml.cpp b/src/common/backend/utils/adt/xml.cpp
|
||||
index 9a62a82..48adb14 100644
|
||||
--- a/src/common/backend/utils/adt/xml.cpp
|
||||
+++ b/src/common/backend/utils/adt/xml.cpp
|
||||
@@ -112,7 +112,7 @@ struct PgXmlErrorContext {
|
||||
};
|
||||
|
||||
static xmlParserInputPtr xmlPgEntityLoader(const char* URL, const char* ID, xmlParserCtxtPtr ctxt);
|
||||
-static void xml_error_handler(void* data, xmlErrorPtr error);
|
||||
+static void xml_error_handler(void* data, const xmlError *error);
|
||||
static void xml_ereport_by_code(int level, int sqlcode, const char* msg, int errcode);
|
||||
static void chopStringInfoNewlines(StringInfo str);
|
||||
static void appendStringInfoLineSeparator(StringInfo str);
|
||||
@@ -1537,7 +1537,7 @@ void xml_ereport(PgXmlErrorContext* errcxt, int level, int sqlcode, const char*
|
||||
ereport(level, (errcode(sqlcode), errmsg_internal("%s", msg), detail ? errdetail_internal("%s", detail) : 0));
|
||||
}
|
||||
|
||||
-static void xml_append_errbuf(xmlErrorPtr error, const xmlChar* name, StringInfo errorBuf)
|
||||
+static void xml_append_errbuf(const xmlError *error, const xmlChar* name, StringInfo errorBuf)
|
||||
{
|
||||
if (error->line > 0)
|
||||
appendStringInfo(errorBuf, "line %d: ", error->line);
|
||||
@@ -1554,7 +1554,7 @@ static void xml_append_errbuf(xmlErrorPtr error, const xmlChar* name, StringInfo
|
||||
/*
|
||||
* Error handler for libxml errors and warnings
|
||||
*/
|
||||
-static void xml_error_handler(void* data, xmlErrorPtr error)
|
||||
+static void xml_error_handler(void* data, const xmlError *error)
|
||||
{
|
||||
PgXmlErrorContext* xmlerrcxt = (PgXmlErrorContext*)data;
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)error->ctxt;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
diff --git a/src/bin/pg_basebackup/pg_basebackup.cpp b/src/bin/pg_basebackup/pg_basebackup.cpp
|
||||
index 88c47e72..a334a782 100644
|
||||
--- a/src/bin/pg_basebackup/pg_basebackup.cpp
|
||||
+++ b/src/bin/pg_basebackup/pg_basebackup.cpp
|
||||
@@ -1689,7 +1689,7 @@ static void GsTarDirCheck(char* tarfilename)
|
||||
struct dirent* ent;
|
||||
while (1) {
|
||||
ent = readdir(dir);
|
||||
- if (ent <= 0) {
|
||||
+ if (ent == NULL) {
|
||||
break;
|
||||
}
|
||||
if ((strcmp(".", ent->d_name) == 0) || (strcmp("..", ent->d_name) == 0)) {
|
||||
diff --git a/src/bin/pg_ctl/backup.cpp b/src/bin/pg_ctl/backup.cpp
|
||||
index 82b50a0c..93444196 100755
|
||||
--- a/src/bin/pg_ctl/backup.cpp
|
||||
+++ b/src/bin/pg_ctl/backup.cpp
|
||||
@@ -1985,7 +1985,7 @@ bool CopySecureFilesMain(char* dirname, uint32 term)
|
||||
}
|
||||
while (1) {
|
||||
de = readdir(dir);
|
||||
- if (de <= 0) {
|
||||
+ if (de == NULL) {
|
||||
break;
|
||||
}
|
||||
if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) {
|
||||
@@ -2884,4 +2884,4 @@ static void BeginGetXlogbyStream(char* xlogstart, uint32 timeline, char* sysiden
|
||||
/* free sysidentifier after use */
|
||||
pg_free(sysidentifier);
|
||||
sysidentifier = NULL;
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/src/gausskernel/optimizer/commands/sequence/sequence.cpp b/src/gausskernel/optimizer/commands/sequence/sequence.cpp
|
||||
index 7c101598..257b8054 100644
|
||||
--- a/src/gausskernel/optimizer/commands/sequence/sequence.cpp
|
||||
+++ b/src/gausskernel/optimizer/commands/sequence/sequence.cpp
|
||||
@@ -749,18 +749,6 @@ static T_Int FetchLogLocal(T_Int* next, T_Int* result, T_Int* last, T_Int maxv,
|
||||
return log;
|
||||
}
|
||||
|
||||
-template<typename T, bool large>
|
||||
-static Datum GetIntDefVal(TypeName* name, T value)
|
||||
-{
|
||||
- if (large) {
|
||||
- *name = makeTypeNameFromOid(INT16OID, -1);
|
||||
- return Int128GetDatum(value);
|
||||
- } else {
|
||||
- *name = makeTypeNameFromOid(INT8OID, -1);
|
||||
- return Int64GetDatumFast(value);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
ObjectAddress DefineSequenceWrapper(CreateSeqStmt* seq)
|
||||
{
|
||||
if (seq->is_large) {
|
||||
diff --git a/src/gausskernel/runtime/opfusion/opfusion_util.cpp b/src/gausskernel/runtime/opfusion/opfusion_util.cpp
|
||||
index 98f3568f..220d4b2f 100644
|
||||
--- a/src/gausskernel/runtime/opfusion/opfusion_util.cpp
|
||||
+++ b/src/gausskernel/runtime/opfusion/opfusion_util.cpp
|
||||
@@ -446,7 +446,7 @@ FusionType checkFusionAgg(Agg *node, ParamListInfo params)
|
||||
|
||||
/* check whether to have order by */
|
||||
if (node->aggstrategy != AGG_PLAIN ||
|
||||
- node->groupingSets > 0) {
|
||||
+ node->groupingSets) {
|
||||
return NOBYPASS_NOT_PLAIN_AGG;
|
||||
}
|
||||
|
||||
diff --git a/src/include/client_logic/cstrings_map.h b/src/include/client_logic/cstrings_map.h
|
||||
index b5f48757..098bcd33 100644
|
||||
--- a/src/include/client_logic/cstrings_map.h
|
||||
+++ b/src/include/client_logic/cstrings_map.h
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#ifndef C_STRINGS_MAP_H
|
||||
#define C_STRINGS_MAP_H
|
||||
+#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
diff --git a/src/include/datatypes.h b/src/include/datatypes.h
|
||||
index 3d40936e..0690aacc 100644
|
||||
--- a/src/include/datatypes.h
|
||||
+++ b/src/include/datatypes.h
|
||||
@@ -24,10 +24,12 @@
|
||||
#ifndef DATA_TYPES_H
|
||||
#define DATA_TYPES_H
|
||||
|
||||
+#include <stdint.h>
|
||||
+
|
||||
typedef unsigned int Oid;
|
||||
typedef uintptr_t Datum;
|
||||
typedef uint16_t uint16;
|
||||
typedef uint32_t uint32;
|
||||
typedef int32_t int32;
|
||||
|
||||
-#endif /* DATA_TYPES_H */
|
||||
\ No newline at end of file
|
||||
+#endif /* DATA_TYPES_H */
|
||||
diff --git a/src/include/gs_policy/policy_common.h b/src/include/gs_policy/policy_common.h
|
||||
index 50552ed9..fd0fd173 100644
|
||||
--- a/src/include/gs_policy/policy_common.h
|
||||
+++ b/src/include/gs_policy/policy_common.h
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "gs_vector.h"
|
||||
#include "pgaudit.h"
|
||||
|
||||
+#include <vector>
|
||||
+
|
||||
struct GsPolicyFQDN {
|
||||
GsPolicyFQDN():m_value_schema(0), m_value_object(0), is_function(false){}
|
||||
Oid m_value_schema; /* schema */
|
||||
diff --git a/contrib/pagehack/CMakeLists.txt b/contrib/pagehack/CMakeLists.txt
|
||||
index b15bee1..4b4a021 100644
|
||||
--- a/contrib/pagehack/CMakeLists.txt
|
||||
+++ b/contrib/pagehack/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@ if(${ENABLE_DEBUG} STREQUAL "ON")
|
||||
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 -l${SECURE_C_CHECK} -lrt -lz -lminizip -lzstd -lpagecompression -llz4)
|
||||
+set(pagehack_LINK_LIBS -lpgport -lcrypt -ldl -lm -ledit -lssl -lcrypto -lpagecompression -l${SECURE_C_CHECK} -lrt -lz -lminizip -lzstd -llz4)
|
||||
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)
|
||||
target_link_directories(pagehack PUBLIC
|
||||
diff --git a/src/common/backend/utils/adt/CMakeLists.txt b/src/common/backend/utils/adt/CMakeLists.txt
|
||||
index b339090..bc9598e 100755
|
||||
--- a/src/common/backend/utils/adt/CMakeLists.txt
|
||||
+++ b/src/common/backend/utils/adt/CMakeLists.txt
|
||||
@@ -14,6 +14,6 @@ set(TGT_adt_INC
|
||||
)
|
||||
|
||||
set(adt_DEF_OPTIONS ${MACRO_OPTIONS})
|
||||
-set(adt_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
+set(adt_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS} -fpermissive)
|
||||
set(adt_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
add_static_objtarget(common_backend_utils_adt TGT_adt_SRC TGT_adt_INC "${adt_DEF_OPTIONS}" "${adt_COMPILE_OPTIONS}" "${adt_LINK_OPTIONS}")
|
||||
|
||||
diff --git a/src/bin/pg_basebackup/CMakeLists.txt b/src/bin/pg_basebackup/CMakeLists.txt
|
||||
index dc5efefb6..f28af37c7 100755
|
||||
--- a/src/bin/pg_basebackup/CMakeLists.txt
|
||||
+++ b/src/bin/pg_basebackup/CMakeLists.txt
|
||||
@@ -33,7 +33,7 @@ set(TGT_basebackup_INC
|
||||
set(basebackup_DEF_OPTIONS ${MACRO_OPTIONS} -DHAVE_LIBZ -DFRONTEND)
|
||||
set(basebackup_COMPILE_OPTIONS ${OPTIMIZE_OPTIONS} ${OS_OPTIONS} ${PROTECT_OPTIONS} ${WARNING_OPTIONS} ${BIN_SECURE_OPTIONS} ${CHECK_OPTIONS})
|
||||
set(basebackup_LINK_OPTIONS ${BIN_LINK_OPTIONS})
|
||||
-set(basebackup_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -l${SECURE_C_CHECK} -lrt -lz -lminizip -llz4 -lzstd -lpagecompression)
|
||||
+set(basebackup_LINK_LIBS lib_string_obj libelog.a libbuildquery.a libpgcommon.a libhotpatchclient.a libpgport.a -lpq -lcrypt -ldl -lm -lssl -lcrypto -lpagecompression -l${SECURE_C_CHECK} -lrt -lz -lminizip -llz4 -lzstd)
|
||||
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
|
||||
list(APPEND basebackup_LINK_LIBS -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss)
|
||||
endif()
|
||||
|
||||
diff --git a/src/gausskernel/cbb/utils/zfiles/zip_file.cpp b/src/gausskernel/cbb/utils/zfiles/zip_file.cpp
|
||||
index dfe74794..3203c293 100644
|
||||
--- a/src/gausskernel/cbb/utils/zfiles/zip_file.cpp
|
||||
+++ b/src/gausskernel/cbb/utils/zfiles/zip_file.cpp
|
||||
@@ -14,34 +14,6 @@
|
||||
#include "utils/palloc.h"
|
||||
#include "utils/zfiles.h"
|
||||
|
||||
-/* MALLOC api for struct unz_memfunc */
|
||||
-static voidp memcnxt_palloc(size_t s)
|
||||
-{
|
||||
- return palloc(s);
|
||||
-}
|
||||
-
|
||||
-/* FREE api for struct unz_memfunc */
|
||||
-static void memcnxt_pfree(voidp p)
|
||||
-{
|
||||
- pfree(p);
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Postmaster will call this function at startup time
|
||||
- * to set memory API for MINIUNZ lib.
|
||||
- * struct unz_memfunc has two members:
|
||||
- * 1) MALLOC api whose type is: typedef voidp (* malloc_pf) (size_t);
|
||||
- * 2) FREE api whose type is: typedef void (* free_pf) (voidp);
|
||||
- *
|
||||
- * see also:
|
||||
- * 3rd_src/zlib1.2.11/unzip_alloc_hook.patch
|
||||
- * 3rd_src/zlib1.2.11/unzip_alloc_hook.patch2
|
||||
- */
|
||||
-void pm_set_unzip_memfuncs(void)
|
||||
-{
|
||||
- setUnzipMemoryFunc(memcnxt_palloc, memcnxt_pfree);
|
||||
-}
|
||||
-
|
||||
/* open a log file using vfd method */
|
||||
void* vfd_file_open(const char* logfile)
|
||||
{
|
||||
diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp
|
||||
index d1749be8..ccc2e1fd 100644
|
||||
--- a/src/gausskernel/process/postmaster/postmaster.cpp
|
||||
+++ b/src/gausskernel/process/postmaster/postmaster.cpp
|
||||
@@ -1880,9 +1880,6 @@ int PostmasterMain(int argc, char* argv[])
|
||||
S3_init();
|
||||
#endif
|
||||
|
||||
- /* set memory manager for minizip libs */
|
||||
- pm_set_unzip_memfuncs();
|
||||
-
|
||||
/* set memory manager for cJSON */
|
||||
cJSON_Hooks hooks = {cJSON_internal_malloc, cJSON_internal_free};
|
||||
cJSON_InitHooks(&hooks);
|
||||
diff --git a/src/include/utils/zfiles.h b/src/include/utils/zfiles.h
|
||||
index 89b6632c..3b87dfb4 100644
|
||||
--- a/src/include/utils/zfiles.h
|
||||
+++ b/src/include/utils/zfiles.h
|
||||
@@ -48,8 +48,6 @@ typedef struct gz_reader {
|
||||
opaque_vfd* m_vfd;
|
||||
} gz_reader;
|
||||
|
||||
-extern void pm_set_unzip_memfuncs(void);
|
||||
-
|
||||
/* unzip postgresql-2018-03-31_000000.zip log file and read its contents */
|
||||
extern void set_unzip_filefuncs(zlib_filefunc64_def* funcs, voidpf opaque);
|
||||
extern void* unzip_open(const char* zipfile);
|
||||
diff --git a/cmake/src/build_options.cmake b/cmake/src/build_options.cmake
|
||||
index 57fbc28e..a024fa29 100755
|
||||
--- a/cmake/src/build_options.cmake
|
||||
+++ b/cmake/src/build_options.cmake
|
||||
@@ -189,6 +189,7 @@ endif()
|
||||
set(LIB_SECURE_OPTIONS -fPIC -fno-common -fstack-protector-strong)
|
||||
# libraries need link options during linking
|
||||
set(LIB_LINK_OPTIONS -pthread -std=c++14 -Wl,-z,noexecstack -Wl,-z,relro,-z,now)
|
||||
+string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
if(NOT "${ENABLE_UT}" STREQUAL "ON")
|
||||
# binaries need fPIE to satisfy security options during compling
|
||||
set(BIN_SECURE_OPTIONS -fPIE -fno-common -fstack-protector)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4f996532700a0c330b04c371993bf5db8b3a5f0912c991a8447f1dce1f9bd2d7
|
||||
size 114458843
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
export GAUSSHOME=/usr/local/opengauss
|
||||
export GAUSSLOG=/var/lib/opengauss/log
|
||||
export LD_LIBRARY_PATH=${GAUSSHOME}/lib:$LD_LIBRARY_PATH
|
||||
export PATH=${GAUSSHOME}/bin:$PATH
|
||||
export PGDATA=/var/lib/opengauss/data
|
||||
export PGPORT=7654
|
||||
export PGDATABASE=postgres
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# This file contains a list of exceptions for rpmlint checker
|
||||
|
||||
addFilter(r'(non-standard-gid|non-standard-uid) .* opengauss')
|
||||
addFilter(r'(postin-without-ldconfig|postun-without-ldconfig) /var/lib/opengauss/pkg_6.0.0/lib/.*')
|
||||
addFilter(r'shared-lib-calls-exit /var/lib/opengauss/pkg_6.0.0/lib/.*')
|
||||
addFilter(r'binary-or-shlib-calls-gethostbyname')
|
||||
addFilter(r'non-standard-group')
|
||||
|
||||
addFilter(r'devel-file-in-non-devel-package.* /var/lib/opengauss/pkg_6.0.0/lib/.*.so')
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
-------------------------------------------------------------------
|
||||
Sat Sep 20 08:23:53 UTC 2025 - Jale Shaw <enjoy-success@qq.com>
|
||||
|
||||
- Use %cmake %cmake_build and %cmake_install
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 18 2025 jaleshaw <enjoy-success@qq.com>
|
||||
|
||||
- Modified according to the review comments:
|
||||
* Standardized the spec, removed the Group tag, and listed requires in single lines.
|
||||
* Removed uncommon compiler options.
|
||||
* Removed zlib.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 15 2025 jaleshaw <enjoy-success@qq.com>
|
||||
|
||||
- Resolve issues encountered during gaussdb execution on s390x platform
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 10 2025 jaleshaw <enjoy-success@qq.com>
|
||||
|
||||
- Package openGauss 6.0.0 for openSUSE
|
||||
* https://opengauss.org/zh/news/2024-09-30
|
||||
* https://github.com/opengauss-mirror/openGauss-server/tree/6.0.0
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Start openGauss server
|
||||
After=local-fs.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=opengauss
|
||||
WorkingDirectory=/var/lib/opengauss
|
||||
ExecStart=/bin/bash -c 'source ~/.bash_profile; gs_ctl start -D /var/lib/opengauss/data'
|
||||
ExecStop=/bin/bash -c 'source ~/.bash_profile; gs_ctl stop -D /var/lib/opengauss/data'
|
||||
ExecReload=/bin/bash -c 'source ~/.bash_profile; gs_ctl reload -D /var/lib/opengauss/data'
|
||||
Delegate=yes
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -0,0 +1,530 @@
|
|||
#
|
||||
# spec file for package openGauss-server
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
%define krb5_name krb5
|
||||
%define krb5_version 1.18.3-final
|
||||
%define xgboost_name xgboost
|
||||
%define xgboost_version 1.4.1
|
||||
%define dmlc_name dmlc-core
|
||||
%define dmlc_version 0.5
|
||||
%define securec_name Huawei_Secure_C
|
||||
%define securec_version V100R001C01SPC010B002
|
||||
%define dcf_name DCF
|
||||
%define dcf_version v6.0.0
|
||||
%define awssdk_name aws-sdk-cpp
|
||||
%define awssdk_version 1.11.327
|
||||
%define port 7654
|
||||
%define datapath /var/lib/opengauss
|
||||
%define apppath %{_prefix}/local/opengauss
|
||||
%define tmppath /var/lib/opengauss/pkg_6.0.0
|
||||
|
||||
Name: opengauss
|
||||
Version: 6.0.0
|
||||
Release: 0
|
||||
Summary: An open source relational database management system
|
||||
License: MulanPSL-2.0 and MIT and TCL and Apache-2.0 and BSL-1.0
|
||||
URL: https://gitcode.com/opengauss/openGauss-server
|
||||
Source0: openGauss-server-%{version}.tar.gz
|
||||
Source1: %{krb5_name}-%{krb5_version}.tar.gz
|
||||
Source2: %{dmlc_name}-v%{dmlc_version}.tar.gz
|
||||
Source3: %{xgboost_name}-v%{xgboost_version}.tar.gz
|
||||
Source4: %{securec_name}_%{securec_version}.zip
|
||||
Source5: %{dcf_name}-%{dcf_version}.tar.gz
|
||||
# Source6 is generated through following steps:
|
||||
# $ git clone https://github.com/aws/aws-sdk-cpp -b %%{version} --recurse-submodules --depth=1
|
||||
# $ pushd aws-sdk-cpp && git-archive-all.sh --format tar --prefix aws-sdk-cpp-%%{version}/ aws-sdk-cpp-%%{version}.tar && xz aws-sdk-cpp-%%{version}.tar && popd
|
||||
# where git-archive-all.sh comes from https://github.com/fabacab/git-archive-all.sh
|
||||
Source6: %{awssdk_name}-%{awssdk_version}.tar.xz
|
||||
|
||||
|
||||
Source10: opengauss-bashprofile
|
||||
Source11: opengauss.service
|
||||
Source12: autostart.sh
|
||||
Source13: version.cfg
|
||||
Source14: upgrade.sh
|
||||
Source20: krb-configure
|
||||
Source30: Huawei_Secure_C_Makefile
|
||||
Source40: opengauss-rpmlintrc
|
||||
|
||||
Patch0: og-cmake.patch
|
||||
Patch1: og-delete-obs.patch
|
||||
Patch2: og-openssl3-adptor.patch
|
||||
Patch3: og-susebuild.patch
|
||||
Patch4: og-dolphin.patch
|
||||
Patch5: og-more-arch-support.patch
|
||||
Patch11: krb5-backport-Add-a-simple-DER-support-header.patch
|
||||
Patch12: krb5-backport-CVE-2024-37370-CVE-2024-37371-Fix-vulnerabilities-in-GSS-message-token-handling.patch
|
||||
Patch13: krb5-cve-2022-42898.patch
|
||||
Patch14: krb5-CVE-2023-36054.patch
|
||||
Patch15: krb5.patch
|
||||
Patch16: xgboost-cmake-3.13.patch
|
||||
Patch17: dmlc-core-port-to-newer-cmake.patch
|
||||
Patch18: DCF_susebuild.patch
|
||||
Patch19: DCF-6.0.0-add-more-arch-support.patch
|
||||
|
||||
BuildRequires: libopenssl-3-devel >= 3.1.4-150600.5
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: python3
|
||||
BuildRequires: tar
|
||||
BuildRequires: unzip
|
||||
BuildRequires: lsb-release
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: cJSON-devel
|
||||
BuildRequires: bison
|
||||
BuildRequires: flex
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: java-1_8_0-openjdk-devel
|
||||
BuildRequires: unixODBC-devel
|
||||
BuildRequires: jemalloc-devel
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: minizip-devel
|
||||
BuildRequires: libedit-devel
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: libxerces-c-devel
|
||||
BuildRequires: libcgroup-devel
|
||||
BuildRequires: libcurl-devel
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: liblz4-devel
|
||||
BuildRequires: libzstd-devel
|
||||
BuildRequires: libboost_headers-devel
|
||||
BuildRequires: libboost_thread-devel
|
||||
BuildRequires: libboost_atomic-devel
|
||||
BuildRequires: libboost_system-devel
|
||||
BuildRequires: libboost_chrono-devel
|
||||
%ifarch aarch64
|
||||
BuildRequires: libnuma-devel
|
||||
%endif
|
||||
|
||||
%global __provides_exclude lib.*[.]so.*
|
||||
%global __requires_exclude lib(com_err|gss|ecpg|pg|pq|aws-cpp|dcf|kadm5|kdb5|k5crypto|krad|krb5|page|verto).*[.]so.*
|
||||
Requires: openssl-3 >= 3.1.4-150600.5
|
||||
Requires(pre): lsof
|
||||
Requires(pre): shadow
|
||||
Requires(post): systemd
|
||||
Requires(post): procps
|
||||
Requires(post): sed
|
||||
Requires(post): gawk
|
||||
Requires(post): tar
|
||||
|
||||
%description
|
||||
openGauss is a user-friendly, enterprise-level, and open-source relational
|
||||
database jointly built with partners. openGauss provides multi-core
|
||||
architecture-oriented ultimate performance, full-link service, data security,
|
||||
AI-based optimization, and efficient O&M capabilities.
|
||||
|
||||
%prep
|
||||
%setup -q -c -n %{name}-%{version}
|
||||
%setup -q -D -T -a 1
|
||||
%setup -q -D -T -a 2
|
||||
%setup -q -D -T -a 3
|
||||
%setup -q -D -T -a 4
|
||||
%setup -q -D -T -a 5
|
||||
%setup -q -D -T -a 6
|
||||
|
||||
pushd openGauss-server-%{version}
|
||||
%patch -P 0 -p1
|
||||
%patch -P 1 -p1
|
||||
%patch -P 2 -p1
|
||||
%patch -P 3 -p1
|
||||
%patch -P 4 -p1
|
||||
%patch -P 5 -p1
|
||||
popd
|
||||
|
||||
pushd %{krb5_name}-%{krb5_name}-%{krb5_version}
|
||||
%patch -P 11 -p1
|
||||
%patch -P 12 -p1
|
||||
%patch -P 13 -p1
|
||||
%patch -P 14 -p1
|
||||
%patch -P 15 -p1
|
||||
popd
|
||||
|
||||
pushd %{xgboost_name}-%{xgboost_version}
|
||||
%patch -P 16 -p1
|
||||
popd
|
||||
|
||||
pushd %{dmlc_name}-%{dmlc_version}
|
||||
%patch -P 17 -p1
|
||||
popd
|
||||
|
||||
pushd %{dcf_name}-%{dcf_version}
|
||||
%patch -P 18 -p1
|
||||
%patch -P 19 -p1
|
||||
popd
|
||||
|
||||
%build
|
||||
dependency_loc=$(pwd)/binarylibs/kernel/dependency
|
||||
|
||||
|
||||
########### build krb5 ###########
|
||||
pushd %{krb5_name}-%{krb5_name}-%{krb5_version}
|
||||
krb5_dir=${dependency_loc}/kerberos/comm
|
||||
|
||||
cd src
|
||||
rm -rf configure; cp %{SOURCE20} ./configure
|
||||
autoheader; chmod +x configure
|
||||
./configure CFLAGS='-std=gnu11' --prefix=${krb5_dir} --disable-rpath --disable-pkinit --with-system-verto=no
|
||||
|
||||
make %{?_smp_mflags}
|
||||
make install %{?_smp_mflags}
|
||||
|
||||
cd ${krb5_dir}
|
||||
rm -rf lib/pkgconfig share var
|
||||
popd
|
||||
|
||||
########### build xgboost ###########
|
||||
pushd %{xgboost_name}-%{xgboost_version}
|
||||
xgboost_dir=${dependency_loc}/xgboost/comm
|
||||
|
||||
rm -rf dmlc-core
|
||||
cp -r ../dmlc-core-%{dmlc_version}/ ./dmlc-core
|
||||
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=${xgboost_dir}
|
||||
make %{?_smp_mflags}
|
||||
make install
|
||||
cp -r ${xgboost_dir} ${dependency_loc}/xgboost/llt
|
||||
popd
|
||||
|
||||
########### build securec ###########
|
||||
pushd %{securec_name}_%{securec_version}
|
||||
securec_dir=${dependency_loc}/../platform/Huawei_Secure_C/comm
|
||||
cp %{SOURCE30} ./src/Makefile
|
||||
|
||||
make -C src securecstatic securecshare %{?_smp_mflags}
|
||||
|
||||
mkdir -p ${securec_dir}
|
||||
cp -arf include ${securec_dir}
|
||||
mkdir ${securec_dir}/lib
|
||||
cp src/libsecurec.a ${securec_dir}/lib/
|
||||
cp src/libsecurec.a ${securec_dir}/lib/libboundscheck.a
|
||||
mkdir ${securec_dir}/../Dynamic_Lib
|
||||
cp src/libsecurec.so ${securec_dir}/../Dynamic_Lib
|
||||
popd
|
||||
|
||||
########### build DCF ###########
|
||||
pushd %{dcf_name}-%{dcf_version}
|
||||
dcf_dir=${dependency_loc}/../component/dcf
|
||||
mkdir library
|
||||
cp -r ${securec_dir} ./library/huawei_security
|
||||
mkdir -p library/cJSON/include
|
||||
cp /usr/include/cjson/cJSON.h library/cJSON/include
|
||||
|
||||
cmake -S . -B tmp_build -DCMAKE_INSTALL_PREFIX=${dcf_dir} -DCMAKE_BUILD_TYPE=Release -DENABLE_EXPORT_API=OFF -DTEST=OFF
|
||||
make -C tmp_build %{?_smp_mflags}
|
||||
|
||||
mkdir -p ${dcf_dir}
|
||||
cp -arf ./output/lib ${dcf_dir}/
|
||||
cp -arf ./src/interface ${dcf_dir}/include
|
||||
popd
|
||||
|
||||
########### build aws-sdk-cpp ###########
|
||||
pushd %{awssdk_name}-%{awssdk_version}
|
||||
awssdk_dir=${dependency_loc}/aws-sdk-cpp/comm
|
||||
mkdir tmp_build && cd tmp_build
|
||||
|
||||
cmake .. -DBUILD_ONLY="s3" \
|
||||
-DCMAKE_SKIP_RPATH=TRUE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_INSTALL_PREFIX=${awssdk_dir} \
|
||||
-DENABLE_TESTING=OFF
|
||||
make %{?_smp_mflags}
|
||||
make install
|
||||
mv ${awssdk_dir}/lib64 ${awssdk_dir}/lib || true
|
||||
popd
|
||||
|
||||
########### build opengauss ###########
|
||||
%ifarch riscv64 ppc64le s390x
|
||||
rm -rf openGauss-server-%{version}/contrib/dolphin
|
||||
%endif
|
||||
cd openGauss-server-%{version}
|
||||
|
||||
export BUILD_TUPLE=%{_arch}
|
||||
export DEBUG_TYPE=release
|
||||
export THIRD_BIN_PATH=${dependency_loc}/../../../binarylibs
|
||||
|
||||
%cmake -DENABLE_MULTIPLE_NODES=OFF \
|
||||
-DENABLE_THREAD_SAFETY=ON \
|
||||
-DENABLE_LLVM_COMPILE=OFF \
|
||||
-DENABLE_OBS=OFF \
|
||||
-DENABLE_OPENSSL3=ON \
|
||||
%ifarch riscv64 ppc64le s390x
|
||||
-DENABLE_BBOX=OFF \
|
||||
%endif
|
||||
%ifarch s390x
|
||||
-DWORDS_BIGENDIAN=ON \
|
||||
%endif
|
||||
-DWITH_OPENEULER_OS=ON
|
||||
|
||||
%cmake_build
|
||||
|
||||
%install
|
||||
|
||||
cd openGauss-server-%{version}
|
||||
opengauss_source_dir=$(pwd)
|
||||
|
||||
%cmake_install
|
||||
|
||||
# Clean devel files
|
||||
rm -r %{buildroot}%{_prefix}/include
|
||||
rm -r %{buildroot}%{_prefix}/lib/pkgconfig
|
||||
rm -r %{buildroot}%{_prefix}/lib/cmake
|
||||
rm -r %{buildroot}%{_prefix}/lib/aws*
|
||||
rm -r %{buildroot}%{_prefix}/lib/s2n
|
||||
rm -r %{buildroot}%{_prefix}/lib/libsimsearch
|
||||
rm %{buildroot}%{_prefix}/lib/*.a
|
||||
|
||||
mkdir -p %{buildroot}/var/lib/opengauss/data
|
||||
mkdir -p %{buildroot}%{tmppath}/script
|
||||
|
||||
# move to {tmppath}
|
||||
mv %{buildroot}%{_prefix}/* %{buildroot}%{tmppath}
|
||||
mkdir -p %{buildroot}%{apppath}
|
||||
|
||||
# make package upgrade sql
|
||||
tar -C ${opengauss_source_dir}/src/include/catalog -zcf upgrade_sql.tar.gz upgrade_sql
|
||||
sha256sum upgrade_sql.tar.gz | awk '{print $1}' > upgrade_sql.sha256
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Generate upgrade_sql.sha256 failed."
|
||||
exit 1
|
||||
fi
|
||||
cp -r upgrade_sql.tar.gz %{buildroot}%{tmppath}
|
||||
cp -r upgrade_sql.sha256 %{buildroot}%{tmppath}
|
||||
|
||||
# opengauss datanode dir.
|
||||
install -d -m 700 $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/data
|
||||
|
||||
# opengauss .bash_profile
|
||||
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{?_localstatedir}/lib/opengauss/.bash_profile
|
||||
# auto start files
|
||||
install -m 644 %{SOURCE11} %{buildroot}%{tmppath}/script/opengauss.service
|
||||
install -m 755 %{SOURCE12} %{buildroot}%{tmppath}/script/autostart.sh
|
||||
|
||||
# upgrade script
|
||||
install -m 644 %{SOURCE13} %{buildroot}%{tmppath}/version.cfg
|
||||
install -m 755 %{SOURCE14} %{buildroot}%{tmppath}/script/upgrade.sh
|
||||
|
||||
# process shell scripts
|
||||
sed -i '1c #!/bin/bash' %{buildroot}%{tmppath}/bin/gs_dbmind
|
||||
sed -i '1c #!/bin/bash' %{buildroot}%{tmppath}/bin/gs_loader.sh
|
||||
|
||||
# permission
|
||||
chmod -R 755 %{buildroot}%{tmppath}/bin/*
|
||||
chmod -R 755 %{buildroot}%{tmppath}/lib/*
|
||||
chmod -R 644 %{buildroot}%{tmppath}/bin/*.conf
|
||||
|
||||
%fdupes %{buildroot}%{tmppath}
|
||||
|
||||
%pre
|
||||
# add opengauss user
|
||||
/usr/sbin/groupadd -r opengauss || :
|
||||
/usr/sbin/useradd -M -N -g opengauss -r -d %{datapath} -s /bin/bash -c "openGauss Server" opengauss || :
|
||||
|
||||
# for install step
|
||||
# 1:install 2:upgrade
|
||||
if [ $1 -eq 1 ]; then
|
||||
echo "Preparing for install"
|
||||
portinfo=$(lsof -i:%{port})
|
||||
if [ "${portinfo}" != "" ]; then
|
||||
echo "Error: The port[%{port}] is occupied. Please use command 'lsof -i:%{port} to check it.'"
|
||||
fi
|
||||
|
||||
if [ -d /var/lib/opengauss/data ]; then
|
||||
if [ "`ls -A /var/lib/opengauss/data`" != "" ]; then
|
||||
echo "Datanode dir(/var/lib/opengauss/data) is not empty."
|
||||
echo "Please delete dir and reinstall opengauss."
|
||||
exit 1
|
||||
fi
|
||||
process_id=$(ps -ef | grep /var/lib/opengauss/data | grep -v grep | awk '{print $2}')
|
||||
if [ "$process_id" != "" ]; then
|
||||
echo "A process of opengauss already exists. Use command (ps -ef | grep /var/lib/opengauss/data) to confirm."
|
||||
echo "Please kill the process and reinstall opengauss."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
elif [ $1 -eq 2 ]; then
|
||||
echo "Preparing for upgrade"
|
||||
old_version=$(rpm -qi opengauss | grep -i version | awk -F':' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//')
|
||||
if [ "$(printf '%s\n' "%{version}" "$old_version" | sort -V | head -n1)" == "%{version}" ]; then
|
||||
echo "Warning: New version (%{version}) must be greater than the old version ($old_version)."
|
||||
exit 0
|
||||
fi
|
||||
if [[ "${old_version}" == "2.1.0" && %{version} == "6.0.0" ]]; then
|
||||
echo "The opengauss do not support upgrade from 2.1.0 to 6.0.0."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
%post
|
||||
start_opengauss(){
|
||||
result=$(su - opengauss -c "source ~/.bash_profile; gs_initdb -D /var/lib/opengauss/data -U opengauss --nodename=single_node")
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Init openGauss database failed."
|
||||
echo "$result"
|
||||
exit 1
|
||||
else
|
||||
echo "Init openGauss database success."
|
||||
fi
|
||||
}
|
||||
|
||||
add_service(){
|
||||
cp %{apppath}/script/opengauss.service /usr/lib/systemd/system/
|
||||
systemctl daemon-reload
|
||||
}
|
||||
|
||||
remove_service(){
|
||||
service_name=/usr/lib/systemd/system/opengauss.service
|
||||
if [ -f $service_name ]; then
|
||||
systemctl disable opengauss.service
|
||||
rm $service_name
|
||||
fi
|
||||
}
|
||||
|
||||
create_dir() {
|
||||
if [ -d /usr/local/opengauss ]; then
|
||||
rm -rf /usr/local/opengauss
|
||||
fi
|
||||
mkdir -p /usr/local/opengauss
|
||||
cp -r /var/lib/opengauss/pkg_%{version}/* /usr/local/opengauss
|
||||
chmod -R 755 /usr/local/opengauss/script/*.sh
|
||||
chown -R opengauss:opengauss /usr/local/opengauss
|
||||
}
|
||||
|
||||
upgrade_create_dir() {
|
||||
rm -rf /var/lib/opengauss/opengauss_upgrade/pkg_%{version}
|
||||
rm -rf /var/lib/opengauss/opengauss_upgrade/bak
|
||||
rm -rf /var/lib/opengauss/opengauss_upgrade/tmp
|
||||
mkdir -p /var/lib/opengauss/opengauss_upgrade/pkg_%{version}
|
||||
mkdir -p /var/lib/opengauss/opengauss_upgrade/bak
|
||||
mkdir -p /var/lib/opengauss/opengauss_upgrade/tmp
|
||||
chown -R opengauss:opengauss /var/lib/opengauss
|
||||
}
|
||||
|
||||
# for install step
|
||||
# 1:install 2:upgrade
|
||||
if [ $1 -eq 1 ]; then
|
||||
echo "install" > /var/lib/opengauss/recode_install_flag
|
||||
create_dir
|
||||
start_opengauss
|
||||
add_service
|
||||
elif [ $1 -eq 2 ]; then
|
||||
echo "upgrade" > /var/lib/opengauss/recode_install_flag
|
||||
echo "start upgrade..."
|
||||
upgrade_create_dir
|
||||
cmd="source ~/.bash_profile; cd /var/lib/opengauss/pkg_%{version}; sh script/upgrade.sh"
|
||||
su - opengauss -c "$cmd"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Upgrade failed."
|
||||
echo "Please cat the log information: cat /var/lib/opengauss/opengauss_upgrade/opengauss_upgrade.log"
|
||||
echo "failed" > /var/lib/opengauss/upgrade_result
|
||||
exit 1
|
||||
else
|
||||
echo "Upgrade success."
|
||||
echo "success" > /var/lib/opengauss/upgrade_result
|
||||
fi
|
||||
remove_service
|
||||
add_service
|
||||
fi
|
||||
|
||||
%preun
|
||||
remove_service(){
|
||||
service_name=/usr/lib/systemd/system/opengauss.service
|
||||
if [ -f $service_name ]; then
|
||||
systemctl disable opengauss.service
|
||||
rm $service_name
|
||||
fi
|
||||
}
|
||||
|
||||
# 0: uninstall 1:upgrade
|
||||
if [ $1 -eq 0 ]; then
|
||||
echo "remove opengauss service"
|
||||
remove_service
|
||||
fi
|
||||
|
||||
%postun
|
||||
clear_database(){
|
||||
pid=$(ps -ef | grep /var/lib/opengauss/data | grep -v grep | awk '{print $2}')
|
||||
if [ "$pid" != "" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
if [ -d /usr/local/opengauss ]; then
|
||||
rm -rf /usr/local/opengauss
|
||||
fi
|
||||
if [ -d /usr/local/opengauss_%{version} ]; then
|
||||
rm -rf /usr/local/opengauss_%{version}
|
||||
fi
|
||||
if [ -f /var/lib/opengauss/recode_install_flag ]; then
|
||||
rm -rf /var/lib/opengauss/recode_install_flag
|
||||
fi
|
||||
if [ -f /var/lib/opengauss/upgrade_result ]; then
|
||||
rm -rf /var/lib/opengauss/upgrade_result
|
||||
fi
|
||||
if [ -d /var/lib/opengauss/pkg_%{version} ]; then
|
||||
rm -rf /var/lib/opengauss/pkg_%{version}
|
||||
fi
|
||||
if [ -d /var/lib/opengauss/opengauss_upgrade ]; then
|
||||
rm -rf /var/lib/opengauss/opengauss_upgrade
|
||||
fi
|
||||
if [ -d /var/lib/opengauss/log ]; then
|
||||
rm -rf /var/lib/opengauss/log
|
||||
fi
|
||||
}
|
||||
|
||||
# 0: uninstall
|
||||
if [ $1 -eq 0 ]; then
|
||||
echo "clean database"
|
||||
clear_database
|
||||
fi
|
||||
|
||||
%posttrans
|
||||
flag=$(cat /var/lib/opengauss/recode_install_flag)
|
||||
if [ $flag = "install" ]; then
|
||||
echo "opengauss install successfully!"
|
||||
echo "Please run: systemctl start opengauss.service"
|
||||
else
|
||||
echo "upgrade posttrans"
|
||||
if [ -d "/usr/local/opengauss" ] && [ "$(ls -A /usr/local/opengauss)" ]; then
|
||||
rm -rf /usr/local/opengauss
|
||||
fi
|
||||
mkdir -p /usr/local/opengauss
|
||||
upgrade_file=/var/lib/opengauss/upgrade_result
|
||||
if [[ -f ${upgrade_file} && $(cat $upgrade_file) = "success" ]]; then
|
||||
echo "opengauss upgrade successfully"
|
||||
cp -rf /var/lib/opengauss/opengauss_upgrade/pkg_%{version}/* /usr/local/opengauss
|
||||
else
|
||||
echo "opengauss upgrade failed, rollback in progress"
|
||||
cp -rf /var/lib/opengauss/opengauss_upgrade/bak/* /usr/local/opengauss
|
||||
fi
|
||||
chown -R opengauss:opengauss /usr/local/opengauss
|
||||
chmod -R 700 /var/lib/opengauss/data
|
||||
systemctl restart opengauss.service
|
||||
fi
|
||||
|
||||
|
||||
%files
|
||||
%doc
|
||||
%defattr (-,opengauss,opengauss)
|
||||
%{apppath}
|
||||
|
||||
%defattr (-,opengauss,opengauss)
|
||||
%{?_localstatedir}/lib/opengauss
|
||||
|
||||
|
||||
%changelog
|
||||
|
|
@ -0,0 +1,653 @@
|
|||
#!/bin/bash
|
||||
err_upgrade_pre=201
|
||||
err_upgrade_bin=202
|
||||
err_upgrade_post=203
|
||||
err_rollback_pre=204
|
||||
err_rollback_bin=205
|
||||
err_rollback_post=206
|
||||
err_check_init=207
|
||||
err_parameter=208
|
||||
err_upgrade_commit=209
|
||||
err_version_same=210
|
||||
err_no_need_commit=211
|
||||
err_inner_sys=212
|
||||
err_dn_role_null=213
|
||||
|
||||
version=6.0.0
|
||||
GAUSS_BASE_PATH="/usr/local/opengauss"
|
||||
GAUSS_UPGRADE_BASE_PATH="/var/lib/opengauss/opengauss_upgrade/pkg_${version}"
|
||||
GAUSS_BACKUP_BASE_PATH="/var/lib/opengauss/opengauss_upgrade/bak"
|
||||
GAUSS_TMP_PATH="/var/lib/opengauss/opengauss_upgrade/tmp"
|
||||
GAUSS_LOG_FILE="/var/lib/opengauss/opengauss_upgrade/opengauss_upgrade.log"
|
||||
new_opengauss_dir=/var/lib/opengauss/pkg_${version}
|
||||
GAUSS_LISTEN_PORT=7654
|
||||
|
||||
function create_dir() {
|
||||
rm -rf ${GAUSS_BACKUP_BASE_PATH}
|
||||
rm -rf ${GAUSS_TMP_PATH}
|
||||
rm -rf ${GAUSS_UPGRADE_BASE_PATH}
|
||||
mkdir -p ${GAUSS_UPGRADE_BASE_PATH}
|
||||
mkdir -p ${GAUSS_BACKUP_BASE_PATH}
|
||||
mkdir -p ${GAUSS_TMP_PATH}
|
||||
# touch ${GAUSS_LOG_FILE}
|
||||
}
|
||||
|
||||
# create_dir
|
||||
|
||||
function cp_new_all_pkg_to_tmp_dir() {
|
||||
cp -rf ${new_opengauss_dir}/* ${GAUSS_UPGRADE_BASE_PATH}
|
||||
}
|
||||
|
||||
function debug() {
|
||||
local current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
echo "[$current_time]" "$1" >>"${GAUSS_LOG_FILE}"
|
||||
}
|
||||
|
||||
function log() {
|
||||
local current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
echo "[$current_time]" "$1" >>"${GAUSS_LOG_FILE}"
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
function die() {
|
||||
local current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
if [[ -f "${GAUSS_LOG_FILE}" ]]; then
|
||||
echo "[$current_time]" "$1" >>"${GAUSS_LOG_FILE}"
|
||||
fi
|
||||
echo -e "\033[31mError: $1\033[0m"
|
||||
exit $2
|
||||
}
|
||||
|
||||
function check_config_path() {
|
||||
local temp_value="$1"
|
||||
if [[ "$temp_value" == *[\(\)\{\}\[\]\<\>\"\'\`\\\ \*\!\|\;\&\$\~\?]* ]]; then
|
||||
die "$temp_value may contain illegal characters" ${err_check_init}
|
||||
fi
|
||||
if echo "$temp_value" | grep -Eq "^/{1,}$"; then
|
||||
die "path cannot be / " ${err_check_init}
|
||||
fi
|
||||
}
|
||||
|
||||
function check_env() {
|
||||
if [[ "$GAUSSHOME" == "" ]]; then
|
||||
die "GAUSSHOME cannot be null!" ${err_check_init}
|
||||
fi
|
||||
if [[ "$GAUSSDATA" == "" ]] && [[ "$PGDATA" == "" ]]; then
|
||||
die "GAUSSDATA or PGDATA cannot be all null!" ${err_check_init}
|
||||
fi
|
||||
if [[ "$PGDATA" == "" ]]; then
|
||||
PGDATA=${GAUSSDATA}
|
||||
fi
|
||||
if [[ "$GAUSSDATA" == "" ]]; then
|
||||
GAUSSDATA=${PGDATA}
|
||||
fi
|
||||
check_config_path "$GAUSSHOME"
|
||||
check_config_path "$GAUSSDATA"
|
||||
check_config_path "$PGDATA"
|
||||
# ensure GAUSSDATA not contain GAUSSHOME
|
||||
if echo "$GAUSSDATA" | grep -wq "^$GAUSSHOME"; then
|
||||
die "GAUSSDATA cannot be in GAUSSHOME!" ${err_check_init}
|
||||
fi
|
||||
log "Current env value: GAUSSHOME is $GAUSSHOME, PGDATA is $PGDATA."
|
||||
}
|
||||
|
||||
function check_upgrade_config() {
|
||||
local tempfile="$GAUSS_TMP_PATH"/".temp_check_guc_value"
|
||||
# guc output from opengauss or gauss is diff
|
||||
if gs_guc check -D ${PGDATA} -c "$1" >"$tempfile" 2>&1; then
|
||||
tempvalue=$(cat "$tempfile" | tail -2 | head -1 | sed 's/\[[^][]*\]//g' | sed 's/[[:space:]]//g' | awk -F= '{print $2}')
|
||||
if ! rm -f ${tempfile}; then
|
||||
log "rm -f $tempfile failed"
|
||||
return 1
|
||||
fi
|
||||
if [[ "$tempvalue" == "$2" ]]; then
|
||||
debug "guc check $1=$2 successfully"
|
||||
return 0
|
||||
elif [[ "$1" == "sync_config_strategy" && "$tempvalue" == "NULL" ]]; then
|
||||
debug "guc check $1=$2 successfully"
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
if ! rm -f ${tempfile}; then
|
||||
log "rm -f $tempfile failed"
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function reload_upgrade_config() {
|
||||
if check_upgrade_config "$1" "$2"; then
|
||||
return 0
|
||||
fi
|
||||
# only primary need to reload upgrade_mode, standby wait sync from primary
|
||||
query_dn_role
|
||||
if [[ X"$dn_role" == X"standby" || X"$dn_role" == X"cascade_standby" ]]; then
|
||||
return 0
|
||||
fi
|
||||
# ensure value of sync_config_strategy is all_node or default
|
||||
if ! check_upgrade_config "sync_config_strategy" "all_node"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
echo -n \[${current_time}\] " " >>"${GAUSS_LOG_FILE}"
|
||||
if [[ -f ${PGDATA}/postmaster.pid ]]; then
|
||||
gs_guc_action="reload"
|
||||
else
|
||||
gs_guc_action="set"
|
||||
fi
|
||||
for i in $(seq 1 3); do
|
||||
if gs_guc $gs_guc_action -D ${PGDATA} -c "$1=$2" >>"${GAUSS_LOG_FILE}" 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function check_version() {
|
||||
version=$(gaussdb -V)
|
||||
if [[ $version =~ "V500R002C00" || $version =~ "2.1.0" ]]; then
|
||||
echo "2.1.0" >${GAUSSHOME}/version.cfg
|
||||
echo "92.421" >>${GAUSSHOME}/version.cfg
|
||||
echo "1f6832d" >>${GAUSSHOME}/version.cfg
|
||||
old_version=1f6832d
|
||||
old_cfg=$(sed -n 2p "$GAUSSHOME/version.cfg" | sed 's/\.//g')
|
||||
else
|
||||
if [[ ! -f "${GAUSSHOME}/version.cfg" ]]; then
|
||||
die "Cannot find current version.cfg!" ${err_upgrade_pre}
|
||||
else
|
||||
old_version=$(sed -n 3p "$GAUSSHOME"/version.cfg)
|
||||
old_cfg=$(sed -n 2p "$GAUSSHOME/version.cfg" | sed 's/\.//g')
|
||||
fi
|
||||
fi
|
||||
if [[ -f "$GAUSS_UPGRADE_BASE_PATH"/version.cfg ]]; then
|
||||
new_version_cfg_path="${GAUSS_UPGRADE_BASE_PATH}/version.cfg"
|
||||
else
|
||||
die "Cannot find new version.cfg!" ${err_upgrade_pre}
|
||||
fi
|
||||
|
||||
new_version=$(sed -n 3p "$new_version_cfg_path")
|
||||
new_cfg=$(sed -n 2p "$new_version_cfg_path" | sed 's/\.//g')
|
||||
|
||||
if [[ X"$old_version" == X || X"$old_cfg" == X || X"$new_version" == X || X"$new_cfg" == X ]]; then
|
||||
die "Maybe version.cfg is not normal" ${err_upgrade_pre}
|
||||
fi
|
||||
if ! echo "$old_cfg" | grep -Ewq "[0-9]{3,6}"; then
|
||||
die "Maybe version.cfg is not normal" ${err_upgrade_pre}
|
||||
fi
|
||||
if ! echo "$new_cfg" | grep -Ewq "[0-9]{3,6}"; then
|
||||
die "Maybe version.cfg is not normal" ${err_upgrade_pre}
|
||||
fi
|
||||
|
||||
if [[ ${new_cfg} -lt ${old_cfg} ]]; then
|
||||
die "Current version is newer!" ${err_upgrade_pre}
|
||||
fi
|
||||
|
||||
log "Old version commitId is $old_version, version info is $old_cfg"
|
||||
log "New version commitId is $new_version, version info is $new_cfg"
|
||||
}
|
||||
|
||||
function check_disk() {
|
||||
avail_disk=$(df -BM "$GAUSS_UPGRADE_BASE_PATH" | tail -n 1 | awk '{print $4}')
|
||||
avail_disk=${avail_disk:0:-1}
|
||||
if [[ X"$min_disk" == "X" ]]; then
|
||||
min_disk=2048
|
||||
fi
|
||||
if [[ ${avail_disk} -lt ${min_disk} ]]; then
|
||||
die "avail disk must be >= ${min_disk}MB, check with cmd: df -BM $GAUSS_UPGRADE_BASE_PATH!" ${err_check_init}
|
||||
fi
|
||||
log "Check available disk space successfully."
|
||||
}
|
||||
|
||||
function start_dbnode() {
|
||||
start_cmd="gs_ctl start -D ${PGDATA} "
|
||||
log "start gaussdb by cmd: $start_cmd"
|
||||
${start_cmd} >>"${GAUSS_LOG_FILE}" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
die "failed to $start_cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
function rollback_post() {
|
||||
if ! check_db_process; then
|
||||
die "Gaussdb is not running" ${err_rollback_post}
|
||||
fi
|
||||
if ! reload_upgrade_config upgrade_mode 2; then
|
||||
die "set upgrade_mode to 2 failed" ${err_upgrade_post}
|
||||
fi
|
||||
if exec_sql "$GAUSS_UPGRADE_BASE_PATH"/temp_sql/temp_rollback-post_maindb.sql maindb && exec_sql "$GAUSS_UPGRADE_BASE_PATH"/temp_sql/temp_rollback-post_otherdb.sql otherdb; then
|
||||
debug "rollback post sql successfully"
|
||||
else
|
||||
die "rollback post sql failed" ${err_rollback_post}
|
||||
fi
|
||||
}
|
||||
|
||||
function prepare_sql() {
|
||||
#$1: upgrade,upgrade-post,rollback,rollback-post
|
||||
#$2: maindb,otherdb
|
||||
temp_old=${old_cfg}
|
||||
temp_new=${new_cfg}
|
||||
local action="$1"
|
||||
local dbname="$2"
|
||||
local tempfile="$GAUSS_TMP_PATH"/temp_sql/"temp_"${action}_${dbname}.sql
|
||||
temp_file_num=0
|
||||
if echo "START TRANSACTION;set IsInplaceUpgrade = on;" >"$tempfile" && chmod 600 "$tempfile"; then
|
||||
debug "Begin to generate $tempfile"
|
||||
else
|
||||
die "Write $tempfile failed" ${err_upgrade_pre}
|
||||
fi
|
||||
if ! echo "SET search_path = 'pg_catalog';SET local client_min_messages = NOTICE;SET local log_min_messages = NOTICE;" >>"$tempfile"; then
|
||||
die "Write $tempfile failed" ${err_upgrade_pre}
|
||||
fi
|
||||
if ! echo "SET statement_timeout = 3600000;" >>"$tempfile"; then
|
||||
die "Write $tempfile failed" ${err_upgrade_pre}
|
||||
fi
|
||||
if [[ "$action" == "upgrade" || "$action" == "upgrade-post" ]]; then
|
||||
while [[ ${temp_old} -lt ${temp_new} ]]; do
|
||||
((temp_old = $temp_old + 1))
|
||||
local upgrade_sql_file="upgrade_sql/upgrade_catalog_${dbname}/${action}_catalog_${dbname}_${temp_old:0:2}_${temp_old:2}.sql"
|
||||
if [[ -f "$upgrade_sql_file" ]]; then
|
||||
if ! cat "$upgrade_sql_file" >>"$tempfile"; then
|
||||
die "Write $tempfile failed" ${err_upgrade_pre}
|
||||
fi
|
||||
debug "$upgrade_sql_file >> $tempfile"
|
||||
((temp_file_num = temp_file_num + 1))
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ "$1" == "rollback" || "$1" == "rollback-post" ]]; then
|
||||
while [[ ${temp_new} -gt ${temp_old} ]]; do
|
||||
local upgrade_sql_file="upgrade_sql/rollback_catalog_${dbname}/${action}_catalog_${dbname}_${temp_new:0:2}_${temp_new:2}.sql"
|
||||
if [[ -f "$upgrade_sql_file" ]]; then
|
||||
if ! cat "$upgrade_sql_file" >>"$tempfile"; then
|
||||
die "Write $tempfile failed" ${err_upgrade_pre}
|
||||
fi
|
||||
debug "$upgrade_sql_file >>$tempfile"
|
||||
((temp_file_num = temp_file_num + 1))
|
||||
fi
|
||||
((temp_new = $temp_new - 1))
|
||||
done
|
||||
fi
|
||||
if ! echo "COMMIT;" >>"$tempfile"; then
|
||||
die "Write $tempfile failed" ${err_upgrade_pre}
|
||||
fi
|
||||
#file not meet requirements
|
||||
if [[ ${temp_file_num} -eq 0 ]]; then
|
||||
debug "No sql file for ${action} ${dbname}!"
|
||||
rm -f "$tempfile"
|
||||
else
|
||||
debug "get ${temp_file_num} files for ${action} ${dbname}!"
|
||||
fi
|
||||
}
|
||||
|
||||
function prepare_sql_all() {
|
||||
local dir_temp_sql="$GAUSS_TMP_PATH"/temp_sql
|
||||
local sql_tar_file="$GAUSS_UPGRADE_BASE_PATH"/upgrade_sql.tar.gz
|
||||
local sql_tar_sha="$GAUSS_UPGRADE_BASE_PATH"/upgrade_sql.sha256
|
||||
|
||||
if [[ ! -f "${sql_tar_file}" ]] || [[ ! -f "${sql_tar_sha}" ]]; then
|
||||
die "${sql_tar_file} or ${sql_tar_sha} not exit!" ${err_upgrade_pre}
|
||||
else
|
||||
local sha_expect=$(cat ${sql_tar_sha})
|
||||
local sha_current=$(sha256sum ${sql_tar_file} | awk '{print $1}')
|
||||
if [[ "$sha_expect" != "$sha_current" ]]; then
|
||||
die "The sha256 value of $sql_tar_file does not match $sql_tar_sha!" ${err_upgrade_pre}
|
||||
fi
|
||||
if [[ -d "$dir_temp_sql" ]]; then
|
||||
rm -rf "$dir_temp_sql"
|
||||
fi
|
||||
if mkdir -p -m 700 "$dir_temp_sql" && tar -zxf "$sql_tar_file" -C "$dir_temp_sql"; then
|
||||
log "decompress upgrade_sql.tar.gz successfully."
|
||||
else
|
||||
die "decompress upgrade_sql.tar.gz failed" ${err_upgrade_pre}
|
||||
fi
|
||||
fi
|
||||
#total 8
|
||||
cd "$dir_temp_sql"
|
||||
for action in upgrade upgrade-post rollback rollback-post; do
|
||||
for db_base in maindb otherdb; do
|
||||
prepare_sql ${action} ${db_base}
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function pre_exec_sql() {
|
||||
if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade_otherdb.sql otherdb; then
|
||||
debug "exec pre sql successfully"
|
||||
return 0
|
||||
else
|
||||
log "exec pre sql failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function post_exec_sql() {
|
||||
if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade-post_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade-post_otherdb.sql otherdb; then
|
||||
debug "upgrade post sql successfully"
|
||||
else
|
||||
die "upgrade post sql failed" ${err_upgrade_post}
|
||||
fi
|
||||
}
|
||||
|
||||
function stop_dbnode() {
|
||||
if ! check_db_process; then
|
||||
return 0
|
||||
fi
|
||||
gs_ctl stop -D ${PGDATA} >>"${GAUSS_LOG_FILE}" 2>&1
|
||||
}
|
||||
|
||||
function check_db_process() {
|
||||
legal_path=$(echo "$GAUSSHOME/bin/gaussdb" | sed 's#//*#/#g')
|
||||
ps wwx | grep "${legal_path}" | grep -v grep >/dev/null
|
||||
}
|
||||
|
||||
function query_dn_role() {
|
||||
gs_ctl query -D ${PGDATA} >"${GAUSS_TMP_PATH}/temp_dn_role"
|
||||
dn_role_temp=$(grep local_role "${GAUSS_TMP_PATH}/temp_dn_role" | head -1 | awk '{print $3}')
|
||||
# rm -f "${GAUSS_TMP_PATH}/temp_dn_role"
|
||||
if [[ "$dn_role_temp" = "Normal" ]]; then
|
||||
dn_role_temp="normal"
|
||||
elif [[ "$dn_role_temp" = "Primary" ]]; then
|
||||
dn_role_temp="primary"
|
||||
elif [[ "$dn_role_temp" = "Standby" ]]; then
|
||||
dn_role_temp="standby"
|
||||
elif [[ "$dn_role_temp" = "Cascade" ]]; then
|
||||
dn_role_temp="cascade_standby"
|
||||
else
|
||||
dn_role_temp=""
|
||||
fi
|
||||
|
||||
dn_role="$dn_role_temp"
|
||||
if [[ "$dn_role" != "$dn_role_temp" ]]; then
|
||||
die "dn_role maybe not right" ${err_dn_role_null}
|
||||
fi
|
||||
}
|
||||
|
||||
function rollback_bin() {
|
||||
export GAUSSHOME=${GAUSS_BASE_PATH}
|
||||
export LD_LIBRARY_PATH=${GAUSSHOME}/lib:$LD_LIBRARY_PATH
|
||||
export PATH=${GAUSSHOME}/bin:$PATH
|
||||
start_dbnode
|
||||
if ! reload_upgrade_config upgrade_mode 0; then
|
||||
die "set upgrade_mode to 0 failed" ${err_upgrade_post}
|
||||
fi
|
||||
}
|
||||
|
||||
function rollback_pre_sql() {
|
||||
if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_rollback_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_rollback_otherdb.sql otherdb; then
|
||||
debug "rollback pre sql successfully"
|
||||
else
|
||||
die "rollback pre sql failed" ${err_rollback_pre}
|
||||
fi
|
||||
}
|
||||
|
||||
function rollback_post() {
|
||||
if ! reload_upgrade_config upgrade_mode 2; then
|
||||
die "set upgrade_mode to 2 failed" ${err_upgrade_post}
|
||||
fi
|
||||
if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_rollback-post_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_rollback-post_otherdb.sql otherdb; then
|
||||
debug "rollback post sql successfully"
|
||||
else
|
||||
die "rollback post sql failed" ${err_rollback_post}
|
||||
fi
|
||||
}
|
||||
|
||||
function set_upgrade_config() {
|
||||
if check_upgrade_config "$1" "$2"; then
|
||||
return 0
|
||||
fi
|
||||
local current_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
echo -n \[${current_time}\] " " >>"${GAUSS_LOG_FILE}"
|
||||
for i in $(seq 1 3); do
|
||||
if gs_guc set -D ${PGDATA} -c "$1=$2" >>"${GAUSS_LOG_FILE}" 2>&1; then
|
||||
debug "guc set $1=$2 successfully"
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
function set_upgrade_mode() {
|
||||
if ! set_upgrade_config upgrade_mode 2; then
|
||||
die "set upgrade_mode to 2 failed" ${err_rollback_bin}
|
||||
fi
|
||||
}
|
||||
|
||||
function check_upgrade_mode_by_sql() {
|
||||
# check upgrade_mode = 2 by sql
|
||||
check_upgrade_mode_result="$GAUSS_TMP_PATH"/".temp_upgrade_mode"
|
||||
if echo "" >${check_upgrade_mode_result} && chmod 600 ${check_upgrade_mode_result}; then
|
||||
debug "Begin to generate check_upgrade_mode_result."
|
||||
else
|
||||
log "generate $check_upgrade_mode_result failed."
|
||||
return 1
|
||||
fi
|
||||
gsql -p ${GAUSS_LISTEN_PORT} -d postgres --pipeline -X -t -A \
|
||||
-c "show upgrade_mode;" >${check_upgrade_mode_result} 2>&1 &
|
||||
sleep 0.1
|
||||
|
||||
for i in $(seq 1 60); do
|
||||
check_mode_sql=$(cat ${check_upgrade_mode_result})
|
||||
if [[ "$check_mode_sql" == "2" ]]; then
|
||||
rm -f ${check_upgrade_mode_result}
|
||||
return 0
|
||||
elif [[ "$check_mode_sql" == "0" ]]; then
|
||||
rm -f ${check_upgrade_mode_result}
|
||||
gsql -p ${GAUSS_LISTEN_PORT} -d postgres --pipeline -X -t -A \
|
||||
-c "show upgrade_mode;" >${check_upgrade_mode_result} 2>&1 &
|
||||
elif [[ "$check_mode_sql" == "" ]]; then
|
||||
debug "Wait for check_upgrade_mode_result..."
|
||||
else
|
||||
log "$(cat ${check_upgrade_mode_result})"
|
||||
return 1
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
if [[ -f "${check_upgrade_mode_result}" ]]; then
|
||||
debug "check_upgrade_mode_result is $(cat ${check_upgrade_mode_result})"
|
||||
rm -f ${check_upgrade_mode_result}
|
||||
else
|
||||
debug "get upgrade_mode by gsql failed"
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
function exec_sql() {
|
||||
#$1: sqlfilename
|
||||
#$2: maindb,otherdb
|
||||
query_dn_role
|
||||
if [[ X"$dn_role" == X"standby" || X"$dn_role" == X"cascade_standby" ]]; then
|
||||
return 0
|
||||
fi
|
||||
if [[ ! -f "$1" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! check_upgrade_mode_by_sql; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
temp_result="$GAUSS_TMP_PATH"/"temp_sql_temp_result_$(date +%Y%m%d_%H%M%S)"
|
||||
if echo "" >"$temp_result" && chmod 600 "$temp_result"; then
|
||||
debug "begin exec sql ,file name is $1"
|
||||
else
|
||||
log "Generate $temp_result failed."
|
||||
fi
|
||||
sqlbegin="gsql -p $GAUSS_LISTEN_PORT -X -t -A "
|
||||
if [[ "$2" == "maindb" ]]; then
|
||||
if ${sqlbegin} -d postgres --echo-queries --set ON_ERROR_STOP=on -f $1 >>"$temp_result" 2>&1; then
|
||||
debug "Exec $1 on database: postgres successfully"
|
||||
else
|
||||
log "Exec sql on postgres failed."
|
||||
debug "$(cat ${temp_result})"
|
||||
rm -f ${temp_result}
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
if databases=$(${sqlbegin} -d postgres -c "SELECT datname FROM pg_catalog.pg_database where datname != 'postgres';"); then
|
||||
temp_num=$(echo ${databases} | awk '{print NF}')
|
||||
debug "Num of other databases: $temp_num"
|
||||
else
|
||||
log "Exec sql to get databases failed."
|
||||
return 1
|
||||
fi
|
||||
for database in ${databases}; do
|
||||
debug "Begin exec $1 on database: $database "
|
||||
${sqlbegin} -d ${database} --echo-queries --set ON_ERROR_STOP=on -f $1 >>"$temp_result" 2>&1
|
||||
done
|
||||
fi
|
||||
if grep -wE "ERROR:|FATAL:|could not connect to server" ${temp_result}; then
|
||||
log "Exec sql failed."
|
||||
debug "$(cat ${temp_result})"
|
||||
rm -f ${temp_result}
|
||||
return 1
|
||||
else
|
||||
debug "Exec all sql successfully."
|
||||
rm -f ${temp_result}
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function guc_delete() {
|
||||
if [[ ! -f "$GAUSS_TMP_PATH"/temp_sql/upgrade_sql/set_guc/delete_guc ]]; then
|
||||
log "No need to delete guc"
|
||||
fi
|
||||
for para in $(cat "$GAUSS_TMP_PATH"/temp_sql/upgrade_sql/set_guc/delete_guc); do
|
||||
if echo ${para} | grep -w datanode >/dev/null; then
|
||||
para=$(echo ${para} | awk '{print $1}')
|
||||
if sed -i "/^${para}[ =]/d" ${PGDATA}/postgresql.conf; then
|
||||
debug "$para was deleted successfully."
|
||||
else
|
||||
die "$para was deleted failed" ${err_upgrade_bin}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
log "Delete guc successfully"
|
||||
}
|
||||
|
||||
function delete_tmp_files() {
|
||||
rm -rf "$GAUSS_TMP_PATH"
|
||||
rm -rf ${GAUSS_LOG_FILE}
|
||||
}
|
||||
|
||||
function add_pg_proc_index() {
|
||||
version=$(gaussdb -V)
|
||||
if [[ ! $version =~ "V500R002C00" && ! $version =~ "2.1.0" ]]; then
|
||||
return 0
|
||||
fi
|
||||
add_index_cmd="start transaction; set isinplaceupgrade=on;
|
||||
ALTER INDEX pg_proc_proname_args_nsp_index unusable;
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 9666;
|
||||
CREATE INDEX pg_catalog.pg_proc_proname_all_args_nsp_index on pg_catalog.pg_proc USING BTREE(proname name_ops, pronamespace oid_ops, propackageid oid_ops);
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
|
||||
commit;"
|
||||
sqlbegin="gsql -p $GAUSS_LISTEN_PORT -X -t -A "
|
||||
result=$(${sqlbegin} -d postgres -c "${add_index_cmd}")
|
||||
if [ $? -ne 0 ]; then
|
||||
log "Exec sql to get databases failed."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function upgrade_pre() {
|
||||
# 1.检查环境变量,版本,磁盘
|
||||
check_env
|
||||
check_version
|
||||
check_disk
|
||||
# 2.准备sql
|
||||
prepare_sql_all
|
||||
# 3.设置升级模式
|
||||
if ! reload_upgrade_config upgrade_mode 2; then
|
||||
die "set upgrade_mode to 0 failed" ${err_upgrade_pre}
|
||||
fi
|
||||
# 4.添加pg_proc_index
|
||||
add_pg_proc_index
|
||||
# 5.执行pre sql
|
||||
pre_exec_sql
|
||||
if [ $? -ne 0 ]; then
|
||||
rollback_pre_sql
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_path() {
|
||||
local remove_dir="$1"
|
||||
export PATH=$(echo $PATH | tr ':' '\n' | grep -v "^${remove_dir}$" | tr '\n' ':' | sed 's/:$//')
|
||||
}
|
||||
|
||||
function remove_lib() {
|
||||
local remove_dir="$1"
|
||||
export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\n' | grep -v "^${remove_dir}$" | tr '\n' ':' | sed 's/:$//')
|
||||
}
|
||||
|
||||
function upgrade_bin() {
|
||||
# 1.停止旧库
|
||||
if ! stop_dbnode; then
|
||||
die "Stop gaussdb failed" ${err_upgrade_bin}
|
||||
fi
|
||||
# 2.删除guc
|
||||
guc_delete
|
||||
# 3.启动新库
|
||||
remove_path ${GAUSS_BASE_PATH}/bin
|
||||
remove_lib ${GAUSS_BASE_PATH}/lib
|
||||
export GAUSSHOME=${GAUSS_UPGRADE_BASE_PATH}
|
||||
export LD_LIBRARY_PATH=${GAUSSHOME}/lib:$LD_LIBRARY_PATH
|
||||
export PATH=${GAUSSHOME}/bin:$PATH
|
||||
start_dbnode
|
||||
}
|
||||
|
||||
function upgrade_post() {
|
||||
# 1.执行升级sql,升级元数据
|
||||
if ! check_db_process; then
|
||||
die "Guassdb is not running" ${err_upgrade_post}
|
||||
fi
|
||||
if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade-post_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade-post_otherdb.sql otherdb; then
|
||||
debug "upgrade post sql successfully"
|
||||
else
|
||||
log "upgrade post sql failed"
|
||||
rollback_post
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function upgrade_commit() {
|
||||
# 1.设置升级模式为0
|
||||
if ! reload_upgrade_config upgrade_mode 0; then
|
||||
die "set upgrade_mode to 0 failed" ${err_upgrade_commit}
|
||||
fi
|
||||
# 2.删除临时文件
|
||||
# delete_tmp_files
|
||||
}
|
||||
|
||||
function cp_bak() {
|
||||
cp -rf ${GAUSS_BASE_PATH}/* ${GAUSS_BACKUP_BASE_PATH}
|
||||
# rm -rf ${GAUSS_BASE_PATH}/*
|
||||
}
|
||||
|
||||
function cp_new() {
|
||||
cp -rf ${GAUSS_UPGRADE_BASE_PATH}/* ${GAUSS_BASE_PATH}
|
||||
}
|
||||
|
||||
function main() {
|
||||
cp_bak
|
||||
cp_new_all_pkg_to_tmp_dir
|
||||
upgrade_pre
|
||||
upgrade_bin
|
||||
upgrade_post
|
||||
upgrade_commit
|
||||
stop_dbnode
|
||||
# cp_new
|
||||
# remove_path ${GAUSS_UPGRADE_BASE_PATH}/bin
|
||||
# remove_lib ${GAUSS_UPGRADE_BASE_PATH}/lib
|
||||
# source /var/lib/opengauss/.bash_profile
|
||||
# which gs_ctl
|
||||
# start_dbnode
|
||||
return 0
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
openGauss-Server-6.0.0
|
||||
92.954
|
||||
798b1578
|
||||
release
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
--- xgboost-1.4.1/rabit/CMakeLists.txt.orig 2025-03-12 09:39:22.266791744 +0800
|
||||
+++ xgboost-1.4.1/rabit/CMakeLists.txt 2025-03-12 09:39:47.096143841 +0800
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 3.3)
|
||||
+cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue