diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 8c03d3ff42b5b0b28f8f1958acfcd7dc8520d464..3f68bb4147ca8d6081c1c41072602b9709166ef2 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -138,6 +138,9 @@ extern bool tsSmlDataFormat; extern int32_t tsTransPullupInterval; extern int32_t tsMqRebalanceInterval; +// ttl unit +extern int32_t tsTtlUnit; + #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize) int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd, diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 269c92a670ffed95c2cd2b5d1f76bf97d5615f1b..cd7cae84717066bf1b647ffebf8c9f581805bf1d 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -188,6 +188,8 @@ bool tsStartUdfd = true; int32_t tsTransPullupInterval = 2; int32_t tsMqRebalanceInterval = 2; +int32_t tsTtlUnit = 86400; + void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary) { tstrncpy(tsDiskCfg[index].dir, v1, TSDB_FILENAME_LEN); tsDiskCfg[index].level = level; @@ -468,6 +470,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "transPullupInterval", tsTransPullupInterval, 1, 10000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "mqRebalanceInterval", tsMqRebalanceInterval, 1, 10000, 1) != 0) return -1; + if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400*365, 1) != 0) return -1; + + if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1; return 0; } @@ -620,6 +625,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32; tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32; + tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; + tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; if (tsQueryBufferSize >= 0) { diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 7a5220d0b22f59514ebf986f669bbdc946b39487..e0c3b8d2a1e92e07dd6f5f80d86cd35ec9a7cba4 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -95,7 +95,7 @@ static void *mndThreadFp(void *param) { taosMsleep(100); if (mndGetStop(pMnode)) break; - if (lastTime % (864000) == 1) { // sleep 1 day for ttl + if (lastTime % (600) == 1) { mndTtlTimer(pMnode); } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index b5777183dbab859f1cbe079c9ad7cdf6947fdb9c..27c1e558e8265182dc6f660e2fef55546ccecc64 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -805,7 +805,7 @@ static int32_t mndProcessTtl(SRpcMsg *pReq) { if(code != 0){ mError("ttl time seed err. code:%d", code); } - mError("ttl time seed succ. time:%d", t); + mDebug("ttl time seed succ. time:%d", t); sdbRelease(pSdb, pVgroup); } return 0; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index bf5d5912f93df374010043c10ef0cdd48368573c..2bbea593faa032d385fc97bfac23bceaaf2e1828 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -400,8 +400,7 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME){ if (ttlDays <= 0) return; - ttlKey->dtime = ctime / 1000 + ttlDays * 24 * 60 * 60; -// ttlKey->dtime = ctime / 1000 + ttlDays; + ttlKey->dtime = ctime / 1000 + ttlDays * tsTtlUnit; ttlKey->uid = pME->uid; } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index b5a2da091ff0113037964494a591a58ce8b072c7..c5023185c8a845339ea7b12c68d7377010417c1d 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -309,7 +309,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p if (tbUids == NULL) return TSDB_CODE_OUT_OF_MEMORY; int32_t t = ntohl(*(int32_t *)pReq); - vError("rec ttl time:%d", t); + vDebug("rec ttl time:%d", t); int32_t ret = metaTtlDropTable(pVnode->pMeta, t, tbUids); if (ret != 0) { goto end;