Commit Graph

740 Commits (c34a2340f283f49df6e8546f7e35640e5c00356c)

Author SHA1 Message Date
Artem Gavrilov c34a2340f2 Try fix 2024-08-27 17:11:38 +02:00
Diego Fronza 43d5548f30 Fix top query regression tests on PG 12,13
On PG 12, 13, the internal return instruction in the following function:
```
CREATE OR REPLACE FUNCTION add(int, int) RETURNS INTEGER AS
  $$
  BEGIN
     return (select $1 + $2);
  END; $$ language plpgsql;
```

Is stored as SELECT (select expr1 + expr2)

On PG 14 onward it's stored just as SELECT (expr1 + expr2)
2024-08-26 17:31:26 -03:00
Diego Fronza ea76553232 Format source using pgindent 2024-08-26 17:31:26 -03:00
Diego Fronza f4b1f35877 Improve query denormalization regression test
Add a new test case:

1. Execute a prepared statement with larger execution time first.
2. Execute the same prepared statement with cheap execution time.
3. Ensures that the denormalized heavy query is not replaced by the
   cheaper.
2024-08-26 17:31:26 -03:00
Diego Fronza 146e3ec57e Updated pgsm_query_id regression tests
With the query dernomalization feature, having integer literals used in
sql like 1, or 2 could create some confusion on whether those are
placeholders or constant values, thus this commit updates the
pgsm_query_id regression test to use different integer literals to avoid
confusion.
2024-08-26 17:31:26 -03:00
Diego Fronza 3133851333 Add query denormalization regression test for prepared statements
Ensures that the denormalization of prepared statements is working, also
ensure that a query which takes more time to execute replaces the
previous denormalized query.
2024-08-26 17:31:26 -03:00
Diego Fronza 522786c581 Fix regression tests
When query normalization is disabled utility queries like SELECT 10+20
are now stored as is, instead of SELECT $1+$2.

Also when functions or sub queries are created the arguments used
internally by the function or subqueries will be replaced by NULL instead
of $1..$N. The actual arguments will be displayed when the function or
subquery is actually invoked.
2024-08-26 17:31:26 -03:00
Diego Fronza 2031e89b62 Store denormalized query only under certain constraints
This commit introduces a little optimization along with a feature, it
stores the query in denormalized form only under the circumstances
below:

- The psgm_normalized_query GUC is disabled (off).
- The query is seem for the first time, or the query total
  execution time exceeds the mean execution time calculated for
  the previous queries.

Having the query which took most execution time along with it's
arguments could help users in further investigating performance issues.
2024-08-26 17:31:26 -03:00
Diego Fronza a1f452c18c Optmize query denormalization(2)
Avoid allocating an array of strings for extracting query argument
values, instead append the current parameter value directly in the
buffer used to store the denormalized query.

This avoids not only unnecessary memory allocations, but also copying
data between temporary memory and the buffer.
2024-08-26 17:31:26 -03:00
Diego Fronza 6acc63e5a6 Optmize query denormalization
Instead of copying original query text byte by byte, copy data between
query placeholders in chunks, example:

`INSERT INTO foo(a, b, c) VALUES('test', 100, 'test again)'`

Would result in normalized query:

`INSERT INTO foo(a, b, c) VALUES($1, $2, $3)`

The original patch would copy the parts between placeholders byte by
byte, e.g. `INSERT INTO foo(a, b, c) VALUES(`, instead we can copy this
whole block at once, 1 function call and maybe 1 buffer re-allocation
per call.

Also make use of `appendBinaryStringInfo` to avoid calculating string
length as we have this info already.
2024-08-26 17:31:26 -03:00
Diego Fronza 70aaa0875e Denormalize prepared statement queries
Added support for extracting query arguments for prepared statements
when `pg_stat_monitor.pgsm_normalized_query` is off.

Previously pg_stat_monitor was unable to extract the arguments for
prepared statements, thus leaving queries with placeholders $1
.. $N instead of the actual arguments.
2024-08-26 17:31:26 -03:00
Artem Gavrilov 467394fb6e
Add timeouts to CI jobs (#484) 2024-08-26 12:00:58 -03:00
Artem Gavrilov bcf7bed60b
Use PG17-beta3 (#483) 2024-08-16 11:52:31 -03:00
Artem Gavrilov 0c50b23d6f
Prepare release 2.1.0 (#482)
* Update META.json

* Drop RELEASE_NOTES.md

* Update meson.build

* Remove mkdocs.yml
2024-08-08 12:17:38 +02:00
Artem Gavrilov 3bb65798fd
Format sources (#475)
* Temporary disable workflows

* Add indent target to makefiel

* Add CI workflow to check if sources formatted

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Format sources

* Add comments

* Revert "Temporary disable workflows"

This reverts commit 7e11cf6154.

* Revert "Format sources"

This reverts commit 6ef992d9f0.

* Use PG17 for code formatt

* Format sources

* Revert "Format sources"

This reverts commit 34061e1f82.

* Format sources
2024-08-07 15:12:24 +02:00
Zsolt Parragi 130d6b5fce
PG-592: Treat queries with different parent queries as separate entries (#403)
* PG-592: Treat queries with different parent queries as separate entries

1. Previously pg_stat_monitor had a `topquery` and `topqueryid` field, but it was only a sample:
it showed one of the top queries executing the specific query.

With this change, the same entry executed by two different functions will result in two entries in the statistics table.

2. This also fixes a bug where the content of these field disappeared for every second query executed:
previously the update function changed topqueryid to `0` if it was non zero, and changed it to the proper id when it was 0.
This resulted in an alternating behavior, where for every second executed query the top query disappeared.

After these changes, the top query is always shown.

3. The previous implementation also leaked dsa memory used to store the parent queries. This is now also fixed.

* PG-502: Fixing review comments

* dsa_free changed to assert as it can never happen
* restructured the ifs to be cleaner
  Note: kept the two-level ifs, as that makes more sense with the assert
  Note: didn't convert nested_level checks to macro, as it is used differently at different parts of the code

* PG-502: Fixing review comments

* PG-592 Add regression test

* Make test compatible with PG12

* Remove redundant line

---------

Co-authored-by: Artem Gavrilov <artem.gavrilov@percona.com>
2024-08-06 23:43:48 +02:00
Artem Gavrilov 1aa3081eaf
Drop adopters list (#480) 2024-08-01 09:12:20 -03:00
Artem Gavrilov 7680ceafd6
Drop CI workflows for PG11 (#479) 2024-08-01 09:23:26 +02:00
Muhammad Aqeel 778043a5db
[PKG-144]: Fixes issue in command to get clang version. (#478) 2024-07-25 14:02:19 +05:00
Artem Gavrilov d7999f1acf
[PG-644] Add option to disable application name tracking (#469)
* Cache application name for every backed instance

* Improve pg_get_backend_status performance for PG16 and PG17

* Fix

* Make application_name tracking disabled by default

* Meke app name tracking opt-out

* Format newly added code with pgindent

* Fix build for PG17

* Fix
2024-07-23 18:49:33 +02:00
Muhammad Aqeel 16ec8362e2
[PKG-140]: Updates build scripts to build pg_stat_monitor with LLVM 1… (#476)
[PKG-140]: Updates build scripts to build pg_stat_monitor with LLVM 17.0.
2024-07-23 14:53:07 +05:00
Artem Gavrilov dacb41f9e4
[PG-810] PG-17 Support (#463)
* Temporary disable all workflows

* Add build workflow with PG17

* Fix incompatibilities

* Fix 007_settings_pgsm_query_shared_buffer.pl test

* Fix 018_column_names.pl

* Fix 025_compare_pgss.pl

* Remove tuplestore_donestoring usage at all

* Rename I/O timing statistics columns to shared_blk_{read|write}_time

* Fix comments with fileds numbers

* Fix format

* Revert "Temporary disable all workflows"

This reverts commit 12e75beb63.

* Disable all workflows except check and build for PG 15, 16 and 17

* Fix

* Fix comments

* Fix migration

* Use REL_17_BETA1 in CI

* Add timers tests to 028_temp_block.pl

* Add local blocks timing statistics columns local_blk_{write|read}_time

* Fix t/027_local_blocks.pl test for older PG versions

* Fix

* Add jit_deform_{count|time} metrics

* Fix

* Add stats_since and minmax_stats_since fields

* Revert "Disable all workflows except check and build for PG 15, 16 and 17"

This reverts commit 73febf3aee.

* Fix t/028_temp_block.pl for PG14 and below

* Fix build for PG12

* Add pgdg workflow for PG17

* Try to fix PG pgdg workflow

* Fixes and formatting

* Format code

* Add level tracking regression test

* Fix nesting level tracking

* Format code

* Add level tracking test expected result for PG13

* Fix for PG12

* Skip level tracking regression test for PG version less than 14

* Fix toplevel calculation for older PG version

* Fix level tracking test results

* Fix nesting level counting for older PG version

* Revert "Fix nesting level counting for older PG version"

This reverts commit 3e91da8010.

* Fix level tracking for older PG versions once again

* Set REL_17_BETA2 tag for PG

* Add CI badge for PG17

* Use PG17 for examples in readme
2024-07-18 14:59:57 +02:00
Artem Gavrilov c796995e0c
Add instructions for Trunk, add PGXN badge (#473) 2024-07-12 18:23:38 +03:00
Artem Gavrilov fdec44af94
Add CODEOWNERS file (#472)
Add codeowners file
2024-07-12 13:46:44 +02:00
Artem Gavrilov 0db7f70028
PGXN integration complete (#471)
* Fix and debug

* Temorary disable all workflows

* Try invalid version tag

* Enable upload step

* Remove pull request trigger

* Revert "Temorary disable all workflows"

This reverts commit 757e04ba58.
2024-07-12 13:46:25 +02:00
Artem Gavrilov d83d202b9c
PGXN integration (#470)
* Update PGXN META.json

* Temorary disable all workflows

* Add PGXN release workflow draft

* Add pull request trigger

* Install dependencies

* Add sudo

* More sudo

* Try older ubuntu version

* Try

* Once again

* Update PGXN workflow

* Revert "Temorary disable all workflows"

This reverts commit 8d15520a51.

* Use ubunut 22.04
2024-07-11 16:41:03 +02:00
Muhammad Aqeel 74d98475a8
Fixes clang version issue that conflicts with llvm version in percona… (#468)
Fixes clang version issue that conflicts with llvm version in percona repositories
2024-06-24 11:36:24 +05:00
Muhammad Aqeel 508e35943e
Needs to install percona-release package to get GPG key. (#465) 2024-05-13 12:00:31 +05:00
Muhammad Aqeel 8d974c958f
percona-release.sh is required from release-1.0-28 branch to setup AR… (#464)
percona-release.sh is required from release-1.0-28 branch to setup ARM repo.
2024-05-10 12:02:54 +05:00
Artem Gavrilov a88c23a626
Remove redundant pgsm unistallation step from readme (#462) 2024-04-26 11:11:41 +02:00
Artem Gavrilov 288ec6325f
Add license headers validation (#458)
* Add .licenserc.yaml file

* Fix license headers

* Add github action to check license headers

* Fix workflow

* Fix checkout path

* Rename workflow

* Add debug info

* Disable workflows

* Try fix

* Split check workflow in two jobs

* Try invalid license header

* Comment of failure

* Disable cppcheck job

* Fix licenserc file

* Enable debug logging

* Prevent comments from licence-eye

* Revert "Disable cppcheck job"

This reverts commit 10f55373ea.

* Revert "Disable workflows"

This reverts commit 2e2ead2fa5.

* Fix typo

* Revert "Try invalid license header"

This reverts commit 0cc0c883d2.

* Update year in license headers

* Cleanup

* Fix indention in license header
2024-04-26 10:55:50 +02:00
Muhammad Aqeel 61256faf83
[PKG-33]: Fixes PPG repo name issue for EL9. (#461) 2024-04-25 12:23:12 +05:00
Muhammad Aqeel 2b9817d3ba
[PKG-33]: Fixes PPG repo name issue from Jenkins. (#460) 2024-04-24 23:18:07 +05:00
Muhammad Aqeel 0ba80547e6
[PKG-33]: Updates scripts to build pg_stat_monitor (#459) 2024-04-23 14:49:47 +05:00
Naeem Akhter 5d7c424fdc
Added a tap test case to load multiple PPG extensions in the server before running a test load. (#456)
1. We load and create other extensions that are distributed by Percona
   in PPG. (postgis, pg_repack, pgaudit, pgaudit_set_user, pgpool)
2. Run test data with pgbench.

To make the above test case work, updated the workflows to install above mentioned extension
where we use installed packages from PPG. On workflows where we build server or use packages
from PGDG, we are skipping this test case.
2024-04-23 02:49:57 +05:00
Artem Gavrilov c2923b4d61
Create SECURITY.md (#452)
* Create SECURITY.md

* Update supported versions section
2024-04-19 14:48:48 +02:00
Naeem Akhter dce1913154
Updated README to reflect badge for pg-16 and content on the landing page. (#455) 2024-04-19 12:28:00 +02:00
Artem Gavrilov 2ebd163225
Tune CI triggers (#444)
* Use commong CI triggers for all workflows

* Tune CI triggers, fix version tag regex

* Escape regex
2024-04-18 16:52:36 +02:00
Artem Gavrilov e3d6dc4af7
Update code-of-conduct.md (#453) 2024-04-17 15:04:50 +02:00
dependabot[bot] 0275fc742e
Bump codecov/codecov-action from 2 to 4 (#451)
* Bump codecov/codecov-action from 2 to 4

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v2...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add token parameter to codecov action

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Artem Gavrilov <artem.gavrilov@percona.com>
2024-04-16 15:17:59 +02:00
Artem Gavrilov f72b8a9537
Add forum badge in readme (#447) 2024-04-16 12:34:37 +02:00
Artem Gavrilov 175e568515
[Proposal] Add issue templates (#446)
Add issue templates
2024-04-16 12:33:56 +02:00
dependabot[bot] 0bf2846748
Bump actions/upload-artifact from 2 to 4 (#450)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-10 12:34:50 +02:00
dependabot[bot] e303899652
Bump actions/checkout from 2 to 4 (#449)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-10 12:25:02 +02:00
Artem Gavrilov 43f3c27141
Add dependabot config (#443) 2024-04-10 11:54:39 +02:00
Artem Gavrilov e1ad88a580
Fix workflows after CI image upgrade (#445)
* Temporary disable all workflows except one

* Try ubuntu 20.04

* Remove redundant working dir config

* Fix

* Try perform some operations from default user

* Try fix

* Revert "Try fix"

This reverts commit 3ed843c7462f69d7ad74ba6f60c93544e1ea549c.

* Revert "Try perform some operations from default user"

This reverts commit 206046714d888b518bce2f83f567176978a73af9.

* Switch back to ubuntu 22.04

* Add debug

* Try fix

* Hit CI

* More debug

* Revert "Remove redundant working dir config"

This reverts commit 3d1ade8948.

* Revert "Fix"

This reverts commit 05dbeed894.

* Try fix

* Revert some changes

* Revert "Temporary disable all workflows except one"

This reverts commit 93b35036fb.

* Fix pgdg workflows

* Fix ppg workflows
2024-04-09 18:12:15 +02:00
Artem Gavrilov 7829869dc7
Fix partition_prune testcase (#440)
* Disable workflows

* Disable pg_stat_monitor tests

* Add no-locale to initdb

* Try with enabled compute_query_id

* Enable tests

* Cleanup

* Set compute_query_id parameter to regress mode

* Revert "Disable workflows"

This reverts commit f0b85b8b4a.

* Fix pg 14 and 15 build workflows

* Fix

* Cleanup
2024-04-09 14:05:58 +02:00
Artem Gavrilov 684e6483b5
Fix cppcheck workflow (#441)
* Upgrade ubuntu from 20.04 to 22.04

* Temporary remove all workflows except cppcheck

* Try ununty 23.10

* Revert "Try ununty 23.10"

This reverts commit c8590b60ed.

* Try cppcheck built from sources

* Add sudo

* Bump checkout action version in cppcheck workflow

* Revert "Temporary remove all workflows except cppcheck"

This reverts commit 9f32e94992.
2024-04-05 19:42:40 +02:00
Artem Gavrilov c89879e372
Fix IPC::Run perl module name in CI (#438) 2024-04-05 19:42:00 +02:00
Artem Gavrilov 64c71f98de
Fix integer overflow (#435)
* Fix MAX_BUCKETS_MEM overflow

* Fix MAX_QUERY_BUF overflow

* Fix int overflow in IsBucketValid function

* Add missing newline

* Remove test for max value of pgsm_query_shared_buffer parameter

* Tune tests

* Cleanup

* Use int64 type instead of long long
2024-04-05 14:34:30 +02:00