Commit Graph

688 Commits

Author SHA1 Message Date
Ibrar Ahmed
a0c848749c Update README.md 2021-11-17 01:36:38 +05:00
Ibrar Ahmed
88523792f5 Rename workflows. 2021-11-16 20:30:34 +00:00
Ibrar Ahmed
5e2b107471 Update README.md 2021-11-17 01:20:08 +05:00
Ibrar Ahmed
b5cbd98ae8 Update and rename pg11test.yml to postgresql-11-build.yml 2021-11-17 01:19:32 +05:00
Ibrar Ahmed
5d06977110 Merge pull request #138 from darkfronza/PG-277_fix_regression_pgsm_overflow_target_defaults
PG-277: Fix regression tests (pgsm_overflow_target defaults).
2021-11-17 01:13:42 +05:00
Diego Fronza
c577750538 PG-277: Fix regression tests (pgsm_overflow_target defaults).
Adjust guc_1.out to match guc.out defaults for pgsm_overflow_target.
2021-11-16 16:31:44 -03:00
Ibrar Ahmed
d3725790d4 Regression Fix. 2021-11-16 12:01:46 +00:00
Ibrar Ahmed
74dd7c80d8 Regression Fix. 2021-11-16 11:46:15 +00:00
Ibrar Ahmed
c8d7209149 PG-273: pg_stat_monitor_hook_stats disable to end user. 2021-11-16 11:38:21 +00:00
Ibrar Ahmed
680c7fda42 PG-210: Add new column toplevel. 2021-11-16 11:23:59 +00:00
Ibrar Ahmed
5f6177daa3 PG-210: Add new column toplevel. 2021-11-16 10:48:11 +00:00
Ibrar Ahmed
6ea5a8991c Merge pull request #135 from percona/devel
Devel
2021-11-14 20:15:30 +05:00
Ibrar Ahmed
351f4e4644 Merge pull request #134 from darkfronza/PG-276_fix_regression_tests
PG-276: Fix regression tests.
2021-11-14 20:15:10 +05:00
Diego Fronza
0a45fc740f PG-276: Fix regression tests.
The guc_1.out is used for PG >= 13, where query track planning is
available, so it has been restored.
2021-11-12 16:55:51 -03:00
Ibrar Ahmed
192ec4e470 Merge pull request #133 from percona/devel
Devel
2021-11-13 00:37:52 +05:00
Ibrar Ahmed
85b7cabf50 Merge pull request #132 from darkfronza/PG-275_fix_regression_tests
PG-275: Fix regression tests.
2021-11-13 00:37:29 +05:00
Diego Fronza
3be31d67e9 PG-275: Fix regression tests.
Removal of redundant file guc_1.out.

Adjusted guc.out to match query planning disabled by default.
2021-11-12 14:42:17 -03:00
Ibrar Ahmed
f1166c306a Merge pull request #130 from darkfronza/PG-272_fix_server_crash
PG-272: Fix server crash when calling pg_stat_monitor_reset().
2021-11-12 20:42:29 +05:00
Ibrar Ahmed
0148409b33 Merge pull request #131 from percona/devel
Devel
2021-11-12 20:41:37 +05:00
Ibrar Ahmed
22fab87dec Merge pull request #129 from darkfronza/PG-220_fix_pgsm_overflow_target
PG-220: fix pgsm overflow target
2021-11-12 20:40:33 +05:00
Diego Fronza
997639c067 PG-272: Fix server crash when calling pg_stat_monitor_reset().
The loop that resets the query buffers was incorrecly using MAX_BUCKETS
to indicate the number of buckets to clear, which defaults to 10. If a
user lowers this value the loop would access a pointer beyond the number
of query buffers allocated.

Fix the problem by using the correct PGSM_MAX_BUCKETS GUC as the limit
to the loop.
2021-11-12 10:58:56 -03:00
Ibrar Ahmed
3f937e30de Merge pull request #128 from nastena1606/PG-215-Doc-Fix-links-master
PG-215: Doc Fixed links to usage examples,
2021-11-12 16:30:17 +05:00
Anastasia Alexadrova
18f357284a PG-215 Doc Fixed links to usage examples,
reaorded usage examples to align with feature order
modified:   docs/USER_GUIDE.md
2021-11-12 12:57:08 +02:00
Ibrar Ahmed
06b5e4c5fe PG-210: Columns names should match upstream pg_stat_statements column names. 2021-11-10 19:30:32 +00:00
Ibrar Ahmed
20f3d8c047 PG-210: Columns names should match upstream pg_stat_statements column names. 2021-11-10 18:33:02 +00:00
Ibrar Ahmed
51a6d38c45 Merge pull request #125 from denisok/add_build_dep
add dependencies for build
2021-11-10 22:31:07 +05:00
Ibrar Ahmed
c4780aba5a Merge pull request #124 from nastena1606/PG-215-Doc-User-guide-updates-master
PG-215 User Guide updates
2021-11-10 22:27:55 +05:00
Anastasia Alexandrova
89ddcb5391 Merge branch 'master' into PG-215-Doc-User-guide-updates-master 2021-11-10 19:26:22 +02:00
Ibrar Ahmed
28efbc90c7 Merge pull request #127 from rnovikovP/patch-3
PG-256: DOC about Views presentation
2021-11-10 22:06:44 +05:00
Roma Novikov
09f298b8d6 PG-256: DOC about Views presentation 2021-11-10 15:47:29 +02:00
Anastasia Alexandrova
f186a28a2d Merge branch 'master' into PG-215-Doc-User-guide-updates-master 2021-11-05 14:46:39 +02:00
Anastasia Alexadrova
d9c281a408 Fixed cmd_type* columns in the Reference doc 2021-11-05 14:42:26 +02:00
EvgeniyPatlan
22ebe35cb1 Merge pull request #126 from EvgeniyPatlan/master
PG-264 fix version
1.0.0-Beta-2
2021-11-01 16:01:21 +02:00
Evgeniy Patlan
ac7aa57995 PG-264 fix version 2021-11-01 14:49:35 +02:00
Denys Kondratenko
5b5979c0aa add dependencies for build 2021-10-29 23:20:54 +02:00
Diego Fronza
f66b45afd6 PG-220: Fix read/write of dumped query buffer to files.
This commit fix some issues when the query buffer overflows and
pg_stat_monitor attempts to dump its contents to a file.

The dump process is now as follows:

1. The dump will always be a full dump of the current query buffer,
   meaning pg_stat_monitor will dump MAX_QUERY_BUFFER_BUCKET bytes to
   the dump file.
2. When scanning the dump file, read chunks of size
   MAX_QUERY_BUFFER_BUCKET, then look for the query ID using that chunk
   and the query position metadata, this allows pg_stat_monitor to avoid
   scanning the whole chunk when looking for a query ID.

The code in charge to read from/write to the dump file now takes into
account that read() and write() may return less bytes than what it was
asked for, the code now ensures that we actually read or write the
amount of bytes required (MAX_QUERY_BUFFER_BUCKET), also it handles
rare but posssible interrupts when doing those operations.
2021-10-25 16:55:30 -03:00
Anastasia Alexadrova
d5e25f961f PG-215 User Guide updates
Moved pg_stat_monitor column description and compaison to separate docs

new file: REFERENCE.md
new file: COMPARISON.md
2021-10-25 10:03:37 +03:00
Diego Fronza
e593dbccc3 PG-220: Fix GUC regression test (pgsm_overflow_target).
Updated expected output for pgsm_overflow_target to match the default
value of 1.
2021-10-22 15:40:27 -03:00
Diego Fronza
c3d167e452 PG-220: Check possible query buffer overflow.
In SaveQueryText() we check for a possible overflow in the query buffer,
but if overflow would happen and pgsm_overflow_target value is 1 (the
default), then we dump the query buffer to a temporary file and reset
the buffer (start saving queries from the start of the buffer). The
problem is that after resetting the buffer we don't check if the current
query length would exceed the buffer size of MAX_QUERY_BUFFER_BUCKET, if
that is the case the buffer would overflow and probably crash the
process or in the worst case become an attack vector for exploitation.

This commit fix the problem by adding an additional check for overflow
after resetting the query buffer.
2021-10-22 15:40:27 -03:00
Diego Fronza
fa55eb333d PG-220: Fix pgsm_overflow_target defaults.
The GUC variable pgsm_overflow_target was pointing to the wrong index
(12, pgsm_track_planning) in the "GucVariable conf[MAX_SETTINGS]" array.

Adjusted it to the right index, 11.
2021-10-22 15:40:27 -03:00
Ibrar Ahmed
693838c979 PG-263: Bump version to 1.0.0 - Beta2. 2021-10-22 16:27:36 +00:00
Ibrar Ahmed
e2679e42aa Merge pull request #123 from darkfronza/PG-262_fix_comments_extraction
PG-262: Fix comments extraction
2021-10-18 22:13:17 +05:00
Diego Fronza
c390f24f5c PG-262: Fix tags regression test.
The test was updated to reflect the new output format for query
comments.
2021-10-18 11:51:49 -03:00
Diego Fronza
a9a36905f2 PG-262: Fix comment extraction on queries.
The regular expression was updated to properly capture comments in SQL
in the form /* */.

The previous regex was capturing everything from /* until the last */
because regex are greedy, this was presenting problems if a input query
has something like:
SELECT /* comment 1 */ field /* comment 2 */ from FOO;

As such, the previous regex would capture anytying between /* comment 1
and comment 2 */, the result would be:
/* comment 1 field comment 2*/.

Multiline comments are also captured.

Multiple comments in one query are now stored in the pg_stat_monitor
comments field in the form: /* Comment 1 */, ... , /* Comment N */.
2021-10-18 11:41:37 -03:00
Ibrar Ahmed
350ef723ab Update README.md 2021-10-16 07:58:14 +05:00
Ibrar Ahmed
b7393ac682 Merge pull request #121 from darkfronza/PG-261_fix_regression_on_distribution_packages_pg11_pg12
PG-261: Fix regression tests on distribution packages.
2021-10-16 00:38:27 +05:00
Diego Fronza
bf8c93b185 PG-261: Fix regression tests on distribution packages.
The code added in pgss_store() to handle an assertion failure when
GetUserId() was being called introduced a problem with regression tests
in some builds, specifically our PG11 and PG12 distributions for Ubuntu.

The problem was detected when calling some json functions that would
trigger parallel workers, to solve the problem now we check if our hooks
are being called by parallel workers, in this case we can avoid doing
work, it also fixes the issue mentioned above as we won't call
GetUserId() anymore in an invalid context.
2021-10-15 11:56:28 -03:00
Ibrar Ahmed
52ea543275 Merge pull request #120 from darkfronza/PG-260_fix_regression_tests
PG-260 fix regression tests
2021-10-14 23:09:30 +05:00
Ibrar Ahmed
0495909820 Merge pull request #119 from Naeem-Akhter/master
PG-259: Fixed PGSM build in Test-with-pg13-pgdg-packages GH action.
2021-10-14 23:09:09 +05:00
Diego Fronza
9e76f6f961 PG-260: Fix regression tests.
The regression tests required some adjustmentes as they were based on a
wrong behavior in pg_stat_monitor that was fixed in the last commits.

The problem was that pg_stat_monitor_reset() was not properly clearing
the query buffers, as such, some garbage queries were residing in the
buffers after calling pg_stat_monitor_reset().

One example of a problem, a query such as "SELECT 1 AS num" and the
same query with comments such as:
SELECT $1 AS num /* { "application", psql_app, "real_ip", 192.168.1.3)
*/
Are evaluated to the same query ID, if a test issue the first query, call
pg_stat_monitor_reset() to clear query buffer, then issue the second
query with comments, the result in pg_stat_monitor view would still contain
the first query without comments, this was leading to tests expecting
the wrong output, which is now fixed.
2021-10-14 10:39:25 -03:00