openGauss资源池化支持多机并行

This commit is contained in:
quemingjian
2023-10-12 18:39:23 +08:00
parent c1aaeea5b2
commit ea7ff3627b
140 changed files with 10069 additions and 353 deletions

View File

@ -115,6 +115,9 @@ typedef struct StreamState {
int64* spill_size;
void* sortstate; /* merge sort for stream */
bool receive_message; /* The stream consumer has receive message from then producer */
#ifdef USE_SPQ
bool skip_direct_distribute_result;
#endif
} StreamState;
extern StreamState* ExecInitStream(Stream* node, EState* estate, int eflags);

View File

@ -841,4 +841,7 @@ private:
bool m_smpEnabled;
};
#ifdef USE_SPQ
extern bool IsJoinExprNull(List *joinExpr, ExprContext *econtext);
#endif
#endif /* EXECUTOR_H */

View File

@ -724,11 +724,15 @@ public:
/* get ThreadInstrumentation */
ThreadInstrumentation *getThreadInstrumentation(int idx, int planNodeId, int smpId)
{
ThreadInstrumentation *threadInstr =
#ifdef ENABLE_MULTIPLE_NODES
getThreadInstrumentationCN(idx, planNodeId, smpId);
ThreadInstrumentation *threadInstr = NULL;
#if defined(ENABLE_MULTIPLE_NODES) || defined(USE_SPQ)
if (t_thrd.spq_ctx.spq_role != ROLE_UTILITY) {
threadInstr = getThreadInstrumentationCN(idx, planNodeId, smpId);
} else {
threadInstr = getThreadInstrumentationDN(planNodeId, smpId);
}
#else
getThreadInstrumentationDN(planNodeId, smpId);
threadInstr = getThreadInstrumentationDN(planNodeId, smpId);
#endif /* ENABLE_MULTIPLE_NODES */
return threadInstr;
}

View File

@ -0,0 +1,28 @@
/* -------------------------------------------------------------------------
*
* nodeAssertOp.h
*
*
* Portions Copyright (c) 2023 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/executor/nodeAssertOp.h
*
* -------------------------------------------------------------------------
*/
#ifndef NODEASSERTOP_H
#define NODEASSERTOP_H
#ifdef USE_SPQ
#include "nodes/execnodes.h"
extern void ExecAssertOpExplainEnd(PlanState *planstate, struct StringInfoData *buf);
extern TupleTableSlot* ExecAssertOp(PlanState *node);
extern AssertOpState* ExecInitAssertOp(AssertOp *node, EState *estate, int eflags);
extern void ExecEndAssertOp(AssertOpState *node);
extern void ExecReScanAssertOp(AssertOpState *node);
#endif /* USE_SPQ */
#endif /* NODEASSERTOP_H */

View File

@ -29,6 +29,10 @@ extern HashJoinTable ExecHashTableCreate(Hash* node, List* hashOperators, bool k
extern void ExecHashTableDestroy(HashJoinTable hashtable);
extern void ExecHashTableInsert(HashJoinTable hashtable, TupleTableSlot* slot, uint32 hashvalue, int planid, int dop,
Instrumentation* instrument = NULL);
#ifdef USE_SPQ
extern bool ExecHashGetHashValue(HashJoinTable hashtable, ExprContext* econtext, List* hashkeys, bool outer_tuple,
bool keep_nulls, uint32* hashvalue, bool *hashkeys_null);
#endif
extern bool ExecHashGetHashValue(HashJoinTable hashtable, ExprContext* econtext, List* hashkeys, bool outer_tuple,
bool keep_nulls, uint32* hashvalue);
extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable, uint32 hashvalue, int* bucketno, int* batchno);

View File

@ -0,0 +1,29 @@
/*-------------------------------------------------------------------------
*
* nodeSequence.h
* header file for nodeSequence.cpp.
*
* Portions Copyright (c) 2023 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 2012 - 2022, EMC/Greenplum
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
*
*
* IDENTIFICATION
* src/include/executor/node/nodeSequence.h
*
*-------------------------------------------------------------------------
*/
#ifndef NODESEQUENCE_H
#define NODESEQUENCE_H
#ifdef USE_SPQ
#include "executor/tuptable.h"
#include "nodes/execnodes.h"
extern SequenceState *ExecInitSequence(Sequence *node, EState *estate, int eflags);
extern TupleTableSlot *ExecSequence(PlanState *pstate);
extern void ExecReScanSequence(SequenceState *node);
extern void ExecEndSequence(SequenceState *node);
#endif /* USE_SPQ */
#endif

View File

@ -0,0 +1,38 @@
/*-------------------------------------------------------------------------
*
* nodeShareInputScan.h
*
* Portions Copyright (c) 2023 Huawei Technologies Co.,Ltd.
* Portions Copyright (c) 2012-2021 VMware, Inc. or its affiliates.
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/include/executor/node/nodeShareInputScan.h
*
*-------------------------------------------------------------------------
*/
#ifndef NODESHAREINPUTSCAN_H
#define NODESHAREINPUTSCAN_H
#ifdef USE_SPQ
#include "nodes/execnodes.h"
#include "storage/sharedfileset.h"
extern ShareInputScanState *ExecInitShareInputScan(ShareInputScan *node, EState *estate, int eflags);
extern void ExecEndShareInputScan(ShareInputScanState *node);
extern void ExecReScanShareInputScan(ShareInputScanState *node);
extern TupleTableSlot *ExecShareInputScan(PlanState *pstate);
extern Size ShareInputShmemSize(void);
extern void ShareInputShmemInit(void);
extern SharedFileSet *get_shareinput_fileset(void);
extern void tuplestore_make_shared(Tuplestorestate *state, SharedFileSet *fileset, const char *filename);
extern void tuplestore_freeze(Tuplestorestate *state);
extern Tuplestorestate *tuplestore_open_shared(SharedFileSet *fileset, const char *filename);
#endif /* USE_SPQ */
#endif /* NODESHAREINPUTSCAN_H */

View File

@ -0,0 +1,32 @@
/* -------------------------------------------------------------------------
*
* nodeSpqSeqscan.h
*
* Portions Copyright (c) 2023 Huawei Technologies Co.,Ltd.
*
* src/include/executor/node/nodeSpqSeqscan.h
*
* -------------------------------------------------------------------------
*/
#ifdef USE_SPQ
#ifndef NODESPQSEQSCAN_H
#define NODESPQSEQSCAN_H
#include "nodes/execnodes.h"
typedef SpqSeqScanState* (*init_spqscan_hook_type)(SpqSeqScan* node, EState* estate, int eflags);
typedef TupleTableSlot* (*exec_spqscan_hook_type)(PlanState* node);
typedef void (*end_spqscan_hook_type)(SpqSeqScanState* node);
typedef void (*spqscan_rescan_hook_type)(SpqSeqScanState* node);
extern THR_LOCAL init_spqscan_hook_type init_spqscan_hook;
extern THR_LOCAL exec_spqscan_hook_type exec_spqscan_hook;
extern THR_LOCAL end_spqscan_hook_type end_spqscan_hook;
extern THR_LOCAL spqscan_rescan_hook_type spqscan_rescan_hook;
// unchanged function compare with seqscan
extern void ExecSpqSeqMarkPos(SpqSeqScanState* node);
extern void ExecSpqSeqRestrPos(SpqSeqScanState* node);
#endif // NODESPQSEQSCAN_H
#endif

View File

@ -249,5 +249,12 @@ extern void heap_slot_getsomeattrs(TupleTableSlot* slot, int attnum);
extern bool heap_slot_attisnull(TupleTableSlot* slot, int attnum);
extern void heap_slot_formbatch(TupleTableSlot* slot, struct VectorBatch* batch, int cur_rows, int attnum);
#ifdef USE_SPQ
extern Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull);
extern void slot_getsomeattrs(TupleTableSlot *slot, int attnum);
extern void slot_getallattrs(TupleTableSlot *slot);
extern Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc);
#endif
#endif /* !FRONTEND_PARSER */
#endif /* TUPTABLE_H */