mirror of https://github.com/citusdata/citus.git
Build Columnar.so and make Citus depends on it (#5661)
* [Columnar] Build columnar.so and let citus depends on it Co-authored-by: Yanwen Jin <yanwjin@microsoft.com> Co-authored-by: Ying Xu <32597660+yxu2162@users.noreply.github.com> Co-authored-by: jeff-davis <Jeffrey.Davis@microsoft.com>pull/5749/head
parent
65bd540943
commit
a4133c69e8
14
Makefile
14
Makefile
|
@ -10,13 +10,18 @@ ifeq (,$(wildcard Makefile.global))
|
|||
endif
|
||||
|
||||
include Makefile.global
|
||||
|
||||
all: extension
|
||||
|
||||
|
||||
#build columnar only
|
||||
columnar:
|
||||
$(MAKE) -C src/backend/columnar all
|
||||
# build extension
|
||||
extension: $(citus_top_builddir)/src/include/citus_version.h
|
||||
extension: $(citus_top_builddir)/src/include/citus_version.h columnar
|
||||
$(MAKE) -C src/backend/distributed/ all
|
||||
install-extension: extension
|
||||
install-columnar:
|
||||
$(MAKE) -C src/backend/columnar install
|
||||
install-extension: extension install-columnar
|
||||
$(MAKE) -C src/backend/distributed/ install
|
||||
install-headers: extension
|
||||
$(MKDIR_P) '$(DESTDIR)$(includedir_server)/distributed/'
|
||||
|
@ -27,6 +32,7 @@ install-headers: extension
|
|||
|
||||
clean-extension:
|
||||
$(MAKE) -C src/backend/distributed/ clean
|
||||
$(MAKE) -C src/backend/columnar/ clean
|
||||
clean-full:
|
||||
$(MAKE) -C src/backend/distributed/ clean-full
|
||||
.PHONY: extension install-extension clean-extension clean-full
|
||||
|
@ -35,8 +41,8 @@ install: install-extension install-headers
|
|||
install-downgrades:
|
||||
$(MAKE) -C src/backend/distributed/ install-downgrades
|
||||
install-all: install-headers
|
||||
$(MAKE) -C src/backend/columnar/ install-all
|
||||
$(MAKE) -C src/backend/distributed/ install-all
|
||||
|
||||
clean: clean-extension
|
||||
|
||||
# apply or check style
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
citus_subdir = src/backend/columnar
|
||||
citus_top_builddir = ../../..
|
||||
safestringlib_srcdir = $(citus_abs_top_srcdir)/vendor/safestringlib
|
||||
SUBDIRS = . safeclib
|
||||
SUBDIRS +=
|
||||
ENSURE_SUBDIRS_EXIST := $(shell mkdir -p $(SUBDIRS))
|
||||
OBJS += \
|
||||
$(patsubst $(citus_abs_srcdir)/%.c,%.o,$(foreach dir,$(SUBDIRS), $(sort $(wildcard $(citus_abs_srcdir)/$(dir)/*.c))))
|
||||
|
||||
MODULE_big = citus_columnar
|
||||
|
||||
PG_CPPFLAGS += -I$(libpq_srcdir) -I$(safestringlib_srcdir)/include
|
||||
|
||||
include $(citus_top_builddir)/Makefile.global
|
||||
|
||||
.PHONY: install-all
|
||||
install-all: install
|
|
@ -11,7 +11,6 @@
|
|||
#include "postgres.h"
|
||||
|
||||
#include "funcapi.h"
|
||||
#include "pg_config.h"
|
||||
#include "access/nbtree.h"
|
||||
#include "access/table.h"
|
||||
#include "catalog/pg_am.h"
|
||||
|
|
|
@ -22,8 +22,13 @@
|
|||
|
||||
#include "columnar/columnar_tableam.h"
|
||||
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
void _PG_init(void);
|
||||
|
||||
void
|
||||
columnar_init(void)
|
||||
_PG_init(void)
|
||||
{
|
||||
columnar_init_gucs();
|
||||
columnar_tableam_init();
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../../vendor/safestringlib/safeclib/
|
|
@ -19,8 +19,6 @@ DATA_built = $(generated_sql_files)
|
|||
|
||||
# directories with source files
|
||||
SUBDIRS = . commands connection ddl deparser executor metadata operations planner progress relay safeclib test transaction utils worker
|
||||
# columnar modules
|
||||
SUBDIRS += ../columnar
|
||||
# enterprise modules
|
||||
SUBDIRS +=
|
||||
|
||||
|
@ -39,9 +37,12 @@ all:
|
|||
NO_PGXS = 1
|
||||
|
||||
SHLIB_LINK = $(libpq)
|
||||
|
||||
SHLIB_LINK_INTERNAL += -L../columnar -l:citus_columnar.so
|
||||
override enable_rpath = yes
|
||||
include $(citus_top_builddir)/Makefile.global
|
||||
|
||||
rpathdir := $(shell $(PG_CONFIG) --libdir):$(shell $(PG_CONFIG) --pkglibdir)
|
||||
|
||||
# make sure citus_version.o is recompiled whenever any change is made to the binary or any
|
||||
# other artifact being installed to reflect the correct gitref for every build
|
||||
CITUS_VERSION_INVALIDATE := $(filter-out utils/citus_version.o,$(OBJS))
|
||||
|
@ -84,7 +85,8 @@ endif
|
|||
.PHONY: clean-full install install-downgrades install-all
|
||||
|
||||
cleanup-before-install:
|
||||
rm -f $(DESTDIR)$(datadir)/$(datamoduledir)/citus*
|
||||
rm -f $(DESTDIR)$(datadir)/$(datamoduledir)/citus.control
|
||||
rm -f $(DESTDIR)$(datadir)/$(datamoduledir)/citus--*
|
||||
|
||||
install: cleanup-before-install
|
||||
|
||||
|
|
|
@ -353,7 +353,13 @@ _PG_init(void)
|
|||
{
|
||||
DoInitialCleanup();
|
||||
}
|
||||
columnar_init();
|
||||
|
||||
/*
|
||||
* For convenience and backwards compatibility, we avoid users having to add both
|
||||
* citus and columnar to shared_preload_libraries by loading citus_columnar.so as part of
|
||||
* loading citus.so.
|
||||
*/
|
||||
load_file(COLUMNAR_LIB_NAME, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#ifndef MOD_H
|
||||
#define MOD_H
|
||||
#define COLUMNAR_LIB_NAME "citus_columnar"
|
||||
|
||||
/* Function declarations for extension loading and unloading */
|
||||
extern void columnar_init(void);
|
||||
|
|
Loading…
Reference in New Issue