Merge pull request #186 from darkfronza/PG-351_add_pgsm_settings_view_api_check

PG-351: Add pg_stat_monitor_settings api check.
pull/196/head
Ibrar Ahmed 2022-02-24 18:05:18 +05:00 committed by GitHub
commit fdd984042e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -48,7 +48,7 @@ function usage() {
usage usage
} }
[ "$1" = "-h" -o "$1" = "--help"] && [ "$1" = "-h" -o "$1" = "--help" ] &&
{ {
usage usage
} }
@ -137,6 +137,7 @@ function cleanup() {
rm -f pgconf.orig rm -f pgconf.orig
fi fi
rm -f pgsm.conf rm -f pgsm.conf
git checkout $ORIG_BRANCH
} }
trap cleanup EXIT trap cleanup EXIT
@ -179,6 +180,8 @@ function dump_pgsm_api() {
"$PSQL" -c 'DROP EXTENSION IF EXISTS pg_stat_monitor;' 2> /dev/null "$PSQL" -c 'DROP EXTENSION IF EXISTS pg_stat_monitor;' 2> /dev/null
"$PSQL" -c 'CREATE EXTENSION pg_stat_monitor;' 2> /dev/null "$PSQL" -c 'CREATE EXTENSION pg_stat_monitor;' 2> /dev/null
"$PSQL" -c '\d pg_stat_monitor' 2> /dev/null > api_pgsmview."${BRANCH}" "$PSQL" -c '\d pg_stat_monitor' 2> /dev/null > api_pgsmview."${BRANCH}"
"$PSQL" -c '\d pg_stat_monitor_settings' 2> /dev/null > api_pgsm_settings."${BRANCH}"
"$PSQL" -c 'SELECT * FROM pg_stat_monitor_settings' 2> /dev/null > api_pgsm_settings_values."${BRANCH}"
"$PSQL" -c '\d pg_stat_monitor_errors' 2> /dev/null > api_pgsmerrview."${BRANCH}" "$PSQL" -c '\d pg_stat_monitor_errors' 2> /dev/null > api_pgsmerrview."${BRANCH}"
"$PSQL" -c '\sf histogram' 2> /dev/null > api_histogramfn."${BRANCH}" "$PSQL" -c '\sf histogram' 2> /dev/null > api_histogramfn."${BRANCH}"
"$PSQL" -c '\sf pg_stat_monitor_reset' 2> /dev/null > api_resetfn."${BRANCH}" "$PSQL" -c '\sf pg_stat_monitor_reset' 2> /dev/null > api_resetfn."${BRANCH}"
@ -215,7 +218,7 @@ then
fi fi
# Remove temporary source branch (if created). # Remove temporary source branch (if created).
[ -z "${TMP_SRC_BRANCH}"] || git branch -D "${TMP_SRC_BRANCH}" [ -z "${TMP_SRC_BRANCH}" ] || git branch -D "${TMP_SRC_BRANCH}"
echo "[*] Dumping API (${TARGET_BRANCH})..." echo "[*] Dumping API (${TARGET_BRANCH})..."
dump_pgsm_api "${TARGET_BRANCH}" dump_pgsm_api "${TARGET_BRANCH}"
@ -230,9 +233,10 @@ echo "[*] ------ API comparison results ------"
echo "[*]" echo "[*]"
# Input files # Input files
INPUT=(api_pgsmview api_pgsmerrview api_histogramfn api_resetfn api_reseterrfn) INPUT=(api_pgsmview api_pgsm_settings api_pgsm_settings_values api_pgsmerrview api_histogramfn api_resetfn api_reseterrfn)
# Real API object names. # Real API object names.
API_OBJECTS=("pg_stat_monitor" "pg_stat_monitor_errors" "histogram" "pg_stat_monitor_reset" "pg_stat_monitor_reset_errors") API_OBJECTS=("pg_stat_monitor" "pg_stat_monitor_settings"
"pg_stat_monitor_settings(values)" "pg_stat_monitor_errors" "histogram" "pg_stat_monitor_reset" "pg_stat_monitor_reset_errors")
STATUS=0 STATUS=0
i=0 i=0