!5932 修复游标表达式+并行游标的若干问题

Merge pull request !5932 from chenxiaobin/fixSmpNotReset
This commit is contained in:
opengauss_bot
2024-08-06 11:18:42 +00:00
committed by Gitee
23 changed files with 501 additions and 87 deletions

View File

@ -837,8 +837,10 @@ public:
{
if (likely(u_sess != NULL)) {
m_smpEnabled = u_sess->opt_cxt.smp_enabled;
m_underCursor = u_sess->opt_cxt.is_under_cursor;
} else {
m_smpEnabled = true;
m_underCursor = false;
}
}
@ -846,6 +848,7 @@ public:
{
if (u_sess != NULL) {
u_sess->opt_cxt.smp_enabled = m_smpEnabled;
u_sess->opt_cxt.is_under_cursor = m_underCursor;
}
}
@ -856,15 +859,24 @@ public:
}
}
void UnderCursor()
{
if (likely(u_sess != NULL)) {
u_sess->opt_cxt.is_under_cursor = true;
}
}
void ResetSmp()
{
if (u_sess != NULL) {
u_sess->opt_cxt.smp_enabled = m_smpEnabled;
u_sess->opt_cxt.is_under_cursor = m_underCursor;
}
}
private:
bool m_smpEnabled;
bool m_underCursor;
};
#ifdef USE_SPQ

View File

@ -360,6 +360,7 @@ typedef struct knl_u_optimizer_context {
/* Mark smp is enabled in procedure. */
bool smp_enabled;
bool is_under_cursor;
double smp_thread_cost;

View File

@ -381,6 +381,8 @@ typedef struct Plan {
#ifdef USE_SPQ
bool spq_scan_partial;
#endif
int cursor_expr_level;
int cursor_owner_node_id;
} Plan;
typedef struct NdpScanCondition { // for each scan node

View File

@ -89,8 +89,6 @@ typedef struct Stream {
#ifdef USE_SPQ
int streamID;
#endif
int cursor_expr_level;
int cursor_owner_node_id;
} Stream;
extern void compute_stream_cost(StreamType type, char locator_type, double subrows, double subgblrows,

View File

@ -39,6 +39,6 @@ extern bool IsQuerySWCBRewrite(Query *query);
extern bool IsSWCBRewriteRTE(RangeTblEntry *rte);
extern Datum GetTypeZeroValue(Form_pg_attribute att_tup);
typedef Datum (*getTypeZeroValueFunc)(Form_pg_attribute att_tup);
extern PlannedStmt* getCursorStreamFromFuncArg(FuncExpr* funcexpr);
extern PlannedStmt* getCursorStreamFromFuncArg(FuncExpr* funcexpr, CursorExpression** ce = NULL);
#endif /* PARSE_EXPR_H */