Commit Graph

456 Commits

Author SHA1 Message Date
Lenz Grimmer
c57120f8a2 Merge pull request #204 from nastena1606/PG-368-Doc-1.0.0-versions-main
PG-368 Amended GH action for 1.0.x version
2022-04-14 08:10:43 +00:00
Anastasia Alexadrova
76ad94d5bf PG-368 Amended GH action for 1.0.x version 2022-04-14 10:00:58 +03:00
Ibrar Ahmed
d59fa30d98 Merge pull request #196 from LenzGr/add-adoptersmd
PG-206: Add ADOPTERS.md file
2022-04-08 11:10:07 -07:00
Ibrar Ahmed
c2eca70cf4 Merge pull request #195 from nastena1606/PG-359-Doc-pgsm_track
PG-359 Doc - Update pg_stat_monitor_settings view with new options
2022-04-05 08:23:05 -07:00
Lenz Grimmer
a8820f5642 PG-206: Add ADOPTERS.md file
Added a basic `ADOPTERS.md` placeholder file
for capturing user success stories.

Signed-off-by: Lenz Grimmer <lenz.grimmer@percona.com>
2022-03-28 09:09:27 +02:00
Anastasia Alexadrova
56e744044e PG-359 Doc - Update pg_stat_monitor_settings view with new options
modified:   docs/USER_GUIDE.md
2022-03-25 15:22:01 +02:00
Ibrar Ahmed
483ffc6163 Merge pull request #187 from EngineeredVirus/main
Fixing issue where makefile was not honoring PG's global makefiles when placed under the contrib folder.
2022-02-24 18:05:28 +05:00
Ibrar Ahmed
fdd984042e Merge pull request #186 from darkfronza/PG-351_add_pgsm_settings_view_api_check
PG-351: Add pg_stat_monitor_settings api check.
2022-02-24 18:05:18 +05:00
Ibrar Ahmed
f2dd002266 Merge pull request #185 from darkfronza/PG-350_fix_bucket_time_range_overflow
PG-350: Fix bucket time overflow.
2022-02-24 18:05:08 +05:00
Ibrar Ahmed
5356e2e75c Merge pull request #182 from darkfronza/PG-326_check_histogram_minmax
PG-326: Validate histogram_min and histogram_max ranges.
2022-02-24 18:04:58 +05:00
Hamid Akhtar
0393caec41 Fixing issue where makefile was not honoring PG's global makefiles when placed under the contrib folder. 2022-02-24 15:49:29 +05:00
Diego Fronza
2999e92b49 PG-351: Add pg_stat_monitor_settings api check.
Added settings view to the api check script, both view interface (column
names and types) and values (SELECT * FROM pg_stat_monitor_settings)
were added for comparison between branches.
2022-02-23 11:16:59 -03:00
Diego Fronza
743bea6fdc PG-350: Fix bucket time overflow.
To check if a bucket has expired, a comparison of the time elapsed
since last bucket change was being done in get_next_wbucket() function
using the following line:

while ((current_usec - current_bucket_usec) > (PGSM_BUCKET_TIME
* 1000 * 1000))

The problem is that the expression compares a uint64 (current_usec)
with a int32 (PGSM_BUCKET_TIME), if a given user configures a value for
pgsm_bucket_time GUC (let's call it T) that could overflow int32 range
in the expression T*1000*1000 > 2**31-1, then the result would be a
negative integer cast to (uint64), resulting in a large uint64 value that
would evaluate the expression as false, thus never updating bucket
number.

When querying pg_stat_monitor view, for every entry it's verified if
the entry has not yet expired by calling IsBucketValid(bucket_number).
Using the entry's bucket number the function calculates if the time
since the bucket started, using shared global variable
pgss->bucket_start_time[bucket_id], is still valid.

Since pgss->bucket_start_time is not properly initialized in
get_next_wbucket(), the function IsBucketValid() will always
return false, thus not listing any entries in the view.
2022-02-21 11:19:05 -03:00
Ibrar Ahmed
613318d542 Merge pull request #183 from darkfronza/PG-311_fix_user_and_system_cputime_zero_values
PG-311: Fix user/system cpu time zero values.
2022-02-21 17:33:06 +05:00
Diego Fronza
87876010f0 PG-311: Fix user/system cpu time zero values.
Some queries were taking less than one millisecond to execute, since we
store cpu time values in milliseconds in a float, a value of 0.1 (a tenth
of millisecond) cast to int64 would truncate the fractional part and
the result would be zero.

To fix the problem, the cast to (int64) when calculating the average cpu
time was removed, when updating entry statistics in pgss_update_entry()
function.
2022-02-17 13:07:02 -03:00
Diego Fronza
18b0c45ae0 PG-326: Validate histogram_min and histogram_max ranges.
Added hook for checking histogram min and max values, in order to ensure
that histogram_min is always less than histogram_max.
2022-02-16 13:24:09 -03:00
Ibrar Ahmed
25aed955dd Merge pull request #181 from darkfronza/PG-345_add_test_missing_queries
PG-345: Add tap test for missing queries.
2022-02-15 15:43:40 +05:00
Diego Fronza
b893f35233 PG-345: Add tap test for missing queries.
This test ensures that pg_stat_monitor moves only pending queries to the
next bucket when transitioning to a new one, also check that it keeps
the finished queries in the original bucket.
2022-02-14 16:24:01 -03:00
Ibrar Ahmed
cb8505a2cb Update README.md 2022-02-09 01:12:57 +05:00
Ibrar Ahmed
855967d915 Merge pull request #180 from darkfronza/PG-342_api_check_script
PG-342: Add API compatibility verification script.
2022-02-09 01:02:03 +05:00
Diego Fronza
39ca8845a9 PG-342: Add API compatibility verification script.
Added a new script that automates the process of checking API
compatibility between two pg_stat_monitor branches.
2022-02-08 11:08:28 -03:00
Ibrar Ahmed
dde2f9d521 Merge pull request #179 from nastena1606/PG-341-Update-doc-GH-action
PG-341: Updated GH action to build from main
2022-02-03 19:07:54 +05:00
Anastasia Alexadrova
f4b2c66c5d PG-341 Updated GH action to uild from main
modified:   .github/workflows/doc-build.yml
2022-02-02 12:45:58 +02:00
Ibrar Ahmed
7196d6106f Merge pull request #178 from Naeem-Akhter/PG-292_tap_tests_branch
PG-292: Automate the Q/A and implement tap testing.
2022-01-28 01:21:41 +05:00
Ibrar Ahmed
161948202b Merge pull request #176 from nastena1606/PG-328-Docs-site
Pg 328 docs site
2022-01-28 01:21:26 +05:00
Naeem Akhter
8647a52856 PG-292: Automate the Q/A and implement tap testcases.
This commit brings following changes:
1) Implementation of tap based testing using perl language for different
scenarios that could not be covered under traditional SQL based diff testing,
or require server start/shutdown. At this point of time, tap testing is only
enabled for Postgres 14 & 13, for rest of back branches it will be done at
laster time as there is substantial change in number of columns and their
names.
2) Changes to github action workflows for Postgres 14 & 13 to accomodate the
requirements for tap testing.
3) Similarly, minor changes to Makefile are also done.
4) Testing of supported GUCs using tap tests for different possible
configuration.
5) pg_stat_monitor_reset_errors testing using the tap testcases.
6) Insufficient shared space and buffer overflow testing via tap testcases.
7) Some sql scripts under 'scripts' folder to generate some work load requried
for tap test cases.
8) Everything under 't' folder is specific to perl based test cases. It houses
perl files and folders for some expected files and result folder.
9) 90%+ code coverage for LOC and functions.
10) PG-339 Fix by diego, change in pgsm_errors.c.
2022-01-27 23:49:38 +05:00
Ibrar Ahmed
363f4ab2bd Merge pull request #175 from darkfronza/PG-338_fix_query_call_count
PG-338: Fix query call count
2022-01-24 18:45:30 +05:00
Ibrar Ahmed
9ebf66ec04 Merge pull request #177 from darkfronza/PG-311_fix_cumulative_cpu_system_time
PG-311: Fix cpu_time and system_time accumulation.
2022-01-24 18:44:39 +05:00
Diego Fronza
868551c1b6 PG-311: Fix cpu_time and system_time accumulation.
Fixed a small typo introduced by commit
eaa9c08e24: PG-316: Convert blocks
timings to average per buckets.

The e->counters.sysinfo.utime = and e->counters.sysinfo.stime =
operations should be += to accumulate the results and calculate the
average correctly.
2022-01-21 16:07:28 -03:00
Anastasia Alexadrova
77c7ae2257 Add a GH action to build docs 2022-01-21 18:58:35 +02:00
Diego Fronza
52fb1fbc7d PG-338: Fix counters regression test.
After fixing the problem with utility statements, this whole block:
do $$
declare
   n integer:= 1;
begin
	loop
		PERFORM a,b,c,d FROM t1, t2, t3, t4
			 WHERE t1.a = t2.b AND t3.c = t4.d ORDER BY a;
		exit when n = 1000;
		n := n + 1;
	end loop;
end $$;

Is only processed once, as those are nested statements, in order to
match the 1000 statements the GUC pg_stat_monitor.track must be set to
'all' and then back to the default of 'top' when done testing it.
2022-01-21 13:44:05 -03:00
Diego Fronza
2c14e1dc08 PG-338: Fix query call count (utilities).
There was a missing increment/decrement to exec_nested_level in
pgss_ProcessUtility hook, due to this, some utility statements could
end up being processed more than once, as PostgreSQL may recurse into
this hook for sub-statements or when processing a query string
containing multiple semicolon-separated statements.
2022-01-21 13:35:14 -03:00
Ibrar Ahmed
74780a30af Merge pull request #174 from nastena1606/PG-287-Doc-delete-pgsm
PG-287 Added uninstall steps to README
2022-01-21 02:59:38 +05:00
Anastasia Alexadrova
f334fa1671 PG-328 Documentation setu and deploy on GH Pages
modified:   docs/USER_GUIDE.md
	new file:   docs/_images/PPG_links.png
	new file:   docs/_images/percona-favicon.ico
	new file:   docs/_images/percona-logo.svg
	new file:   docs/_images/percona_favicon.ico
	new file:   docs/css/percona.css
	new file:   docs/css/toctree.css
	new file:   docs/index.md
	new file:   docs/js/version-select.js
	new file:   docs/setup.md
	new file:   mkdocs.yml
2022-01-20 11:23:56 +02:00
Anastasia Alexadrova
0470546069 PG-287 Added uninstall steps to README
modified:   README.md
2022-01-20 11:12:46 +02:00
Ibrar Ahmed
37b05decda Merge pull request #172 from Naeem-Akhter/sql_new_testcases
PG-267: Add testcase to test histogram, unique application name and insert error.
2022-01-20 01:39:49 +05:00
Ibrar Ahmed
e6f89725e2 Merge pull request #173 from LenzGr/update-forum
docs: Updated Forum URL, removed Discord link
2022-01-20 01:39:32 +05:00
Lenz Grimmer
63abff2fe5 docs: Updated Forum URL, removed Discord link
Updated the Forum URL to point to the dedicated
pg_stat_monitor forum in `README.md` and
`CONTRIBUTING.md`, removed link to the Discord
channel to ensure that conversations are focused
to one location. Updated the table of contents in
the README.

Signed-off-by: Lenz Grimmer <lenz.grimmer@percona.com>
2022-01-19 15:35:35 +01:00
Naeem Akhter
433472ef12 PG-267 Add testcase to test histogram.
This commit adds following three sql based testcases:

1) Test unique application name set by user.
2) Histogram function is working properly as desired.
3) Error on insert is shown with proper message.
2022-01-19 18:04:02 +05:00
Ibrar Ahmed
26000f40b6 Merge pull request #170 from darkfronza/PG-329_fix_errors_view_sql_master
PG-329: Fix creation of pg_stat_monitor_errors view on SQL files.
2022-01-18 19:30:40 +05:00
Ibrar Ahmed
86b098f0f2 Merge pull request #171 from nastena1606/PG-308-Readme-link-to-view-doc
PG-308 README Updates
2022-01-18 19:30:22 +05:00
Diego Fronza
e38d79365b PG-329: Fix creation of pg_stat_monitor_errors view on SQL files.
After the split into multiple pg_stat_monitor--1.0.XX.sql.in sql files,
where XX is the PostgreSQL version, it was forgotten to add the errors
view to the relevant files, this commit fixes that.
2022-01-17 15:29:40 -03:00
Ibrar Ahmed
09e0f26511 Merge pull request #169 from nastena1606/PG-298-Readme-add-report-bug
PG-298 Add 'Report a bug' section to readme
2022-01-13 22:11:31 +05:00
Ibrar Ahmed
cc8506233d Merge pull request #165 from darkfronza/PG-296_fix_application_name_master
PG-296: Fix application name.
2022-01-13 22:09:20 +05:00
Ibrar Ahmed
eb9e1c1d49 Merge pull request #167 from darkfronza/PG-325_fix_deadlock_master
PG-325: Fix deadlock.
2022-01-13 22:08:29 +05:00
Anastasia Alexadrova
1ad5a06d46 PG-308 README Updates
Added a link to pg_stat_monitor view reference in the Overview
Aded PG 14 to supported versions
Updated links in the Documentation section

modified:   README.md
2022-01-13 16:47:00 +02:00
Anastasia Alexadrova
dcfde045a0 PG-298 Add 'Report a bug' section to readme
modified:   README.md
2022-01-13 10:53:49 +02:00
Diego Fronza
d25dcadadd PG-325: Fix deadlock.
If a query exceeds pg_stat_monitor.pgsm_query_max_len, then it's
truncated before we save it into the query buffer (SaveQueryText).

When reading the query back, on pg_stat_monitor_internal, we allocate a
buffer for the query with length = pg_stat_monitor.pgsm_query_max_len,
the problem is that the read_query function adds a '\0' to the end of
the buffer when reading a query, thus if a query has been truncated, for
example, to 1024, when reading it back read_query will store the '\0' at
the position 1025, an out of array bounds position.

Then, when we call pfree to release the buffer, PostgreSQL notices the
buffer overrun and triggers an error assertion, the assertion calls our
error hook which attempts to acquire the shared pgss->lock before
pg_stat_monitor_internal has released it, leading to a deadlock.

To avoid the problem we add 1 more byte to the extra '\0' during palloc
call for query_text and parent_query_text.

Also, we release the lock before calling pfree, just in case PostgreSQL
finds a problem in pfree we won't deadlock again and get the error
reported correctly.
2022-01-12 17:23:02 -03:00
Diego Fronza
cb554f78dd PG-296: Fix application name.
If a backend would change the application name during execution,
pg_stat_monitor would then fail to read the updated value, as it caches
the result in order to avoid calling the expensive functions
pgstat_fetch_stat_numbackends() and pgstat_fetch_stat_local_beentry().

A workaround was found, we can just read an exported GUC from
PostgreSQL backend itself, namely application_name, from utils/guc.h,
thus saving us from having to call those expensive functions.
2022-01-12 14:06:50 -03:00
Vadim Yalovets
b1c54b877b Merge pull request #164 from adivinho/DISTPG-353-pg_stat_monitor-PG-Debian-Requirement-the-Description-is-overflowing
DISTPG-353 PG Debian Requirement: the Description is overflowing
2022-01-07 14:55:49 +02:00