Merge pull request #15359 from taosdata/feature/3.0_mhli

refactor(sync): add ref id in raft entry
This commit is contained in:
Li Minghao 2022-07-23 19:57:38 +08:00 committed by GitHub
commit 1986b77f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,7 @@ extern "C" {
extern bool gRaftDetailLog; extern bool gRaftDetailLog;
#define SYNC_RESP_TTL_MS 10000 #define SYNC_RESP_TTL_MS 10000000
#define SYNC_MAX_BATCH_SIZE 500 #define SYNC_MAX_BATCH_SIZE 500
#define SYNC_INDEX_BEGIN 0 #define SYNC_INDEX_BEGIN 0

View File

@ -36,6 +36,7 @@ typedef struct SSyncRaftEntry {
bool isWeak; bool isWeak;
SyncTerm term; SyncTerm term;
SyncIndex index; SyncIndex index;
int64_t rid;
uint32_t dataLen; // origin RpcMsg.contLen uint32_t dataLen; // origin RpcMsg.contLen
char data[]; // origin RpcMsg.pCont char data[]; // origin RpcMsg.pCont
} SSyncRaftEntry; } SSyncRaftEntry;

View File

@ -137,6 +137,8 @@ cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry) {
cJSON_AddStringToObject(pRoot, "term", u64buf); cJSON_AddStringToObject(pRoot, "term", u64buf);
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->index); snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->index);
cJSON_AddStringToObject(pRoot, "index", u64buf); cJSON_AddStringToObject(pRoot, "index", u64buf);
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pEntry->rid);
cJSON_AddStringToObject(pRoot, "rid", u64buf);
cJSON_AddNumberToObject(pRoot, "dataLen", pEntry->dataLen); cJSON_AddNumberToObject(pRoot, "dataLen", pEntry->dataLen);
char* s; char* s;

View File

@ -19,11 +19,14 @@
#include "syncRespMgr.h" #include "syncRespMgr.h"
int32_t syncNodeTimerRoutine(SSyncNode* ths) { int32_t syncNodeTimerRoutine(SSyncNode* ths) {
syncNodeEventLog(ths, "timer routines ... "); syncNodeEventLog(ths, "timer routines");
#if 0
if (ths->vgId != 1) { if (ths->vgId != 1) {
syncRespClean(ths->pSyncRespMgr); syncRespClean(ths->pSyncRespMgr);
} }
#endif
return 0; return 0;
} }