aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlogutils.c
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>2000-10-24 09:56:23 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>2000-10-24 09:56:23 +0000
commitdb2faa943a0d3517f9e9641b9012d81ecc870ff6 (patch)
treeded2e15b6978762d5676cc76c51c0fbe51db5e3a /src/backend/access/transam/xlogutils.c
parent4b70629b92185a3d5c5a39e224f38564d1e4fed6 (diff)
downloadpostgresql-db2faa943a0d3517f9e9641b9012d81ecc870ff6.tar.gz
postgresql-db2faa943a0d3517f9e9641b9012d81ecc870ff6.zip
WAL misc
Diffstat (limited to 'src/backend/access/transam/xlogutils.c')
-rw-r--r--src/backend/access/transam/xlogutils.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 5140cfaf34a..2800ff0316f 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -14,6 +14,7 @@
#include "postgres.h"
#include "access/xlog.h"
+#include "access/transam.h"
#include "access/xact.h"
#include "storage/bufpage.h"
#include "storage/bufmgr.h"
@@ -134,10 +135,16 @@ XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr)
/* MUST CHECK WASN'T TUPLE INSERTED IN PREV STARTUP */
- if (XLogIsAborted(htup->t_xmin))
+ if (!(htup->t_infomask & HEAP_XMIN_COMMITTED))
{
- UnlockAndReleaseBuffer(buffer);
- return(false);
+ if (htup->t_infomask & HEAP_XMIN_INVALID ||
+ (htup->t_infomask & HEAP_MOVED_IN &&
+ TransactionIdDidAbort((TransactionId)htup->t_cmin)) ||
+ TransactionIdDidAbort(htup->t_xmin))
+ {
+ UnlockAndReleaseBuffer(buffer);
+ return(false);
+ }
}
UnlockAndReleaseBuffer(buffer);
@@ -145,41 +152,32 @@ XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr)
}
/*
- * ---------------------------------------------------------------
- *
- * Transaction support functions for recovery
- *
- * On recovery we create tmp file to know what xactions were
- * committed/aborted (2 bits per xaction).
- *
- *----------------------------------------------------------------
+ * Open pg_log in recovery
*/
-
-bool
-XLogIsAborted(TransactionId xid)
-{
- return(false);
-}
-
-bool
-XLogIsCommitted(TransactionId xid)
-{
- return(true);
-}
+extern Relation LogRelation; /* pg_log relation */
void
-XLogMarkAborted(TransactionId xid)
+XLogOpenLogRelation(void)
{
- return;
+ Relation logRelation;
+
+ Assert(!LogRelation);
+ logRelation = (Relation) malloc(sizeof(RelationData));
+ memset(logRelation, 0, sizeof(RelationData));
+ logRelation->rd_rel = (Form_pg_class) malloc(sizeof(FormData_pg_class));
+ memset(logRelation->rd_rel, 0, sizeof(FormData_pg_class));
+
+ sprintf(RelationGetPhysicalRelationName(logRelation), "pg_log");
+ logRelation->rd_node.tblNode = InvalidOid;
+ logRelation->rd_node.relNode = RelOid_pg_log;
+ logRelation->rd_unlinked = false; /* must exists */
+ logRelation->rd_fd = -1;
+ logRelation->rd_fd = smgropen(DEFAULT_SMGR, logRelation);
+ if (logRelation->rd_fd < 0)
+ elog(STOP, "XLogOpenLogRelation: failed to open pg_log");
+ LogRelation = logRelation;
}
-void
-XLogMarkCommitted(TransactionId xid)
-{
- return;
-}
-
-
/*
* ---------------------------------------------------------------
*
@@ -274,7 +272,7 @@ _xl_init_rel_cache(void)
_xlrelarr = (XLogRelDesc*) malloc(sizeof(XLogRelDesc) * _xlcnt);
memset(_xlrelarr, 0, sizeof(XLogRelDesc) * _xlcnt);
_xlpgcarr = (Form_pg_class) malloc(sizeof(FormData_pg_class) * _xlcnt);
- memset(_xlpgcarr, 0, sizeof(XLogRelDesc) * _xlcnt);
+ memset(_xlpgcarr, 0, sizeof(FormData_pg_class) * _xlcnt);
_xlrelarr[0].moreRecently = &(_xlrelarr[0]);
_xlrelarr[0].lessRecently = &(_xlrelarr[0]);