diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index a2b5b44878ac6a421cc0f1141276d706cb16cd24..3f3ad8dc9a3d135fcf8bb884d1227d6ec5534762 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -45,6 +45,7 @@ typedef struct { int (*eventCallBack)(void *); void *(*cqCreateFunc)(void *handle, int sid, char *sqlStr, STSchema *pSchema); void (*cqDropFunc)(void *handle); + void *(*configFunc)(int32_t vgId, int32_t sid); } STsdbAppH; // --------- TSDB REPOSITORY CONFIGURATION DEFINITION diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index abce4e9a62801e82d591c4f2c4470e32bed28750..15a6ca240359eed4fcf8a1ff2c68a046b1860cba 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -425,8 +425,14 @@ int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg) { return TSDB_CODE_INVALID_TABLE_TYPE; } - if (schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)) > tversion) { - // TODO: Need to update + if (schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)) < tversion) { + tsdbTrace("vgId:%d server tag version %d is older than client tag version %d, try to config", pRepo->config.tsdbId, + schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)), tversion); + void *msg = (*pRepo->appH.configFunc)(pRepo->config.tsdbId, htonl(pMsg->tid)); + // Deal with error her + STableCfg *pTableCfg = tsdbCreateTableCfgFromMsg(msg); + + ASSERT(pTableCfg != NULL); } if (schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)) > tversion) { diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 87ee5c2c1ccc4f71cc61d645f62acc1279876971..c2831c3bd574f2c94666b2820d779301f1811a42 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -224,6 +224,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { appH.cqH = pVnode->cq; appH.cqCreateFunc = cqCreate; appH.cqDropFunc = cqDrop; + appH.configFunc = dnodeSendCfgTableToRecv; sprintf(temp, "%s/tsdb", rootDir); pVnode->tsdb = tsdbOpenRepo(temp, &appH); if (pVnode->tsdb == NULL) { @@ -473,6 +474,7 @@ static void vnodeNotifyFileSynced(void *ahandle, uint64_t fversion) { appH.cqH = pVnode->cq; appH.cqCreateFunc = cqCreate; appH.cqDropFunc = cqDrop; + appH.configFunc = dnodeSendCfgTableToRecv; pVnode->tsdb = tsdbOpenRepo(rootDir, &appH); }