Merge branch '3.0' into feat/sangshuduo/TD-14141-update-taostools-for3.0
This commit is contained in:
commit
4dc3d88b57
|
@ -1,12 +0,0 @@
|
||||||
[submodule "src/connector/go"]
|
|
||||||
path = src/connector/go
|
|
||||||
url = git@github.com:taosdata/driver-go.git
|
|
||||||
[submodule "src/connector/hivemq-tdengine-extension"]
|
|
||||||
path = src/connector/hivemq-tdengine-extension
|
|
||||||
url = git@github.com:taosdata/hivemq-tdengine-extension.git
|
|
||||||
[submodule "deps/TSZ"]
|
|
||||||
path = deps/TSZ
|
|
||||||
url = https://github.com/taosdata/TSZ.git
|
|
||||||
[submodule "examples/rust"]
|
|
||||||
path = examples/rust
|
|
||||||
url = https://github.com/songtianyi/tdengine-rust-bindings.git
|
|
|
@ -118,6 +118,7 @@ def pre_test(){
|
||||||
git rm --cached tools/taos-tools 2>/dev/null || :
|
git rm --cached tools/taos-tools 2>/dev/null || :
|
||||||
git rm --cached tools/taosadapter 2>/dev/null || :
|
git rm --cached tools/taosadapter 2>/dev/null || :
|
||||||
git rm --cached tools/taosws-rs 2>/dev/null || :
|
git rm --cached tools/taosws-rs 2>/dev/null || :
|
||||||
|
git rm --cached examples/rust 2>/dev/null || :
|
||||||
'''
|
'''
|
||||||
sh '''
|
sh '''
|
||||||
cd ${WKC}
|
cd ${WKC}
|
||||||
|
@ -269,6 +270,7 @@ def pre_test_win(){
|
||||||
git rm --cached tools/taos-tools 2>nul
|
git rm --cached tools/taos-tools 2>nul
|
||||||
git rm --cached tools/taosadapter 2>nul
|
git rm --cached tools/taosadapter 2>nul
|
||||||
git rm --cached tools/taosws-rs 2>nul
|
git rm --cached tools/taosws-rs 2>nul
|
||||||
|
git rm --cached examples/rust 2>nul
|
||||||
exit 0
|
exit 0
|
||||||
'''
|
'''
|
||||||
bat '''
|
bat '''
|
||||||
|
|
|
@ -90,6 +90,12 @@ ELSE ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
option(
|
||||||
|
RUST_BINDINGS
|
||||||
|
"If build with rust-bindings"
|
||||||
|
ON
|
||||||
|
)
|
||||||
|
|
||||||
option(
|
option(
|
||||||
JEMALLOC_ENABLED
|
JEMALLOC_ENABLED
|
||||||
"If build with jemalloc"
|
"If build with jemalloc"
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
# rust-bindings
|
||||||
|
ExternalProject_Add(rust-bindings
|
||||||
|
GIT_REPOSITORY https://github.com/songtianyi/tdengine-rust-bindings.git
|
||||||
|
GIT_TAG 7ed7a97
|
||||||
|
SOURCE_DIR "${TD_SOURCE_DIR}/examples/rust"
|
||||||
|
BINARY_DIR "${TD_SOURCE_DIR}/examples/rust"
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
TEST_COMMAND ""
|
||||||
|
)
|
|
@ -105,6 +105,11 @@ if(${BUILD_WITH_SQLITE})
|
||||||
cat("${TD_SUPPORT_DIR}/sqlite_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
cat("${TD_SUPPORT_DIR}/sqlite_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
endif(${BUILD_WITH_SQLITE})
|
endif(${BUILD_WITH_SQLITE})
|
||||||
|
|
||||||
|
# rust-bindings
|
||||||
|
if(${RUST_BINDINGS})
|
||||||
|
cat("${TD_SUPPORT_DIR}/rust-bindings_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
|
endif(${RUST_BINDINGS})
|
||||||
|
|
||||||
# lucene
|
# lucene
|
||||||
if(${BUILD_WITH_LUCENE})
|
if(${BUILD_WITH_LUCENE})
|
||||||
cat("${TD_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
cat("${TD_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
|
@ -136,6 +141,24 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||||
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
|
||||||
|
|
||||||
|
# clear submodule
|
||||||
|
execute_process(COMMAND git submodule deinit -f tools/taos-tools
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git rm --cached tools/taos-tools
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git submodule deinit -f tools/taosadapter
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git rm --cached tools/taosadapter
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git submodule deinit -f tools/taosws-rs
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git rm --cached tools/taosws-rs
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git submodule deinit -f examples/rust
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
execute_process(COMMAND git rm --cached examples/rust
|
||||||
|
WORKING_DIRECTORY "${TD_SOURCE_DIR}")
|
||||||
|
|
||||||
# ================================================================================================
|
# ================================================================================================
|
||||||
# Build
|
# Build
|
||||||
# ================================================================================================
|
# ================================================================================================
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 7ed7a97715388fa144718764d6bf20f9bfc29a12
|
|
|
@ -155,7 +155,7 @@ int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t
|
||||||
|
|
||||||
void qProcessRspMsg(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
|
void qProcessRspMsg(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
|
||||||
|
|
||||||
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t* resNum, SExplainExecInfo** pRes);
|
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, SArray* pExecInfoList/*,int32_t* resNum, SExplainExecInfo** pRes*/);
|
||||||
|
|
||||||
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len);
|
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len);
|
||||||
|
|
||||||
|
|
|
@ -16,65 +16,9 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
#include "tglobal.h"
|
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
#include "tname.h"
|
#include "tname.h"
|
||||||
|
|
||||||
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
|
|
||||||
pEp->port = 0;
|
|
||||||
strcpy(pEp->fqdn, ep);
|
|
||||||
|
|
||||||
char* temp = strchr(pEp->fqdn, ':');
|
|
||||||
if (temp) {
|
|
||||||
*temp = 0;
|
|
||||||
pEp->port = atoi(temp + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pEp->port == 0) {
|
|
||||||
pEp->port = tsServerPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port) {
|
|
||||||
if (pEpSet == NULL || fqdn == NULL || strlen(fqdn) == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t index = pEpSet->numOfEps;
|
|
||||||
tstrncpy(pEpSet->eps[index].fqdn, fqdn, tListLen(pEpSet->eps[index].fqdn));
|
|
||||||
pEpSet->eps[index].port = port;
|
|
||||||
pEpSet->numOfEps += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
|
|
||||||
if (s1->numOfEps != s2->numOfEps || s1->inUse != s2->inUse) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < s1->numOfEps; i++) {
|
|
||||||
if (s1->eps[i].port != s2->eps[i].port || strncmp(s1->eps[i].fqdn, s2->eps[i].fqdn, TSDB_FQDN_LEN) != 0)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
|
|
||||||
taosCorBeginWrite(&pEpSet->version);
|
|
||||||
pEpSet->epSet = *pNewEpSet;
|
|
||||||
taosCorEndWrite(&pEpSet->version);
|
|
||||||
}
|
|
||||||
|
|
||||||
SEpSet getEpSet_s(SCorEpSet* pEpSet) {
|
|
||||||
SEpSet ep = {0};
|
|
||||||
taosCorBeginRead(&pEpSet->version);
|
|
||||||
ep = pEpSet->epSet;
|
|
||||||
taosCorEndRead(&pEpSet->version);
|
|
||||||
|
|
||||||
return ep;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) {
|
int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) {
|
||||||
ASSERT(pColumnInfoData != NULL);
|
ASSERT(pColumnInfoData != NULL);
|
||||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _DEFAULT_SOURCE
|
||||||
|
#include "tdatablock.h"
|
||||||
|
#include "tglobal.h"
|
||||||
|
#include "tlog.h"
|
||||||
|
#include "tname.h"
|
||||||
|
|
||||||
|
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
|
||||||
|
pEp->port = 0;
|
||||||
|
strcpy(pEp->fqdn, ep);
|
||||||
|
|
||||||
|
char* temp = strchr(pEp->fqdn, ':');
|
||||||
|
if (temp) {
|
||||||
|
*temp = 0;
|
||||||
|
pEp->port = atoi(temp + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEp->port == 0) {
|
||||||
|
pEp->port = tsServerPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port) {
|
||||||
|
if (pEpSet == NULL || fqdn == NULL || strlen(fqdn) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t index = pEpSet->numOfEps;
|
||||||
|
tstrncpy(pEpSet->eps[index].fqdn, fqdn, tListLen(pEpSet->eps[index].fqdn));
|
||||||
|
pEpSet->eps[index].port = port;
|
||||||
|
pEpSet->numOfEps += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
|
||||||
|
if (s1->numOfEps != s2->numOfEps || s1->inUse != s2->inUse) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < s1->numOfEps; i++) {
|
||||||
|
if (s1->eps[i].port != s2->eps[i].port || strncmp(s1->eps[i].fqdn, s2->eps[i].fqdn, TSDB_FQDN_LEN) != 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
|
||||||
|
taosCorBeginWrite(&pEpSet->version);
|
||||||
|
pEpSet->epSet = *pNewEpSet;
|
||||||
|
taosCorEndWrite(&pEpSet->version);
|
||||||
|
}
|
||||||
|
|
||||||
|
SEpSet getEpSet_s(SCorEpSet* pEpSet) {
|
||||||
|
SEpSet ep = {0};
|
||||||
|
taosCorBeginRead(&pEpSet->version);
|
||||||
|
ep = pEpSet->epSet;
|
||||||
|
taosCorEndRead(&pEpSet->version);
|
||||||
|
|
||||||
|
return ep;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,34 +20,6 @@
|
||||||
|
|
||||||
#define VALID_NAME_TYPE(x) ((x) == TSDB_DB_NAME_T || (x) == TSDB_TABLE_NAME_T)
|
#define VALID_NAME_TYPE(x) ((x) == TSDB_DB_NAME_T || (x) == TSDB_TABLE_NAME_T)
|
||||||
|
|
||||||
bool tscValidateTableNameLength(size_t len) { return len < TSDB_TABLE_NAME_LEN; }
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// TODO refactor
|
|
||||||
SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFilters) {
|
|
||||||
if (numOfFilters == 0 || src == NULL) {
|
|
||||||
assert(src == NULL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SColumnFilterInfo* pFilter = taosMemoryCalloc(1, numOfFilters * sizeof(SColumnFilterInfo));
|
|
||||||
|
|
||||||
memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters);
|
|
||||||
for (int32_t j = 0; j < numOfFilters; ++j) {
|
|
||||||
if (pFilter[j].filterstr) {
|
|
||||||
size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE;
|
|
||||||
pFilter[j].pz = (int64_t) taosMemoryCalloc(1, len);
|
|
||||||
|
|
||||||
memcpy((char*)pFilter[j].pz, (char*)src[j].pz, (size_t) pFilter[j].len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(src->filterstr == 0 || src->filterstr == 1);
|
|
||||||
assert(!(src->lowerRelOptr == 0 && src->upperRelOptr == 0));
|
|
||||||
|
|
||||||
return pFilter;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if 0
|
#if 0
|
||||||
int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, int64_t intervalTime, char timeUnit, int16_t precision) {
|
int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, int64_t intervalTime, char timeUnit, int16_t precision) {
|
||||||
if (slidingTime == 0) {
|
if (slidingTime == 0) {
|
||||||
|
|
|
@ -447,6 +447,7 @@ _err:
|
||||||
|
|
||||||
static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
||||||
SDecoder decoder = {0};
|
SDecoder decoder = {0};
|
||||||
|
SEncoder encoder = {0};
|
||||||
int32_t rcode = 0;
|
int32_t rcode = 0;
|
||||||
SVCreateTbBatchReq req = {0};
|
SVCreateTbBatchReq req = {0};
|
||||||
SVCreateTbReq *pCreateReq;
|
SVCreateTbReq *pCreateReq;
|
||||||
|
@ -515,7 +516,6 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR
|
||||||
tdUidStoreFree(pStore);
|
tdUidStoreFree(pStore);
|
||||||
|
|
||||||
// prepare rsp
|
// prepare rsp
|
||||||
SEncoder encoder = {0};
|
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
tEncodeSize(tEncodeSVCreateTbBatchRsp, &rsp, pRsp->contLen, ret);
|
tEncodeSize(tEncodeSVCreateTbBatchRsp, &rsp, pRsp->contLen, ret);
|
||||||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||||
|
|
|
@ -855,7 +855,6 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWin
|
||||||
int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, char* pData,
|
int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, char* pData,
|
||||||
int32_t compLen, int32_t numOfOutput, int64_t startTs, uint64_t* total,
|
int32_t compLen, int32_t numOfOutput, int64_t startTs, uint64_t* total,
|
||||||
SArray* pColList);
|
SArray* pColList);
|
||||||
STimeWindow getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t key);
|
|
||||||
STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInterval* pInterval, int32_t order);
|
STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInterval* pInterval, int32_t order);
|
||||||
|
|
||||||
int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t *order, int32_t* scanFlag);
|
int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t *order, int32_t* scanFlag);
|
||||||
|
@ -987,8 +986,7 @@ void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status);
|
||||||
int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
|
int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
|
||||||
const char* sql, EOPTR_EXEC_MODEL model);
|
const char* sql, EOPTR_EXEC_MODEL model);
|
||||||
int32_t createDataSinkParam(SDataSinkNode *pNode, void **pParam, qTaskInfo_t* pTaskInfo, SReadHandle* readHandle);
|
int32_t createDataSinkParam(SDataSinkNode *pNode, void **pParam, qTaskInfo_t* pTaskInfo, SReadHandle* readHandle);
|
||||||
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo** pRes, int32_t* capacity,
|
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInfoList);
|
||||||
int32_t* resNum);
|
|
||||||
|
|
||||||
int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result);
|
int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result);
|
||||||
int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* length);
|
int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* length);
|
||||||
|
|
|
@ -496,11 +496,9 @@ void qDestroyTask(qTaskInfo_t qTaskHandle) {
|
||||||
doDestroyTask(pTaskInfo);
|
doDestroyTask(pTaskInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t* resNum, SExplainExecInfo** pRes) {
|
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, SArray* pExecInfoList) {
|
||||||
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||||
int32_t capacity = 0;
|
return getOperatorExplainExecInfo(pTaskInfo->pRoot, pExecInfoList);
|
||||||
|
|
||||||
return getOperatorExplainExecInfo(pTaskInfo->pRoot, pRes, &capacity, resNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) {
|
int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len) {
|
||||||
|
|
|
@ -4613,42 +4613,29 @@ void releaseQueryBuf(size_t numOfTables) {
|
||||||
atomic_add_fetch_64(&tsQueryBufferSizeBytes, t);
|
atomic_add_fetch_64(&tsQueryBufferSizeBytes, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo** pRes, int32_t* capacity,
|
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInfoList) {
|
||||||
int32_t* resNum) {
|
SExplainExecInfo execInfo = {0};
|
||||||
if (*resNum >= *capacity) {
|
SExplainExecInfo* pExplainInfo = taosArrayPush(pExecInfoList, &execInfo);
|
||||||
*capacity += 10;
|
|
||||||
|
|
||||||
*pRes = taosMemoryRealloc(*pRes, (*capacity) * sizeof(SExplainExecInfo));
|
pExplainInfo->numOfRows = operatorInfo->resultInfo.totalRows;
|
||||||
if (NULL == *pRes) {
|
pExplainInfo->startupCost = operatorInfo->cost.openCost;
|
||||||
qError("malloc %d failed", (*capacity) * (int32_t)sizeof(SExplainExecInfo));
|
pExplainInfo->totalCost = operatorInfo->cost.totalCost;
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
pExplainInfo->verboseLen = 0;
|
||||||
}
|
pExplainInfo->verboseInfo = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
SExplainExecInfo* pInfo = &(*pRes)[*resNum];
|
|
||||||
|
|
||||||
pInfo->numOfRows = operatorInfo->resultInfo.totalRows;
|
|
||||||
pInfo->startupCost = operatorInfo->cost.openCost;
|
|
||||||
pInfo->totalCost = operatorInfo->cost.totalCost;
|
|
||||||
|
|
||||||
if (operatorInfo->fpSet.getExplainFn) {
|
if (operatorInfo->fpSet.getExplainFn) {
|
||||||
int32_t code = operatorInfo->fpSet.getExplainFn(operatorInfo, &pInfo->verboseInfo, &pInfo->verboseLen);
|
int32_t code = operatorInfo->fpSet.getExplainFn(operatorInfo, &pExplainInfo->verboseInfo, &pExplainInfo->verboseLen);
|
||||||
if (code) {
|
if (code) {
|
||||||
qError("%s operator getExplainFn failed, code:%s", GET_TASKID(operatorInfo->pTaskInfo), tstrerror(code));
|
qError("%s operator getExplainFn failed, code:%s", GET_TASKID(operatorInfo->pTaskInfo), tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
pInfo->verboseLen = 0;
|
|
||||||
pInfo->verboseInfo = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++(*resNum);
|
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
for (int32_t i = 0; i < operatorInfo->numOfDownstream; ++i) {
|
for (int32_t i = 0; i < operatorInfo->numOfDownstream; ++i) {
|
||||||
code = getOperatorExplainExecInfo(operatorInfo->pDownstream[i], pRes, capacity, resNum);
|
code = getOperatorExplainExecInfo(operatorInfo->pDownstream[i], pExecInfoList);
|
||||||
if (code) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
taosMemoryFreeClear(*pRes);
|
// taosMemoryFreeClear(*pRes);
|
||||||
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
return TSDB_CODE_QRY_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,21 @@ static int32_t* setupColumnOffset(const SSDataBlock* pBlock, int32_t rowCapacity
|
||||||
static int32_t setGroupResultOutputBuf(SOperatorInfo* pOperator, SOptrBasicInfo* binfo, int32_t numOfCols, char* pData, int16_t bytes,
|
static int32_t setGroupResultOutputBuf(SOperatorInfo* pOperator, SOptrBasicInfo* binfo, int32_t numOfCols, char* pData, int16_t bytes,
|
||||||
uint64_t groupId, SDiskbasedBuf* pBuf, SAggSupporter* pAggSup);
|
uint64_t groupId, SDiskbasedBuf* pBuf, SAggSupporter* pAggSup);
|
||||||
|
|
||||||
|
static void freeGroupKey(void* param) {
|
||||||
|
SGroupKeys* pKey = (SGroupKeys*) param;
|
||||||
|
taosMemoryFree(pKey->pData);
|
||||||
|
}
|
||||||
|
|
||||||
static void destroyGroupOperatorInfo(void* param, int32_t numOfOutput) {
|
static void destroyGroupOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
SGroupbyOperatorInfo* pInfo = (SGroupbyOperatorInfo*)param;
|
SGroupbyOperatorInfo* pInfo = (SGroupbyOperatorInfo*)param;
|
||||||
cleanupBasicInfo(&pInfo->binfo);
|
cleanupBasicInfo(&pInfo->binfo);
|
||||||
taosMemoryFreeClear(pInfo->keyBuf);
|
taosMemoryFreeClear(pInfo->keyBuf);
|
||||||
taosArrayDestroy(pInfo->pGroupCols);
|
taosArrayDestroy(pInfo->pGroupCols);
|
||||||
taosArrayDestroy(pInfo->pGroupColVals);
|
taosArrayDestroyEx(pInfo->pGroupColVals, freeGroupKey);
|
||||||
cleanupExprSupp(&pInfo->scalarSup);
|
cleanupExprSupp(&pInfo->scalarSup);
|
||||||
|
|
||||||
|
cleanupGroupResInfo(&pInfo->groupResInfo);
|
||||||
|
cleanupAggSup(&pInfo->aggSup);
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,8 +421,6 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
|
||||||
pOperator->blocking = true;
|
pOperator->blocking = true;
|
||||||
pOperator->status = OP_NOT_OPENED;
|
pOperator->status = OP_NOT_OPENED;
|
||||||
// pOperator->operatorType = OP_Groupby;
|
// pOperator->operatorType = OP_Groupby;
|
||||||
pOperator->exprSupp.pExprInfo = pExprInfo;
|
|
||||||
pOperator->exprSupp.numOfExprs = numOfCols;
|
|
||||||
pOperator->info = pInfo;
|
pOperator->info = pInfo;
|
||||||
pOperator->pTaskInfo = pTaskInfo;
|
pOperator->pTaskInfo = pTaskInfo;
|
||||||
|
|
||||||
|
|
|
@ -2414,7 +2414,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
{
|
{
|
||||||
.name = "hyperloglog",
|
.name = "hyperloglog",
|
||||||
.type = FUNCTION_TYPE_HYPERLOGLOG,
|
.type = FUNCTION_TYPE_HYPERLOGLOG,
|
||||||
.classification = FUNC_MGT_AGG_FUNC,
|
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC,
|
||||||
.translateFunc = translateHLL,
|
.translateFunc = translateHLL,
|
||||||
.getEnvFunc = getHLLFuncEnv,
|
.getEnvFunc = getHLLFuncEnv,
|
||||||
.initFunc = functionSetup,
|
.initFunc = functionSetup,
|
||||||
|
@ -2428,7 +2428,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "_hyperloglog_partial",
|
.name = "_hyperloglog_partial",
|
||||||
.type = FUNCTION_TYPE_HYPERLOGLOG_PARTIAL,
|
.type = FUNCTION_TYPE_HYPERLOGLOG_PARTIAL | FUNC_MGT_TIMELINE_FUNC,
|
||||||
.classification = FUNC_MGT_AGG_FUNC,
|
.classification = FUNC_MGT_AGG_FUNC,
|
||||||
.translateFunc = translateHLLPartial,
|
.translateFunc = translateHLLPartial,
|
||||||
.getEnvFunc = getHLLFuncEnv,
|
.getEnvFunc = getHLLFuncEnv,
|
||||||
|
@ -2440,7 +2440,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "_hyperloglog_merge",
|
.name = "_hyperloglog_merge",
|
||||||
.type = FUNCTION_TYPE_HYPERLOGLOG_MERGE,
|
.type = FUNCTION_TYPE_HYPERLOGLOG_MERGE | FUNC_MGT_TIMELINE_FUNC,
|
||||||
.classification = FUNC_MGT_AGG_FUNC,
|
.classification = FUNC_MGT_AGG_FUNC,
|
||||||
.translateFunc = translateHLLMerge,
|
.translateFunc = translateHLLMerge,
|
||||||
.getEnvFunc = getHLLFuncEnv,
|
.getEnvFunc = getHLLFuncEnv,
|
||||||
|
|
|
@ -39,7 +39,7 @@ int32_t qwBuildAndSendFetchRsp(int32_t rspType, SRpcHandleInfo *pConn, SRetrieve
|
||||||
void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete);
|
void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete);
|
||||||
int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn);
|
int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn);
|
||||||
int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, SQWTaskCtx *ctx);
|
int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, SQWTaskCtx *ctx);
|
||||||
int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execInfo, int32_t num);
|
int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SArray* pExecList);
|
||||||
int32_t qwBuildAndSendErrorRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code);
|
int32_t qwBuildAndSendErrorRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code);
|
||||||
void qwFreeFetchRsp(void *msg);
|
void qwFreeFetchRsp(void *msg);
|
||||||
int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp);
|
int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp);
|
||||||
|
|
|
@ -82,8 +82,9 @@ int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t c
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execInfo, int32_t num) {
|
int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SArray* pExecList) {
|
||||||
SExplainRsp rsp = {.numOfPlans = num, .subplanInfo = execInfo};
|
SExplainExecInfo* pInfo = taosArrayGet(pExecList, 0);
|
||||||
|
SExplainRsp rsp = {.numOfPlans = taosArrayGetSize(pExecList), .subplanInfo = pInfo};
|
||||||
|
|
||||||
int32_t contLen = tSerializeSExplainRsp(NULL, 0, &rsp);
|
int32_t contLen = tSerializeSExplainRsp(NULL, 0, &rsp);
|
||||||
void * pRsp = rpcMallocCont(contLen);
|
void * pRsp = rpcMallocCont(contLen);
|
||||||
|
@ -96,10 +97,9 @@ int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execIn
|
||||||
.code = 0,
|
.code = 0,
|
||||||
.info = *pConn,
|
.info = *pConn,
|
||||||
};
|
};
|
||||||
|
|
||||||
rpcRsp.info.ahandle = NULL;
|
rpcRsp.info.ahandle = NULL;
|
||||||
|
|
||||||
tmsgSendRsp(&rpcRsp);
|
tmsgSendRsp(&rpcRsp);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,18 +44,24 @@ int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *re
|
||||||
QW_RET(TSDB_CODE_SUCCESS);
|
QW_RET(TSDB_CODE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void freeItem(void* param) {
|
||||||
|
SExplainExecInfo* pInfo = param;
|
||||||
|
taosMemoryFree(pInfo->verboseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
|
int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
|
||||||
qTaskInfo_t taskHandle = ctx->taskHandle;
|
qTaskInfo_t taskHandle = ctx->taskHandle;
|
||||||
|
|
||||||
if (TASK_TYPE_TEMP == ctx->taskType && taskHandle) {
|
if (TASK_TYPE_TEMP == ctx->taskType && taskHandle) {
|
||||||
if (ctx->explain) {
|
if (ctx->explain) {
|
||||||
SExplainExecInfo *execInfo = NULL;
|
SArray* execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo));
|
||||||
int32_t resNum = 0;
|
QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList));
|
||||||
QW_ERR_RET(qGetExplainExecInfo(taskHandle, &resNum, &execInfo));
|
|
||||||
|
|
||||||
SRpcHandleInfo connInfo = ctx->ctrlConnInfo;
|
SRpcHandleInfo connInfo = ctx->ctrlConnInfo;
|
||||||
connInfo.ahandle = NULL;
|
connInfo.ahandle = NULL;
|
||||||
QW_ERR_RET(qwBuildAndSendExplainRsp(&connInfo, execInfo, resNum));
|
int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList);
|
||||||
|
taosArrayDestroyEx(execInfoList, freeItem);
|
||||||
|
QW_ERR_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx->needFetch) {
|
if (!ctx->needFetch) {
|
||||||
|
|
|
@ -790,65 +790,6 @@ int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMs
|
||||||
}
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// fake match
|
|
||||||
//
|
|
||||||
// condition1:
|
|
||||||
// I have snapshot, no log, preIndex > myLastIndex
|
|
||||||
//
|
|
||||||
// condition2:
|
|
||||||
// I have snapshot, have log, log <= snapshot, preIndex > myLastIndex
|
|
||||||
//
|
|
||||||
// condition3:
|
|
||||||
// I have snapshot, preIndex < snapshot.lastApplyIndex
|
|
||||||
//
|
|
||||||
// condition4:
|
|
||||||
// I have snapshot, preIndex == snapshot.lastApplyIndex, no data
|
|
||||||
//
|
|
||||||
// operation:
|
|
||||||
// match snapshot.lastApplyIndex - 1;
|
|
||||||
// no operation on log
|
|
||||||
do {
|
|
||||||
SyncIndex myLastIndex = syncNodeGetLastIndex(ths);
|
|
||||||
SSnapshot snapshot;
|
|
||||||
ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot);
|
|
||||||
|
|
||||||
bool condition0 = (pMsg->term == ths->pRaftStore->currentTerm) && (ths->state == TAOS_SYNC_STATE_FOLLOWER) &&
|
|
||||||
syncNodeHasSnapshot(ths);
|
|
||||||
bool condition1 =
|
|
||||||
condition0 && (ths->pLogStore->syncLogEntryCount(ths->pLogStore) == 0) && (pMsg->prevLogIndex > myLastIndex); // donot use syncLogEntryCount!!! use isEmpty
|
|
||||||
bool condition2 = condition0 && (ths->pLogStore->syncLogLastIndex(ths->pLogStore) <= snapshot.lastApplyIndex) &&
|
|
||||||
(pMsg->prevLogIndex > myLastIndex);
|
|
||||||
bool condition3 = condition0 && (pMsg->prevLogIndex < snapshot.lastApplyIndex);
|
|
||||||
bool condition4 = condition0 && (pMsg->prevLogIndex == snapshot.lastApplyIndex) && (pMsg->dataLen == 0);
|
|
||||||
bool condition = condition1 || condition2 || condition3 || condition4;
|
|
||||||
|
|
||||||
if (condition) {
|
|
||||||
char logBuf[128];
|
|
||||||
snprintf(logBuf, sizeof(logBuf), "recv sync-append-entries, fake match, pre-index:%" PRId64 ", pre-term:%" PRIu64,
|
|
||||||
pMsg->prevLogIndex, pMsg->prevLogTerm);
|
|
||||||
syncNodeEventLog(ths, logBuf);
|
|
||||||
|
|
||||||
// prepare response msg
|
|
||||||
SyncAppendEntriesReply* pReply = syncAppendEntriesReplyBuild(ths->vgId);
|
|
||||||
pReply->srcId = ths->myRaftId;
|
|
||||||
pReply->destId = pMsg->srcId;
|
|
||||||
pReply->term = ths->pRaftStore->currentTerm;
|
|
||||||
pReply->privateTerm = ths->pNewNodeReceiver->privateTerm;
|
|
||||||
pReply->success = true;
|
|
||||||
pReply->matchIndex = snapshot.lastApplyIndex;
|
|
||||||
|
|
||||||
// send response
|
|
||||||
SRpcMsg rpcMsg;
|
|
||||||
syncAppendEntriesReply2RpcMsg(pReply, &rpcMsg);
|
|
||||||
syncNodeSendMsgById(&pReply->destId, ths, &rpcMsg);
|
|
||||||
syncAppendEntriesReplyDestroy(pReply);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
} while (0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// fake match
|
// fake match
|
||||||
//
|
//
|
||||||
// condition1:
|
// condition1:
|
||||||
|
|
|
@ -348,16 +348,16 @@ int sml_16384_Test() {
|
||||||
pRes = taos_query(taos, "use sml_db");
|
pRes = taos_query(taos, "use sml_db");
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
TAOS_RES *res = taos_schemaless_insert(taos, (char **)sql, 1, TSDB_SML_LINE_PROTOCOL, 0);
|
pRes = taos_schemaless_insert(taos, (char **)sql, 1, TSDB_SML_LINE_PROTOCOL, 0);
|
||||||
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
|
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
|
||||||
int code = taos_errno(pRes);
|
int code = taos_errno(pRes);
|
||||||
taos_free_result(res);
|
taos_free_result(pRes);
|
||||||
if(code) return code;
|
if(code) return code;
|
||||||
|
|
||||||
const char *sql1[] = {
|
const char *sql1[] = {
|
||||||
"qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=f,c1=127i8,c11=L\"ncharColValue\",c10=t 1626006833639000000",
|
"qelhxo,id=pnnqhsa,t0=t,t1=127i8 c0=f,c1=127i8,c11=L\"ncharColValue\",c10=t 1626006833639000000",
|
||||||
};
|
};
|
||||||
TAOS_RES *res1 = taos_schemaless_insert(taos, (char **)sql1, 1, TSDB_SML_LINE_PROTOCOL, 0);
|
pRes = taos_schemaless_insert(taos, (char **)sql1, 1, TSDB_SML_LINE_PROTOCOL, 0);
|
||||||
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
|
printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes));
|
||||||
code = taos_errno(pRes);
|
code = taos_errno(pRes);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
Loading…
Reference in New Issue