Fix unit test.
This commit is contained in:
parent
3a32980577
commit
c653daf5dc
|
@ -54,7 +54,6 @@ extern uint16_t tsServerPort;
|
||||||
extern int32_t tsVersion;
|
extern int32_t tsVersion;
|
||||||
extern int32_t tsForceReadConfig;
|
extern int32_t tsForceReadConfig;
|
||||||
extern int32_t tsdmConfigVersion;
|
extern int32_t tsdmConfigVersion;
|
||||||
extern int32_t tsmmConfigVersion;
|
|
||||||
extern int32_t tsConfigInited;
|
extern int32_t tsConfigInited;
|
||||||
extern int32_t tsStatusInterval;
|
extern int32_t tsStatusInterval;
|
||||||
extern int32_t tsNumOfSupportVnodes;
|
extern int32_t tsNumOfSupportVnodes;
|
||||||
|
|
|
@ -46,7 +46,6 @@ uint16_t tsServerPort = 6030;
|
||||||
int32_t tsVersion = 30000000;
|
int32_t tsVersion = 30000000;
|
||||||
int32_t tsForceReadConfig = 0;
|
int32_t tsForceReadConfig = 0;
|
||||||
int32_t tsdmConfigVersion = -1;
|
int32_t tsdmConfigVersion = -1;
|
||||||
int32_t tsmmConfigVersion = -1;
|
|
||||||
int32_t tsConfigInited = 0;
|
int32_t tsConfigInited = 0;
|
||||||
int32_t tsStatusInterval = 1; // second
|
int32_t tsStatusInterval = 1; // second
|
||||||
int32_t tsNumOfSupportVnodes = 256;
|
int32_t tsNumOfSupportVnodes = 256;
|
||||||
|
@ -2630,7 +2629,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
||||||
{"keepColumnName", &tsKeepColumnName},
|
{"keepColumnName", &tsKeepColumnName},
|
||||||
{"logKeepDays", &tsLogKeepDays},
|
{"logKeepDays", &tsLogKeepDays},
|
||||||
{"maxInsertBatchRows", &tsMaxInsertBatchRows},
|
{"maxInsertBatchRows", &tsMaxInsertBatchRows},
|
||||||
{"maxRetryWaitTime", &tsMaxRetryWaitTime},
|
|
||||||
{"minSlidingTime", &tsMinSlidingTime},
|
{"minSlidingTime", &tsMinSlidingTime},
|
||||||
{"minIntervalTime", &tsMinIntervalTime},
|
{"minIntervalTime", &tsMinIntervalTime},
|
||||||
{"numOfLogLines", &tsNumOfLogLines},
|
{"numOfLogLines", &tsNumOfLogLines},
|
||||||
|
@ -2641,13 +2639,10 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
||||||
{"queryNodeChunkSize", &tsQueryNodeChunkSize},
|
{"queryNodeChunkSize", &tsQueryNodeChunkSize},
|
||||||
{"queryUseNodeAllocator", &tsQueryUseNodeAllocator},
|
{"queryUseNodeAllocator", &tsQueryUseNodeAllocator},
|
||||||
{"smlDot2Underline", &tsSmlDot2Underline},
|
{"smlDot2Underline", &tsSmlDot2Underline},
|
||||||
{"shellActivityTimer", &tsShellActivityTimer},
|
|
||||||
{"useAdapter", &tsUseAdapter},
|
{"useAdapter", &tsUseAdapter},
|
||||||
{"experimental", &tsExperimental},
|
|
||||||
{"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags},
|
{"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags},
|
||||||
{"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay},
|
{"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay},
|
||||||
{"tsmaDataDeleteMark", &tsmaDataDeleteMark},
|
{"tsmaDataDeleteMark", &tsmaDataDeleteMark},
|
||||||
{"safetyCheckLevel", &tsSafetyCheckLevel},
|
|
||||||
{"bypassFlag", &tsBypassFlag}};
|
{"bypassFlag", &tsBypassFlag}};
|
||||||
|
|
||||||
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
|
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -17,10 +17,7 @@
|
||||||
|
|
||||||
void* serverLoop(void* param) {
|
void* serverLoop(void* param) {
|
||||||
TestServer* server = (TestServer*)param;
|
TestServer* server = (TestServer*)param;
|
||||||
|
cfgInit(&tsCfg);
|
||||||
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0) != 0){
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dmInit() != 0) {
|
if (dmInit() != 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -32,7 +32,8 @@ enum CfgAlterType {
|
||||||
|
|
||||||
static int32_t mndMCfgGetValInt32(SMCfgDnodeReq *pInMCfgReq, int32_t optLen, int32_t *pOutValue);
|
static int32_t mndMCfgGetValInt32(SMCfgDnodeReq *pInMCfgReq, int32_t optLen, int32_t *pOutValue);
|
||||||
static int32_t cfgUpdateItem(SConfigItem *pItem, SConfigObj *obj);
|
static int32_t cfgUpdateItem(SConfigItem *pItem, SConfigObj *obj);
|
||||||
static int32_t mndConfigUpdateTrans(SMnode *pMnode, const char *name, char *pValue, ECfgDataType dtype);
|
static int32_t mndConfigUpdateTrans(SMnode *pMnode, const char *name, char *pValue, ECfgDataType dtype,
|
||||||
|
int32_t tsmmConfigVersion);
|
||||||
static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq);
|
static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq);
|
||||||
static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp);
|
static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp);
|
||||||
static int32_t mndProcessConfigReq(SRpcMsg *pReq);
|
static int32_t mndProcessConfigReq(SRpcMsg *pReq);
|
||||||
|
@ -229,10 +230,18 @@ static int32_t mndProcessConfigReq(SRpcMsg *pReq) {
|
||||||
mError("failed to deserialize config req, since %s", terrstr());
|
mError("failed to deserialize config req, since %s", terrstr());
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SConfigObj *vObj = sdbAcquire(pMnode->pSdb, SDB_CFG, "tsmmConfigVersion");
|
||||||
|
if (vObj == NULL) {
|
||||||
|
mInfo("failed to acquire mnd config version, since %s", terrstr());
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
SArray *diffArray = taosArrayInit(16, sizeof(SConfigItem));
|
SArray *diffArray = taosArrayInit(16, sizeof(SConfigItem));
|
||||||
SConfigRsp configRsp = {0};
|
SConfigRsp configRsp = {0};
|
||||||
configRsp.forceReadConfig = configReq.forceReadConfig;
|
configRsp.forceReadConfig = configReq.forceReadConfig;
|
||||||
configRsp.cver = tsmmConfigVersion;
|
|
||||||
|
configRsp.cver = vObj->i32;
|
||||||
if (configRsp.forceReadConfig) {
|
if (configRsp.forceReadConfig) {
|
||||||
// compare config array from configReq with current config array
|
// compare config array from configReq with current config array
|
||||||
if (compareSConfigItemArrays(taosGetGlobalCfg(tsCfg), configReq.array, diffArray)) {
|
if (compareSConfigItemArrays(taosGetGlobalCfg(tsCfg), configReq.array, diffArray)) {
|
||||||
|
@ -242,7 +251,7 @@ static int32_t mndProcessConfigReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
configRsp.array = taosGetGlobalCfg(tsCfg);
|
configRsp.array = taosGetGlobalCfg(tsCfg);
|
||||||
if (configReq.cver == tsmmConfigVersion) {
|
if (configReq.cver == vObj->i32) {
|
||||||
configRsp.isVersionVerified = 1;
|
configRsp.isVersionVerified = 1;
|
||||||
} else {
|
} else {
|
||||||
configRsp.array = taosGetGlobalCfg(tsCfg);
|
configRsp.array = taosGetGlobalCfg(tsCfg);
|
||||||
|
@ -316,11 +325,12 @@ int32_t mndInitReadCfg(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
SConfigObj *obj = sdbAcquire(pMnode->pSdb, SDB_CFG, "tsmmConfigVersion");
|
SConfigObj *obj = sdbAcquire(pMnode->pSdb, SDB_CFG, "tsmmConfigVersion");
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
mInfo("failed to acquire mnd config version, since %s", terrstr());
|
code = mndInitWriteCfg(pMnode);
|
||||||
|
if (code != 0) {
|
||||||
|
mError("failed to init write cfg, since %s", terrstr());
|
||||||
|
}
|
||||||
|
mInfo("failed to acquire mnd config version, try to rebuild it , since %s", terrstr());
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
} else {
|
|
||||||
tsmmConfigVersion = obj->i32;
|
|
||||||
sdbRelease(pMnode->pSdb, obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = taosArrayGetSize(taosGetGlobalCfg(tsCfg));
|
sz = taosArrayGetSize(taosGetGlobalCfg(tsCfg));
|
||||||
|
@ -469,6 +479,11 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
|
||||||
int32_t lino = -1;
|
int32_t lino = -1;
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
SMCfgDnodeReq cfgReq = {0};
|
SMCfgDnodeReq cfgReq = {0};
|
||||||
|
SConfigObj *vObj = sdbAcquire(pMnode->pSdb, SDB_CFG, "tsmmConfigVersion");
|
||||||
|
if (vObj == NULL) {
|
||||||
|
mInfo("failed to acquire mnd config version, since %s", terrstr());
|
||||||
|
TAOS_RETURN(terrno);
|
||||||
|
}
|
||||||
TAOS_CHECK_RETURN(tDeserializeSMCfgDnodeReq(pReq->pCont, pReq->contLen, &cfgReq));
|
TAOS_CHECK_RETURN(tDeserializeSMCfgDnodeReq(pReq->pCont, pReq->contLen, &cfgReq));
|
||||||
int8_t updateIpWhiteList = 0;
|
int8_t updateIpWhiteList = 0;
|
||||||
mInfo("dnode:%d, start to config, option:%s, value:%s", cfgReq.dnodeId, cfgReq.config, cfgReq.value);
|
mInfo("dnode:%d, start to config, option:%s, value:%s", cfgReq.dnodeId, cfgReq.config, cfgReq.value);
|
||||||
|
@ -521,11 +536,12 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
|
||||||
code = TSDB_CODE_CFG_NOT_FOUND;
|
code = TSDB_CODE_CFG_NOT_FOUND;
|
||||||
goto _err_out;
|
goto _err_out;
|
||||||
}
|
}
|
||||||
if (pItem->category == CFG_CATEGORY_GLOBAL) {
|
|
||||||
TAOS_CHECK_GOTO(mndConfigUpdateTrans(pMnode, dcfgReq.config, dcfgReq.value, pItem->dtype), &lino, _err_out);
|
|
||||||
}
|
|
||||||
_send_req :
|
|
||||||
|
|
||||||
|
_send_req:
|
||||||
|
if (pItem->category == CFG_CATEGORY_GLOBAL) {
|
||||||
|
TAOS_CHECK_GOTO(mndConfigUpdateTrans(pMnode, dcfgReq.config, dcfgReq.value, pItem->dtype, ++vObj->i32), &lino,
|
||||||
|
_err_out);
|
||||||
|
}
|
||||||
{ // audit
|
{ // audit
|
||||||
char obj[50] = {0};
|
char obj[50] = {0};
|
||||||
(void)sprintf(obj, "%d", cfgReq.dnodeId);
|
(void)sprintf(obj, "%d", cfgReq.dnodeId);
|
||||||
|
@ -535,7 +551,7 @@ _send_req :
|
||||||
|
|
||||||
tFreeSMCfgDnodeReq(&cfgReq);
|
tFreeSMCfgDnodeReq(&cfgReq);
|
||||||
|
|
||||||
dcfgReq.version = tsmmConfigVersion;
|
dcfgReq.version = vObj->i32;
|
||||||
code = mndSendCfgDnodeReq(pMnode, cfgReq.dnodeId, &dcfgReq);
|
code = mndSendCfgDnodeReq(pMnode, cfgReq.dnodeId, &dcfgReq);
|
||||||
|
|
||||||
// dont care suss or succ;
|
// dont care suss or succ;
|
||||||
|
@ -577,25 +593,15 @@ _err:
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndConfigUpdateTrans(SMnode *pMnode, const char *name, char *pValue, ECfgDataType dtype) {
|
static int32_t mndConfigUpdateTrans(SMnode *pMnode, const char *name, char *pValue, ECfgDataType dtype,
|
||||||
|
int32_t tsmmConfigVersion) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
int32_t lino = -1;
|
int32_t lino = -1;
|
||||||
// SConfigObj *pVersion = sdbAcquire(pMnode->pSdb, SDB_CFG, "tsmmConfigVersion");
|
|
||||||
// if (pVersion == NULL) {
|
|
||||||
// mError("failed to acquire tsmmConfigVersion while update config, since %s", terrstr());
|
|
||||||
// code = terrno;
|
|
||||||
// goto _OVER;
|
|
||||||
// }
|
|
||||||
// pVersion->i32 = ++tsmmConfigVersion;
|
|
||||||
// SConfigObj *pObj = sdbAcquire(pMnode->pSdb, SDB_CFG, name);
|
|
||||||
// if (pObj == NULL) {
|
|
||||||
// mError("failed to acquire mnd config:%s while update config, since %s", name, terrstr());
|
|
||||||
// code = terrno;
|
|
||||||
// goto _OVER;
|
|
||||||
// }
|
|
||||||
SConfigObj pVersion = {0}, pObj = {0};
|
SConfigObj pVersion = {0}, pObj = {0};
|
||||||
pVersion.i32 = ++tsmmConfigVersion;
|
|
||||||
strncpy(pVersion.name, "tsmmConfigVersion", CFG_NAME_MAX_LEN);
|
strncpy(pVersion.name, "tsmmConfigVersion", CFG_NAME_MAX_LEN);
|
||||||
|
pVersion.i32 = tsmmConfigVersion;
|
||||||
|
pVersion.dtype = CFG_DTYPE_INT32;
|
||||||
|
|
||||||
pObj.dtype = dtype;
|
pObj.dtype = dtype;
|
||||||
strncpy(pObj.name, name, CFG_NAME_MAX_LEN);
|
strncpy(pObj.name, name, CFG_NAME_MAX_LEN);
|
||||||
|
@ -613,7 +619,6 @@ static int32_t mndConfigUpdateTrans(SMnode *pMnode, const char *name, char *pVal
|
||||||
code = 0;
|
code = 0;
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
--tsmmConfigVersion;
|
|
||||||
mError("failed to update config:%s to value:%s, since %s", name, pValue, tstrerror(code));
|
mError("failed to update config:%s to value:%s, since %s", name, pValue, tstrerror(code));
|
||||||
}
|
}
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
|
|
|
@ -822,7 +822,7 @@ SConfigObj *mndInitConfigVersion() {
|
||||||
}
|
}
|
||||||
strncpy(pObj->name, "tsmmConfigVersion", CFG_NAME_MAX_LEN);
|
strncpy(pObj->name, "tsmmConfigVersion", CFG_NAME_MAX_LEN);
|
||||||
pObj->dtype = CFG_DTYPE_INT32;
|
pObj->dtype = CFG_DTYPE_INT32;
|
||||||
pObj->i32 = ++tsmmConfigVersion;
|
pObj->i32 = 0;
|
||||||
return pObj;
|
return pObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,107 @@ class TDTestCase:
|
||||||
|
|
||||||
self.configration_dic = {
|
self.configration_dic = {
|
||||||
"cli": [
|
"cli": [
|
||||||
|
{
|
||||||
|
"name": "asyncLog",
|
||||||
|
"value": 0,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "enableQueryHb",
|
||||||
|
"value": 0,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keepColumnName",
|
||||||
|
"value": 1,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "logKeepDays",
|
||||||
|
"value": 30,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "maxInsertBatchRows",
|
||||||
|
"value": 2000000,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "minSlidingTime",
|
||||||
|
"value": 10000,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "minIntervalTime",
|
||||||
|
"value": 2,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "numOfLogLines",
|
||||||
|
"value": 20000000,
|
||||||
|
"category": "local",
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "querySmaOptimize",
|
||||||
|
"value": 1,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "queryPolicy",
|
||||||
|
"value": 3,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "queryTableNotExistAsEmpty",
|
||||||
|
"value": 1,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "queryPlannerTrace",
|
||||||
|
"value": 1,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "queryNodeChunkSize",
|
||||||
|
"value": 16 * 1024,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "queryUseNodeAllocator",
|
||||||
|
"value": 0,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "smlDot2Underline",
|
||||||
|
"value": 0,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "useAdapter",
|
||||||
|
"value": 1,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
# {
|
||||||
|
# "name": "multiResultFunctionStarReturnTags",
|
||||||
|
# "value": 1,
|
||||||
|
# "category": "local",
|
||||||
|
# },
|
||||||
|
{
|
||||||
|
"name": "maxTsmaCalcDelay",
|
||||||
|
"value": 1200,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tsmaDataDeleteMark",
|
||||||
|
"value": 1000 * 60 * 60 * 12,
|
||||||
|
"category": "local",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bypassFlag",
|
||||||
|
"value": 4,
|
||||||
|
"category": "local",
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"svr": [
|
"svr": [
|
||||||
{
|
{
|
||||||
|
@ -528,18 +629,17 @@ class TDTestCase:
|
||||||
tdLog.info("success to alter all configurations")
|
tdLog.info("success to alter all configurations")
|
||||||
|
|
||||||
tdLog.info("stop and restart taosd")
|
tdLog.info("stop and restart taosd")
|
||||||
time.sleep(3)
|
|
||||||
sc.dnodeStopAll()
|
sc.dnodeStopAll()
|
||||||
sc.dnodeStart(1)
|
sc.dnodeStart(1)
|
||||||
sc.dnodeStart(2)
|
sc.dnodeStart(2)
|
||||||
sc.dnodeStart(3)
|
sc.dnodeStart(3)
|
||||||
time.sleep(10)
|
|
||||||
|
|
||||||
for key in self.configration_dic:
|
for key in self.configration_dic:
|
||||||
if "cli" == key:
|
if "cli" == key:
|
||||||
for item in self.configration_dic[key]:
|
for item in self.configration_dic[key]:
|
||||||
actVal = self.cli_get_param_value(item["name"])
|
actVal = self.cli_get_param_value(item["name"])
|
||||||
assert str(actVal) == str(item["oldVal"]), f"item name: {item['name']}, Expected value: {item['value']}, actual value: {actVal}"
|
assert str(actVal) == str(item["value"]), f"item name: {item['name']}, Expected value: {item['value']}, actual value: {actVal}"
|
||||||
elif "svr" == key:
|
elif "svr" == key:
|
||||||
for item in self.configration_dic[key]:
|
for item in self.configration_dic[key]:
|
||||||
actVal = self.svr_get_param_value(item["name"])
|
actVal = self.svr_get_param_value(item["name"])
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
,,n,army,python3 ./test.py -f cmdline/fullopt.py
|
,,n,army,python3 ./test.py -f cmdline/fullopt.py
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/show.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f query/show.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f alter/alterConfig.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f alter/alterConfig.py -N 3
|
||||||
|
,,y,army,./pytest.sh python3 ./test.py -f alter/test_alter_config.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/subquery/subqueryBugs.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f query/subquery/subqueryBugs.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f storage/oneStageComp.py -N 3 -L 3 -D 1
|
,,y,army,./pytest.sh python3 ./test.py -f storage/oneStageComp.py -N 3 -L 3 -D 1
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f storage/compressBasic.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f storage/compressBasic.py -N 3
|
||||||
|
|
Loading…
Reference in New Issue