mirror of https://github.com/citusdata/citus.git
Separate build of citus.so and citus_columnar.so.
Because columnar code is statically-linked to both modules, it doesn't make sense to load them both at once. A subsequent commit will make the modules entirely separate and allow loading them both simultaneously.separate-modules
parent
e21980fb89
commit
a5f4ef5943
12
Makefile
12
Makefile
|
@ -13,10 +13,16 @@ 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: 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 +33,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,6 +42,7 @@ 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
|
||||
|
|
|
@ -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
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "citus_version.h"
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
|
||||
/* Default values for option parameters */
|
||||
#define DEFAULT_STRIPE_ROW_COUNT 150000
|
||||
|
@ -53,6 +54,14 @@ static const struct config_enum_entry columnar_compression_options[] =
|
|||
{ NULL, 0, false }
|
||||
};
|
||||
|
||||
void
|
||||
columnar_init(void)
|
||||
{
|
||||
columnar_init_gucs();
|
||||
columnar_tableam_init();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
columnar_init_gucs()
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
#include "citus_version.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/mod.h"
|
||||
|
||||
#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();
|
||||
columnar_init();
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@ ENSURE_SUBDIRS_EXIST := $(shell mkdir -p $(SUBDIRS))
|
|||
|
||||
# That patsubst rule searches all directories listed in SUBDIRS for .c
|
||||
# files, and adds the corresponding .o files to OBJS
|
||||
OBJS += \
|
||||
ALL_OBJS = \
|
||||
$(patsubst $(citus_abs_srcdir)/%.c,%.o,$(foreach dir,$(SUBDIRS), $(sort $(wildcard $(citus_abs_srcdir)/$(dir)/*.c))))
|
||||
|
||||
OBJS += $(filter-out ../columnar/mod.o,$(ALL_OBJS))
|
||||
|
||||
# be explicit about the default target
|
||||
all:
|
||||
|
||||
|
@ -84,7 +86,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
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
#include "utils/syscache.h"
|
||||
#include "utils/varlena.h"
|
||||
|
||||
#include "columnar/mod.h"
|
||||
#include "columnar/columnar.h"
|
||||
|
||||
/* marks shared object as one loadable by the postgres version compiled against */
|
||||
PG_MODULE_MAGIC;
|
||||
|
|
|
@ -207,6 +207,7 @@ extern int columnar_compression_level;
|
|||
typedef void (*ColumnarTableSetOptions_hook_type)(Oid relid, ColumnarOptions options);
|
||||
extern ColumnarTableSetOptions_hook_type ColumnarTableSetOptions_hook;
|
||||
|
||||
extern void columnar_init(void);
|
||||
extern void columnar_init_gucs(void);
|
||||
|
||||
extern CompressionType ParseCompressionType(const char *compressionTypeString);
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* mod.h
|
||||
*
|
||||
* Type and function declarations for columnar
|
||||
*
|
||||
* Copyright (c) Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MOD_H
|
||||
#define MOD_H
|
||||
|
||||
/* Function declarations for extension loading and unloading */
|
||||
extern void columnar_init(void);
|
||||
extern void columnar_fini(void);
|
||||
|
||||
#endif /* MOD_H */
|
|
@ -185,3 +185,11 @@ SELECT columnar_test_helpers.columnar_metadata_has_storage_id(:columnar_temp_sto
|
|||
f
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- Will throw error due to redefining GUCs, because citus is already
|
||||
-- loaded and has already initialized columnar code. This test is to
|
||||
-- ensure that the citus_columnar module is built and present, and
|
||||
-- that it can be loaded without link failures.
|
||||
--
|
||||
LOAD 'citus_columnar';
|
||||
ERROR: attempt to redefine parameter "columnar.compression"
|
||||
|
|
|
@ -129,3 +129,11 @@ SELECT COUNT(*)=1 FROM pg_class WHERE relname='columnar_temp';
|
|||
SELECT COUNT(*)=0 FROM columnar_temp;
|
||||
-- since we deleted all the rows, we shouldn't have any stripes for table
|
||||
SELECT columnar_test_helpers.columnar_metadata_has_storage_id(:columnar_temp_storage_id);
|
||||
|
||||
--
|
||||
-- Will throw error due to redefining GUCs, because citus is already
|
||||
-- loaded and has already initialized columnar code. This test is to
|
||||
-- ensure that the citus_columnar module is built and present, and
|
||||
-- that it can be loaded without link failures.
|
||||
--
|
||||
LOAD 'citus_columnar';
|
||||
|
|
Loading…
Reference in New Issue