提交 3e0bd397 编写于 作者: S slguan

[TD-52] [TD-148] add cluster test script

上级 0c23737d
...@@ -163,11 +163,13 @@ void tscProcessActivityTimer(void *handle, void *tmrId) { ...@@ -163,11 +163,13 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
tscGetQueryInfoDetailSafely(&pSql->cmd, 0, &pQueryInfo); tscGetQueryInfoDetailSafely(&pSql->cmd, 0, &pQueryInfo);
pQueryInfo->command = TSDB_SQL_HB; pQueryInfo->command = TSDB_SQL_HB;
pSql->cmd.command = TSDB_SQL_HB;
if (TSDB_CODE_SUCCESS != tscAllocPayload(&(pSql->cmd), TSDB_DEFAULT_PAYLOAD_SIZE)) { if (TSDB_CODE_SUCCESS != tscAllocPayload(&(pSql->cmd), TSDB_DEFAULT_PAYLOAD_SIZE)) {
tfree(pSql); tfree(pSql);
return; return;
} }
pSql->cmd.command = TSDB_SQL_HB;
pSql->param = pObj; pSql->param = pObj;
pSql->pTscObj = pObj; pSql->pTscObj = pObj;
pSql->signature = pSql; pSql->signature = pSql;
......
...@@ -67,7 +67,6 @@ int32_t tscInitRpc(const char *user, const char *secret) { ...@@ -67,7 +67,6 @@ int32_t tscInitRpc(const char *user, const char *secret) {
rpcInit.label = "TSC-vnode"; rpcInit.label = "TSC-vnode";
rpcInit.numOfThreads = tscNumOfThreads; rpcInit.numOfThreads = tscNumOfThreads;
rpcInit.cfp = tscProcessMsgFromServer; rpcInit.cfp = tscProcessMsgFromServer;
rpcInit.ufp = tscUpdateIpSet;
rpcInit.sessions = tsMaxVnodeConnections; rpcInit.sessions = tsMaxVnodeConnections;
rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.user = (char*)user; rpcInit.user = (char*)user;
...@@ -96,6 +95,7 @@ int32_t tscInitRpc(const char *user, const char *secret) { ...@@ -96,6 +95,7 @@ int32_t tscInitRpc(const char *user, const char *secret) {
rpcInit.label = "TSC-mgmt"; rpcInit.label = "TSC-mgmt";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
rpcInit.cfp = tscProcessMsgFromServer; rpcInit.cfp = tscProcessMsgFromServer;
rpcInit.ufp = tscUpdateIpSet;
rpcInit.sessions = tsMaxMgmtConnections; rpcInit.sessions = tsMaxMgmtConnections;
rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.idleTime = 2000; rpcInit.idleTime = 2000;
......
...@@ -59,6 +59,19 @@ void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) { ...@@ -59,6 +59,19 @@ void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) {
tsMnodeIpSet = *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() { int32_t dnodeInitMClient() {
dnodeReadDnodeCfg(); dnodeReadDnodeCfg();
tsRebootTime = taosGetTimestampSec(); tsRebootTime = taosGetTimestampSec();
...@@ -138,7 +151,9 @@ static void dnodeProcessRspFromMnode(SRpcMsg *pMsg) { ...@@ -138,7 +151,9 @@ static void dnodeProcessRspFromMnode(SRpcMsg *pMsg) {
if (tsDnodeProcessMgmtRspFp[pMsg->msgType]) { if (tsDnodeProcessMgmtRspFp[pMsg->msgType]) {
(*tsDnodeProcessMgmtRspFp[pMsg->msgType])(pMsg); (*tsDnodeProcessMgmtRspFp[pMsg->msgType])(pMsg);
} else { } 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); rpcFreeCont(pMsg->pCont);
......
...@@ -88,7 +88,7 @@ static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) { ...@@ -88,7 +88,7 @@ static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) {
if (dnodeProcessMgmtMsgFp[pMsg->msgType]) { if (dnodeProcessMgmtMsgFp[pMsg->msgType]) {
(*dnodeProcessMgmtMsgFp[pMsg->msgType])(pMsg); (*dnodeProcessMgmtMsgFp[pMsg->msgType])(pMsg);
} else { } 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; rspMsg.code = TSDB_CODE_MSG_NOT_PROCESSED;
rpcSendResponse(&rspMsg); rpcSendResponse(&rspMsg);
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
......
...@@ -41,8 +41,9 @@ void *dnodeAllocateRqueue(void *pVnode); ...@@ -41,8 +41,9 @@ void *dnodeAllocateRqueue(void *pVnode);
void dnodeFreeRqueue(void *rqueue); void dnodeFreeRqueue(void *rqueue);
void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code); void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code);
bool dnodeIsFirstDeploy(); bool dnodeIsFirstDeploy();
uint32_t dnodeGetMnodeMasteIp(); uint32_t dnodeGetMnodeMasteIp();
void dnodeGetMnodeIpSet(void *ipSet, bool usePublicIp);
void * dnodeGetMnodeInfos(); void * dnodeGetMnodeInfos();
int32_t dnodeGetDnodeId(); int32_t dnodeGetDnodeId();
......
...@@ -79,7 +79,9 @@ static void mgmtProcessRspFromDnode(SRpcMsg *rpcMsg) { ...@@ -79,7 +79,9 @@ static void mgmtProcessRspFromDnode(SRpcMsg *rpcMsg) {
if (mgmtProcessDnodeRspFp[rpcMsg->msgType]) { if (mgmtProcessDnodeRspFp[rpcMsg->msgType]) {
(*mgmtProcessDnodeRspFp[rpcMsg->msgType])(rpcMsg); (*mgmtProcessDnodeRspFp[rpcMsg->msgType])(rpcMsg);
} else { } 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); rpcFreeCont(rpcMsg->pCont);
......
...@@ -108,8 +108,12 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) { ...@@ -108,8 +108,12 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
bool usePublicIp = false; bool usePublicIp = false;
SRpcIpSet ipSet = {0}; SRpcIpSet ipSet = {0};
mgmtGetMnodeIpSet(&ipSet, usePublicIp); ipSet.port = tsMnodeDnodePort;
mTrace("conn from dnode ip:%s redirect msg", taosIpStr(connInfo.clientIp)); 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); rpcSendRedirectRsp(rpcMsg->handle, &ipSet);
return; return;
} }
...@@ -119,7 +123,8 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) { ...@@ -119,7 +123,8 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
memcpy(pMsg, rpcMsg, sizeof(SRpcMsg)); memcpy(pMsg, rpcMsg, sizeof(SRpcMsg));
mgmtAddToDServerQueue(pMsg); mgmtAddToDServerQueue(pMsg);
} else { } 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); rpcFreeCont(rpcMsg->pCont);
} }
} }
......
...@@ -151,8 +151,13 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) { ...@@ -151,8 +151,13 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) {
bool usePublicIp = (connInfo.serverIp == tsPublicIpInt); bool usePublicIp = (connInfo.serverIp == tsPublicIpInt);
SRpcIpSet ipSet = {0}; SRpcIpSet ipSet = {0};
mgmtGetMnodeIpSet(&ipSet, usePublicIp); ipSet.port = tsMnodeShellPort;
mTrace("conn from ip:%s user:%s redirect msg", taosIpStr(connInfo.clientIp), connInfo.user); 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); rpcSendRedirectRsp(rpcMsg->handle, &ipSet);
return; return;
} }
...@@ -429,9 +434,9 @@ static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) { ...@@ -429,9 +434,9 @@ static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) {
connect_over: connect_over:
rpcRsp.code = code; rpcRsp.code = code;
if (code != TSDB_CODE_SUCCESS) { 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 { } 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.pCont = pConnectRsp;
rpcRsp.contLen = sizeof(SCMConnectRsp); rpcRsp.contLen = sizeof(SCMConnectRsp);
} }
...@@ -488,7 +493,7 @@ static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg) { ...@@ -488,7 +493,7 @@ static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg) {
} }
static void mgmtProcessUnSupportMsg(SRpcMsg *rpcMsg) { 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 = { SRpcMsg rpcRsp = {
.msgType = 0, .msgType = 0,
.pCont = 0, .pCont = 0,
......
...@@ -93,7 +93,7 @@ echo "privateIp $NODE_IP" >> $TAOS_CFG ...@@ -93,7 +93,7 @@ echo "privateIp $NODE_IP" >> $TAOS_CFG
echo "dDebugFlag 199" >> $TAOS_CFG echo "dDebugFlag 199" >> $TAOS_CFG
echo "mDebugFlag 199" >> $TAOS_CFG echo "mDebugFlag 199" >> $TAOS_CFG
echo "sdbDebugFlag 199" >> $TAOS_CFG echo "sdbDebugFlag 199" >> $TAOS_CFG
echo "rpcDebugFlag 131" >> $TAOS_CFG echo "rpcDebugFlag 135" >> $TAOS_CFG
echo "tmrDebugFlag 131" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG
echo "cDebugFlag 135" >> $TAOS_CFG echo "cDebugFlag 135" >> $TAOS_CFG
echo "httpDebugFlag 131" >> $TAOS_CFG echo "httpDebugFlag 131" >> $TAOS_CFG
......
...@@ -116,7 +116,7 @@ sleep 8000 ...@@ -116,7 +116,7 @@ sleep 8000
sql show mnodes sql show mnodes
$dnode1Role = $data3_1 $dnode1Role = $data3_1
$dnode2Role = $data3_2 $dnode2Role = $data3_4
$dnode3Role = $data3_3 $dnode3Role = $data3_3
print 192.168.0.1 ==> $dnode1Role print 192.168.0.1 ==> $dnode1Role
print 192.168.0.2 ==> $dnode2Role print 192.168.0.2 ==> $dnode2Role
...@@ -138,13 +138,13 @@ sleep 10000 ...@@ -138,13 +138,13 @@ sleep 10000
sql show mnodes sql show mnodes
$dnode1Role = $data3_1 $dnode1Role = $data3_1
$dnode2Role = $data3_2 $dnode2Role = $data3_4
$dnode3Role = $data3_3 $dnode3Role = $data3_3
print 192.168.0.1 ==> $dnode1Role print 192.168.0.1 ==> $dnode1Role
print 192.168.0.2 ==> $dnode2Role print 192.168.0.2 ==> $dnode2Role
print 192.168.0.3 ==> $dnode3Role print 192.168.0.3 ==> $dnode3Role
if $dnode1Role != undecided then if $dnode1Role != offline then
return -1 return -1
endi endi
#if $dnode2Role != master then #if $dnode2Role != master then
......
...@@ -183,7 +183,7 @@ endi ...@@ -183,7 +183,7 @@ endi
print ============== step7 print ============== step7
system sh/exec_up.sh -n dnode1 -s stop system sh/exec_up.sh -n dnode1 -s stop
sleep 10000 sleep 4000
sql show mnodes sql show mnodes
$dnode1Role = $data3_1 $dnode1Role = $data3_1
...@@ -195,7 +195,7 @@ print 192.168.0.2 ==> $dnode2Role ...@@ -195,7 +195,7 @@ print 192.168.0.2 ==> $dnode2Role
print 192.168.0.3 ==> $dnode3Role print 192.168.0.3 ==> $dnode3Role
print 192.168.0.4 ==> $dnode4Role print 192.168.0.4 ==> $dnode4Role
if $dnode1Role != undecided then if $dnode1Role != offline then
return -1 return -1
endi endi
...@@ -205,7 +205,7 @@ sleep 8000 ...@@ -205,7 +205,7 @@ sleep 8000
sql show mnodes sql show mnodes
$dnode1Role = $data3_1 $dnode1Role = $data3_1
$dnode2Role = $data3_2 $dnode2Role = $data3_5
$dnode3Role = $data3_3 $dnode3Role = $data3_3
$dnode4Role = $data3_4 $dnode4Role = $data3_4
print 192.168.0.1 ==> $dnode1Role print 192.168.0.1 ==> $dnode1Role
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册