fix TD-29562
This commit is contained in:
parent
e7f967df75
commit
3f4fa8b74e
|
@ -109,7 +109,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
|||
if (pMeta->pTagIvtIdx == NULL || pCtbEntry == NULL) {
|
||||
return -1;
|
||||
}
|
||||
void * data = pCtbEntry->ctbEntry.pTags;
|
||||
void *data = pCtbEntry->ctbEntry.pTags;
|
||||
const char *tagName = pSchema->name;
|
||||
|
||||
tb_uid_t suid = pCtbEntry->ctbEntry.suid;
|
||||
|
@ -128,7 +128,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
|||
STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i);
|
||||
char type = pTagVal->type;
|
||||
|
||||
char * key = pTagVal->pKey;
|
||||
char *key = pTagVal->pKey;
|
||||
int32_t nKey = strlen(key);
|
||||
|
||||
SIndexTerm *term = NULL;
|
||||
|
@ -136,7 +136,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
|||
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0);
|
||||
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
||||
if (pTagVal->nData > 0) {
|
||||
char * val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||
memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE);
|
||||
type = TSDB_DATA_TYPE_VARCHAR;
|
||||
|
@ -170,7 +170,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
if (pMeta->pTagIvtIdx == NULL || pCtbEntry == NULL) {
|
||||
return -1;
|
||||
}
|
||||
void * data = pCtbEntry->ctbEntry.pTags;
|
||||
void *data = pCtbEntry->ctbEntry.pTags;
|
||||
const char *tagName = pSchema->name;
|
||||
|
||||
tb_uid_t suid = pCtbEntry->ctbEntry.suid;
|
||||
|
@ -189,7 +189,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i);
|
||||
char type = pTagVal->type;
|
||||
|
||||
char * key = pTagVal->pKey;
|
||||
char *key = pTagVal->pKey;
|
||||
int32_t nKey = strlen(key);
|
||||
|
||||
SIndexTerm *term = NULL;
|
||||
|
@ -197,7 +197,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
|||
term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0);
|
||||
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
||||
if (pTagVal->nData > 0) {
|
||||
char * val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||
memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE);
|
||||
type = TSDB_DATA_TYPE_VARCHAR;
|
||||
|
@ -244,9 +244,9 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
int vLen = 0;
|
||||
const void *pKey = NULL;
|
||||
const void *pVal = NULL;
|
||||
void * pBuf = NULL;
|
||||
void *pBuf = NULL;
|
||||
int32_t szBuf = 0;
|
||||
void * p = NULL;
|
||||
void *p = NULL;
|
||||
|
||||
// validate req
|
||||
void *pData = NULL;
|
||||
|
@ -385,7 +385,7 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
|
|||
int c = 0;
|
||||
void *pKey = NULL;
|
||||
int nKey = 0;
|
||||
TBC * pCtbIdxc = NULL;
|
||||
TBC *pCtbIdxc = NULL;
|
||||
|
||||
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
|
||||
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
|
||||
|
@ -416,8 +416,8 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
|
|||
int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||
SMetaEntry oStbEntry = {0};
|
||||
SMetaEntry nStbEntry = {0};
|
||||
TBC * pUidIdxc = NULL;
|
||||
TBC * pTbDbc = NULL;
|
||||
TBC *pUidIdxc = NULL;
|
||||
TBC *pTbDbc = NULL;
|
||||
const void *pData;
|
||||
int nData;
|
||||
int64_t oversion;
|
||||
|
@ -484,7 +484,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
bool updStat = deltaCol != 0 && !metaTbInFilterCache(pMeta, pReq->name, 1);
|
||||
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
STsdb * pTsdb = pMeta->pVnode->pTsdb;
|
||||
STsdb *pTsdb = pMeta->pVnode->pTsdb;
|
||||
SArray *uids = taosArrayInit(8, sizeof(int64_t));
|
||||
if (deltaCol == 1) {
|
||||
int16_t cid = pReq->schemaRow.pSchema[nCols - 1].colId;
|
||||
|
@ -554,9 +554,9 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
|||
|
||||
STbDbKey tbDbKey = {0};
|
||||
|
||||
TBC * pUidIdxc = NULL;
|
||||
TBC * pTbDbc = NULL;
|
||||
void * pData = NULL;
|
||||
TBC *pUidIdxc = NULL;
|
||||
TBC *pTbDbc = NULL;
|
||||
void *pData = NULL;
|
||||
int nData = 0;
|
||||
int64_t oversion;
|
||||
SDecoder dc = {0};
|
||||
|
@ -710,11 +710,11 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
SMetaEntry nStbEntry = {0};
|
||||
|
||||
STbDbKey tbDbKey = {0};
|
||||
TBC * pUidIdxc = NULL;
|
||||
TBC * pTbDbc = NULL;
|
||||
TBC *pUidIdxc = NULL;
|
||||
TBC *pTbDbc = NULL;
|
||||
int ret = 0;
|
||||
int c = -2;
|
||||
void * pData = NULL;
|
||||
void *pData = NULL;
|
||||
int nData = 0;
|
||||
int64_t oversion;
|
||||
SDecoder dc = {0};
|
||||
|
@ -817,8 +817,8 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
|||
nStbEntry.uid = oStbEntry.uid;
|
||||
nStbEntry.name = oStbEntry.name;
|
||||
|
||||
SSchemaWrapper * row = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaRow);
|
||||
SSchemaWrapper * tag = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaTag);
|
||||
SSchemaWrapper *row = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaRow);
|
||||
SSchemaWrapper *tag = tCloneSSchemaWrapper(&oStbEntry.stbEntry.schemaTag);
|
||||
SColCmprWrapper *cmpr = tCloneSColCmprWrapper(&oStbEntry.colCmpr);
|
||||
|
||||
nStbEntry.stbEntry.schemaRow = *row;
|
||||
|
@ -999,7 +999,7 @@ _err:
|
|||
}
|
||||
|
||||
int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUids, tb_uid_t *tbUid) {
|
||||
void * pData = NULL;
|
||||
void *pData = NULL;
|
||||
int nData = 0;
|
||||
int rc = 0;
|
||||
tb_uid_t uid = 0;
|
||||
|
@ -1078,10 +1078,10 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
|
|||
metaULock(pMeta);
|
||||
|
||||
// update timeseries
|
||||
void * pCtbDropped = NULL;
|
||||
void *pCtbDropped = NULL;
|
||||
int32_t iter = 0;
|
||||
while ((pCtbDropped = tSimpleHashIterate(suidHash, pCtbDropped, &iter))) {
|
||||
tb_uid_t * pSuid = tSimpleHashGetKey(pCtbDropped, NULL);
|
||||
tb_uid_t *pSuid = tSimpleHashGetKey(pCtbDropped, NULL);
|
||||
int32_t nCols = 0;
|
||||
SVnodeStats *pStats = &pMeta->pVnode->config.vndStats;
|
||||
if (metaGetStbStats(pMeta->pVnode, *pSuid, NULL, &nCols) == 0) {
|
||||
|
@ -1221,7 +1221,7 @@ static int metaDeleteTtl(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
}
|
||||
|
||||
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *pSuid, int8_t *pSysTbl) {
|
||||
void * pData = NULL;
|
||||
void *pData = NULL;
|
||||
int nData = 0;
|
||||
int rc = 0;
|
||||
SMetaEntry e = {0};
|
||||
|
@ -1260,7 +1260,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
|||
|
||||
if (pSysTbl) *pSysTbl = metaTbInFilterCache(pMeta, stbEntry.name, 1) ? 1 : 0;
|
||||
|
||||
SSchema * pTagColumn = NULL;
|
||||
SSchema *pTagColumn = NULL;
|
||||
SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
|
||||
if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) {
|
||||
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
|
||||
|
@ -1384,14 +1384,14 @@ int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
|||
}
|
||||
|
||||
static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq, STableMetaRsp *pMetaRsp) {
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int nVal = 0;
|
||||
const void * pData = NULL;
|
||||
const void *pData = NULL;
|
||||
int nData = 0;
|
||||
int ret = 0;
|
||||
tb_uid_t uid;
|
||||
int64_t oversion;
|
||||
SSchema * pColumn = NULL;
|
||||
SSchema *pColumn = NULL;
|
||||
SMetaEntry entry = {0};
|
||||
SSchemaWrapper *pSchema;
|
||||
int c;
|
||||
|
@ -1652,7 +1652,7 @@ _err:
|
|||
static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||
SMetaEntry ctbEntry = {0};
|
||||
SMetaEntry stbEntry = {0};
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int nVal = 0;
|
||||
int ret;
|
||||
int c;
|
||||
|
@ -1693,7 +1693,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||
|
||||
// search table.db
|
||||
TBC * pTbDbc = NULL;
|
||||
TBC *pTbDbc = NULL;
|
||||
SDecoder dc1 = {0};
|
||||
SDecoder dc2 = {0};
|
||||
|
||||
|
@ -1729,7 +1729,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
metaDecodeEntry(&dc2, &stbEntry);
|
||||
|
||||
SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
|
||||
SSchema * pColumn = NULL;
|
||||
SSchema *pColumn = NULL;
|
||||
int32_t iCol = 0;
|
||||
for (;;) {
|
||||
pColumn = NULL;
|
||||
|
@ -1756,8 +1756,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
memcpy((void *)ctbEntry.ctbEntry.pTags, pAlterTbReq->pTagVal, pAlterTbReq->nTagVal);
|
||||
} else {
|
||||
const STag *pOldTag = (const STag *)ctbEntry.ctbEntry.pTags;
|
||||
STag * pNewTag = NULL;
|
||||
SArray * pTagArray = taosArrayInit(pTagSchema->nCols, sizeof(STagVal));
|
||||
STag *pNewTag = NULL;
|
||||
SArray *pTagArray = taosArrayInit(pTagSchema->nCols, sizeof(STagVal));
|
||||
if (!pTagArray) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
|
@ -1839,7 +1839,7 @@ _err:
|
|||
}
|
||||
|
||||
static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int nVal = 0;
|
||||
const void *pData = NULL;
|
||||
int nData = 0;
|
||||
|
@ -1943,7 +1943,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
|||
|
||||
static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||
SMetaEntry stbEntry = {0};
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int nVal = 0;
|
||||
int ret;
|
||||
int c;
|
||||
|
@ -2076,7 +2076,7 @@ typedef struct SMetaPair {
|
|||
|
||||
static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||
SMetaEntry stbEntry = {0};
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int nVal = 0;
|
||||
int ret;
|
||||
int c;
|
||||
|
@ -2186,7 +2186,7 @@ _err:
|
|||
int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq) {
|
||||
// impl later
|
||||
SMetaEntry tbEntry = {0};
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int nVal = 0;
|
||||
int ret;
|
||||
int c;
|
||||
|
@ -2296,8 +2296,8 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta
|
|||
|
||||
static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
|
||||
STbDbKey tbDbKey;
|
||||
void * pKey = NULL;
|
||||
void * pVal = NULL;
|
||||
void *pKey = NULL;
|
||||
void *pVal = NULL;
|
||||
int kLen = 0;
|
||||
int vLen = 0;
|
||||
SEncoder coder = {0};
|
||||
|
@ -2448,14 +2448,14 @@ static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) {
|
|||
}
|
||||
|
||||
static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
||||
void * pData = NULL;
|
||||
void *pData = NULL;
|
||||
int nData = 0;
|
||||
STbDbKey tbDbKey = {0};
|
||||
SMetaEntry stbEntry = {0};
|
||||
STagIdxKey * pTagIdxKey = NULL;
|
||||
STagIdxKey *pTagIdxKey = NULL;
|
||||
int32_t nTagIdxKey;
|
||||
const SSchema *pTagColumn;
|
||||
const void * pTagData = NULL;
|
||||
const void *pTagData = NULL;
|
||||
int32_t nTagData = 0;
|
||||
SDecoder dc = {0};
|
||||
int32_t ret = 0;
|
||||
|
@ -2524,7 +2524,7 @@ end:
|
|||
|
||||
static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
|
||||
SEncoder coder = {0};
|
||||
void * pVal = NULL;
|
||||
void *pVal = NULL;
|
||||
int vLen = 0;
|
||||
int rcode = 0;
|
||||
SSkmDbKey skmDbKey = {0};
|
||||
|
@ -2652,15 +2652,15 @@ int32_t colCompressDebug(SHashObj *pColCmprObj) {
|
|||
const char *l1str = columnEncodeStr(l1);
|
||||
const char *l2str = columnCompressStr(l2);
|
||||
const char *lvlstr = columnLevelStr(lvl);
|
||||
metaInfo("colId: %d, encode:%s, compress:%s,level:%s", colId, l1str, l2str, lvlstr);
|
||||
metaDebug("colId: %d, encode:%s, compress:%s,level:%s", colId, l1str, l2str, lvlstr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
||||
int rc = 0;
|
||||
|
||||
SHashObj * pColCmprObj = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
|
||||
void * pData = NULL;
|
||||
SHashObj *pColCmprObj = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
|
||||
void *pData = NULL;
|
||||
int nData = 0;
|
||||
SMetaEntry e = {0};
|
||||
SDecoder dc = {0};
|
||||
|
|
Loading…
Reference in New Issue