aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>1998-12-15 12:47:01 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>1998-12-15 12:47:01 +0000
commit3f7fbf85dc5b42dfd33c803efe6c90533773576a (patch)
treedf8f84075ae7a27fa6b7ec0d063a03898e0b1bbb /src/backend/storage/ipc
parentc5a27161a188b235ce3c0afb1b12e8942ac8e963 (diff)
downloadpostgresql-3f7fbf85dc5b42dfd33c803efe6c90533773576a.tar.gz
postgresql-3f7fbf85dc5b42dfd33c803efe6c90533773576a.zip
Initial MVCC code.
New code for locking buffer' context.
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r--src/backend/storage/ipc/ipci.c7
-rw-r--r--src/backend/storage/ipc/shmem.c23
2 files changed, 13 insertions, 17 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index f6ce9eda241..47305f3f087 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.16 1998/09/01 03:25:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.17 1998/12/15 12:46:24 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,6 @@
#include "postgres.h"
#include "storage/ipc.h"
-#include "storage/multilev.h"
#include "storage/sinval.h"
#include "storage/bufmgr.h"
#include "storage/proc.h"
@@ -92,7 +91,7 @@ CreateSharedMemoryAndSemaphores(IPCKey key)
* ----------------
*/
InitLocks();
- if (InitMultiLevelLocks() == INVALID_TABLEID)
+ if (InitLockTable() == INVALID_TABLEID)
elog(FATAL, "Couldn't create the lock table");
/* ----------------
@@ -145,7 +144,7 @@ AttachSharedMemoryAndSemaphores(IPCKey key)
* ----------------
*/
InitLocks();
- if (InitMultiLevelLocks() == INVALID_TABLEID)
+ if (InitLockTable() == INVALID_TABLEID)
elog(FATAL, "Couldn't attach to the lock table");
AttachSharedInvalidationState(key);
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 18b8d718d67..17416fc9eef 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.31 1998/09/01 04:31:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.32 1998/12/15 12:46:24 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,7 +68,8 @@
#include "utils/dynahash.h"
#include "utils/hsearch.h"
#include "utils/memutils.h"
-#include "access/transam.h"
+#include "access/xact.h"
+#include "utils/tqual.h"
/* shared memory global variables */
@@ -629,7 +630,6 @@ TransactionIdIsInProgress(TransactionId xid)
return false;
}
-#ifdef LowLevelLocking
/*
* GetSnapshotData -- returns information about running transactions.
*
@@ -645,16 +645,15 @@ Snapshot
GetSnapshotData(bool serialized)
{
Snapshot snapshot = (Snapshot) malloc(sizeof(SnapshotData));
- TransactionId snapshot->xip = (TransactionId *)
- malloc(32 * sizeof(TransactionId));
ShmemIndexEnt *result;
PROC *proc;
TransactionId cid = GetCurrentTransactionId();
- uint count = 0;
- unit free = 31;
+ uint32 count = 0;
+ uint32 have = 31;
Assert(ShmemIndex);
+ snapshot->xip = (TransactionId *) malloc(32 * sizeof(TransactionId));
snapshot->xmax = cid;
snapshot->xmin = cid;
@@ -676,20 +675,20 @@ GetSnapshotData(bool serialized)
continue;
proc = (PROC *) MAKE_PTR(result->location);
if (proc == MyProc || proc->xid < FirstTransactionId ||
- serialized && proc->xid >= cid)
+ (serialized && proc->xid >= cid))
continue;
if (proc->xid < snapshot->xmin)
snapshot->xmin = proc->xid;
else if (proc->xid > snapshot->xmax)
snapshot->xmax = proc->xid;
- if (free == 0)
+ if (have == 0)
{
snapshot->xip = (TransactionId *) realloc(snapshot->xip,
(count + 33) * sizeof(TransactionId));
- free = 32;
+ have = 32;
}
snapshot->xip[count] = proc->xid;
- free--;
+ have--;
count++;
}
@@ -699,5 +698,3 @@ GetSnapshotData(bool serialized)
elog(ERROR, "GetSnapshotData: ShmemIndex corrupted");
return NULL;
}
-
-#endif