mirror of https://github.com/postgres/postgres
Back-patch fix for bogus clearing of BufferDirtiedByMe.
This commit is contained in:
parent
6dee4ac84c
commit
6779723126
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.81.2.2 2000/10/04 07:50:00 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.81.2.3 2000/10/22 20:33:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -1656,7 +1656,6 @@ recheck:
|
|||
}
|
||||
/* Now we can do what we came for */
|
||||
buf->flags &= ~(BM_DIRTY | BM_JUST_DIRTIED);
|
||||
ClearBufferDirtiedByMe(i, buf);
|
||||
|
||||
/*
|
||||
* Release any refcount we may have.
|
||||
|
@ -1680,7 +1679,23 @@ recheck:
|
|||
*/
|
||||
BufTableDelete(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Also check to see if BufferDirtiedByMe info for this buffer
|
||||
* refers to the target relation, and clear it if so. This is
|
||||
* independent of whether the current contents of the buffer
|
||||
* belong to the target relation!
|
||||
*
|
||||
* NOTE: we have no way to clear BufferDirtiedByMe info in other
|
||||
* backends, but hopefully there are none with that bit set for
|
||||
* this rel, since we hold exclusive lock on this rel.
|
||||
*/
|
||||
if (BufferTagLastDirtied[i - 1].relId.relId == relid &&
|
||||
(BufferTagLastDirtied[i - 1].relId.dbId == MyDatabaseId ||
|
||||
BufferTagLastDirtied[i - 1].relId.dbId == (Oid) NULL))
|
||||
BufferDirtiedByMe[i - 1] = false;
|
||||
}
|
||||
|
||||
SpinRelease(BufMgrLock);
|
||||
}
|
||||
|
||||
|
@ -1726,7 +1741,6 @@ recheck:
|
|||
}
|
||||
/* Now we can do what we came for */
|
||||
buf->flags &= ~(BM_DIRTY | BM_JUST_DIRTIED);
|
||||
ClearBufferDirtiedByMe(i, buf);
|
||||
|
||||
/*
|
||||
* The thing should be free, if caller has checked that no
|
||||
|
@ -1738,7 +1752,20 @@ recheck:
|
|||
*/
|
||||
BufTableDelete(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Also check to see if BufferDirtiedByMe info for this buffer
|
||||
* refers to the target database, and clear it if so. This is
|
||||
* independent of whether the current contents of the buffer
|
||||
* belong to the target database!
|
||||
*
|
||||
* (Actually, this is probably unnecessary, since I shouldn't have
|
||||
* ever dirtied pages of the target database, but...)
|
||||
*/
|
||||
if (BufferTagLastDirtied[i - 1].relId.dbId == dbid)
|
||||
BufferDirtiedByMe[i - 1] = false;
|
||||
}
|
||||
|
||||
SpinRelease(BufMgrLock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue