From 0eacf6bd9576921a608d9a828e67c7b5f5142c6e Mon Sep 17 00:00:00 2001 From: Jason Petersen Date: Mon, 27 Nov 2017 11:49:46 -0700 Subject: [PATCH] Refactor VacuumStmt checker to be single-return Decided this would be safer for the future (defaults to unsupported). --- .../distributed/executor/multi_utility.c | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/backend/distributed/executor/multi_utility.c b/src/backend/distributed/executor/multi_utility.c index 339e6e073..8863fcd37 100644 --- a/src/backend/distributed/executor/multi_utility.c +++ b/src/backend/distributed/executor/multi_utility.c @@ -1534,43 +1534,39 @@ static bool IsSupportedDistributedVacuumStmt(Oid relationId, VacuumStmt *vacuumStmt) { const char *stmtName = (vacuumStmt->options & VACOPT_VACUUM) ? "VACUUM" : "ANALYZE"; + bool distributeStmt = false; if (vacuumStmt->relation == NULL) { - /* WARN and exit early for unqualified VACUUM commands */ + /* WARN for unqualified VACUUM commands */ ereport(WARNING, (errmsg("not propagating %s command to worker nodes", stmtName), errhint("Provide a specific table in order to %s " "distributed tables.", stmtName))); - - return false; } - - if (!OidIsValid(relationId) || !IsDistributedTable(relationId)) + else if (!OidIsValid(relationId) || !IsDistributedTable(relationId)) { - return false; + /* Nothing to do here; relation no longer exists or is not distributed */ } - - if (!EnableDDLPropagation) + else if (!EnableDDLPropagation) { - /* WARN and exit early if DDL propagation is not enabled */ + /* WARN if DDL propagation is not enabled */ ereport(WARNING, (errmsg("not propagating %s command to worker nodes", stmtName), errhint("Set citus.enable_ddl_propagation to true in order to " "send targeted %s commands to worker nodes.", stmtName))); - - return false; } - - if (vacuumStmt->options & VACOPT_VERBOSE) + else if (vacuumStmt->options & VACOPT_VERBOSE) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("the VERBOSE option is currently unsupported in " "distributed %s commands", stmtName))); - - return false; + } + else + { + distributeStmt = true; } - return true; + return distributeStmt; }