diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/pg_buffercache/Makefile | 4 | ||||
-rw-r--r-- | contrib/pg_buffercache/meson.build | 1 | ||||
-rw-r--r-- | contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql | 30 | ||||
-rw-r--r-- | contrib/pg_buffercache/pg_buffercache.control | 2 | ||||
-rw-r--r-- | contrib/pg_buffercache/pg_buffercache_pages.c | 39 | ||||
-rw-r--r-- | contrib/pg_prewarm/autoprewarm.c | 4 | ||||
-rw-r--r-- | contrib/pg_walinspect/expected/pg_walinspect.out | 4 | ||||
-rw-r--r-- | contrib/pg_walinspect/sql/pg_walinspect.sql | 4 |
8 files changed, 13 insertions, 75 deletions
diff --git a/contrib/pg_buffercache/Makefile b/contrib/pg_buffercache/Makefile index 4d88eba5e3a..d74b3e853c6 100644 --- a/contrib/pg_buffercache/Makefile +++ b/contrib/pg_buffercache/Makefile @@ -6,8 +6,8 @@ OBJS = \ pg_buffercache_pages.o EXTENSION = pg_buffercache -DATA = pg_buffercache--1.0--1.1.sql pg_buffercache--1.1--1.2.sql pg_buffercache--1.2.sql \ - pg_buffercache--1.2--1.3.sql pg_buffercache--1.3--1.4.sql +DATA = pg_buffercache--1.2.sql pg_buffercache--1.2--1.3.sql \ + pg_buffercache--1.1--1.2.sql pg_buffercache--1.0--1.1.sql PGFILEDESC = "pg_buffercache - monitoring of shared buffer cache in real-time" REGRESS = pg_buffercache diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build index 9f34754d6c3..2c69eae3ea2 100644 --- a/contrib/pg_buffercache/meson.build +++ b/contrib/pg_buffercache/meson.build @@ -11,7 +11,6 @@ install_data( 'pg_buffercache--1.1--1.2.sql', 'pg_buffercache--1.2--1.3.sql', 'pg_buffercache--1.2.sql', - 'pg_buffercache--1.3--1.4.sql', 'pg_buffercache.control', kwargs: contrib_data_args, ) diff --git a/contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql b/contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql deleted file mode 100644 index 50956b195a8..00000000000 --- a/contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* contrib/pg_buffercache/pg_buffercache--1.3--1.4.sql */ - --- complain if script is sourced in psql, rather than via ALTER EXTENSION -\echo Use "ALTER EXTENSION pg_buffercache UPDATE TO '1.4'" to load this file. \quit - -/* First we have to remove them from the extension */ -ALTER EXTENSION pg_buffercache DROP VIEW pg_buffercache; -ALTER EXTENSION pg_buffercache DROP FUNCTION pg_buffercache_pages(); - -/* Then we can drop them */ -DROP VIEW pg_buffercache; -DROP FUNCTION pg_buffercache_pages(); - -/* Now redefine */ -CREATE FUNCTION pg_buffercache_pages() -RETURNS SETOF RECORD -AS 'MODULE_PATHNAME', 'pg_buffercache_pages_v1_4' -LANGUAGE C PARALLEL SAFE; - -CREATE VIEW pg_buffercache AS - SELECT P.* FROM pg_buffercache_pages() AS P - (bufferid integer, relfilenode int8, reltablespace oid, reldatabase oid, - relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2, - pinning_backends int4); - --- Don't want these to be available to public. -REVOKE ALL ON FUNCTION pg_buffercache_pages() FROM PUBLIC; -REVOKE ALL ON pg_buffercache FROM PUBLIC; -GRANT EXECUTE ON FUNCTION pg_buffercache_pages() TO pg_monitor; -GRANT SELECT ON pg_buffercache TO pg_monitor; diff --git a/contrib/pg_buffercache/pg_buffercache.control b/contrib/pg_buffercache/pg_buffercache.control index a82ae5f9bb5..8c060ae9abf 100644 --- a/contrib/pg_buffercache/pg_buffercache.control +++ b/contrib/pg_buffercache/pg_buffercache.control @@ -1,5 +1,5 @@ # pg_buffercache extension comment = 'examine the shared buffer cache' -default_version = '1.4' +default_version = '1.3' module_pathname = '$libdir/pg_buffercache' relocatable = true diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c index a45f240499a..c5754ea9fa5 100644 --- a/contrib/pg_buffercache/pg_buffercache_pages.c +++ b/contrib/pg_buffercache/pg_buffercache_pages.c @@ -59,10 +59,9 @@ typedef struct * relation node/tablespace/database/blocknum and dirty indicator. */ PG_FUNCTION_INFO_V1(pg_buffercache_pages); -PG_FUNCTION_INFO_V1(pg_buffercache_pages_v1_4); -static Datum -pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid) +Datum +pg_buffercache_pages(PG_FUNCTION_ARGS) { FuncCallContext *funcctx; Datum result; @@ -104,7 +103,7 @@ pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid) TupleDescInitEntry(tupledesc, (AttrNumber) 1, "bufferid", INT4OID, -1, 0); TupleDescInitEntry(tupledesc, (AttrNumber) 2, "relfilenode", - rfn_typid, -1, 0); + OIDOID, -1, 0); TupleDescInitEntry(tupledesc, (AttrNumber) 3, "reltablespace", OIDOID, -1, 0); TupleDescInitEntry(tupledesc, (AttrNumber) 4, "reldatabase", @@ -210,24 +209,7 @@ pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid) } else { - if (rfn_typid == INT8OID) - values[1] = - Int64GetDatum((int64) fctx->record[i].relfilenumber); - else - { - Assert(rfn_typid == OIDOID); - - if (fctx->record[i].relfilenumber > OID_MAX) - ereport(ERROR, - errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("relfilenode %llu is too large to be represented as an OID", - (unsigned long long) fctx->record[i].relfilenumber), - errhint("Upgrade the extension using ALTER EXTENSION pg_buffercache UPDATE")); - - values[1] = - ObjectIdGetDatum((Oid) fctx->record[i].relfilenumber); - } - + values[1] = ObjectIdGetDatum(fctx->record[i].relfilenumber); nulls[1] = false; values[2] = ObjectIdGetDatum(fctx->record[i].reltablespace); nulls[2] = false; @@ -255,16 +237,3 @@ pg_buffercache_pages_internal(PG_FUNCTION_ARGS, Oid rfn_typid) else SRF_RETURN_DONE(funcctx); } - -/* entry point for old extension version */ -Datum -pg_buffercache_pages(PG_FUNCTION_ARGS) -{ - return pg_buffercache_pages_internal(fcinfo, OIDOID); -} - -Datum -pg_buffercache_pages_v1_4(PG_FUNCTION_ARGS) -{ - return pg_buffercache_pages_internal(fcinfo, INT8OID); -} diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c index 31caf101a94..c8d673a20e3 100644 --- a/contrib/pg_prewarm/autoprewarm.c +++ b/contrib/pg_prewarm/autoprewarm.c @@ -345,7 +345,7 @@ apw_load_buffers(void) { unsigned forknum; - if (fscanf(file, "%u,%u," UINT64_FORMAT ",%u,%u\n", &blkinfo[i].database, + if (fscanf(file, "%u,%u,%u,%u,%u\n", &blkinfo[i].database, &blkinfo[i].tablespace, &blkinfo[i].filenumber, &forknum, &blkinfo[i].blocknum) != 5) ereport(ERROR, @@ -669,7 +669,7 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged) { CHECK_FOR_INTERRUPTS(); - ret = fprintf(file, "%u,%u," UINT64_FORMAT ",%u,%u\n", + ret = fprintf(file, "%u,%u,%u,%u,%u\n", block_info_array[i].database, block_info_array[i].tablespace, block_info_array[i].filenumber, diff --git a/contrib/pg_walinspect/expected/pg_walinspect.out b/contrib/pg_walinspect/expected/pg_walinspect.out index e9b06ed3af2..a1ee743457c 100644 --- a/contrib/pg_walinspect/expected/pg_walinspect.out +++ b/contrib/pg_walinspect/expected/pg_walinspect.out @@ -54,9 +54,9 @@ SELECT COUNT(*) >= 0 AS ok FROM pg_get_wal_stats_till_end_of_wal(:'wal_lsn1'); -- =================================================================== -- Test for filtering out WAL records of a particular table -- =================================================================== -SELECT relfilenode AS sample_tbl_relfilenode FROM pg_class WHERE relname = 'sample_tbl' \gset +SELECT oid AS sample_tbl_oid FROM pg_class WHERE relname = 'sample_tbl' \gset SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_records_info(:'wal_lsn1', :'wal_lsn2') - WHERE block_ref LIKE concat('%', :'sample_tbl_relfilenode', '%') AND resource_manager = 'Heap'; + WHERE block_ref LIKE concat('%', :'sample_tbl_oid', '%') AND resource_manager = 'Heap'; ok ---- t diff --git a/contrib/pg_walinspect/sql/pg_walinspect.sql b/contrib/pg_walinspect/sql/pg_walinspect.sql index 53938341257..1b265ea7bcc 100644 --- a/contrib/pg_walinspect/sql/pg_walinspect.sql +++ b/contrib/pg_walinspect/sql/pg_walinspect.sql @@ -39,10 +39,10 @@ SELECT COUNT(*) >= 0 AS ok FROM pg_get_wal_stats_till_end_of_wal(:'wal_lsn1'); -- Test for filtering out WAL records of a particular table -- =================================================================== -SELECT relfilenode AS sample_tbl_relfilenode FROM pg_class WHERE relname = 'sample_tbl' \gset +SELECT oid AS sample_tbl_oid FROM pg_class WHERE relname = 'sample_tbl' \gset SELECT COUNT(*) >= 1 AS ok FROM pg_get_wal_records_info(:'wal_lsn1', :'wal_lsn2') - WHERE block_ref LIKE concat('%', :'sample_tbl_relfilenode', '%') AND resource_manager = 'Heap'; + WHERE block_ref LIKE concat('%', :'sample_tbl_oid', '%') AND resource_manager = 'Heap'; -- =================================================================== -- Test for filtering out WAL records based on resource_manager and |