more code format

This commit is contained in:
Hongze Cheng 2022-10-13 14:06:27 +08:00
parent bb65999566
commit c79cc7e454
33 changed files with 102 additions and 106 deletions

View File

@ -34,10 +34,10 @@ extern "C" {
typedef struct SSyncIO {
STaosQueue *pMsgQ;
STaosQset * pQset;
STaosQset *pQset;
TdThread consumerTid;
void * serverRpc;
void * clientRpc;
void *serverRpc;
void *clientRpc;
SEpSet myAddr;
SMsgCb msgcb;

View File

@ -49,8 +49,8 @@ void raftStoreClearVote(SRaftStore *pRaftStore);
void raftStoreNextTerm(SRaftStore *pRaftStore);
void raftStoreSetTerm(SRaftStore *pRaftStore, SyncTerm term);
int32_t raftStoreFromJson(SRaftStore *pRaftStore, cJSON *pJson);
cJSON * raftStore2Json(SRaftStore *pRaftStore);
char * raftStore2Str(SRaftStore *pRaftStore);
cJSON *raftStore2Json(SRaftStore *pRaftStore);
char *raftStore2Str(SRaftStore *pRaftStore);
// for debug -------------------
void raftStorePrint(SRaftStore *pObj);

View File

@ -46,8 +46,8 @@ void voteGrantedUpdate(SVotesGranted *pVotesGranted, SSyncNode *pSyncN
bool voteGrantedMajority(SVotesGranted *pVotesGranted);
void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg);
void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term);
cJSON * voteGranted2Json(SVotesGranted *pVotesGranted);
char * voteGranted2Str(SVotesGranted *pVotesGranted);
cJSON *voteGranted2Json(SVotesGranted *pVotesGranted);
char *voteGranted2Str(SVotesGranted *pVotesGranted);
// for debug -------------------
void voteGrantedPrint(SVotesGranted *pObj);
@ -70,8 +70,8 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSync
bool votesResponded(SVotesRespond *pVotesRespond, const SRaftId *pRaftId);
void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *pMsg);
void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term);
cJSON * votesRespond2Json(SVotesRespond *pVotesRespond);
char * votesRespond2Str(SVotesRespond *pVotesRespond);
cJSON *votesRespond2Json(SVotesRespond *pVotesRespond);
char *votesRespond2Str(SVotesRespond *pVotesRespond);
// for debug -------------------
void votesRespondPrint(SVotesRespond *pObj);

View File

@ -30,7 +30,7 @@ static int32_t syncIODestroy(SSyncIO *io);
static int32_t syncIOStartInternal(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 syncIOProcessReply(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet);
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) {
}
static void *syncIOConsumerFunc(void *param) {
SSyncIO * io = param;
SSyncIO *io = param;
STaosQall *qall = taosAllocateQall();
SRpcMsg * pRpcMsg, rpcMsg;
SRpcMsg *pRpcMsg, rpcMsg;
SQueueInfo qinfo = {0};
while (1) {

View File

@ -52,7 +52,7 @@ int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg);
int32_t syncNodeOnPingReplyCb(SSyncNode* ths, SyncPingReply* pMsg);
// ---------------------------------
static void syncNodeFreeCb(void *param) {
static void syncNodeFreeCb(void* param) {
syncNodeClose(param);
param = NULL;
}
@ -1008,7 +1008,7 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
// init replicaNum, replicasId
pSyncNode->replicaNum = pSyncNode->pRaftCfg->cfg.replicaNum;
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);
goto _error;
}

View File

@ -218,7 +218,7 @@ cJSON *raftStore2Json(SRaftStore *pRaftStore) {
char *raftStore2Str(SRaftStore *pRaftStore) {
cJSON *pJson = raftStore2Json(pRaftStore);
char * serialized = cJSON_Print(pJson);
char *serialized = cJSON_Print(pJson);
cJSON_Delete(pJson);
return serialized;
}

View File

@ -130,7 +130,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) {
char *voteGranted2Str(SVotesGranted *pVotesGranted) {
cJSON *pJson = voteGranted2Json(pVotesGranted);
char * serialized = cJSON_Print(pJson);
char *serialized = cJSON_Print(pJson);
cJSON_Delete(pJson);
return serialized;
}
@ -259,7 +259,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) {
char *votesRespond2Str(SVotesRespond *pVotesRespond) {
cJSON *pJson = votesRespond2Json(pVotesRespond);
char * serialized = cJSON_Print(pJson);
char *serialized = cJSON_Print(pJson);
cJSON_Delete(pJson);
return serialized;
}

View File

@ -37,7 +37,7 @@ void test1() {
void test2() {
SyncAppendEntriesReply *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncAppendEntriesReplySerialize(pMsg, serialized, len);
SyncAppendEntriesReply *pMsg2 = syncAppendEntriesReplyBuild(1000);
syncAppendEntriesReplyDeserialize(serialized, len, pMsg2);
@ -52,7 +52,7 @@ void test2() {
void test3() {
SyncAppendEntriesReply *pMsg = createMsg();
uint32_t len;
char * serialized = syncAppendEntriesReplySerialize2(pMsg, &len);
char *serialized = syncAppendEntriesReplySerialize2(pMsg, &len);
SyncAppendEntriesReply *pMsg2 = syncAppendEntriesReplyDeserialize2(serialized, len);
syncAppendEntriesReplyLog2((char *)"test3: syncAppendEntriesReplySerialize3 -> syncAppendEntriesReplyDeserialize2 ",
pMsg2);

View File

@ -37,7 +37,7 @@ void test1() {
void test2() {
SyncAppendEntries *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncAppendEntriesSerialize(pMsg, serialized, len);
SyncAppendEntries *pMsg2 = syncAppendEntriesBuild(pMsg->dataLen, 1000);
syncAppendEntriesDeserialize(serialized, len, pMsg2);
@ -51,7 +51,7 @@ void test2() {
void test3() {
SyncAppendEntries *pMsg = createMsg();
uint32_t len;
char * serialized = syncAppendEntriesSerialize2(pMsg, &len);
char *serialized = syncAppendEntriesSerialize2(pMsg, &len);
SyncAppendEntries *pMsg2 = syncAppendEntriesDeserialize2(serialized, len);
syncAppendEntriesLog2((char *)"test3: syncAppendEntriesSerialize3 -> syncAppendEntriesDeserialize2 ", pMsg2);

View File

@ -43,7 +43,7 @@ void test1() {
void test2() {
SyncApplyMsg *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncApplyMsgSerialize(pMsg, serialized, len);
SyncApplyMsg *pMsg2 = syncApplyMsgBuild(pMsg->dataLen);
syncApplyMsgDeserialize(serialized, len, pMsg2);
@ -57,7 +57,7 @@ void test2() {
void test3() {
SyncApplyMsg *pMsg = createMsg();
uint32_t len;
char * serialized = syncApplyMsgSerialize2(pMsg, &len);
char *serialized = syncApplyMsgSerialize2(pMsg, &len);
SyncApplyMsg *pMsg2 = syncApplyMsgDeserialize2(serialized, len);
syncApplyMsgLog2((char *)"test3: syncApplyMsgSerialize2 -> syncApplyMsgDeserialize2 ", pMsg2);

View File

@ -33,7 +33,7 @@ SyncClientRequestBatch *createMsg() {
for (int32_t i = 0; i < 5; ++i) {
SRpcMsg *pRpcMsg = createRpcMsg(i, 20);
rpcMsgPArr[i] = pRpcMsg;
//taosMemoryFree(pRpcMsg);
// taosMemoryFree(pRpcMsg);
}
SRaftMeta raftArr[5];

View File

@ -35,7 +35,7 @@ void test1() {
void test2() {
SyncClientRequest *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncClientRequestSerialize(pMsg, serialized, len);
SyncClientRequest *pMsg2 = syncClientRequestBuild(pMsg->dataLen);
syncClientRequestDeserialize(serialized, len, pMsg2);
@ -49,7 +49,7 @@ void test2() {
void test3() {
SyncClientRequest *pMsg = createMsg();
uint32_t len;
char * serialized = syncClientRequestSerialize2(pMsg, &len);
char *serialized = syncClientRequestSerialize2(pMsg, &len);
SyncClientRequest *pMsg2 = syncClientRequestDeserialize2(serialized, len);
syncClientRequestLog2((char *)"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 ", pMsg2);

View File

@ -149,7 +149,7 @@ int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_
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,
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term);
}

View File

@ -80,7 +80,7 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
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,
cbMeta->flag, cbMeta->index, cbMeta->code, cbMeta->currentTerm, cbMeta->term);
}

View File

@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId ids[TSDB_MAX_REPLICA];
SSyncInfo syncInfo;
SSyncFSM * pFsm;
SWal * pWal;
SSyncFSM *pFsm;
SWal *pWal;
SSyncNode *pSyncNode;
SSyncNode *syncNodeInit() {
@ -187,8 +187,8 @@ int main(int argc, char **argv) {
// step5
uint32_t len;
char * pMsg5 = step5(pMsg4, &len);
char * s = syncUtilprintBin(pMsg5, len);
char *pMsg5 = step5(pMsg4, &len);
char *s = syncUtilprintBin(pMsg5, len);
printf("==step5== [%s] \n", s);
taosMemoryFree(s);

View File

@ -36,12 +36,11 @@ void test1() {
void test2() {
SyncHeartbeatReply *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncHeartbeatReplySerialize(pMsg, serialized, len);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyBuild(1000);
syncHeartbeatReplyDeserialize(serialized, len, pMsg2);
syncHeartbeatReplyLog2((char *)"test2: syncHeartbeatReplySerialize -> syncHeartbeatReplyDeserialize ",
pMsg2);
syncHeartbeatReplyLog2((char *)"test2: syncHeartbeatReplySerialize -> syncHeartbeatReplyDeserialize ", pMsg2);
taosMemoryFree(serialized);
syncHeartbeatReplyDestroy(pMsg);
@ -51,10 +50,9 @@ void test2() {
void test3() {
SyncHeartbeatReply *pMsg = createMsg();
uint32_t len;
char * serialized = syncHeartbeatReplySerialize2(pMsg, &len);
char *serialized = syncHeartbeatReplySerialize2(pMsg, &len);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyDeserialize2(serialized, len);
syncHeartbeatReplyLog2((char *)"test3: syncHeartbeatReplySerialize3 -> syncHeartbeatReplyDeserialize2 ",
pMsg2);
syncHeartbeatReplyLog2((char *)"test3: syncHeartbeatReplySerialize3 -> syncHeartbeatReplyDeserialize2 ", pMsg2);
taosMemoryFree(serialized);
syncHeartbeatReplyDestroy(pMsg);
@ -67,8 +65,7 @@ void test4() {
syncHeartbeatReply2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyBuild(1000);
syncHeartbeatReplyFromRpcMsg(&rpcMsg, pMsg2);
syncHeartbeatReplyLog2((char *)"test4: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg ",
pMsg2);
syncHeartbeatReplyLog2((char *)"test4: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg ", pMsg2);
rpcFreeCont(rpcMsg.pCont);
syncHeartbeatReplyDestroy(pMsg);
@ -80,8 +77,7 @@ void test5() {
SRpcMsg rpcMsg;
syncHeartbeatReply2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeatReply *pMsg2 = syncHeartbeatReplyFromRpcMsg2(&rpcMsg);
syncHeartbeatReplyLog2((char *)"test5: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg2 ",
pMsg2);
syncHeartbeatReplyLog2((char *)"test5: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg2 ", pMsg2);
rpcFreeCont(rpcMsg.pCont);
syncHeartbeatReplyDestroy(pMsg);

View File

@ -35,7 +35,7 @@ void test1() {
void test2() {
SyncHeartbeat *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncHeartbeatSerialize(pMsg, serialized, len);
SyncHeartbeat *pMsg2 = syncHeartbeatBuild(789);
syncHeartbeatDeserialize(serialized, len, pMsg2);
@ -49,7 +49,7 @@ void test2() {
void test3() {
SyncHeartbeat *pMsg = createMsg();
uint32_t len;
char * serialized = syncHeartbeatSerialize2(pMsg, &len);
char *serialized = syncHeartbeatSerialize2(pMsg, &len);
SyncHeartbeat *pMsg2 = syncHeartbeatDeserialize2(serialized, len);
syncHeartbeatLog2((char *)"test3: syncHeartbeatSerialize2 -> syncHeartbeatDeserialize2 ", pMsg2);
@ -75,7 +75,7 @@ void test5() {
SyncHeartbeat *pMsg = createMsg();
SRpcMsg rpcMsg;
syncHeartbeat2RpcMsg(pMsg, &rpcMsg);
SyncHeartbeat *pMsg2 =syncHeartbeatFromRpcMsg2(&rpcMsg);
SyncHeartbeat *pMsg2 = syncHeartbeatFromRpcMsg2(&rpcMsg);
syncHeartbeatLog2((char *)"test5: syncHeartbeat2RpcMsg -> syncHeartbeatFromRpcMsg2 ", pMsg2);
rpcFreeCont(rpcMsg.pCont);

View File

@ -9,7 +9,7 @@ void print(SHashObj *pNextIndex) {
uint64_t *p = (uint64_t *)taosHashIterate(pNextIndex, NULL);
while (p) {
size_t len;
void * key = taosHashGetKey(p, &len);
void *key = taosHashGetKey(p, &len);
SRaftId *pRaftId = (SRaftId *)key;

View File

@ -36,7 +36,7 @@ void test1() {
void test2() {
SyncLeaderTransfer *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncLeaderTransferSerialize(pMsg, serialized, len);
SyncLeaderTransfer *pMsg2 = syncLeaderTransferBuild(1000);
syncLeaderTransferDeserialize(serialized, len, pMsg2);
@ -50,7 +50,7 @@ void test2() {
void test3() {
SyncLeaderTransfer *pMsg = createMsg();
uint32_t len;
char * serialized = syncLeaderTransferSerialize2(pMsg, &len);
char *serialized = syncLeaderTransferSerialize2(pMsg, &len);
SyncLeaderTransfer *pMsg2 = syncLeaderTransferDeserialize2(serialized, len);
syncLeaderTransferLog2((char *)"test3: syncLeaderTransferSerialize2 -> syncLeaderTransferDeserialize2 ", pMsg2);

View File

@ -33,7 +33,7 @@ void test1() {
void test2() {
SyncPingReply *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncPingReplySerialize(pMsg, serialized, len);
SyncPingReply *pMsg2 = syncPingReplyBuild(pMsg->dataLen);
syncPingReplyDeserialize(serialized, len, pMsg2);
@ -47,7 +47,7 @@ void test2() {
void test3() {
SyncPingReply *pMsg = createMsg();
uint32_t len;
char * serialized = syncPingReplySerialize2(pMsg, &len);
char *serialized = syncPingReplySerialize2(pMsg, &len);
SyncPingReply *pMsg2 = syncPingReplyDeserialize2(serialized, len);
syncPingReplyLog2((char *)"test3: syncPingReplySerialize2 -> syncPingReplyDeserialize2 ", pMsg2);
@ -84,7 +84,7 @@ void test5() {
void test6() {
SyncPingReply *pMsg = createMsg();
int32_t bufLen = syncPingReplySerialize3(pMsg, NULL, 0);
char * serialized = (char *)taosMemoryMalloc(bufLen);
char *serialized = (char *)taosMemoryMalloc(bufLen);
syncPingReplySerialize3(pMsg, serialized, bufLen);
SyncPingReply *pMsg2 = syncPingReplyDeserialize3(serialized, bufLen);
assert(pMsg2 != NULL);

View File

@ -33,7 +33,7 @@ void test1() {
void test2() {
SyncPing *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncPingSerialize(pMsg, serialized, len);
SyncPing *pMsg2 = syncPingBuild(pMsg->dataLen);
syncPingDeserialize(serialized, len, pMsg2);
@ -47,7 +47,7 @@ void test2() {
void test3() {
SyncPing *pMsg = createMsg();
uint32_t len;
char * serialized = syncPingSerialize2(pMsg, &len);
char *serialized = syncPingSerialize2(pMsg, &len);
SyncPing *pMsg2 = syncPingDeserialize2(serialized, len);
syncPingLog2((char *)"test3: syncPingSerialize2 -> syncPingDeserialize2 ", pMsg2);
@ -84,7 +84,7 @@ void test5() {
void test6() {
SyncPing *pMsg = createMsg();
int32_t bufLen = syncPingSerialize3(pMsg, NULL, 0);
char * serialized = (char *)taosMemoryMalloc(bufLen);
char *serialized = (char *)taosMemoryMalloc(bufLen);
syncPingSerialize3(pMsg, serialized, bufLen);
SyncPing *pMsg2 = syncPingDeserialize3(serialized, bufLen);
assert(pMsg2 != NULL);

View File

@ -53,20 +53,20 @@ SSyncCfg* createSyncCfg() {
return pCfg;
}
const char *pFile = "./raft_config_index.json";
const char* pFile = "./raft_config_index.json";
void test1() {
int32_t code = raftCfgIndexCreateFile(pFile);
ASSERT(code == 0);
SRaftCfgIndex *pRaftCfgIndex = raftCfgIndexOpen(pFile);
SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile);
raftCfgIndexLog2((char*)"==test1==", pRaftCfgIndex);
raftCfgIndexClose(pRaftCfgIndex);
}
void test2() {
SRaftCfgIndex *pRaftCfgIndex = raftCfgIndexOpen(pFile);
SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile);
for (int i = 0; i < 500; ++i) {
raftCfgIndexAddConfigIndex(pRaftCfgIndex, i);
}
@ -77,7 +77,7 @@ void test2() {
}
void test3() {
SRaftCfgIndex *pRaftCfgIndex = raftCfgIndexOpen(pFile);
SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile);
raftCfgIndexLog2((char*)"==test3==", pRaftCfgIndex);
raftCfgIndexClose(pRaftCfgIndex);

View File

@ -69,7 +69,7 @@ void test1() {
void test2() {
SyncReconfigFinish *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncReconfigFinishSerialize(pMsg, serialized, len);
SyncReconfigFinish *pMsg2 = syncReconfigFinishBuild(1000);
syncReconfigFinishDeserialize(serialized, len, pMsg2);
@ -83,7 +83,7 @@ void test2() {
void test3() {
SyncReconfigFinish *pMsg = createMsg();
uint32_t len;
char * serialized = syncReconfigFinishSerialize2(pMsg, &len);
char *serialized = syncReconfigFinishSerialize2(pMsg, &len);
SyncReconfigFinish *pMsg2 = syncReconfigFinishDeserialize2(serialized, len);
syncReconfigFinishLog2((char *)"test3: SyncReconfigFinishSerialize2 -> syncReconfigFinishDeserialize2 ", pMsg2);

View File

@ -25,7 +25,7 @@ int g = 100;
typedef struct SyncObj {
int64_t rid;
void * data;
void *data;
char name[32];
int counter;
} SyncObj;

View File

@ -34,7 +34,7 @@ void test1() {
void test2() {
SyncRequestVoteReply *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncRequestVoteReplySerialize(pMsg, serialized, len);
SyncRequestVoteReply *pMsg2 = syncRequestVoteReplyBuild(1000);
syncRequestVoteReplyDeserialize(serialized, len, pMsg2);
@ -48,7 +48,7 @@ void test2() {
void test3() {
SyncRequestVoteReply *pMsg = createMsg();
uint32_t len;
char * serialized = syncRequestVoteReplySerialize2(pMsg, &len);
char *serialized = syncRequestVoteReplySerialize2(pMsg, &len);
SyncRequestVoteReply *pMsg2 = syncRequestVoteReplyDeserialize2(serialized, len);
syncRequestVoteReplyLog2((char *)"test3: syncRequestVoteReplySerialize3 -> syncRequestVoteReplyDeserialize2 ", pMsg2);

View File

@ -35,7 +35,7 @@ void test1() {
void test2() {
SyncRequestVote *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncRequestVoteSerialize(pMsg, serialized, len);
SyncRequestVote *pMsg2 = syncRequestVoteBuild(1000);
syncRequestVoteDeserialize(serialized, len, pMsg2);
@ -49,7 +49,7 @@ void test2() {
void test3() {
SyncRequestVote *pMsg = createMsg();
uint32_t len;
char * serialized = syncRequestVoteSerialize2(pMsg, &len);
char *serialized = syncRequestVoteSerialize2(pMsg, &len);
SyncRequestVote *pMsg2 = syncRequestVoteDeserialize2(serialized, len);
syncRequestVoteLog2((char *)"test3: syncRequestVoteSerialize3 -> syncRequestVoteDeserialize2 ", pMsg2);

View File

@ -38,7 +38,7 @@ void test1() {
void test2() {
SyncSnapshotRsp *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncSnapshotRspSerialize(pMsg, serialized, len);
SyncSnapshotRsp *pMsg2 = syncSnapshotRspBuild(1000);
syncSnapshotRspDeserialize(serialized, len, pMsg2);
@ -52,7 +52,7 @@ void test2() {
void test3() {
SyncSnapshotRsp *pMsg = createMsg();
uint32_t len;
char * serialized = syncSnapshotRspSerialize2(pMsg, &len);
char *serialized = syncSnapshotRspSerialize2(pMsg, &len);
SyncSnapshotRsp *pMsg2 = syncSnapshotRspDeserialize2(serialized, len);
syncSnapshotRspLog2((char *)"test3: syncSnapshotRspSerialize2 -> syncSnapshotRspDeserialize2 ", pMsg2);

View File

@ -48,7 +48,7 @@ void test1() {
void test2() {
SyncSnapshotSend *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncSnapshotSendSerialize(pMsg, serialized, len);
SyncSnapshotSend *pMsg2 = syncSnapshotSendBuild(pMsg->dataLen, 1000);
syncSnapshotSendDeserialize(serialized, len, pMsg2);
@ -62,7 +62,7 @@ void test2() {
void test3() {
SyncSnapshotSend *pMsg = createMsg();
uint32_t len;
char * serialized = syncSnapshotSendSerialize2(pMsg, &len);
char *serialized = syncSnapshotSendSerialize2(pMsg, &len);
SyncSnapshotSend *pMsg2 = syncSnapshotSendDeserialize2(serialized, len);
syncSnapshotSendLog2((char *)"test3: syncSnapshotSendSerialize2 -> syncSnapshotSendDeserialize2 ", pMsg2);

View File

@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId ids[TSDB_MAX_REPLICA];
SSyncInfo syncInfo;
SSyncFSM * pFsm;
SWal * pWal;
SSyncFSM *pFsm;
SWal *pWal;
SSyncNode *gSyncNode;
SyncIndex snapshotLastApplyIndex = SYNC_INDEX_INVALID;

View File

@ -30,7 +30,7 @@ void test1() {
void test2() {
SyncTimeout *pMsg = createMsg();
uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len);
char *serialized = (char *)taosMemoryMalloc(len);
syncTimeoutSerialize(pMsg, serialized, len);
SyncTimeout *pMsg2 = syncTimeoutBuild();
syncTimeoutDeserialize(serialized, len, pMsg2);
@ -44,7 +44,7 @@ void test2() {
void test3() {
SyncTimeout *pMsg = createMsg();
uint32_t len;
char * serialized = syncTimeoutSerialize2(pMsg, &len);
char *serialized = syncTimeoutSerialize2(pMsg, &len);
SyncTimeout *pMsg2 = syncTimeoutDeserialize2(serialized, len);
syncTimeoutLog2((char *)"test3: syncTimeoutSerialize3 -> syncTimeoutDeserialize2 ", pMsg2);
@ -80,7 +80,7 @@ void test5() {
void test6() {
SyncTimeout *pMsg = createMsg();
char * jsonStr = syncTimeout2Str(pMsg);
char *jsonStr = syncTimeout2Str(pMsg);
sTrace("jsonStr: %s", jsonStr);
syncUtilJson2Line(jsonStr);

View File

@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId ids[TSDB_MAX_REPLICA];
SSyncInfo syncInfo;
SSyncFSM * pFsm;
SWal * pWal;
SSyncFSM *pFsm;
SWal *pWal;
SSyncNode *gSyncNode;
const char *pDir = "./syncWriteTest";

View File

@ -26,7 +26,7 @@ FORMAT_DIR_LIST=(
# "${PRJ_ROOT_DIR}/source/libs/qworker"
"${PRJ_ROOT_DIR}/source/libs/scalar"
"${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/tfs"
"${PRJ_ROOT_DIR}/source/libs/transport"