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

Commit2484329

Browse files
committed
Adjust comments of CheckRelationTableSpaceMove() and SetRelationTableSpace()
4c9c359, that introduced those two functions, has been overoptimistic onthe point that only ShareUpdateExclusiveLock would be required whenmoving a relation to a new tablespace. AccessExclusiveLock is arequirement, but ShareUpdateExclusiveLock may be used under specificconditions like REINDEX CONCURRENTLY where waits on past transactionsmake the operation safe even with a lower-level lock. The current codedoes only the former, so update the existing comments to reflect that.Once a REINDEX (TABLESPACE) is introduced, those comments would requirean extra refresh to mention their new use case.While on it, fix an incorrect variable name.Per discussion with Álvaro Herrera.Discussion:https://postgr.es/m/20210127140741.GA14174@alvherre.pgsql
1 parent5c6d184 commit2484329

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,11 +3041,11 @@ SetRelationHasSubclass(Oid relationId, bool relhassubclass)
30413041
* CheckRelationTableSpaceMove
30423042
*Check if relation can be moved to new tablespace.
30433043
*
3044-
* NOTE: Caller must be holding an appropriate lock on the relation.
3045-
* ShareUpdateExclusiveLock is sufficient.
3044+
* NOTE: The caller must hold AccessExclusiveLock on the relation.
30463045
*
3047-
* Returns true if the relation can be moved to the new tablespace;
3048-
* false otherwise.
3046+
* Returns true if the relation can be moved to the new tablespace; raises
3047+
* an error if it is not possible to do the move; returns false if the move
3048+
* would have no effect.
30493049
*/
30503050
bool
30513051
CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId)
@@ -3094,11 +3094,10 @@ CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId)
30943094
*Set new reltablespace and relfilenode in pg_class entry.
30953095
*
30963096
* newTableSpaceId is the new tablespace for the relation, and
3097-
* newRelFileNode its new filenode. Ifnewrelfilenode is InvalidOid,
3097+
* newRelFileNode its new filenode. IfnewRelFileNode is InvalidOid,
30983098
* this field is not updated.
30993099
*
3100-
* NOTE: Caller must be holding an appropriate lock on the relation.
3101-
* ShareUpdateExclusiveLock is sufficient.
3100+
* NOTE: The caller must hold AccessExclusiveLock on the relation.
31023101
*
31033102
* The caller of this routine had better check if a relation can be
31043103
* moved to this new tablespace by calling CheckRelationTableSpaceMove()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp