mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Clean up and document the API for XLogOpenRelation and XLogReadBuffer.
This commit doesn't make much functional change, but it does eliminate some duplicated code --- for instance, PageIsNew tests are now done inside XLogReadBuffer rather than by each caller. The GIST xlog code still needs a lot of love, but I'll worry about that separately.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.178 2006/03/24 04:32:13 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.179 2006/03/29 21:17:38 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -671,7 +671,7 @@ dropdb(const char *dbname, bool missing_ok)
|
||||
* is important to ensure that no remaining backend tries to write out a
|
||||
* dirty buffer to the dead database later...
|
||||
*/
|
||||
DropBuffers(db_id);
|
||||
DropDatabaseBuffers(db_id);
|
||||
|
||||
/*
|
||||
* Also, clean out any entries in the shared free space map.
|
||||
@@ -1377,11 +1377,16 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
|
||||
|
||||
dst_path = GetDatabasePath(xlrec->db_id, xlrec->tablespace_id);
|
||||
|
||||
/*
|
||||
* Drop pages for this database that are in the shared buffer cache
|
||||
*/
|
||||
DropBuffers(xlrec->db_id);
|
||||
/* Drop pages for this database that are in the shared buffer cache */
|
||||
DropDatabaseBuffers(xlrec->db_id);
|
||||
|
||||
/* Also, clean out any entries in the shared free space map */
|
||||
FreeSpaceMapForgetDatabase(xlrec->db_id);
|
||||
|
||||
/* Clean out the xlog relcache too */
|
||||
XLogDropDatabase(xlrec->db_id);
|
||||
|
||||
/* And remove the physical files */
|
||||
if (!rmtree(dst_path, true))
|
||||
ereport(WARNING,
|
||||
(errmsg("could not remove database directory \"%s\"",
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.130 2006/03/24 04:32:13 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.131 2006/03/29 21:17:38 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1140,14 +1140,8 @@ seq_redo(XLogRecPtr lsn, XLogRecord *record)
|
||||
elog(PANIC, "seq_redo: unknown op code %u", info);
|
||||
|
||||
reln = XLogOpenRelation(xlrec->node);
|
||||
if (!RelationIsValid(reln))
|
||||
return;
|
||||
|
||||
buffer = XLogReadBuffer(true, reln, 0);
|
||||
if (!BufferIsValid(buffer))
|
||||
elog(PANIC, "seq_redo: can't read block 0 of rel %u/%u/%u",
|
||||
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode);
|
||||
|
||||
buffer = XLogReadBuffer(reln, 0, true);
|
||||
Assert(BufferIsValid(buffer));
|
||||
page = (Page) BufferGetPage(buffer);
|
||||
|
||||
/* Always reinit the page and reinstall the magic number */
|
||||
|
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.33 2006/03/29 15:15:43 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.34 2006/03/29 21:17:38 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -467,6 +467,12 @@ DropTableSpace(DropTableSpaceStmt *stmt)
|
||||
(void) XLogInsert(RM_TBLSPC_ID, XLOG_TBLSPC_DROP, rdata);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: because we checked that the tablespace was empty, there should
|
||||
* be no need to worry about flushing shared buffers or free space map
|
||||
* entries for relations in the tablespace.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Allow TablespaceCreateDbspace again.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user