[TD-52] [TD-148] add cluster test script
This commit is contained in:
parent
0c23737dc5
commit
3e0bd397e9
|
@ -163,11 +163,13 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
|
|||
tscGetQueryInfoDetailSafely(&pSql->cmd, 0, &pQueryInfo);
|
||||
pQueryInfo->command = TSDB_SQL_HB;
|
||||
|
||||
pSql->cmd.command = TSDB_SQL_HB;
|
||||
if (TSDB_CODE_SUCCESS != tscAllocPayload(&(pSql->cmd), TSDB_DEFAULT_PAYLOAD_SIZE)) {
|
||||
tfree(pSql);
|
||||
return;
|
||||
}
|
||||
|
||||
pSql->cmd.command = TSDB_SQL_HB;
|
||||
pSql->param = pObj;
|
||||
pSql->pTscObj = pObj;
|
||||
pSql->signature = pSql;
|
||||
|
|
|
@ -67,7 +67,6 @@ int32_t tscInitRpc(const char *user, const char *secret) {
|
|||
rpcInit.label = "TSC-vnode";
|
||||
rpcInit.numOfThreads = tscNumOfThreads;
|
||||
rpcInit.cfp = tscProcessMsgFromServer;
|
||||
rpcInit.ufp = tscUpdateIpSet;
|
||||
rpcInit.sessions = tsMaxVnodeConnections;
|
||||
rpcInit.connType = TAOS_CONN_CLIENT;
|
||||
rpcInit.user = (char*)user;
|
||||
|
@ -96,6 +95,7 @@ int32_t tscInitRpc(const char *user, const char *secret) {
|
|||
rpcInit.label = "TSC-mgmt";
|
||||
rpcInit.numOfThreads = 1;
|
||||
rpcInit.cfp = tscProcessMsgFromServer;
|
||||
rpcInit.ufp = tscUpdateIpSet;
|
||||
rpcInit.sessions = tsMaxMgmtConnections;
|
||||
rpcInit.connType = TAOS_CONN_CLIENT;
|
||||
rpcInit.idleTime = 2000;
|
||||
|
|
|
@ -59,6 +59,19 @@ void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) {
|
|||
tsMnodeIpSet = *pIpSet;
|
||||
}
|
||||
|
||||
void dnodeGetMnodeIpSet(void *ipSetRaw, bool usePublicIp) {
|
||||
SRpcIpSet *ipSet = ipSetRaw;
|
||||
ipSet->numOfIps = tsMnodeInfos.nodeNum;
|
||||
ipSet->inUse = tsMnodeInfos.inUse;
|
||||
for (int32_t i = 0; i < tsMnodeInfos.nodeNum; ++i) {
|
||||
if (usePublicIp) {
|
||||
ipSet->ip[i] = tsMnodeInfos.nodeInfos[i].nodeIp;
|
||||
} else {
|
||||
ipSet->ip[i] = tsMnodeInfos.nodeInfos[i].nodeIp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t dnodeInitMClient() {
|
||||
dnodeReadDnodeCfg();
|
||||
tsRebootTime = taosGetTimestampSec();
|
||||
|
@ -138,7 +151,9 @@ static void dnodeProcessRspFromMnode(SRpcMsg *pMsg) {
|
|||
if (tsDnodeProcessMgmtRspFp[pMsg->msgType]) {
|
||||
(*tsDnodeProcessMgmtRspFp[pMsg->msgType])(pMsg);
|
||||
} else {
|
||||
dError("%s is not processed in mnode rpc client", taosMsg[pMsg->msgType]);
|
||||
dError("%s is not processed in dnode mclient", taosMsg[pMsg->msgType]);
|
||||
SRpcMsg rpcRsp = {.pCont = 0, .contLen = 0, .code = TSDB_CODE_OPS_NOT_SUPPORT, .handle = pMsg->handle};
|
||||
rpcSendResponse(&rpcRsp);
|
||||
}
|
||||
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
|
|
|
@ -88,7 +88,7 @@ static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) {
|
|||
if (dnodeProcessMgmtMsgFp[pMsg->msgType]) {
|
||||
(*dnodeProcessMgmtMsgFp[pMsg->msgType])(pMsg);
|
||||
} else {
|
||||
dError("%s is not processed in mserver", taosMsg[pMsg->msgType]);
|
||||
dError("%s is not processed in dnode mserver", taosMsg[pMsg->msgType]);
|
||||
rspMsg.code = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||
rpcSendResponse(&rspMsg);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
|
|
|
@ -43,6 +43,7 @@ void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code);
|
|||
|
||||
bool dnodeIsFirstDeploy();
|
||||
uint32_t dnodeGetMnodeMasteIp();
|
||||
void dnodeGetMnodeIpSet(void *ipSet, bool usePublicIp);
|
||||
void * dnodeGetMnodeInfos();
|
||||
int32_t dnodeGetDnodeId();
|
||||
|
||||
|
|
|
@ -79,7 +79,9 @@ static void mgmtProcessRspFromDnode(SRpcMsg *rpcMsg) {
|
|||
if (mgmtProcessDnodeRspFp[rpcMsg->msgType]) {
|
||||
(*mgmtProcessDnodeRspFp[rpcMsg->msgType])(rpcMsg);
|
||||
} else {
|
||||
mError("%s is not processed in dclient", taosMsg[rpcMsg->msgType]);
|
||||
mError("%s is not processed in mgmt dclient", taosMsg[rpcMsg->msgType]);
|
||||
SRpcMsg rpcRsp = {.pCont = 0, .contLen = 0, .code = TSDB_CODE_OPS_NOT_SUPPORT, .handle = rpcMsg->handle};
|
||||
rpcSendResponse(&rpcRsp);
|
||||
}
|
||||
|
||||
rpcFreeCont(rpcMsg->pCont);
|
||||
|
|
|
@ -108,8 +108,12 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
|
|||
bool usePublicIp = false;
|
||||
|
||||
SRpcIpSet ipSet = {0};
|
||||
mgmtGetMnodeIpSet(&ipSet, usePublicIp);
|
||||
mTrace("conn from dnode ip:%s redirect msg", taosIpStr(connInfo.clientIp));
|
||||
ipSet.port = tsMnodeDnodePort;
|
||||
dnodeGetMnodeIpSet(&ipSet, usePublicIp);
|
||||
mTrace("conn from dnode ip:%s user:%s redirect msg, inUse:%d", taosIpStr(connInfo.clientIp), connInfo.user, ipSet.inUse);
|
||||
for (int32_t i = 0; i < ipSet.numOfIps; ++i) {
|
||||
mTrace("index:%d ip:%s", i, taosIpStr(ipSet.ip[i]));
|
||||
}
|
||||
rpcSendRedirectRsp(rpcMsg->handle, &ipSet);
|
||||
return;
|
||||
}
|
||||
|
@ -119,7 +123,8 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
|
|||
memcpy(pMsg, rpcMsg, sizeof(SRpcMsg));
|
||||
mgmtAddToDServerQueue(pMsg);
|
||||
} else {
|
||||
mError("%s is not processed in dserver", taosMsg[rpcMsg->msgType]);
|
||||
mError("%s is not processed in mgmt dserver", taosMsg[rpcMsg->msgType]);
|
||||
mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_MSG_NOT_PROCESSED);
|
||||
rpcFreeCont(rpcMsg->pCont);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,8 +151,13 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) {
|
|||
bool usePublicIp = (connInfo.serverIp == tsPublicIpInt);
|
||||
|
||||
SRpcIpSet ipSet = {0};
|
||||
mgmtGetMnodeIpSet(&ipSet, usePublicIp);
|
||||
mTrace("conn from ip:%s user:%s redirect msg", taosIpStr(connInfo.clientIp), connInfo.user);
|
||||
ipSet.port = tsMnodeShellPort;
|
||||
dnodeGetMnodeIpSet(&ipSet, usePublicIp);
|
||||
mTrace("conn from shell ip:%s user:%s redirect msg, inUse:%d", taosIpStr(connInfo.clientIp), connInfo.user, ipSet.inUse);
|
||||
for (int32_t i = 0; i < ipSet.numOfIps; ++i) {
|
||||
mTrace("index:%d ip:%s", i, taosIpStr(ipSet.ip[i]));
|
||||
}
|
||||
|
||||
rpcSendRedirectRsp(rpcMsg->handle, &ipSet);
|
||||
return;
|
||||
}
|
||||
|
@ -429,9 +434,9 @@ static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) {
|
|||
connect_over:
|
||||
rpcRsp.code = code;
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mLError("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
mLError("user:%s login from %s, result:%s", connInfo.user, taosIpStr(connInfo.clientIp), tstrerror(code));
|
||||
} else {
|
||||
mLPrint("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
|
||||
mLPrint("user:%s login from %s, result:%s", connInfo.user, taosIpStr(connInfo.clientIp), tstrerror(code));
|
||||
rpcRsp.pCont = pConnectRsp;
|
||||
rpcRsp.contLen = sizeof(SCMConnectRsp);
|
||||
}
|
||||
|
@ -488,7 +493,7 @@ static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg) {
|
|||
}
|
||||
|
||||
static void mgmtProcessUnSupportMsg(SRpcMsg *rpcMsg) {
|
||||
mError("%s is not processed in shell", taosMsg[rpcMsg->msgType]);
|
||||
mError("%s is not processed in mnode shell", taosMsg[rpcMsg->msgType]);
|
||||
SRpcMsg rpcRsp = {
|
||||
.msgType = 0,
|
||||
.pCont = 0,
|
||||
|
|
|
@ -93,7 +93,7 @@ echo "privateIp $NODE_IP" >> $TAOS_CFG
|
|||
echo "dDebugFlag 199" >> $TAOS_CFG
|
||||
echo "mDebugFlag 199" >> $TAOS_CFG
|
||||
echo "sdbDebugFlag 199" >> $TAOS_CFG
|
||||
echo "rpcDebugFlag 131" >> $TAOS_CFG
|
||||
echo "rpcDebugFlag 135" >> $TAOS_CFG
|
||||
echo "tmrDebugFlag 131" >> $TAOS_CFG
|
||||
echo "cDebugFlag 135" >> $TAOS_CFG
|
||||
echo "httpDebugFlag 131" >> $TAOS_CFG
|
||||
|
|
|
@ -116,7 +116,7 @@ sleep 8000
|
|||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data3_1
|
||||
$dnode2Role = $data3_2
|
||||
$dnode2Role = $data3_4
|
||||
$dnode3Role = $data3_3
|
||||
print 192.168.0.1 ==> $dnode1Role
|
||||
print 192.168.0.2 ==> $dnode2Role
|
||||
|
@ -138,13 +138,13 @@ sleep 10000
|
|||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data3_1
|
||||
$dnode2Role = $data3_2
|
||||
$dnode2Role = $data3_4
|
||||
$dnode3Role = $data3_3
|
||||
print 192.168.0.1 ==> $dnode1Role
|
||||
print 192.168.0.2 ==> $dnode2Role
|
||||
print 192.168.0.3 ==> $dnode3Role
|
||||
|
||||
if $dnode1Role != undecided then
|
||||
if $dnode1Role != offline then
|
||||
return -1
|
||||
endi
|
||||
#if $dnode2Role != master then
|
||||
|
|
|
@ -183,7 +183,7 @@ endi
|
|||
|
||||
print ============== step7
|
||||
system sh/exec_up.sh -n dnode1 -s stop
|
||||
sleep 10000
|
||||
sleep 4000
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data3_1
|
||||
|
@ -195,7 +195,7 @@ print 192.168.0.2 ==> $dnode2Role
|
|||
print 192.168.0.3 ==> $dnode3Role
|
||||
print 192.168.0.4 ==> $dnode4Role
|
||||
|
||||
if $dnode1Role != undecided then
|
||||
if $dnode1Role != offline then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
@ -205,7 +205,7 @@ sleep 8000
|
|||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data3_1
|
||||
$dnode2Role = $data3_2
|
||||
$dnode2Role = $data3_5
|
||||
$dnode3Role = $data3_3
|
||||
$dnode4Role = $data3_4
|
||||
print 192.168.0.1 ==> $dnode1Role
|
||||
|
|
Loading…
Reference in New Issue