From f7588532be85a2f6e0c14bae746adeeca46316d4 Mon Sep 17 00:00:00 2001 From: Naeem Akhter Date: Thu, 23 Sep 2021 03:10:06 +0500 Subject: [PATCH] PG-226: Enable installcheck-world regression. 1) Enabled configure and build with proper flags and environment to make sure that built server is aligned with pg and ppg package distribution in terms of features and configurations. Earlier build (configure) was not aligned with pg community standard configuration that are used for community builds and distribution. 2) Enabled installcheck-world regression test suites of the pg server, to verify the stability and compatibility of pg server after loading pg_stat_monitor in server. 3) Change in expected files of error.out and error_1.out for error testacase. 4) Disbaled and removed coverage using coveralls.io, as it was not serving the purpose. (Note: installcheck-world was failing on pg-14 due to some changes that are done in pg14 or upstream PGSS, and that is causing additional line (Query Identifier) is output of some of the test cases of installcheck-world so it is not enabled in this commit. Problem with pg14 server installcheck regression is output of an extra line (Query identifier ****) in some of the test cases after loading extension PGSM and that causes regression to fail for server after library load.) --- .github/workflows/coverage_test.yml | 68 ------------------------ .github/workflows/pg11test.yml | 81 +++++++++++++++++++++-------- .github/workflows/pg12test.yml | 75 ++++++++++++++++++-------- .github/workflows/pg13test.yml | 80 ++++++++++++++++++++-------- .github/workflows/pg14test.yml | 66 +++++++++++++++-------- README.md | 2 - regression/expected/error.out | 6 +-- regression/expected/error_1.out | 6 +-- 8 files changed, 220 insertions(+), 164 deletions(-) delete mode 100644 .github/workflows/coverage_test.yml diff --git a/.github/workflows/coverage_test.yml b/.github/workflows/coverage_test.yml deleted file mode 100644 index 55304c4..0000000 --- a/.github/workflows/coverage_test.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: coverage-test -on: ["push", "pull_request"] - -jobs: - build: - name: coverage-test - runs-on: ubuntu-latest - steps: - - name: Clone postgres repository - uses: actions/checkout@v2 - with: - repository: 'postgres/postgres' - ref: 'REL_13_STABLE' - - - name: Clone pg_stat_monitor repository - uses: actions/checkout@v2 - with: - path: 'src/pg_stat_monitor' - ref: 'master' - - - 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 python-dev bison flex libipc-run-perl git lcov -y - 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 - - name: Create pgsql dir - run: mkdir -p /opt/pgsql - - - name: Build postgres - run: | - export PATH="/opt/pgsql/bin:$PATH" - ./configure --enable-coverage --enable-tap-tests --prefix=/opt/pgsql - make - make install - - name: Start postgresql cluster - run: | - export PATH="/opt/pgsql/bin:$PATH" - /opt/pgsql/bin/initdb -D /opt/pgsql/data - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start - - name: Build pg_stat_monitor - run: | - export PATH="/opt/pgsql/bin:$PATH" - sudo cp /opt/pgsql/bin/pg_config /usr/bin - make USE_PGXS=1 - make USE_PGXS=1 install - working-directory: src/pg_stat_monitor/ - - - name: Start pg_stat_monitor_tests & Run code coverage - run: | - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop - echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start - make installcheck - make coverage-html - lcov --capture --directory . --output-file coverage/lcov.info - pip install cpp-coveralls - export COVERALLS_REPO_TOKEN="${{ secrets.COVERALL_PG_STAT_MONITOR_TOKEN }}" - coveralls --verbose - working-directory: src/pg_stat_monitor/ - diff --git a/.github/workflows/pg11test.yml b/.github/workflows/pg11test.yml index 57ea811..a1f7e53 100644 --- a/.github/workflows/pg11test.yml +++ b/.github/workflows/pg11test.yml @@ -1,10 +1,10 @@ -name: pg11-test +name: Test-with-pg11-build on: [push] jobs: build: name: pg11-test - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - name: Clone postgres repository uses: actions/checkout@v2 @@ -12,16 +12,13 @@ jobs: repository: 'postgres/postgres' ref: 'REL_11_STABLE' - - name: Clone pg_stat_monitor repository - uses: actions/checkout@v2 - with: - path: 'src/pg_stat_monitor' - - 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 python-dev bison flex libipc-run-perl -y + sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-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-9 llvm-9 llvm-9-dev libselinux1-dev python-dev python3-dev uuid-dev liblz4-dev sudo rm -rf /var/lib/postgresql/ sudo rm -rf /var/log/postgresql/ sudo rm -rf /etc/postgresql/ @@ -37,34 +34,76 @@ jobs: - name: Build postgres run: | export PATH="/opt/pgsql/bin:$PATH" - ./configure --enable-tap-tests --prefix=/opt/pgsql - make - make install + ./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=/usr/include' \ + '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc' \ + '--localstatedir=/var' '--disable-silent-rules' '--libdir=/usr/lib/x86_64-linux-gnu' \ + 'runstatedir=/run' '--disable-maintainer-mode' '--disable-dependency-tracking' \ + '--with-icu' '--with-tcl' '--with-perl' '--with-python' '--with-pam' '--with-openssl' \ + '--with-libxml' '--with-libxslt' 'PYTHON=/usr/bin/python3' \ + '--mandir=/usr/share/postgresql/11/man' '--docdir=/usr/share/doc/postgresql-doc-11' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' \ + '--datadir=/usr/share/postgresql/11' '--bindir=/usr/lib/postgresql/11/bin' \ + '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' \ + '--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 11.x.pgdg20.04+1)' \ + '--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-9' 'CLANG=/usr/bin/clang-9' '--with-systemd' \ + '--with-selinux' 'MKDIR_P=/bin/mkdir -p' 'PROVE=/usr/bin/prove' 'TAR=/bin/tar' \ + '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' \ + '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' \ + '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' '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: | - export PATH="/opt/pgsql/bin:$PATH" - /opt/pgsql/bin/initdb -D /opt/pgsql/data - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start + /usr/lib/postgresql/11/bin/initdb -D /opt/pgsql/data + /usr/lib/postgresql/11/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="/opt/pgsql/bin:$PATH" - sudo cp /opt/pgsql/bin/pg_config /usr/bin + export PATH="/usr/lib/postgresql/11/bin:$PATH" + sudo cp /usr/lib/postgresql/11/bin/pg_config /usr/bin make USE_PGXS=1 - make USE_PGXS=1 install + 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/11/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/11/bin/pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor/ + + - name: Start Server installcheck-world tests (without TAP) + run: | + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and postgresql log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 1 - name: Start pg_stat_monitor_tests run: | - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop - echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start make installcheck working-directory: src/pg_stat_monitor/ - - name: Report on test fail + - name: Report on pg_stat_monitor test fail uses: actions/upload-artifact@v2 if: ${{ failure() }} with: diff --git a/.github/workflows/pg12test.yml b/.github/workflows/pg12test.yml index 1eee4c2..919614b 100644 --- a/.github/workflows/pg12test.yml +++ b/.github/workflows/pg12test.yml @@ -1,4 +1,4 @@ -name: pg12-test +name: Test-with-pg12-build on: [push] jobs: @@ -12,16 +12,13 @@ jobs: repository: 'postgres/postgres' ref: 'REL_12_STABLE' - - name: Clone pg_stat_monitor repository - uses: actions/checkout@v2 - with: - path: 'src/pg_stat_monitor' - - 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 python-dev bison flex libipc-run-perl -y + sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-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-9 llvm-9 llvm-9-dev libselinux1-dev python-dev python3-dev uuid-dev liblz4-dev sudo rm -rf /var/lib/postgresql/ sudo rm -rf /var/log/postgresql/ sudo rm -rf /etc/postgresql/ @@ -30,41 +27,77 @@ jobs: sudo rm -rf /usr/share/postgresql sudo rm -rf /etc/postgresql sudo rm -f /usr/bin/pg_config - - name: Create pgsql dir run: mkdir -p /opt/pgsql - name: Build postgres run: | export PATH="/opt/pgsql/bin:$PATH" - ./configure --enable-tap-tests --prefix=/opt/pgsql - make - make install + ./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=/usr/include' '--mandir=/usr/share/man' \ + '--infodir=/usr/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' \ + '--libdir=/usr/lib/x86_64-linux-gnu' 'runstatedir=/run' '--disable-maintainer-mode' \ + '--disable-dependency-tracking' '--with-icu' '--with-tcl' '--with-perl' '--with-python' \ + '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' 'PYTHON=/usr/bin/python3' \ + '--mandir=/usr/share/postgresql/12/man' '--docdir=/usr/share/doc/postgresql-doc-12' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' '--datadir=/usr/share/postgresql/12' \ + '--bindir=/usr/lib/postgresql/12/bin' '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' \ + '--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 12.x.pgdg20.04+1)' '--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-9' 'CLANG=/usr/bin/clang-9' '--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' \ + 'PROVE=/usr/bin/prove' 'TAR=/bin/tar' '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' \ + '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' \ + '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' '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: | - export PATH="/opt/pgsql/bin:$PATH" - /opt/pgsql/bin/initdb -D /opt/pgsql/data - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start + /usr/lib/postgresql/12/bin/initdb -D /opt/pgsql/data + /usr/lib/postgresql/12/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="/opt/pgsql/bin:$PATH" - sudo cp /opt/pgsql/bin/pg_config /usr/bin + export PATH="/usr/lib/postgresql/12/bin:$PATH" + sudo cp /usr/lib/postgresql/12/bin/pg_config /usr/bin make USE_PGXS=1 - make USE_PGXS=1 install + 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/12/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/12/bin/pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor/ + + - name: Start Server installcheck-world tests (without TAP) + run: | + make installcheck-world + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and postgresql log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 1 - name: Start pg_stat_monitor_tests run: | - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop - echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start make installcheck working-directory: src/pg_stat_monitor/ - - name: Report on test fail + - name: Report on pg_stat_monitor test fail uses: actions/upload-artifact@v2 if: ${{ failure() }} with: diff --git a/.github/workflows/pg13test.yml b/.github/workflows/pg13test.yml index dd746fa..6a85cd5 100644 --- a/.github/workflows/pg13test.yml +++ b/.github/workflows/pg13test.yml @@ -1,4 +1,4 @@ -name: pg13-test +name: Test-with-pg13-build on: [push] jobs: @@ -12,16 +12,13 @@ jobs: repository: 'postgres/postgres' ref: 'REL_13_STABLE' - - name: Clone pg_stat_monitor repository - uses: actions/checkout@v2 - with: - path: 'src/pg_stat_monitor' - - 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 python-dev bison flex libipc-run-perl -y + sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-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-9 llvm-9 llvm-9-dev libselinux1-dev python-dev python3-dev uuid-dev liblz4-dev sudo rm -rf /var/lib/postgresql/ sudo rm -rf /var/log/postgresql/ sudo rm -rf /etc/postgresql/ @@ -30,41 +27,82 @@ jobs: sudo rm -rf /usr/share/postgresql sudo rm -rf /etc/postgresql sudo rm -f /usr/bin/pg_config - - name: Create pgsql dir run: mkdir -p /opt/pgsql - name: Build postgres run: | export PATH="/opt/pgsql/bin:$PATH" - ./configure --enable-tap-tests --prefix=/opt/pgsql - make - make install + ./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' \ + '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' \ + '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' \ + '--libdir=${prefix}/lib/x86_64-linux-gnu' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' \ + '--disable-dependency-tracking' '--with-icu' '--with-tcl' '--with-perl' \ + '--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' \ + 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/13/man' \ + '--docdir=/usr/share/doc/postgresql-doc-13' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' \ + '--datadir=/usr/share/postgresql/13' '--bindir=/usr/lib/postgresql/13/bin' \ + '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' \ + '--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 2:13-x.focal)' \ + '--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: | - export PATH="/opt/pgsql/bin:$PATH" - /opt/pgsql/bin/initdb -D /opt/pgsql/data - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start + /usr/lib/postgresql/13/bin/initdb -D /opt/pgsql/data + /usr/lib/postgresql/13/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="/opt/pgsql/bin:$PATH" - sudo cp /opt/pgsql/bin/pg_config /usr/bin + export PATH="/usr/lib/postgresql/13/bin:$PATH" + sudo cp /usr/lib/postgresql/13/bin/pg_config /usr/bin make USE_PGXS=1 - make USE_PGXS=1 install + 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/13/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/13/bin/pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor/ + + - name: Start Server installcheck-world tests (without TAP) + run: | + make installcheck-world + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and postgresql log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 1 - name: Start pg_stat_monitor_tests run: | - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop - echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start make installcheck working-directory: src/pg_stat_monitor/ - - name: Report on test fail + - name: Report on pg_stat_monitor test fail uses: actions/upload-artifact@v2 if: ${{ failure() }} with: diff --git a/.github/workflows/pg14test.yml b/.github/workflows/pg14test.yml index acfcdbf..0824bd4 100644 --- a/.github/workflows/pg14test.yml +++ b/.github/workflows/pg14test.yml @@ -1,4 +1,4 @@ -name: pg14-test +name: Test-with-pg14-build on: [push] jobs: @@ -12,16 +12,13 @@ jobs: repository: 'postgres/postgres' ref: 'REL_14_STABLE' - - name: Clone pg_stat_monitor repository - uses: actions/checkout@v2 - with: - path: 'src/pg_stat_monitor' - - 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 python-dev bison flex libipc-run-perl -y + sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-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-9 llvm-9 llvm-9-dev libselinux1-dev python-dev python3-dev uuid-dev liblz4-dev sudo rm -rf /var/lib/postgresql/ sudo rm -rf /var/log/postgresql/ sudo rm -rf /etc/postgresql/ @@ -30,41 +27,68 @@ jobs: sudo rm -rf /usr/share/postgresql sudo rm -rf /etc/postgresql sudo rm -f /usr/bin/pg_config - - name: Create pgsql dir run: mkdir -p /opt/pgsql - name: Build postgres run: | export PATH="/opt/pgsql/bin:$PATH" - ./configure --enable-tap-tests --prefix=/opt/pgsql - make - make install + ./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' \ + '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' \ + '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' \ + '--libdir=${prefix}/lib/x86_64-linux-gnu' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' \ + '--disable-dependency-tracking' '--with-icu' '--with-tcl' '--with-perl' \ + '--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' \ + 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/14/man' \ + '--docdir=/usr/share/doc/postgresql-doc-14' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' \ + '--datadir=/usr/share/postgresql/14' '--bindir=/usr/lib/postgresql/14/bin' \ + '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' \ + '--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 2:14-x.focal)' \ + '--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: | - export PATH="/opt/pgsql/bin:$PATH" - /opt/pgsql/bin/initdb -D /opt/pgsql/data - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start + /usr/lib/postgresql/14/bin/initdb -D /opt/pgsql/data + /usr/lib/postgresql/14/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="/opt/pgsql/bin:$PATH" - sudo cp /opt/pgsql/bin/pg_config /usr/bin + export PATH="/usr/lib/postgresql/14/bin:$PATH" + sudo cp /usr/lib/postgresql/14/bin/pg_config /usr/bin make USE_PGXS=1 - make USE_PGXS=1 install + 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/14/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/14/bin/pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor/ - name: Start pg_stat_monitor_tests run: | - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop - echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf - /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start make installcheck working-directory: src/pg_stat_monitor/ - - name: Report on test fail + - name: Report on pg_stat_monitor test fail uses: actions/upload-artifact@v2 if: ${{ failure() }} with: diff --git a/README.md b/README.md index cac1ab0..5ce62a4 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ ![pg13-test](https://github.com/percona/pg_stat_monitor/workflows/pg13-test/badge.svg) ![pg14-test](https://github.com/percona/pg_stat_monitor/workflows/pg14-test/badge.svg) -[![Coverage Status](https://coveralls.io/repos/github/percona/pg_stat_monitor/badge.svg)](https://coveralls.io/github/percona/pg_stat_monitor) - ## What is pg_stat_monitor? **pg_stat_monitor** is a **Query Performance Monitoring** tool for [Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution) and PostgreSQL. **pg_stat_monitor** is based on PostgreSQL's contrib module ``pg_stat_statements``. ``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. diff --git a/regression/expected/error.out b/regression/expected/error.out index b901e14..ccf7968 100644 --- a/regression/expected/error.out +++ b/regression/expected/error.out @@ -28,15 +28,11 @@ SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLA SELECT 1/0; | 20 | 22012 | division by zero SELECT pg_stat_monitor_reset(); | 0 | | SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLATE "C",elevel; | 0 | | - do $$ +| 0 | | - BEGIN +| | | - RAISE WARNING 'warning message'; +| | | - END $$; | | | do $$ +| 19 | 01000 | warning message BEGIN +| | | RAISE WARNING 'warning message'; +| | | END $$; | | | -(7 rows) +(6 rows) SELECT pg_stat_monitor_reset(); pg_stat_monitor_reset diff --git a/regression/expected/error_1.out b/regression/expected/error_1.out index 8a8dd8b..102a92a 100644 --- a/regression/expected/error_1.out +++ b/regression/expected/error_1.out @@ -28,15 +28,11 @@ SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLA SELECT 1/0; | 21 | 22012 | division by zero SELECT pg_stat_monitor_reset(); | 0 | | SELECT query, elevel, sqlcode, message FROM pg_stat_monitor ORDER BY query COLLATE "C",elevel; | 0 | | - do $$ +| 0 | | - BEGIN +| | | - RAISE WARNING 'warning message'; +| | | - END $$; | | | do $$ +| 19 | 01000 | warning message BEGIN +| | | RAISE WARNING 'warning message'; +| | | END $$; | | | -(7 rows) +(6 rows) SELECT pg_stat_monitor_reset(); pg_stat_monitor_reset