提交 bbafe35f 编写于 作者: S shenglian zhou

(query,insert,other)figure out data len in retrieve rsp to set start of tlv

上级 67c04baf
......@@ -2806,10 +2806,19 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
tscDebug("0x%"PRIx64" numOfRows:%d, offset:%" PRId64 ", complete:%d, qId:0x%"PRIx64, pSql->self, pRes->numOfRows, pRes->offset,
pRes->completed, pRes->qId);
int32_t numOfCols = pQueryInfo->fieldsInfo.numOfOutput;
int32_t rowBytes = 0;
for (int i = 0; i < numOfCols; ++i) {
SInternalField* internalField = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, i);
rowBytes += internalField->field.bytes;
}
int32_t origSize = rowBytes * pRes->numOfRows;
int32_t compSize = htonl(pRetrieve->compLen) + numOfCols * sizeof(int32_t);
int32_t dataLen = (pRetrieve->compressed) ? compSize : origSize;
if (pRetrieve->extend == 1) {
STLV* tlv = (STLV*)(pRetrieve->data + ntohl(pRetrieve->compLen));
STLV* tlv = (STLV*)(pRetrieve->data + dataLen);
while (tlv->type != TLV_TYPE_END_MARK) {
switch (tlv->type) {
switch (ntohs(tlv->type)) {
case TLV_TYPE_META_VERSION:
pRes->sVersion = ntohl(*(int32_t*)tlv->value);
pRes->tVersion = ntohl(*(int32_t*)(tlv->value + sizeof(int32_t)));
......
......@@ -421,10 +421,12 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
RESET_NUM_OF_RESULTS(&(pQInfo->runtimeEnv));
pQInfo->lastRetrieveTs = taosGetTimestampMs();
if ((*pRsp)->compressed && compLen != 0) {
int32_t numOfCols = pQueryAttr->pExpr2 ? pQueryAttr->numOfExpr2 : pQueryAttr->numOfOutput;
int32_t origSize = pQueryAttr->resultRowSize * s;
int32_t compSize = compLen + numOfCols * sizeof(int32_t);
int32_t dataLen = origSize;
if ((*pRsp)->compressed && compLen != 0) {
dataLen = compSize;
*contLen = *contLen - origSize + compSize;
*pRsp = (SRetrieveTableRsp *)rpcReallocCont(*pRsp, *contLen);
qDebug("QInfo:0x%"PRIx64" compress col data, uncompressed size:%d, compressed size:%d, ratio:%.2f",
......@@ -446,7 +448,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
(*pRsp)->extend = 1;
STLV* tlv = (STLV*)((*pRsp)->data + compLen);
STLV* tlv = (STLV*)((*pRsp)->data + dataLen);
tlv->type = htons(TLV_TYPE_META_VERSION);
tlv->len = htonl(sizeof(int32_t) + sizeof(int32_t));
int32_t sVersion = htonl(pQueryAttr->tableGroupInfo.sVersion);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册