Skip to content

Commit

Permalink
Process toast should be true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
naisila committed Aug 16, 2023
1 parent b229137 commit 174b02d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
22 changes: 13 additions & 9 deletions src/backend/distributed/commands/vacuum.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,17 @@ DeparseVacuumStmtPrefix(CitusVacuumParams vacuumParams)
}

/* if no flags remain, exit early */
if (vacuumFlags == 0 &&
vacuumParams.truncate == VACOPTVALUE_UNSPECIFIED &&
vacuumParams.index_cleanup == VACOPTVALUE_UNSPECIFIED &&
vacuumParams.nworkers == VACUUM_PARALLEL_NOTSET
)
if (vacuumFlags & VACOPT_PROCESS_TOAST)
{
return vacuumPrefix->data;
/* process toast is true by default */
if ((vacuumFlags & ~VACOPT_PROCESS_TOAST) == 0 &&
vacuumParams.truncate == VACOPTVALUE_UNSPECIFIED &&
vacuumParams.index_cleanup == VACOPTVALUE_UNSPECIFIED &&
vacuumParams.nworkers == VACUUM_PARALLEL_NOTSET
)
{
return vacuumPrefix->data;
}
}

/* otherwise, handle options */
Expand Down Expand Up @@ -360,9 +364,9 @@ DeparseVacuumStmtPrefix(CitusVacuumParams vacuumParams)
appendStringInfoString(vacuumPrefix, "SKIP_LOCKED,");
}

if (vacuumFlags & VACOPT_PROCESS_TOAST)
if (!(vacuumFlags & VACOPT_PROCESS_TOAST))
{
appendStringInfoString(vacuumPrefix, "PROCESS_TOAST,");
appendStringInfoString(vacuumPrefix, "PROCESS_TOAST FALSE,");
}

if (vacuumParams.truncate != VACOPTVALUE_UNSPECIFIED)
Expand Down Expand Up @@ -499,7 +503,7 @@ VacuumStmtParams(VacuumStmt *vacstmt)
bool freeze = false;
bool full = false;
bool disable_page_skipping = false;
bool process_toast = false;
bool process_toast = true;

/* Set default value */
params.index_cleanup = VACOPTVALUE_UNSPECIFIED;
Expand Down
20 changes: 10 additions & 10 deletions src/test/regress/expected/pg14.out
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing VACUUM (FULL) pg14.t1_980001
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
VACUUM (FULL, PROCESS_TOAST) t1;
NOTICE: issuing VACUUM (FULL,PROCESS_TOAST) pg14.t1_980000
NOTICE: issuing VACUUM (FULL) pg14.t1_980000
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing VACUUM (FULL,PROCESS_TOAST) pg14.t1_980001
NOTICE: issuing VACUUM (FULL) pg14.t1_980001
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
VACUUM (FULL, PROCESS_TOAST true) t1;
NOTICE: issuing VACUUM (FULL,PROCESS_TOAST) pg14.t1_980000
NOTICE: issuing VACUUM (FULL) pg14.t1_980000
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing VACUUM (FULL,PROCESS_TOAST) pg14.t1_980001
NOTICE: issuing VACUUM (FULL) pg14.t1_980001
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
VACUUM (FULL, PROCESS_TOAST false) t1;
ERROR: PROCESS_TOAST required with VACUUM FULL
VACUUM (PROCESS_TOAST false) t1;
NOTICE: issuing VACUUM pg14.t1_980000
NOTICE: issuing VACUUM (PROCESS_TOAST false) pg14.t1_980000
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing VACUUM pg14.t1_980001
NOTICE: issuing VACUUM (PROCESS_TOAST false) pg14.t1_980001
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
VACUUM (INDEX_CLEANUP AUTO) t1;
NOTICE: issuing VACUUM (INDEX_CLEANUP auto) pg14.t1_980000
Expand Down Expand Up @@ -62,14 +62,14 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
VACUUM (INDEX_CLEANUP "AUTOX") t1;
ERROR: index_cleanup requires a Boolean value
VACUUM (FULL, FREEZE, VERBOSE false, ANALYZE, SKIP_LOCKED, INDEX_CLEANUP, PROCESS_TOAST, TRUNCATE) t1;
NOTICE: issuing VACUUM (ANALYZE,FREEZE,FULL,SKIP_LOCKED,PROCESS_TOAST,TRUNCATE,INDEX_CLEANUP auto) pg14.t1_980000
NOTICE: issuing VACUUM (ANALYZE,FREEZE,FULL,SKIP_LOCKED,TRUNCATE,INDEX_CLEANUP auto) pg14.t1_980000
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing VACUUM (ANALYZE,FREEZE,FULL,SKIP_LOCKED,PROCESS_TOAST,TRUNCATE,INDEX_CLEANUP auto) pg14.t1_980001
NOTICE: issuing VACUUM (ANALYZE,FREEZE,FULL,SKIP_LOCKED,TRUNCATE,INDEX_CLEANUP auto) pg14.t1_980001
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
VACUUM (FULL, FREEZE false, VERBOSE false, ANALYZE false, SKIP_LOCKED false, INDEX_CLEANUP "Auto", PROCESS_TOAST true, TRUNCATE false) t1;
NOTICE: issuing VACUUM (FULL,PROCESS_TOAST,TRUNCATE false,INDEX_CLEANUP auto) pg14.t1_980000
NOTICE: issuing VACUUM (FULL,TRUNCATE false,INDEX_CLEANUP auto) pg14.t1_980000
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing VACUUM (FULL,PROCESS_TOAST,TRUNCATE false,INDEX_CLEANUP auto) pg14.t1_980001
NOTICE: issuing VACUUM (FULL,TRUNCATE false,INDEX_CLEANUP auto) pg14.t1_980001
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
-- vacuum (process_toast true) should be vacuuming toast tables (default is true)
CREATE TABLE local_vacuum_table(name text);
Expand Down

0 comments on commit 174b02d

Please sign in to comment.