TDengine/source/client/inc/clientInt.h

490 lines
16 KiB
C
Raw Normal View History

/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_CLIENTINT_H
#define TDENGINE_CLIENTINT_H
#ifdef __cplusplus
extern "C" {
#endif
2022-06-21 05:50:33 +00:00
#include "catalog.h"
2022-02-23 15:10:56 +00:00
#include "parser.h"
#include "planner.h"
2022-02-23 15:10:56 +00:00
#include "query.h"
#include "taos.h"
2022-03-04 09:08:46 +00:00
#include "tcommon.h"
2022-11-23 14:08:35 +00:00
#include "tmisce.h"
#include "tdef.h"
#include "thash.h"
#include "tlist.h"
2022-02-23 15:10:56 +00:00
#include "tmsg.h"
2021-12-13 11:31:00 +00:00
#include "tmsgtype.h"
#include "trpc.h"
2022-01-28 07:24:09 +00:00
2022-02-24 10:13:57 +00:00
#include "tconfig.h"
2022-02-23 03:54:29 +00:00
2022-04-15 04:09:27 +00:00
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
2022-04-20 13:36:55 +00:00
#define HEARTBEAT_INTERVAL 1500 // ms
2022-06-02 13:20:15 +00:00
enum {
RES_TYPE__QUERY = 1,
RES_TYPE__TMQ,
2022-06-21 05:50:33 +00:00
RES_TYPE__TMQ_META,
RES_TYPE__TMQ_METADATA,
2024-05-23 09:35:54 +00:00
RES_TYPE__TMQ_BATCH_META,
};
2023-07-14 05:57:02 +00:00
#define SHOW_VARIABLES_RESULT_COLS 3
2022-06-24 07:18:40 +00:00
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
2023-07-14 05:57:02 +00:00
#define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE)
2022-06-24 07:18:40 +00:00
2024-05-23 09:35:54 +00:00
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
#define TD_RES_TMQ_METADATA(res) (*(int8_t*)res == RES_TYPE__TMQ_METADATA)
#define TD_RES_TMQ_BATCH_META(res) (*(int8_t*)res == RES_TYPE__TMQ_BATCH_META)
2022-01-14 02:48:05 +00:00
typedef struct SAppInstInfo SAppInstInfo;
2022-03-04 09:08:46 +00:00
typedef struct {
2023-02-28 11:53:17 +00:00
char* key;
int32_t idx;
2022-01-14 02:48:05 +00:00
// statistics
int32_t reportCnt;
int32_t connKeyCnt;
2023-06-30 08:30:04 +00:00
int8_t connHbFlag; // 0 init, 1 send req, 2 get resp
2022-01-14 02:48:05 +00:00
int64_t reportBytes; // not implemented
int64_t startTime;
// ctl
2022-06-21 05:50:33 +00:00
SRWLatch lock; // lock is used in serialization
2022-01-14 02:48:05 +00:00
SAppInstInfo* pAppInstInfo;
2022-06-21 05:50:33 +00:00
SHashObj* activeInfo; // hash<SClientHbKey, SClientHbReq>
2022-01-14 02:48:05 +00:00
} SAppHbMgr;
2022-03-04 09:08:46 +00:00
typedef int32_t (*FHbRspHandle)(SAppHbMgr* pAppHbMgr, SClientHbRsp* pRsp);
2022-01-26 00:50:32 +00:00
2023-04-23 14:43:29 +00:00
typedef int32_t (*FHbReqHandle)(SClientHbKey* connKey, void* param, SClientHbReq* req);
2022-01-26 00:50:32 +00:00
2022-03-04 09:08:46 +00:00
typedef struct {
2022-06-21 05:50:33 +00:00
int8_t inited;
int64_t appId;
2022-01-14 02:48:05 +00:00
// ctl
2022-04-12 02:45:34 +00:00
int8_t threadStop;
int8_t quitByKill;
2022-04-12 02:45:34 +00:00
TdThread thread;
2023-06-30 06:52:20 +00:00
TdThreadMutex lock; // used when app init and cleanup
2022-06-21 05:50:33 +00:00
SHashObj* appSummary;
2023-07-01 07:25:17 +00:00
SHashObj* appHbHash; // key: clusterId
2022-04-12 02:45:34 +00:00
SArray* appHbMgrs; // SArray<SAppHbMgr*> one for each cluster
2022-04-14 11:54:59 +00:00
FHbReqHandle reqHandle[CONN_TYPE__MAX];
FHbRspHandle rspHandle[CONN_TYPE__MAX];
2022-01-14 02:48:05 +00:00
} SClientHbMgr;
typedef struct SQueryExecMetric {
2022-08-24 09:36:10 +00:00
int64_t start; // start timestamp, us
int64_t ctgStart; // start to parse, us
int64_t execStart; // start to parse, us
int64_t parseCostUs;
int64_t ctgCostUs;
int64_t analyseCostUs;
int64_t planCostUs;
int64_t execCostUs;
} SQueryExecMetric;
2022-01-14 02:48:05 +00:00
struct SAppInstInfo {
2022-06-15 12:59:33 +00:00
int64_t numOfConns;
SCorEpSet mgmtEp;
2022-06-24 07:18:40 +00:00
int32_t totalDnodes;
int32_t onlineDnodes;
2022-06-15 12:59:33 +00:00
TdThreadMutex qnodeMutex;
SArray* pQnodeList;
SAppClusterSummary summary;
SList* pConnList; // STscObj linked list
2024-06-19 10:54:26 +00:00
int64_t clusterId;
2022-06-15 12:59:33 +00:00
void* pTransporter;
SAppHbMgr* pAppHbMgr;
2022-06-27 05:33:29 +00:00
char* instKey;
2024-06-19 10:54:26 +00:00
SMonitorParas monitorParas;
2022-01-14 02:48:05 +00:00
};
typedef struct SAppInfo {
2022-04-12 02:45:34 +00:00
int64_t startTime;
char appName[TSDB_APP_NAME_LEN];
int32_t pid;
int32_t numOfThreads;
SHashObj* pInstMap;
2024-06-19 10:54:26 +00:00
SHashObj* pInstMapByClusterId;
2022-03-19 16:47:45 +00:00
TdThreadMutex mutex;
} SAppInfo;
2023-04-09 10:44:46 +00:00
typedef struct {
2023-04-19 06:47:06 +00:00
int32_t ver;
void* param;
__taos_notify_fn_t fp;
2023-09-21 01:53:45 +00:00
} STscNotifyInfo;
typedef STscNotifyInfo SPassInfo;
2023-04-09 10:44:46 +00:00
typedef struct {
2023-09-21 01:53:45 +00:00
int64_t ver;
void* param;
__taos_notify_fn_t fp;
} SWhiteListInfo;
typedef struct STscObj {
char user[TSDB_USER_LEN];
char pass[TSDB_PASSWORD_LEN];
char db[TSDB_DB_FNAME_LEN];
char sVer[TSDB_VERSION_LEN];
char sDetailVer[128];
int8_t sysInfo;
int8_t connType;
2023-09-21 08:12:46 +00:00
int8_t dropped;
int8_t biMode;
int32_t acctId;
uint32_t connId;
2024-01-19 02:24:39 +00:00
int32_t appHbMgrIdx;
int64_t id; // ref ID returned by taosAddRef
TdThreadMutex mutex; // used to protect the operation on db
int32_t numOfReqs; // number of sqlObj bound to this connection
int32_t authVer;
SAppInstInfo* pAppInfo;
SHashObj* pRequests;
SPassInfo passInfo;
SWhiteListInfo whiteListInfo;
2023-09-21 01:53:45 +00:00
STscNotifyInfo userDroppedInfo;
} STscObj;
2023-02-17 09:40:14 +00:00
typedef struct STscDbg {
bool memEnable;
} STscDbg;
typedef struct SResultColumn {
union {
2022-04-12 02:45:34 +00:00
char* nullbitmap; // bitmap, one bit for each item in the list
int32_t* offset;
};
2022-04-12 02:45:34 +00:00
char* pData;
} SResultColumn;
typedef struct SReqResultInfo {
2022-07-04 01:08:57 +00:00
SExecResult execRes;
2024-03-08 07:47:53 +00:00
const char* pRspMsg;
const char* pData;
2022-04-12 02:45:34 +00:00
TAOS_FIELD* fields; // todo, column names are not needed.
TAOS_FIELD* userFields; // the fields info that return to user
uint32_t numOfCols;
int32_t* length;
2022-03-24 09:26:04 +00:00
char** convertBuf;
TAOS_ROW row;
SResultColumn* pCol;
uint64_t numOfRows; // from int32_t change to int64_t
uint64_t totalRows;
uint64_t current;
bool localResultFetched;
bool completed;
bool convertUcs4;
2024-05-17 09:51:41 +00:00
char* decompBuf;
int32_t decompBufSize;
int32_t precision;
int32_t payloadLen;
2022-06-18 09:04:32 +00:00
char* convertJson;
} SReqResultInfo;
typedef struct SRequestSendRecvBody {
2022-07-02 09:00:57 +00:00
tsem_t rspSem; // not used now
__taos_async_fn_t queryFp;
__taos_async_fn_t fetchFp;
2022-07-13 12:25:16 +00:00
EQueryExecMode execMode;
void* interParam;
2022-07-02 09:00:57 +00:00
SDataBuf requestMsg;
int64_t queryJob; // query job, created according to sql query DAG.
int32_t subplanNum;
SReqResultInfo resInfo;
} SRequestSendRecvBody;
2022-04-13 08:00:30 +00:00
typedef struct {
2022-04-20 13:36:55 +00:00
int8_t resType;
char topic[TSDB_TOPIC_FNAME_LEN];
2022-06-02 02:18:11 +00:00
char db[TSDB_DB_FNAME_LEN];
2022-04-20 13:36:55 +00:00
int32_t vgId;
SSchemaWrapper schema;
int32_t resIter;
SReqResultInfo resInfo;
2024-04-19 05:48:17 +00:00
} SMqRspObjCommon;
typedef struct {
SMqRspObjCommon common;
SMqDataRsp rsp;
2022-04-12 05:39:52 +00:00
} SMqRspObj;
2022-04-12 02:45:34 +00:00
2022-06-21 05:50:33 +00:00
typedef struct {
int8_t resType;
char topic[TSDB_TOPIC_FNAME_LEN];
char db[TSDB_DB_FNAME_LEN];
int32_t vgId;
SMqMetaRsp metaRsp;
} SMqMetaRspObj;
2022-08-30 02:57:24 +00:00
typedef struct {
2024-04-19 05:48:17 +00:00
SMqRspObjCommon common;
STaosxRsp rsp;
2022-08-30 02:57:24 +00:00
} SMqTaosxRspObj;
2024-05-23 09:35:54 +00:00
typedef struct {
SMqRspObjCommon common;
SMqBatchMetaRsp rsp;
} SMqBatchMetaRspObj;
typedef struct SReqRelInfo {
uint64_t userRefId;
uint64_t prevRefId;
uint64_t nextRefId;
} SReqRelInfo;
typedef struct SRequestObj {
2022-04-12 02:45:34 +00:00
int8_t resType; // query or tmq
2022-02-23 15:10:56 +00:00
uint64_t requestId;
int32_t type; // request type
STscObj* pTscObj;
char* pDb; // current database string
2022-02-23 15:10:56 +00:00
char* sqlstr; // sql string
int32_t sqlLen;
int64_t self;
char* msgBuf;
2022-04-14 12:14:52 +00:00
int32_t msgBufLen;
2022-02-23 15:10:56 +00:00
int32_t code;
2022-03-15 07:34:17 +00:00
SArray* dbList;
SArray* tableList;
2022-07-27 03:12:31 +00:00
SArray* targetTableList;
2022-02-23 15:10:56 +00:00
SQueryExecMetric metric;
2021-12-24 15:39:55 +00:00
SRequestSendRecvBody body;
2022-08-01 12:47:08 +00:00
int32_t stmtType;
2022-07-25 11:32:12 +00:00
bool syncQuery; // todo refactor: async query object
bool stableQuery; // todo refactor
bool validateOnly; // todo refactor
2023-10-08 10:36:06 +00:00
bool parseOnly;
2022-07-14 11:09:40 +00:00
bool killed;
2022-08-01 12:47:08 +00:00
bool inRetry;
bool isSubReq;
bool inCallback;
2024-07-02 03:05:54 +00:00
bool isStmtBind; // is statement bind parameter
2022-07-14 11:09:40 +00:00
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
uint32_t retry;
int64_t allocatorRefId;
2022-09-22 06:03:11 +00:00
SQuery* pQuery;
void* pPostPlan;
SReqRelInfo relation;
void* pWrapper;
2023-10-08 10:36:06 +00:00
SMetaData parseMeta;
2023-10-20 00:41:49 +00:00
char* effectiveUser;
2024-03-05 03:25:43 +00:00
int8_t source;
} SRequestObj;
typedef struct SSyncQueryParam {
tsem_t sem;
SRequestObj* pRequest;
void* userParam;
} SSyncQueryParam;
2022-06-21 05:50:33 +00:00
void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4);
void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4);
2022-06-29 12:57:15 +00:00
void doSetOneRowPtr(SReqResultInfo* pResultInfo);
void setResPrecision(SReqResultInfo* pResInfo, int32_t precision);
2024-03-08 06:49:48 +00:00
int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp, bool convertUcs4);
2024-01-17 12:08:26 +00:00
int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t numOfCols, int32_t numOfRows,
bool convertUcs4);
int32_t setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols);
2022-06-29 12:57:15 +00:00
void doFreeReqResultInfo(SReqResultInfo* pResInfo);
int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq);
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
2022-06-24 00:20:54 +00:00
2024-03-05 03:25:43 +00:00
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly, int8_t source);
2022-11-03 12:08:30 +00:00
TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid);
2024-03-05 03:25:43 +00:00
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly, int8_t source);
2022-11-03 12:08:30 +00:00
void taosAsyncQueryImplWithReqid(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly,
int64_t reqid);
void taosAsyncFetchImpl(SRequestObj *pRequest, __taos_async_fn_t fp, void *param);
2023-10-24 03:29:04 +00:00
int32_t clientParseSql(void* param, const char* dbName, const char* sql, bool parseOnly, const char* effectiveUser, SParseSqlRes* pRes);
2023-09-22 03:36:53 +00:00
void syncQueryFn(void* param, void* res, int32_t code);
2022-04-20 13:36:55 +00:00
2022-08-24 09:36:10 +00:00
int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols);
2022-04-12 02:45:34 +00:00
static FORCE_INLINE SReqResultInfo* tmqGetCurResInfo(TAOS_RES* res) {
2022-04-12 05:39:52 +00:00
SMqRspObj* msg = (SMqRspObj*)res;
2024-04-19 05:48:17 +00:00
return (SReqResultInfo*)&msg->common.resInfo;
2022-04-12 02:45:34 +00:00
}
int32_t tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4, SReqResultInfo** pResInfo);
2022-04-12 02:45:34 +00:00
static FORCE_INLINE SReqResultInfo* tscGetCurResInfo(TAOS_RES* res) {
if (TD_RES_QUERY(res)) return &(((SRequestObj*)res)->body.resInfo);
return tmqGetCurResInfo(res);
}
extern SAppInfo appInfo;
2021-12-24 15:39:55 +00:00
extern int32_t clientReqRefPool;
extern int32_t clientConnRefPool;
2022-07-15 06:51:20 +00:00
extern int32_t timestampDeltaLimit;
2022-12-30 05:30:54 +00:00
extern int64_t lastClusterId;
2022-06-06 11:27:51 +00:00
__async_send_cb_fn_t getMsgRspHandle(int32_t msgType);
2022-01-19 14:35:25 +00:00
SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pReqObj);
2021-12-13 11:31:00 +00:00
int32_t createTscObj(const char *user, const char *auth, const char *db, int32_t connType, SAppInstInfo *pAppInfo,
STscObj **p);
2022-04-20 13:36:55 +00:00
void destroyTscObj(void* pObj);
STscObj* acquireTscObj(int64_t rid);
void releaseTscObj(int64_t rid);
2024-06-19 10:54:26 +00:00
void destroyAppInst(void* pAppInfo);
uint64_t generateRequestId();
int32_t createRequest(uint64_t connId, int32_t type, int64_t reqid, SRequestObj **pRequest);
2022-04-20 13:36:55 +00:00
void destroyRequest(SRequestObj* pRequest);
SRequestObj* acquireRequest(int64_t rid);
int32_t releaseRequest(int64_t rid);
2022-06-26 07:13:22 +00:00
int32_t removeRequest(int64_t rid);
2022-07-02 09:00:57 +00:00
void doDestroyRequest(void* p);
int64_t removeFromMostPrevReq(SRequestObj* pRequest);
2022-02-23 15:10:56 +00:00
char* getDbOfConnection(STscObj* pObj);
void setConnectionDB(STscObj* pTscObj, const char* db);
2022-04-01 11:31:24 +00:00
void resetConnectDB(STscObj* pTscObj);
2022-04-20 13:36:55 +00:00
int taos_options_imp(TSDB_OPTION option, const char* str);
int32_t openTransporter(const char* user, const char* auth, int32_t numOfThreads, void **pDnodeConn);
2022-12-30 05:30:54 +00:00
void tscStopCrashReport();
void cleanupAppInfo();
2021-12-13 11:31:00 +00:00
2022-07-13 06:04:18 +00:00
typedef struct AsyncArg {
SRpcMsg msg;
SEpSet* pEpset;
} AsyncArg;
2022-02-23 15:10:56 +00:00
bool persistConnForSpecificMsg(void* parenct, tmsg_t msgType);
2021-12-13 11:31:00 +00:00
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet);
2022-01-11 07:42:27 +00:00
int32_t taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db,
uint16_t port, int connType, STscObj** pObj);
2022-01-11 07:42:27 +00:00
2022-04-18 02:19:15 +00:00
int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb);
2022-06-18 08:30:46 +00:00
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList);
2022-01-28 07:24:09 +00:00
2022-07-12 12:00:26 +00:00
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql,
2022-11-03 12:08:30 +00:00
SRequestObj** pRequest, int64_t reqid);
2022-01-28 07:24:09 +00:00
2022-06-21 05:50:33 +00:00
void taos_close_internal(void* taos);
2022-02-23 15:10:56 +00:00
// --- heartbeat
2022-01-14 02:48:05 +00:00
// global, called by mgmt
int32_t hbMgrInit();
void hbMgrCleanUp();
2022-01-14 02:48:05 +00:00
// cluster level
int32_t appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key, SAppHbMgr **pAppHbMgr);
2022-02-23 15:10:56 +00:00
void appHbMgrCleanup(void);
2022-07-02 09:00:57 +00:00
void hbRemoveAppHbMrg(SAppHbMgr** pAppHbMgr);
2022-07-04 08:10:59 +00:00
void destroyAllRequests(SHashObj* pRequests);
void stopAllRequests(SHashObj* pRequests);
2022-01-14 02:48:05 +00:00
2024-06-19 10:54:26 +00:00
//SAppInstInfo* getAppInstInfo(const char* clusterKey);
2023-11-02 10:44:18 +00:00
2022-01-14 02:48:05 +00:00
// conn level
int32_t hbRegisterConn(SAppHbMgr* pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType);
2023-04-25 02:59:02 +00:00
void hbDeregisterConn(STscObj* pTscObj, SClientHbKey connKey);
2022-01-14 02:48:05 +00:00
typedef struct SSqlCallbackWrapper {
SParseContext* pParseCtx;
SCatalogReq* pCatalogReq;
SRequestObj* pRequest;
void* pPlanInfo;
} SSqlCallbackWrapper;
SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void** res);
2022-06-02 09:52:51 +00:00
int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList);
void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta, SSqlCallbackWrapper* pWrapper);
int32_t refreshMeta(STscObj* pTscObj, SRequestObj* pRequest);
int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList);
void doAsyncQuery(SRequestObj* pRequest, bool forceUpdateMeta);
int32_t removeMeta(STscObj* pTscObj, SArray* tbList, bool isView);
int32_t handleAlterTbExecRes(void* res, struct SCatalog* pCatalog);
int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog);
int32_t qnodeRequired(SRequestObj* pRequest, bool *required);
2022-11-04 07:21:38 +00:00
void continueInsertFromCsv(SSqlCallbackWrapper* pWrapper, SRequestObj* pRequest);
void destorySqlCallbackWrapper(SSqlCallbackWrapper* pWrapper);
void handleQueryAnslyseRes(SSqlCallbackWrapper *pWrapper, SMetaData *pResultMeta, int32_t code);
void restartAsyncQuery(SRequestObj *pRequest, int32_t code);
int32_t buildPreviousRequest(SRequestObj *pRequest, const char* sql, SRequestObj** pNewRequest);
int32_t prepareAndParseSqlSyntax(SSqlCallbackWrapper **ppWrapper, SRequestObj *pRequest, bool updateMetaForce);
void returnToUser(SRequestObj* pRequest);
void stopAllQueries(SRequestObj *pRequest);
void doRequestCallback(SRequestObj* pRequest, int32_t code);
2023-09-22 03:36:53 +00:00
void freeQueryParam(SSyncQueryParam* param);
#ifdef TD_ENTERPRISE
2023-10-24 03:29:04 +00:00
int32_t clientParseSqlImpl(void* param, const char* dbName, const char* sql, bool parseOnly, const char* effeciveUser, SParseSqlRes* pRes);
2023-09-22 03:36:53 +00:00
#endif
2022-04-18 02:19:15 +00:00
#define TSC_ERR_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define TSC_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
} \
return _code; \
} while (0)
#define TSC_ERR_JRET(c) \
do { \
code = c; \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
2023-11-02 10:44:18 +00:00
2024-06-19 10:54:26 +00:00
void slowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost);
2024-02-19 06:27:54 +00:00
enum {
MONITORSQLTYPESELECT = 0,
MONITORSQLTYPEINSERT = 1,
MONITORSQLTYPEDELETE = 2
};
void sqlReqLog(int64_t rid, bool killed, int32_t code, int8_t type);
2023-11-02 10:44:18 +00:00
2024-07-08 01:12:50 +00:00
void tmqMgmtClose(void);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_CLIENTINT_H