[TD-926]
This commit is contained in:
parent
c02b53fcb4
commit
03f0231765
|
@ -4700,10 +4700,10 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
|
|||
} else if ((strncasecmp(cfgOptions[tokenBalance].name, pOptionToken->z, pOptionToken->n) == 0) &&
|
||||
(cfgOptions[tokenBalance].len == pOptionToken->n)) {
|
||||
SSQLToken* pValToken = &pOptions->a[2];
|
||||
int32_t vnodeIndex = 0;
|
||||
int32_t dnodeIndex = 0;
|
||||
int32_t vnodeId = 0;
|
||||
int32_t dnodeId = 0;
|
||||
strdequote(pValToken->z);
|
||||
bool parseOk = taosCheckBalanceCfgOptions(pValToken->z, &vnodeIndex, &dnodeIndex);
|
||||
bool parseOk = taosCheckBalanceCfgOptions(pValToken->z, &vnodeId, &dnodeId);
|
||||
if (!parseOk) {
|
||||
return TSDB_CODE_TSC_INVALID_SQL; // options value is invalid
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ bool taosCheckGlobalCfg();
|
|||
void taosSetAllDebugFlag();
|
||||
bool taosCfgDynamicOptions(char *msg);
|
||||
int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port);
|
||||
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeIndex, int32_t *dnodeIndex);
|
||||
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1315,7 +1315,7 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
|
|||
* alter dnode 1 balance "vnode:1-dnode:2"
|
||||
*/
|
||||
|
||||
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeIndex, int32_t *dnodeIndex) {
|
||||
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId) {
|
||||
int len = strlen(option);
|
||||
if (strncasecmp(option, "vnode:", 6) != 0) {
|
||||
return false;
|
||||
|
@ -1331,9 +1331,9 @@ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeIndex, int32_t
|
|||
return false;
|
||||
}
|
||||
|
||||
*vnodeIndex = strtol(option + 6, NULL, 10);
|
||||
*dnodeIndex = strtol(option + pos + 6, NULL, 10);
|
||||
if (*vnodeIndex <= 1 || *dnodeIndex <= 0) {
|
||||
*vnodeId = strtol(option + 6, NULL, 10);
|
||||
*dnodeId = strtol(option + pos + 6, NULL, 10);
|
||||
if (*vnodeId <= 1 || *dnodeId <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_EXIST, 0, 0x0332, "mnode vgro
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_REMOVE_MASTER, 0, 0x0333, "mnode cant not remove master")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_DNODES, 0, 0x0334, "mnode no enough dnodes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT, 0, 0x0335, "mnode cluster cfg inconsistent")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DNODE_CFG_OPTION, 0, 0x0336, "mnode invalid dnode cfg option")
|
||||
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, 0, 0x0340, "mnode accounts already exist")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ACCT, 0, 0x0341, "mnode invalid account")
|
||||
|
|
|
@ -29,7 +29,7 @@ void balanceAsyncNotify();
|
|||
void balanceSyncNotify();
|
||||
void balanceReset();
|
||||
int32_t balanceAllocVnodes(struct SVgObj *pVgroup);
|
||||
int32_t balanceCfgDnode(struct SDnodeObj *pDnode, const char *option);
|
||||
int32_t balanceAlterDnode(struct SDnodeObj *pDnode, int32_t vnodeId, int32_t dnodeId);
|
||||
int32_t balanceDropDnode(struct SDnodeObj *pDnode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -28,7 +28,7 @@ void balanceCleanUp() {}
|
|||
void balanceAsyncNotify() {}
|
||||
void balanceSyncNotify() {}
|
||||
void balanceReset() {}
|
||||
int32_t balanceCfgDnode(struct SDnodeObj *pDnode, const char *option) { return TSDB_CODE_SYN_NOT_ENABLED; }
|
||||
int32_t balanceAlterDnode(struct SDnodeObj *pDnode, int32_t vnodeId, int32_t dnodeId) { return TSDB_CODE_SYN_NOT_ENABLED; }
|
||||
|
||||
int32_t balanceAllocVnodes(SVgObj *pVgroup) {
|
||||
void * pIter = NULL;
|
||||
|
|
|
@ -295,10 +295,19 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
SRpcEpSet epSet = mnodeGetEpSetFromIp(pDnode->dnodeEp);
|
||||
mnodeDecDnodeRef(pDnode);
|
||||
|
||||
if (strncasecmp(pCmCfgDnode->config, "balance", 7) == 0) {
|
||||
return balanceCfgDnode(pDnode, pCmCfgDnode->config + 8);
|
||||
int32_t vnodeId = 0;
|
||||
int32_t dnodeId = 0;
|
||||
bool parseOk = taosCheckBalanceCfgOptions(pCmCfgDnode->config + 8, &vnodeId, &dnodeId);
|
||||
if (!parseOk) {
|
||||
mnodeDecDnodeRef(pDnode);
|
||||
return TSDB_CODE_MND_INVALID_DNODE_CFG_OPTION;
|
||||
}
|
||||
|
||||
int32_t code = balanceAlterDnode(pDnode, vnodeId, dnodeId);
|
||||
mnodeDecDnodeRef(pDnode);
|
||||
return code;
|
||||
} else {
|
||||
SMDCfgDnodeMsg *pMdCfgDnode = rpcMallocCont(sizeof(SMDCfgDnodeMsg));
|
||||
strcpy(pMdCfgDnode->ep, pCmCfgDnode->ep);
|
||||
|
@ -314,6 +323,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
mInfo("dnode:%s, is configured by %s", pCmCfgDnode->ep, pMsg->pUser->user);
|
||||
dnodeSendMsgToDnode(&epSet, &rpcMdCfgDnodeMsg);
|
||||
mnodeDecDnodeRef(pDnode);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ int64_t numOfThreads = 10;
|
|||
int64_t numOfTablesPerThread = 100;
|
||||
char dbName[32] = "db";
|
||||
char stableName[64] = "st";
|
||||
int32_t cache = 4;
|
||||
int32_t cache = 1;
|
||||
int32_t replica = 3;
|
||||
int32_t days = 10;
|
||||
int32_t interval = 1000;
|
||||
|
|
Loading…
Reference in New Issue