Skip to content

Commit 32c389d

Browse files
committed
Merge branch 'master' into stable
2 parents df7612b + 92becb3 commit 32c389d

19 files changed

+172
-9
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/results
55
*pg_wait_sampling--1.1.sql
66
.log
7+
Dockerfile

Diff for: .travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@ env:
2323
- PG_VERSION=10 CHECK_CODE=clang
2424
- PG_VERSION=10 CHECK_CODE=cppcheck
2525
- PG_VERSION=10 CHECK_CODE=false
26+
- PG_VERSION=11 CHECK_CODE=clang
2627
- PG_VERSION=11 CHECK_CODE=false
28+
- PG_VERSION=12 CHECK_CODE=clang
2729
- PG_VERSION=12 CHECK_CODE=false
30+
- PG_VERSION=13 CHECK_CODE=clang
31+
- PG_VERSION=13 CHECK_CODE=false

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/postgrespro/pg_wait_sampling.svg?branch=master)](https://travis-ci.org/postgrespro/pg_wait_sampling)
1+
[![Build Status](https://travis-ci.com/postgrespro/pg_wait_sampling.svg?branch=master)](https://travis-ci.com/postgrespro/pg_wait_sampling)
22
[![PGXN version](https://badge.fury.io/pg/pg_wait_sampling.svg)](https://badge.fury.io/pg/pg_wait_sampling)
33
[![GitHub license](https://img.shields.io/badge/license-PostgreSQL-blue.svg)](https://raw.githubusercontent.com/postgrespro/pg_wait_sampling/master/LICENSE)
44

Diff for: collector.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#include "postgres.h"
1111

1212
#include "catalog/pg_type.h"
13+
#if PG_VERSION_NUM >= 130000
14+
#include "common/hashfn.h"
15+
#endif
1316
#include "funcapi.h"
1417
#include "miscadmin.h"
1518
#include "postmaster/bgworker.h"
@@ -303,11 +306,11 @@ static int64
303306
millisecs_diff(TimestampTz tz1, TimestampTz tz2)
304307
{
305308
long secs;
306-
int millisecs;
309+
int microsecs;
307310

308-
TimestampDifference(tz1, tz2, &secs, &millisecs);
311+
TimestampDifference(tz1, tz2, &secs, &microsecs);
309312

310-
return secs * 1000 + millisecs;
313+
return secs * 1000 + microsecs / 1000;
311314

312315
}
313316

Diff for: debian/changelog

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pg-wait-sampling (1.1.2-1) unstable; urgency=medium
2+
3+
* New upstream version compatible with PG13
4+
5+
-- Adrien Nayrat <[email protected]> Wed, 28 Oct 2020 09:03:03 +0000
6+
7+
pg-wait-sampling (1.1.1-1) unstable; urgency=medium
8+
9+
* Release 1.1.1
10+
11+
-- Adrien Nayrat <[email protected]> Wed, 17 Jun 2020 12:26:59 +0000

Diff for: debian/compat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

Diff for: debian/control

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Source: pg-wait-sampling
2+
Section: database
3+
Priority: optional
4+
Maintainer: Adrien Nayrat <[email protected]>
5+
Standards-Version: 4.5.0
6+
Build-Depends: debhelper (>=9~), postgresql-server-dev-all (>= 141~)
7+
Homepage: https://github.com/postgrespro/pg_wait_sampling
8+
Vcs-Browser: https://github.com/postgrespro/pg_wait_sampling
9+
Vcs-Git: https://github.com/postgrespro/pg_wait_sampling.git
10+
11+
Package: postgresql-9.6-pg-wait-sampling
12+
Architecture: any
13+
Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-9.6,
14+
Description: pg_wait-sampling provides functions for detailed per backend
15+
and per query statistics about PostgreSQL wait events
16+
17+
Package: postgresql-10-pg-wait-sampling
18+
Architecture: any
19+
Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-10,
20+
Description: pg_wait-sampling provides functions for detailed per backend
21+
and per query statistics about PostgreSQL wait events
22+
23+
Package: postgresql-11-pg-wait-sampling
24+
Architecture: any
25+
Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-11,
26+
Description: pg_wait-sampling provides functions for detailed per backend
27+
and per query statistics about PostgreSQL wait events
28+
29+
Package: postgresql-12-pg-wait-sampling
30+
Architecture: any
31+
Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-12,
32+
Description: pg_wait-sampling provides functions for detailed per backend
33+
and per query statistics about PostgreSQL wait events
34+
35+
Package: postgresql-13-pg-wait-sampling
36+
Architecture: any
37+
Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-13,
38+
Description: pg_wait-sampling provides functions for detailed per backend
39+
and per query statistics about PostgreSQL wait events

Diff for: debian/control.in

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Source: pg-wait-sampling
2+
Section: database
3+
Priority: optional
4+
Maintainer: Adrien Nayrat <[email protected]>
5+
Standards-Version: 4.5.0
6+
Build-Depends: debhelper (>=9~), postgresql-server-dev-all (>= 141~)
7+
Homepage: https://github.com/postgrespro/pg_wait_sampling
8+
Vcs-Browser: https://github.com/postgrespro/pg_wait_sampling
9+
Vcs-Git: https://github.com/postgrespro/pg_wait_sampling.git
10+
11+
Package: postgresql-PGVERSION-pg-wait-sampling
12+
Architecture: any
13+
Depends: ${misc:Depends}, ${shlibs:Depends}, postgresql-PGVERSION,
14+
Description: pg_wait-sampling provides functions for detailed per backend
15+
and per query statistics about PostgreSQL wait events

Diff for: debian/copyright

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pg_wait_sampling is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
2+
3+
Copyright (c) 2015-2017, Postgres Professional
4+
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
5+
Portions Copyright (c) 1994, The Regents of the University of California
6+
7+
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
8+
9+
IN NO EVENT SHALL POSTGRES PROFESSIONAL BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF POSTGRES PROFESSIONAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10+
11+
POSTGRES PROFESSIONAL SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND POSTGRES PROFESSIONAL HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

Diff for: debian/pgversions

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9.6+

Diff for: debian/rules

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/make -f
2+
3+
PKGVER = $(shell dpkg-parsechangelog | awk -F '[:-]' '/^Version:/ { print substr($$2, 2) }')
4+
EXCLUDE = --exclude-vcs --exclude=debian
5+
6+
include /usr/share/postgresql-common/pgxs_debian_control.mk
7+
8+
override_dh_auto_build:
9+
# do nothing
10+
11+
override_dh_auto_test:
12+
# nothing to do here, upstream tests used, see debian/tests/*
13+
14+
override_dh_auto_install:
15+
# build all supported versions
16+
+pg_buildext loop postgresql-%v-pg-wait-sampling
17+
18+
override_dh_installdocs:
19+
dh_installdocs --all README.md
20+
21+
override_dh_auto_clean:
22+
$(MAKE) clean USE_PGXS=1 PG_CONFIG=/usr/bin/pg_config
23+
24+
orig: debian/control clean
25+
cd .. && tar czf pg-wait-sampling_$(PKGVER).orig.tar.gz $(EXCLUDE) pg_wait_sampling-$(PKGVER)
26+
%:
27+
dh $@

Diff for: debian/source/format

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (quilt)

Diff for: debian/tests/control

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Depends: @, postgresql-server-dev-all
2+
Tests: installcheck
3+
Restrictions: allow-stderr

Diff for: debian/tests/installcheck

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
pg_buildext -o "shared_preload_libraries=pg_wait_sampling" installcheck

Diff for: debian/watch

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version=3
2+
opts="uversionmangle=s/_/./g" \
3+
https://github.com/postgrespro/pg_wait_sampling/releases .*/archive/v(.*).tar.gz

Diff for: expected/queries.out

+19
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,25 @@ WITH t as (SELECT sum(0) FROM pg_wait_sampling_profile)
2020
0
2121
(1 row)
2222

23+
-- Some dummy checks just to be sure that all our functions work and return something.
24+
SELECT count(*) = 1 as test FROM pg_wait_sampling_get_current(pg_backend_pid());
25+
test
26+
------
27+
t
28+
(1 row)
29+
30+
SELECT count(*) >= 0 as test FROM pg_wait_sampling_get_profile();
31+
test
32+
------
33+
t
34+
(1 row)
35+
36+
SELECT count(*) >= 0 as test FROM pg_wait_sampling_get_history();
37+
test
38+
------
39+
t
40+
(1 row)
41+
2342
SELECT pg_wait_sampling_reset_profile();
2443
pg_wait_sampling_reset_profile
2544
--------------------------------

Diff for: pg_wait_sampling.c

+18-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ CollectorShmqHeader *collector_hdr = NULL;
5050
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
5151
static PGPROC * search_proc(int backendPid);
5252
static PlannedStmt *pgws_planner_hook(Query *parse,
53+
#if PG_VERSION_NUM >= 130000
54+
const char *query_string,
55+
#endif
5356
int cursorOptions, ParamListInfo boundParams);
5457
static void pgws_ExecutorEnd(QueryDesc *queryDesc);
5558

@@ -771,7 +774,11 @@ pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
771774
* planner_hook hook, save queryId for collector
772775
*/
773776
static PlannedStmt *
774-
pgws_planner_hook(Query *parse, int cursorOptions,
777+
pgws_planner_hook(Query *parse,
778+
#if PG_VERSION_NUM >= 130000
779+
const char *query_string,
780+
#endif
781+
int cursorOptions,
775782
ParamListInfo boundParams)
776783
{
777784
if (MyProc)
@@ -795,9 +802,17 @@ pgws_planner_hook(Query *parse, int cursorOptions,
795802

796803
/* Invoke original hook if needed */
797804
if (planner_hook_next)
798-
return planner_hook_next(parse, cursorOptions, boundParams);
805+
return planner_hook_next(parse,
806+
#if PG_VERSION_NUM >= 130000
807+
query_string,
808+
#endif
809+
cursorOptions, boundParams);
799810

800-
return standard_planner(parse, cursorOptions, boundParams);
811+
return standard_planner(parse,
812+
#if PG_VERSION_NUM >= 130000
813+
query_string,
814+
#endif
815+
cursorOptions, boundParams);
801816
}
802817

803818
/*

Diff for: run_tests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ if [ "$CHECK_CODE" = "clang" ]; then
1919

2020
elif [ "$CHECK_CODE" = "cppcheck" ]; then
2121
cppcheck \
22-
--template "{file} ({line}): {severity} ({id}): {message}" \
22+
--template "{file} ({line}): {severity} ({id}): {message}" \
2323
--enable=warning,portability,performance \
2424
--suppress=redundantAssignment \
2525
--suppress=uselessAssignmentPtrArg \
26-
--suppress=literalWithCharPtrCompare \
26+
--suppress=literalWithCharPtrCompare \
2727
--suppress=incorrectStringBooleanError \
2828
--std=c89 *.c *.h 2> cppcheck.log
2929

Diff for: sql/queries.sql

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ WITH t as (SELECT sum(0) FROM pg_wait_sampling_history)
99
WITH t as (SELECT sum(0) FROM pg_wait_sampling_profile)
1010
SELECT sum(0) FROM generate_series(1, 2), t;
1111

12+
-- Some dummy checks just to be sure that all our functions work and return something.
13+
SELECT count(*) = 1 as test FROM pg_wait_sampling_get_current(pg_backend_pid());
14+
SELECT count(*) >= 0 as test FROM pg_wait_sampling_get_profile();
15+
SELECT count(*) >= 0 as test FROM pg_wait_sampling_get_history();
1216
SELECT pg_wait_sampling_reset_profile();
1317

1418
DROP EXTENSION pg_wait_sampling;

0 commit comments

Comments
 (0)