Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6779723

Browse files
committed
Back-patch fix for bogus clearing of BufferDirtiedByMe.
1 parent6dee4ac commit6779723

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1656,7 +1656,6 @@ ReleaseRelationBuffers(Relation rel)
16561656
}
16571657
/* Now we can do what we came for */
16581658
buf->flags &= ~(BM_DIRTY |BM_JUST_DIRTIED);
1659-
ClearBufferDirtiedByMe(i,buf);
16601659

16611660
/*
16621661
* Release any refcount we may have.
@@ -1680,7 +1679,23 @@ ReleaseRelationBuffers(Relation rel)
16801679
*/
16811680
BufTableDelete(buf);
16821681
}
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;
16831697
}
1698+
16841699
SpinRelease(BufMgrLock);
16851700
}
16861701

@@ -1726,7 +1741,6 @@ DropBuffers(Oid dbid)
17261741
}
17271742
/* Now we can do what we came for */
17281743
buf->flags &= ~(BM_DIRTY |BM_JUST_DIRTIED);
1729-
ClearBufferDirtiedByMe(i,buf);
17301744

17311745
/*
17321746
* The thing should be free, if caller has checked that no
@@ -1738,7 +1752,20 @@ DropBuffers(Oid dbid)
17381752
*/
17391753
BufTableDelete(buf);
17401754
}
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;
17411767
}
1768+
17421769
SpinRelease(BufMgrLock);
17431770
}
17441771

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp