more code

This commit is contained in:
Hongze Cheng 2024-12-13 16:47:05 +08:00
parent 8525df81a8
commit a6463884f0
5 changed files with 8 additions and 16 deletions

View File

@ -62,7 +62,7 @@ typedef struct SMetaEntry {
struct {
int64_t btime;
int32_t ttlDays;
int32_t commentLen;
int32_t commentLen; // not include '\0'
char* comment;
tb_uid_t suid;
uint8_t* pTags;
@ -431,7 +431,7 @@ typedef struct SStateStore {
int32_t (*streamFileStateInit)(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize,
GetTsFun fp, void* pFile, TSKEY delMark, const char* id, int64_t ckId, int8_t type,
struct SStreamFileState** ppFileState);
int32_t (*streamStateGroupPut)(SStreamState* pState, int64_t groupId, void* value, int32_t vLen);
SStreamStateCur* (*streamStateGroupGetCur)(SStreamState* pState);
void (*streamStateGroupCurNext)(SStreamStateCur* pCur);

View File

@ -317,7 +317,7 @@ int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
metaCloneEntryFree(ppEntry);
return code;
}
memcpy((*ppEntry)->ctbEntry.comment, pEntry->ctbEntry.comment, pEntry->ctbEntry.commentLen);
memcpy((*ppEntry)->ctbEntry.comment, pEntry->ctbEntry.comment, pEntry->ctbEntry.commentLen + 1);
}
// tags
@ -350,7 +350,7 @@ int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
metaCloneEntryFree(ppEntry);
return code;
}
memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen);
memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
}
} else {
return TSDB_CODE_INVALID_PARA;

View File

@ -964,7 +964,7 @@ static int32_t metaHandleNormalTableCreate(SMeta *pMeta, const SMetaEntry *pEntr
metaULock(pMeta);
// update other stuff
if (TSDB_CODE_SUCCESS != code) {
if (TSDB_CODE_SUCCESS == code) {
pMeta->pVnode->config.vndStats.numOfNTables++;
pMeta->pVnode->config.vndStats.numOfNTimeSeries += pEntry->ntbEntry.schemaRow.nCols - 1;
pMeta->changed = true;
@ -1041,7 +1041,7 @@ static int32_t metaHandleChildTableCreate(SMeta *pMeta, const SMetaEntry *pEntry
metaULock(pMeta);
// update other stuff
if (TSDB_CODE_SUCCESS != code) {
if (TSDB_CODE_SUCCESS == code) {
pMeta->pVnode->config.vndStats.numOfCTables++;
if (!metaTbInFilterCache(pMeta, pSuperEntry->name, 1)) {

View File

@ -3003,10 +3003,6 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta
return metaUpdateTableMultiTagValue(pMeta, version, pReq);
case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
return metaUpdateTableOptions2(pMeta, version, pReq);
case TSDB_ALTER_TABLE_ADD_TAG_INDEX:
return metaAddTagIndex(pMeta, version, pReq);
case TSDB_ALTER_TABLE_DROP_TAG_INDEX:
return metaDropTagIndex(pMeta, version, pReq);
case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS:
return metaUpdateTableColCompress2(pMeta, version, pReq);
default:

View File

@ -1402,9 +1402,6 @@ int32_t metaUpdateTableOptions2(SMeta *pMeta, int64_t version, SVAlterTbReq *pRe
if (pEntry->type == TSDB_CHILD_TABLE) {
if (pReq->updateTTL) {
pEntry->ctbEntry.ttlDays = pReq->newTTL;
// metaDeleteTtl(pMeta, &entry);
// entry.ctbEntry.ttlDays = pReq->newTTL;
// metaUpdateTtl(pMeta, &entry);
}
if (pReq->newCommentLen >= 0) {
char *pNewComment = taosMemoryRealloc(pEntry->ctbEntry.comment, pReq->newCommentLen + 1);
@ -1414,15 +1411,13 @@ int32_t metaUpdateTableOptions2(SMeta *pMeta, int64_t version, SVAlterTbReq *pRe
metaFetchEntryFree(&pEntry);
TAOS_RETURN(terrno);
}
memcpy(pNewComment, pReq->newComment, pReq->newCommentLen + 1);
pEntry->ctbEntry.comment = pNewComment;
pEntry->ctbEntry.commentLen = pReq->newCommentLen;
}
} else if (pEntry->type == TSDB_NORMAL_TABLE) {
if (pReq->updateTTL) {
pEntry->ntbEntry.ttlDays = pReq->newTTL;
// metaDeleteTtl(pMeta, &entry);
// entry.ntbEntry.ttlDays = pReq->newTTL;
// metaUpdateTtl(pMeta, &entry);
}
if (pReq->newCommentLen >= 0) {
char *pNewComment = taosMemoryRealloc(pEntry->ntbEntry.comment, pReq->newCommentLen + 1);
@ -1432,6 +1427,7 @@ int32_t metaUpdateTableOptions2(SMeta *pMeta, int64_t version, SVAlterTbReq *pRe
metaFetchEntryFree(&pEntry);
TAOS_RETURN(terrno);
}
memcpy(pNewComment, pReq->newComment, pReq->newCommentLen + 1);
pEntry->ntbEntry.comment = pNewComment;
pEntry->ntbEntry.commentLen = pReq->newCommentLen;
}