mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Rethink the way FSM truncation works. Instead of WAL-logging FSM
truncations in FSM code, call FreeSpaceMapTruncateRel from smgr_redo. To make that cleaner from modularity point of view, move the WAL-logging one level up to RelationTruncate, and move RelationTruncate and all the related WAL-logging to new src/backend/catalog/storage.c file. Introduce new RelationCreateStorage and RelationDropStorage functions that are used instead of calling smgrcreate/smgrscheduleunlink directly. Move the pending rel deletion stuff from smgrcreate/smgrscheduleunlink to the new functions. This leaves smgr.c as a thin wrapper around md.c; all the transactional stuff is now in storage.c. This will make it easier to add new forks with similar truncation logic, like the visibility map.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.63 2008/08/11 11:05:11 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.64 2008/11/19 10:34:52 heikki Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -65,10 +65,7 @@ extern void smgrsetowner(SMgrRelation *owner, SMgrRelation reln);
|
||||
extern void smgrclose(SMgrRelation reln);
|
||||
extern void smgrcloseall(void);
|
||||
extern void smgrclosenode(RelFileNode rnode);
|
||||
extern void smgrcreate(SMgrRelation reln, ForkNumber forknum,
|
||||
bool isTemp, bool isRedo);
|
||||
extern void smgrscheduleunlink(SMgrRelation reln, ForkNumber forknum,
|
||||
bool isTemp);
|
||||
extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo);
|
||||
extern void smgrdounlink(SMgrRelation reln, ForkNumber forknum,
|
||||
bool isTemp, bool isRedo);
|
||||
extern void smgrextend(SMgrRelation reln, ForkNumber forknum,
|
||||
@@ -81,21 +78,10 @@ extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum);
|
||||
extern void smgrtruncate(SMgrRelation reln, ForkNumber forknum,
|
||||
BlockNumber nblocks, bool isTemp);
|
||||
extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum);
|
||||
extern void smgrDoPendingDeletes(bool isCommit);
|
||||
extern int smgrGetPendingDeletes(bool forCommit, RelFileFork **ptr,
|
||||
bool *haveNonTemp);
|
||||
extern void AtSubCommit_smgr(void);
|
||||
extern void AtSubAbort_smgr(void);
|
||||
extern void PostPrepare_smgr(void);
|
||||
extern void smgrcommit(void);
|
||||
extern void smgrabort(void);
|
||||
extern void smgrpreckpt(void);
|
||||
extern void smgrsync(void);
|
||||
extern void smgrpostckpt(void);
|
||||
|
||||
extern void smgr_redo(XLogRecPtr lsn, XLogRecord *record);
|
||||
extern void smgr_desc(StringInfo buf, uint8 xl_info, char *rec);
|
||||
|
||||
|
||||
/* internals: move me elsewhere -- ay 7/94 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user