PolarDB 11 compiles pg_bulkload plugin but reports an error

I am encountering a compilation error when trying to build the pg_bulkload plugin with PolarDB 11. Here’s a detailed description of the steps I followed and the errors encountered

Reproduction Steps:

  1. Set Up PolarDB Development Environment:
  • I set up a PolarDB development environment by compiling and installing PolarDB 11 from the source.Pulled a Docker image for PolarDB development on a familiar OS, such as Ubuntu 22.04:
docker pull registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_devel:ubuntu22.04      
  • Created and ran a container:
docker run -d -it -P --shm-size=1g --cap-add=SYS_PTRACE --cap-add SYS_ADMIN --privileged=true --name polardb_pg_devel registry.cn-hangzhou.aliyuncs.com/polardb_pg/polardb_pg_devel:ubuntu22.04 bash      
  • Entered the container:
# 进入容器    
docker exec -ti polardb_pg_devel bash      
  • Cloned PolarDB 11 source code and deployed the PolarDB-PG instance:
# 例如这里拉取 POLARDB_11_STABLE 分支;     
# PS: 截止2024.9.24 PolarDB开源的最新分支为: POLARDB_15_STABLE      
cd /tmp       
git clone -c core.symlinks=true --depth 1 -b POLARDB_11_STABLE https://github.com/ApsaraDB/PolarDB-for-PostgreSQL      
    
# 编译PolarDB 11并初始化实例    
cd /tmp/PolarDB-for-PostgreSQL      
./polardb_build.sh --without-fbl --debug=off      
      
# 验证PolarDB-PG      
psql -c 'SELECT version();'        
      
            version                   
--------------------------------      
 PostgreSQL 11.9 (POLARDB 11.9)      
(1 row)    
    
# 在容器内关闭、启动PolarDB数据库方法如下:       
pg_ctl stop -m fast -D ~/tmp_master_dir_polardb_pg_1100_bld         
pg_ctl start -D ~/tmp_master_dir_polardb_pg_1100_bld        

2.Inside the container, downloaded the pg_bulkload source code:

cd /tmp    
git clone -c core.symlinks=true --depth 1 https://github.com/ossc-db/pg_bulkload  
  1. Compile pg_bulkload:
    Attempted to compile pg_bulkload:
cd /tmp/pg_bulkload    
USE_PGXS=1 make install    

Error Messages:

In file included from /home/postgres/tmp_basedir_polardb_pg_1100_bld/include/server/storage/pg_shmem.h:30,  
                 from recovery.c:29:  
/home/postgres/tmp_basedir_polardb_pg_1100_bld/include/server/utils/hsearch.h:78:9: error: unknown type name ‘MemoryContext’  
   78 |         MemoryContext hcxt;                     /* memory context to use for allocations */  
      |         ^~~~~~~~~~~~~  
make[1]: *** [<builtin>: recovery.o] Error 1  
make[1]: Leaving directory '/tmp/pg_bulkload/bin'  
make: *** [Makefile:27: all] Error 2  

The error message should be due to the lack of a header file reference containing memoryContext. After searching the code, I found this definition in utils/palloc.h.

/home/postgres/tmp_basedir_polardb_pg_1100_bld/include/server/utils/palloc.h    
  
... ...  
 /*  
  * Type MemoryContextData is declared in nodes/memnodes.h.  Most users  
  * of memory allocation should just treat it as an abstract type, so we  
  * do not provide the struct contents here.  
  */  
 typedef struct MemoryContextData *MemoryContext;  
... ...   

Modified recovery.c to include the missing header:

vi bin/recovery.c  
  
... ...  
#include "storage/bufpage.h"  
// 新增一个 include :    
#include "utils/palloc.h"  
#include "storage/pg_shmem.h"  
... ...  

After fixing the first error, a new error appeared:

cd /tmp/pg_bulkload    
USE_PGXS=1 make install    
  
# 报错如下:  
writer_binary.c: In function ‘open_output_file’:  
writer_binary.c:430:14: error: too few arguments to function ‘BasicOpenFilePerm’  
  430 |         fd = BasicOpenFilePerm(fname, O_WRONLY | O_CREAT | O_EXCL | PG_BINARY,  
      |              ^~~~~~~~~~~~~~~~~  
In file included from /home/postgres/tmp_basedir_polardb_pg_1100_bld/include/server/utils/sharedtuplestore.h:17,  
                 from /home/postgres/tmp_basedir_polardb_pg_1100_bld/include/server/nodes/execnodes.h:27,  
                 from ../include/reader.h:18,  
                 from ../include/binary.h:15,  
                 from writer_binary.c:19:  
/home/postgres/tmp_basedir_polardb_pg_1100_bld/include/server/storage/fd.h:115:17: note: declared here  
  115 | extern int      BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode, bool polar_vfs);  
      |                 ^~~~~~~~~~~~~~~~~  
make[1]: *** [<builtin>: writer_binary.o] Error 1  
make[1]: Leaving directory '/tmp/pg_bulkload/lib'  
make: *** [Makefile:27: all] Error 2  

It seems that the BasicOpenFilePerm called by pg_bulkload has been modified by PolarDB and is incompatible with PostgreSQL 11.

How to solve this error?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật