enh: prefer to use latest schema

This commit is contained in:
Cary Xu 2022-05-30 19:56:15 +08:00
parent 5fa27b27ba
commit 76ef412d8f
1 changed files with 2 additions and 2 deletions

View File

@ -182,10 +182,10 @@ int tsdbUnlockRepo(STsdb *pTsdb);
static FORCE_INLINE STSchema *tsdbGetTableSchemaImpl(STsdb *pTsdb, STable *pTable, bool lock, bool copy,
int32_t version) {
if (version < 0) {
if ((version < 0) || (schemaVersion(pTable->pSchema) == version)) {
return pTable->pSchema;
}
if (!pTable->pCacheSchema || (schemaVersion(pTable->pCacheSchema) != version)) {
taosMemoryFreeClear(pTable->pCacheSchema);
pTable->pCacheSchema = metaGetTbTSchema(REPO_META(pTsdb), pTable->uid, version);