提交 c79cc7e4 编写于 作者: H Hongze Cheng

more code format

上级 bb659995
...@@ -29,15 +29,15 @@ extern "C" { ...@@ -29,15 +29,15 @@ extern "C" {
#include "tqueue.h" #include "tqueue.h"
#include "trpc.h" #include "trpc.h"
#define TICK_Q_TIMER_MS 1000 #define TICK_Q_TIMER_MS 1000
#define TICK_Ping_TIMER_MS 1000 #define TICK_Ping_TIMER_MS 1000
typedef struct SSyncIO { typedef struct SSyncIO {
STaosQueue *pMsgQ; STaosQueue *pMsgQ;
STaosQset * pQset; STaosQset *pQset;
TdThread consumerTid; TdThread consumerTid;
void * serverRpc; void *serverRpc;
void * clientRpc; void *clientRpc;
SEpSet myAddr; SEpSet myAddr;
SMsgCb msgcb; SMsgCb msgcb;
......
...@@ -28,7 +28,7 @@ extern "C" { ...@@ -28,7 +28,7 @@ extern "C" {
#include "taosdef.h" #include "taosdef.h"
#define RAFT_STORE_BLOCK_SIZE 512 #define RAFT_STORE_BLOCK_SIZE 512
#define RAFT_STORE_PATH_LEN (TSDB_FILENAME_LEN * 2) #define RAFT_STORE_PATH_LEN (TSDB_FILENAME_LEN * 2)
typedef struct SRaftStore { typedef struct SRaftStore {
SyncTerm currentTerm; SyncTerm currentTerm;
...@@ -49,8 +49,8 @@ void raftStoreClearVote(SRaftStore *pRaftStore); ...@@ -49,8 +49,8 @@ void raftStoreClearVote(SRaftStore *pRaftStore);
void raftStoreNextTerm(SRaftStore *pRaftStore); void raftStoreNextTerm(SRaftStore *pRaftStore);
void raftStoreSetTerm(SRaftStore *pRaftStore, SyncTerm term); void raftStoreSetTerm(SRaftStore *pRaftStore, SyncTerm term);
int32_t raftStoreFromJson(SRaftStore *pRaftStore, cJSON *pJson); int32_t raftStoreFromJson(SRaftStore *pRaftStore, cJSON *pJson);
cJSON * raftStore2Json(SRaftStore *pRaftStore); cJSON *raftStore2Json(SRaftStore *pRaftStore);
char * raftStore2Str(SRaftStore *pRaftStore); char *raftStore2Str(SRaftStore *pRaftStore);
// for debug ------------------- // for debug -------------------
void raftStorePrint(SRaftStore *pObj); void raftStorePrint(SRaftStore *pObj);
......
...@@ -46,8 +46,8 @@ void voteGrantedUpdate(SVotesGranted *pVotesGranted, SSyncNode *pSyncN ...@@ -46,8 +46,8 @@ void voteGrantedUpdate(SVotesGranted *pVotesGranted, SSyncNode *pSyncN
bool voteGrantedMajority(SVotesGranted *pVotesGranted); bool voteGrantedMajority(SVotesGranted *pVotesGranted);
void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg); void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg);
void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term); void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term);
cJSON * voteGranted2Json(SVotesGranted *pVotesGranted); cJSON *voteGranted2Json(SVotesGranted *pVotesGranted);
char * voteGranted2Str(SVotesGranted *pVotesGranted); char *voteGranted2Str(SVotesGranted *pVotesGranted);
// for debug ------------------- // for debug -------------------
void voteGrantedPrint(SVotesGranted *pObj); void voteGrantedPrint(SVotesGranted *pObj);
...@@ -70,8 +70,8 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSync ...@@ -70,8 +70,8 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSync
bool votesResponded(SVotesRespond *pVotesRespond, const SRaftId *pRaftId); bool votesResponded(SVotesRespond *pVotesRespond, const SRaftId *pRaftId);
void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *pMsg); void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *pMsg);
void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term); void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term);
cJSON * votesRespond2Json(SVotesRespond *pVotesRespond); cJSON *votesRespond2Json(SVotesRespond *pVotesRespond);
char * votesRespond2Str(SVotesRespond *pVotesRespond); char *votesRespond2Str(SVotesRespond *pVotesRespond);
// for debug ------------------- // for debug -------------------
void votesRespondPrint(SVotesRespond *pObj); void votesRespondPrint(SVotesRespond *pObj);
......
...@@ -30,7 +30,7 @@ static int32_t syncIODestroy(SSyncIO *io); ...@@ -30,7 +30,7 @@ static int32_t syncIODestroy(SSyncIO *io);
static int32_t syncIOStartInternal(SSyncIO *io); static int32_t syncIOStartInternal(SSyncIO *io);
static int32_t syncIOStopInternal(SSyncIO *io); static int32_t syncIOStopInternal(SSyncIO *io);
static void * syncIOConsumerFunc(void *param); static void *syncIOConsumerFunc(void *param);
static void syncIOProcessRequest(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet); static void syncIOProcessRequest(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet);
static void syncIOProcessReply(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet); static void syncIOProcessReply(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet);
static int32_t syncIOAuth(void *parent, char *meterId, char *spi, char *encrypt, char *secret, char *ckey); static int32_t syncIOAuth(void *parent, char *meterId, char *spi, char *encrypt, char *secret, char *ckey);
...@@ -242,9 +242,9 @@ static int32_t syncIOStopInternal(SSyncIO *io) { ...@@ -242,9 +242,9 @@ static int32_t syncIOStopInternal(SSyncIO *io) {
} }
static void *syncIOConsumerFunc(void *param) { static void *syncIOConsumerFunc(void *param) {
SSyncIO * io = param; SSyncIO *io = param;
STaosQall *qall = taosAllocateQall(); STaosQall *qall = taosAllocateQall();
SRpcMsg * pRpcMsg, rpcMsg; SRpcMsg *pRpcMsg, rpcMsg;
SQueueInfo qinfo = {0}; SQueueInfo qinfo = {0};
while (1) { while (1) {
......
...@@ -52,9 +52,9 @@ int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg); ...@@ -52,9 +52,9 @@ int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg);
int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg); int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg);
// --------------------------------- // ---------------------------------
static void syncNodeFreeCb(void *param) { static void syncNodeFreeCb(void* param) {
syncNodeClose(param); syncNodeClose(param);
param = NULL; param = NULL;
} }
int32_t syncInit() { int32_t syncInit() {
...@@ -947,15 +947,15 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { ...@@ -947,15 +947,15 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
meta.batchSize = pSyncInfo->batchSize; meta.batchSize = pSyncInfo->batchSize;
ret = raftCfgCreateFile((SSyncCfg*)&(pSyncInfo->syncCfg), meta, pSyncNode->configPath); ret = raftCfgCreateFile((SSyncCfg*)&(pSyncInfo->syncCfg), meta, pSyncNode->configPath);
if (ret != 0) { if (ret != 0) {
sError("failed to create raft cfg file. configPath: %s", pSyncNode->configPath); sError("failed to create raft cfg file. configPath: %s", pSyncNode->configPath);
goto _error; goto _error;
} }
} else { } else {
// update syncCfg by raft_config.json // update syncCfg by raft_config.json
pSyncNode->pRaftCfg = raftCfgOpen(pSyncNode->configPath); pSyncNode->pRaftCfg = raftCfgOpen(pSyncNode->configPath);
if (pSyncNode->pRaftCfg == NULL) { if (pSyncNode->pRaftCfg == NULL) {
sError("failed to open raft cfg file. path:%s", pSyncNode->configPath); sError("failed to open raft cfg file. path:%s", pSyncNode->configPath);
goto _error; goto _error;
} }
pSyncInfo->syncCfg = pSyncNode->pRaftCfg->cfg; pSyncInfo->syncCfg = pSyncNode->pRaftCfg->cfg;
...@@ -985,8 +985,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { ...@@ -985,8 +985,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
// init internal // init internal
pSyncNode->myNodeInfo = pSyncNode->pRaftCfg->cfg.nodeInfo[pSyncNode->pRaftCfg->cfg.myIndex]; pSyncNode->myNodeInfo = pSyncNode->pRaftCfg->cfg.nodeInfo[pSyncNode->pRaftCfg->cfg.myIndex];
if (!syncUtilnodeInfo2raftId(&pSyncNode->myNodeInfo, pSyncNode->vgId, &pSyncNode->myRaftId)) { if (!syncUtilnodeInfo2raftId(&pSyncNode->myNodeInfo, pSyncNode->vgId, &pSyncNode->myRaftId)) {
sError("failed to determine my raft member id. vgId:%d", pSyncNode->vgId); sError("failed to determine my raft member id. vgId:%d", pSyncNode->vgId);
goto _error; goto _error;
} }
// init peersNum, peers, peersId // init peersNum, peers, peersId
...@@ -1000,17 +1000,17 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { ...@@ -1000,17 +1000,17 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
} }
for (int i = 0; i < pSyncNode->peersNum; ++i) { for (int i = 0; i < pSyncNode->peersNum; ++i) {
if (!syncUtilnodeInfo2raftId(&pSyncNode->peersNodeInfo[i], pSyncNode->vgId, &pSyncNode->peersId[i])) { if (!syncUtilnodeInfo2raftId(&pSyncNode->peersNodeInfo[i], pSyncNode->vgId, &pSyncNode->peersId[i])) {
sError("failed to determine raft member id. vgId:%d, peer:%d", pSyncNode->vgId, i); sError("failed to determine raft member id. vgId:%d, peer:%d", pSyncNode->vgId, i);
goto _error; goto _error;
} }
} }
// init replicaNum, replicasId // init replicaNum, replicasId
pSyncNode->replicaNum = pSyncNode->pRaftCfg->cfg.replicaNum; pSyncNode->replicaNum = pSyncNode->pRaftCfg->cfg.replicaNum;
for (int i = 0; i < pSyncNode->pRaftCfg->cfg.replicaNum; ++i) { for (int i = 0; i < pSyncNode->pRaftCfg->cfg.replicaNum; ++i) {
if(!syncUtilnodeInfo2raftId(&pSyncNode->pRaftCfg->cfg.nodeInfo[i], pSyncNode->vgId, &pSyncNode->replicasId[i])) { if (!syncUtilnodeInfo2raftId(&pSyncNode->pRaftCfg->cfg.nodeInfo[i], pSyncNode->vgId, &pSyncNode->replicasId[i])) {
sError("failed to determine raft member id. vgId:%d, replica:%d", pSyncNode->vgId, i); sError("failed to determine raft member id. vgId:%d, replica:%d", pSyncNode->vgId, i);
goto _error; goto _error;
} }
} }
...@@ -1090,8 +1090,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { ...@@ -1090,8 +1090,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
SSnapshot snapshot = {0}; SSnapshot snapshot = {0};
int32_t code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); int32_t code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);
if (code != 0) { if (code != 0) {
sError("failed to get snapshot info. vgId:%d, code:%d", pSyncNode->vgId, code); sError("failed to get snapshot info. vgId:%d, code:%d", pSyncNode->vgId, code);
goto _error; goto _error;
} }
if (snapshot.lastApplyIndex > commitIndex) { if (snapshot.lastApplyIndex > commitIndex) {
commitIndex = snapshot.lastApplyIndex; commitIndex = snapshot.lastApplyIndex;
...@@ -1191,8 +1191,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { ...@@ -1191,8 +1191,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
_error: _error:
if (pSyncInfo->pFsm) { if (pSyncInfo->pFsm) {
taosMemoryFree(pSyncInfo->pFsm); taosMemoryFree(pSyncInfo->pFsm);
pSyncInfo->pFsm = NULL; pSyncInfo->pFsm = NULL;
} }
syncNodeClose(pSyncNode); syncNodeClose(pSyncNode);
pSyncNode = NULL; pSyncNode = NULL;
......
...@@ -218,7 +218,7 @@ cJSON *raftStore2Json(SRaftStore *pRaftStore) { ...@@ -218,7 +218,7 @@ cJSON *raftStore2Json(SRaftStore *pRaftStore) {
char *raftStore2Str(SRaftStore *pRaftStore) { char *raftStore2Str(SRaftStore *pRaftStore) {
cJSON *pJson = raftStore2Json(pRaftStore); cJSON *pJson = raftStore2Json(pRaftStore);
char * serialized = cJSON_Print(pJson); char *serialized = cJSON_Print(pJson);
cJSON_Delete(pJson); cJSON_Delete(pJson);
return serialized; return serialized;
} }
......
...@@ -36,8 +36,8 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI ...@@ -36,8 +36,8 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI
if (condition) { if (condition) {
pSender = taosMemoryMalloc(sizeof(SSyncSnapshotSender)); pSender = taosMemoryMalloc(sizeof(SSyncSnapshotSender));
if (pSender == NULL) { if (pSender == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL; return NULL;
} }
memset(pSender, 0, sizeof(*pSender)); memset(pSender, 0, sizeof(*pSender));
......
...@@ -130,7 +130,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) { ...@@ -130,7 +130,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) {
char *voteGranted2Str(SVotesGranted *pVotesGranted) { char *voteGranted2Str(SVotesGranted *pVotesGranted) {
cJSON *pJson = voteGranted2Json(pVotesGranted); cJSON *pJson = voteGranted2Json(pVotesGranted);
char * serialized = cJSON_Print(pJson); char *serialized = cJSON_Print(pJson);
cJSON_Delete(pJson); cJSON_Delete(pJson);
return serialized; return serialized;
} }
...@@ -259,7 +259,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) { ...@@ -259,7 +259,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) {
char *votesRespond2Str(SVotesRespond *pVotesRespond) { char *votesRespond2Str(SVotesRespond *pVotesRespond) {
cJSON *pJson = votesRespond2Json(pVotesRespond); cJSON *pJson = votesRespond2Json(pVotesRespond);
char * serialized = cJSON_Print(pJson); char *serialized = cJSON_Print(pJson);
cJSON_Delete(pJson); cJSON_Delete(pJson);
return serialized; return serialized;
} }
......
...@@ -37,7 +37,7 @@ void test1() { ...@@ -37,7 +37,7 @@ void test1() {
void test2() { void test2() {
SyncAppendEntriesReply *pMsg = createMsg(); SyncAppendEntriesReply *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncAppendEntriesReplySerialize(pMsg, serialized, len); syncAppendEntriesReplySerialize(pMsg, serialized, len);
SyncAppendEntriesReply *pMsg2 = syncAppendEntriesReplyBuild(1000); SyncAppendEntriesReply *pMsg2 = syncAppendEntriesReplyBuild(1000);
syncAppendEntriesReplyDeserialize(serialized, len, pMsg2); syncAppendEntriesReplyDeserialize(serialized, len, pMsg2);
...@@ -52,7 +52,7 @@ void test2() { ...@@ -52,7 +52,7 @@ void test2() {
void test3() { void test3() {
SyncAppendEntriesReply *pMsg = createMsg(); SyncAppendEntriesReply *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncAppendEntriesReplySerialize2(pMsg, &len); char *serialized = syncAppendEntriesReplySerialize2(pMsg, &len);
SyncAppendEntriesReply *pMsg2 = syncAppendEntriesReplyDeserialize2(serialized, len); SyncAppendEntriesReply *pMsg2 = syncAppendEntriesReplyDeserialize2(serialized, len);
syncAppendEntriesReplyLog2((char *)"test3: syncAppendEntriesReplySerialize3 -> syncAppendEntriesReplyDeserialize2 ", syncAppendEntriesReplyLog2((char *)"test3: syncAppendEntriesReplySerialize3 -> syncAppendEntriesReplyDeserialize2 ",
pMsg2); pMsg2);
......
...@@ -37,7 +37,7 @@ void test1() { ...@@ -37,7 +37,7 @@ void test1() {
void test2() { void test2() {
SyncAppendEntries *pMsg = createMsg(); SyncAppendEntries *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncAppendEntriesSerialize(pMsg, serialized, len); syncAppendEntriesSerialize(pMsg, serialized, len);
SyncAppendEntries *pMsg2 = syncAppendEntriesBuild(pMsg->dataLen, 1000); SyncAppendEntries *pMsg2 = syncAppendEntriesBuild(pMsg->dataLen, 1000);
syncAppendEntriesDeserialize(serialized, len, pMsg2); syncAppendEntriesDeserialize(serialized, len, pMsg2);
...@@ -51,7 +51,7 @@ void test2() { ...@@ -51,7 +51,7 @@ void test2() {
void test3() { void test3() {
SyncAppendEntries *pMsg = createMsg(); SyncAppendEntries *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncAppendEntriesSerialize2(pMsg, &len); char *serialized = syncAppendEntriesSerialize2(pMsg, &len);
SyncAppendEntries *pMsg2 = syncAppendEntriesDeserialize2(serialized, len); SyncAppendEntries *pMsg2 = syncAppendEntriesDeserialize2(serialized, len);
syncAppendEntriesLog2((char *)"test3: syncAppendEntriesSerialize3 -> syncAppendEntriesDeserialize2 ", pMsg2); syncAppendEntriesLog2((char *)"test3: syncAppendEntriesSerialize3 -> syncAppendEntriesDeserialize2 ", pMsg2);
......
...@@ -43,7 +43,7 @@ void test1() { ...@@ -43,7 +43,7 @@ void test1() {
void test2() { void test2() {
SyncApplyMsg *pMsg = createMsg(); SyncApplyMsg *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncApplyMsgSerialize(pMsg, serialized, len); syncApplyMsgSerialize(pMsg, serialized, len);
SyncApplyMsg *pMsg2 = syncApplyMsgBuild(pMsg->dataLen); SyncApplyMsg *pMsg2 = syncApplyMsgBuild(pMsg->dataLen);
syncApplyMsgDeserialize(serialized, len, pMsg2); syncApplyMsgDeserialize(serialized, len, pMsg2);
...@@ -57,7 +57,7 @@ void test2() { ...@@ -57,7 +57,7 @@ void test2() {
void test3() { void test3() {
SyncApplyMsg *pMsg = createMsg(); SyncApplyMsg *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncApplyMsgSerialize2(pMsg, &len); char *serialized = syncApplyMsgSerialize2(pMsg, &len);
SyncApplyMsg *pMsg2 = syncApplyMsgDeserialize2(serialized, len); SyncApplyMsg *pMsg2 = syncApplyMsgDeserialize2(serialized, len);
syncApplyMsgLog2((char *)"test3: syncApplyMsgSerialize2 -> syncApplyMsgDeserialize2 ", pMsg2); syncApplyMsgLog2((char *)"test3: syncApplyMsgSerialize2 -> syncApplyMsgDeserialize2 ", pMsg2);
......
...@@ -33,7 +33,7 @@ SyncClientRequestBatch *createMsg() { ...@@ -33,7 +33,7 @@ SyncClientRequestBatch *createMsg() {
for (int32_t i = 0; i < 5; ++i) { for (int32_t i = 0; i < 5; ++i) {
SRpcMsg *pRpcMsg = createRpcMsg(i, 20); SRpcMsg *pRpcMsg = createRpcMsg(i, 20);
rpcMsgPArr[i] = pRpcMsg; rpcMsgPArr[i] = pRpcMsg;
//taosMemoryFree(pRpcMsg); // taosMemoryFree(pRpcMsg);
} }
SRaftMeta raftArr[5]; SRaftMeta raftArr[5];
......
...@@ -35,7 +35,7 @@ void test1() { ...@@ -35,7 +35,7 @@ void test1() {
void test2() { void test2() {
SyncClientRequest *pMsg = createMsg(); SyncClientRequest *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncClientRequestSerialize(pMsg, serialized, len); syncClientRequestSerialize(pMsg, serialized, len);
SyncClientRequest *pMsg2 = syncClientRequestBuild(pMsg->dataLen); SyncClientRequest *pMsg2 = syncClientRequestBuild(pMsg->dataLen);
syncClientRequestDeserialize(serialized, len, pMsg2); syncClientRequestDeserialize(serialized, len, pMsg2);
...@@ -49,7 +49,7 @@ void test2() { ...@@ -49,7 +49,7 @@ void test2() {
void test3() { void test3() {
SyncClientRequest *pMsg = createMsg(); SyncClientRequest *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncClientRequestSerialize2(pMsg, &len); char *serialized = syncClientRequestSerialize2(pMsg, &len);
SyncClientRequest *pMsg2 = syncClientRequestDeserialize2(serialized, len); SyncClientRequest *pMsg2 = syncClientRequestDeserialize2(serialized, len);
syncClientRequestLog2((char *)"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 ", pMsg2); syncClientRequestLog2((char *)"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 ", pMsg2);
......
...@@ -149,7 +149,7 @@ int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_ ...@@ -149,7 +149,7 @@ int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); } void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); }
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta *cbMeta) { void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta* cbMeta) {
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64, sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64,
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term); cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term);
} }
......
...@@ -80,7 +80,7 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) { ...@@ -80,7 +80,7 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); } void RestoreFinishCb(struct SSyncFSM* pFsm) { sTrace("==callback== ==RestoreFinishCb=="); }
void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta *cbMeta) { void ReConfigCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta* cbMeta) {
sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64, sTrace("==callback== ==ReConfigCb== flag:0x%lX, index:%" PRId64 ", code:%d, currentTerm:%" PRIu64 ", term:%" PRIu64,
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term); cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term);
} }
......
...@@ -25,8 +25,8 @@ int32_t myIndex = 0; ...@@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId ids[TSDB_MAX_REPLICA]; SRaftId ids[TSDB_MAX_REPLICA];
SSyncInfo syncInfo; SSyncInfo syncInfo;
SSyncFSM * pFsm; SSyncFSM *pFsm;
SWal * pWal; SWal *pWal;
SSyncNode *pSyncNode; SSyncNode *pSyncNode;
SSyncNode *syncNodeInit() { SSyncNode *syncNodeInit() {
...@@ -187,8 +187,8 @@ int main(int argc, char **argv) { ...@@ -187,8 +187,8 @@ int main(int argc, char **argv) {
// step5 // step5
uint32_t len; uint32_t len;
char * pMsg5 = step5(pMsg4, &len); char *pMsg5 = step5(pMsg4, &len);
char * s = syncUtilprintBin(pMsg5, len); char *s = syncUtilprintBin(pMsg5, len);
printf("==step5== [%s] \n", s); printf("==step5== [%s] \n", s);
taosMemoryFree(s); taosMemoryFree(s);
......
...@@ -35,13 +35,12 @@ void test1() { ...@@ -35,13 +35,12 @@ void test1() {
void test2() { void test2() {
SyncHeartbeatReply *pMsg = createMsg(); SyncHeartbeatReply *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncHeartbeatReplySerialize(pMsg, serialized, len); syncHeartbeatReplySerialize(pMsg, serialized, len);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyBuild(1000); SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyBuild(1000);
syncHeartbeatReplyDeserialize(serialized, len, pMsg2); syncHeartbeatReplyDeserialize(serialized, len, pMsg2);
syncHeartbeatReplyLog2((char *)"test2: syncHeartbeatReplySerialize -> syncHeartbeatReplyDeserialize ", syncHeartbeatReplyLog2((char *)"test2: syncHeartbeatReplySerialize -> syncHeartbeatReplyDeserialize ", pMsg2);
pMsg2);
taosMemoryFree(serialized); taosMemoryFree(serialized);
syncHeartbeatReplyDestroy(pMsg); syncHeartbeatReplyDestroy(pMsg);
...@@ -50,11 +49,10 @@ void test2() { ...@@ -50,11 +49,10 @@ void test2() {
void test3() { void test3() {
SyncHeartbeatReply *pMsg = createMsg(); SyncHeartbeatReply *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncHeartbeatReplySerialize2(pMsg, &len); char *serialized = syncHeartbeatReplySerialize2(pMsg, &len);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyDeserialize2(serialized, len); SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyDeserialize2(serialized, len);
syncHeartbeatReplyLog2((char *)"test3: syncHeartbeatReplySerialize3 -> syncHeartbeatReplyDeserialize2 ", syncHeartbeatReplyLog2((char *)"test3: syncHeartbeatReplySerialize3 -> syncHeartbeatReplyDeserialize2 ", pMsg2);
pMsg2);
taosMemoryFree(serialized); taosMemoryFree(serialized);
syncHeartbeatReplyDestroy(pMsg); syncHeartbeatReplyDestroy(pMsg);
...@@ -63,12 +61,11 @@ void test3() { ...@@ -63,12 +61,11 @@ void test3() {
void test4() { void test4() {
SyncHeartbeatReply *pMsg = createMsg(); SyncHeartbeatReply *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
syncHeartbeatReply2RpcMsg(pMsg, &rpcMsg); syncHeartbeatReply2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyBuild(1000); SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyBuild(1000);
syncHeartbeatReplyFromRpcMsg(&rpcMsg, pMsg2); syncHeartbeatReplyFromRpcMsg(&rpcMsg, pMsg2);
syncHeartbeatReplyLog2((char *)"test4: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg ", syncHeartbeatReplyLog2((char *)"test4: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg ", pMsg2);
pMsg2);
rpcFreeCont(rpcMsg.pCont); rpcFreeCont(rpcMsg.pCont);
syncHeartbeatReplyDestroy(pMsg); syncHeartbeatReplyDestroy(pMsg);
...@@ -77,11 +74,10 @@ void test4() { ...@@ -77,11 +74,10 @@ void test4() {
void test5() { void test5() {
SyncHeartbeatReply *pMsg = createMsg(); SyncHeartbeatReply *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
syncHeartbeatReply2RpcMsg(pMsg, &rpcMsg); syncHeartbeatReply2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyFromRpcMsg2(&rpcMsg); SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyFromRpcMsg2(&rpcMsg);
syncHeartbeatReplyLog2((char *)"test5: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg2 ", syncHeartbeatReplyLog2((char *)"test5: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg2 ", pMsg2);
pMsg2);
rpcFreeCont(rpcMsg.pCont); rpcFreeCont(rpcMsg.pCont);
syncHeartbeatReplyDestroy(pMsg); syncHeartbeatReplyDestroy(pMsg);
......
...@@ -19,7 +19,7 @@ SyncHeartbeat *createMsg() { ...@@ -19,7 +19,7 @@ SyncHeartbeat *createMsg() {
pMsg->srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234); pMsg->srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234);
pMsg->srcId.vgId = 100; pMsg->srcId.vgId = 100;
pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678); pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
pMsg->destId.vgId = 100; pMsg->destId.vgId = 100;
pMsg->term = 8; pMsg->term = 8;
pMsg->commitIndex = 33; pMsg->commitIndex = 33;
pMsg->privateTerm = 44; pMsg->privateTerm = 44;
...@@ -34,8 +34,8 @@ void test1() { ...@@ -34,8 +34,8 @@ void test1() {
void test2() { void test2() {
SyncHeartbeat *pMsg = createMsg(); SyncHeartbeat *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncHeartbeatSerialize(pMsg, serialized, len); syncHeartbeatSerialize(pMsg, serialized, len);
SyncHeartbeat *pMsg2 = syncHeartbeatBuild(789); SyncHeartbeat *pMsg2 = syncHeartbeatBuild(789);
syncHeartbeatDeserialize(serialized, len, pMsg2); syncHeartbeatDeserialize(serialized, len, pMsg2);
...@@ -48,8 +48,8 @@ void test2() { ...@@ -48,8 +48,8 @@ void test2() {
void test3() { void test3() {
SyncHeartbeat *pMsg = createMsg(); SyncHeartbeat *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncHeartbeatSerialize2(pMsg, &len); char *serialized = syncHeartbeatSerialize2(pMsg, &len);
SyncHeartbeat *pMsg2 = syncHeartbeatDeserialize2(serialized, len); SyncHeartbeat *pMsg2 = syncHeartbeatDeserialize2(serialized, len);
syncHeartbeatLog2((char *)"test3: syncHeartbeatSerialize2 -> syncHeartbeatDeserialize2 ", pMsg2); syncHeartbeatLog2((char *)"test3: syncHeartbeatSerialize2 -> syncHeartbeatDeserialize2 ", pMsg2);
...@@ -60,7 +60,7 @@ void test3() { ...@@ -60,7 +60,7 @@ void test3() {
void test4() { void test4() {
SyncHeartbeat *pMsg = createMsg(); SyncHeartbeat *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
syncHeartbeat2RpcMsg(pMsg, &rpcMsg); syncHeartbeat2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeat *pMsg2 = (SyncHeartbeat *)taosMemoryMalloc(rpcMsg.contLen); SyncHeartbeat *pMsg2 = (SyncHeartbeat *)taosMemoryMalloc(rpcMsg.contLen);
syncHeartbeatFromRpcMsg(&rpcMsg, pMsg2); syncHeartbeatFromRpcMsg(&rpcMsg, pMsg2);
...@@ -73,9 +73,9 @@ void test4() { ...@@ -73,9 +73,9 @@ void test4() {
void test5() { void test5() {
SyncHeartbeat *pMsg = createMsg(); SyncHeartbeat *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
syncHeartbeat2RpcMsg(pMsg, &rpcMsg); syncHeartbeat2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeat *pMsg2 =syncHeartbeatFromRpcMsg2(&rpcMsg); SyncHeartbeat *pMsg2 = syncHeartbeatFromRpcMsg2(&rpcMsg);
syncHeartbeatLog2((char *)"test5: syncHeartbeat2RpcMsg -> syncHeartbeatFromRpcMsg2 ", pMsg2); syncHeartbeatLog2((char *)"test5: syncHeartbeat2RpcMsg -> syncHeartbeatFromRpcMsg2 ", pMsg2);
rpcFreeCont(rpcMsg.pCont); rpcFreeCont(rpcMsg.pCont);
......
...@@ -9,7 +9,7 @@ void print(SHashObj *pNextIndex) { ...@@ -9,7 +9,7 @@ void print(SHashObj *pNextIndex) {
uint64_t *p = (uint64_t *)taosHashIterate(pNextIndex, NULL); uint64_t *p = (uint64_t *)taosHashIterate(pNextIndex, NULL);
while (p) { while (p) {
size_t len; size_t len;
void * key = taosHashGetKey(p, &len); void *key = taosHashGetKey(p, &len);
SRaftId *pRaftId = (SRaftId *)key; SRaftId *pRaftId = (SRaftId *)key;
......
...@@ -36,7 +36,7 @@ void test1() { ...@@ -36,7 +36,7 @@ void test1() {
void test2() { void test2() {
SyncLeaderTransfer *pMsg = createMsg(); SyncLeaderTransfer *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncLeaderTransferSerialize(pMsg, serialized, len); syncLeaderTransferSerialize(pMsg, serialized, len);
SyncLeaderTransfer *pMsg2 = syncLeaderTransferBuild(1000); SyncLeaderTransfer *pMsg2 = syncLeaderTransferBuild(1000);
syncLeaderTransferDeserialize(serialized, len, pMsg2); syncLeaderTransferDeserialize(serialized, len, pMsg2);
...@@ -50,7 +50,7 @@ void test2() { ...@@ -50,7 +50,7 @@ void test2() {
void test3() { void test3() {
SyncLeaderTransfer *pMsg = createMsg(); SyncLeaderTransfer *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncLeaderTransferSerialize2(pMsg, &len); char *serialized = syncLeaderTransferSerialize2(pMsg, &len);
SyncLeaderTransfer *pMsg2 = syncLeaderTransferDeserialize2(serialized, len); SyncLeaderTransfer *pMsg2 = syncLeaderTransferDeserialize2(serialized, len);
syncLeaderTransferLog2((char *)"test3: syncLeaderTransferSerialize2 -> syncLeaderTransferDeserialize2 ", pMsg2); syncLeaderTransferLog2((char *)"test3: syncLeaderTransferSerialize2 -> syncLeaderTransferDeserialize2 ", pMsg2);
......
...@@ -33,7 +33,7 @@ void test1() { ...@@ -33,7 +33,7 @@ void test1() {
void test2() { void test2() {
SyncPingReply *pMsg = createMsg(); SyncPingReply *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncPingReplySerialize(pMsg, serialized, len); syncPingReplySerialize(pMsg, serialized, len);
SyncPingReply *pMsg2 = syncPingReplyBuild(pMsg->dataLen); SyncPingReply *pMsg2 = syncPingReplyBuild(pMsg->dataLen);
syncPingReplyDeserialize(serialized, len, pMsg2); syncPingReplyDeserialize(serialized, len, pMsg2);
...@@ -47,7 +47,7 @@ void test2() { ...@@ -47,7 +47,7 @@ void test2() {
void test3() { void test3() {
SyncPingReply *pMsg = createMsg(); SyncPingReply *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncPingReplySerialize2(pMsg, &len); char *serialized = syncPingReplySerialize2(pMsg, &len);
SyncPingReply *pMsg2 = syncPingReplyDeserialize2(serialized, len); SyncPingReply *pMsg2 = syncPingReplyDeserialize2(serialized, len);
syncPingReplyLog2((char *)"test3: syncPingReplySerialize2 -> syncPingReplyDeserialize2 ", pMsg2); syncPingReplyLog2((char *)"test3: syncPingReplySerialize2 -> syncPingReplyDeserialize2 ", pMsg2);
...@@ -84,7 +84,7 @@ void test5() { ...@@ -84,7 +84,7 @@ void test5() {
void test6() { void test6() {
SyncPingReply *pMsg = createMsg(); SyncPingReply *pMsg = createMsg();
int32_t bufLen = syncPingReplySerialize3(pMsg, NULL, 0); int32_t bufLen = syncPingReplySerialize3(pMsg, NULL, 0);
char * serialized = (char *)taosMemoryMalloc(bufLen); char *serialized = (char *)taosMemoryMalloc(bufLen);
syncPingReplySerialize3(pMsg, serialized, bufLen); syncPingReplySerialize3(pMsg, serialized, bufLen);
SyncPingReply *pMsg2 = syncPingReplyDeserialize3(serialized, bufLen); SyncPingReply *pMsg2 = syncPingReplyDeserialize3(serialized, bufLen);
assert(pMsg2 != NULL); assert(pMsg2 != NULL);
......
...@@ -33,7 +33,7 @@ void test1() { ...@@ -33,7 +33,7 @@ void test1() {
void test2() { void test2() {
SyncPing *pMsg = createMsg(); SyncPing *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncPingSerialize(pMsg, serialized, len); syncPingSerialize(pMsg, serialized, len);
SyncPing *pMsg2 = syncPingBuild(pMsg->dataLen); SyncPing *pMsg2 = syncPingBuild(pMsg->dataLen);
syncPingDeserialize(serialized, len, pMsg2); syncPingDeserialize(serialized, len, pMsg2);
...@@ -47,7 +47,7 @@ void test2() { ...@@ -47,7 +47,7 @@ void test2() {
void test3() { void test3() {
SyncPing *pMsg = createMsg(); SyncPing *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncPingSerialize2(pMsg, &len); char *serialized = syncPingSerialize2(pMsg, &len);
SyncPing *pMsg2 = syncPingDeserialize2(serialized, len); SyncPing *pMsg2 = syncPingDeserialize2(serialized, len);
syncPingLog2((char *)"test3: syncPingSerialize2 -> syncPingDeserialize2 ", pMsg2); syncPingLog2((char *)"test3: syncPingSerialize2 -> syncPingDeserialize2 ", pMsg2);
...@@ -84,7 +84,7 @@ void test5() { ...@@ -84,7 +84,7 @@ void test5() {
void test6() { void test6() {
SyncPing *pMsg = createMsg(); SyncPing *pMsg = createMsg();
int32_t bufLen = syncPingSerialize3(pMsg, NULL, 0); int32_t bufLen = syncPingSerialize3(pMsg, NULL, 0);
char * serialized = (char *)taosMemoryMalloc(bufLen); char *serialized = (char *)taosMemoryMalloc(bufLen);
syncPingSerialize3(pMsg, serialized, bufLen); syncPingSerialize3(pMsg, serialized, bufLen);
SyncPing *pMsg2 = syncPingDeserialize3(serialized, bufLen); SyncPing *pMsg2 = syncPingDeserialize3(serialized, bufLen);
assert(pMsg2 != NULL); assert(pMsg2 != NULL);
......
...@@ -53,20 +53,20 @@ SSyncCfg* createSyncCfg() { ...@@ -53,20 +53,20 @@ SSyncCfg* createSyncCfg() {
return pCfg; return pCfg;
} }
const char *pFile = "./raft_config_index.json"; const char* pFile = "./raft_config_index.json";
void test1() { void test1() {
int32_t code = raftCfgIndexCreateFile(pFile); int32_t code = raftCfgIndexCreateFile(pFile);
ASSERT(code == 0); ASSERT(code == 0);
SRaftCfgIndex *pRaftCfgIndex = raftCfgIndexOpen(pFile); SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile);
raftCfgIndexLog2((char*)"==test1==", pRaftCfgIndex); raftCfgIndexLog2((char*)"==test1==", pRaftCfgIndex);
raftCfgIndexClose(pRaftCfgIndex); raftCfgIndexClose(pRaftCfgIndex);
} }
void test2() { void test2() {
SRaftCfgIndex *pRaftCfgIndex = raftCfgIndexOpen(pFile); SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile);
for (int i = 0; i < 500; ++i) { for (int i = 0; i < 500; ++i) {
raftCfgIndexAddConfigIndex(pRaftCfgIndex, i); raftCfgIndexAddConfigIndex(pRaftCfgIndex, i);
} }
...@@ -77,7 +77,7 @@ void test2() { ...@@ -77,7 +77,7 @@ void test2() {
} }
void test3() { void test3() {
SRaftCfgIndex *pRaftCfgIndex = raftCfgIndexOpen(pFile); SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile);
raftCfgIndexLog2((char*)"==test3==", pRaftCfgIndex); raftCfgIndexLog2((char*)"==test3==", pRaftCfgIndex);
raftCfgIndexClose(pRaftCfgIndex); raftCfgIndexClose(pRaftCfgIndex);
......
...@@ -69,7 +69,7 @@ void test1() { ...@@ -69,7 +69,7 @@ void test1() {
void test2() { void test2() {
SyncReconfigFinish *pMsg = createMsg(); SyncReconfigFinish *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncReconfigFinishSerialize(pMsg, serialized, len); syncReconfigFinishSerialize(pMsg, serialized, len);
SyncReconfigFinish *pMsg2 = syncReconfigFinishBuild(1000); SyncReconfigFinish *pMsg2 = syncReconfigFinishBuild(1000);
syncReconfigFinishDeserialize(serialized, len, pMsg2); syncReconfigFinishDeserialize(serialized, len, pMsg2);
...@@ -83,7 +83,7 @@ void test2() { ...@@ -83,7 +83,7 @@ void test2() {
void test3() { void test3() {
SyncReconfigFinish *pMsg = createMsg(); SyncReconfigFinish *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncReconfigFinishSerialize2(pMsg, &len); char *serialized = syncReconfigFinishSerialize2(pMsg, &len);
SyncReconfigFinish *pMsg2 = syncReconfigFinishDeserialize2(serialized, len); SyncReconfigFinish *pMsg2 = syncReconfigFinishDeserialize2(serialized, len);
syncReconfigFinishLog2((char *)"test3: SyncReconfigFinishSerialize2 -> syncReconfigFinishDeserialize2 ", pMsg2); syncReconfigFinishLog2((char *)"test3: SyncReconfigFinishSerialize2 -> syncReconfigFinishDeserialize2 ", pMsg2);
......
...@@ -25,7 +25,7 @@ int g = 100; ...@@ -25,7 +25,7 @@ int g = 100;
typedef struct SyncObj { typedef struct SyncObj {
int64_t rid; int64_t rid;
void * data; void *data;
char name[32]; char name[32];
int counter; int counter;
} SyncObj; } SyncObj;
......
...@@ -34,7 +34,7 @@ void test1() { ...@@ -34,7 +34,7 @@ void test1() {
void test2() { void test2() {
SyncRequestVoteReply *pMsg = createMsg(); SyncRequestVoteReply *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncRequestVoteReplySerialize(pMsg, serialized, len); syncRequestVoteReplySerialize(pMsg, serialized, len);
SyncRequestVoteReply *pMsg2 = syncRequestVoteReplyBuild(1000); SyncRequestVoteReply *pMsg2 = syncRequestVoteReplyBuild(1000);
syncRequestVoteReplyDeserialize(serialized, len, pMsg2); syncRequestVoteReplyDeserialize(serialized, len, pMsg2);
...@@ -48,7 +48,7 @@ void test2() { ...@@ -48,7 +48,7 @@ void test2() {
void test3() { void test3() {
SyncRequestVoteReply *pMsg = createMsg(); SyncRequestVoteReply *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncRequestVoteReplySerialize2(pMsg, &len); char *serialized = syncRequestVoteReplySerialize2(pMsg, &len);
SyncRequestVoteReply *pMsg2 = syncRequestVoteReplyDeserialize2(serialized, len); SyncRequestVoteReply *pMsg2 = syncRequestVoteReplyDeserialize2(serialized, len);
syncRequestVoteReplyLog2((char *)"test3: syncRequestVoteReplySerialize3 -> syncRequestVoteReplyDeserialize2 ", pMsg2); syncRequestVoteReplyLog2((char *)"test3: syncRequestVoteReplySerialize3 -> syncRequestVoteReplyDeserialize2 ", pMsg2);
......
...@@ -35,7 +35,7 @@ void test1() { ...@@ -35,7 +35,7 @@ void test1() {
void test2() { void test2() {
SyncRequestVote *pMsg = createMsg(); SyncRequestVote *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncRequestVoteSerialize(pMsg, serialized, len); syncRequestVoteSerialize(pMsg, serialized, len);
SyncRequestVote *pMsg2 = syncRequestVoteBuild(1000); SyncRequestVote *pMsg2 = syncRequestVoteBuild(1000);
syncRequestVoteDeserialize(serialized, len, pMsg2); syncRequestVoteDeserialize(serialized, len, pMsg2);
...@@ -49,7 +49,7 @@ void test2() { ...@@ -49,7 +49,7 @@ void test2() {
void test3() { void test3() {
SyncRequestVote *pMsg = createMsg(); SyncRequestVote *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncRequestVoteSerialize2(pMsg, &len); char *serialized = syncRequestVoteSerialize2(pMsg, &len);
SyncRequestVote *pMsg2 = syncRequestVoteDeserialize2(serialized, len); SyncRequestVote *pMsg2 = syncRequestVoteDeserialize2(serialized, len);
syncRequestVoteLog2((char *)"test3: syncRequestVoteSerialize3 -> syncRequestVoteDeserialize2 ", pMsg2); syncRequestVoteLog2((char *)"test3: syncRequestVoteSerialize3 -> syncRequestVoteDeserialize2 ", pMsg2);
......
...@@ -38,7 +38,7 @@ void test1() { ...@@ -38,7 +38,7 @@ void test1() {
void test2() { void test2() {
SyncSnapshotRsp *pMsg = createMsg(); SyncSnapshotRsp *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncSnapshotRspSerialize(pMsg, serialized, len); syncSnapshotRspSerialize(pMsg, serialized, len);
SyncSnapshotRsp *pMsg2 = syncSnapshotRspBuild(1000); SyncSnapshotRsp *pMsg2 = syncSnapshotRspBuild(1000);
syncSnapshotRspDeserialize(serialized, len, pMsg2); syncSnapshotRspDeserialize(serialized, len, pMsg2);
...@@ -52,7 +52,7 @@ void test2() { ...@@ -52,7 +52,7 @@ void test2() {
void test3() { void test3() {
SyncSnapshotRsp *pMsg = createMsg(); SyncSnapshotRsp *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncSnapshotRspSerialize2(pMsg, &len); char *serialized = syncSnapshotRspSerialize2(pMsg, &len);
SyncSnapshotRsp *pMsg2 = syncSnapshotRspDeserialize2(serialized, len); SyncSnapshotRsp *pMsg2 = syncSnapshotRspDeserialize2(serialized, len);
syncSnapshotRspLog2((char *)"test3: syncSnapshotRspSerialize2 -> syncSnapshotRspDeserialize2 ", pMsg2); syncSnapshotRspLog2((char *)"test3: syncSnapshotRspSerialize2 -> syncSnapshotRspDeserialize2 ", pMsg2);
......
...@@ -48,7 +48,7 @@ void test1() { ...@@ -48,7 +48,7 @@ void test1() {
void test2() { void test2() {
SyncSnapshotSend *pMsg = createMsg(); SyncSnapshotSend *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncSnapshotSendSerialize(pMsg, serialized, len); syncSnapshotSendSerialize(pMsg, serialized, len);
SyncSnapshotSend *pMsg2 = syncSnapshotSendBuild(pMsg->dataLen, 1000); SyncSnapshotSend *pMsg2 = syncSnapshotSendBuild(pMsg->dataLen, 1000);
syncSnapshotSendDeserialize(serialized, len, pMsg2); syncSnapshotSendDeserialize(serialized, len, pMsg2);
...@@ -62,7 +62,7 @@ void test2() { ...@@ -62,7 +62,7 @@ void test2() {
void test3() { void test3() {
SyncSnapshotSend *pMsg = createMsg(); SyncSnapshotSend *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncSnapshotSendSerialize2(pMsg, &len); char *serialized = syncSnapshotSendSerialize2(pMsg, &len);
SyncSnapshotSend *pMsg2 = syncSnapshotSendDeserialize2(serialized, len); SyncSnapshotSend *pMsg2 = syncSnapshotSendDeserialize2(serialized, len);
syncSnapshotSendLog2((char *)"test3: syncSnapshotSendSerialize2 -> syncSnapshotSendDeserialize2 ", pMsg2); syncSnapshotSendLog2((char *)"test3: syncSnapshotSendSerialize2 -> syncSnapshotSendDeserialize2 ", pMsg2);
......
...@@ -25,8 +25,8 @@ int32_t myIndex = 0; ...@@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId ids[TSDB_MAX_REPLICA]; SRaftId ids[TSDB_MAX_REPLICA];
SSyncInfo syncInfo; SSyncInfo syncInfo;
SSyncFSM * pFsm; SSyncFSM *pFsm;
SWal * pWal; SWal *pWal;
SSyncNode *gSyncNode; SSyncNode *gSyncNode;
SyncIndex snapshotLastApplyIndex = SYNC_INDEX_INVALID; SyncIndex snapshotLastApplyIndex = SYNC_INDEX_INVALID;
......
...@@ -30,7 +30,7 @@ void test1() { ...@@ -30,7 +30,7 @@ void test1() {
void test2() { void test2() {
SyncTimeout *pMsg = createMsg(); SyncTimeout *pMsg = createMsg();
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncTimeoutSerialize(pMsg, serialized, len); syncTimeoutSerialize(pMsg, serialized, len);
SyncTimeout *pMsg2 = syncTimeoutBuild(); SyncTimeout *pMsg2 = syncTimeoutBuild();
syncTimeoutDeserialize(serialized, len, pMsg2); syncTimeoutDeserialize(serialized, len, pMsg2);
...@@ -44,7 +44,7 @@ void test2() { ...@@ -44,7 +44,7 @@ void test2() {
void test3() { void test3() {
SyncTimeout *pMsg = createMsg(); SyncTimeout *pMsg = createMsg();
uint32_t len; uint32_t len;
char * serialized = syncTimeoutSerialize2(pMsg, &len); char *serialized = syncTimeoutSerialize2(pMsg, &len);
SyncTimeout *pMsg2 = syncTimeoutDeserialize2(serialized, len); SyncTimeout *pMsg2 = syncTimeoutDeserialize2(serialized, len);
syncTimeoutLog2((char *)"test3: syncTimeoutSerialize3 -> syncTimeoutDeserialize2 ", pMsg2); syncTimeoutLog2((char *)"test3: syncTimeoutSerialize3 -> syncTimeoutDeserialize2 ", pMsg2);
...@@ -80,7 +80,7 @@ void test5() { ...@@ -80,7 +80,7 @@ void test5() {
void test6() { void test6() {
SyncTimeout *pMsg = createMsg(); SyncTimeout *pMsg = createMsg();
char * jsonStr = syncTimeout2Str(pMsg); char *jsonStr = syncTimeout2Str(pMsg);
sTrace("jsonStr: %s", jsonStr); sTrace("jsonStr: %s", jsonStr);
syncUtilJson2Line(jsonStr); syncUtilJson2Line(jsonStr);
......
...@@ -25,8 +25,8 @@ int32_t myIndex = 0; ...@@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId ids[TSDB_MAX_REPLICA]; SRaftId ids[TSDB_MAX_REPLICA];
SSyncInfo syncInfo; SSyncInfo syncInfo;
SSyncFSM * pFsm; SSyncFSM *pFsm;
SWal * pWal; SWal *pWal;
SSyncNode *gSyncNode; SSyncNode *gSyncNode;
const char *pDir = "./syncWriteTest"; const char *pDir = "./syncWriteTest";
......
...@@ -26,7 +26,7 @@ FORMAT_DIR_LIST=( ...@@ -26,7 +26,7 @@ FORMAT_DIR_LIST=(
# "${PRJ_ROOT_DIR}/source/libs/qworker" # "${PRJ_ROOT_DIR}/source/libs/qworker"
"${PRJ_ROOT_DIR}/source/libs/scalar" "${PRJ_ROOT_DIR}/source/libs/scalar"
"${PRJ_ROOT_DIR}/source/libs/stream" "${PRJ_ROOT_DIR}/source/libs/stream"
# "${PRJ_ROOT_DIR}/source/libs/sync" "${PRJ_ROOT_DIR}/source/libs/sync"
"${PRJ_ROOT_DIR}/source/libs/tdb" "${PRJ_ROOT_DIR}/source/libs/tdb"
"${PRJ_ROOT_DIR}/source/libs/tfs" "${PRJ_ROOT_DIR}/source/libs/tfs"
"${PRJ_ROOT_DIR}/source/libs/transport" "${PRJ_ROOT_DIR}/source/libs/transport"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册