diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 52e740b3df..04ff6b9b3d 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -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); diff --git a/source/dnode/vnode/src/meta/metaEntry.c b/source/dnode/vnode/src/meta/metaEntry.c index 4ddd7c991d..302a1eb04a 100644 --- a/source/dnode/vnode/src/meta/metaEntry.c +++ b/source/dnode/vnode/src/meta/metaEntry.c @@ -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; diff --git a/source/dnode/vnode/src/meta/metaEntry2.c b/source/dnode/vnode/src/meta/metaEntry2.c index cdc3628102..bcbd6f275c 100644 --- a/source/dnode/vnode/src/meta/metaEntry2.c +++ b/source/dnode/vnode/src/meta/metaEntry2.c @@ -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)) { diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index ae846d860b..8bad8ab569 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -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: diff --git a/source/dnode/vnode/src/meta/metaTable2.c b/source/dnode/vnode/src/meta/metaTable2.c index 4b55000525..1cb714e7bd 100644 --- a/source/dnode/vnode/src/meta/metaTable2.c +++ b/source/dnode/vnode/src/meta/metaTable2.c @@ -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; }