提交 8057e44d 编写于 作者: M Minghao Li

sync modify timer

上级 398d5ec3
...@@ -41,7 +41,8 @@ static void syncIOTickPingFunc(void *param, void *tmrId); ...@@ -41,7 +41,8 @@ static void syncIOTickPingFunc(void *param, void *tmrId);
// public function ------------ // public function ------------
int32_t syncIOSendMsg(void *clientRpc, const SEpSet *pEpSet, SRpcMsg *pMsg) { int32_t syncIOSendMsg(void *clientRpc, const SEpSet *pEpSet, SRpcMsg *pMsg) {
sTrace("syncIOSendMsg ... "); sTrace("<--- syncIOSendMsg ---> clientRpc:%p, numOfEps:%d, inUse:%d, destAddr:%s-%u", clientRpc, pEpSet->numOfEps,
pEpSet->inUse, pEpSet->eps[0].fqdn, pEpSet->eps[0].port);
pMsg->handle = NULL; pMsg->handle = NULL;
rpcSendRequest(clientRpc, pEpSet, pMsg, NULL); rpcSendRequest(clientRpc, pEpSet, pMsg, NULL);
return 0; return 0;
...@@ -54,6 +55,7 @@ int32_t syncIOStart(char *host, uint16_t port) { ...@@ -54,6 +55,7 @@ int32_t syncIOStart(char *host, uint16_t port) {
int32_t ret = syncIOStartInternal(gSyncIO); int32_t ret = syncIOStartInternal(gSyncIO);
assert(ret == 0); assert(ret == 0);
sTrace("syncIOStart ok, gSyncIO:%p gSyncIO->clientRpc:%p", gSyncIO, gSyncIO->clientRpc);
return 0; return 0;
} }
......
...@@ -184,7 +184,7 @@ static int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, Syn ...@@ -184,7 +184,7 @@ static int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, Syn
SyncPing* pMsg2 = rpcMsg.pCont; SyncPing* pMsg2 = rpcMsg.pCont;
cJSON* pJson = syncPing2Json(pMsg2); cJSON* pJson = syncPing2Json(pMsg2);
char* serialized = cJSON_Print(pJson); char* serialized = cJSON_Print(pJson);
sTrace("syncNodePing pMsg2:%s ", serialized); sTrace("syncNodePing rpcMsg.pCont:%s ", serialized);
free(serialized); free(serialized);
cJSON_Delete(pJson); cJSON_Delete(pJson);
} }
...@@ -253,12 +253,16 @@ static void syncNodePingTimerCb(void* param, void* tmrId) { ...@@ -253,12 +253,16 @@ static void syncNodePingTimerCb(void* param, void* tmrId) {
++(pSyncNode->pingTimerCounter); ++(pSyncNode->pingTimerCounter);
// pSyncNode->pingTimerMS += 100; // pSyncNode->pingTimerMS += 100;
sTrace("pSyncNode->pingTimerCounter:%lu, pSyncNode->pingTimerMS:%d, pSyncNode->pPingTimer:%p, tmrId:%p ", sTrace(
pSyncNode->pingTimerCounter, pSyncNode->pingTimerMS, pSyncNode->pPingTimer, tmrId); "syncNodePingTimerCb: pSyncNode->pingTimerCounter:%lu, pSyncNode->pingTimerMS:%d, pSyncNode->pPingTimer:%p, "
"tmrId:%p ",
pSyncNode->pingTimerCounter, pSyncNode->pingTimerMS, pSyncNode->pPingTimer, tmrId);
syncNodePingAll(pSyncNode);
taosTmrReset(syncNodePingTimerCb, pSyncNode->pingTimerMS, pSyncNode, &gSyncEnv->pTimerManager, taosTmrReset(syncNodePingTimerCb, pSyncNode->pingTimerMS, pSyncNode, &gSyncEnv->pTimerManager,
&pSyncNode->pPingTimer); &pSyncNode->pPingTimer);
} else {
syncNodePingAll(pSyncNode); sTrace("syncNodePingTimerCb: pingTimerStart:%u ", pSyncNode->pingTimerStart);
} }
} }
\ No newline at end of file
...@@ -70,7 +70,7 @@ cJSON* syncPing2Json(const SyncPing* pMsg) { ...@@ -70,7 +70,7 @@ cJSON* syncPing2Json(const SyncPing* pMsg) {
cJSON* pDestId = cJSON_CreateObject(); cJSON* pDestId = cJSON_CreateObject();
cJSON_AddNumberToObject(pDestId, "addr", pMsg->destId.addr); cJSON_AddNumberToObject(pDestId, "addr", pMsg->destId.addr);
cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId);
cJSON_AddItemToObject(pRoot, "srcId", pDestId); cJSON_AddItemToObject(pRoot, "destId", pDestId);
cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen);
cJSON_AddStringToObject(pRoot, "data", pMsg->data); cJSON_AddStringToObject(pRoot, "data", pMsg->data);
...@@ -145,7 +145,7 @@ cJSON* syncPingReply2Json(const SyncPingReply* pMsg) { ...@@ -145,7 +145,7 @@ cJSON* syncPingReply2Json(const SyncPingReply* pMsg) {
cJSON* pDestId = cJSON_CreateObject(); cJSON* pDestId = cJSON_CreateObject();
cJSON_AddNumberToObject(pDestId, "addr", pMsg->destId.addr); cJSON_AddNumberToObject(pDestId, "addr", pMsg->destId.addr);
cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId);
cJSON_AddItemToObject(pRoot, "srcId", pDestId); cJSON_AddItemToObject(pRoot, "destId", pDestId);
cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen); cJSON_AddNumberToObject(pRoot, "dataLen", pMsg->dataLen);
cJSON_AddStringToObject(pRoot, "data", pMsg->data); cJSON_AddStringToObject(pRoot, "data", pMsg->data);
......
...@@ -51,11 +51,10 @@ void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) { ...@@ -51,11 +51,10 @@ void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) {
pEpSet->numOfEps = 1; pEpSet->numOfEps = 1;
pEpSet->inUse = 0; pEpSet->inUse = 0;
pEpSet->eps[0].port = port; pEpSet->eps[0].port = port;
snprintf(epSet.eps[0].fqdn, sizeof(epSet.eps[0].fqdn), host); snprintf(pEpSet->eps[0].fqdn, sizeof(pEpSet->eps[0].fqdn), "%s", host);
*/ */
pEpSet->inUse = 0; pEpSet->inUse = 0;
pEpSet->numOfEps = 1; pEpSet->numOfEps = 0;
addEpIntoEpSet(pEpSet, host, port); addEpIntoEpSet(pEpSet, host, port);
} }
......
...@@ -34,7 +34,7 @@ int main() { ...@@ -34,7 +34,7 @@ int main() {
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
rpcMsg.contLen = 64; rpcMsg.contLen = 64;
rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
snprintf((char*)rpcMsg.pCont, rpcMsg.contLen, "%s", "syncIOSendMsgTest"); snprintf((char *)rpcMsg.pCont, rpcMsg.contLen, "%s", "syncIOSendMsgTest");
rpcMsg.handle = NULL; rpcMsg.handle = NULL;
rpcMsg.msgType = 77; rpcMsg.msgType = 77;
......
...@@ -34,7 +34,7 @@ int main() { ...@@ -34,7 +34,7 @@ int main() {
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
rpcMsg.contLen = 64; rpcMsg.contLen = 64;
rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
snprintf((char*)rpcMsg.pCont, rpcMsg.contLen, "%s", "syncIOSendMsgTest"); snprintf((char *)rpcMsg.pCont, rpcMsg.contLen, "%s", "syncIOSendMsgTest");
rpcMsg.handle = NULL; rpcMsg.handle = NULL;
rpcMsg.msgType = 77; rpcMsg.msgType = 77;
......
...@@ -28,13 +28,16 @@ SSyncNode* doSync() { ...@@ -28,13 +28,16 @@ SSyncNode* doSync() {
pCfg->replicaNum = 1; pCfg->replicaNum = 1;
pCfg->nodeInfo[0].nodePort = 7010; pCfg->nodeInfo[0].nodePort = 7010;
taosGetFqdn(pCfg->nodeInfo[0].nodeFqdn); snprintf(pCfg->nodeInfo[0].nodeFqdn, sizeof(pCfg->nodeInfo[0].nodeFqdn), "%s", "127.0.0.1");
// taosGetFqdn(pCfg->nodeInfo[0].nodeFqdn);
pCfg->nodeInfo[1].nodePort = 7110; pCfg->nodeInfo[1].nodePort = 7110;
taosGetFqdn(pCfg->nodeInfo[1].nodeFqdn); snprintf(pCfg->nodeInfo[1].nodeFqdn, sizeof(pCfg->nodeInfo[1].nodeFqdn), "%s", "127.0.0.1");
// taosGetFqdn(pCfg->nodeInfo[1].nodeFqdn);
pCfg->nodeInfo[2].nodePort = 7210; pCfg->nodeInfo[2].nodePort = 7210;
taosGetFqdn(pCfg->nodeInfo[2].nodeFqdn); snprintf(pCfg->nodeInfo[2].nodeFqdn, sizeof(pCfg->nodeInfo[2].nodeFqdn), "%s", "127.0.0.1");
// taosGetFqdn(pCfg->nodeInfo[2].nodeFqdn);
SSyncNode* pSyncNode = syncNodeOpen(&syncInfo); SSyncNode* pSyncNode = syncNodeOpen(&syncInfo);
assert(pSyncNode != NULL); assert(pSyncNode != NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册