diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index eb3038a152b2894423d3194ec37a3b9a7b31b2ad..78b038ab19815a7e00f9e30bc0a98e8b792af7b7 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -964,9 +964,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pQueryMsg->numOfGroupCols = htons(pQueryInfo->groupbyExpr.numOfGroupCols); pQueryMsg->queryType = htonl(pQueryInfo->type); pQueryMsg->prevResultLen = htonl(pQueryInfo->bufLen); - - pQueryMsg->schemaVersion = htons(pTableMeta->sversion); - pQueryMsg->tagVersion = htons(pTableMeta->tversion); + // set column list ids size_t numOfCols = taosArrayGetSize(pQueryInfo->colList); char *pMsg = (char *)(pQueryMsg->tableCols) + numOfCols * sizeof(SColumnInfo); @@ -1152,21 +1150,21 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pMsg += sqlLen; -/* - //MSG EXTEND DEMO + pQueryMsg->extend = 1; STLV *tlv = (STLV *)pMsg; - tlv->type = htons(TLV_TYPE_DUMMY); - tlv->len = htonl(sizeof(int16_t)); - *(int16_t *)tlv->value = htons(12345); + tlv->type = htons(TLV_TYPE_META_VERSION); + tlv->len = htonl(sizeof(int16_t) * 2); + *(int16_t*)tlv->value = htons(pTableMeta->sversion); + *(int16_t*)(tlv->value+sizeof(int16_t)) = htons(pTableMeta->tversion); pMsg += sizeof(*tlv) + ntohl(tlv->len); tlv = (STLV *)pMsg; + tlv->type = htons(TLV_TYPE_END_MARK); tlv->len = 0; pMsg += sizeof(*tlv); -*/ int32_t msgLen = (int32_t)(pMsg - pCmd->payload); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index bd173494430b84bf703d3df6ec24e991a56b35f4..26ce551e397fccfe6eb378aa0de2de771dfae10f 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -523,8 +523,6 @@ typedef struct { int32_t udfNum; // number of udf function int32_t udfContentOffset; int32_t udfContentLen; - int16_t schemaVersion; - int16_t tagVersion; SColumnInfo tableCols[]; } SQueryTableMsg; diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index f399cbc7e12bd7f54b34bb03e792f8b9023870ec..0b938078e39e8a61d3c2d871192717fdc4dc82e7 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -428,6 +428,8 @@ typedef struct SQueryParam { int32_t tableScanOperator; SArray *pOperator; SUdfInfo *pUdfInfo; + int16_t schemaVersion; + int16_t tagVersion; } SQueryParam; typedef struct SColumnDataParam{ diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 310c82ad04e6ee0e41a93b12f8e23c26d7692259..69076045befc08988855625a3aaa725b77dfe670 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -8264,10 +8264,6 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { goto _cleanup; } - - -/* - //MSG EXTEND DEMO if (pQueryMsg->extend) { pMsg += pQueryMsg->sqlstrLen; @@ -8276,19 +8272,24 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { tlv = (STLV *)pMsg; tlv->type = ntohs(tlv->type); tlv->len = ntohl(tlv->len); - if (tlv->len > 0) { - *(int16_t *)tlv->value = ntohs(*(int16_t *)tlv->value); - qDebug("Got TLV,type:%d,len:%d,value:%d", tlv->type, tlv->len, *(int16_t*)tlv->value); - pMsg += sizeof(*tlv) + tlv->len; - continue; + if (tlv->type == TLV_TYPE_END_MARK) { + break; + } + switch(tlv->type) { + case TLV_TYPE_META_VERSION: { + assert(tlv->len == 2*sizeof(int16_t)); + param->schemaVersion = ntohs(*(int16_t*)tlv->value); + param->tagVersion = ntohs(*(int16_t*)(tlv->value + sizeof(int16_t))); + pMsg += sizeof(*tlv) + tlv->len; + break; + } + default: { + pMsg += sizeof(*tlv) + tlv->len; + break; + } } - - break; } } - -*/ - qDebug("qmsg:%p query %d tables, type:%d, qrange:%" PRId64 "-%" PRId64 ", numOfGroupbyTagCols:%d, order:%d, " "outputCols:%d, numOfCols:%d, interval:%" PRId64 ", fillType:%d, comptsLen:%d, compNumOfBlocks:%d, limit:%" PRId64 ", offset:%" PRId64, diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index adf688feba4e45b08ae5e13805eae3962006ccb1..abbce6d3cf2bc918300356d251c69c774667bac2 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -162,8 +162,8 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi assert(0); } - int16_t queryTagVersion = ntohs(pQueryMsg->tagVersion); - int16_t querySchemaVersion = ntohs(pQueryMsg->schemaVersion); + int16_t queryTagVersion = param.tagVersion; + int16_t querySchemaVersion = param.schemaVersion; if (queryTagVersion < tableGroupInfo.tVersion || querySchemaVersion < tableGroupInfo.sVersion) { code = TSDB_CODE_QRY_INVALID_SCHEMA_VERSION; goto _over;