support order for super table projection query. #1166. [tbase-1477]
This commit is contained in:
parent
29df3ea39b
commit
f726178075
|
@ -1174,10 +1174,18 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
|
||||||
|
|
||||||
if (numOfRows > 0) {
|
if (numOfRows > 0) {
|
||||||
assert(pRes->numOfRows == numOfRows);
|
assert(pRes->numOfRows == numOfRows);
|
||||||
atomic_add_fetch_64(&pState->numOfRetrievedRows, numOfRows);
|
int64_t num = atomic_add_fetch_64(&pState->numOfRetrievedRows, numOfRows);
|
||||||
|
|
||||||
tscTrace("%p sub:%p retrieve numOfRows:%d totalNumOfRows:%d from ip:%u,vid:%d,orderOfSub:%d", pPObj, pSql,
|
tscTrace("%p sub:%p retrieve numOfRows:%d totalNumOfRows:%d from ip:%u,vid:%d,orderOfSub:%d", pPObj, pSql,
|
||||||
pRes->numOfRows, pState->numOfRetrievedRows, pSvd->ip, pSvd->vnode, idx);
|
pRes->numOfRows, pState->numOfRetrievedRows, pSvd->ip, pSvd->vnode, idx);
|
||||||
|
|
||||||
|
if (num > tsMaxNumOfOrderedResults) {
|
||||||
|
tscError("%p sub:%p num of OrderedRes is too many, max allowed:%" PRId64 " , current:%" PRId64,
|
||||||
|
pPObj, pSql, tsMaxNumOfOrderedResults, num);
|
||||||
|
tscAbortFurtherRetryRetrieval(trsupport, tres, TSDB_CODE_SORTED_RES_TOO_MANY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG_VIEW
|
#ifdef _DEBUG_VIEW
|
||||||
printf("received data from vnode: %d rows\n", pRes->numOfRows);
|
printf("received data from vnode: %d rows\n", pRes->numOfRows);
|
||||||
|
@ -1213,12 +1221,11 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
|
||||||
#ifdef _DEBUG_VIEW
|
#ifdef _DEBUG_VIEW
|
||||||
printf("%" PRIu64 " rows data flushed to disk:\n", trsupport->localBuffer->numOfElems);
|
printf("%" PRIu64 " rows data flushed to disk:\n", trsupport->localBuffer->numOfElems);
|
||||||
SSrcColumnInfo colInfo[256] = {0};
|
SSrcColumnInfo colInfo[256] = {0};
|
||||||
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(&pPObj->cmd, 0);
|
|
||||||
|
|
||||||
tscGetSrcColumnInfo(colInfo, pQueryInfo);
|
tscGetSrcColumnInfo(colInfo, pQueryInfo);
|
||||||
tColModelDisplayEx(pDesc->pSchema, trsupport->localBuffer->data, trsupport->localBuffer->numOfElems,
|
tColModelDisplayEx(pDesc->pSchema, trsupport->localBuffer->data, trsupport->localBuffer->numOfElems,
|
||||||
trsupport->localBuffer->numOfElems, colInfo);
|
trsupport->localBuffer->numOfElems, colInfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (tsTotalTmpDirGB != 0 && tsAvailTmpDirGB < tsMinimalTmpDirGB) {
|
if (tsTotalTmpDirGB != 0 && tsAvailTmpDirGB < tsMinimalTmpDirGB) {
|
||||||
tscError("%p sub:%p client disk space remain %.3f GB, need at least %.3f GB, stop query", pPObj, pSql,
|
tscError("%p sub:%p client disk space remain %.3f GB, need at least %.3f GB, stop query", pPObj, pSql,
|
||||||
tsAvailTmpDirGB, tsMinimalTmpDirGB);
|
tsAvailTmpDirGB, tsMinimalTmpDirGB);
|
||||||
|
@ -1251,7 +1258,7 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
|
||||||
|
|
||||||
tscTrace("%p retrieve from %d vnodes completed.final NumOfRows:%d,start to build loser tree", pPObj,
|
tscTrace("%p retrieve from %d vnodes completed.final NumOfRows:%d,start to build loser tree", pPObj,
|
||||||
pState->numOfTotal, pState->numOfRetrievedRows);
|
pState->numOfTotal, pState->numOfRetrievedRows);
|
||||||
|
|
||||||
SQueryInfo *pPQueryInfo = tscGetQueryInfoDetail(&pPObj->cmd, 0);
|
SQueryInfo *pPQueryInfo = tscGetQueryInfoDetail(&pPObj->cmd, 0);
|
||||||
tscClearInterpInfo(pPQueryInfo);
|
tscClearInterpInfo(pPQueryInfo);
|
||||||
|
|
||||||
|
@ -1674,6 +1681,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
pQueryMsg->nAggTimeInterval = htobe64(pQueryInfo->nAggTimeInterval);
|
pQueryMsg->nAggTimeInterval = htobe64(pQueryInfo->nAggTimeInterval);
|
||||||
pQueryMsg->intervalTimeUnit = pQueryInfo->intervalTimeUnit;
|
pQueryMsg->intervalTimeUnit = pQueryInfo->intervalTimeUnit;
|
||||||
|
pQueryMsg->slidingTime = htobe64(pQueryInfo->nSlidingTime);
|
||||||
|
|
||||||
if (pQueryInfo->nAggTimeInterval < 0) {
|
if (pQueryInfo->nAggTimeInterval < 0) {
|
||||||
tscError("%p illegal value of aggregation time interval in query msg: %ld", pSql, pQueryInfo->nAggTimeInterval);
|
tscError("%p illegal value of aggregation time interval in query msg: %ld", pSql, pQueryInfo->nAggTimeInterval);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -125,7 +125,7 @@ extern "C" {
|
||||||
#define TSDB_CODE_BATCH_SIZE_TOO_BIG 104
|
#define TSDB_CODE_BATCH_SIZE_TOO_BIG 104
|
||||||
#define TSDB_CODE_TIMESTAMP_OUT_OF_RANGE 105
|
#define TSDB_CODE_TIMESTAMP_OUT_OF_RANGE 105
|
||||||
#define TSDB_CODE_INVALID_QUERY_MSG 106 // failed to validate the sql expression msg by vnode
|
#define TSDB_CODE_INVALID_QUERY_MSG 106 // failed to validate the sql expression msg by vnode
|
||||||
#define TSDB_CODE_CACHE_BLOCK_TS_DISORDERED 107 // time stamp in cache block is disordered
|
#define TSDB_CODE_SORTED_RES_TOO_MANY 107 // too many result for ordered super table projection query
|
||||||
#define TSDB_CODE_FILE_BLOCK_TS_DISORDERED 108 // time stamp in file block is disordered
|
#define TSDB_CODE_FILE_BLOCK_TS_DISORDERED 108 // time stamp in file block is disordered
|
||||||
#define TSDB_CODE_INVALID_COMMIT_LOG 109 // commit log init failed
|
#define TSDB_CODE_INVALID_COMMIT_LOG 109 // commit log init failed
|
||||||
#define TSDB_CODE_SERV_NO_DISKSPACE 110
|
#define TSDB_CODE_SERV_NO_DISKSPACE 110
|
||||||
|
@ -137,7 +137,7 @@ extern "C" {
|
||||||
#define TSDB_CODE_INVALID_VNODE_STATUS 116
|
#define TSDB_CODE_INVALID_VNODE_STATUS 116
|
||||||
#define TSDB_CODE_FAILED_TO_LOCK_RESOURCES 117
|
#define TSDB_CODE_FAILED_TO_LOCK_RESOURCES 117
|
||||||
#define TSDB_CODE_TABLE_ID_MISMATCH 118
|
#define TSDB_CODE_TABLE_ID_MISMATCH 118
|
||||||
#define TSDB_CODE_QUERY_CACHE_ERASED 119
|
#define TSDB_CODE_QUERY_CACHE_ERASED 119
|
||||||
|
|
||||||
#define TSDB_CODE_MAX_ERROR_CODE 120
|
#define TSDB_CODE_MAX_ERROR_CODE 120
|
||||||
|
|
||||||
|
|
|
@ -514,7 +514,8 @@ typedef struct {
|
||||||
char intervalTimeUnit; // time interval type, for revisement of interval(1d)
|
char intervalTimeUnit; // time interval type, for revisement of interval(1d)
|
||||||
|
|
||||||
int64_t nAggTimeInterval; // time interval for aggregation, in million second
|
int64_t nAggTimeInterval; // time interval for aggregation, in million second
|
||||||
|
int64_t slidingTime; // value for sliding window
|
||||||
|
|
||||||
// tag schema, used to parse tag information in pSidExtInfo
|
// tag schema, used to parse tag information in pSidExtInfo
|
||||||
uint64_t pTagSchema;
|
uint64_t pTagSchema;
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ extern int tsEnableMonitorModule;
|
||||||
extern int tsRestRowLimit;
|
extern int tsRestRowLimit;
|
||||||
extern int tsCompressMsgSize;
|
extern int tsCompressMsgSize;
|
||||||
extern int tsMaxSQLStringLen;
|
extern int tsMaxSQLStringLen;
|
||||||
|
extern int tsMaxNumOfOrderedResults;
|
||||||
|
|
||||||
extern char tsSocketType[4];
|
extern char tsSocketType[4];
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ char *tsError[] = {"success",
|
||||||
"batch size too big",
|
"batch size too big",
|
||||||
"timestamp out of range", //105
|
"timestamp out of range", //105
|
||||||
"invalid query message",
|
"invalid query message",
|
||||||
"timestamp disordered in cache block",
|
"too many results from vnodes for sort",
|
||||||
"timestamp disordered in file block",
|
"timestamp disordered in file block",
|
||||||
"invalid commit log",
|
"invalid commit log",
|
||||||
"no disk space on server", //110
|
"no disk space on server", //110
|
||||||
|
|
|
@ -124,6 +124,10 @@ int tsEnableMonitorModule = 1;
|
||||||
int tsRestRowLimit = 10240;
|
int tsRestRowLimit = 10240;
|
||||||
int tsMaxSQLStringLen = TSDB_MAX_SQL_LEN;
|
int tsMaxSQLStringLen = TSDB_MAX_SQL_LEN;
|
||||||
|
|
||||||
|
// the maximum number of results for projection query on super table that are returned from
|
||||||
|
// one virtual node, to order according to timestamp
|
||||||
|
int tsMaxNumOfOrderedResults = 100000;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* denote if the server needs to compress response message at the application layer to client, including query rsp,
|
* denote if the server needs to compress response message at the application layer to client, including query rsp,
|
||||||
* metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server.
|
* metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server.
|
||||||
|
@ -672,6 +676,10 @@ static void doInitGlobalConfig() {
|
||||||
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW,
|
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW,
|
||||||
TSDB_MAX_SQL_LEN, TSDB_MAX_ALLOWED_SQL_LEN, 0, TSDB_CFG_UTYPE_BYTE);
|
TSDB_MAX_SQL_LEN, TSDB_MAX_ALLOWED_SQL_LEN, 0, TSDB_CFG_UTYPE_BYTE);
|
||||||
|
|
||||||
|
tsInitConfigOption(cfg++, "maxNumOfOrderedRes", &tsMaxNumOfOrderedResults, TSDB_CFG_VTYPE_INT,
|
||||||
|
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW,
|
||||||
|
TSDB_MAX_SQL_LEN, TSDB_MAX_ALLOWED_SQL_LEN, 0, TSDB_CFG_UTYPE_NONE);
|
||||||
|
|
||||||
// locale & charset
|
// locale & charset
|
||||||
tsInitConfigOption(cfg++, "timezone", tsTimezone, TSDB_CFG_VTYPE_STRING,
|
tsInitConfigOption(cfg++, "timezone", tsTimezone, TSDB_CFG_VTYPE_STRING,
|
||||||
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT,
|
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT,
|
||||||
|
|
Loading…
Reference in New Issue