!6620 解决pg_buffercache插件编译、安装问题

Merge pull request !6620 from jeremytim/master
This commit is contained in:
opengauss_bot
2024-11-12 03:29:27 +00:00
committed by Gitee
4 changed files with 5 additions and 17 deletions

View File

@ -1,8 +1,5 @@
# contrib/pg_buffercache/Makefile
MODULE_big = pg_buffercache
OBJS = pg_buffercache_pages.o
EXTENSION = pg_buffercache
DATA = pg_buffercache--1.0.sql pg_buffercache--unpackaged--1.0.sql

View File

@ -3,18 +3,9 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_buffercache" to load this file. \quit
-- Register the function.
CREATE FUNCTION pg_buffercache_pages()
RETURNS SETOF RECORD
AS 'MODULE_PATHNAME', 'pg_buffercache_pages'
LANGUAGE C;
-- Create a view for convenient access.
CREATE VIEW pg_buffercache AS
SELECT P.* FROM pg_buffercache_pages() AS P
(bufferid integer, relfilenode oid, reltablespace oid, reldatabase oid,
relforknumber int2, relblocknumber int8, isdirty bool, usagecount int2);
SELECT * FROM pg_buffercache_pages();
-- 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;

View File

@ -3,5 +3,4 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_buffercache" to load this file. \quit
ALTER EXTENSION pg_buffercache ADD function pg_buffercache_pages();
ALTER EXTENSION pg_buffercache ADD view pg_buffercache;

View File

@ -1,6 +1,6 @@
/*-------------------------------------------------------------------------
*
* pg_buffercache_pages.c
* pg_buffercache_pages.c (deprecated in openGauss)
* display some contents of the buffer cache
*
* contrib/pg_buffercache/pg_buffercache_pages.c
@ -18,14 +18,13 @@
PG_MODULE_MAGIC;
Datum pg_buffercache_pages(PG_FUNCTION_ARGS);
/*
* Record structure holding the to be exposed cache data.
*/
typedef struct {
uint32 bufferid;
Oid relfilenode;
int4 bucketnode;
Oid reltablespace;
Oid reldatabase;
ForkNumber forknum;
@ -49,6 +48,8 @@ typedef struct {
*/
PG_FUNCTION_INFO_V1(pg_buffercache_pages);
extern "C" Datum pg_buffercache_pages(PG_FUNCTION_ARGS);
Datum pg_buffercache_pages(PG_FUNCTION_ARGS)
{
FuncCallContext* funcctx = NULL;