enh: adjust request vote reply
This commit is contained in:
parent
cd19ff0173
commit
5b46cbefe9
|
@ -115,17 +115,6 @@ void syncAppendEntriesPrint2(char* s, const SyncAppendEntries* pMsg);
|
||||||
void syncAppendEntriesLog(const SyncAppendEntries* pMsg);
|
void syncAppendEntriesLog(const SyncAppendEntries* pMsg);
|
||||||
void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg);
|
void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg);
|
||||||
|
|
||||||
// ---------------------------------------------
|
|
||||||
|
|
||||||
typedef struct SOffsetAndContLen {
|
|
||||||
int32_t offset;
|
|
||||||
int32_t contLen;
|
|
||||||
} SOffsetAndContLen;
|
|
||||||
|
|
||||||
// data:
|
|
||||||
// block1: SOffsetAndContLen Array
|
|
||||||
// block2: entry Array
|
|
||||||
|
|
||||||
typedef struct SyncAppendEntriesReply {
|
typedef struct SyncAppendEntriesReply {
|
||||||
uint32_t bytes;
|
uint32_t bytes;
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
|
|
|
@ -1654,7 +1654,7 @@ void syncNodeVoteForSelf(SSyncNode* pSyncNode) {
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {0};
|
SRpcMsg rpcMsg = {0};
|
||||||
int32_t ret = syncBuildRequestVoteReply(&rpcMsg, pSyncNode->vgId);
|
int32_t ret = syncBuildRequestVoteReply(&rpcMsg, pSyncNode->vgId);
|
||||||
if (ret == 0) return;
|
if (ret != 0) return;
|
||||||
|
|
||||||
SyncRequestVoteReply* pMsg = rpcMsg.pCont;
|
SyncRequestVoteReply* pMsg = rpcMsg.pCont;
|
||||||
pMsg->srcId = pSyncNode->myRaftId;
|
pMsg->srcId = pSyncNode->myRaftId;
|
||||||
|
|
|
@ -141,7 +141,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
||||||
// send msg
|
// send msg
|
||||||
SRpcMsg rpcMsg = {0};
|
SRpcMsg rpcMsg = {0};
|
||||||
ret = syncBuildRequestVoteReply(&rpcMsg, ths->vgId);
|
ret = syncBuildRequestVoteReply(&rpcMsg, ths->vgId);
|
||||||
ASSERT(ret);
|
ASSERT(ret == 0 );
|
||||||
|
|
||||||
SyncRequestVoteReply* pReply = rpcMsg.pCont;
|
SyncRequestVoteReply* pReply = rpcMsg.pCont;
|
||||||
pReply->srcId = ths->myRaftId;
|
pReply->srcId = ths->myRaftId;
|
||||||
|
|
|
@ -58,6 +58,15 @@ void syncClientRequestBatchPrint2(char* s, const SyncClientRequestBatch* pMsg);
|
||||||
void syncClientRequestBatchLog(const SyncClientRequestBatch* pMsg);
|
void syncClientRequestBatchLog(const SyncClientRequestBatch* pMsg);
|
||||||
void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg);
|
void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg);
|
||||||
|
|
||||||
|
typedef struct SOffsetAndContLen {
|
||||||
|
int32_t offset;
|
||||||
|
int32_t contLen;
|
||||||
|
} SOffsetAndContLen;
|
||||||
|
|
||||||
|
// data:
|
||||||
|
// block1: SOffsetAndContLen Array
|
||||||
|
// block2: entry Array
|
||||||
|
|
||||||
typedef struct SyncAppendEntriesBatch {
|
typedef struct SyncAppendEntriesBatch {
|
||||||
uint32_t bytes;
|
uint32_t bytes;
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
|
|
Loading…
Reference in New Issue