Commit Graph

723 Commits

Author SHA1 Message Date
Hamid Akhtar
726556dbaf Updating release notes for the 2.0.1 release. 2023-05-25 19:43:49 +05:00
Hamid Akhtar
67a54c792d Merge pull request #399 from codeforall/main
Merging changes back to the main branch after the 2.0.1 release
2023-05-24 14:42:01 -06:00
EvgeniyPatlan
d2f133657f ENG-7 Update pg-stat-monitor.spec 2023-05-24 12:29:00 +05:00
Hamid Akhtar
639bf6f158 Version bumped for the 2.0.1 release. 2023-05-24 12:28:16 +05:00
Hamid Akhtar
39d9419bd0 PG-624: pg_stat_monitor: Possible server crash when running pgbench with pg_stat_monitor loaded (#396)
PG-624: pg_stat_monitor: Possible server crash when running pgbench
with pg_stat_monitor loaded

It appears that this issue was being caused by improper handling of
dynamic number of buckets. This commit resolves the issue.

Also, as part of a larger cleanup, memory context has been moved to
local space from shared storage. Also, some unwanted
and no-longer-needed variables are removed.

Co-authored-by: Muhammad Usama <muhammad.usama@percona.com>
2023-05-24 12:27:40 +05:00
Hamid Akhtar
2ceb47e3cd PG-613: Postgresql crashes with Segmentation fault when query plan is enabled on large queries
The return value for snprintf was incorrectly being recorded as plan
length. That's been resolved.

As part of this fix, we've also elminated the possibility of a potential
memory leak when plan text was being saved.

Co-authored-by: Hamid Akhtar <hamid.akhtar@percona.com>
Co-authored-by: Muhammad Usama <muhammad.usama@percona.com>
2023-05-24 12:26:30 +05:00
Mikail
7623f15e68 Make pg_config configurable in Makefile invocation (#392)
This allows to override the `PG_CONFIG` variable through environment variables
when wanting to use another one that is not in the `PATH`.
2023-05-02 16:26:55 +05:00
Hamid Akhtar
1617f0df09 Updating release notes for the 2.0.0 release 2.0.0 2023-03-01 19:40:24 +05:00
Hamid Akhtar
cf5be6dd5d Adding pgsm_query_id for pgsm_store_error function 2023-03-01 19:40:24 +05:00
Hamid Akhtar
9ecd2ccbb7 Updating formatting of source code 2023-03-01 19:40:24 +05:00
EvgeniyPatlan
c7cb3d08be Merge pull request #390 from EvgeniyPatlan/main
DISTPG-530 Update build flow
2023-02-27 12:15:35 +01:00
EvgeniyPatlan
df3945aa39 Fix indentation 2023-02-27 12:11:42 +01:00
EvgeniyPatlan
a896be9f4d DISTPG-530 Update build flow 2023-02-27 12:04:28 +01:00
Hamid Akhtar
088c85f8db Update RELEASE_NOTES.md
Resolving formatting issue.
2023-02-27 15:01:31 +05:00
Hamid Akhtar
faa938b8f1 Fixing code indentation with pgindent 2023-02-27 14:47:27 +05:00
Hamid Akhtar
1883b05fc7 Updating release notes for pg_stat_monitor 2.0.0 release 2023-02-27 14:46:28 +05:00
Naeem Akhter
3541ac0d26 PG-608: pg_stat_monitor: Update histogram TAP testcase for sub-ms. (#386) 2023-02-24 02:15:36 +05:00
Muhammad Usama
c31d3ba332 PG-609: Bump version to 2.0.0 for the release. (#385)
Version bumped for the 2.0.0 release.
2023-02-23 23:02:18 +05:00
Muhammad Usama
fe23d31bf9 PG-607: Allow histogram to track queries in sub-ms time brackets (#384)
* PG-607: Allow histogram to track queries in sub-ms time brackets

Updated the GUC configuration and the relevant histogram functionality
to track queries in lower cardinality than ms. This is done by saving
the GUC values for histogram min and max values in real (double) type.

All test cases except for the 030 tap test are passing. The test case
needs an update.

* Fixing regression issues for v12 and below because of histogram changes.
2023-02-23 21:24:40 +05:00
Muhammad Usama
05ffcac2fa PG-606: New GUC required for enabling/disabling of pgsm_query_id calculation… (#383)
* PG-606: New GUC required for enabling/disabling of pgsm_query_id calculation

Adds a new GUC pg_stat_monitor.pgsm_enable_pgsm_query_id to enable/disable
pgsm query id calculation. Apart from that patch also refactors the GUC-related
code to match PostgreSQL conventions.

Moreover, the commit also changes the pgsm_enable_overflow GUC to boolean
instead of enum.
2023-02-23 19:08:09 +05:00
Ibrar Ahmed
ce32f6f15d Merge pull request #382 from EngineeredVirus/main
PG-542: Performance improvement of pg_stat_monitor.
2023-02-23 14:06:03 +05:00
Hamid Akhtar
9d2efb8913 PG-542: Performance improvement of pg_stat_monitor.
Refining the code for storing ip locally.
2023-02-23 13:18:38 +05:00
Hamid Akhtar
ccaa910c35 PG-542: Performance improvement of pg_stat_monitor.
Saving the client IP address once per the lifetime of a backend. This avoid
the expensive operation multiple times, and hence improving performance
significantly.
2023-02-23 02:41:39 +05:00
Hamid Akhtar
8482bcc347 Revert "PG-542: Performance improvement of pg_stat_monitor."
This reverts commit 7b0e603bcf.
2023-02-23 02:41:39 +05:00
Ibrar Ahmed
a8fc7081d0 Merge pull request #380 from EngineeredVirus/main
PG-542: Performance improvement of pg_stat_monitor.
2023-02-23 01:55:13 +05:00
Hamid Akhtar
5f6425a6f8 PG-542: Performance improvement of pg_stat_monitor.
Performance related changes where some calculations are moved out
of the spinlock in the pgsm_update_entry function. This should
improve the performance a bit.

Also, moved the histogram calculation function to init. The update
function now only searches an array rather than recalculatiing the
histogram bucket timings.

Updated conditional statement to update parent query only when
required.
2023-02-23 01:53:30 +05:00
Ibrar Ahmed
1fcdbcefaf Merge pull request #379 from codeforall/main
PG-542: Performance improvement of pg_stat_monitor.
2023-02-23 01:49:28 +05:00
Muhammad Usama
7b0e603bcf PG-542: Performance improvement of pg_stat_monitor.
Saving the client IP address once per the lifetime of a backend. This avoid
the expensive operation multiple times, and hence improving performance
significantly.
2023-02-23 01:33:23 +05:00
Ibrar Ahmed
7b9711eb7d Merge pull request #378 from EngineeredVirus/main
PG-588: Some queries are not being normalised.
2023-02-23 01:24:31 +05:00
Naeem Akhter
be1b4af180 PG-605: Fix TAP Tests framework crash. (#377) 2023-02-22 23:47:03 +05:00
Hamid Akhtar
de66ef0fce PG-588: Some queries are not being normalised.
This bug uncovered serious issues with how the data was being stored by PSGM.
So it require a complete redesign.

pg_stat_monitor now stores the data locally within the backend process's local
memory. The data is only stored when the query completes. This reduces the
number of lock acquisitions that were previously needed during various stages
of the execution. Also, this avoids data loss in case the current bucket
changes during execution. Also, the unavailability of jumble state during later
stages of executions was causing pg_stat_monitor to save non-normalized query.
This was a major problem as well.

pg_stat_monitor specific memory context is implemented. It is used for saving
data locally. The context memory callback helps us clear the locally saved data
so that we do not store it multiple times in the shared hash.

As part of this major rewrite, pgss reference in function and variable names
is changed to pgsm. Memory footprint for the entries is reduced, data types
are corrected where needed, and we've removed unused variables, functions and
macros.

This patch was mutually created by:
Co-authored-by: Hamid Akhtar <hamid.akhtar@percona.com>
Co-authored-by: Muhammad Usama <muhammad.usama@percona.com>
2023-02-22 19:31:52 +05:00
Naeem Akhter
837bacdf3a PG-571: Update Jobs to run on PR and Push. (#374) 2023-02-09 00:35:51 +05:00
Naeem Akhter
4352d97af0 PG-603: Fix/Update String::Util module in TAP test perl. (#373)
Removed use of String::Util perl module from TAP test cases, and now using
Text::Trim module instead, as that is more stable. Also removed the
Data::Str2Num perl module as it was not needed any more.
2023-02-02 15:41:43 +05:00
Vadim Yalovets
32b1219087 Merge pull request #372 from adivinho/Fix-build-script
Fix build script for PG13
2023-02-01 14:14:38 +02:00
Vadim Yalovets
11b9924b3c Fix build script for PG13 2023-02-01 12:13:09 +02:00
Muhammad Usama
8193e527da PG-587: pg_stat_monitor: Validate the upgrade from 1.x to 2.0 version (#370)
Disallow V1 API to be used with V2.0 lib and remove pg_stat_monitor--1.0.sql
as part of that. A few adjustments to 1.x to 2.0 upgrade script are also
part of the commit
2023-02-01 01:38:02 +05:00
Naeem Akhter
62d2ad6d8e Merge pull request #371 from capri1989/PG-571
PG-571: Update badges in README
2023-01-30 19:21:32 +05:00
Kai Wagner
2ccbe416c2 PG-571: Update badges in README
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
2023-01-30 14:14:07 +01:00
Kai Wagner
9b9e1f6eef Merge pull request #368 from capri1989/PG-602
PG-602: Updated the README and added PG15
2023-01-30 13:38:33 +01:00
Ibrar Ahmed
9382f6de8f Merge pull request #369 from Naeem-Akhter/PG-559-testcase
PG-559: Add a TAP testcase for historgram feature.
2023-01-30 17:27:30 +05:00
Naeem Akhter
6939ea282a PG-559: Add a TAP testcase for historgram feature. 2023-01-30 15:45:11 +05:00
Kai Wagner
347ee6cf19 PG-602: Changed release notes to mention the initial PG15 support
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
2023-01-30 09:17:41 +01:00
Kai Wagner
70decec03c PG-602: Updated the README and added PG15 and increased the copyright year to 2023
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
2023-01-30 08:35:48 +01:00
Ibrar Ahmed
a4e60b97bb Merge pull request #367 from EngineeredVirus/main
PG-601: Histogram ranges are not correct
2023-01-26 14:59:17 +05:00
Hamid Akhtar
3b6fc3846c PG-601: Histogram ranges are not correct
Resolved the issue with histogram outlier buckets. Also updated
the printing of bucket ranges to be in correct set notation with
reference to brackets. The lower bounds of buckets always have an
exclusive range except for the first bucket, and the upper bounds
always have an inclusive value.
( or ) => exclusive
{ or } => inclusive

The entire range is enclosed within the {} brackets.
2023-01-25 20:31:14 +05:00
Hamid Akhtar
3487e70cc6 PG-599: PGSM build failure on PG-11
Resolving the compilation issue caused by ereport statement.
2023-01-25 12:51:57 +05:00
Hamid Akhtar
9327c864d3 PG-586: pg_stat_monitor: CPU and user timing should be captured
for utility statements as well

Setting user and sys time to 0 in case there is a problem getting
rusage details.
2023-01-25 12:50:29 +05:00
Hamid Akhtar
ee18c16149 PG-586: pg_stat_monitor: CPU and user timing should be captured
for utility statements as well

Added the necessary capture of resource usage  in the process
utility function. We are now storing CPU and user timings for a
utility statement.
2023-01-25 12:50:29 +05:00
Muhammad Usama
ac8800a637 PG-597: pg_stat_monitor: Remove rounding off for floating point values (#364)
As an observability tool that serves data to other tools, data must be output without any loss. So rounding off causes data loss and rounding off errors when comparing different columns.

Therefore, it was decided to eliminate rounding off when outputting values. Any consumer of this data should round off data to whatever precision it prefers.

This behaviour is also consistent with pg_stat_statements.
2023-01-24 16:54:13 +05:00
Naeem Akhter
e10c615dfb PG-572: Verify 025_compare_pgss.pl TAP test case.
Updated test case for column name change (rows_retrieved -> rows).
2023-01-24 16:10:45 +05:00