[SCM] PostGIS branch master updated. 3.7.0beta1-19-g54bbfc720

git at osgeo.org git at osgeo.org
Fri Jul 24 09:08:55 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  54bbfc720af0c81db5b972eda8eabff93a44b86a (commit)
      from  f6b40a31677b233a80e7543086b8267089c11f62 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 54bbfc720af0c81db5b972eda8eabff93a44b86a
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Fri Jul 24 16:48:12 2026 +0400

    ci: add Winnie EDB cleanup helper
    
    Add a repository-owned helper for the Jenkins PG_ED_STOP step used by Winnie.
    
    The helper stops the target cluster, terminates stale postgres.exe processes matching the data directory or PGPORT, recreates the data directory, and retries initdb once when PostgreSQL reports a pre-existing shared memory block.

diff --git a/ci/winnie/pg_ed_stop.sh b/ci/winnie/pg_ed_stop.sh
new file mode 100644
index 000000000..2497cbb5e
--- /dev/null
+++ b/ci/winnie/pg_ed_stop.sh
@@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+
+# Reset the EDB PostgreSQL cluster used by Winnie before PostGIS regression
+# jobs.  This script is intended to replace the Jenkins-managed PG_ED_STOP
+# batch so the cleanup logic lives with the rest of the Winnie CI scripts.
+
+set -e
+
+# shellcheck source=ci/winnie/winnie_common.sh
+. "$(dirname "$0")/winnie_common.sh"
+
+if [ -z "${PGPORT:-}" ]; then
+  echo "PGPORT is required"
+  exit 1
+fi
+
+PGDATA="${PGPATHEDB}/data_${PGPORT}"
+LOGFILE="${PGPATHEDB}/logfile_${PGPORT}"
+INITDB_LOG="${PGPATHEDB}/initdb_${PGPORT}.log"
+
+echo "Resetting Winnie PostgreSQL ${PG_VER} ${OS_BUILD}-bit cluster on port ${PGPORT}"
+echo "PGPATHEDB=${PGPATHEDB}"
+echo "PGDATA=${PGDATA}"
+
+win_path() {
+  cygpath -aw "$1" 2>/dev/null || printf "%s\n" "$1"
+}
+
+kill_pid() {
+  pid="$1"
+  if [ -z "${pid}" ] || [ "${pid}" = "0" ]; then
+    return
+  fi
+
+  echo "Terminating stale PostgreSQL process ${pid}"
+  taskkill.exe /PID "${pid}" /T /F || true
+}
+
+kill_postgres_by_port() {
+  netstat.exe -ano -p TCP 2>/dev/null |
+    awk -v port=":${PGPORT}" '
+      $2 ~ port "$" && $NF ~ /^[0-9]+$/ {
+        print $NF
+      }
+    ' |
+    sort -u |
+    while read -r pid; do
+      kill_pid "${pid}"
+    done
+}
+
+kill_postgres_by_command_line() {
+  WINNIE_PGDATA_WIN="$(win_path "${PGDATA}")"
+  WINNIE_PGPATH_WIN="$(win_path "${PGPATHEDB}")"
+  export WINNIE_PGDATA_WIN WINNIE_PGPATH_WIN PGPORT
+
+  # shellcheck disable=SC2016
+  powershell.exe -NoProfile -ExecutionPolicy Bypass -Command '
+    $pgdata = $env:WINNIE_PGDATA_WIN;
+    $pgpath = $env:WINNIE_PGPATH_WIN;
+    $pgport = $env:PGPORT;
+    Get-CimInstance Win32_Process |
+      Where-Object {
+        ($_.Name -eq "postgres.exe") -and (
+          ($_.CommandLine -like "*$pgdata*") -or
+          ($_.CommandLine -like "*$pgpath*data_$pgport*") -or
+          ($_.CommandLine -like "*-p $pgport*")
+        )
+      } |
+      ForEach-Object { $_.ProcessId }
+  ' 2>/dev/null |
+    tr -d '\r' |
+    awk 'NF { print $1 }' |
+    sort -u |
+    while read -r pid; do
+      kill_pid "${pid}"
+    done
+}
+
+clear_stale_postgres_processes() {
+  echo "Checking for stale PostgreSQL processes bound to ${PGDATA} or port ${PGPORT}"
+  kill_postgres_by_command_line
+  kill_postgres_by_port
+}
+
+stop_cluster() {
+  if [ -x "${PGPATHEDB}/bin/pg_ctl" ]; then
+    "${PGPATHEDB}/bin/pg_ctl" -D "${PGDATA}" -l "${LOGFILE}" stop || true
+  fi
+}
+
+initialize_cluster() {
+  rm -f "${INITDB_LOG}"
+  "${PGPATHEDB}/bin/initdb" -D "${PGDATA}" -E=UTF8 -U postgres -A trust > "${INITDB_LOG}" 2>&1
+}
+
+cd "${PGPATHEDB}"
+
+stop_cluster
+clear_stale_postgres_processes
+rm -rf "${PGDATA}"
+
+if ! initialize_cluster; then
+  cat "${INITDB_LOG}"
+  if grep -q "pre-existing shared memory block is still in use" "${INITDB_LOG}"; then
+    echo "initdb found stale PostgreSQL shared memory; terminating matching processes and retrying once"
+    clear_stale_postgres_processes
+    rm -rf "${PGDATA}"
+    initialize_cluster
+  else
+    exit 1
+  fi
+fi
+
+"${PGPATHEDB}/bin/pg_ctl" -D "${PGDATA}" -l "${LOGFILE}" -o "-F -p ${PGPORT}" start
+"${PGPATHEDB}/bin/pg_ctl" -D "${PGDATA}" -l "${LOGFILE}" stop

-----------------------------------------------------------------------

Summary of changes:
 ci/winnie/pg_ed_stop.sh | 116 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 ci/winnie/pg_ed_stop.sh


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list