mirror of https://github.com/citusdata/citus.git
process utility
parent
613d9c0dca
commit
f6159ab3ea
|
@ -85,6 +85,7 @@ static int activeDropSchemaOrDBs = 0;
|
||||||
static bool ConstraintDropped = false;
|
static bool ConstraintDropped = false;
|
||||||
|
|
||||||
|
|
||||||
|
ProcessUtility_hook_type PrevProcessUtility = NULL;
|
||||||
int UtilityHookLevel = 0;
|
int UtilityHookLevel = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,8 +181,8 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
||||||
* that state. Since we never need to intercept transaction statements,
|
* that state. Since we never need to intercept transaction statements,
|
||||||
* skip our checks and immediately fall into standard_ProcessUtility.
|
* skip our checks and immediately fall into standard_ProcessUtility.
|
||||||
*/
|
*/
|
||||||
standard_ProcessUtility_compat(pstmt, queryString, false, context,
|
PrevProcessUtility_compat(pstmt, queryString, false, context,
|
||||||
params, queryEnv, dest, completionTag);
|
params, queryEnv, dest, completionTag);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -199,8 +200,8 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
||||||
* Ensure that utility commands do not behave any differently until CREATE
|
* Ensure that utility commands do not behave any differently until CREATE
|
||||||
* EXTENSION is invoked.
|
* EXTENSION is invoked.
|
||||||
*/
|
*/
|
||||||
standard_ProcessUtility_compat(pstmt, queryString, false, context,
|
PrevProcessUtility_compat(pstmt, queryString, false, context,
|
||||||
params, queryEnv, dest, completionTag);
|
params, queryEnv, dest, completionTag);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -231,8 +232,8 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
||||||
|
|
||||||
PG_TRY();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
standard_ProcessUtility_compat(pstmt, queryString, false, context,
|
PrevProcessUtility_compat(pstmt, queryString, false, context,
|
||||||
params, queryEnv, dest, completionTag);
|
params, queryEnv, dest, completionTag);
|
||||||
|
|
||||||
StoredProcedureLevel -= 1;
|
StoredProcedureLevel -= 1;
|
||||||
|
|
||||||
|
@ -265,8 +266,8 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
||||||
|
|
||||||
PG_TRY();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
standard_ProcessUtility_compat(pstmt, queryString, false, context,
|
PrevProcessUtility_compat(pstmt, queryString, false, context,
|
||||||
params, queryEnv, dest, completionTag);
|
params, queryEnv, dest, completionTag);
|
||||||
|
|
||||||
DoBlockLevel -= 1;
|
DoBlockLevel -= 1;
|
||||||
}
|
}
|
||||||
|
@ -591,8 +592,8 @@ ProcessUtilityInternal(PlannedStmt *pstmt,
|
||||||
citusCanBeUpdatedToAvailableVersion = !InstalledAndAvailableVersionsSame();
|
citusCanBeUpdatedToAvailableVersion = !InstalledAndAvailableVersionsSame();
|
||||||
}
|
}
|
||||||
|
|
||||||
standard_ProcessUtility_compat(pstmt, queryString, false, context,
|
PrevProcessUtility_compat(pstmt, queryString, false, context,
|
||||||
params, queryEnv, dest, completionTag);
|
params, queryEnv, dest, completionTag);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we are running ALTER EXTENSION citus UPDATE (to "<version>") command, we may need
|
* if we are running ALTER EXTENSION citus UPDATE (to "<version>") command, we may need
|
||||||
|
|
|
@ -334,9 +334,6 @@ _PG_init(void)
|
||||||
/* intercept planner */
|
/* intercept planner */
|
||||||
planner_hook = distributed_planner;
|
planner_hook = distributed_planner;
|
||||||
|
|
||||||
/* register utility hook */
|
|
||||||
ProcessUtility_hook = multi_ProcessUtility;
|
|
||||||
|
|
||||||
/* register for planner hook */
|
/* register for planner hook */
|
||||||
set_rel_pathlist_hook = multi_relation_restriction_hook;
|
set_rel_pathlist_hook = multi_relation_restriction_hook;
|
||||||
set_join_pathlist_hook = multi_join_restriction_hook;
|
set_join_pathlist_hook = multi_join_restriction_hook;
|
||||||
|
@ -387,6 +384,17 @@ _PG_init(void)
|
||||||
/* ensure columnar module is loaded at the right time */
|
/* ensure columnar module is loaded at the right time */
|
||||||
load_file(COLUMNAR_MODULE_NAME, false);
|
load_file(COLUMNAR_MODULE_NAME, false);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register utility hook. This must be done after loading columnar, so
|
||||||
|
* that the citus hook is called first, followed by the columnar hook,
|
||||||
|
* followed by standard_ProcessUtility. That allows citus to distribute
|
||||||
|
* ALTER TABLE commands before columnar strips out the columnar-specific
|
||||||
|
* options.
|
||||||
|
*/
|
||||||
|
PrevProcessUtility = (ProcessUtility_hook != NULL) ?
|
||||||
|
ProcessUtility_hook : standard_ProcessUtility;
|
||||||
|
ProcessUtility_hook = multi_ProcessUtility;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now, acquire symbols from columnar module. First, acquire
|
* Now, acquire symbols from columnar module. First, acquire
|
||||||
* the address of the set options hook, and set it so that we
|
* the address of the set options hook, and set it so that we
|
||||||
|
|
|
@ -75,6 +75,7 @@ typedef struct DDLJob
|
||||||
List *taskList; /* worker DDL tasks to execute */
|
List *taskList; /* worker DDL tasks to execute */
|
||||||
} DDLJob;
|
} DDLJob;
|
||||||
|
|
||||||
|
extern ProcessUtility_hook_type PrevProcessUtility;
|
||||||
|
|
||||||
extern void multi_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
extern void multi_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_14
|
#if PG_VERSION_NUM >= PG_VERSION_14
|
||||||
|
|
|
@ -77,6 +77,8 @@ RelationGetSmgr(Relation rel)
|
||||||
standard_ProcessUtility(a, b, c, d, e, f, g, h)
|
standard_ProcessUtility(a, b, c, d, e, f, g, h)
|
||||||
#define ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
#define ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||||
ProcessUtility(a, b, c, d, e, f, g, h)
|
ProcessUtility(a, b, c, d, e, f, g, h)
|
||||||
|
#define PrevProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||||
|
PrevProcessUtility(a, b, c, d, e, f, g, h)
|
||||||
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||||
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
||||||
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
||||||
|
@ -106,6 +108,8 @@ RelationGetSmgr(Relation rel)
|
||||||
#define standard_ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
#define standard_ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||||
standard_ProcessUtility(a, b, d, e, f, g, h)
|
standard_ProcessUtility(a, b, d, e, f, g, h)
|
||||||
#define ProcessUtility_compat(a, b, c, d, e, f, g, h) ProcessUtility(a, b, d, e, f, g, h)
|
#define ProcessUtility_compat(a, b, c, d, e, f, g, h) ProcessUtility(a, b, d, e, f, g, h)
|
||||||
|
#define PrevProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||||
|
PrevProcessUtility(a, b, d, e, f, g, h)
|
||||||
#define COPY_FRONTEND COPY_NEW_FE
|
#define COPY_FRONTEND COPY_NEW_FE
|
||||||
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||||
SetTuplestoreDestReceiverParams(a, b, c, d)
|
SetTuplestoreDestReceiverParams(a, b, c, d)
|
||||||
|
|
Loading…
Reference in New Issue