For oracle_fdw.

This commit is contained in:
TotaJ 2020-07-18 17:37:25 +08:00
parent f9eddc45b8
commit df66f2fd3d
12 changed files with 1146 additions and 4 deletions

View File

@ -34,8 +34,15 @@ else
install_mysql_fdw:
endif
ifeq ($(enable_oracle_fdw), yes)
install_oracle_fdw:
$(MAKE) -C contrib/oracle_fdw install
else
install_oracle_fdw:
endif
ifeq ($(enable_multiple_nodes), yes)
install: install_mysql_fdw
install: install_mysql_fdw install_oracle_fdw
$(MAKE) -C contrib/hstore $@
$(MAKE) -C src/distribute/kernel/extension/packages $@
$(MAKE) -C contrib/pagehack $@
@ -45,7 +52,7 @@ install: install_mysql_fdw
$(MAKE) -C src/distribute/kernel/extension/tsdb $@
+@echo "PostgreSQL installation complete."
else
install: install_mysql_fdw
install: install_mysql_fdw install_oracle_fdw
+@echo "openGauss installation complete."
endif

View File

@ -514,6 +514,7 @@ Compilation log: **make_compile.log**
> 3. On the **ARMv8.1** platform or a later version (for example, Kunpeng 920), **-D__ARM_LSE** needs to be added to **CFLAGS**.
> 4. If **binarylibs** is moved to **openGauss-server** or a soft link to **binarylibs** is created in **openGauss-server**, you do not need to specify the **--3rd** parameter. However, if you do so, please note that the file is easy to be deleted by the `git clean` command.
> 5. To build with mysql_fdw, add **--enable-mysql-fdw** when configure. Note that before build mysql_fdw, MariaDB's C client library is needed.
> 6. To build with oracle_fdw, add **--enable-oracle-fdw** when configure. Note that before build oracle_fdw, Oracle's C client library is needed.
4. Run the following commands to compile openGauss:

24
configure vendored
View File

@ -744,6 +744,7 @@ enable_jemalloc_debug
enable_multiple_nodes
enable_memory_check
enable_mysql_fdw
enable_oracle_fdw
enable_thread_check
enable_shared
default_gs_version
@ -821,6 +822,7 @@ enable_jemalloc_debug
enable_multiple_nodes
enable_memory_check
enable_mysql_fdw
enable_oracle_fdw
enable_thread_check
enable_spinlocks
enable_debug
@ -2869,6 +2871,28 @@ else
fi
# Check whether --enable-oracle-fdw was given.
if test "${enable_oracle_fdw+set}" = set; then
enableval=$enable_oracle_fdw;
case $enableval in
yes)
:
;;
no)
:
;;
*)
{ { $as_echo "$as_me:$LINENO: error: no argument expected for --enable-oracle-fdw option" >&5
$as_echo "$as_me: error: no argument expected for --enable-oracle-fdw option" >&2;}
{ (exit 1); exit 1; }; }
;;
esac
else
enable_oracle_fdw=no
fi
# Check whether --enable-thread-check was given.
if test "${enable_thread_check+set}" = set; then
enableval=$enable_thread_check;

View File

@ -0,0 +1,59 @@
#
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# ---------------------------------------------------------------------------------------
#
# Makefile
# Makefile for the oracle_fdw
#
# IDENTIFICATION
# contrib/oracle_fdw/Makefile
#
# ---------------------------------------------------------------------------------------
all:oracle_fdw_target
install:install-data
top_builddir ?= ../../
ORACLE_FDW_DIR=$(top_builddir)/third_party/dependency/oracle_fdw
ORACLE_FDW_PACKAGE=oracle_fdw-ORACLE_FDW_2_2_0
ORACLE_FDW_PATCH=huawei_oracle_fdw-2.2.0_patch
ORACLE_FDW_MEGRED_SOURCES_DIR=$(ORACLE_FDW_DIR)/code
.PHONY: oracle_fdw_target
oracle_fdw_target:
@$(call create_oracle_fdw_sources)
@make -C $(ORACLE_FDW_MEGRED_SOURCES_DIR)/$(ORACLE_FDW_PACKAGE) NO_PGXS=1
.PHONY: install-data
install-data: oracle_fdw_target
@make -C $(ORACLE_FDW_MEGRED_SOURCES_DIR)/$(ORACLE_FDW_PACKAGE) NO_PGXS=1 install
uninstall distclean clean:
@rm -rf $(ORACLE_FDW_MEGRED_SOURCES_DIR)
define create_oracle_fdw_sources
rm -rf $(ORACLE_FDW_MEGRED_SOURCES_DIR); \
mkdir $(ORACLE_FDW_MEGRED_SOURCES_DIR); \
tar xfzv $(ORACLE_FDW_DIR)/$(ORACLE_FDW_PACKAGE).tar.gz -C $(ORACLE_FDW_MEGRED_SOURCES_DIR) &> /dev/null; \
for ((i=1;i<=99;i++)); \
do \
file_name="$(ORACLE_FDW_DIR)/$$i-oracle_fdw-2.2.0_patch.patch"; \
if [ ! -f "$$file_name" ]; then \
exit 0; \
fi; \
patch -p0 -d $(ORACLE_FDW_MEGRED_SOURCES_DIR)/$(ORACLE_FDW_PACKAGE) < $$file_name &> /dev/null; \
done
rename ".c" ".cpp" $(ORACLE_FDW_MEGRED_SOURCES_DIR)/$(ORACLE_FDW_PACKAGE)/*.c; \
patch -p0 -d $(ORACLE_FDW_MEGRED_SOURCES_DIR)/$(ORACLE_FDW_PACKAGE) < $(ORACLE_FDW_DIR)/$(ORACLE_FDW_PATCH).patch &> /dev/null;
endef

View File

@ -172,6 +172,7 @@ enable_jemalloc = @enable_jemalloc@
enable_jemalloc_debug = @enable_jemalloc_debug@
enable_multiple_nodes = @enable_multiple_nodes@
enable_mysql_fdw = @enable_mysql_fdw@
enable_oracle_fdw = @enable_oracle_fdw@
enable_memory_check = @enable_memory_check@
enable_memory_check_core = @enable_memory_check_core@
enable_thread_check = @enable_thread_check@

View File

@ -868,8 +868,10 @@ static void CheckUnsupportInsertSelectClause(Query* query)
AssertEreport(query->commandType == CMD_INSERT, MOD_OPT, "Only deal with CMD_INSERT commondType here");
if (result->relkind == RELKIND_FOREIGN_TABLE) {
if (isMOTFromTblOid(result->relid) || isMysqlFDWFromTblOid(result->relid))
if (isMOTFromTblOid(result->relid) || isMysqlFDWFromTblOid(result->relid) ||
isOracleFDWFromTblOid(result->relid)) {
return;
}
if (list_length(query->rtable) == 1)
ereport(ERROR,

View File

@ -31,6 +31,10 @@ ifeq ($(enable_mysql_fdw), yes)
SUBDIRS += $(top_builddir)/contrib/mysql_fdw
endif
ifeq ($(enable_oracle_fdw), yes)
SUBDIRS += $(top_builddir)/contrib/oracle_fdw
endif
ifeq ($(enable_multiple_nodes), yes)
SUBDIRS += ../distribute/kernel ../distribute/kernel/extension/roach_api ../distribute/kernel/extension/dimsearch/main \
../distribute/kernel/extension/tsdb

View File

@ -8462,7 +8462,8 @@ ModifyTable* make_modifytable(CmdType operation, bool canSetTag, List* resultRel
Plan* subplan = (Plan*)(linitial(subplans));
ForeignScan* fscan = NULL;
if ((fscan = (ForeignScan*)FindForeignScan(subplan)) != NULL) {
if (!isMOTFromTblOid(fscan->scan_relid) && !isMysqlFDWFromTblOid(fscan->scan_relid))
if (!isMOTFromTblOid(fscan->scan_relid) && !isMysqlFDWFromTblOid(fscan->scan_relid) &&
!isOracleFDWFromTblOid(fscan->scan_relid))
ereport(ERROR,
(errmodule(MOD_OPT),
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

View File

@ -285,6 +285,9 @@ bool isWriteOnlyFt(Oid relid);
#define isMysqlFDWFromTblOid(relId) \
(IsSpecifiedFDWFromRelid(relId, MYSQL_FDW))
#define isOracleFDWFromTblOid(relId) \
(IsSpecifiedFDWFromRelid(relId, ORACLE_FDW))
#define IS_OBS_CSV_TXT_FOREIGN_TABLE(relId) \
(IsSpecifiedFDWFromRelid(relId, DIST_FDW) && (is_obs_protocol(HdfsGetOptionValue(relId, optLocation))))

View File

@ -78,6 +78,10 @@
#define MYSQL_FDW "mysql_fdw"
#endif
#ifndef ORACLE_FDW
#define ORACLE_FDW "oracle_fdw"
#endif
#ifndef MOT_FDW
#define MOT_FDW "mot_fdw"
#endif

File diff suppressed because it is too large Load Diff