From cffe2185339bd448d23780152d09e3fc1fe69060 Mon Sep 17 00:00:00 2001 From: slguan Date: Fri, 12 Jul 2019 11:25:11 +0800 Subject: [PATCH] Solve the bugs when creating the database --- src/client/src/tscProfile.c | 9 +++++++++ src/client/src/tscSQLParser.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index 019b0e4a4c..c51c20868a 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -201,6 +201,15 @@ char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) { pMsg += sizeof(SQList); SSqlObj *pSql = pObj->sqlList; while (pSql) { + /* + * avoid sqlobj may not be correctly removed from sql list + * e.g., forgetting to free the sql result may cause the sql object still in sql list + */ + if (pSql->sqlstr == NULL) { + pSql = pSql->next; + continue; + } + strncpy(pQdesc->sql, pSql->sqlstr, TSDB_SHOW_SQL_LEN - 1); pQdesc->sql[TSDB_SHOW_SQL_LEN - 1] = 0; pQdesc->stime = pSql->stime; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 52ba520e64..e786e6b134 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3928,9 +3928,9 @@ static void setCreateDBOption(SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { pMsg->daysToKeep2 = htonl(-1); pMsg->blocksPerMeter = (pCreateDb->numOfBlocksPerTable == 0) ? htons(-1) : htons(pCreateDb->numOfBlocksPerTable); - pMsg->compression = (pCreateDb->compressionLevel == 0) ? -1 : pCreateDb->numOfAvgCacheBlocks; + pMsg->compression = (pCreateDb->compressionLevel == 0) ? -1 : pCreateDb->compressionLevel; - pMsg->commitLog = (pCreateDb->commitLog == 0) ? -1 : pCreateDb->numOfAvgCacheBlocks; + pMsg->commitLog = (pCreateDb->commitLog == 0) ? -1 : pCreateDb->commitLog; pMsg->commitTime = (pCreateDb->commitTime == 0) ? htonl(-1) : htonl(pCreateDb->commitTime); pMsg->maxSessions = (pCreateDb->tablesPerVnode == 0) ? htonl(-1) : htonl(pCreateDb->tablesPerVnode); pMsg->cacheNumOfBlocks.fraction = (pCreateDb->numOfAvgCacheBlocks == 0) ? -1 : pCreateDb->numOfAvgCacheBlocks; -- GitLab