Rename persistLocalConfig to taosPersistLocalConfig.
This commit is contained in:
parent
a579abd0f0
commit
8ffa8811f5
|
@ -296,8 +296,8 @@ void taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
|
||||||
int8_t taosGranted(int8_t type);
|
int8_t taosGranted(int8_t type);
|
||||||
int32_t taosSetSlowLogScope(char *pScopeStr, int32_t *pScope);
|
int32_t taosSetSlowLogScope(char *pScopeStr, int32_t *pScope);
|
||||||
|
|
||||||
int32_t persistGlobalConfig(SArray *array, const char *path, int32_t version);
|
int32_t taosPersistGlobalConfig(SArray *array, const char *path, int32_t version);
|
||||||
int32_t persistLocalConfig(const char *path);
|
int32_t taosPersistLocalConfig(const char *path);
|
||||||
int32_t localConfigSerialize(SArray *array, char **serialized);
|
int32_t localConfigSerialize(SArray *array, char **serialized);
|
||||||
int32_t tSerializeSConfigArray(SEncoder *pEncoder, SArray *array);
|
int32_t tSerializeSConfigArray(SEncoder *pEncoder, SArray *array);
|
||||||
int32_t tDeserializeSConfigArray(SDecoder *pDecoder, SArray *array);
|
int32_t tDeserializeSConfigArray(SDecoder *pDecoder, SArray *array);
|
||||||
|
|
|
@ -2800,7 +2800,7 @@ int32_t localConfigSerialize(SArray *array, char **serialized) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:close file when error
|
// TODO:close file when error
|
||||||
int32_t persistGlobalConfig(SArray *array, const char *path, int32_t version) {
|
int32_t taosPersistGlobalConfig(SArray *array, const char *path, int32_t version) {
|
||||||
// TODO: just tmp ,refactor later
|
// TODO: just tmp ,refactor later
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
@ -2836,7 +2836,7 @@ int32_t persistGlobalConfig(SArray *array, const char *path, int32_t version) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t persistLocalConfig(const char *path) {
|
int32_t taosPersistLocalConfig(const char *path) {
|
||||||
// TODO: just tmp ,refactor later
|
// TODO: just tmp ,refactor later
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
#include "tanal.h"
|
#include "tanal.h"
|
||||||
#include "tchecksum.h"
|
#include "tchecksum.h"
|
||||||
|
#include "tutil.h"
|
||||||
|
|
||||||
extern SConfig *tsCfg;
|
extern SConfig *tsCfg;
|
||||||
|
|
||||||
|
@ -285,6 +286,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
static void dmProcessConfigRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
static void dmProcessConfigRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
const STraceId *trace = &pRsp->info.traceId;
|
const STraceId *trace = &pRsp->info.traceId;
|
||||||
|
int32_t code = 0;
|
||||||
SConfigRsp configRsp = {0};
|
SConfigRsp configRsp = {0};
|
||||||
|
|
||||||
if (pRsp->code != 0) {
|
if (pRsp->code != 0) {
|
||||||
|
@ -305,7 +307,12 @@ static void dmProcessConfigRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
// Try to use cfg file in current dnode.
|
// Try to use cfg file in current dnode.
|
||||||
if (configRsp.forceReadConfig) {
|
if (configRsp.forceReadConfig) {
|
||||||
if (configRsp.isConifgVerified) {
|
if (configRsp.isConifgVerified) {
|
||||||
persistGlobalConfig(taosGetGlobalCfg(tsCfg), pMgmt->path, configRsp.cver);
|
code = taosPersistGlobalConfig(taosGetGlobalCfg(tsCfg), pMgmt->path, configRsp.cver);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
dError("failed to persist global config since %s", tstrerror(code));
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
needUpdate = true;
|
||||||
} else {
|
} else {
|
||||||
// log the difference configurations
|
// log the difference configurations
|
||||||
printConfigNotMatch(configRsp.array);
|
printConfigNotMatch(configRsp.array);
|
||||||
|
@ -315,13 +322,20 @@ static void dmProcessConfigRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
// Try to use cfg from mnode sdb.
|
// Try to use cfg from mnode sdb.
|
||||||
if (!configRsp.isVersionVerified) {
|
if (!configRsp.isVersionVerified) {
|
||||||
needUpdate = true;
|
needUpdate = true;
|
||||||
persistGlobalConfig(configRsp.array, pMgmt->path, configRsp.cver);
|
code = taosPersistGlobalConfig(configRsp.array, pMgmt->path, configRsp.cver);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
dError("failed to persist global config since %s", tstrerror(code));
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (needUpdate) {
|
if (needUpdate) {
|
||||||
setAllConfigs(tsCfg);
|
setAllConfigs(tsCfg);
|
||||||
}
|
}
|
||||||
persistLocalConfig(pMgmt->path);
|
code = taosPersistLocalConfig(pMgmt->path);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
dError("failed to persist local config since %s", tstrerror(code));
|
||||||
|
}
|
||||||
tsConfigInited = 1;
|
tsConfigInited = 1;
|
||||||
}
|
}
|
||||||
_exit:
|
_exit:
|
||||||
|
@ -453,6 +467,7 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
SConfig *pCfg = taosGetCfg();
|
SConfig *pCfg = taosGetCfg();
|
||||||
SConfigItem *pItem = NULL;
|
SConfigItem *pItem = NULL;
|
||||||
|
|
||||||
code = cfgGetAndSetItem(pCfg, &pItem, cfgReq.config, cfgReq.value, CFG_STYPE_ALTER_CMD, true);
|
code = cfgGetAndSetItem(pCfg, &pItem, cfgReq.config, cfgReq.value, CFG_STYPE_ALTER_CMD, true);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (strncasecmp(cfgReq.config, "resetlog", strlen("resetlog")) == 0) {
|
if (strncasecmp(cfgReq.config, "resetlog", strlen("resetlog")) == 0) {
|
||||||
|
@ -466,11 +481,16 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
tsdmConfigVersion = cfgReq.version;
|
tsdmConfigVersion = cfgReq.version;
|
||||||
}
|
}
|
||||||
if (pItem->category == CFG_CATEGORY_GLOBAL) {
|
if (pItem->category == CFG_CATEGORY_GLOBAL) {
|
||||||
persistGlobalConfig(taosGetGlobalCfg(pCfg), pMgmt->path, tsdmConfigVersion);
|
code = taosPersistGlobalConfig(taosGetGlobalCfg(pCfg), pMgmt->path, tsdmConfigVersion);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
dError("failed to persist global config since %s", tstrerror(code));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
persistLocalConfig(pMgmt->path);
|
code = taosPersistLocalConfig(pMgmt->path);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
dError("failed to persist local config since %s", tstrerror(code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,7 +377,6 @@ int32_t cfgGetAndSetItem(SConfig *pCfg, SConfigItem **pItem, const char *name, c
|
||||||
(void)taosThreadMutexUnlock(&pCfg->lock);
|
(void)taosThreadMutexUnlock(&pCfg->lock);
|
||||||
TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND);
|
TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(cfgSetItemVal(*pItem, name, value, stype));
|
TAOS_CHECK_RETURN(cfgSetItemVal(*pItem, name, value, stype));
|
||||||
|
|
||||||
if (lock) {
|
if (lock) {
|
||||||
|
|
Loading…
Reference in New Issue