Skip to content

Detect patchset version automatically with Meson too #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 45 commits into
base: patches16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
806dbc0
Custom user shared invalidation message
akorotkov Dec 12, 2021
9bba509
CacheInvalidateRelcacheByDbidRelid()
akorotkov Dec 12, 2021
a2309b3
CommitSeqNo data type
akorotkov Dec 12, 2021
47a39c7
Custom TOAST
akorotkov Dec 12, 2021
7862dff
Allow locking updated tuples in tuple_update() and tuple_delete()
akorotkov Mar 22, 2023
d26db9e
Add EvalPlanQual delete returning isolation test
anarazel Mar 22, 2023
89e4d47
Improvements to TableAM API
akorotkov Dec 12, 2021
2a7e944
Hook for custom error cleanup
akorotkov Dec 12, 2021
32f225b
Snapshot extension and hooks
akorotkov Dec 12, 2021
cdc5d3f
Hooks for builtin functions and datatypes and orioledb recovery
akorotkov Dec 12, 2021
c775144
Recovery and checkpointer hooks
akorotkov Dec 12, 2021
66ffd88
Allow skipping logging for AccessExclusiveLock
akorotkov Dec 12, 2021
104a6c3
Add convenience functions
akorotkov Dec 12, 2021
5e46375
PERFORM_DELETION_OF_RELATION flag for object hooks
akorotkov Dec 12, 2021
b2cab21
Expose existing planning funcs and structs
akorotkov Dec 12, 2021
5496ad4
Allow locks in checkpointer
akorotkov Dec 12, 2021
503a751
Add base_init_startup_hook and HandleStartupProcInterrupts_hook
akorotkov Dec 13, 2021
ff119e5
Don't cancel recovery processes because of deadlocks
akorotkov Dec 13, 2021
447bc97
set_plain_rel_pathlist_hook
akorotkov Dec 13, 2021
8c4540c
Let locker tolerate being removed from the waiting queue without obta…
akorotkov Dec 13, 2021
62984a8
Count extension wait events in pg_isolation_test_session_is_blocked()
akorotkov Feb 17, 2022
818f0d4
Support for custom table AM in pgbench
akorotkov Feb 24, 2022
c165ad8
Support for outline atomics on aarch64
akorotkov Mar 2, 2022
6f9d6e5
OrioleDB specific CI
akorotkov Feb 17, 2022
7507685
Close indices in AttachPartitionEnsureIndexes() before DefineIndex()
akorotkov Apr 8, 2023
58b411a
New BGWORKER_CLASS_SYSTEM bgworkers class
akorotkov Jun 29, 2023
71907c6
Add pg_newlocale_from_collation_hook to perform stricter collation ch…
homper Sep 7, 2023
31ee509
Archive preload callback
akorotkov Jul 12, 2023
cfa69d1
Remove pthread_is_threaded_np() call
akorotkov Feb 18, 2024
73f1c62
Added option to pg_rewind to perform extension specific rewind
homper Dec 8, 2023
dfa97f5
Index scan and index only scan with rowid
homper May 3, 2024
e56d0e7
Remove primary index am check
homper May 8, 2024
c3e9f05
Passing tupleid to insert now
homper May 13, 2024
e556905
Methods for index update and delete
homper May 16, 2024
9774eb4
Hook to override index AM routine
akorotkov Aug 12, 2024
f9b8cd9
Always building child/root maps for relations with ROW_REF_ROWID
homper Sep 4, 2024
ab0b3eb
Don't run internal btree _bt_getrootheight on non-btree in get_relati…
homper Aug 20, 2024
3833e5d
Fix handling tupleid in logical replication
akorotkov Sep 16, 2024
24fb478
New CSN snapshot format
homper Sep 27, 2024
f5f12ce
Restart archiver during PM_SHUTDOWN postmaster stage
akorotkov Oct 3, 2024
bf4510e
Add handling of CSN snapshot in some places of snapbuild.c
akorotkov Oct 8, 2024
7e50554
Move CheckPoint_hook() call after CheckPointBuffers()
akorotkov Oct 14, 2024
3e6f16b
Restore GetIndexAmRoutine signature for compatibility with other callers
pashkinelfe Oct 15, 2024
6aeb4e4
Make index insert compatible with outside callers
pashkinelfe Oct 16, 2024
050b9c5
Detect patchset version automatically with Meson too
kou Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: build

on:
push:
pull_request:

jobs:
test:
runs-on:
- ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
check_type: [normal, debug]
env:
LLVM_VER: 10
COMPILER: ${{ matrix.compiler }}
CHECK_TYPE: ${{ matrix.check_type }}
steps:
- name: Checkout code into workspace directory
uses: actions/checkout@v2
- name: Setup prerequisites
run: bash ./ci/prerequisites.sh
- name: Build
run: bash ./ci/build.sh
- name: Check
run: bash ./ci/check.sh
- name: Check output
run: bash ./ci/check_output.sh
if: ${{ success() || failure() }}
21 changes: 21 additions & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -eu

if [ $COMPILER = "clang" ]; then
export CC=clang-$LLVM_VER
else
export CC=gcc
fi

# configure & build
if [ $CHECK_TYPE = "debug" ]; then
CFLAGS="-O0" ./configure --enable-debug --enable-cassert --enable-tap-tests --with-icu
else
./configure --disable-debug --disable-cassert --enable-tap-tests --with-icu
fi

make -sj4
cd contrib
make -sj4
cd ..
11 changes: 11 additions & 0 deletions ci/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -eu

# unsets limit for coredumps size
ulimit -c unlimited -S
# sets a coredump file pattern
mkdir -p /tmp/cores-$GITHUB_SHA-$TIMESTAMP
sudo sh -c "echo \"/tmp/cores-$GITHUB_SHA-$TIMESTAMP/%t_%p_%s.core\" > /proc/sys/kernel/core_pattern"

make check-world -j4
30 changes: 30 additions & 0 deletions ci/check_output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -eu

status=0

# show diff if it exists
for f in ` find . -name regression.diffs ` ; do
echo "========= Contents of $f"
cat $f
status=1
done

# check core dumps if any
cores=$(find /tmp/cores-$GITHUB_SHA-$TIMESTAMP/ -name '*.core' 2>/dev/null)

if [ -n "$cores" ]; then
for corefile in $cores ; do
if [[ $corefile != *_3.core ]]; then
binary=$(gdb -quiet -core $corefile -batch -ex 'info auxv' | grep AT_EXECFN | perl -pe "s/^.*\"(.*)\"\$/\$1/g")
echo dumping $corefile for $binary
gdb --batch --quiet -ex "thread apply all bt full" -ex "quit" $binary $corefile
status=1
fi
done
fi

rm -rf /tmp/cores-$GITHUB_SHA-$TIMESTAMP

exit $status
22 changes: 22 additions & 0 deletions ci/prerequisites.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -eu

# print the hostname to be able to identify runner by logs
echo "HOSTNAME=`hostname`"
TIMESTAMP=$(date +%s)
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
echo "TIMESTAMP=$TIMESTAMP"

sudo apt-get -y install -qq wget ca-certificates

sudo apt-get update -qq

apt_packages="build-essential flex bison pkg-config libreadline-dev make gdb libipc-run-perl libicu-dev python3 python3-dev python3-pip python3-setuptools python3-testresources"

if [ $COMPILER = "clang" ]; then
apt_packages="$apt_packages llvm-$LLVM_VER clang-$LLVM_VER clang-tools-$LLVM_VER"
fi

# install required packages
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y install -qq $apt_packages
100 changes: 99 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
vpath_build
PG_SYSROOT
ORIOLEDB_PATCHSET_VERSION
PG_VERSION_NUM
LDFLAGS_EX_BE
PROVE
Expand Down Expand Up @@ -6657,6 +6658,99 @@ fi
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
fi
if test x"$host_cpu" == x"aarch64"; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -moutline-atomics, for CFLAGS" >&5
$as_echo_n "checking whether ${CC} supports -moutline-atomics, for CFLAGS... " >&6; }
if ${pgac_cv_prog_CC_cflags__moutline_atomics+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CFLAGS=$CFLAGS
pgac_save_CC=$CC
CC=${CC}
CFLAGS="${CFLAGS} -moutline-atomics"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

int
main ()
{

;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_prog_CC_cflags__moutline_atomics=yes
else
pgac_cv_prog_CC_cflags__moutline_atomics=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$pgac_save_CFLAGS"
CC="$pgac_save_CC"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__moutline_atomics" >&5
$as_echo "$pgac_cv_prog_CC_cflags__moutline_atomics" >&6; }
if test x"$pgac_cv_prog_CC_cflags__moutline_atomics" = x"yes"; then
CFLAGS="${CFLAGS} -moutline-atomics"
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -moutline-atomics, for CXXFLAGS" >&5
$as_echo_n "checking whether ${CXX} supports -moutline-atomics, for CXXFLAGS... " >&6; }
if ${pgac_cv_prog_CXX_cxxflags__moutline_atomics+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_save_CXXFLAGS=$CXXFLAGS
pgac_save_CXX=$CXX
CXX=${CXX}
CXXFLAGS="${CXXFLAGS} -moutline-atomics"
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

int
main ()
{

;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
pgac_cv_prog_CXX_cxxflags__moutline_atomics=yes
else
pgac_cv_prog_CXX_cxxflags__moutline_atomics=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="$pgac_save_CXXFLAGS"
CXX="$pgac_save_CXX"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__moutline_atomics" >&5
$as_echo "$pgac_cv_prog_CXX_cxxflags__moutline_atomics" >&6; }
if test x"$pgac_cv_prog_CXX_cxxflags__moutline_atomics" = x"yes"; then
CXXFLAGS="${CXXFLAGS} -moutline-atomics"
fi


fi
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
Expand Down Expand Up @@ -15706,7 +15800,7 @@ fi
LIBS_including_readline="$LIBS"
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`

for ac_func in backtrace_symbols copyfile getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s posix_fallocate ppoll pthread_is_threaded_np setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l
for ac_func in backtrace_symbols copyfile getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s posix_fallocate ppoll setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
Expand Down Expand Up @@ -19386,6 +19480,10 @@ _ACEOF



# Needed to check postgresql patches git tag during orioledb extension build
ORIOLEDB_PATCHSET_VERSION=`git describe --tags | cut -d'_' -f2`


# If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not
# literally, so that it's possible to override it at build time using
# a command like "make ... PG_SYSROOT=path". This has to be done after
Expand Down
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ if test "$GCC" = yes -a "$ICC" = no; then
if test -n "$NOT_THE_CFLAGS"; then
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
fi
if test x"$host_cpu" == x"aarch64"; then
PGAC_PROG_CC_CFLAGS_OPT([-moutline-atomics])
PGAC_PROG_CXX_CFLAGS_OPT([-moutline-atomics])
fi
elif test "$ICC" = yes; then
# Intel's compiler has a bug/misoptimization in checking for
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
Expand Down Expand Up @@ -1804,7 +1808,6 @@ AC_CHECK_FUNCS(m4_normalize([
memset_s
posix_fallocate
ppoll
pthread_is_threaded_np
setproctitle
setproctitle_fast
strchrnul
Expand Down Expand Up @@ -2414,6 +2417,10 @@ $AWK '{printf "%d%04d", $1, $2}'`"]
AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
AC_SUBST(PG_VERSION_NUM)

# Needed to check postgresql patches git tag during orioledb extension build
[ORIOLEDB_PATCHSET_VERSION=`git describe --tags | cut -d'_' -f2`]
AC_SUBST(ORIOLEDB_PATCHSET_VERSION)

# If we are inserting PG_SYSROOT into CPPFLAGS, do so symbolically not
# literally, so that it's possible to override it at build time using
# a command like "make ... PG_SYSROOT=path". This has to be done after
Expand Down
3 changes: 2 additions & 1 deletion contrib/bloom/blinsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ blbuildempty(Relation index)
*/
bool
blinsert(Relation index, Datum *values, bool *isnull,
ItemPointer ht_ctid, Relation heapRel,
Datum tupleid, Relation heapRel,
IndexUniqueCheck checkUnique,
bool indexUnchanged,
IndexInfo *indexInfo)
Expand All @@ -189,6 +189,7 @@ blinsert(Relation index, Datum *values, bool *isnull,
BlockNumber blkno = InvalidBlockNumber;
OffsetNumber nStart;
GenericXLogState *state;
ItemPointer ht_ctid = DatumGetItemPointer(tupleid);

insertCtx = AllocSetContextCreate(CurrentMemoryContext,
"Bloom insert temporary context",
Expand Down
2 changes: 1 addition & 1 deletion contrib/bloom/bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ extern bool blvalidate(Oid opclassoid);

/* index access method interface functions */
extern bool blinsert(Relation index, Datum *values, bool *isnull,
ItemPointer ht_ctid, Relation heapRel,
Datum tupleid, Relation heapRel,
IndexUniqueCheck checkUnique,
bool indexUnchanged,
struct IndexInfo *indexInfo);
Expand Down
3 changes: 2 additions & 1 deletion contrib/bloom/blutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ blhandler(PG_FUNCTION_ARGS)

amroutine->ambuild = blbuild;
amroutine->ambuildempty = blbuildempty;
amroutine->aminsert = blinsert;
amroutine->aminsert = NULL;
amroutine->aminsertextended = blinsert;
amroutine->ambulkdelete = blbulkdelete;
amroutine->amvacuumcleanup = blvacuumcleanup;
amroutine->amcanreturn = NULL;
Expand Down
1 change: 1 addition & 0 deletions contrib/pageinspect/heapfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ tuple_data_split_internal(Oid relid, char *tupdata,
*/
if (VARATT_IS_EXTERNAL(tupdata + off) &&
!VARATT_IS_EXTERNAL_ONDISK(tupdata + off) &&
!VARATT_IS_EXTERNAL_ORIOLEDB(tupdata + off) &&
!VARATT_IS_EXTERNAL_INDIRECT(tupdata + off))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
Expand Down
2 changes: 1 addition & 1 deletion contrib/test_decoding/test_decoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_
/* print data */
if (isnull)
appendStringInfoString(s, "null");
else if (typisvarlena && VARATT_IS_EXTERNAL_ONDISK(origval))
else if (typisvarlena && (VARATT_IS_EXTERNAL_ONDISK(origval) || VARATT_IS_EXTERNAL_ORIOLEDB(origval)))
appendStringInfoString(s, "unchanged-toast-datum");
else if (!typisvarlena)
print_literal(s, typid,
Expand Down
1 change: 1 addition & 0 deletions doc/src/sgml/indexam.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ typedef struct IndexAmRoutine
ambuild_function ambuild;
ambuildempty_function ambuildempty;
aminsert_function aminsert;
aminsert_extended_function aminsertextended;
ambulkdelete_function ambulkdelete;
amvacuumcleanup_function amvacuumcleanup;
amcanreturn_function amcanreturn; /* can be NULL */
Expand Down
10 changes: 10 additions & 0 deletions doc/src/sgml/ref/pg_rewind.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>-e <replaceable class="parameter">path</replaceable></option></term>
<term><option>--extension=<replaceable class="parameter">path</replaceable></option></term>
<listitem>
<para>
Load shared library that performs custom rewind for postgres extension. The <replaceable class="parameter">path</replaceable> may be full or relative to PKGLIBDIR. File extension is optional. Multiple extensions can be selected by multiple <option>-e</option> switches.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>-V</option></term>
<term><option>--version</option></term>
Expand Down
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ cdata.set('PG_VERSION_NUM', pg_version_num)
# PG_VERSION_STR is built later, it depends on compiler test results
cdata.set_quoted('CONFIGURE_ARGS', '')

git_describe_tags = run_command('git', 'describe', '--tags', check: true)
orioledb_patchset_version = git_describe_tags.stdout().strip().split('_')[1]


###############################################################
Expand Down Expand Up @@ -2539,7 +2541,6 @@ func_checks = [
['posix_fallocate'],
['ppoll'],
['pthread_barrier_wait', {'dependencies': [thread_dep]}],
['pthread_is_threaded_np', {'dependencies': [thread_dep]}],
['sem_init', {'dependencies': [rt_dep, thread_dep], 'skip': sema_kind != 'unnamed_posix', 'define': false}],
['setproctitle', {'dependencies': [util_dep]}],
['setproctitle_fast'],
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile.global.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ VERSION_NUM = @PG_VERSION_NUM@

PACKAGE_URL = @PACKAGE_URL@

# OrioleDB patchset git tag number
ORIOLEDB_PATCHSET_VERSION = @ORIOLEDB_PATCHSET_VERSION@

# Set top_srcdir, srcdir, and VPATH.
ifdef PGXS
top_srcdir = $(top_builddir)
Expand Down
Loading