syncEnvTest.cpp 1.1 KB
Newer Older
M
Minghao Li 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#include "syncEnv.h"
#include <stdio.h>
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.h"

void logTest() {
  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");
}

void doSync() {
  SSyncInfo syncInfo;
  syncInfo.vgId = 1;

  SSyncCfg* pCfg = &syncInfo.syncCfg;
  pCfg->replicaNum = 3;

  pCfg->nodeInfo[0].nodePort = 7010;
  taosGetFqdn(pCfg->nodeInfo[0].nodeFqdn);

  pCfg->nodeInfo[1].nodePort = 7110;
  taosGetFqdn(pCfg->nodeInfo[1].nodeFqdn);

  pCfg->nodeInfo[2].nodePort = 7210;
  taosGetFqdn(pCfg->nodeInfo[2].nodeFqdn);

  SSyncNode* pSyncNode = syncNodeOpen(&syncInfo);
  assert(pSyncNode != NULL);
}

int main() {
M
Minghao Li 已提交
37
  // taosInitLog((char*)"syncEnvTest.log", 100000, 10);
M
Minghao Li 已提交
38 39
  tsAsyncLog = 0;
  sDebugFlag = 143 + 64;
M
Minghao Li 已提交
40
  int32_t ret;
M
Minghao Li 已提交
41 42 43

  logTest();

M
Minghao Li 已提交
44 45
  // ret = syncIOStart();
  // assert(ret == 0);
M
Minghao Li 已提交
46 47 48 49

  ret = syncEnvStart();
  assert(ret == 0);

M
Minghao Li 已提交
50
  // doSync();
M
Minghao Li 已提交
51 52 53 54 55 56 57

  while (1) {
    taosMsleep(1000);
  }

  return 0;
}