mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Add an "unset" value for vacuum_index_cleanup.
This commit adds a new value to StdRdOptIndexCleanup to distinguish whether it is explicitly set, similar to ViewOptCheckOption's VIEW_OPTION_CHECK_OPTION_NOT_SET. This changes only the internal representation; an unset value still defaults to AUTO, and the option accepts the same input as before. This is preparatory work for a follow-up commit that will make use of the new "unset" state. Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Sami Imseih <samimseih@gmail.com> Tested-by: Greg Burd <greg@burd.me> Tested-by: solai v <solai.cdac@gmail.com> Discussion: https://postgr.es/m/aFRxC1W_kZU9OjJ9%40nathan
This commit is contained in:
@@ -517,6 +517,7 @@ static relopt_real realRelOpts[] =
|
||||
/* values from StdRdOptIndexCleanup */
|
||||
static relopt_enum_elt_def StdRdOptIndexCleanupValues[] =
|
||||
{
|
||||
/* no value for NOT_SET */
|
||||
{"auto", STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO},
|
||||
{"on", STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON},
|
||||
{"off", STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF},
|
||||
@@ -557,7 +558,7 @@ static relopt_enum enumRelOpts[] =
|
||||
ShareUpdateExclusiveLock
|
||||
},
|
||||
StdRdOptIndexCleanupValues,
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO,
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
|
||||
gettext_noop("Valid values are \"on\", \"off\", and \"auto\".")
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2210,20 +2210,25 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams params,
|
||||
StdRdOptIndexCleanup vacuum_index_cleanup;
|
||||
|
||||
if (rel->rd_options == NULL)
|
||||
vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO;
|
||||
vacuum_index_cleanup = STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET;
|
||||
else
|
||||
vacuum_index_cleanup =
|
||||
((StdRdOptions *) rel->rd_options)->vacuum_index_cleanup;
|
||||
|
||||
if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO)
|
||||
params.index_cleanup = VACOPTVALUE_AUTO;
|
||||
else if (vacuum_index_cleanup == STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON)
|
||||
params.index_cleanup = VACOPTVALUE_ENABLED;
|
||||
else
|
||||
switch (vacuum_index_cleanup)
|
||||
{
|
||||
Assert(vacuum_index_cleanup ==
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF);
|
||||
params.index_cleanup = VACOPTVALUE_DISABLED;
|
||||
case STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON:
|
||||
params.index_cleanup = VACOPTVALUE_ENABLED;
|
||||
break;
|
||||
case STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF:
|
||||
params.index_cleanup = VACOPTVALUE_DISABLED;
|
||||
break;
|
||||
case STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO:
|
||||
params.index_cleanup = VACOPTVALUE_AUTO;
|
||||
break;
|
||||
case STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET:
|
||||
params.index_cleanup = VACOPTVALUE_AUTO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -338,6 +338,7 @@ typedef enum StdRdOptIndexCleanup
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_AUTO = 0,
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_OFF,
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_ON,
|
||||
STDRD_OPTION_VACUUM_INDEX_CLEANUP_NOT_SET,
|
||||
} StdRdOptIndexCleanup;
|
||||
|
||||
typedef struct StdRdOptions
|
||||
|
||||
Reference in New Issue
Block a user