8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.81.2.2 2000/10/04 07:50:00 inoue Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.81.2.3 2000/10/22 20:33:22 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1656,7 +1656,6 @@ ReleaseRelationBuffers(Relation rel)
1656
1656
}
1657
1657
/* Now we can do what we came for */
1658
1658
buf -> flags &= ~(BM_DIRTY |BM_JUST_DIRTIED );
1659
- ClearBufferDirtiedByMe (i ,buf );
1660
1659
1661
1660
/*
1662
1661
* Release any refcount we may have.
@@ -1680,7 +1679,23 @@ ReleaseRelationBuffers(Relation rel)
1680
1679
*/
1681
1680
BufTableDelete (buf );
1682
1681
}
1682
+
1683
+ /*
1684
+ * Also check to see if BufferDirtiedByMe info for this buffer
1685
+ * refers to the target relation, and clear it if so. This is
1686
+ * independent of whether the current contents of the buffer
1687
+ * belong to the target relation!
1688
+ *
1689
+ * NOTE: we have no way to clear BufferDirtiedByMe info in other
1690
+ * backends, but hopefully there are none with that bit set for
1691
+ * this rel, since we hold exclusive lock on this rel.
1692
+ */
1693
+ if (BufferTagLastDirtied [i - 1 ].relId .relId == relid &&
1694
+ (BufferTagLastDirtied [i - 1 ].relId .dbId == MyDatabaseId ||
1695
+ BufferTagLastDirtied [i - 1 ].relId .dbId == (Oid )NULL ))
1696
+ BufferDirtiedByMe [i - 1 ]= false;
1683
1697
}
1698
+
1684
1699
SpinRelease (BufMgrLock );
1685
1700
}
1686
1701
@@ -1726,7 +1741,6 @@ DropBuffers(Oid dbid)
1726
1741
}
1727
1742
/* Now we can do what we came for */
1728
1743
buf -> flags &= ~(BM_DIRTY |BM_JUST_DIRTIED );
1729
- ClearBufferDirtiedByMe (i ,buf );
1730
1744
1731
1745
/*
1732
1746
* The thing should be free, if caller has checked that no
@@ -1738,7 +1752,20 @@ DropBuffers(Oid dbid)
1738
1752
*/
1739
1753
BufTableDelete (buf );
1740
1754
}
1755
+
1756
+ /*
1757
+ * Also check to see if BufferDirtiedByMe info for this buffer
1758
+ * refers to the target database, and clear it if so. This is
1759
+ * independent of whether the current contents of the buffer
1760
+ * belong to the target database!
1761
+ *
1762
+ * (Actually, this is probably unnecessary, since I shouldn't have
1763
+ * ever dirtied pages of the target database, but...)
1764
+ */
1765
+ if (BufferTagLastDirtied [i - 1 ].relId .dbId == dbid )
1766
+ BufferDirtiedByMe [i - 1 ]= false;
1741
1767
}
1768
+
1742
1769
SpinRelease (BufMgrLock );
1743
1770
}
1744
1771