Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions src/backend/storage/smgr/smgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "utils/inval.h"


/* Hook for plugin to get control in smgrextend() */
SmgrExtend_hook_type SmgrExtend_hook = NULL;

/*
* This struct of function pointers defines the API between smgr.c and
* any individual storage manager module. Note that smgr subfunctions are
Expand Down Expand Up @@ -600,6 +603,9 @@ void
smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer, bool skipFsync)
{
if (SmgrExtend_hook)
(*SmgrExtend_hook)(reln, forknum, blocknum,
buffer, skipFsync);
smgrsw[reln->smgr_which].smgr_extend(reln, forknum, blocknum,
buffer, skipFsync);
}
Expand Down
6 changes: 6 additions & 0 deletions src/include/storage/smgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ typedef struct SMgrRelationData

typedef SMgrRelationData *SMgrRelation;

/* Hook for plugins to get control in smgrextend() */
typedef void (*SmgrExtend_hook_type) (SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer, bool skipFsync);
extern PGDLLIMPORT SmgrExtend_hook_type SmgrExtend_hook;


#define SmgrIsTemp(smgr) \
RelFileNodeBackendIsTemp((smgr)->smgr_rnode)

Expand Down
1 change: 1 addition & 0 deletions src/tools/pgindent/typedefs.list
Original file line number Diff line number Diff line change
Expand Up @@ -2161,6 +2161,7 @@ SlruPageStatus
SlruScanCallback
SlruShared
SlruSharedData
SmgrExtend_hook_type
SnapBuild
SnapBuildOnDisk
SnapBuildState
Expand Down