sync refactor
This commit is contained in:
parent
48aace92c5
commit
3139aaef05
|
@ -35,7 +35,7 @@ extern "C" {
|
||||||
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;
|
||||||
|
|
|
@ -120,6 +120,7 @@ int main(int argc, char** argv) {
|
||||||
"elect sleep, state: %d, %s, term:%lu electTimerLogicClock:%lu, electTimerLogicClockUser:%lu, electTimerMS:%d",
|
"elect sleep, state: %d, %s, term:%lu electTimerLogicClock:%lu, electTimerLogicClockUser:%lu, electTimerMS:%d",
|
||||||
gSyncNode->state, syncUtilState2String(gSyncNode->state), gSyncNode->pRaftStore->currentTerm,
|
gSyncNode->state, syncUtilState2String(gSyncNode->state), gSyncNode->pRaftStore->currentTerm,
|
||||||
gSyncNode->electTimerLogicClock, gSyncNode->electTimerLogicClockUser, gSyncNode->electTimerMS);
|
gSyncNode->electTimerLogicClock, gSyncNode->electTimerLogicClockUser, gSyncNode->electTimerMS);
|
||||||
|
taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,10 +21,10 @@ uint16_t ports[] = {7010, 7110, 7210, 7310, 7410};
|
||||||
int32_t replicaNum = 3;
|
int32_t replicaNum = 3;
|
||||||
int32_t myIndex = 0;
|
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;
|
||||||
|
|
||||||
int64_t syncNodeInit() {
|
int64_t syncNodeInit() {
|
||||||
syncInfo.vgId = 1234;
|
syncInfo.vgId = 1234;
|
||||||
|
@ -33,7 +33,7 @@ int64_t syncNodeInit() {
|
||||||
syncInfo.queue = gSyncIO->pMsgQ;
|
syncInfo.queue = gSyncIO->pMsgQ;
|
||||||
syncInfo.FpEqMsg = syncIOEqMsg;
|
syncInfo.FpEqMsg = syncIOEqMsg;
|
||||||
syncInfo.pFsm = pFsm;
|
syncInfo.pFsm = pFsm;
|
||||||
snprintf(syncInfo.path, sizeof(syncInfo.path), "./elect_test_%d", myIndex);
|
snprintf(syncInfo.path, sizeof(syncInfo.path), "./elect2_test_%d", myIndex);
|
||||||
|
|
||||||
int code = walInit();
|
int code = walInit();
|
||||||
assert(code == 0);
|
assert(code == 0);
|
||||||
|
@ -48,7 +48,7 @@ int64_t syncNodeInit() {
|
||||||
walCfg.level = TAOS_WAL_FSYNC;
|
walCfg.level = TAOS_WAL_FSYNC;
|
||||||
|
|
||||||
char tmpdir[128];
|
char tmpdir[128];
|
||||||
snprintf(tmpdir, sizeof(tmpdir), "./elect_test_wal_%d", myIndex);
|
snprintf(tmpdir, sizeof(tmpdir), "./elect2_test_wal_%d", myIndex);
|
||||||
pWal = walOpen(tmpdir, &walCfg);
|
pWal = walOpen(tmpdir, &walCfg);
|
||||||
assert(pWal != NULL);
|
assert(pWal != NULL);
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ int64_t syncNodeInit() {
|
||||||
// taosGetFqdn(pCfg->nodeInfo[0].nodeFqdn);
|
// taosGetFqdn(pCfg->nodeInfo[0].nodeFqdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int64_t rid = syncStart(&syncInfo);
|
int64_t rid = syncStart(&syncInfo);
|
||||||
assert(rid > 0);
|
assert(rid > 0);
|
||||||
|
|
||||||
|
@ -127,6 +126,7 @@ int main(int argc, char** argv) {
|
||||||
"elect sleep, state: %d, %s, term:%lu electTimerLogicClock:%lu, electTimerLogicClockUser:%lu, electTimerMS:%d",
|
"elect sleep, state: %d, %s, term:%lu electTimerLogicClock:%lu, electTimerLogicClockUser:%lu, electTimerMS:%d",
|
||||||
pSyncNode->state, syncUtilState2String(pSyncNode->state), pSyncNode->pRaftStore->currentTerm,
|
pSyncNode->state, syncUtilState2String(pSyncNode->state), pSyncNode->pRaftStore->currentTerm,
|
||||||
pSyncNode->electTimerLogicClock, pSyncNode->electTimerLogicClockUser, pSyncNode->electTimerMS);
|
pSyncNode->electTimerLogicClock, pSyncNode->electTimerLogicClockUser, pSyncNode->electTimerMS);
|
||||||
|
taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
syncNodeRelease(pSyncNode);
|
syncNodeRelease(pSyncNode);
|
||||||
|
|
Loading…
Reference in New Issue