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

Commitaa3299f

Browse files
committed
Avoid retaining multiple relation locks in RangeVarGetRelid.
If it turns out we've locked the wrong OID, release the old lock. Inmost cases, it's pretty harmless to retain the extra lock, but thisseems tidier and avoids using lock table slots unnecessarily.Per discussion with Tom Lane.
1 parenta6ce8ba commitaa3299f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/backend/catalog/namespace.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,18 @@ RangeVarGetRelid(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok,
322322
* If, upon retry, we get back the same OID we did last time, then
323323
* the invalidation messages we processed did not change the final
324324
* answer. So we're done.
325+
*
326+
* If we got a different OID, we've locked the relation that used to
327+
* have this name rather than the one that does now. So release
328+
* the lock.
325329
*/
326-
if (retry&&relId==oldRelId)
327-
break;
330+
if (retry)
331+
{
332+
if (relId==oldRelId)
333+
break;
334+
if (OidIsValid(oldRelId))
335+
UnlockRelationOid(oldRelId,lockmode);
336+
}
328337

329338
/*
330339
* Lock relation. This will also accept any pending invalidation

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp