mirror of https://github.com/citusdata/citus.git
Make local VACUUM occur first; rework prototypes
As part of review feedback.pull/1013/head
parent
10236564fa
commit
1b98b3ef72
|
@ -110,8 +110,7 @@ static Node * ProcessAlterTableStmt(AlterTableStmt *alterTableStatement,
|
||||||
static Node * ProcessAlterObjectSchemaStmt(AlterObjectSchemaStmt *alterObjectSchemaStmt,
|
static Node * ProcessAlterObjectSchemaStmt(AlterObjectSchemaStmt *alterObjectSchemaStmt,
|
||||||
const char *alterObjectSchemaCommand,
|
const char *alterObjectSchemaCommand,
|
||||||
bool isTopLevel);
|
bool isTopLevel);
|
||||||
static Node * ProcessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand,
|
static void ProcessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand);
|
||||||
bool isTopLevel);
|
|
||||||
static List * VacuumTaskList(Oid relationId, VacuumStmt *vacuumStmt);
|
static List * VacuumTaskList(Oid relationId, VacuumStmt *vacuumStmt);
|
||||||
static StringInfo DeparseVacuumStmtPrefix(VacuumStmt *vacuumStmt);
|
static StringInfo DeparseVacuumStmtPrefix(VacuumStmt *vacuumStmt);
|
||||||
|
|
||||||
|
@ -287,17 +286,6 @@ multi_ProcessUtility(Node *parsetree,
|
||||||
errhint("Connect to worker nodes directly to manually "
|
errhint("Connect to worker nodes directly to manually "
|
||||||
"move all tables.")));
|
"move all tables.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsA(parsetree, VacuumStmt))
|
|
||||||
{
|
|
||||||
VacuumStmt *vacuumStmt = (VacuumStmt *) parsetree;
|
|
||||||
|
|
||||||
/* must check fields to know whether actually a vacuum */
|
|
||||||
if (vacuumStmt->options | VACOPT_VACUUM)
|
|
||||||
{
|
|
||||||
parsetree = ProcessVacuumStmt(vacuumStmt, queryString, isTopLevel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -383,6 +371,18 @@ multi_ProcessUtility(Node *parsetree,
|
||||||
{
|
{
|
||||||
SetUserIdAndSecContext(savedUserId, savedSecurityContext);
|
SetUserIdAndSecContext(savedUserId, savedSecurityContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we run VacuumStmt after standard processing to benefit from its checks */
|
||||||
|
if (IsA(parsetree, VacuumStmt))
|
||||||
|
{
|
||||||
|
VacuumStmt *vacuumStmt = (VacuumStmt *) parsetree;
|
||||||
|
|
||||||
|
/* must check fields to know whether actually a vacuum */
|
||||||
|
if (vacuumStmt->options | VACOPT_VACUUM)
|
||||||
|
{
|
||||||
|
ProcessVacuumStmt(vacuumStmt, queryString);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -900,15 +900,15 @@ ProcessAlterObjectSchemaStmt(AlterObjectSchemaStmt *alterObjectSchemaStmt,
|
||||||
|
|
||||||
|
|
||||||
/* TODO: Write function comments */
|
/* TODO: Write function comments */
|
||||||
static Node *
|
static void
|
||||||
ProcessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand, bool isTopLevel)
|
ProcessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand)
|
||||||
{
|
{
|
||||||
Oid relationId = InvalidOid;
|
Oid relationId = InvalidOid;
|
||||||
List *taskList = NIL;
|
List *taskList = NIL;
|
||||||
|
|
||||||
if (vacuumStmt->relation == NULL)
|
if (vacuumStmt->relation == NULL)
|
||||||
{
|
{
|
||||||
return (Node *) vacuumStmt;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
relationId = RangeVarGetRelid(vacuumStmt->relation, NoLock, false);
|
relationId = RangeVarGetRelid(vacuumStmt->relation, NoLock, false);
|
||||||
|
@ -916,7 +916,7 @@ ProcessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand, bool isTopL
|
||||||
/* first check whether a distributed relation is affected */
|
/* first check whether a distributed relation is affected */
|
||||||
if (!OidIsValid(relationId) || !IsDistributedTable(relationId))
|
if (!OidIsValid(relationId) || !IsDistributedTable(relationId))
|
||||||
{
|
{
|
||||||
return (Node *) vacuumStmt;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
taskList = VacuumTaskList(relationId, vacuumStmt);
|
taskList = VacuumTaskList(relationId, vacuumStmt);
|
||||||
|
@ -924,8 +924,6 @@ ProcessVacuumStmt(VacuumStmt *vacuumStmt, const char *vacuumCommand, bool isTopL
|
||||||
SavedMultiShardCommitProtocol = MultiShardCommitProtocol;
|
SavedMultiShardCommitProtocol = MultiShardCommitProtocol;
|
||||||
MultiShardCommitProtocol = COMMIT_PROTOCOL_BARE;
|
MultiShardCommitProtocol = COMMIT_PROTOCOL_BARE;
|
||||||
ExecuteModifyTasksWithoutResults(taskList);
|
ExecuteModifyTasksWithoutResults(taskList);
|
||||||
|
|
||||||
return (Node *) vacuumStmt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue