From 1f6d8b90b83e02af8e73adcb167581bb10d6be22 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 9 Apr 2000 04:43:20 +0000 Subject: Buffer manager modifications to keep a local buffer-dirtied bit as well as a shared dirtybit for each shared buffer. The shared dirtybit still controls writing the buffer, but the local bit controls whether we need to fsync the buffer's file. This arrangement fixes a bug that allowed some required fsyncs to be missed, and should improve performance as well. For more info see my post of same date on pghackers. --- src/backend/storage/buffer/buf_init.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/backend/storage/buffer/buf_init.c') diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index 0a58033c97..4f1d033bc4 100644 --- a/src/backend/storage/buffer/buf_init.c +++ b/src/backend/storage/buffer/buf_init.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.32 2000/01/26 05:56:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.33 2000/04/09 04:43:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -65,9 +65,11 @@ long *NWaitIOBackendP; extern IpcSemaphoreId WaitIOSemId; long *PrivateRefCount; /* also used in freelist.c */ -bits8 *BufferLocks; /* */ -long *CommitInfoNeedsSave;/* to write buffers where we have filled - * in t_infomask */ +bits8 *BufferLocks; /* flag bits showing locks I have set */ +BufferTag *BufferTagLastDirtied; /* tag buffer had when last dirtied by me */ +BufferBlindId *BufferBlindLastDirtied; /* and its BlindId too */ +bool *BufferDirtiedByMe; /* T if buf has been dirtied in cur xact */ + /* * Data Structures: @@ -247,7 +249,9 @@ InitBufferPool(IPCKey key) #endif PrivateRefCount = (long *) calloc(NBuffers, sizeof(long)); BufferLocks = (bits8 *) calloc(NBuffers, sizeof(bits8)); - CommitInfoNeedsSave = (long *) calloc(NBuffers, sizeof(long)); + BufferTagLastDirtied = (BufferTag *) calloc(NBuffers, sizeof(BufferTag)); + BufferBlindLastDirtied = (BufferBlindId *) calloc(NBuffers, sizeof(BufferBlindId)); + BufferDirtiedByMe = (bool *) calloc(NBuffers, sizeof(bool)); } /* ----------------------------------------------------- -- cgit v1.2.1