-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Switched from CMake to native Postgres build based on make. Debug version can be compiled with `QUACK_BUILD=Debug make` command. Otherwise release will be built. * Multi-thread scan support. Number of threads per query can be set via `quack.max_threads_per_query` GUC variable (default is 1 thread). * Added basic regression test
- Loading branch information
Showing
33 changed files
with
1,268 additions
and
474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: pg_quack Build and Test | ||
on: | ||
push: | ||
pull_request: | ||
jobs: | ||
build-and-test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
version: [REL_16_STABLE] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Test details | ||
run: echo Build and test pg_quack on ${{ matrix.os }} with PostgreSQL ${{ matrix.version }} branch | ||
|
||
- name: Checkout and build PostgreSQL code | ||
run: | | ||
sudo apt-get update -qq | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 | ||
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libc++-dev libc++abi-dev libglib2.0-dev libtinfo5 cmake libstdc++-12-dev | ||
rm -rf postgres | ||
git clone --branch ${{ matrix.version }} --single-branch --depth 1 https://github.com/postgres/postgres.git | ||
pushd postgres | ||
git branch | ||
./configure --prefix=$PWD/inst/ --enable-cassert --enable-debug --with-openssl | ||
make -j4 install | ||
- name: Start Postgres | ||
run: | | ||
pushd postgres | ||
cd inst/bin | ||
./initdb -D data | ||
./pg_ctl -D data -l logfile start | ||
popd | ||
- name: Checkout pg_quack extension code | ||
uses: actions/checkout@v4 | ||
with: | ||
path: quack | ||
|
||
- name: Build and test pg_quack extension | ||
id: regression-tests | ||
run: | | ||
export PATH="${PWD}/postgres/inst/bin:$PATH" | ||
pushd quack | ||
git submodule update --init --recursive | ||
make | ||
make install | ||
make installcheck | ||
popd | ||
- name: Print regression.diffs if regression tests failed | ||
if: failure() && steps.regression-tests.outcome != 'success' | ||
run: | | ||
cat quack/regression.diffs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,12 @@ | |
.ccls | ||
compile_commands.json | ||
|
||
build/ | ||
|
||
*.a | ||
*.so | ||
*.o | ||
*.bc | ||
*.dylib | ||
|
||
results | ||
results | ||
regression.diffs | ||
regression.out |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.PHONY: duckdb install_duckdb clean_duckdb lintcheck | ||
|
||
MODULE_big = quack | ||
EXTENSION = quack | ||
DATA = quack.control $(wildcard quack--*.sql) | ||
|
||
SRCS = src/quack_heap_seq_scan.cpp \ | ||
src/quack_heap_scan.cpp \ | ||
src/quack_hooks.cpp \ | ||
src/quack_select.cpp \ | ||
src/quack_types.cpp \ | ||
src/quack_memory_allocator.cpp \ | ||
src/quack.cpp | ||
|
||
OBJS = $(subst .cpp,.o, $(SRCS)) | ||
|
||
REGRESS = basic | ||
|
||
PG_CONFIG ?= pg_config | ||
|
||
PGXS := $(shell $(PG_CONFIG) --pgxs) | ||
PG_LIB := $(shell $(PG_CONFIG) --pkglibdir) | ||
INCLUDEDIR := ${shell $(PG_CONFIG) --includedir} | ||
INCLUDEDIR_SERVER := ${shell $(PG_CONFIG) --includedir-server} | ||
|
||
QUACK_BUILD_CXX_FLAGS= | ||
QUACK_BUILD_DUCKDB= | ||
|
||
ifeq ($(QUACK_BUILD), Debug) | ||
QUACK_BUILD_CXX_FLAGS = -g -O0 | ||
QUACK_BUILD_DUCKDB = debug | ||
else | ||
QUACK_BUILD_CXX_FLAGS = | ||
QUACK_BUILD_DUCKDB = release | ||
endif | ||
|
||
override PG_CPPFLAGS += -Iinclude -Ithird_party/duckdb/src/include -std=c++17 ${QUACK_BUILD_CXX_FLAGS} | ||
|
||
SHLIB_LINK += -Wl,-rpath,$(PG_LIB)/ -lpq -L$(PG_LIB) -lduckdb -Lthird_party/duckdb/build/$(QUACK_BUILD_DUCKDB)/src -lstdc++ | ||
|
||
COMPILE.cc.bc = $(CXX) -Wno-ignored-attributes -Wno-register $(BITCODE_CXXFLAGS) $(CXXFLAGS) $(PG_CPPFLAGS) -I$(INCLUDEDIR_SERVER) -emit-llvm -c | ||
|
||
%.bc : %.cpp | ||
$(COMPILE.cc.bc) $(SHLIB_LINK) $(PG_CPPFLAGS) -I$(INCLUDE_SERVER) -o $@ $< | ||
|
||
# determine the name of the duckdb library that is built | ||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Darwin) | ||
DUCKDB_LIB = libduckdb.dylib | ||
endif | ||
ifeq ($(UNAME_S),Linux) | ||
DUCKDB_LIB = libduckdb.so | ||
endif | ||
|
||
all: duckdb $(OBJS) | ||
|
||
include $(PGXS) | ||
|
||
duckdb: third_party/duckdb third_party/duckdb/build/$(QUACK_BUILD_DUCKDB)/src/$(DUCKDB_LIB) | ||
|
||
third_party/duckdb: | ||
git submodule update --init --recursive | ||
|
||
third_party/duckdb/build/$(QUACK_BUILD_DUCKDB)/src/$(DUCKDB_LIB): | ||
$(MAKE) -C third_party/duckdb $(QUACK_BUILD_DUCKDB) DISABLE_SANITIZER=1 ENABLE_UBSAN=0 BUILD_UNITTESTS=OFF CMAKE_EXPORT_COMPILE_COMMANDS=1 | ||
|
||
install_duckdb: | ||
$(install_bin) -m 755 third_party/duckdb/build/$(QUACK_BUILD_DUCKDB)/src/$(DUCKDB_LIB) $(DESTDIR)$(PG_LIB) | ||
|
||
clean_duckdb: | ||
rm -rf third_party/duckdb/build | ||
|
||
install: install_duckdb | ||
|
||
clean: clean_duckdb | ||
|
||
lintcheck: | ||
clang-tidy $(SRCS) -- -I$(INCLUDEDIR) -I$(INCLUDEDIR_SERVER) -Iinclude $(CPPFLAGS) -std=c++17 | ||
|
||
.depend: | ||
$(RM) -f .depend | ||
$(foreach SRC,$(SRCS),$(CXX) $(CPPFLAGS) -I$(INCLUDEDIR) -I$(INCLUDEDIR_SERVER) -MM -MT $(SRC:.cpp=.o) $(SRC) >> .depend;) | ||
|
||
include .depend |
Oops, something went wrong.