Merge remote-tracking branch 'origin/feature/sim' into feature/win
This commit is contained in:
commit
7b71a3dfb1
|
@ -56,7 +56,7 @@ int32_t bnInitThread() {
|
||||||
pthread_attr_destroy(&thattr);
|
pthread_attr_destroy(&thattr);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
mError("failed to create balance thread since %s", strerror(errno));
|
mError("failed to create balance thread since %s", strerror(ret));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ int32_t dnodeInitTelemetry() {
|
||||||
int32_t code = pthread_create(&tsTelemetryThread, &attr, telemetryThread, NULL);
|
int32_t code = pthread_create(&tsTelemetryThread, &attr, telemetryThread, NULL);
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
dTrace("failed to create telemetry thread, reason:%s", strerror(errno));
|
dTrace("failed to create telemetry thread, reason:%s", strerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
dInfo("dnode telemetry is initialized");
|
dInfo("dnode telemetry is initialized");
|
||||||
|
|
|
@ -56,7 +56,10 @@ void httpCleanUpConnect() {
|
||||||
HttpServer *pServer = &tsHttpServer;
|
HttpServer *pServer = &tsHttpServer;
|
||||||
if (pServer->pThreads == NULL) return;
|
if (pServer->pThreads == NULL) return;
|
||||||
|
|
||||||
pthread_join(pServer->thread, NULL);
|
if (taosCheckPthreadValid(pServer->thread)) {
|
||||||
|
pthread_join(pServer->thread, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pServer->numOfThreads; ++i) {
|
for (int32_t i = 0; i < pServer->numOfThreads; ++i) {
|
||||||
HttpThread* pThread = pServer->pThreads + i;
|
HttpThread* pThread = pServer->pThreads + i;
|
||||||
if (pThread != NULL) {
|
if (pThread != NULL) {
|
||||||
|
|
|
@ -246,7 +246,10 @@ void monStopSystem() {
|
||||||
void monCleanupSystem() {
|
void monCleanupSystem() {
|
||||||
tsMonitor.quiting = 1;
|
tsMonitor.quiting = 1;
|
||||||
monStopSystem();
|
monStopSystem();
|
||||||
pthread_join(tsMonitor.thread, NULL);
|
if (taosCheckPthreadValid(tsMonitor.thread)) {
|
||||||
|
pthread_join(tsMonitor.thread, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (tsMonitor.conn != NULL) {
|
if (tsMonitor.conn != NULL) {
|
||||||
taos_close(tsMonitor.conn);
|
taos_close(tsMonitor.conn);
|
||||||
tsMonitor.conn = NULL;
|
tsMonitor.conn = NULL;
|
||||||
|
|
|
@ -156,7 +156,7 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
code = pthread_create(&pServerObj->thread, &thattr, taosAcceptTcpConnection, (void *)pServerObj);
|
code = pthread_create(&pServerObj->thread, &thattr, taosAcceptTcpConnection, (void *)pServerObj);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
tError("%s failed to create TCP accept thread(%s)", label, strerror(errno));
|
tError("%s failed to create TCP accept thread(%s)", label, strerror(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,9 @@ void taosCacheCleanup(SCacheObj *pCacheObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pCacheObj->deleting = 1;
|
pCacheObj->deleting = 1;
|
||||||
pthread_join(pCacheObj->refreshWorker, NULL);
|
if (taosCheckPthreadValid(pCacheObj->refreshWorker)) {
|
||||||
|
pthread_join(pCacheObj->refreshWorker, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
uInfo("cache:%s will be cleaned up", pCacheObj->name);
|
uInfo("cache:%s will be cleaned up", pCacheObj->name);
|
||||||
doCleanupDataCache(pCacheObj);
|
doCleanupDataCache(pCacheObj);
|
||||||
|
|
|
@ -201,6 +201,8 @@ int32_t vnodeOpen(int32_t vgId) {
|
||||||
pthread_mutex_init(&pVnode->statusMutex, NULL);
|
pthread_mutex_init(&pVnode->statusMutex, NULL);
|
||||||
vnodeSetInitStatus(pVnode);
|
vnodeSetInitStatus(pVnode);
|
||||||
|
|
||||||
|
tsdbIncCommitRef(pVnode->vgId);
|
||||||
|
|
||||||
int32_t code = vnodeReadCfg(pVnode);
|
int32_t code = vnodeReadCfg(pVnode);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
vnodeCleanUp(pVnode);
|
vnodeCleanUp(pVnode);
|
||||||
|
@ -297,7 +299,6 @@ int32_t vnodeOpen(int32_t vgId) {
|
||||||
pVnode->events = NULL;
|
pVnode->events = NULL;
|
||||||
|
|
||||||
vDebug("vgId:%d, vnode is opened in %s, pVnode:%p", pVnode->vgId, rootDir, pVnode);
|
vDebug("vgId:%d, vnode is opened in %s, pVnode:%p", pVnode->vgId, rootDir, pVnode);
|
||||||
tsdbIncCommitRef(pVnode->vgId);
|
|
||||||
|
|
||||||
vnodeAddIntoHash(pVnode);
|
vnodeAddIntoHash(pVnode);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#undef TAOS_MEM_CHECK
|
#undef TAOS_MEM_CHECK
|
||||||
|
|
||||||
bool simAsyncQuery = false;
|
bool simAsyncQuery = false;
|
||||||
|
bool simExecSuccess = false;
|
||||||
|
|
||||||
void simHandleSignal(int32_t signo) {
|
void simHandleSignal(int32_t signo) {
|
||||||
simSystemCleanUp();
|
simSystemCleanUp();
|
||||||
|
@ -62,5 +63,8 @@ int32_t main(int32_t argc, char *argv[]) {
|
||||||
simScriptList[++simScriptPos] = script;
|
simScriptList[++simScriptPos] = script;
|
||||||
simExecuteScript(script);
|
simExecuteScript(script);
|
||||||
|
|
||||||
return 0;
|
int32_t ret = simExecSuccess ? 0 : -1;
|
||||||
|
simError("execute result %d", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@
|
||||||
#include "ttimer.h"
|
#include "ttimer.h"
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
#include "tsocket.h"
|
#include "tsocket.h"
|
||||||
|
#include "taoserror.h"
|
||||||
#undef TAOS_MEM_CHECK
|
#undef TAOS_MEM_CHECK
|
||||||
|
|
||||||
SScript *simScriptList[MAX_MAIN_SCRIPT_NUM];
|
SScript *simScriptList[MAX_MAIN_SCRIPT_NUM];
|
||||||
|
@ -31,6 +32,8 @@ int32_t simDebugFlag = 135;
|
||||||
void simCloseTaosdConnect(SScript *script);
|
void simCloseTaosdConnect(SScript *script);
|
||||||
char simHostName[128];
|
char simHostName[128];
|
||||||
|
|
||||||
|
extern bool simExecSuccess;
|
||||||
|
|
||||||
char *simParseArbitratorName(char *varName) {
|
char *simParseArbitratorName(char *varName) {
|
||||||
static char hostName[140];
|
static char hostName[140];
|
||||||
sprintf(hostName, "%s:%d", simHostName, 8000);
|
sprintf(hostName, "%s:%d", simHostName, 8000);
|
||||||
|
@ -118,10 +121,12 @@ SScript *simProcessCallOver(SScript *script) {
|
||||||
if (script->type == SIM_SCRIPT_TYPE_MAIN) {
|
if (script->type == SIM_SCRIPT_TYPE_MAIN) {
|
||||||
simDebug("script:%s, is main script, set stop flag", script->fileName);
|
simDebug("script:%s, is main script, set stop flag", script->fileName);
|
||||||
if (script->killed) {
|
if (script->killed) {
|
||||||
|
simExecSuccess = false;
|
||||||
simInfo("script:" FAILED_PREFIX "%s" FAILED_POSTFIX ", " FAILED_PREFIX "failed" FAILED_POSTFIX ", error:%s",
|
simInfo("script:" FAILED_PREFIX "%s" FAILED_POSTFIX ", " FAILED_PREFIX "failed" FAILED_POSTFIX ", error:%s",
|
||||||
script->fileName, script->error);
|
script->fileName, script->error);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
|
simExecSuccess = true;
|
||||||
simInfo("script:" SUCCESS_PREFIX "%s" SUCCESS_POSTFIX ", " SUCCESS_PREFIX "success" SUCCESS_POSTFIX,
|
simInfo("script:" SUCCESS_PREFIX "%s" SUCCESS_POSTFIX ", " SUCCESS_PREFIX "success" SUCCESS_POSTFIX,
|
||||||
script->fileName);
|
script->fileName);
|
||||||
simCloseTaosdConnect(script);
|
simCloseTaosdConnect(script);
|
||||||
|
|
Loading…
Reference in New Issue