diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-07-17 03:32:14 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-07-17 03:32:14 +0000 |
commit | fe548629c50b753e96515ba2cfd8a85e8fba10de (patch) | |
tree | e80b54f71cb7868db3f9f9c97bccf4c48859951a /src/backend/storage/buffer/localbuf.c | |
parent | f4c069ca8fc80640bd1bff510697371ffaf45267 (diff) | |
download | postgresql-fe548629c50b753e96515ba2cfd8a85e8fba10de.tar.gz postgresql-fe548629c50b753e96515ba2cfd8a85e8fba10de.zip |
Invent ResourceOwner mechanism as per my recent proposal, and use it to
keep track of portal-related resources separately from transaction-related
resources. This allows cursors to work in a somewhat sane fashion with
nested transactions. For now, cursor behavior is non-subtransactional,
that is a cursor's state does not roll back if you abort a subtransaction
that fetched from the cursor. We might want to change that later.
Diffstat (limited to 'src/backend/storage/buffer/localbuf.c')
-rw-r--r-- | src/backend/storage/buffer/localbuf.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index f4d1163f16a..7103c46c11f 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.56 2004/06/18 06:13:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.57 2004/07/17 03:28:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,7 @@ #include "storage/bufmgr.h" #include "storage/smgr.h" #include "utils/relcache.h" +#include "utils/resowner.h" /*#define LBDEBUG*/ @@ -62,6 +63,8 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) #endif LocalRefCount[i]++; + ResourceOwnerRememberBuffer(CurrentResourceOwner, + BufferDescriptorGetBuffer(bufHdr)); if (bufHdr->flags & BM_VALID) *foundPtr = TRUE; else @@ -88,6 +91,8 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) { bufHdr = &LocalBufferDescriptors[b]; LocalRefCount[b]++; + ResourceOwnerRememberBuffer(CurrentResourceOwner, + BufferDescriptorGetBuffer(bufHdr)); nextFreeLocalBuf = (b + 1) % NLocBuffer; break; } @@ -179,6 +184,7 @@ WriteLocalBuffer(Buffer buffer, bool release) { Assert(LocalRefCount[bufid] > 0); LocalRefCount[bufid]--; + ResourceOwnerForgetBuffer(CurrentResourceOwner, buffer); } } |