diff --git a/include/util/tconfig.h b/include/util/tconfig.h index f109153384..3fc247982f 100644 --- a/include/util/tconfig.h +++ b/include/util/tconfig.h @@ -84,11 +84,11 @@ typedef struct SConfigItem { }; union { int64_t imin; - double fmin; + float fmin; }; union { int64_t imax; - double fmax; + float fmax; }; SArray *array; // SDiskCfg/SLogVar } SConfigItem; diff --git a/include/util/tutil.h b/include/util/tutil.h index 6c7517f630..6321d2011a 100644 --- a/include/util/tutil.h +++ b/include/util/tutil.h @@ -55,7 +55,7 @@ void taosIpPort2String(uint32_t ip, uint16_t port, char *str); void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen); -int32_t parseCfgReal(const char *str, double *out); +int32_t parseCfgReal(const char *str, float *out); static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) { T_MD5_CTX context; diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index 4492073620..612f57ecdd 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -696,7 +696,7 @@ static void monitorSendAllSlowLogFromTempDir(int64_t clusterId) { continue; } if (taosLockFile(pFile) < 0) { - tscError("failed to lock file:%s since %s, maybe used by other process", filename, terrstr()); + tscInfo("failed to lock file:%s since %s, maybe used by other process", filename, terrstr()); (void)taosCloseFile(&pFile); continue; } diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 29d8b38146..6e8ad547e1 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -193,15 +193,15 @@ static int32_t cfgSetInt64(SConfigItem *pItem, const char *value, ECfgSrcType st } static int32_t cfgSetFloat(SConfigItem *pItem, const char *value, ECfgSrcType stype) { - double dval; + float dval = 0; TAOS_CHECK_RETURN(parseCfgReal(value, &dval)); if (dval < pItem->fmin || dval > pItem->fmax) { - uError("cfg:%s, type:%s src:%s value:%f out of range[%f, %f]", pItem->name, cfgDtypeStr(pItem->dtype), + uError("cfg:%s, type:%s src:%s value:%g out of range[%g, %g]", pItem->name, cfgDtypeStr(pItem->dtype), cfgStypeStr(stype), dval, pItem->fmin, pItem->fmax); TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); } - pItem->fval = (float)dval; + pItem->fval = dval; pItem->stype = stype; TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -385,6 +385,10 @@ int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcTy (void)taosThreadMutexUnlock(&pCfg->lock); } + if (code != 0){ + uError("cfg:%s, type:%s src:%s value:%s failed since %s", pItem->name, cfgDtypeStr(pItem->dtype), + cfgStypeStr(stype), value, tstrerror(code)); + } TAOS_RETURN(code); } @@ -475,14 +479,14 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p } break; case CFG_DTYPE_FLOAT: case CFG_DTYPE_DOUBLE: { - double dval; + float dval = 0; int32_t code = parseCfgReal(pVal, &dval); if (code != TSDB_CODE_SUCCESS) { cfgUnLock(pCfg); TAOS_RETURN(code); } if (dval < pItem->fmin || dval > pItem->fmax) { - uError("cfg:%s, type:%s value:%f out of range[%f, %f]", pItem->name, cfgDtypeStr(pItem->dtype), dval, + uError("cfg:%s, type:%s value:%g out of range[%g, %g]", pItem->name, cfgDtypeStr(pItem->dtype), dval, pItem->fmin, pItem->fmax); cfgUnLock(pCfg); TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); diff --git a/source/util/src/tutil.c b/source/util/src/tutil.c index 081acda20f..48338e7996 100644 --- a/source/util/src/tutil.c +++ b/source/util/src/tutil.c @@ -505,11 +505,11 @@ size_t twcsncspn(const TdUcs4 *wcs, size_t size, const TdUcs4 *reject, size_t rs return index; } -int32_t parseCfgReal(const char *str, double *out) { - double val; +int32_t parseCfgReal(const char *str, float *out) { + float val; char *endPtr; errno = 0; - val = taosStr2Double(str, &endPtr); + val = taosStr2Float(str, &endPtr); if (str == endPtr || errno == ERANGE || isnan(val)) { return terrno = TSDB_CODE_INVALID_CFG_VALUE; }