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

Commit5ac5980

Browse files
committed
More cleanup after failed reduced-lock-levels-for-DDL feature.
Turns out that use of ShareUpdateExclusiveLock or ShareRowExclusiveLockto protect DDL changes had gotten copied into several places that werenot touched by either of Simon's original patches for the feature, andthus neither he nor I thought to revert them. (Indeed, it appears thattwo of these uses were committed *after* the reversion, which just goesto show that git merging is no panacea.) Change these places to useAccessExclusiveLock again. If we ever manage to resurrect that feature,we're going to have to think a bit harder about how to keep lock levelusage in sync for DDL operations that aren't within the AlterTableinfrastructure.Two of these bugs are only in HEAD, but one is in the 9.1 branch too.Alvaro found one of them, I found the other two.
1 parentc8e8b5a commit5ac5980

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

‎src/backend/catalog/toasting.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ AlterTableCreateToastTable(Oid relOid, Datum reloptions)
5858
Relationrel;
5959

6060
/*
61-
* Grab a DDL-exclusive lock on the target table, since we'll update the
62-
* pg_class tuple.This is redundant for all present users. Tuple
63-
* toasting behaves safely in the face of a concurrent TOAST table add.
61+
* Grab an exclusive lock on the target table, since we'll update its
62+
* pg_class tuple. This is redundant for all present uses, since caller
63+
* will have such a lock already. But the lock is needed to ensure that
64+
* concurrent readers of the pg_class tuple won't have visibility issues,
65+
* so let's be safe.
6466
*/
65-
rel=heap_open(relOid,ShareUpdateExclusiveLock);
67+
rel=heap_open(relOid,AccessExclusiveLock);
6668

6769
/* create_toast_table does all the work */
6870
(void)create_toast_table(rel,InvalidOid,InvalidOid,reloptions);

‎src/backend/commands/trigger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ DropTrigger(RangeVar *relation, const char *trigname, DropBehavior behavior,
10381038
ObjectAddressobject;
10391039

10401040
/* lock level should match RemoveTriggerById */
1041-
relid=RangeVarGetRelid(relation,ShareRowExclusiveLock, false, false);
1041+
relid=RangeVarGetRelid(relation,AccessExclusiveLock, false, false);
10421042

10431043
object.classId=TriggerRelationId;
10441044
object.objectId=get_trigger_oid(relid,trigname,missing_ok);

‎src/backend/rewrite/rewriteRemove.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ RemoveRewriteRule(RangeVar *relation, const char *ruleName,
4545
OidowningRel;
4646
ObjectAddressobject;
4747

48-
/* should match RemoveRewriteRuleById */
49-
owningRel=RangeVarGetRelid(relation,ShareUpdateExclusiveLock,
48+
/*lock levelshould match RemoveRewriteRuleById */
49+
owningRel=RangeVarGetRelid(relation,AccessExclusiveLock,
5050
false, false);
5151

5252
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp