Merge remote-tracking branch 'origin/develop' into feature/vnode
This commit is contained in:
commit
5d30120ae0
|
@ -682,6 +682,7 @@ static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock
|
||||||
// query ended in current block
|
// query ended in current block
|
||||||
if (pQueryHandle->window.ekey < pBlock->keyLast || pCheckInfo->lastKey > pBlock->keyFirst) {
|
if (pQueryHandle->window.ekey < pBlock->keyLast || pCheckInfo->lastKey > pBlock->keyFirst) {
|
||||||
if (!doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo)) {
|
if (!doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo)) {
|
||||||
|
taosArrayDestroy(sa);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,6 +1502,7 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
|
||||||
pQueryHandle->window = pQueryHandle->cur.win;
|
pQueryHandle->window = pQueryHandle->cur.win;
|
||||||
pQueryHandle->cur.rows = 1;
|
pQueryHandle->cur.rows = 1;
|
||||||
pQueryHandle->type = TSDB_QUERY_TYPE_EXTERNAL;
|
pQueryHandle->type = TSDB_QUERY_TYPE_EXTERNAL;
|
||||||
|
taosArrayDestroy(sa);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
STsdbQueryHandle* pSecQueryHandle = calloc(1, sizeof(STsdbQueryHandle));
|
STsdbQueryHandle* pSecQueryHandle = calloc(1, sizeof(STsdbQueryHandle));
|
||||||
|
@ -2081,26 +2083,15 @@ bool indexedNodeFilterFp(const void* pNode, void* param) {
|
||||||
STable* pTable = *(STable**)(SL_GET_NODE_DATA((SSkipListNode*)pNode));
|
STable* pTable = *(STable**)(SL_GET_NODE_DATA((SSkipListNode*)pNode));
|
||||||
|
|
||||||
char* val = NULL;
|
char* val = NULL;
|
||||||
int8_t type = pInfo->sch.type;
|
|
||||||
|
|
||||||
if (pInfo->colIndex == TSDB_TBNAME_COLUMN_INDEX) {
|
if (pInfo->colIndex == TSDB_TBNAME_COLUMN_INDEX) {
|
||||||
val = (char*) pTable->name;
|
val = (char*) pTable->name;
|
||||||
type = TSDB_DATA_TYPE_BINARY;
|
|
||||||
} else {
|
} else {
|
||||||
val = tdGetKVRowValOfCol(pTable->tagVal, pInfo->sch.colId);
|
val = tdGetKVRowValOfCol(pTable->tagVal, pInfo->sch.colId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo :the val is possible to be null, so check it out carefully
|
//todo :the val is possible to be null, so check it out carefully
|
||||||
int32_t ret = 0;
|
int32_t ret = pInfo->compare(val, pInfo->q);
|
||||||
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
|
|
||||||
if (pInfo->optr == TSDB_RELATION_IN) {
|
|
||||||
ret = pInfo->compare(val, pInfo->q);
|
|
||||||
} else {
|
|
||||||
ret = pInfo->compare(val, pInfo->q);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ret = pInfo->compare(val, pInfo->q);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (pInfo->optr) {
|
switch (pInfo->optr) {
|
||||||
case TSDB_RELATION_EQUAL: {
|
case TSDB_RELATION_EQUAL: {
|
||||||
|
@ -2269,7 +2260,9 @@ int32_t tsdbGetOneTableGroup(TSDB_REPO_T* tsdb, uint64_t uid, STableGroupInfo* p
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbGetTableGroupFromIdList(TSDB_REPO_T* tsdb, SArray* pTableIdList, STableGroupInfo* pGroupInfo) {
|
int32_t tsdbGetTableGroupFromIdList(TSDB_REPO_T* tsdb, SArray* pTableIdList, STableGroupInfo* pGroupInfo) {
|
||||||
if (tsdbRLockRepoMeta(tsdb) < 0) goto _error;
|
if (tsdbRLockRepoMeta(tsdb) < 0) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
assert(pTableIdList != NULL);
|
assert(pTableIdList != NULL);
|
||||||
size_t size = taosArrayGetSize(pTableIdList);
|
size_t size = taosArrayGetSize(pTableIdList);
|
||||||
|
@ -2295,15 +2288,15 @@ int32_t tsdbGetTableGroupFromIdList(TSDB_REPO_T* tsdb, SArray* pTableIdList, STa
|
||||||
taosArrayPush(group, &pTable);
|
taosArrayPush(group, &pTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsdbUnlockRepoMeta(tsdb) < 0) goto _error;
|
if (tsdbUnlockRepoMeta(tsdb) < 0) {
|
||||||
|
taosArrayDestroy(group);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
pGroupInfo->numOfTables = i;
|
pGroupInfo->numOfTables = i;
|
||||||
taosArrayPush(pGroupInfo->pGroupList, &group);
|
taosArrayPush(pGroupInfo->pGroupList, &group);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
_error:
|
|
||||||
return terrno;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
|
void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
|
||||||
|
|
|
@ -374,3 +374,34 @@ int32_t getTimestampInUsFromStr(char* token, int32_t tokenlen, int64_t* ts) {
|
||||||
|
|
||||||
return getTimestampInUsFromStrImpl(timestamp, token[tokenlen - 1], ts);
|
return getTimestampInUsFromStrImpl(timestamp, token[tokenlen - 1], ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// internal function, when program is paused in debugger,
|
||||||
|
// one can call this function from debugger to print a
|
||||||
|
// timestamp as human readable string, for example (gdb):
|
||||||
|
// p fmtts(1593769722)
|
||||||
|
// outputs:
|
||||||
|
// 2020-07-03 17:48:42
|
||||||
|
// and the parameter can also be a variable.
|
||||||
|
const char* fmtts(int64_t ts) {
|
||||||
|
static char buf[32];
|
||||||
|
|
||||||
|
time_t tt;
|
||||||
|
if (ts > -62135625943 && ts < 32503651200) {
|
||||||
|
tt = ts;
|
||||||
|
} else if (ts > -62135625943000 && ts < 32503651200000) {
|
||||||
|
tt = ts / 1000;
|
||||||
|
} else {
|
||||||
|
tt = ts / 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tm* ptm = localtime(&tt);
|
||||||
|
size_t pos = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", ptm);
|
||||||
|
|
||||||
|
if (ts <= -62135625943000 || ts >= 32503651200000) {
|
||||||
|
sprintf(buf + pos, ".%06d", (int)(ts % 1000000));
|
||||||
|
} else if (ts <= -62135625943 || ts >= 32503651200) {
|
||||||
|
sprintf(buf + pos, ".%03d", (int)(ts % 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
|
@ -101,6 +101,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
|
||||||
|
|
||||||
pRet->len = sizeof(SQueryTableRsp);
|
pRet->len = sizeof(SQueryTableRsp);
|
||||||
pRet->rsp = pRsp;
|
pRet->rsp = pRsp;
|
||||||
|
int32_t vgId = pVnode->vgId;
|
||||||
|
|
||||||
// current connect is broken
|
// current connect is broken
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
@ -125,7 +126,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
|
||||||
vnodeRelease(pVnode);
|
vnodeRelease(pVnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
vDebug("vgId:%d, QInfo:%p, dnode query msg disposed", pVnode->vgId, pQInfo);
|
vDebug("vgId:%d, QInfo:%p, dnode query msg disposed", vgId, pQInfo);
|
||||||
} else {
|
} else {
|
||||||
assert(pCont != NULL);
|
assert(pCont != NULL);
|
||||||
pQInfo = *(void**)(pCont);
|
pQInfo = *(void**)(pCont);
|
||||||
|
|
Loading…
Reference in New Issue