提交 f56c354c 编写于 作者: S Shengliang Guan

fix: startup is slow in valgrind mode

上级 9ba91dba
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
void simLogSql(char *sql, bool useSharp) { void simLogSql(char *sql, bool useSharp) {
static TdFilePtr pFile = NULL; static TdFilePtr pFile = NULL;
char filename[256]; char filename[256];
sprintf(filename, "%s/sim.sql", simScriptDir); sprintf(filename, "%s/sim.sql", simScriptDir);
if (pFile == NULL) { if (pFile == NULL) {
// fp = fopen(filename, "w"); // fp = fopen(filename, "w");
...@@ -305,7 +305,8 @@ bool simExecuteRunBackCmd(SScript *script, char *option) { ...@@ -305,7 +305,8 @@ bool simExecuteRunBackCmd(SScript *script, char *option) {
return true; return true;
} }
void simReplaceStr(char *buf, char *src, char *dst) { bool simReplaceStr(char *buf, char *src, char *dst) {
bool replaced = false;
char *begin = strstr(buf, src); char *begin = strstr(buf, src);
if (begin != NULL) { if (begin != NULL) {
int32_t srcLen = (int32_t)strlen(src); int32_t srcLen = (int32_t)strlen(src);
...@@ -320,13 +321,16 @@ void simReplaceStr(char *buf, char *src, char *dst) { ...@@ -320,13 +321,16 @@ void simReplaceStr(char *buf, char *src, char *dst) {
} }
memcpy(begin, dst, dstLen); memcpy(begin, dst, dstLen);
replaced = true;
} }
simInfo("system cmd is %s", buf); simInfo("system cmd is %s", buf);
return replaced;
} }
bool simExecuteSystemCmd(SScript *script, char *option) { bool simExecuteSystemCmd(SScript *script, char *option) {
char buf[4096] = {0}; char buf[4096] = {0};
bool replaced = false;
#ifndef WINDOWS #ifndef WINDOWS
sprintf(buf, "cd %s; ", simScriptDir); sprintf(buf, "cd %s; ", simScriptDir);
...@@ -341,7 +345,7 @@ bool simExecuteSystemCmd(SScript *script, char *option) { ...@@ -341,7 +345,7 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
} }
if (useValgrind) { if (useValgrind) {
simReplaceStr(buf, "exec.sh", "exec.sh -v"); replaced = simReplaceStr(buf, "exec.sh", "exec.sh -v");
} }
simLogSql(buf, true); simLogSql(buf, true);
...@@ -359,6 +363,11 @@ bool simExecuteSystemCmd(SScript *script, char *option) { ...@@ -359,6 +363,11 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
sprintf(script->system_exit_code, "%d", code); sprintf(script->system_exit_code, "%d", code);
script->linePos++; script->linePos++;
if (replaced && strstr(buf, "start") != NULL) {
simInfo("====> startup is slow in valgrind mode, so sleep 5 seconds after exec.sh -s start");
taosMsleep(5000);
}
return true; return true;
} }
...@@ -774,7 +783,7 @@ bool simExecuteSqlSlowCmd(SScript *script, char *rest) { ...@@ -774,7 +783,7 @@ bool simExecuteSqlSlowCmd(SScript *script, char *rest) {
bool simExecuteRestfulCmd(SScript *script, char *rest) { bool simExecuteRestfulCmd(SScript *script, char *rest) {
TdFilePtr pFile = NULL; TdFilePtr pFile = NULL;
char filename[256]; char filename[256];
sprintf(filename, "%s/tmp.sql", simScriptDir); sprintf(filename, "%s/tmp.sql", simScriptDir);
// fp = fopen(filename, "w"); // fp = fopen(filename, "w");
pFile = taosOpenFile(filename, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_STREAM); pFile = taosOpenFile(filename, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_STREAM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册