fix invalid copy
This commit is contained in:
parent
5dd4d05b2e
commit
796ff03eb5
|
@ -20,13 +20,13 @@
|
|||
#include "taoserror.h"
|
||||
#include "tarray.h"
|
||||
#include "tcoding.h"
|
||||
#include "tcol.h"
|
||||
#include "tencode.h"
|
||||
#include "thash.h"
|
||||
#include "tlist.h"
|
||||
#include "tname.h"
|
||||
#include "trow.h"
|
||||
#include "tuuid.h"
|
||||
#include "tcol.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -555,7 +555,7 @@ struct SSchemaExt {
|
|||
|
||||
#define COMPRESS_L1_TYPE_U32(type) (((type) >> 24) & 0xFF)
|
||||
#define COMPRESS_L2_TYPE_U32(type) (((type) >> 8) & 0xFFFF)
|
||||
#define COMPRESS_L2_TYPE_LEVEL_U32(type) ((type) & 0xFF)
|
||||
#define COMPRESS_L2_TYPE_LEVEL_U32(type) ((type)&0xFF)
|
||||
|
||||
// compress flag
|
||||
// |----l2lel--|----l2Alg---|---l1Alg--|
|
||||
|
@ -772,14 +772,14 @@ static FORCE_INLINE int32_t tDecodeSSchema(SDecoder* pDecoder, SSchema* pSchema)
|
|||
}
|
||||
|
||||
static FORCE_INLINE int32_t tEncodeSSchemaExt(SEncoder* pEncoder, const SSchemaExt* pSchemaExt) {
|
||||
// if (tEncodeI16v(pEncoder, pSchemaExt->colId) < 0) return -1;
|
||||
// if (tEncodeU32(pEncoder, pSchemaExt->compress) < 0) return -1;
|
||||
if (tEncodeI16v(pEncoder, pSchemaExt->colId) < 0) return -1;
|
||||
if (tEncodeU32(pEncoder, pSchemaExt->compress) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tDecodeSSchemaExt(SDecoder* pDecoder, SSchemaExt* pSchemaExt) {
|
||||
// if (tDecodeI16v(pDecoder, &pSchemaExt->colId) < 0) return -1;
|
||||
// if (tDecodeU32(pDecoder, &pSchemaExt->compress) < 0) return -1;
|
||||
if (tDecodeI16v(pDecoder, &pSchemaExt->colId) < 0) return -1;
|
||||
if (tDecodeU32(pDecoder, &pSchemaExt->compress) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4133,8 +4133,8 @@ int32_t tSerializeSViewMetaRsp(void* buf, int32_t bufLen, const SViewMetaRsp* pR
|
|||
int32_t tDeserializeSViewMetaRsp(void* buf, int32_t bufLen, SViewMetaRsp* pRsp);
|
||||
void tFreeSViewMetaRsp(SViewMetaRsp* pRsp);
|
||||
|
||||
void setDefaultOptionsForField(SFieldWithOptions *field);
|
||||
void setFieldWithOptions(SFieldWithOptions *fieldWithOptions, SField* field);
|
||||
void setDefaultOptionsForField(SFieldWithOptions* field);
|
||||
void setFieldWithOptions(SFieldWithOptions* fieldWithOptions, SField* field);
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -4433,10 +4433,12 @@ static int32_t tEncodeSTableMetaRsp(SEncoder *pEncoder, STableMetaRsp *pRsp) {
|
|||
if (tEncodeSSchema(pEncoder, pSchema) < 0) return -1;
|
||||
}
|
||||
|
||||
if (pRsp->tableType == TSDB_SUPER_TABLE || pRsp->tableType == TSDB_NORMAL_TABLE) {
|
||||
for (int32_t i = 0; i < pRsp->numOfColumns; ++i) {
|
||||
SSchemaExt *pSchemaExt = &pRsp->pSchemaExt[i];
|
||||
if (tEncodeSSchemaExt(pEncoder, pSchemaExt) < 0) return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -4470,6 +4472,8 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) {
|
|||
}
|
||||
|
||||
// if (tDecodeIsEnd(pDecoder)) return 0;
|
||||
if (!tDecodeIsEnd(pDecoder)) {
|
||||
if (pRsp->tableType == TSDB_SUPER_TABLE || pRsp->tableType == TSDB_NORMAL_TABLE) {
|
||||
if (pRsp->numOfColumns > 0) {
|
||||
pRsp->pSchemaExt = taosMemoryMalloc(sizeof(SSchemaExt) * pRsp->numOfColumns);
|
||||
if (pRsp->pSchemaExt == NULL) return -1;
|
||||
|
@ -4483,6 +4487,10 @@ static int32_t tDecodeSTableMetaRsp(SDecoder *pDecoder, STableMetaRsp *pRsp) {
|
|||
} else {
|
||||
pRsp->pSchemaExt = NULL;
|
||||
}
|
||||
} else {
|
||||
pRsp->pSchemaExt = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1939,6 +1939,12 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa
|
|||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
pRsp->pSchemaExt = taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchemaExt));
|
||||
if (pRsp->pSchemaExt == NULL) {
|
||||
taosRUnLockLatch(&pStb->lock);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
tstrncpy(pRsp->dbFName, pStb->db, sizeof(pRsp->dbFName));
|
||||
tstrncpy(pRsp->tbName, tbName, sizeof(pRsp->tbName));
|
||||
|
@ -1972,6 +1978,12 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa
|
|||
pSchema->colId = pSrcSchema->colId;
|
||||
pSchema->bytes = pSrcSchema->bytes;
|
||||
}
|
||||
for (int32_t i = 0; i < pStb->numOfColumns; i++) {
|
||||
SCmprObj *pCmpr = &pStb->pCmpr[i];
|
||||
SSchemaExt *pSchEx = &pRsp->pSchemaExt[i];
|
||||
pSchEx->colId = pCmpr->colId;
|
||||
pSchEx->compress = pCmpr->cmprAlg;
|
||||
}
|
||||
|
||||
taosRUnLockLatch(&pStb->lock);
|
||||
return 0;
|
||||
|
@ -2028,6 +2040,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName,
|
|||
pRsp->pFuncs = taosArrayDup(pStb->pFuncs, NULL);
|
||||
}
|
||||
|
||||
|
||||
taosRUnLockLatch(&pStb->lock);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
|
|||
case TSDB_CODE_PAR_CANNOT_DROP_PRIMARY_KEY:
|
||||
return "Primary timestamp column cannot be dropped";
|
||||
case TSDB_CODE_PAR_INVALID_MODIFY_COL:
|
||||
return "Only varbinary/binary/nchar/geometry column length could be modified, and the length can only be increased, not decreased";
|
||||
return "Only varbinary/binary/nchar/geometry column length could be modified, and the length can only be "
|
||||
"increased, not decreased";
|
||||
case TSDB_CODE_PAR_INVALID_TBNAME:
|
||||
return "Invalid tbname pseudo column";
|
||||
case TSDB_CODE_PAR_INVALID_FUNCTION_NAME:
|
||||
|
@ -265,14 +266,14 @@ int32_t getNumOfTags(const STableMeta* pTableMeta) { return getTableInfo(pTableM
|
|||
|
||||
STableComInfo getTableInfo(const STableMeta* pTableMeta) { return pTableMeta->tableInfo; }
|
||||
|
||||
int32_t getTableTypeFromTableNode(SNode *pTable) {
|
||||
int32_t getTableTypeFromTableNode(SNode* pTable) {
|
||||
if (NULL == pTable) {
|
||||
return -1;
|
||||
}
|
||||
if (QUERY_NODE_REAL_TABLE != nodeType(pTable)) {
|
||||
return -1;
|
||||
}
|
||||
return ((SRealTableNode *)pTable)->pMeta->tableType;
|
||||
return ((SRealTableNode*)pTable)->pMeta->tableType;
|
||||
}
|
||||
|
||||
STableMeta* tableMetaDup(const STableMeta* pTableMeta) {
|
||||
|
@ -713,7 +714,6 @@ int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalog
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
SNode* createSelectStmtImpl(bool isDistinct, SNodeList* pProjectionList, SNode* pTable, SNodeList* pHint) {
|
||||
SSelectStmt* select = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT);
|
||||
if (NULL == select) {
|
||||
|
@ -948,7 +948,6 @@ int32_t getViewMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, ST
|
|||
return code;
|
||||
}
|
||||
|
||||
|
||||
static int32_t reserveDbReqInCache(int32_t acctId, const char* pDb, SHashObj** pDbs) {
|
||||
if (NULL == *pDbs) {
|
||||
*pDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
|
@ -1044,15 +1043,13 @@ int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pD
|
|||
return reserveUserAuthInCacheImpl(key, len, pMetaCache);
|
||||
}
|
||||
|
||||
int32_t reserveViewUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type,
|
||||
SParseMetaCache* pMetaCache) {
|
||||
int32_t reserveViewUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable,
|
||||
AUTH_TYPE type, SParseMetaCache* pMetaCache) {
|
||||
char key[USER_AUTH_KEY_MAX_LEN] = {0};
|
||||
int32_t len = userAuthToString(acctId, pUser, pDb, pTable, type, key, true);
|
||||
return reserveUserAuthInCacheImpl(key, len, pMetaCache);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, SUserAuthInfo* pAuthReq, SUserAuthRes* pAuthRes) {
|
||||
char key[USER_AUTH_KEY_MAX_LEN] = {0};
|
||||
int32_t len = userAuthToString(pAuthReq->tbName.acctId, pAuthReq->user, pAuthReq->tbName.dbname,
|
||||
|
@ -1228,5 +1225,3 @@ int64_t int64SafeSub(int64_t a, int64_t b) {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ int32_t queryBuildUseDbOutput(SUseDbOutput *pOut, SUseDbRsp *usedbRsp) {
|
|||
pOut->dbVgroup->hashSuffix = usedbRsp->hashSuffix;
|
||||
pOut->dbVgroup->stateTs = usedbRsp->stateTs;
|
||||
|
||||
qDebug("Got %d vgroup for db %s, vgVersion:%d, stateTs:%" PRId64, usedbRsp->vgNum, usedbRsp->db, usedbRsp->vgVersion, usedbRsp->stateTs);
|
||||
qDebug("Got %d vgroup for db %s, vgVersion:%d, stateTs:%" PRId64, usedbRsp->vgNum, usedbRsp->db, usedbRsp->vgVersion,
|
||||
usedbRsp->stateTs);
|
||||
|
||||
if (usedbRsp->vgNum <= 0) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -408,7 +409,7 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta *
|
|||
qError("calloc size[%d] failed", metaSize);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
SSchemaExt* pSchemaExt = (SSchemaExt*)((char*)pTableMeta + metaSize);
|
||||
SSchemaExt *pSchemaExt = (SSchemaExt *)((char *)pTableMeta + metaSize);
|
||||
|
||||
pTableMeta->vgId = isStb ? 0 : msg->vgId;
|
||||
pTableMeta->tableType = isStb ? TSDB_SUPER_TABLE : msg->tableType;
|
||||
|
@ -421,15 +422,18 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta *
|
|||
pTableMeta->tableInfo.precision = msg->precision;
|
||||
pTableMeta->tableInfo.numOfColumns = msg->numOfColumns;
|
||||
|
||||
if (pTableMeta->tableType == TSDB_SUPER_TABLE || pTableMeta->tableType == TSDB_NORMAL_TABLE) {
|
||||
pTableMeta->schemaExt = pSchemaExt;
|
||||
memcpy(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total);
|
||||
memcpy(pSchemaExt, msg->pSchemaExt, schemaExtSize);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < msg->numOfColumns; ++i) {
|
||||
pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes;
|
||||
}
|
||||
|
||||
qDebug("table %s uid %" PRIx64 " meta returned, type %d vgId:%d db %s stb %s suid %" PRIx64 " sver %d tver %d"
|
||||
qDebug("table %s uid %" PRIx64 " meta returned, type %d vgId:%d db %s stb %s suid %" PRIx64
|
||||
" sver %d tver %d"
|
||||
" tagNum %d colNum %d precision %d rowSize %d",
|
||||
msg->tbName, pTableMeta->uid, pTableMeta->tableType, pTableMeta->vgId, msg->dbFName, msg->stbName,
|
||||
pTableMeta->suid, pTableMeta->sversion, pTableMeta->tversion, pTableMeta->tableInfo.numOfTags,
|
||||
|
@ -679,7 +683,6 @@ int32_t queryProcessGetViewMetaRsp(void *output, char *msg, int32_t msgSize) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void initQueryModuleMsgHandle() {
|
||||
queryBuildMsg[TMSG_INDEX(TDMT_VND_TABLE_META)] = queryBuildTableMetaReqMsg;
|
||||
queryBuildMsg[TMSG_INDEX(TDMT_MND_TABLE_META)] = queryBuildTableMetaReqMsg;
|
||||
|
|
Loading…
Reference in New Issue