提交 37da0e66 编写于 作者: H Hui Li

[TD-1203]

上级 a8417e7b
...@@ -395,6 +395,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); ...@@ -395,6 +395,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_PORT_DNODEDNODE 5 #define TSDB_PORT_DNODEDNODE 5
#define TSDB_PORT_SYNC 10 #define TSDB_PORT_SYNC 10
#define TSDB_PORT_HTTP 11 #define TSDB_PORT_HTTP 11
#define TSDB_PORT_ARBITRATOR 12
#define TAOS_QTYPE_RPC 0 #define TAOS_QTYPE_RPC 0
#define TAOS_QTYPE_FWD 1 #define TAOS_QTYPE_FWD 1
......
...@@ -40,12 +40,16 @@ typedef struct { ...@@ -40,12 +40,16 @@ typedef struct {
void *pConn; void *pConn;
} SNodeConn; } SNodeConn;
uint16_t tsArbitratorPort = 0;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
char arbLogPath[TSDB_FILENAME_LEN + 16] = {0}; char arbLogPath[TSDB_FILENAME_LEN + 16] = {0};
tsArbitratorPort = tsServerPort + TSDB_PORT_ARBITRATOR;
for (int i=1; i<argc; ++i) { for (int i=1; i<argc; ++i) {
if (strcmp(argv[i], "-p")==0 && i < argc-1) { if (strcmp(argv[i], "-p")==0 && i < argc-1) {
tsServerPort = atoi(argv[++i]); tsArbitratorPort = atoi(argv[++i]);
} else if (strcmp(argv[i], "-d")==0 && i < argc-1) { } else if (strcmp(argv[i], "-d")==0 && i < argc-1) {
debugFlag = atoi(argv[++i]); debugFlag = atoi(argv[++i]);
} else if (strcmp(argv[i], "-g")==0 && i < argc-1) { } else if (strcmp(argv[i], "-g")==0 && i < argc-1) {
...@@ -53,14 +57,16 @@ int main(int argc, char *argv[]) { ...@@ -53,14 +57,16 @@ int main(int argc, char *argv[]) {
tstrncpy(arbLogPath, argv[i], sizeof(arbLogPath)); tstrncpy(arbLogPath, argv[i], sizeof(arbLogPath));
} else { } else {
printf("\nusage: %s [options] \n", argv[0]); printf("\nusage: %s [options] \n", argv[0]);
printf(" [-p port]: server port number, default is:%d\n", tsServerPort); printf(" [-p port]: arbitrator server port number, default is:%d\n", tsServerPort + TSDB_PORT_ARBITRATOR);
printf(" [-d debugFlag]: debug flag, default:%d\n", debugFlag); printf(" [-d debugFlag]: debug flag, option 131 | 135 | 143, default:0\n");
printf(" [-g logFilePath]: log file pathe, default:%s\n", arbLogPath); printf(" [-g logFilePath]: log file pathe, default:/arbitrator.log\n");
printf(" [-h help]: print out this help\n\n"); printf(" [-h help]: print out this help\n\n");
exit(0); exit(0);
} }
} }
sDebugFlag = debugFlag;
if (tsem_init(&tsArbSem, 0, 0) != 0) { if (tsem_init(&tsArbSem, 0, 0) != 0) {
printf("failed to create exit semphore\n"); printf("failed to create exit semphore\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -79,12 +85,11 @@ int main(int argc, char *argv[]) { ...@@ -79,12 +85,11 @@ int main(int argc, char *argv[]) {
taosInitLog(arbLogPath, 1000000, 10); taosInitLog(arbLogPath, 1000000, 10);
taosGetFqdn(tsNodeFqdn); taosGetFqdn(tsNodeFqdn);
tsSyncPort = tsServerPort + TSDB_PORT_SYNC;
SPoolInfo info; SPoolInfo info;
info.numOfThreads = 1; info.numOfThreads = 1;
info.serverIp = 0; info.serverIp = 0;
info.port = tsSyncPort; info.port = tsArbitratorPort;
info.bufferSize = 640000; info.bufferSize = 640000;
info.processBrokenLink = arbProcessBrokenLink; info.processBrokenLink = arbProcessBrokenLink;
info.processIncomingMsg = arbProcessPeerMsg; info.processIncomingMsg = arbProcessPeerMsg;
...@@ -96,7 +101,7 @@ int main(int argc, char *argv[]) { ...@@ -96,7 +101,7 @@ int main(int argc, char *argv[]) {
return -1; return -1;
} }
sInfo("TAOS arbitrator: %s:%d is running", tsNodeFqdn, tsServerPort); sInfo("TAOS arbitrator: %s:%d is running", tsNodeFqdn, tsArbitratorPort);
for (int res = tsem_wait(&tsArbSem); res != 0; res = tsem_wait(&tsArbSem)) { for (int res = tsem_wait(&tsArbSem); res != 0; res = tsem_wait(&tsArbSem)) {
if (res != EINTR) break; if (res != EINTR) break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册