1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Reduce lock levels for ALTER TABLE SET autovacuum storage options

Reduce lock levels down to ShareUpdateExclusiveLock for all autovacuum-related
relation options when setting them using ALTER TABLE.

Add infrastructure to allow varying lock levels for relation options in later
patches. Setting multiple options together uses the highest lock level required
for any option. Works for both main and toast tables.

Fabrízio Mello, reviewed by Michael Paquier, mild edit and additional regression
tests from myself
This commit is contained in:
Simon Riggs
2015-08-14 14:19:28 +01:00
parent f16d52269a
commit 47167b7907
6 changed files with 219 additions and 43 deletions

View File

@ -3038,16 +3038,12 @@ AlterTableGetLockLevel(List *cmds)
* are set here for tables, views and indexes; for historical
* reasons these can all be used with ALTER TABLE, so we can't
* decide between them using the basic grammar.
*
* XXX Look in detail at each option to determine lock level,
* e.g. cmd_lockmode = GetRelOptionsLockLevel((List *)
* cmd->def);
*/
case AT_SetRelOptions: /* Uses MVCC in getIndexes() and
* getTables() */
case AT_ResetRelOptions: /* Uses MVCC in getIndexes() and
* getTables() */
cmd_lockmode = AccessExclusiveLock;
cmd_lockmode = AlterTableGetRelOptionsLockLevel((List *) cmd->def);
break;
default: /* oops */