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

Commit96cc18e

Browse files
committed
Put back AcceptInvalidationMessages calls in heap_openrv(_extended).
These calls were removed in commit4240e42as part of a general refactoring and improvement of DDL locking. However,there's a problem not solved by the rewrite, which is that GRANT/REVOKEupdate pg_class.relacl without taking any particular lock on the targettable as such. If another backend fails to do AcceptInvalidationMessages,it won't notice a recently-committed change in ACLs. Bug #7557 from PiotrCzachur demonstrates that there's at least one code path in 9.2.0 in whicha command fails to do any AcceptInvalidationMessages calls at all, if thecurrent transaction already holds all the locks it will need.Since we're hard up against the release deadline for 9.2.1, fix this byputting back the AcceptInvalidationMessages calls in heap_openrv andheap_openrv_extended, thereby restoring the historical behavior in thisarea. We ought to look for a more elegant and perhaps more bulletproofsolution, but there's no time for that right now.
1 parentf1f722d commit96cc18e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,20 @@ relation_openrv(const RangeVar *relation, LOCKMODE lockmode)
986986
{
987987
OidrelOid;
988988

989+
/*
990+
* Check for shared-cache-inval messages before trying to open the
991+
* relation. This is needed even if we already hold a lock on the
992+
* relation, because GRANT/REVOKE are executed without taking any lock on
993+
* the target relation, and we want to be sure we see current ACL
994+
* information. We can skip this if asked for NoLock, on the assumption
995+
* that such a call is not the first one in the current command, and so we
996+
* should be reasonably up-to-date already. (XXX this all could stand to
997+
* be redesigned, but for the moment we'll keep doing this like it's been
998+
* done historically.)
999+
*/
1000+
if (lockmode!=NoLock)
1001+
AcceptInvalidationMessages();
1002+
9891003
/* Look up and lock the appropriate relation using namespace search */
9901004
relOid=RangeVarGetRelid(relation,lockmode, false);
9911005

@@ -1008,6 +1022,13 @@ relation_openrv_extended(const RangeVar *relation, LOCKMODE lockmode,
10081022
{
10091023
OidrelOid;
10101024

1025+
/*
1026+
* Check for shared-cache-inval messages before trying to open the
1027+
* relation. See comments in relation_openrv().
1028+
*/
1029+
if (lockmode!=NoLock)
1030+
AcceptInvalidationMessages();
1031+
10111032
/* Look up and lock the appropriate relation using namespace search */
10121033
relOid=RangeVarGetRelid(relation,lockmode,missing_ok);
10131034

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp