[TD-2785]<enhance>: Allow to judge the status of sync and arbitrator ports
This commit is contained in:
parent
0a46dd0f64
commit
be4fd9831a
|
@ -47,7 +47,7 @@ static struct argp_option options[] = {
|
||||||
{"thread", 'T', "THREADNUM", 0, "Number of threads when using multi-thread to import data."},
|
{"thread", 'T', "THREADNUM", 0, "Number of threads when using multi-thread to import data."},
|
||||||
{"database", 'd', "DATABASE", 0, "Database to use when connecting to the server."},
|
{"database", 'd', "DATABASE", 0, "Database to use when connecting to the server."},
|
||||||
{"timezone", 't', "TIMEZONE", 0, "Time zone of the shell, default is local."},
|
{"timezone", 't', "TIMEZONE", 0, "Time zone of the shell, default is local."},
|
||||||
{"netrole", 'n', "NETROLE", 0, "Net role when network connectivity test, default is startup, options: client|server|rpc|startup."},
|
{"netrole", 'n', "NETROLE", 0, "Net role when network connectivity test, default is startup, options: client|server|rpc|startup|sync."},
|
||||||
{"pktlen", 'l', "PKTLEN", 0, "Packet length used for net test, default is 1000 bytes."},
|
{"pktlen", 'l', "PKTLEN", 0, "Packet length used for net test, default is 1000 bytes."},
|
||||||
{0}};
|
{0}};
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void printHelp() {
|
||||||
printf("%s%s\n", indent, "-t");
|
printf("%s%s\n", indent, "-t");
|
||||||
printf("%s%s%s\n", indent, indent, "Time zone of the shell, default is local.");
|
printf("%s%s%s\n", indent, indent, "Time zone of the shell, default is local.");
|
||||||
printf("%s%s\n", indent, "-n");
|
printf("%s%s\n", indent, "-n");
|
||||||
printf("%s%s%s\n", indent, indent, "Net role when network connectivity test, default is startup, options: client|server|rpc|startup.");
|
printf("%s%s%s\n", indent, indent, "Net role when network connectivity test, default is startup, options: client|server|rpc|startup|sync.");
|
||||||
printf("%s%s\n", indent, "-l");
|
printf("%s%s\n", indent, "-l");
|
||||||
printf("%s%s%s\n", indent, indent, "Packet length used for net test, default is 1000 bytes.");
|
printf("%s%s%s\n", indent, indent, "Packet length used for net test, default is 1000 bytes.");
|
||||||
printf("%s%s\n", indent, "-V");
|
printf("%s%s\n", indent, "-V");
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "syncInt.h"
|
#include "syncInt.h"
|
||||||
#include "syncTcp.h"
|
#include "syncTcp.h"
|
||||||
|
|
||||||
|
extern void syncProcessTestMsg(SSyncMsg *pMsg, SOCKET connFd);
|
||||||
static void arbSignalHandler(int32_t signum, void *sigInfo, void *context);
|
static void arbSignalHandler(int32_t signum, void *sigInfo, void *context);
|
||||||
static void arbProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp);
|
static void arbProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp);
|
||||||
static void arbProcessBrokenLink(int64_t rid);
|
static void arbProcessBrokenLink(int64_t rid);
|
||||||
|
@ -118,6 +119,11 @@ static void arbProcessIncommingConnection(SOCKET connFd, uint32_t sourceIp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg.head.type == TAOS_SMSG_TEST) {
|
||||||
|
syncProcessTestMsg(&msg, connFd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SNodeConn *pNode = calloc(sizeof(SNodeConn), 1);
|
SNodeConn *pNode = calloc(sizeof(SNodeConn), 1);
|
||||||
if (pNode == NULL) {
|
if (pNode == NULL) {
|
||||||
sError("failed to allocate memory since %s", strerror(errno));
|
sError("failed to allocate memory since %s", strerror(errno));
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ static void syncCreateRestoreDataThread(SSyncPeer *pPeer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void syncProcessTestMsg(SSyncMsg *pMsg, SOCKET connFd) {
|
void syncProcessTestMsg(SSyncMsg *pMsg, SOCKET connFd) {
|
||||||
sInfo("recv sync test msg");
|
sInfo("recv sync test msg");
|
||||||
|
|
||||||
SSyncMsg rsp;
|
SSyncMsg rsp;
|
||||||
|
|
|
@ -483,7 +483,8 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosNetCheckSync(host, endPort);
|
taosNetCheckSync(host, startPort + TSDB_PORT_SYNC);
|
||||||
|
taosNetCheckSync(host, startPort + TSDB_PORT_ARBITRATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosNetTestClient(char *host, int32_t startPort, int32_t pkgLen) {
|
static void taosNetTestClient(char *host, int32_t startPort, int32_t pkgLen) {
|
||||||
|
@ -550,6 +551,8 @@ void taosNetTest(char *role, char *host, int32_t port, int32_t pkgLen) {
|
||||||
taosNetTestServer(host, port, pkgLen);
|
taosNetTestServer(host, port, pkgLen);
|
||||||
} else if (0 == strcmp("rpc", role)) {
|
} else if (0 == strcmp("rpc", role)) {
|
||||||
taosNetTestRpc(host, port, pkgLen);
|
taosNetTestRpc(host, port, pkgLen);
|
||||||
|
} else if (0 == strcmp("sync", role)) {
|
||||||
|
taosNetCheckSync(host, port);
|
||||||
} else if (0 == strcmp("startup", role)) {
|
} else if (0 == strcmp("startup", role)) {
|
||||||
taosNetTestStartup(host, port);
|
taosNetTestStartup(host, port);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue