more code

This commit is contained in:
Hongze Cheng 2024-12-16 10:59:55 +08:00
parent 2b4046ecf8
commit a0cae0ddca
6 changed files with 28 additions and 27 deletions

View File

@ -60,7 +60,7 @@ int metaRemoveTableFromIdx(SMeta* pMeta, tb_uid_t uid);
static FORCE_INLINE tb_uid_t metaGenerateUid(SMeta* pMeta) { return tGenIdPI64(); }
// metaTable ==================
int metaHandleEntry(SMeta* pMeta, const SMetaEntry* pME);
int32_t metaHandleEntry2(SMeta* pMeta, const SMetaEntry* pEntry);
// metaCache ==================
int32_t metaCacheOpen(SMeta* pMeta);

View File

@ -452,13 +452,12 @@ static int32_t metaSchemaTableUpdate(SMeta *pMeta, const SMetaHandleParam *pPara
}
// check tag schema
if (pOldEntry->stbEntry.schemaTag.version != pEntry->stbEntry.schemaTag.version) {
code = metaUpdateSuperTableTagSchema(pMeta, pParam);
if (code) {
metaErr(TD_VID(pMeta->pVnode), code);
return code;
}
code = metaUpdateSuperTableTagSchema(pMeta, pParam);
if (code) {
metaErr(TD_VID(pMeta->pVnode), code);
return code;
}
} else {
return TSDB_CODE_INVALID_PARA;
}

View File

@ -330,7 +330,7 @@ static int32_t metaGenerateNewMeta(SMeta **ppMeta) {
tdbTbGet(pMeta->pUidIdx, &me.ctbEntry.suid, sizeof(me.ctbEntry.suid), NULL, NULL) != 0) {
metaError("vgId:%d failed to get super table uid:%" PRId64 " for child table uid:%" PRId64,
TD_VID(pVnode), me.ctbEntry.suid, uid);
} else if (metaHandleEntry(pNewMeta, &me) != 0) {
} else if (metaHandleEntry2(pNewMeta, &me) != 0) {
metaError("vgId:%d failed to handle entry, uid:%" PRId64, TD_VID(pVnode), uid);
}
}

View File

@ -72,7 +72,6 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
int32_t nKey = 0;
int32_t nData = 0;
STbDbKey key;
SMetaInfo info;
*ppData = NULL;
for (;;) {
@ -85,8 +84,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
goto _exit;
}
if (key.version < pReader->sver //
|| metaGetInfo(pReader->pMeta, key.uid, &info, NULL) == TSDB_CODE_NOT_FOUND) {
if (key.version < pReader->sver) {
if (tdbTbcMoveToNext(pReader->pTbc) != 0) {
metaTrace("vgId:%d, vnode snapshot meta read data done", TD_VID(pReader->pMeta->pVnode));
}
@ -199,7 +197,7 @@ int32_t metaSnapWrite(SMetaSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
code = metaDecodeEntry(pDecoder, &metaEntry);
TSDB_CHECK_CODE(code, lino, _exit);
code = metaHandleEntry(pMeta, &metaEntry);
code = metaHandleEntry2(pMeta, &metaEntry);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:

View File

@ -46,6 +46,8 @@ static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME);
static int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
int metaHandleEntry(SMeta *pMeta, const SMetaEntry *pME);
int32_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add, uint32_t compress) {
int32_t nCols = pWp->nCols;
int32_t ver = pWp->version;

View File

@ -1574,13 +1574,14 @@ int32_t metaAddIndexToSuperTable(SMeta *pMeta, int64_t version, SVCreateStbReq *
TAOS_RETURN(TSDB_CODE_INVALID_MSG);
}
if (pEntry->stbEntry.schemaTag.version >= pReq->schemaTag.version) {
metaError("vgId:%d, %s failed at %s:%d since table %s tag schema version %d is not less than %d, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->name, pEntry->stbEntry.schemaTag.version,
pReq->schemaTag.version, version);
metaFetchEntryFree(&pEntry);
TAOS_RETURN(TSDB_CODE_INVALID_MSG);
}
// if (pEntry->stbEntry.schemaTag.version >= pReq->schemaTag.version) {
// metaError("vgId:%d, %s failed at %s:%d since table %s tag schema version %d is not less than %d, version:%"
// PRId64,
// TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->name, pEntry->stbEntry.schemaTag.version,
// pReq->schemaTag.version, version);
// metaFetchEntryFree(&pEntry);
// TAOS_RETURN(TSDB_CODE_INVALID_MSG);
// }
// do change the entry
SSchemaWrapper *pOldTagSchema = &pEntry->stbEntry.schemaTag;
@ -1601,13 +1602,14 @@ int32_t metaAddIndexToSuperTable(SMeta *pMeta, int64_t version, SVCreateStbReq *
TAOS_RETURN(TSDB_CODE_INVALID_MSG);
}
if (pOldTagSchema->version >= pNewTagSchema->version) {
metaError("vgId:%d, %s failed at %s:%d since table %s tag schema version %d is not less than %d, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->name, pOldTagSchema->version,
pNewTagSchema->version, version);
metaFetchEntryFree(&pEntry);
TAOS_RETURN(TSDB_CODE_INVALID_MSG);
}
// if (pOldTagSchema->version >= pNewTagSchema->version) {
// metaError("vgId:%d, %s failed at %s:%d since table %s tag schema version %d is not less than %d, version:%"
// PRId64,
// TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->name, pOldTagSchema->version,
// pNewTagSchema->version, version);
// metaFetchEntryFree(&pEntry);
// TAOS_RETURN(TSDB_CODE_INVALID_MSG);
// }
int32_t numOfChangedTags = 0;
for (int32_t i = 0; i < pOldTagSchema->nCols; i++) {
@ -1670,7 +1672,7 @@ int32_t metaDropIndexFromSuperTable(SMeta *pMeta, int64_t version, SDropIndexReq
}
SMetaEntry *pEntry = NULL;
code = metaFetchEntryByName(pMeta, pReq->stb, &pEntry);
code = metaFetchEntryByUid(pMeta, pReq->stbUid, &pEntry);
if (code) {
metaError("vgId:%d, %s failed at %s:%d since table %s not found, version:%" PRId64, TD_VID(pMeta->pVnode), __func__,
__FILE__, __LINE__, pReq->stb, version);