os: fix win sync compile error
This commit is contained in:
parent
240a4a197c
commit
d42c9b0eae
|
@ -262,128 +262,20 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader);
|
||||||
int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* pEntry);
|
int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* pEntry);
|
||||||
|
|
||||||
// trace log
|
// trace log
|
||||||
|
void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s);
|
||||||
|
void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s);
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
|
void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s);
|
||||||
char host[64];
|
void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s);
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"send sync-request-vote to %s:%d {term:%" PRIu64 ", lindex:%" PRId64 ", lterm:%" PRIu64 "}, %s", host, port,
|
|
||||||
pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
|
void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s);
|
||||||
char logBuf[256];
|
void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s);
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"recv sync-request-vote from %s:%d, {term:%" PRIu64 ", lindex:%" PRId64 ", lterm:%" PRIu64 "}, %s", host,
|
|
||||||
port, pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
|
void syncLogSendAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s);
|
||||||
char host[64];
|
void syncLogRecvAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s);
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf), "send sync-request-vote-reply to %s:%d {term:%" PRIu64 ", grant:%d}, %s", host, port,
|
|
||||||
pMsg->term, pMsg->voteGranted, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
|
void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s);
|
||||||
char host[64];
|
void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s);
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf), "recv sync-request-vote-reply from %s:%d {term:%" PRIu64 ", grant:%d}, %s", host,
|
|
||||||
port, pMsg->term, pMsg->voteGranted, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
|
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"send sync-append-entries to %s:%d, {term:%" PRIu64 ", pre-index:%" PRId64 ", pre-term:%" PRIu64
|
|
||||||
", pterm:%" PRIu64 ", cmt:%" PRId64
|
|
||||||
", "
|
|
||||||
"datalen:%d}, %s",
|
|
||||||
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex,
|
|
||||||
pMsg->dataLen, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
|
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"recv sync-append-entries from %s:%d {term:%" PRIu64 ", pre-index:%" PRIu64 ", pre-term:%" PRIu64
|
|
||||||
", cmt:%" PRIu64 ", pterm:%" PRIu64
|
|
||||||
", "
|
|
||||||
"datalen:%d}, %s",
|
|
||||||
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, pMsg->privateTerm,
|
|
||||||
pMsg->dataLen, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogSendAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
|
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"send sync-append-entries-batch to %s:%d, {term:%" PRIu64 ", pre-index:%" PRId64 ", pre-term:%" PRIu64
|
|
||||||
", pterm:%" PRIu64 ", cmt:%" PRId64 ", datalen:%d, count:%d}, %s",
|
|
||||||
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex,
|
|
||||||
pMsg->dataLen, pMsg->dataCount, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogRecvAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
|
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"recv sync-append-entries-batch from %s:%d, {term:%" PRIu64 ", pre-index:%" PRId64 ", pre-term:%" PRIu64
|
|
||||||
", pterm:%" PRIu64 ", cmt:%" PRId64 ", datalen:%d, count:%d}, %s",
|
|
||||||
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex,
|
|
||||||
pMsg->dataLen, pMsg->dataCount, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
|
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"send sync-append-entries-reply to %s:%d, {term:%" PRIu64 ", pterm:%" PRIu64 ", success:%d, match:%" PRId64
|
|
||||||
"}, %s",
|
|
||||||
host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->matchIndex, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
|
|
||||||
char host[64];
|
|
||||||
uint16_t port;
|
|
||||||
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
|
||||||
char logBuf[256];
|
|
||||||
snprintf(logBuf, sizeof(logBuf),
|
|
||||||
"recv sync-append-entries-reply from %s:%d {term:%" PRIu64 ", pterm:%" PRIu64 ", success:%d, match:%" PRId64
|
|
||||||
"}, %s",
|
|
||||||
host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->matchIndex, s);
|
|
||||||
syncNodeEventLog(pSyncNode, logBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for debug --------------
|
// for debug --------------
|
||||||
void syncNodePrint(SSyncNode* pObj);
|
void syncNodePrint(SSyncNode* pObj);
|
||||||
|
|
|
@ -2964,3 +2964,125 @@ bool syncNodeCanChange(SSyncNode* pSyncNode) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"send sync-request-vote to %s:%d {term:%" PRIu64 ", lindex:%" PRId64 ", lterm:%" PRIu64 "}, %s", host, port,
|
||||||
|
pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
|
||||||
|
char logBuf[256];
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"recv sync-request-vote from %s:%d, {term:%" PRIu64 ", lindex:%" PRId64 ", lterm:%" PRIu64 "}, %s", host,
|
||||||
|
port, pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf), "send sync-request-vote-reply to %s:%d {term:%" PRIu64 ", grant:%d}, %s", host, port,
|
||||||
|
pMsg->term, pMsg->voteGranted, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf), "recv sync-request-vote-reply from %s:%d {term:%" PRIu64 ", grant:%d}, %s", host,
|
||||||
|
port, pMsg->term, pMsg->voteGranted, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"send sync-append-entries to %s:%d, {term:%" PRIu64 ", pre-index:%" PRId64 ", pre-term:%" PRIu64
|
||||||
|
", pterm:%" PRIu64 ", cmt:%" PRId64
|
||||||
|
", "
|
||||||
|
"datalen:%d}, %s",
|
||||||
|
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex,
|
||||||
|
pMsg->dataLen, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"recv sync-append-entries from %s:%d {term:%" PRIu64 ", pre-index:%" PRIu64 ", pre-term:%" PRIu64
|
||||||
|
", cmt:%" PRIu64 ", pterm:%" PRIu64
|
||||||
|
", "
|
||||||
|
"datalen:%d}, %s",
|
||||||
|
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, pMsg->privateTerm,
|
||||||
|
pMsg->dataLen, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogSendAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"send sync-append-entries-batch to %s:%d, {term:%" PRIu64 ", pre-index:%" PRId64 ", pre-term:%" PRIu64
|
||||||
|
", pterm:%" PRIu64 ", cmt:%" PRId64 ", datalen:%d, count:%d}, %s",
|
||||||
|
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex,
|
||||||
|
pMsg->dataLen, pMsg->dataCount, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogRecvAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"recv sync-append-entries-batch from %s:%d, {term:%" PRIu64 ", pre-index:%" PRId64 ", pre-term:%" PRIu64
|
||||||
|
", pterm:%" PRIu64 ", cmt:%" PRId64 ", datalen:%d, count:%d}, %s",
|
||||||
|
host, port, pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->privateTerm, pMsg->commitIndex,
|
||||||
|
pMsg->dataLen, pMsg->dataCount, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"send sync-append-entries-reply to %s:%d, {term:%" PRIu64 ", pterm:%" PRIu64 ", success:%d, match:%" PRId64
|
||||||
|
"}, %s",
|
||||||
|
host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->matchIndex, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
|
||||||
|
char host[64];
|
||||||
|
uint16_t port;
|
||||||
|
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
|
||||||
|
char logBuf[256];
|
||||||
|
snprintf(logBuf, sizeof(logBuf),
|
||||||
|
"recv sync-append-entries-reply from %s:%d {term:%" PRIu64 ", pterm:%" PRIu64 ", success:%d, match:%" PRId64
|
||||||
|
"}, %s",
|
||||||
|
host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->matchIndex, s);
|
||||||
|
syncNodeEventLog(pSyncNode, logBuf);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue