summaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-08-25 18:52:43 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-08-25 18:52:43 +0000
commit2589735da08c4e597accb6eab5ae65b6339ee630 (patch)
tree829f7073292c6b55f86580863837441991638405 /src/backend/access/transam/xlog.c
parent4699d81dc99ef1687e9396b57b0ed10f42699792 (diff)
Replace implementation of pg_log as a relation accessed through the
buffer manager with 'pg_clog', a specialized access method modeled on pg_xlog. This simplifies startup (don't need to play games to open pg_log; among other things, OverrideTransactionSystem goes away), should improve performance a little, and opens the door to recycling commit log space by removing no-longer-needed segments of the commit log. Actual recycling is not there yet, but I felt I should commit this part separately since it'd still be useful if we chose not to do transaction ID wraparound.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9389f159969..567937ebaee 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.74 2001/08/23 23:06:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.75 2001/08/25 18:52:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,8 +26,11 @@
#include <locale.h>
#endif
+#include "access/clog.h"
#include "access/transam.h"
#include "access/xact.h"
+#include "access/xlog.h"
+#include "access/xlogutils.h"
#include "catalog/catversion.h"
#include "catalog/pg_control.h"
#include "storage/sinval.h"
@@ -35,8 +38,6 @@
#include "storage/spin.h"
#include "storage/s_lock.h"
#include "storage/bufpage.h"
-#include "access/xlog.h"
-#include "access/xlogutils.h"
#include "utils/builtins.h"
#include "utils/relcache.h"
#include "utils/selfuncs.h"
@@ -1580,7 +1581,7 @@ MoveOfflineLogs(uint32 log, uint32 seg, XLogRecPtr endptr)
strspn(xlde->d_name, "0123456789ABCDEF") == 16 &&
strcmp(xlde->d_name, lastoff) <= 0)
{
- sprintf(path, "%s/%s", XLogDir, xlde->d_name);
+ snprintf(path, MAXPGPATH, "%s/%s", XLogDir, xlde->d_name);
if (XLOG_archive_dir[0])
{
elog(LOG, "archiving transaction log file %s",
@@ -2409,6 +2410,9 @@ BootStrapXLOG(void)
/* some additional ControlFile fields are set in WriteControlFile() */
WriteControlFile();
+
+ /* Bootstrap the commit log, too */
+ BootStrapCLOG();
}
static char *
@@ -2543,7 +2547,6 @@ StartupXLOG(void)
ControlFile->time = time(NULL);
UpdateControlFile();
- XLogOpenLogRelation(); /* open pg_log */
XLogInitRelationCache();
/* Is REDO required ? */
@@ -2724,6 +2727,9 @@ StartupXLOG(void)
ThisStartUpID++;
XLogCtl->ThisStartUpID = ThisStartUpID;
+ /* Start up the commit log, too */
+ StartupCLOG();
+
elog(LOG, "database system is ready");
CritSectionCount--;
@@ -2845,6 +2851,7 @@ ShutdownXLOG(void)
CritSectionCount++;
CreateDummyCaches();
CreateCheckPoint(true);
+ ShutdownCLOG();
CritSectionCount--;
elog(LOG, "database system is shut down");
@@ -2981,6 +2988,9 @@ CreateCheckPoint(bool shutdown)
*/
FlushBufferPool();
+ /* And commit-log buffers, too */
+ CheckPointCLOG();
+
/*
* Now insert the checkpoint record into XLOG.
*/