TDengine/source/libs/sync/test/syncTest.cpp

59 lines
1.1 KiB
C++
Raw Normal View History

2022-02-22 03:28:15 +00:00
#include <stdio.h>
2022-02-26 18:24:50 +00:00
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.h"
#include "gtest/gtest.h"
2022-02-23 08:14:02 +00:00
2022-02-26 18:24:50 +00:00
void *pingFunc(void *param) {
SSyncIO *io = (SSyncIO *)param;
while (1) {
sDebug("io->ping");
io->ping(io);
sleep(1);
}
return NULL;
2022-02-22 03:28:15 +00:00
}
2022-02-26 10:30:58 +00:00
2022-02-26 18:24:50 +00:00
int main() {
2022-02-27 06:27:06 +00:00
//taosInitLog((char *)"syncTest.log", 100000, 10);
2022-02-26 18:24:50 +00:00
tsAsyncLog = 0;
sDebugFlag = 143 + 64;
sTrace("sync log test: trace");
sDebug("sync log test: debug");
sInfo("sync log test: info");
sWarn("sync log test: warn");
sError("sync log test: error");
sFatal("sync log test: fatal");
SRaftStore *pRaftStore = raftStoreOpen("./raft_store.json");
// assert(pRaftStore != NULL);
2022-02-26 18:24:50 +00:00
// raftStorePrint(pRaftStore);
2022-02-26 18:24:50 +00:00
// pRaftStore->currentTerm = 100;
// pRaftStore->voteFor.addr = 200;
// pRaftStore->voteFor.vgId = 300;
2022-02-26 18:24:50 +00:00
// raftStorePrint(pRaftStore);
2022-02-26 18:24:50 +00:00
// raftStorePersist(pRaftStore);
2022-02-26 18:24:50 +00:00
// sDebug("sync test");
2022-02-26 18:24:50 +00:00
// SSyncIO *syncIO = syncIOCreate();
// assert(syncIO != NULL);
2022-02-26 18:24:50 +00:00
// syncIO->start(syncIO);
2022-02-26 18:24:50 +00:00
// sleep(2);
2022-02-26 18:24:50 +00:00
// pthread_t tid;
// pthread_create(&tid, NULL, pingFunc, syncIO);
2022-02-26 18:24:50 +00:00
// while (1) {
// sleep(1);
// }
2022-02-26 18:24:50 +00:00
return 0;
}