Skip to content
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

PG-564 #349

Closed
wants to merge 11 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/postgresql-11-pmm.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ jobs:
build:
name: pg-11-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
@@ -18,7 +18,7 @@ jobs:
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor

- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=11
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=11 --pgstat-monitor-branch=REL_1_1_1

- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
4 changes: 2 additions & 2 deletions .github/workflows/postgresql-12-pmm.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ jobs:
build:
name: pg-12-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
@@ -18,7 +18,7 @@ jobs:
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor

- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=12
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=12 --pgstat-monitor-branch=REL_1_1_1

- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
4 changes: 2 additions & 2 deletions .github/workflows/postgresql-13-pmm.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ jobs:
build:
name: pg-13-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
@@ -18,7 +18,7 @@ jobs:
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor

- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=13
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=13 --pgstat-monitor-branch=REL_1_1_1

- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
4 changes: 2 additions & 2 deletions .github/workflows/postgresql-14-pmm.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ jobs:
build:
name: pg-14-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
@@ -18,7 +18,7 @@ jobs:
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor

- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=14
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=14 --pgstat-monitor-branch=REL_1_1_1

- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
121 changes: 121 additions & 0 deletions .github/workflows/postgresql-15-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: postgresql-15-build
on: ["push", "pull_request"]

jobs:
build:
name: pg-15-build-test
runs-on: ubuntu-22.04
steps:
- name: Clone postgres repository
uses: actions/checkout@v2
with:
repository: 'postgres/postgres'
ref: 'REL_15_STABLE'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt purge postgresql-client-common postgresql-common postgresql postgresql*
sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex libipc-run-perl -y docbook-xsl docbook-xsl
sudo apt-get install -y libxml2 libxml2-utils libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev libsystemd-dev gettext tcl-dev libperl-dev
sudo apt-get install -y pkg-config clang-11 llvm-11 llvm-11-dev libselinux1-dev uuid-dev liblz4-dev
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
sudo rm -rf /usr/lib/postgresql
sudo rm -rf /usr/include/postgresql
sudo rm -rf /usr/share/postgresql
sudo rm -rf /etc/postgresql
sudo rm -f /usr/bin/pg_config
sudo /usr/bin/perl -MCPAN -e 'install IPC::RUN'
sudo /usr/bin/perl -MCPAN -e 'install String::Util'
sudo /usr/bin/perl -MCPAN -e 'install Data::Str2Num'

- name: Create pgsql dir
run: mkdir -p /opt/pgsql

- name: Build postgres
run: |
export PATH="/opt/pgsql/bin:$PATH"
./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' \
'--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' \
'--sysconfdir=/etc' '--localstatedir=/var' \
'--libdir=${prefix}/lib/x86_64-linux-gnu' \
'--libexecdir=${prefix}/lib/x86_64-linux-gnu' \
'--with-icu' '--with-tcl' '--with-perl' \
'--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' \
'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/15/man' \
'--docdir=/usr/share/doc/postgresql-doc-15' \
'--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' \
'--datadir=/usr/share/postgresql/15' '--bindir=/usr/lib/postgresql/15/bin' \
'--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' \
'--includedir=/usr/include/postgresql/' \
'--enable-nls' '--enable-thread-safety' '--enable-tap-tests' '--enable-debug' \
'--enable-dtrace' '--disable-rpath' '--with-uuid=e2fs' '--with-gnu-ld' \
'--with-pgport=5432' '--with-system-tzdata=/usr/share/zoneinfo' '--with-llvm' \
'LLVM_CONFIG=/usr/bin/llvm-config-11' 'CLANG=/usr/bin/clang-11' \
'--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' 'PROVE=/usr/bin/prove' \
'TAR=/bin/tar' 'XSLTPROC=xsltproc --nonet' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' '--with-gssapi' '--with-ldap' \
'build_alias=x86_64-linux-gnu' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \
'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'
make world
sudo make install-world

- name: Start postgresql cluster
run: |
/usr/lib/postgresql/15/bin/initdb -D /opt/pgsql/data
/usr/lib/postgresql/15/bin/pg_ctl -D /opt/pgsql/data -l logfile start

- name: Clone pg_stat_monitor repository
uses: actions/checkout@v2
with:
path: 'src/pg_stat_monitor'

- name: Build pg_stat_monitor
run: |
export PATH="/usr/lib/postgresql/15/bin:$PATH"
sudo cp /usr/lib/postgresql/15/bin/pg_config /usr/bin
make USE_PGXS=1
sudo make USE_PGXS=1 install
working-directory: src/pg_stat_monitor/

- name: Load pg_stat_monitor library and Restart Server
run: |
/usr/lib/postgresql/15/bin/pg_ctl -D /opt/pgsql/data -l logfile stop
echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf
/usr/lib/postgresql/15/bin/pg_ctl -D /opt/pgsql/data -l logfile start
working-directory: src/pg_stat_monitor/

- name: Start pg_stat_monitor_tests
run: |
make installcheck
working-directory: src/pg_stat_monitor/

- name: Change dir permissions on fail
if: ${{ failure() }}
run: |
sudo chmod -R ugo+rwx t
sudo chmod -R ugo+rwx tmp_check
exit 2 # regenerate error so that we can upload files in next step
working-directory: src/pg_stat_monitor/

- name: Upload logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Regressions diff and postgresql log
path: |
src/pg_stat_monitor/regression.diffs
src/pg_stat_monitor/regression.out
src/pg_stat_monitor/logfile
src/pg_stat_monitor/t/results/
src/pg_stat_monitor/tmp_check/log/
!src/pg_stat_monitor/tmp_check/**/archives/*
!src/pg_stat_monitor/tmp_check/**/backup/*
!src/pg_stat_monitor/tmp_check/**/pgdata/*
!src/pg_stat_monitor/tmp_check/**/archives/
!src/pg_stat_monitor/tmp_check/**/backup/
!src/pg_stat_monitor/tmp_check/**/pgdata/
if-no-files-found: warn
retention-days: 3
33 changes: 33 additions & 0 deletions .github/workflows/postgresql-15-pmm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: postgresql-15-pmm-integration
on: push

jobs:
build:
name: pg-15-pgsm-pmm-integration-test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Clone QA Integration repository
uses: actions/checkout@v2
with:
repository: 'Percona-Lab/qa-integration'
ref: 'main'

# print branch and Repo name
- name: Get branch and Repo Name
run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor

- name: Run PMM & PGSM Setup, E2E Tests
run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=15 --pgstat-monitor-branch=REL_1_1_1

- name: Get PMM-Agent Logs from the Container
if: success() || failure() # run this step even if previous step failed
run: docker exec pgsql_pgsm_15 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log

- name: Upload Tests Artifacts
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: tests-artifact
path: ./pmm-ui-tests/tests/output/
if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn`
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "pg_stat_monitor",
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"description": "pg_stat_monitor is a PostgreSQL Query Performance Monitoring tool, based on PostgreSQL's contrib module pg_stat_statements. PostgreSQL’s pg_stat_statements provides the basic statistics, which is sometimes not enough. The major shortcoming in pg_stat_statements is that it accumulates all the queries and their statistics and does not provide aggregated statistics nor histogram information. In this case, a user would need to calculate the aggregates, which is quite an expensive operation.",
"version": "1.1.0",
"version": "1.1.1",
"maintainer": [
"ibrar.ahmed@percona.com"
],
@@ -12,7 +12,7 @@
"abstract": "PostgreSQL Query Performance Monitoring Tool",
"file": "pg_stat_monitor--1.0.sql",
"docfile": "README.md",
"version": "1.1.0"
"version": "1.1.1"
}
},
"prereqs": {
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ REGRESS = basic version guc counters relations database error_insert application
PG_CONFIG = pg_config
PGSM_INPUT_SQL_VERSION := 1.0

PG_CPPFLAGS += -std=c99 -g -ggdb

ifdef USE_PGXS
MAJORVERSION := $(shell pg_config --version | awk {'print $$2'} | cut -f1 -d".")
PGXS := $(shell $(PG_CONFIG) --pgxs)
@@ -48,3 +50,8 @@ endif
clean:
rm -rf ${DATA}
rm -rf t/results
rm -rf /experdb/app/postgres/lib/pg_stat_monitor.so
rm -rf /experdb/app/postgres/share/extension/pg_stat_monitor.control
rm -rf /experdb/app/postgres/share/extension/pg_stat_monitor--1.0.sql
rm -rf *.o
rm -rf *.so
7 changes: 7 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

Below is the complete list of release notes for every version of ``pg_stat_monitor``.

## 1.1.1

### Bugs Fixed

[PG-520](https://jira.percona.com/browse/PG-520): pg_stat_monitor does not work with PostgreSQL15


## 1.1.0

### Improvements
14 changes: 14 additions & 0 deletions guc.c
Original file line number Diff line number Diff line change
@@ -237,6 +237,20 @@ init_guc(void)
.guc_value = &PGSM_TRACK_PLANNING
};
DefineBoolGUC(&conf[i++]);
#ifdef BINDPARAM
conf[i] = (GucVariable)
{
.guc_name = "pg_stat_monitor.pgsm_extract_bind_variables",
.guc_desc = "Selects whether extracting bind variables from queries.",
.guc_default = 0,
.guc_min = 0,
.guc_max = 0,
.guc_restart = false,
.guc_unit = 0,
.guc_value = &PGSM_EXTRACT_VARIABLES
};
DefineBoolGUC(&conf[i++]);
#endif
#endif
}

3 changes: 2 additions & 1 deletion pg_stat_monitor--1.0.13.sql.in
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ CREATE FUNCTION pg_stat_monitor_internal(IN showtext boolean,
OUT top_queryid text,
OUT top_query text,
OUT application_name text,

OUT bind_variables text,
OUT relations text, -- 11
OUT cmd_type int,
OUT elevel int,
@@ -157,6 +157,7 @@ CREATE VIEW pg_stat_monitor AS SELECT
query_plan,
top_query,
application_name,
bind_variables,
string_to_array(relations, ',') AS relations,
cmd_type,
get_cmd_type(cmd_type) AS cmd_type_text,
3 changes: 2 additions & 1 deletion pg_stat_monitor--1.0.14.sql.in
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ CREATE FUNCTION pg_stat_monitor_internal(IN showtext boolean,
OUT top_queryid text,
OUT top_query text,
OUT application_name text,

OUT bind_variables text,
OUT relations text, -- 11
OUT cmd_type int,
OUT elevel int,
@@ -158,6 +158,7 @@ CREATE VIEW pg_stat_monitor AS SELECT
query_plan,
top_query,
application_name,
bind_variables,
string_to_array(relations, ',') AS relations,
cmd_type,
get_cmd_type(cmd_type) AS cmd_type_text,
3 changes: 2 additions & 1 deletion pg_stat_monitor--1.0.15.sql.in
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ CREATE FUNCTION pg_stat_monitor_internal(IN showtext boolean,
OUT top_queryid text,
OUT top_query text,
OUT application_name text,

OUT bind_variables text,
OUT relations text, -- 11
OUT cmd_type int,
OUT elevel int,
@@ -158,6 +158,7 @@ CREATE VIEW pg_stat_monitor AS SELECT
query_plan,
top_query,
application_name,
bind_variables,
string_to_array(relations, ',') AS relations,
cmd_type,
get_cmd_type(cmd_type) AS cmd_type_text,
Loading