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

Commite038b77

Browse files
committed
AccessExclusiveLock new relations just after assigning the OID.
This has no user-visible, important consequences, since other sessions'catalog scans can't find the relation until we commit. However, thisunblocks introducing a rule about locks required to heap_update() apg_class row. CREATE TABLE has been acquiring this lock eventually, butit can heap_update() pg_class.relchecks earlier. create_toast_table()has been acquiring only ShareLock. Back-patch to v12 (all supportedversions), the plan for the commit relying on the new rule.Reviewed (in an earlier version) by Robert Haas.Discussion:https://postgr.es/m/20240611024525.9f.nmisch@google.com
1 parent578db9c commite038b77

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎src/backend/catalog/heap.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,13 @@ heap_create_with_catalog(const char *relname,
12641264
relpersistence);
12651265
}
12661266

1267+
/*
1268+
* Other sessions' catalog scans can't find this until we commit. Hence,
1269+
* it doesn't hurt to hold AccessExclusiveLock. Do it here so callers
1270+
* can't accidentally vary in their lock mode or acquisition timing.
1271+
*/
1272+
LockRelationOid(relid,AccessExclusiveLock);
1273+
12671274
/*
12681275
* Determine the relation's initial permissions.
12691276
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp