Skip to content

Commit

Permalink
Fix tests (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgguru authored Feb 5, 2024
1 parent e12a283 commit 272acb0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ jobs:
pg: [16, 15, 14, 13, 12]
name: 🐘 PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container:
image: pgxn/pgxn-tools
options: -e AS_USER=pgtest
container: pgxn/pgxn-tools
steps:
- run: pg-start ${{ matrix.pg }}
- uses: actions/checkout@v4
- run: pg-build-test
- run: chown -R postgres:postgres .
- run: gosu postgres pg-build-test
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ jobs:
release:
name: Release on PGXN
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
container:
image: pgxn/pgxn-tools
options: "-e AS_USER=pgtest"
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"prereqs": {
"runtime": {
"requires": {
"PostgreSQL": ">= 12.0.0"
"PostgreSQL": "12.0.0"
}
}
},
"resources": {
"bugtracker": {
"web": "https://github.com/CrunchyData/pg_kaboom/issues/"
"web": "https://github.com/pgguru/pg_kaboom/issues/"
},
"repository": {
"url": "git://github.com/CrunchyData/pg_kaboom.git",
"web": "https://github.com/CrunchyData/pg_kaboom/",
"url": "git://github.com/pgguru/pg_kaboom.git",
"web": "https://github.com/pgguru/pg_kaboom/",
"type": "git"
}
},
Expand Down
13 changes: 11 additions & 2 deletions pg_kaboom.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@

#define PG_KABOOM_DISCLAIMER "I can afford to lose this data and server"

#define PG_MAJOR_VERSION (PG_VERSION_NUM / 100)

/* compatibility macros */
#if PG_MAJOR_VERSION < 1600
#define GET_BEENTRY(i) pgstat_fetch_stat_beentry(i);
#else
#define GET_BEENTRY(i) pgstat_get_beentry_by_backend_id(i);
#endif


#define WPN_ARGS Jsonb *payload, char *arg

/* function signature for the weapon implementation; "payload" is for weapon customization; "arg" is
Expand Down Expand Up @@ -489,8 +499,7 @@ static pid_t find_random_pid_of_type(char *type) {

/* do a linear wrapping search through the array starting at the random offset */
for (i = startIdx; i != startIdx || is_first; i = ((i + 1) >= num_procs ? 0 : i + 1), is_first = false) {
PgBackendStatus *st = pgstat_fetch_stat_beentry(i);

PgBackendStatus *st = GET_BEENTRY(i);
if (st && st->st_procpid > 0 && st->st_procpid != MyProcPid) {
/* check for correct backend type and exit loop if so */
if (st->st_backendType == backend_type) {
Expand Down

0 comments on commit 272acb0

Please sign in to comment.