[td-11818] refactor.
This commit is contained in:
parent
bd386044a1
commit
dc3ecc0a21
|
@ -65,14 +65,14 @@ int32_t catalogGetDBVgroupVersion(struct SCatalog* pCatalog, const char* dbName,
|
||||||
/**
|
/**
|
||||||
* Get a DB's all vgroup info.
|
* Get a DB's all vgroup info.
|
||||||
* @param pCatalog (input, got with catalogGetHandle)
|
* @param pCatalog (input, got with catalogGetHandle)
|
||||||
* @param pRpc (input, rpc object)
|
* @param pTransporter (input, rpc object)
|
||||||
* @param pMgmtEps (input, mnode EPs)
|
* @param pMgmtEps (input, mnode EPs)
|
||||||
* @param pDBName (input, full db name)
|
* @param pDBName (input, full db name)
|
||||||
* @param forceUpdate (input, force update db vgroup info from mnode)
|
* @param forceUpdate (input, force update db vgroup info from mnode)
|
||||||
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
|
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int32_t catalogGetDBVgroup(struct SCatalog* pCatalog, void *pRpc, const SEpSet* pMgmtEps, const char* pDBName, bool forceUpdate, SArray** pVgroupList);
|
int32_t catalogGetDBVgroup(struct SCatalog* pCatalog, void *pTransporter, const SEpSet* pMgmtEps, const char* pDBName, bool forceUpdate, SArray** pVgroupList);
|
||||||
|
|
||||||
int32_t catalogUpdateDBVgroup(struct SCatalog* pCatalog, const char* dbName, SDBVgroupInfo* dbInfo);
|
int32_t catalogUpdateDBVgroup(struct SCatalog* pCatalog, const char* dbName, SDBVgroupInfo* dbInfo);
|
||||||
|
|
||||||
|
@ -112,13 +112,13 @@ int32_t catalogRenewAndGetTableMeta(struct SCatalog* pCatalog, void *pTransporte
|
||||||
/**
|
/**
|
||||||
* Get a table's actual vgroup, for stable it's all possible vgroup list.
|
* Get a table's actual vgroup, for stable it's all possible vgroup list.
|
||||||
* @param pCatalog (input, got with catalogGetHandle)
|
* @param pCatalog (input, got with catalogGetHandle)
|
||||||
* @param pRpc (input, rpc object)
|
* @param pTransporter (input, rpc object)
|
||||||
* @param pMgmtEps (input, mnode EPs)
|
* @param pMgmtEps (input, mnode EPs)
|
||||||
* @param pTableName (input, table name, NOT including db name)
|
* @param pTableName (input, table name, NOT including db name)
|
||||||
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
|
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int32_t catalogGetTableDistVgroup(struct SCatalog* pCatalog, void *pRpc, const SEpSet* pMgmtEps, const SName* pTableName, SArray** pVgroupList);
|
int32_t catalogGetTableDistVgroup(struct SCatalog* pCatalog, void *pTransporter, const SEpSet* pMgmtEps, const SName* pTableName, SArray** pVgroupList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a table's vgroup from its name's hash value.
|
* Get a table's vgroup from its name's hash value.
|
||||||
|
@ -135,16 +135,16 @@ int32_t catalogGetTableHashVgroup(struct SCatalog* pCatalog, void * pTransporter
|
||||||
/**
|
/**
|
||||||
* Get all meta data required in pReq.
|
* Get all meta data required in pReq.
|
||||||
* @param pCatalog (input, got with catalogGetHandle)
|
* @param pCatalog (input, got with catalogGetHandle)
|
||||||
* @param pRpc (input, rpc object)
|
* @param pTransporter (input, rpc object)
|
||||||
* @param pMgmtEps (input, mnode EPs)
|
* @param pMgmtEps (input, mnode EPs)
|
||||||
* @param pReq (input, reqest info)
|
* @param pReq (input, reqest info)
|
||||||
* @param pRsp (output, response data)
|
* @param pRsp (output, response data)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int32_t catalogGetAllMeta(struct SCatalog* pCatalog, void *pRpc, const SEpSet* pMgmtEps, const SCatalogReq* pReq, SMetaData* pRsp);
|
int32_t catalogGetAllMeta(struct SCatalog* pCatalog, void *pTransporter, const SEpSet* pMgmtEps, const SCatalogReq* pReq, SMetaData* pRsp);
|
||||||
|
|
||||||
|
|
||||||
int32_t catalogGetQnodeList(struct SCatalog* pCatalog, void *pRpc, const SEpSet* pMgmtEps, SArray* pQnodeList);
|
int32_t catalogGetQnodeList(struct SCatalog* pCatalog, void *pTransporter, const SEpSet* pMgmtEps, SArray* pQnodeList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct SParseContext {
|
typedef struct SParseContext {
|
||||||
SParseBasicCtx ctx;
|
SParseBasicCtx ctx;
|
||||||
int8_t schemaAttached; // denote if submit block is built with table schema or not
|
|
||||||
const char *pSql; // sql string
|
const char *pSql; // sql string
|
||||||
size_t sqlLen; // length of the sql string
|
size_t sqlLen; // length of the sql string
|
||||||
char *pMsg; // extended error message if exists to help identifying the problem in sql statement.
|
char *pMsg; // extended error message if exists to help identifying the problem in sql statement.
|
||||||
|
@ -41,8 +40,17 @@ typedef struct SParseContext {
|
||||||
*/
|
*/
|
||||||
int32_t qParseQuerySql(SParseContext* pContext, SQueryNode** pQuery);
|
int32_t qParseQuerySql(SParseContext* pContext, SQueryNode** pQuery);
|
||||||
|
|
||||||
bool qIsDdlQuery(const SQueryNode* pQuery);
|
/**
|
||||||
|
* Return true if it is a ddl/dcl sql statement
|
||||||
|
* @param pQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool qIsDdlQuery(const SQueryNode* pQueryNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy logic query plan
|
||||||
|
* @param pQueryNode
|
||||||
|
*/
|
||||||
void qDestroyQuery(SQueryNode* pQueryNode);
|
void qDestroyQuery(SQueryNode* pQueryNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -139,8 +139,12 @@ typedef struct SQueryDag {
|
||||||
|
|
||||||
struct SQueryNode;
|
struct SQueryNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the physical plan for the query, according to the AST.
|
* Create the physical plan for the query, according to the AST.
|
||||||
|
* @param pQueryInfo
|
||||||
|
* @param pDag
|
||||||
|
* @param requestId
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t qCreateQueryDag(const struct SQueryNode* pQueryInfo, struct SQueryDag** pDag, uint64_t requestId);
|
int32_t qCreateQueryDag(const struct SQueryNode* pQueryInfo, struct SQueryDag** pDag, uint64_t requestId);
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,12 @@ int32_t scheduleExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void
|
||||||
*/
|
*/
|
||||||
int32_t scheduleAsyncExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void** pJob);
|
int32_t scheduleAsyncExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void** pJob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch query result from the remote query executor
|
||||||
|
* @param pJob
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
int32_t scheduleFetchRows(void *pJob, void **data);
|
int32_t scheduleFetchRows(void *pJob, void **data);
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,6 +91,10 @@ int32_t scheduleFetchRows(void *pJob, void **data);
|
||||||
*/
|
*/
|
||||||
int32_t scheduleCancelJob(void *pJob);
|
int32_t scheduleCancelJob(void *pJob);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free the query job
|
||||||
|
* @param pJob
|
||||||
|
*/
|
||||||
void scheduleFreeJob(void *pJob);
|
void scheduleFreeJob(void *pJob);
|
||||||
|
|
||||||
void schedulerDestroy(void);
|
void schedulerDestroy(void);
|
||||||
|
|
|
@ -62,6 +62,7 @@ typedef struct SAppInstInfo {
|
||||||
SList *pConnList; // STscObj linked list
|
SList *pConnList; // STscObj linked list
|
||||||
int64_t clusterId;
|
int64_t clusterId;
|
||||||
void *pTransporter;
|
void *pTransporter;
|
||||||
|
SHeartBeatInfo hb;
|
||||||
} SAppInstInfo;
|
} SAppInstInfo;
|
||||||
|
|
||||||
typedef struct SAppInfo {
|
typedef struct SAppInfo {
|
||||||
|
@ -70,7 +71,7 @@ typedef struct SAppInfo {
|
||||||
char *ep;
|
char *ep;
|
||||||
int32_t pid;
|
int32_t pid;
|
||||||
int32_t numOfThreads;
|
int32_t numOfThreads;
|
||||||
SHeartBeatInfo hb;
|
|
||||||
SHashObj *pInstMap;
|
SHashObj *pInstMap;
|
||||||
} SAppInfo;
|
} SAppInfo;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#include <astGenerator.h>
|
#include "tmsg.h"
|
||||||
#include <tmsg.h>
|
#include "tglobal.h"
|
||||||
#include "astToMsg.h"
|
|
||||||
#include "parserInt.h"
|
#include "parserInt.h"
|
||||||
|
#include "ttime.h"
|
||||||
|
#include "astToMsg.h"
|
||||||
|
#include "astGenerator.h"
|
||||||
#include "parserUtil.h"
|
#include "parserUtil.h"
|
||||||
#include "queryInfoUtil.h"
|
#include "queryInfoUtil.h"
|
||||||
#include "tglobal.h"
|
|
||||||
#include "tmsg.h"
|
|
||||||
#include "ttime.h"
|
|
||||||
|
|
||||||
/* is contained in pFieldList or not */
|
/* is contained in pFieldList or not */
|
||||||
static bool has(SArray* pFieldList, int32_t startIndex, const char* name) {
|
static bool has(SArray* pFieldList, int32_t startIndex, const char* name) {
|
||||||
|
|
|
@ -629,7 +629,6 @@ int32_t parseInsertSql(SParseContext* pContext, SVnodeModifOpStmtInfo** pInfo) {
|
||||||
|
|
||||||
*pInfo = context.pOutput;
|
*pInfo = context.pOutput;
|
||||||
context.pOutput->nodeType = TSDB_SQL_INSERT;
|
context.pOutput->nodeType = TSDB_SQL_INSERT;
|
||||||
context.pOutput->schemaAttache = pContext->schemaAttached;
|
|
||||||
context.pOutput->payloadType = PAYLOAD_TYPE_KV;
|
context.pOutput->payloadType = PAYLOAD_TYPE_KV;
|
||||||
|
|
||||||
int32_t code = skipInsertInto(&context);
|
int32_t code = skipInsertInto(&context);
|
||||||
|
|
|
@ -31,8 +31,8 @@ bool isInsertSql(const char* pStr, size_t length) {
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool qIsDdlQuery(const SQueryNode* pQuery) {
|
bool qIsDdlQuery(const SQueryNode* pQueryNode) {
|
||||||
return TSDB_SQL_INSERT != pQuery->type && TSDB_SQL_SELECT != pQuery->type && TSDB_SQL_CREATE_TABLE != pQuery->type;
|
return TSDB_SQL_INSERT != pQueryNode->type && TSDB_SQL_SELECT != pQueryNode->type && TSDB_SQL_CREATE_TABLE != pQueryNode->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
|
int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
|
||||||
|
|
Loading…
Reference in New Issue