Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Drop support for Postgres < 12#75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
shinderuk merged 1 commit intomasterfromdrop-support-v11
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,6 @@ env:
- PG_MAJOR=14
- PG_MAJOR=13
- PG_MAJOR=12
- PG_MAJOR=11
before_script:
- curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
- echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee -a /etc/apt/sources.list
Expand Down
8 changes: 4 additions & 4 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
Introduction
------------

PostgreSQL9.6+provides an information about current wait event of particular
PostgreSQL provides information about current wait event of particular
process. However, in order to gather descriptive statistics of server
behavior user have to sample current wait event multiple times.
`pg_wait_sampling` is an extension for collecting sampling statistics of wait
Expand DownExpand Up@@ -47,7 +47,7 @@ PostgreSQL installation. It is available from
[github](https://github.com/postgrespro/pg_wait_sampling)
under the same license as
[PostgreSQL](http://www.postgresql.org/about/licence/)
and supports PostgreSQL9.6+.
and supports PostgreSQL12+.

Installation
------------
Expand All@@ -58,10 +58,10 @@ repository: https://download.postgresql.org/pub/repos/
Manual build
------------

`pg_wait_sampling` is PostgreSQL extension which requires PostgreSQL9.6 or
`pg_wait_sampling` is PostgreSQL extension which requires PostgreSQL12 or
higher. Before build and install you should ensure following:

* PostgreSQL version is9.6 or higher.
* PostgreSQL version is12 or higher.
* You have development package of PostgreSQL installed or you built
PostgreSQL from source.
* Your PATH variable is configured so that `pg_config` command available, or
Expand Down
8 changes: 1 addition & 7 deletionscollector.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -423,15 +423,9 @@ pgws_collector_main(Datum main_arg)
* Wait until next sample time or request to do something through
* shared memory.
*/
#if PG_VERSION_NUM >= 100000
rc = WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
Min(history_period - (int)history_diff,
profile_period - (int)profile_diff), PG_WAIT_EXTENSION);
#else
rc = WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
Min(history_period - (int)history_diff,
profile_period - (int)profile_diff));
#endif

if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
Expand DownExpand Up@@ -482,7 +476,7 @@ pgws_collector_main(Datum main_arg)
default:
Assert(false);
}
shm_mq_detach_compat(mqh, pgws_collector_mq);
shm_mq_detach(mqh);
}
else if (request == PROFILE_RESET)
{
Expand Down
24 changes: 1 addition & 23 deletionscompat.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,26 +17,6 @@
#include "storage/shm_mq.h"
#include "utils/guc_tables.h"

static inline TupleDesc
CreateTemplateTupleDescCompat(int nattrs, bool hasoid)
{
#if PG_VERSION_NUM >= 120000
return CreateTemplateTupleDesc(nattrs);
#else
return CreateTemplateTupleDesc(nattrs, hasoid);
#endif
}

static inline void
shm_mq_detach_compat(shm_mq_handle *mqh, shm_mq *mq)
{
#if PG_VERSION_NUM >= 100000
shm_mq_detach(mqh);
#else
shm_mq_detach(mq);
#endif
}

static inline shm_mq_result
shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes, const void *data,
bool nowait, bool force_flush)
Expand All@@ -61,11 +41,9 @@ InitPostgresCompat(const char *in_dbname, Oid dboid,
#elif PG_VERSION_NUM >= 150000
InitPostgres(in_dbname, dboid, username, useroid, load_session_libraries,
override_allow_connections, out_dbname);
#elif PG_VERSION_NUM >= 110000
#else
InitPostgres(in_dbname, dboid, username, useroid, out_dbname,
override_allow_connections);
#else
InitPostgres(in_dbname, dboid, username, useroid, out_dbname);
#endif
}

Expand Down
43 changes: 5 additions & 38 deletionspg_wait_sampling.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,9 +18,7 @@
#include "optimizer/planner.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
#if PG_VERSION_NUM >= 120000
#include "replication/walsender.h"
#endif
#include "storage/ipc.h"
#include "storage/pg_shmem.h"
#include "storage/procarray.h"
Expand DownExpand Up@@ -119,9 +117,7 @@ get_max_procs_count(void)
* Starting with pg12, wal senders aren't part of MaxConnections anymore
* and have to be accounted for.
*/
#if PG_VERSION_NUM >= 120000
count += max_wal_senders;
#endif/* pg 12+ */
#endif/* pg 15- */
/* End of MaxBackends calculation. */

Expand DownExpand Up@@ -331,16 +327,9 @@ pgws_shmem_startup(void)
else
{
toc = shm_toc_attach(PG_WAIT_SAMPLING_MAGIC, pgws);

#if PG_VERSION_NUM >= 100000
pgws_collector_hdr = shm_toc_lookup(toc, 0, false);
pgws_collector_mq = shm_toc_lookup(toc, 1, false);
pgws_proc_queryids = shm_toc_lookup(toc, 2, false);
#else
pgws_collector_hdr = shm_toc_lookup(toc, 0);
pgws_collector_mq = shm_toc_lookup(toc, 1);
pgws_proc_queryids = shm_toc_lookup(toc, 2);
#endif
}

shmem_initialized = true;
Expand All@@ -366,7 +355,7 @@ static void
pgws_cleanup_callback(int code, Datum arg)
{
elog(DEBUG3, "pg_wait_sampling cleanup: detaching shm_mq and releasing queue lock");
shm_mq_detach_compat(recv_mqh, recv_mq);
shm_mq_detach(recv_mqh);
LockRelease(&queueTag, ExclusiveLock, false);
}

Expand DownExpand Up@@ -463,7 +452,7 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
params->ts = GetCurrentTimestamp();

funcctx->user_fctx = params;
tupdesc =CreateTemplateTupleDescCompat(4, false);
tupdesc =CreateTemplateTupleDesc(4);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "type",
Expand DownExpand Up@@ -651,7 +640,7 @@ receive_array(SHMRequest request, Size item_size, Size *count)
PG_END_ENSURE_ERROR_CLEANUP(pgws_cleanup_callback, 0);

/* We still have to detach and release lock during normal operation. */
shm_mq_detach_compat(recv_mqh, recv_mq);
shm_mq_detach(recv_mqh);
LockRelease(&queueTag, ExclusiveLock, false);

return result;
Expand DownExpand Up@@ -684,7 +673,7 @@ pg_wait_sampling_get_profile(PG_FUNCTION_ARGS)
funcctx->max_calls = profile->count;

/* Make tuple descriptor */
tupdesc =CreateTemplateTupleDescCompat(5, false);
tupdesc =CreateTemplateTupleDesc(5);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "type",
Expand DownExpand Up@@ -801,7 +790,7 @@ pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
funcctx->max_calls = history->count;

/* Make tuple descriptor */
tupdesc =CreateTemplateTupleDescCompat(5, false);
tupdesc =CreateTemplateTupleDesc(5);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "sample_ts",
Expand DownExpand Up@@ -879,17 +868,6 @@ pgws_planner_hook(Query *parse,
if (MyProc)
{
int i = MyProc - ProcGlobal->allProcs;
#if PG_VERSION_NUM >= 110000
/*
* since we depend on queryId we need to check that its size
* is uint64 as we coded in pg_wait_sampling
*/
StaticAssertExpr(sizeof(parse->queryId) == sizeof(uint64),
"queryId size is not uint64");
#else
StaticAssertExpr(sizeof(parse->queryId) == sizeof(uint32),
"queryId size is not uint32");
#endif
if (!pgws_proc_queryids[i])
pgws_proc_queryids[i] = parse->queryId;

Expand DownExpand Up@@ -921,17 +899,6 @@ pgws_ExecutorStart(QueryDesc *queryDesc, int eflags)
if (MyProc)
{
i = MyProc - ProcGlobal->allProcs;
#if PG_VERSION_NUM >= 110000
/*
* since we depend on queryId we need to check that its size
* is uint64 as we coded in pg_wait_sampling
*/
StaticAssertExpr(sizeof(queryDesc->plannedstmt->queryId) == sizeof(uint64),
"queryId size is not uint64");
#else
StaticAssertExpr(sizeof(queryDesc->plannedstmt->queryId) == sizeof(uint32),
"queryId size is not uint32");
#endif
if (!pgws_proc_queryids[i])
pgws_proc_queryids[i] = queryDesc->plannedstmt->queryId;
}
Expand Down
7 changes: 1 addition & 6 deletionspg_wait_sampling.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,12 +10,7 @@
#ifndef __PG_WAIT_SAMPLING_H__
#define __PG_WAIT_SAMPLING_H__

#include <postgres.h>

/* Check PostgreSQL version */
#if PG_VERSION_NUM < 90600
#error "You are trying to build pg_wait_sampling with PostgreSQL version lower than 9.6. Please, check you environment."
#endif
#include "postgres.h"

#include "storage/proc.h"
#include "storage/shm_mq.h"
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp