Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion .github/scripts/build-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ case "$1" in
export CFLAGS="-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fno-inline-functions"
;;

exec-backend)
echo "Building with exec-backend option"
export CFLAGS="-DEXEC_BACKEND"
ARGS+=" --enable-cassert"
;;

*)
echo "Unknown build type: $1"
echo "Please use one of the following: debug, debugoptimized, sanitize"
echo "Please use one of the following: debug, debugoptimized, sanitize, exec-backend"
exit 1
;;
esac
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ case "$1" in
echo "Building with debug option"
;;

debugoptimized)
debugoptimized | exec-backend)
echo "Building with debugoptimized option"
PG_CFLAGS+=" -O2"
;;
Expand All @@ -29,7 +29,7 @@ case "$1" in

*)
echo "Unknown build type: $1"
echo "Please use one of the following: debug, debugoptimized, sanitize"
echo "Please use one of the following: debug, debugoptimized, sanitize, exec-backend"
exit 1
;;
esac
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ jobs:
build_type: ${{ matrix.build_type }}
secrets: inherit

exec_backend:
name: EXEC_BACKEND
strategy:
fail-fast: false
matrix:
pg_package: [source]
pg_version: [14, 15, 16, 17, 18]
os: [ubuntu-24.04]
compiler: [gcc]
build_type: [exec-backend]
uses: ./.github/workflows/build-and-test.yml
with:
pg_package: ${{ matrix.pg_package }}
pg_version: ${{ matrix.pg_version }}
os: ${{ matrix.os }}
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
secrets: inherit

macos:
name: MacOS
strategy:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## [Unreleased]

### Added

- Support for `EXEC_BACKEND` builds ([PG-2547](https://perconadev.atlassian.net/browse/PG-2547))
9 changes: 2 additions & 7 deletions src/hash_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ pgsm_startup(void)
dsa_pin(dsa);
dsa_set_size_limit(dsa, pgsm_query_area_size());

pgsm->hash_handle = pgsm_create_bucket_hash();

/*
* If overflow is enabled, set the DSA size to unlimited, and allow
* the DSA to grow beyond the shared memory space into the swap area
Expand All @@ -137,13 +135,14 @@ pgsm_startup(void)
dsa_detach(dsa);
}

pgsmStateLocal.shared_hash = pgsm_create_bucket_hash();

LWLockRelease(AddinShmemInitLock);

pgsmStateLocal.shared_pgsmState = pgsm;

/* Reset in case this is a restart within the postmaster */
pgsmStateLocal.dsa = NULL;
pgsmStateLocal.shared_hash = NULL;
}

/*
Expand Down Expand Up @@ -190,7 +189,6 @@ pgsm_attach_shmem(void)
* explicit detach.
*/
dsa_pin_mapping(pgsmStateLocal.dsa);
pgsmStateLocal.shared_hash = pgsmStateLocal.shared_pgsmState->hash_handle;
MemoryContextSwitchTo(oldcontext);
}

Expand Down Expand Up @@ -255,9 +253,6 @@ hash_entry_dealloc(int bucket_id)
HASH_SEQ_STATUS hstat;
pgsmEntry *entry;

if (!pgsmStateLocal.shared_hash)
return;

/* Iterate over the hash table. */
hash_seq_init(&hstat, pgsmStateLocal.shared_hash);

Expand Down
2 changes: 0 additions & 2 deletions src/hash_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <storage/lwlock.h>
#include <storage/spin.h>
#include <utils/dsa.h>
#include <utils/hsearch.h>
#include <utils/timestamp.h>

#define ERROR_MESSAGE_LEN 100
Expand Down Expand Up @@ -200,7 +199,6 @@ typedef struct pgsmSharedState
pg_atomic_uint64 current_wbucket;
pg_atomic_uint64 prev_bucket_sec;
void *raw_dsa_area; /* DSA area pointer to store query texts */
HTAB *hash_handle;

bool pgsm_oom;
TimestampTz bucket_start_time[]; /* start time of the bucket */
Expand Down
Loading