Merge branch 'develop' into coverity_scan
This commit is contained in:
commit
539c7c2b07
|
@ -55,7 +55,7 @@
|
|||
<li>enableMonitor: 系统监测标志位,0:关闭,1:打开</li>
|
||||
<li>logDir: 日志文件目录,缺省是/var/log/taos</li>
|
||||
<li>numOfLogLines:日志文件的最大行数</li>
|
||||
<li>debugFlag: 系统debug日志开关,131:仅错误和报警信息,135:所有</li>
|
||||
<li>debugFlag: 系统debug日志开关,131:仅错误和报警信息,135:调试信息,143:非常详细的调试信息</li>
|
||||
</ul>
|
||||
<p>不同应用场景的数据往往具有不同的数据特征,比如保留天数、副本数、采集频次、记录大小、采集点的数量、压缩等都可完全不同。为获得在存储上的最高效率,TDengine提供如下存储相关的系统配置参数:</p>
|
||||
<ul>
|
||||
|
|
|
@ -35,6 +35,8 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
|
|||
MESSAGE(STATUS "build version ${VERSION_INFO}")
|
||||
SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${VERSION_INFO} SOVERSION 1)
|
||||
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
|
||||
ELSEIF (TD_WINDOWS_64)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows)
|
||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows/win32)
|
||||
|
|
|
@ -23,12 +23,17 @@ extern "C" {
|
|||
#include "tlog.h"
|
||||
|
||||
extern int32_t cDebugFlag;
|
||||
extern int32_t tscEmbedded;
|
||||
|
||||
#define tscError(...) { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR TSC ", cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscWarn(...) { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("WARN TSC ", cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscTrace(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscDump(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscPrint(...) { taosPrintLog("TSC ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
|
||||
#define tscFatal(...) { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscError(...) { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscWarn(...) { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscInfo(...) { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC INFO ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscDebug(...) { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC DEBUG ", cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscTrace(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC TRACE ", cDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define tscDebugDump(...) { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC DEBUG ", cDebugFlag, __VA_ARGS__); }}
|
||||
#define tscTraceDump(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLongString("TSC TRACE ", cDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -171,11 +171,7 @@ typedef struct STableDataBlocks {
|
|||
* to avoid it to be removed from cache
|
||||
*/
|
||||
STableMeta *pTableMeta;
|
||||
|
||||
union {
|
||||
char *filename;
|
||||
char *pData;
|
||||
};
|
||||
|
||||
// for parameter ('?') binding
|
||||
uint32_t numOfAllocedParams;
|
||||
|
@ -398,7 +394,7 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code) ;
|
|||
int doAsyncParseSql(SSqlObj* pSql);
|
||||
void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, void (*fp)(), void *param, const char *sqlstr, size_t sqlLen);
|
||||
|
||||
void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql);
|
||||
void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql);
|
||||
void tscKillSTableQuery(SSqlObj *pSql);
|
||||
void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen);
|
||||
bool tscIsUpdateQuery(SSqlObj* pSql);
|
||||
|
|
|
@ -22,26 +22,15 @@
|
|||
|
||||
#include "com_taosdata_jdbc_TSDBJNIConnector.h"
|
||||
|
||||
#define jniError(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_ERROR) { \
|
||||
taosPrintLog("ERROR JNI ", jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniWarn(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_WARN) { \
|
||||
taosPrintLog("WARN JNI ", jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniTrace(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_TRACE) { \
|
||||
taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniPrint(...) \
|
||||
{ taosPrintLog("JNI ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
|
||||
#define jniFatal(...) { if (jniDebugFlag & DEBUG_FATAL) { taosPrintLog("JNI FATAL ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
|
||||
#define jniError(...) { if (jniDebugFlag & DEBUG_ERROR) { taosPrintLog("JNI ERROR ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
|
||||
#define jniWarn(...) { if (jniDebugFlag & DEBUG_WARN) { taosPrintLog("JNI WARN ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
|
||||
#define jniInfo(...) { if (jniDebugFlag & DEBUG_INFO) { taosPrintLog("JNI INFO ", tscEmbedded ? 255 : jniDebugFlag, __VA_ARGS__); }}
|
||||
#define jniDebug(...) { if (jniDebugFlag & DEBUG_DEBUG) { taosPrintLog("JNI DEBUG ", jniDebugFlag, __VA_ARGS__); }}
|
||||
#define jniTrace(...) { if (jniDebugFlag & DEBUG_TRACE) { taosPrintLog("JNI TRACE ", jniDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define jniDebugDump(...) { if (jniDebugFlag & DEBUG_DEBUG) { taosPrintLongString("JNI DEBUG ", jniDebugFlag, __VA_ARGS__); }}
|
||||
#define jniTraceDump(...) { if (jniDebugFlag & DEBUG_TRACE) { taosPrintLongString("JNI DEBUG ", jniDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
int __init = 0;
|
||||
|
||||
|
@ -130,7 +119,7 @@ void jniGetGlobalMethod(JNIEnv *env) {
|
|||
(*env)->DeleteLocalRef(env, rowdataClass);
|
||||
|
||||
atomic_store_32(&__init, 2);
|
||||
jniTrace("native method register finished");
|
||||
jniDebug("native method register finished");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setAllocModeImp(JNIEnv *env, jobject jobj, jint jMode,
|
||||
|
@ -158,13 +147,13 @@ JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_initImp(JNIEnv *e
|
|||
}
|
||||
|
||||
jniGetGlobalMethod(env);
|
||||
jniTrace("jni initialized successfully, config directory: %s", configDir);
|
||||
jniDebug("jni initialized successfully, config directory: %s", configDir);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv *env, jobject jobj, jint optionIndex,
|
||||
jstring optionValue) {
|
||||
if (optionValue == NULL) {
|
||||
jniTrace("option index:%d value is null", optionIndex);
|
||||
jniDebug("option index:%d value is null", optionIndex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -174,27 +163,27 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv
|
|||
const char *locale = (*env)->GetStringUTFChars(env, optionValue, NULL);
|
||||
if (locale && strlen(locale) != 0) {
|
||||
res = taos_options(TSDB_OPTION_LOCALE, locale);
|
||||
jniTrace("set locale to %s, result:%d", locale, res);
|
||||
jniDebug("set locale to %s, result:%d", locale, res);
|
||||
} else {
|
||||
jniTrace("input locale is empty");
|
||||
jniDebug("input locale is empty");
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, optionValue, locale);
|
||||
} else if (optionIndex == TSDB_OPTION_CHARSET) {
|
||||
const char *charset = (*env)->GetStringUTFChars(env, optionValue, NULL);
|
||||
if (charset && strlen(charset) != 0) {
|
||||
res = taos_options(TSDB_OPTION_CHARSET, charset);
|
||||
jniTrace("set character encoding to %s, result:%d", charset, res);
|
||||
jniDebug("set character encoding to %s, result:%d", charset, res);
|
||||
} else {
|
||||
jniTrace("input character encoding is empty");
|
||||
jniDebug("input character encoding is empty");
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, optionValue, charset);
|
||||
} else if (optionIndex == TSDB_OPTION_TIMEZONE) {
|
||||
const char *tz1 = (*env)->GetStringUTFChars(env, optionValue, NULL);
|
||||
if (tz1 && strlen(tz1) != 0) {
|
||||
res = taos_options(TSDB_OPTION_TIMEZONE, tz1);
|
||||
jniTrace("set timezone to %s, result:%d", tz1, res);
|
||||
jniDebug("set timezone to %s, result:%d", tz1, res);
|
||||
} else {
|
||||
jniTrace("input timezone is empty");
|
||||
jniDebug("input timezone is empty");
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, optionValue, tz1);
|
||||
} else {
|
||||
|
@ -227,10 +216,10 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEn
|
|||
}
|
||||
|
||||
if (user == NULL) {
|
||||
jniTrace("jobj:%p, user is null, use default user %s", jobj, TSDB_DEFAULT_USER);
|
||||
jniDebug("jobj:%p, user is null, use default user %s", jobj, TSDB_DEFAULT_USER);
|
||||
}
|
||||
if (pass == NULL) {
|
||||
jniTrace("jobj:%p, pass is null, use default password", jobj);
|
||||
jniDebug("jobj:%p, pass is null, use default password", jobj);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -244,7 +233,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEn
|
|||
jniError("jobj:%p, conn:%p, connect to database failed, host=%s, user=%s, dbname=%s, port=%d", jobj, (void *)ret,
|
||||
(char *)host, (char *)user, (char *)dbname, jport);
|
||||
} else {
|
||||
jniTrace("jobj:%p, conn:%p, connect to database succeed, host=%s, user=%s, dbname=%s, port=%d", jobj, (void *)ret,
|
||||
jniDebug("jobj:%p, conn:%p, connect to database succeed, host=%s, user=%s, dbname=%s, port=%d", jobj, (void *)ret,
|
||||
(char *)host, (char *)user, (char *)dbname, jport);
|
||||
}
|
||||
|
||||
|
@ -282,7 +271,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeQueryImp(
|
|||
// todo handle error
|
||||
}
|
||||
|
||||
jniTrace("jobj:%p, conn:%p, sql:%s", jobj, tscon, dst);
|
||||
jniDebug("jobj:%p, conn:%p, sql:%s", jobj, tscon, dst);
|
||||
|
||||
SSqlObj *pSql = taos_query(tscon, dst);
|
||||
int32_t code = taos_errno(pSql);
|
||||
|
@ -293,9 +282,9 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeQueryImp(
|
|||
int32_t affectRows = 0;
|
||||
if (pSql->cmd.command == TSDB_SQL_INSERT) {
|
||||
affectRows = taos_affected_rows(pSql);
|
||||
jniTrace("jobj:%p, conn:%p, code:%s, affect rows:%d", jobj, tscon, tstrerror(code), affectRows);
|
||||
jniDebug("jobj:%p, conn:%p, code:%s, affect rows:%d", jobj, tscon, tstrerror(code), affectRows);
|
||||
} else {
|
||||
jniTrace("jobj:%p, conn:%p, code:%s", jobj, tscon, tstrerror(code));
|
||||
jniDebug("jobj:%p, conn:%p, code:%s", jobj, tscon, tstrerror(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,10 +332,10 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getResultSetImp(
|
|||
|
||||
if (tscIsUpdateQuery(pSql)) {
|
||||
// taos_free_result(pSql); // free result here
|
||||
jniTrace("jobj:%p, conn:%p, no resultset, %p", jobj, pObj, (void *)tres);
|
||||
jniDebug("jobj:%p, conn:%p, no resultset, %p", jobj, pObj, (void *)tres);
|
||||
return 0;
|
||||
} else {
|
||||
jniTrace("jobj:%p, conn:%p, get resultset, %p", jobj, pObj, (void *)tres);
|
||||
jniDebug("jobj:%p, conn:%p, get resultset, %p", jobj, pObj, (void *)tres);
|
||||
return tres;
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +354,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_freeResultSetImp(
|
|||
}
|
||||
|
||||
taos_free_result((void *)res);
|
||||
jniTrace("jobj:%p, conn:%p, free resultset:%p", jobj, tscon, (void *)res);
|
||||
jniDebug("jobj:%p, conn:%p, free resultset:%p", jobj, tscon, (void *)res);
|
||||
return JNI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -383,7 +372,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsIm
|
|||
}
|
||||
|
||||
jint ret = taos_affected_rows((SSqlObj *)res);
|
||||
jniTrace("jobj:%p, conn:%p, sql:%p, res: %p, affect rows:%d", jobj, tscon, (void *)con, (void *)res, ret);
|
||||
jniDebug("jobj:%p, conn:%p, sql:%p, res: %p, affect rows:%d", jobj, tscon, (void *)con, (void *)res, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -412,7 +401,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaData
|
|||
jniError("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, (void *)res, num_fields);
|
||||
return JNI_NUM_OF_FIELDS_0;
|
||||
} else {
|
||||
jniTrace("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, (void *)res, num_fields);
|
||||
jniDebug("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, (void *)res, num_fields);
|
||||
for (int i = 0; i < num_fields; ++i) {
|
||||
jobject metadataObj = (*env)->NewObject(env, g_metadataClass, g_metadataConstructFp);
|
||||
(*env)->SetIntField(env, metadataObj, g_metadataColtypeField, fields[i].type);
|
||||
|
@ -471,10 +460,10 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn
|
|||
if (row == NULL) {
|
||||
int tserrno = taos_errno(result);
|
||||
if (tserrno == 0) {
|
||||
jniTrace("jobj:%p, conn:%p, resultset:%p, fields size is %d, fetch row to the end", jobj, tscon, (void*)res, num_fields);
|
||||
jniDebug("jobj:%p, conn:%p, resultset:%p, fields size is %d, fetch row to the end", jobj, tscon, (void*)res, num_fields);
|
||||
return JNI_FETCH_END;
|
||||
} else {
|
||||
jniTrace("jobj:%p, conn:%p, interruptted query", jobj, tscon);
|
||||
jniDebug("jobj:%p, conn:%p, interruptted query", jobj, tscon);
|
||||
return JNI_RESULT_SET_NULL;
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +531,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_closeConnectionIm
|
|||
jniError("jobj:%p, connection is already closed", jobj);
|
||||
return JNI_CONNECTION_NULL;
|
||||
} else {
|
||||
jniTrace("jobj:%p, conn:%p, close connection success", jobj, tscon);
|
||||
jniDebug("jobj:%p, conn:%p, close connection success", jobj, tscon);
|
||||
taos_close(tscon);
|
||||
return JNI_SUCCESS;
|
||||
}
|
||||
|
@ -556,7 +545,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
|
|||
char *sql = NULL;
|
||||
|
||||
jniGetGlobalMethod(env);
|
||||
jniTrace("jobj:%p, in TSDBJNIConnector_subscribeImp", jobj);
|
||||
jniDebug("jobj:%p, in TSDBJNIConnector_subscribeImp", jobj);
|
||||
|
||||
if (jtopic != NULL) {
|
||||
topic = (char *)(*env)->GetStringUTFChars(env, jtopic, NULL);
|
||||
|
@ -566,7 +555,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
|
|||
}
|
||||
|
||||
if (topic == NULL || sql == NULL) {
|
||||
jniTrace("jobj:%p, invalid argument: topic or sql is NULL", jobj);
|
||||
jniDebug("jobj:%p, invalid argument: topic or sql is NULL", jobj);
|
||||
return sub;
|
||||
}
|
||||
|
||||
|
@ -574,9 +563,9 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
|
|||
sub = (jlong)tsub;
|
||||
|
||||
if (sub == 0) {
|
||||
jniTrace("jobj:%p, failed to subscribe: topic:%s", jobj, topic);
|
||||
jniDebug("jobj:%p, failed to subscribe: topic:%s", jobj, topic);
|
||||
} else {
|
||||
jniTrace("jobj:%p, successfully subscribe: topic: %s", jobj, topic);
|
||||
jniDebug("jobj:%p, successfully subscribe: topic: %s", jobj, topic);
|
||||
}
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, jtopic, topic);
|
||||
|
@ -586,7 +575,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNI
|
|||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNIEnv *env, jobject jobj, jlong sub) {
|
||||
jniTrace("jobj:%p, in TSDBJNIConnector_consumeImp, sub:%lld", jobj, sub);
|
||||
jniDebug("jobj:%p, in TSDBJNIConnector_consumeImp, sub:%lld", jobj, sub);
|
||||
jniGetGlobalMethod(env);
|
||||
|
||||
TAOS_SUB *tsub = (TAOS_SUB *)sub;
|
||||
|
@ -629,7 +618,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
|
|||
}
|
||||
|
||||
int code = taos_validate_sql(tscon, dst);
|
||||
jniTrace("jobj:%p, conn:%p, code is %d", jobj, tscon, code);
|
||||
jniDebug("jobj:%p, conn:%p, code is %d", jobj, tscon, code);
|
||||
|
||||
free(dst);
|
||||
return code;
|
||||
|
|
|
@ -55,7 +55,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
|
|||
|
||||
strtolower(pSql->sqlstr, sqlstr);
|
||||
|
||||
tscDump("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
tscDebugDump("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
pSql->cmd.curSql = pSql->sqlstr;
|
||||
|
||||
int32_t code = tsParseSql(pSql, true);
|
||||
|
@ -361,7 +361,7 @@ void tscProcessAsyncRes(SSchedMsg *pMsg) {
|
|||
}
|
||||
|
||||
if (shouldFree) {
|
||||
tscTrace("%p sqlObj is automatically freed in async res", pSql);
|
||||
tscDebug("%p sqlObj is automatically freed in async res", pSql);
|
||||
tscFreeSqlObj(pSql);
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
|
|||
|
||||
void tscQueueAsyncRes(SSqlObj *pSql) {
|
||||
if (pSql == NULL || pSql->signature != pSql) {
|
||||
tscTrace("%p SqlObj is freed, not add into queue async res", pSql);
|
||||
tscDebug("%p SqlObj is freed, not add into queue async res", pSql);
|
||||
return;
|
||||
} else {
|
||||
tscError("%p add into queued async res, code:%s", pSql, tstrerror(pSql->res.code));
|
||||
|
@ -401,12 +401,12 @@ void tscQueueAsyncRes(SSqlObj *pSql) {
|
|||
|
||||
void tscProcessAsyncFree(SSchedMsg *pMsg) {
|
||||
SSqlObj *pSql = (SSqlObj *)pMsg->ahandle;
|
||||
tscTrace("%p sql is freed", pSql);
|
||||
tscDebug("%p sql is freed", pSql);
|
||||
taos_free_result(pSql);
|
||||
}
|
||||
|
||||
void tscQueueAsyncFreeResult(SSqlObj *pSql) {
|
||||
tscTrace("%p sqlObj put in queue to async free", pSql);
|
||||
tscDebug("%p sqlObj put in queue to async free", pSql);
|
||||
|
||||
SSchedMsg schedMsg = { 0 };
|
||||
schedMsg.fp = tscProcessAsyncFree;
|
||||
|
@ -436,7 +436,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
|
||||
// check if it is a sub-query of super table query first, if true, enter another routine
|
||||
if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_STABLE_SUBQUERY)) {
|
||||
tscTrace("%p update table meta in local cache, continue to process sql and send corresponding subquery", pSql);
|
||||
tscDebug("%p update table meta in local cache, continue to process sql and send corresponding subquery", pSql);
|
||||
|
||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
code = tscGetTableMeta(pSql, pTableMetaInfo);
|
||||
|
@ -462,7 +462,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
}
|
||||
} else { // continue to process normal async query
|
||||
if (pCmd->parseFinished) {
|
||||
tscTrace("%p update table meta in local cache, continue to process sql and send corresponding query", pSql);
|
||||
tscDebug("%p update table meta in local cache, continue to process sql and send corresponding query", pSql);
|
||||
|
||||
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||
code = tscGetTableMeta(pSql, pTableMetaInfo);
|
||||
|
@ -481,7 +481,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
// code = tscSendMsgToServer(pSql);
|
||||
// if (code == TSDB_CODE_SUCCESS) return;
|
||||
} else {
|
||||
tscTrace("%p continue parse sql after get table meta", pSql);
|
||||
tscDebug("%p continue parse sql after get table meta", pSql);
|
||||
|
||||
code = tsParseSql(pSql, false);
|
||||
if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_STMT_INSERT)) {
|
||||
|
@ -522,14 +522,14 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
|||
}
|
||||
|
||||
if (pSql->pStream) {
|
||||
tscTrace("%p stream:%p meta is updated, start new query, command:%d", pSql, pSql->pStream, pSql->cmd.command);
|
||||
tscDebug("%p stream:%p meta is updated, start new query, command:%d", pSql, pSql->pStream, pSql->cmd.command);
|
||||
if (!pSql->cmd.parseFinished) {
|
||||
tsParseSql(pSql, false);
|
||||
sem_post(&pSql->rspSem);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
tscTrace("%p get tableMeta successfully", pSql);
|
||||
tscDebug("%p get tableMeta successfully", pSql);
|
||||
}
|
||||
|
||||
tscDoQuery(pSql);
|
||||
|
|
|
@ -962,7 +962,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
|
|||
} else if (pCtx->inputType == TSDB_DATA_TYPE_INT) {
|
||||
int32_t *data = (int32_t *)pOutput;
|
||||
#if defined(_DEBUG_VIEW)
|
||||
tscTrace("max value updated according to pre-cal:%d", *data);
|
||||
tscDebug("max value updated according to pre-cal:%d", *data);
|
||||
#endif
|
||||
|
||||
if ((*data < val) ^ isMin) {
|
||||
|
@ -1022,7 +1022,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
|
|||
*notNullElems += 1;
|
||||
}
|
||||
#if defined(_DEBUG_VIEW)
|
||||
tscTrace("max value updated:%d", *retVal);
|
||||
tscDebug("max value updated:%d", *retVal);
|
||||
#endif
|
||||
} else if (pCtx->inputType == TSDB_DATA_TYPE_BIGINT) {
|
||||
TYPED_LOOPCHECK_N(int64_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems);
|
||||
|
@ -1704,7 +1704,7 @@ static void last_data_assign_impl(SQLFunctionCtx *pCtx, char *pData, int32_t ind
|
|||
|
||||
if (pInfo->hasResult != DATA_SET_FLAG || pInfo->ts < timestamp[index]) {
|
||||
#if defined(_DEBUG_VIEW)
|
||||
tscTrace("assign index:%d, ts:%" PRId64 ", val:%d, ", index, timestamp[index], *(int32_t *)pData);
|
||||
tscDebug("assign index:%d, ts:%" PRId64 ", val:%d, ", index, timestamp[index], *(int32_t *)pData);
|
||||
#endif
|
||||
|
||||
memcpy(pCtx->aOutputBuf, pData, pCtx->inputBytes);
|
||||
|
@ -3973,7 +3973,7 @@ static double do_calc_rate(const SRateInfo* pRateInfo) {
|
|||
|
||||
double resultVal = ((double)diff) / duration;
|
||||
|
||||
tscTrace("do_calc_rate() isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " resultVal:%f",
|
||||
tscDebug("do_calc_rate() isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " resultVal:%f",
|
||||
pRateInfo->isIRate, pRateInfo->firstKey, pRateInfo->lastKey, pRateInfo->firstValue, pRateInfo->lastValue, pRateInfo->CorrectionValue, resultVal);
|
||||
|
||||
return resultVal;
|
||||
|
@ -4009,12 +4009,12 @@ static void rate_function(SQLFunctionCtx *pCtx) {
|
|||
SRateInfo *pRateInfo = (SRateInfo *)pResInfo->interResultBuf;
|
||||
TSKEY *primaryKey = pCtx->ptsList;
|
||||
|
||||
tscTrace("%p rate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull);
|
||||
tscDebug("%p rate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull);
|
||||
|
||||
for (int32_t i = 0; i < pCtx->size; ++i) {
|
||||
char *pData = GET_INPUT_CHAR_INDEX(pCtx, i);
|
||||
if (pCtx->hasNull && isNull(pData, pCtx->inputType)) {
|
||||
tscTrace("%p rate_function() index of null data:%d", pCtx, i);
|
||||
tscDebug("%p rate_function() index of null data:%d", pCtx, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4042,19 +4042,19 @@ static void rate_function(SQLFunctionCtx *pCtx) {
|
|||
pRateInfo->firstValue = v;
|
||||
pRateInfo->firstKey = primaryKey[i];
|
||||
|
||||
tscTrace("firstValue:%" PRId64 " firstKey:%" PRId64, pRateInfo->firstValue, pRateInfo->firstKey);
|
||||
tscDebug("firstValue:%" PRId64 " firstKey:%" PRId64, pRateInfo->firstValue, pRateInfo->firstKey);
|
||||
}
|
||||
|
||||
if (INT64_MIN == pRateInfo->lastValue) {
|
||||
pRateInfo->lastValue = v;
|
||||
} else if (v < pRateInfo->lastValue) {
|
||||
pRateInfo->CorrectionValue += pRateInfo->lastValue;
|
||||
tscTrace("CorrectionValue:%" PRId64, pRateInfo->CorrectionValue);
|
||||
tscDebug("CorrectionValue:%" PRId64, pRateInfo->CorrectionValue);
|
||||
}
|
||||
|
||||
pRateInfo->lastValue = v;
|
||||
pRateInfo->lastKey = primaryKey[i];
|
||||
tscTrace("lastValue:%" PRId64 " lastKey:%" PRId64, pRateInfo->lastValue, pRateInfo->lastKey);
|
||||
tscDebug("lastValue:%" PRId64 " lastKey:%" PRId64, pRateInfo->lastValue, pRateInfo->lastKey);
|
||||
}
|
||||
|
||||
if (!pCtx->hasNull) {
|
||||
|
@ -4117,7 +4117,7 @@ static void rate_function_f(SQLFunctionCtx *pCtx, int32_t index) {
|
|||
pRateInfo->lastValue = v;
|
||||
pRateInfo->lastKey = primaryKey[index];
|
||||
|
||||
tscTrace("====%p rate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " CorrectionValue:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->CorrectionValue);
|
||||
tscDebug("====%p rate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " CorrectionValue:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->CorrectionValue);
|
||||
|
||||
SET_VAL(pCtx, 1, 1);
|
||||
|
||||
|
@ -4137,7 +4137,7 @@ static void rate_func_merge(SQLFunctionCtx *pCtx) {
|
|||
SResultInfo *pResInfo = GET_RES_INFO(pCtx);
|
||||
assert(pResInfo->superTableQ);
|
||||
|
||||
tscTrace("rate_func_merge() size:%d", pCtx->size);
|
||||
tscDebug("rate_func_merge() size:%d", pCtx->size);
|
||||
|
||||
//SRateInfo *pRateInfo = (SRateInfo *)pResInfo->interResultBuf;
|
||||
SRateInfo *pBuf = (SRateInfo *)pCtx->aOutputBuf;
|
||||
|
@ -4154,7 +4154,7 @@ static void rate_func_merge(SQLFunctionCtx *pCtx) {
|
|||
|
||||
numOfNotNull++;
|
||||
memcpy(pBuf, pInput, sizeof(SRateInfo));
|
||||
tscTrace("%p rate_func_merge() isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64,
|
||||
tscDebug("%p rate_func_merge() isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64,
|
||||
pCtx, pInput->isIRate, pInput->firstKey, pInput->lastKey, pInput->firstValue, pInput->lastValue, pInput->CorrectionValue);
|
||||
}
|
||||
|
||||
|
@ -4177,7 +4177,7 @@ static void rate_func_copy(SQLFunctionCtx *pCtx) {
|
|||
pResInfo->hasResult = ((SRateInfo*)pCtx->aInputElemBuf)->hasResult;
|
||||
|
||||
SRateInfo* pRateInfo = (SRateInfo*)pCtx->aInputElemBuf;
|
||||
tscTrace("%p rate_func_second_merge() firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d",
|
||||
tscDebug("%p rate_func_second_merge() firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d",
|
||||
pCtx, pRateInfo->firstKey, pRateInfo->lastKey, pRateInfo->firstValue, pRateInfo->lastValue, pRateInfo->CorrectionValue, pRateInfo->hasResult);
|
||||
}
|
||||
|
||||
|
@ -4187,7 +4187,7 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) {
|
|||
SResultInfo *pResInfo = GET_RES_INFO(pCtx);
|
||||
SRateInfo *pRateInfo = (SRateInfo *)pResInfo->interResultBuf;
|
||||
|
||||
tscTrace("%p isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d",
|
||||
tscDebug("%p isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d",
|
||||
pCtx, pRateInfo->isIRate, pRateInfo->firstKey, pRateInfo->lastKey, pRateInfo->firstValue, pRateInfo->lastValue, pRateInfo->CorrectionValue, pRateInfo->hasResult);
|
||||
|
||||
if (pRateInfo->hasResult != DATA_SET_FLAG) {
|
||||
|
@ -4197,7 +4197,7 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) {
|
|||
|
||||
*(double*)pCtx->aOutputBuf = do_calc_rate(pRateInfo);
|
||||
|
||||
tscTrace("rate_finalizer() output result:%f", *(double *)pCtx->aOutputBuf);
|
||||
tscDebug("rate_finalizer() output result:%f", *(double *)pCtx->aOutputBuf);
|
||||
|
||||
// cannot set the numOfIteratedElems again since it is set during previous iteration
|
||||
pResInfo->numOfRes = 1;
|
||||
|
@ -4214,7 +4214,7 @@ static void irate_function(SQLFunctionCtx *pCtx) {
|
|||
SRateInfo *pRateInfo = (SRateInfo *)pResInfo->interResultBuf;
|
||||
TSKEY *primaryKey = pCtx->ptsList;
|
||||
|
||||
tscTrace("%p irate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull);
|
||||
tscDebug("%p irate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull);
|
||||
|
||||
if (pCtx->size < 1) {
|
||||
return;
|
||||
|
@ -4223,7 +4223,7 @@ static void irate_function(SQLFunctionCtx *pCtx) {
|
|||
for (int32_t i = pCtx->size - 1; i >= 0; --i) {
|
||||
char *pData = GET_INPUT_CHAR_INDEX(pCtx, i);
|
||||
if (pCtx->hasNull && isNull(pData, pCtx->inputType)) {
|
||||
tscTrace("%p irate_function() index of null data:%d", pCtx, i);
|
||||
tscDebug("%p irate_function() index of null data:%d", pCtx, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4252,7 +4252,7 @@ static void irate_function(SQLFunctionCtx *pCtx) {
|
|||
pRateInfo->lastValue = v;
|
||||
pRateInfo->lastKey = primaryKey[i];
|
||||
|
||||
tscTrace("%p irate_function() lastValue:%" PRId64 " lastKey:%" PRId64, pCtx, pRateInfo->lastValue, pRateInfo->lastKey);
|
||||
tscDebug("%p irate_function() lastValue:%" PRId64 " lastKey:%" PRId64, pCtx, pRateInfo->lastValue, pRateInfo->lastKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4260,7 +4260,7 @@ static void irate_function(SQLFunctionCtx *pCtx) {
|
|||
pRateInfo->firstValue = v;
|
||||
pRateInfo->firstKey = primaryKey[i];
|
||||
|
||||
tscTrace("%p irate_function() firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, pRateInfo->firstValue, pRateInfo->firstKey);
|
||||
tscDebug("%p irate_function() firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, pRateInfo->firstValue, pRateInfo->firstKey);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4313,7 +4313,7 @@ static void irate_function_f(SQLFunctionCtx *pCtx, int32_t index) {
|
|||
pRateInfo->lastValue = v;
|
||||
pRateInfo->lastKey = primaryKey[index];
|
||||
|
||||
tscTrace("====%p irate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->firstValue , pRateInfo->firstKey);
|
||||
tscDebug("====%p irate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->firstValue , pRateInfo->firstKey);
|
||||
|
||||
SET_VAL(pCtx, 1, 1);
|
||||
|
||||
|
@ -4337,7 +4337,7 @@ static void do_sumrate_merge(SQLFunctionCtx *pCtx) {
|
|||
for (int32_t i = 0; i < pCtx->size; ++i, input += pCtx->inputBytes) {
|
||||
SRateInfo *pInput = (SRateInfo *)input;
|
||||
|
||||
tscTrace("%p do_sumrate_merge() hasResult:%d input num:%" PRId64 " input sum:%f total num:%" PRId64 " total sum:%f", pCtx, pInput->hasResult, pInput->num, pInput->sum, pRateInfo->num, pRateInfo->sum);
|
||||
tscDebug("%p do_sumrate_merge() hasResult:%d input num:%" PRId64 " input sum:%f total num:%" PRId64 " total sum:%f", pCtx, pInput->hasResult, pInput->num, pInput->sum, pRateInfo->num, pRateInfo->sum);
|
||||
|
||||
if (pInput->hasResult != DATA_SET_FLAG) {
|
||||
continue;
|
||||
|
@ -4360,12 +4360,12 @@ static void do_sumrate_merge(SQLFunctionCtx *pCtx) {
|
|||
}
|
||||
|
||||
static void sumrate_func_merge(SQLFunctionCtx *pCtx) {
|
||||
tscTrace("%p sumrate_func_merge() process ...", pCtx);
|
||||
tscDebug("%p sumrate_func_merge() process ...", pCtx);
|
||||
do_sumrate_merge(pCtx);
|
||||
}
|
||||
|
||||
static void sumrate_func_second_merge(SQLFunctionCtx *pCtx) {
|
||||
tscTrace("%p sumrate_func_second_merge() process ...", pCtx);
|
||||
tscDebug("%p sumrate_func_second_merge() process ...", pCtx);
|
||||
do_sumrate_merge(pCtx);
|
||||
}
|
||||
|
||||
|
@ -4373,7 +4373,7 @@ static void sumrate_finalizer(SQLFunctionCtx *pCtx) {
|
|||
SResultInfo *pResInfo = GET_RES_INFO(pCtx);
|
||||
SRateInfo *pRateInfo = (SRateInfo *)pResInfo->interResultBuf;
|
||||
|
||||
tscTrace("%p sumrate_finalizer() superTableQ:%d num:%" PRId64 " sum:%f hasResult:%d", pCtx, pResInfo->superTableQ, pRateInfo->num, pRateInfo->sum, pRateInfo->hasResult);
|
||||
tscDebug("%p sumrate_finalizer() superTableQ:%d num:%" PRId64 " sum:%f hasResult:%d", pCtx, pResInfo->superTableQ, pRateInfo->num, pRateInfo->sum, pRateInfo->hasResult);
|
||||
|
||||
if (pRateInfo->hasResult != DATA_SET_FLAG) {
|
||||
setNull(pCtx->aOutputBuf, TSDB_DATA_TYPE_DOUBLE, sizeof(double));
|
||||
|
|
|
@ -177,7 +177,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
|
|||
for (int32_t i = 0; i < numOfBuffer; ++i) {
|
||||
int32_t len = pMemBuffer[i]->fileMeta.flushoutData.nLength;
|
||||
if (len == 0) {
|
||||
tscTrace("%p no data retrieved from orderOfVnode:%d", pSql, i + 1);
|
||||
tscDebug("%p no data retrieved from orderOfVnode:%d", pSql, i + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
|
|||
|
||||
if (numOfFlush == 0 || numOfBuffer == 0) {
|
||||
tscLocalReducerEnvDestroy(pMemBuffer, pDesc, finalmodel, numOfBuffer);
|
||||
tscTrace("%p retrieved no data", pSql);
|
||||
tscDebug("%p retrieved no data", pSql);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
|
|||
pReducer->numOfVnode = numOfBuffer;
|
||||
|
||||
pReducer->pDesc = pDesc;
|
||||
tscTrace("%p the number of merged leaves is: %d", pSql, pReducer->numOfBuffer);
|
||||
tscDebug("%p the number of merged leaves is: %d", pSql, pReducer->numOfBuffer);
|
||||
|
||||
int32_t idx = 0;
|
||||
for (int32_t i = 0; i < numOfBuffer; ++i) {
|
||||
|
@ -242,7 +242,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
|
|||
ds->pageId = 0;
|
||||
ds->rowIdx = 0;
|
||||
|
||||
tscTrace("%p load data from disk into memory, orderOfVnode:%d, total:%d", pSql, i + 1, idx + 1);
|
||||
tscDebug("%p load data from disk into memory, orderOfVnode:%d, total:%d", pSql, i + 1, idx + 1);
|
||||
tExtMemBufferLoadData(pMemBuffer[i], &(ds->filePage), j, 0);
|
||||
#ifdef _DEBUG_VIEW
|
||||
printf("load data page into mem for build loser tree: %" PRIu64 " rows\n", ds->filePage.num);
|
||||
|
@ -256,7 +256,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
|
|||
#endif
|
||||
|
||||
if (ds->filePage.num == 0) { // no data in this flush, the index does not increase
|
||||
tscTrace("%p flush data is empty, ignore %d flush record", pSql, idx);
|
||||
tscDebug("%p flush data is empty, ignore %d flush record", pSql, idx);
|
||||
tfree(ds);
|
||||
continue;
|
||||
}
|
||||
|
@ -477,10 +477,10 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p start to free local reducer", pSql);
|
||||
tscDebug("%p start to free local reducer", pSql);
|
||||
SSqlRes *pRes = &(pSql->res);
|
||||
if (pRes->pLocalReducer == NULL) {
|
||||
tscTrace("%p local reducer has been freed, abort", pSql);
|
||||
tscDebug("%p local reducer has been freed, abort", pSql);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
|
|||
while ((status = atomic_val_compare_exchange_32(&pLocalReducer->status, TSC_LOCALREDUCE_READY,
|
||||
TSC_LOCALREDUCE_TOBE_FREED)) == TSC_LOCALREDUCE_IN_PROGRESS) {
|
||||
taosMsleep(100);
|
||||
tscTrace("%p waiting for delete procedure, status: %d", pSql, status);
|
||||
tscDebug("%p waiting for delete procedure, status: %d", pSql, status);
|
||||
}
|
||||
|
||||
pLocalReducer->pFillInfo = taosDestoryFillInfo(pLocalReducer->pFillInfo);
|
||||
|
@ -543,10 +543,10 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
|
|||
pLocalReducer->numOfCompleted = 0;
|
||||
free(pLocalReducer);
|
||||
} else {
|
||||
tscTrace("%p already freed or another free function is invoked", pSql);
|
||||
tscDebug("%p already freed or another free function is invoked", pSql);
|
||||
}
|
||||
|
||||
tscTrace("%p free local reducer finished", pSql);
|
||||
tscDebug("%p free local reducer finished", pSql);
|
||||
}
|
||||
|
||||
static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCmd, SColumnModel *pModel) {
|
||||
|
@ -1407,7 +1407,7 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) {
|
|||
tscResetForNextRetrieve(pRes);
|
||||
|
||||
if (pSql->signature != pSql || pRes == NULL || pRes->pLocalReducer == NULL) { // all data has been processed
|
||||
tscTrace("%p %s call the drop local reducer", pSql, __FUNCTION__);
|
||||
tscDebug("%p %s call the drop local reducer", pSql, __FUNCTION__);
|
||||
tscDestroyLocalReducer(pSql);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1050,7 +1050,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
|
|||
str = pCmd->curSql;
|
||||
}
|
||||
|
||||
tscTrace("%p create data block list for submit data:%p, pTableList:%p", pSql, pCmd->pDataBlocks, pCmd->pTableList);
|
||||
tscDebug("%p create data block list for submit data:%p, pTableList:%p", pSql, pCmd->pDataBlocks, pCmd->pTableList);
|
||||
|
||||
while (1) {
|
||||
int32_t index = 0;
|
||||
|
@ -1153,29 +1153,19 @@ int tsParseInsertSql(SSqlObj *pSql) {
|
|||
goto _error;
|
||||
}
|
||||
|
||||
char fname[PATH_MAX] = {0};
|
||||
strncpy(fname, sToken.z, sToken.n);
|
||||
strdequote(fname);
|
||||
strncpy(pCmd->payload, sToken.z, sToken.n);
|
||||
strdequote(pCmd->payload);
|
||||
|
||||
// todo refactor extract method
|
||||
wordexp_t full_path;
|
||||
if (wordexp(fname, &full_path, 0) != 0) {
|
||||
if (wordexp(pCmd->payload, &full_path, 0) != 0) {
|
||||
code = tscInvalidSQLErrMsg(pCmd->payload, "invalid filename", sToken.z);
|
||||
goto _error;
|
||||
}
|
||||
strcpy(fname, full_path.we_wordv[0]);
|
||||
|
||||
tstrncpy(pCmd->payload, full_path.we_wordv[0], pCmd->allocSize);
|
||||
wordfree(&full_path);
|
||||
|
||||
STableDataBlocks *pDataBlock = NULL;
|
||||
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
||||
|
||||
int32_t ret = tscCreateDataBlock(PATH_MAX, tinfo.rowSize, sizeof(SSubmitBlk), pTableMetaInfo->name,
|
||||
pTableMeta, &pDataBlock);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
taosArrayPush(pCmd->pDataBlocks, &pDataBlock);
|
||||
strcpy(pDataBlock->filename, fname);
|
||||
} else if (sToken.type == TK_LP) {
|
||||
/* insert into tablename(col1, col2,..., coln) values(v1, v2,... vn); */
|
||||
STableMeta *pTableMeta = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0)->pTableMeta;
|
||||
|
@ -1320,7 +1310,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
|
|||
SSqlCmd* pCmd = &pSql->cmd;
|
||||
|
||||
if ((!pCmd->parseFinished) && (!initial)) {
|
||||
tscTrace("%p resume to parse sql: %s", pSql, pCmd->curSql);
|
||||
tscDebug("%p resume to parse sql: %s", pSql, pCmd->curSql);
|
||||
}
|
||||
|
||||
if (tscIsInsertData(pSql->sqlstr)) {
|
||||
|
@ -1361,6 +1351,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
|
|||
static int doPackSendDataBlock(SSqlObj *pSql, int32_t numOfRows, STableDataBlocks *pTableDataBlocks) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
pSql->res.numOfRows = 0;
|
||||
|
||||
assert(pCmd->numOfClause == 1);
|
||||
STableMeta *pTableMeta = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0)->pTableMeta;
|
||||
|
@ -1377,172 +1368,145 @@ static int doPackSendDataBlock(SSqlObj *pSql, int32_t numOfRows, STableDataBlock
|
|||
return code;
|
||||
}
|
||||
|
||||
if ((code = tscProcessSql(pSql)) != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
return tscProcessSql(pSql);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
typedef struct SImportFileSupport {
|
||||
SSqlObj *pSql;
|
||||
FILE *fp;
|
||||
} SImportFileSupport;
|
||||
|
||||
static int tscInsertDataFromFile(SSqlObj *pSql, FILE *fp, char *tmpTokenBuf) {
|
||||
size_t readLen = 0;
|
||||
char * line = NULL;
|
||||
size_t n = 0;
|
||||
int len = 0;
|
||||
int32_t maxRows = 0;
|
||||
static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
|
||||
assert(param != NULL && tres != NULL);
|
||||
|
||||
SSqlObj *pSql = tres;
|
||||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
int numOfRows = 0;
|
||||
int32_t code = 0;
|
||||
int nrows = 0;
|
||||
|
||||
SImportFileSupport *pSupporter = (SImportFileSupport *) param;
|
||||
|
||||
SSqlObj *pParentSql = pSupporter->pSql;
|
||||
FILE *fp = pSupporter->fp;
|
||||
|
||||
if (taos_errno(pSql) != TSDB_CODE_SUCCESS) { // handle error
|
||||
assert(taos_errno(pSql) == code);
|
||||
|
||||
taos_free_result(pSql);
|
||||
tfree(pSupporter);
|
||||
fclose(fp);
|
||||
|
||||
pParentSql->res.code = code;
|
||||
tscQueueAsyncRes(pParentSql);
|
||||
return;
|
||||
}
|
||||
|
||||
// accumulate the total submit records
|
||||
pParentSql->res.numOfRows += pSql->res.numOfRows;
|
||||
|
||||
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||
STableMeta * pTableMeta = pTableMetaInfo->pTableMeta;
|
||||
SSchema * pSchema = tscGetTableSchema(pTableMeta);
|
||||
STableComInfo tinfo = tscGetTableInfo(pTableMeta);
|
||||
|
||||
assert(pCmd->numOfClause == 1);
|
||||
SParsedDataColInfo spd = {.numOfCols = tinfo.numOfColumns};
|
||||
tscSetAssignedColumnInfo(&spd, pSchema, tinfo.numOfColumns);
|
||||
|
||||
int32_t rowSize = tinfo.rowSize;
|
||||
size_t n = 0;
|
||||
ssize_t readLen = 0;
|
||||
char * line = NULL;
|
||||
int32_t count = 0;
|
||||
int32_t maxRows = 0;
|
||||
|
||||
tscDestroyBlockArrayList(pSql->cmd.pDataBlocks);
|
||||
pCmd->pDataBlocks = taosArrayInit(1, POINTER_BYTES);
|
||||
|
||||
pCmd->pDataBlocks = taosArrayInit(4, POINTER_BYTES);
|
||||
STableDataBlocks *pTableDataBlock = NULL;
|
||||
|
||||
int32_t ret = tscCreateDataBlock(TSDB_PAYLOAD_SIZE, rowSize, sizeof(SSubmitBlk), pTableMetaInfo->name, pTableMeta, &pTableDataBlock);
|
||||
int32_t ret = tscCreateDataBlock(TSDB_PAYLOAD_SIZE, tinfo.rowSize, sizeof(SSubmitBlk), pTableMetaInfo->name, pTableMeta, &pTableDataBlock);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
return ret;
|
||||
// return ret;
|
||||
}
|
||||
|
||||
taosArrayPush(pCmd->pDataBlocks, &pTableDataBlock);
|
||||
tscAllocateMemIfNeed(pTableDataBlock, tinfo.rowSize, &maxRows);
|
||||
|
||||
code = tscAllocateMemIfNeed(pTableDataBlock, rowSize, &maxRows);
|
||||
if (TSDB_CODE_SUCCESS != code) return -1;
|
||||
|
||||
int count = 0;
|
||||
SParsedDataColInfo spd = {.numOfCols = tinfo.numOfColumns};
|
||||
SSchema * pSchema = tscGetTableSchema(pTableMeta);
|
||||
|
||||
tscSetAssignedColumnInfo(&spd, pSchema, tinfo.numOfColumns);
|
||||
char *tokenBuf = calloc(1, 4096);
|
||||
|
||||
while ((readLen = getline(&line, &n, fp)) != -1) {
|
||||
// line[--readLen] = '\0';
|
||||
if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) line[--readLen] = 0;
|
||||
if (readLen == 0) continue; // fang, <= to ==
|
||||
if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) {
|
||||
line[--readLen] = 0;
|
||||
}
|
||||
|
||||
if (readLen == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
char *lineptr = line;
|
||||
strtolower(line, line);
|
||||
|
||||
len = tsParseOneRowData(&lineptr, pTableDataBlock, pSchema, &spd, pCmd->payload, tinfo.precision, &code, tmpTokenBuf);
|
||||
int32_t len =
|
||||
tsParseOneRowData(&lineptr, pTableDataBlock, pSchema, &spd, pCmd->payload, tinfo.precision, &code, tokenBuf);
|
||||
if (len <= 0 || pTableDataBlock->numOfParams > 0) {
|
||||
pSql->res.code = code;
|
||||
return (-code);
|
||||
break;
|
||||
}
|
||||
|
||||
pTableDataBlock->size += len;
|
||||
|
||||
count++;
|
||||
nrows++;
|
||||
if (count >= maxRows) {
|
||||
if ((code = doPackSendDataBlock(pSql, count, pTableDataBlock)) != TSDB_CODE_SUCCESS) {
|
||||
return -code;
|
||||
if (++count >= maxRows) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pTableDataBlock = taosArrayGetP(pCmd->pDataBlocks, 0);
|
||||
pTableDataBlock->size = sizeof(SSubmitBlk);
|
||||
pTableDataBlock->rowSize = tinfo.rowSize;
|
||||
|
||||
numOfRows += pSql->res.numOfRows;
|
||||
pSql->res.numOfRows = 0;
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
tfree(tokenBuf);
|
||||
free(line);
|
||||
|
||||
if (count > 0) {
|
||||
if ((code = doPackSendDataBlock(pSql, count, pTableDataBlock)) != TSDB_CODE_SUCCESS) {
|
||||
return -code;
|
||||
code = doPackSendDataBlock(pSql, count, pTableDataBlock);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pParentSql->res.code = code;
|
||||
tscQueueAsyncRes(pParentSql);
|
||||
return;
|
||||
}
|
||||
|
||||
numOfRows += pSql->res.numOfRows;
|
||||
pSql->res.numOfRows = 0;
|
||||
} else {
|
||||
taos_free_result(pSql);
|
||||
tfree(pSupporter);
|
||||
fclose(fp);
|
||||
|
||||
pParentSql->fp = pParentSql->fetchFp;
|
||||
|
||||
// all data has been sent to vnode, call user function
|
||||
int32_t v = (pParentSql->res.code != TSDB_CODE_SUCCESS) ? pParentSql->res.code : pParentSql->res.numOfRows;
|
||||
(*pParentSql->fp)(pParentSql->param, pParentSql, v);
|
||||
}
|
||||
}
|
||||
|
||||
if (line) tfree(line);
|
||||
|
||||
return numOfRows;
|
||||
}
|
||||
|
||||
void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql) {
|
||||
void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql) {
|
||||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
if (pCmd->command != TSDB_SQL_INSERT) {
|
||||
return;
|
||||
}
|
||||
|
||||
SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
|
||||
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
assert(pCmd->dataSourceType == DATA_FROM_DATA_FILE && strlen(pCmd->payload) != 0);
|
||||
|
||||
STableDataBlocks *pDataBlock = NULL;
|
||||
int32_t affected_rows = 0;
|
||||
SImportFileSupport *pSupporter = calloc(1, sizeof(SImportFileSupport));
|
||||
SSqlObj *pNew = createSubqueryObj(pSql, 0, parseFileSendDataBlock, pSupporter, TSDB_SQL_INSERT, NULL);
|
||||
|
||||
assert(pCmd->dataSourceType == DATA_FROM_DATA_FILE && pCmd->pDataBlocks != NULL);
|
||||
SArray *pDataBlockList = pCmd->pDataBlocks;
|
||||
pCmd->pDataBlocks = NULL;
|
||||
|
||||
char path[PATH_MAX] = {0};
|
||||
|
||||
size_t size = taosArrayGetSize(pDataBlockList);
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
pDataBlock = taosArrayGetP(pDataBlockList, i );
|
||||
if (pDataBlock == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, TSDB_PAYLOAD_SIZE)) {
|
||||
tscError("%p failed to malloc when insert file", pSql);
|
||||
continue;
|
||||
}
|
||||
pNew->cmd.pDataBlocks = taosArrayInit(4, POINTER_BYTES);
|
||||
pCmd->count = 1;
|
||||
|
||||
tstrncpy(path, pDataBlock->filename, sizeof(path));
|
||||
|
||||
FILE *fp = fopen(path, "r");
|
||||
FILE *fp = fopen(pCmd->payload, "r");
|
||||
if (fp == NULL) {
|
||||
tscError("%p failed to open file %s to load data from file, reason:%s", pSql, path, strerror(errno));
|
||||
continue;
|
||||
pSql->res.code = TAOS_SYSTEM_ERROR(errno);
|
||||
tscError("%p failed to open file %s to load data from file, code:%s", pSql, pCmd->payload, tstrerror(pSql->res.code));
|
||||
|
||||
tfree(pSupporter)
|
||||
tscQueueAsyncRes(pSql);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tstrncpy(pTableMetaInfo->name, pDataBlock->tableId, sizeof(pTableMetaInfo->name));
|
||||
memset(pDataBlock->pData, 0, pDataBlock->nAllocSize);
|
||||
pSupporter->pSql = pSql;
|
||||
pSupporter->fp = fp;
|
||||
|
||||
int32_t ret = tscGetTableMeta(pSql, pTableMetaInfo);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
tscError("%p get meter meta failed, abort", pSql);
|
||||
continue;
|
||||
}
|
||||
|
||||
char *tmpTokenBuf = calloc(1, 4096); // used for deleting Escape character: \\, \', \"
|
||||
if (NULL == tmpTokenBuf) {
|
||||
tscError("%p calloc failed", pSql);
|
||||
continue;
|
||||
}
|
||||
|
||||
int nrows = tscInsertDataFromFile(pSql, fp, tmpTokenBuf);
|
||||
free(tmpTokenBuf);
|
||||
|
||||
pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
|
||||
|
||||
if (nrows < 0) {
|
||||
fclose(fp);
|
||||
tscTrace("%p no records(%d) in file %s", pSql, nrows, path);
|
||||
continue;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
affected_rows += nrows;
|
||||
|
||||
tscTrace("%p Insert data %d records from file %s", pSql, nrows, path);
|
||||
}
|
||||
|
||||
pSql->res.numOfRows = affected_rows;
|
||||
|
||||
// all data have been submit to vnode, release data blocks
|
||||
pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
|
||||
tscDestroyBlockArrayList(pDataBlockList);
|
||||
parseFileSendDataBlock(pSupporter, pNew, 0);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
|
|||
break;
|
||||
|
||||
default:
|
||||
tscTrace("param %d: type mismatch or invalid", i);
|
||||
tscDebug("param %d: type mismatch or invalid", i);
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ static int insertStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
|
|||
SParamInfo* param = pBlock->params + j;
|
||||
int code = doBindParam(data, param, bind + param->idx);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tscTrace("param %d: type mismatch or invalid", param->idx);
|
||||
tscDebug("param %d: type mismatch or invalid", param->idx);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
|
|||
pRes->numOfRows = 1;
|
||||
|
||||
strtolower(pSql->sqlstr, sql);
|
||||
tscDump("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
tscDebugDump("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
|
||||
if (tscIsInsertData(pSql->sqlstr)) {
|
||||
pStmt->isInsert = true;
|
||||
|
|
|
@ -34,7 +34,7 @@ void tscInitConnCb(void *param, TAOS_RES *result, int code) {
|
|||
tscSlowQueryConnInitialized = false;
|
||||
free(sql);
|
||||
} else {
|
||||
tscTrace("taos:%p, slow query connect success, code:%d", tscSlowQueryConn, code);
|
||||
tscDebug("taos:%p, slow query connect success, code:%d", tscSlowQueryConn, code);
|
||||
tscSlowQueryConnInitialized = true;
|
||||
tscSaveSlowQueryFp(sql, NULL);
|
||||
}
|
||||
|
@ -59,14 +59,14 @@ void tscAddIntoSqlList(SSqlObj *pSql) {
|
|||
pSql->stime = taosGetTimestampMs();
|
||||
pSql->listed = 1;
|
||||
|
||||
tscTrace("%p added into sqlList", pSql);
|
||||
tscDebug("%p added into sqlList", pSql);
|
||||
}
|
||||
|
||||
void tscSaveSlowQueryFpCb(void *param, TAOS_RES *result, int code) {
|
||||
if (code < 0) {
|
||||
tscError("failed to save slow query, code:%d", code);
|
||||
} else {
|
||||
tscTrace("success to save slow query, code:%d", code);
|
||||
tscDebug("success to save slow query, code:%d", code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,14 +75,14 @@ void tscSaveSlowQueryFp(void *handle, void *tmrId) {
|
|||
|
||||
if (!tscSlowQueryConnInitialized) {
|
||||
if (tscSlowQueryConn == NULL) {
|
||||
tscTrace("start to init slow query connect");
|
||||
tscDebug("start to init slow query connect");
|
||||
taos_connect_a(NULL, "monitor", tsInternalPass, "", 0, tscInitConnCb, sql, &tscSlowQueryConn);
|
||||
} else {
|
||||
tscError("taos:%p, slow query connect is already initialized", tscSlowQueryConn);
|
||||
free(sql);
|
||||
}
|
||||
} else {
|
||||
tscTrace("taos:%p, save slow query:%s", tscSlowQueryConn, sql);
|
||||
tscDebug("taos:%p, save slow query:%s", tscSlowQueryConn, sql);
|
||||
taos_query_a(tscSlowQueryConn, sql, tscSaveSlowQueryFpCb, NULL);
|
||||
free(sql);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ void tscSaveSlowQuery(SSqlObj *pSql) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p query time:%" PRId64 " sql:%s", pSql, pSql->res.useconds, pSql->sqlstr);
|
||||
tscDebug("%p query time:%" PRId64 " sql:%s", pSql, pSql->res.useconds, pSql->sqlstr);
|
||||
int32_t sqlSize = TSDB_SLOW_QUERY_SQL_LEN + size;
|
||||
|
||||
char *sql = malloc(sqlSize);
|
||||
|
@ -138,7 +138,7 @@ void tscRemoveFromSqlList(SSqlObj *pSql) {
|
|||
pSql->listed = 0;
|
||||
|
||||
tscSaveSlowQuery(pSql);
|
||||
tscTrace("%p removed from sqlList", pSql);
|
||||
tscDebug("%p removed from sqlList", pSql);
|
||||
}
|
||||
|
||||
void tscKillQuery(STscObj *pObj, uint32_t killId) {
|
||||
|
@ -154,7 +154,7 @@ void tscKillQuery(STscObj *pObj, uint32_t killId) {
|
|||
|
||||
if (pSql == NULL) return;
|
||||
|
||||
tscTrace("%p query is killed, queryId:%d", pSql, killId);
|
||||
tscDebug("%p query is killed, queryId:%d", pSql, killId);
|
||||
taos_stop_query(pSql);
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
|
|||
pthread_mutex_unlock(&pObj->mutex);
|
||||
|
||||
if (pStream) {
|
||||
tscTrace("%p stream:%p is killed, streamId:%d", pStream->pSql, pStream, killId);
|
||||
tscDebug("%p stream:%p is killed, streamId:%d", pStream->pSql, pStream, killId);
|
||||
if (pStream->callback) {
|
||||
pStream->callback(pStream->param);
|
||||
}
|
||||
|
@ -299,6 +299,6 @@ void tscKillConnection(STscObj *pObj) {
|
|||
|
||||
pthread_mutex_unlock(&pObj->mutex);
|
||||
|
||||
tscTrace("connection:%p is killed", pObj);
|
||||
tscDebug("connection:%p is killed", pObj);
|
||||
taos_close(pObj);
|
||||
}
|
||||
|
|
|
@ -4754,7 +4754,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
|
|||
pQueryInfo->clauseLimit = pQueryInfo->limit.limit;
|
||||
pQueryInfo->slimit = pQuerySql->slimit;
|
||||
|
||||
tscTrace("%p limit:%" PRId64 ", offset:%" PRId64 " slimit:%" PRId64 ", soffset:%" PRId64, pSql, pQueryInfo->limit.limit,
|
||||
tscDebug("%p limit:%" PRId64 ", offset:%" PRId64 " slimit:%" PRId64 ", soffset:%" PRId64, pSql, pQueryInfo->limit.limit,
|
||||
pQueryInfo->limit.offset, pQueryInfo->slimit.limit, pQueryInfo->slimit.offset);
|
||||
|
||||
if (pQueryInfo->slimit.offset < 0 || pQueryInfo->limit.offset < 0) {
|
||||
|
@ -4762,7 +4762,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
|
|||
}
|
||||
|
||||
if (pQueryInfo->limit.limit == 0) {
|
||||
tscTrace("%p limit 0, no output result", pSql);
|
||||
tscDebug("%p limit 0, no output result", pSql);
|
||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -4784,7 +4784,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
|
|||
}
|
||||
|
||||
if (pQueryInfo->slimit.limit == 0) {
|
||||
tscTrace("%p slimit 0, no output result", pSql);
|
||||
tscDebug("%p slimit 0, no output result", pSql);
|
||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -4802,7 +4802,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
|
|||
|
||||
// No tables included. No results generated. Query results are empty.
|
||||
if (pTableMetaInfo->vgroupList->numOfVgroups == 0) {
|
||||
tscTrace("%p no table in super table, no output result", pSql);
|
||||
tscDebug("%p no table in super table, no output result", pSql);
|
||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -5522,7 +5522,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex) {
|
|||
}
|
||||
|
||||
str[offset] = ']';
|
||||
tscTrace("%p select clause:%s", pSql, str);
|
||||
tscDebug("%p select clause:%s", pSql, str);
|
||||
}
|
||||
|
||||
int32_t doCheckForCreateTable(SSqlObj* pSql, int32_t subClauseIndex, SSqlInfo* pInfo) {
|
||||
|
|
|
@ -61,7 +61,7 @@ void tscPrintMgmtIp() {
|
|||
tscError("invalid mnode IP list:%d", tscMgmtIpSet.numOfIps);
|
||||
} else {
|
||||
for (int i = 0; i < tscMgmtIpSet.numOfIps; ++i) {
|
||||
tscTrace("mnode index:%d %s:%d", i, tscMgmtIpSet.fqdn[i], tscMgmtIpSet.port[i]);
|
||||
tscDebug("mnode index:%d %s:%d", i, tscMgmtIpSet.fqdn[i], tscMgmtIpSet.port[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ void tscSetMgmtIpList(SRpcIpSet *pIpList) {
|
|||
|
||||
void tscUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) {
|
||||
tscMgmtIpSet = *pIpSet;
|
||||
tscTrace("mnode IP list is changed for ufp is called, numOfIps:%d inUse:%d", tscMgmtIpSet.numOfIps, tscMgmtIpSet.inUse);
|
||||
tscDebug("mnode IP list is changed for ufp is called, numOfIps:%d inUse:%d", tscMgmtIpSet.numOfIps, tscMgmtIpSet.inUse);
|
||||
for (int32_t i = 0; i < tscMgmtIpSet.numOfIps; ++i) {
|
||||
tscTrace("index:%d fqdn:%s port:%d", i, tscMgmtIpSet.fqdn[i], tscMgmtIpSet.port[i]);
|
||||
tscDebug("index:%d fqdn:%s port:%d", i, tscMgmtIpSet.fqdn[i], tscMgmtIpSet.port[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
|
|||
if (pRsp->streamId) tscKillStream(pObj, htonl(pRsp->streamId));
|
||||
}
|
||||
} else {
|
||||
tscTrace("heart beat failed, code:%s", tstrerror(code));
|
||||
tscDebug("heart beat failed, code:%s", tstrerror(code));
|
||||
}
|
||||
|
||||
taosTmrReset(tscProcessActivityTimer, tsShellActivityTimer * 500, pObj, tscTmr, &pObj->pTimer);
|
||||
|
@ -157,11 +157,11 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
|
|||
pObj->pHb = pSql;
|
||||
tscAddSubqueryInfo(&pObj->pHb->cmd);
|
||||
|
||||
tscTrace("%p pHb is allocated, pObj:%p", pObj->pHb, pObj);
|
||||
tscDebug("%p pHb is allocated, pObj:%p", pObj->pHb, pObj);
|
||||
}
|
||||
|
||||
if (tscShouldFreeHeatBeat(pObj->pHb)) {
|
||||
tscTrace("%p free HB object and release connection", pObj);
|
||||
tscDebug("%p free HB object and release connection", pObj);
|
||||
tscFreeSqlObj(pObj->pHb);
|
||||
tscCloseTscObj(pObj);
|
||||
return;
|
||||
|
@ -195,7 +195,11 @@ int tscSendMsgToServer(SSqlObj *pSql) {
|
|||
.code = 0
|
||||
};
|
||||
|
||||
pSql->pRpcCtx = rpcSendRequest(pObj->pDnodeConn, &pSql->ipList, &rpcMsg);
|
||||
// NOTE: the rpc context should be acquired before sending data to server.
|
||||
// Otherwise, the pSql object may have been released already during the response function, which is
|
||||
// processMsgFromServer function. In the meanwhile, the assignment of the rpc context to sql object will absolutely
|
||||
// cause crash.
|
||||
/*pSql->pRpcCtx = */rpcSendRequest(pObj->pDnodeConn, &pSql->ipList, &rpcMsg);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -211,7 +215,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
|
|||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
|
||||
if (pObj->signature != pObj) {
|
||||
tscTrace("%p DB connection is closed, cmd:%d pObj:%p signature:%p", pSql, pCmd->command, pObj, pObj->signature);
|
||||
tscDebug("%p DB connection is closed, cmd:%d pObj:%p signature:%p", pSql, pCmd->command, pObj, pObj->signature);
|
||||
|
||||
tscFreeSqlObj(pSql);
|
||||
rpcFreeCont(rpcMsg->pCont);
|
||||
|
@ -220,7 +224,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
|
|||
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
|
||||
if (pQueryInfo != NULL && pQueryInfo->type == TSDB_QUERY_TYPE_FREE_RESOURCE) {
|
||||
tscTrace("%p sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p",
|
||||
tscDebug("%p sqlObj needs to be released or DB connection is closed, cmd:%d type:%d, pObj:%p signature:%p",
|
||||
pSql, pCmd->command, pQueryInfo->type, pObj, pObj->signature);
|
||||
|
||||
tscFreeSqlObj(pSql);
|
||||
|
@ -275,11 +279,11 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
|
|||
if (pRes->code != TSDB_CODE_TSC_QUERY_CANCELLED) {
|
||||
pRes->code = (rpcMsg->code != TSDB_CODE_SUCCESS) ? rpcMsg->code : TSDB_CODE_RPC_NETWORK_UNAVAIL;
|
||||
} else {
|
||||
tscTrace("%p query is cancelled, code:%s", pSql, tstrerror(pRes->code));
|
||||
tscDebug("%p query is cancelled, code:%s", pSql, tstrerror(pRes->code));
|
||||
}
|
||||
|
||||
if (pRes->code == TSDB_CODE_SUCCESS) {
|
||||
tscTrace("%p reset retry counter to be 0 due to success rsp, old:%d", pSql, pSql->retry);
|
||||
tscDebug("%p reset retry counter to be 0 due to success rsp, old:%d", pSql, pSql->retry);
|
||||
pSql->retry = 0;
|
||||
}
|
||||
|
||||
|
@ -314,10 +318,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
|
|||
pMsg->numOfFailedBlocks = htonl(pMsg->numOfFailedBlocks);
|
||||
|
||||
pRes->numOfRows += pMsg->affectedRows;
|
||||
tscTrace("%p SQL cmd:%s, code:%s inserted rows:%d rspLen:%d", pSql, sqlCmd[pCmd->command],
|
||||
tscDebug("%p SQL cmd:%s, code:%s inserted rows:%d rspLen:%d", pSql, sqlCmd[pCmd->command],
|
||||
tstrerror(pRes->code), pMsg->affectedRows, pRes->rspLen);
|
||||
} else {
|
||||
tscTrace("%p SQL cmd:%s, code:%s rspLen:%d", pSql, sqlCmd[pCmd->command], tstrerror(pRes->code), pRes->rspLen);
|
||||
tscDebug("%p SQL cmd:%s, code:%s rspLen:%d", pSql, sqlCmd[pCmd->command], tstrerror(pRes->code), pRes->rspLen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +336,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
|
|||
(*pSql->fp)(pSql->param, pSql, rpcMsg->code);
|
||||
|
||||
if (shouldFree) {
|
||||
tscTrace("%p sqlObj is automatically freed", pSql);
|
||||
tscDebug("%p sqlObj is automatically freed", pSql);
|
||||
tscFreeSqlObj(pSql);
|
||||
}
|
||||
}
|
||||
|
@ -390,7 +394,7 @@ int tscProcessSql(SSqlObj *pSql) {
|
|||
assert((pQueryInfo->numOfTables == 0 && pQueryInfo->command == TSDB_SQL_HB) || pQueryInfo->numOfTables > 0);
|
||||
}
|
||||
|
||||
tscTrace("%p SQL cmd:%s will be processed, name:%s, type:%d", pSql, sqlCmd[pCmd->command], name, type);
|
||||
tscDebug("%p SQL cmd:%s will be processed, name:%s, type:%d", pSql, sqlCmd[pCmd->command], name, type);
|
||||
if (pCmd->command < TSDB_SQL_MGMT) { // the pTableMetaInfo cannot be NULL
|
||||
if (pTableMetaInfo == NULL) {
|
||||
pSql->res.code = TSDB_CODE_TSC_APP_ERROR;
|
||||
|
@ -443,7 +447,7 @@ void tscKillSTableQuery(SSqlObj *pSql) {
|
|||
}
|
||||
}
|
||||
|
||||
tscTrace("%p super table query cancelled", pSql);
|
||||
tscDebug("%p super table query cancelled", pSql);
|
||||
}
|
||||
|
||||
int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||
|
@ -500,7 +504,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
pSql->cmd.msgType = TSDB_MSG_TYPE_SUBMIT;
|
||||
tscSetDnodeIpList(pSql, &pTableMeta->vgroupInfo);
|
||||
|
||||
tscTrace("%p build submit msg, vgId:%d numOfTables:%d numberOfIP:%d", pSql, vgId, pSql->cmd.numOfTablesInSubmit,
|
||||
tscDebug("%p build submit msg, vgId:%d numOfTables:%d numberOfIP:%d", pSql, vgId, pSql->cmd.numOfTablesInSubmit,
|
||||
pSql->ipList.numOfIps);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -533,7 +537,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
|
|||
assert(index >= 0);
|
||||
|
||||
pVgroupInfo = &pTableMetaInfo->vgroupList->vgroups[index];
|
||||
tscTrace("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, pTableMetaInfo->vgroupList->numOfVgroups);
|
||||
tscDebug("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, pTableMetaInfo->vgroupList->numOfVgroups);
|
||||
} else {
|
||||
pVgroupInfo = &pTableMeta->vgroupInfo;
|
||||
}
|
||||
|
@ -553,7 +557,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
|
|||
int32_t numOfVgroups = taosArrayGetSize(pTableMetaInfo->pVgroupTables);
|
||||
assert(index >= 0 && index < numOfVgroups);
|
||||
|
||||
tscTrace("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, numOfVgroups);
|
||||
tscDebug("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, numOfVgroups);
|
||||
|
||||
SVgroupTableInfo* pTableIdList = taosArrayGet(pTableMetaInfo->pVgroupTables, index);
|
||||
|
||||
|
@ -576,7 +580,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
|
|||
}
|
||||
}
|
||||
|
||||
tscTrace("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name,
|
||||
tscDebug("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name,
|
||||
pTableMeta->sid, pTableMeta->uid);
|
||||
|
||||
return pMsg;
|
||||
|
@ -845,7 +849,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
|
||||
int32_t msgLen = pMsg - pCmd->payload;
|
||||
|
||||
tscTrace("%p msg built success,len:%d bytes", pSql, msgLen);
|
||||
tscDebug("%p msg built success,len:%d bytes", pSql, msgLen);
|
||||
pCmd->payloadLen = msgLen;
|
||||
pSql->cmd.msgType = TSDB_MSG_TYPE_QUERY;
|
||||
|
||||
|
@ -1517,7 +1521,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
|||
|
||||
assert(pCmd->payloadLen + minMsgSize() <= pCmd->allocSize);
|
||||
|
||||
tscTrace("%p build load multi-metermeta msg completed, numOfTables:%d, msg size:%d", pSql, pCmd->count,
|
||||
tscDebug("%p build load multi-metermeta msg completed, numOfTables:%d, msg size:%d", pSql, pCmd->count,
|
||||
pCmd->payloadLen);
|
||||
|
||||
return pCmd->payloadLen;
|
||||
|
@ -1677,7 +1681,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
|
|||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
tscTrace("%p recv table meta, uid:%"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->uid, pTableMeta->sid, pTableMetaInfo->name);
|
||||
tscDebug("%p recv table meta, uid:%"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->uid, pTableMeta->sid, pTableMetaInfo->name);
|
||||
free(pTableMeta);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1786,7 +1790,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
|
|||
|
||||
pSql->res.code = TSDB_CODE_SUCCESS;
|
||||
pSql->res.numOfTotal = i;
|
||||
tscTrace("%p load multi-metermeta resp from complete num:%d", pSql, pSql->res.numOfTotal);
|
||||
tscDebug("%p load multi-metermeta resp from complete num:%d", pSql, pSql->res.numOfTotal);
|
||||
#endif
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1955,7 +1959,7 @@ int tscProcessDropTableRsp(SSqlObj *pSql) {
|
|||
* The cached information is expired, however, we may have lost the ref of original meter. So, clear whole cache
|
||||
* instead.
|
||||
*/
|
||||
tscTrace("%p force release table meta after drop table:%s", pSql, pTableMetaInfo->name);
|
||||
tscDebug("%p force release table meta after drop table:%s", pSql, pTableMetaInfo->name);
|
||||
taosCacheRelease(tscCacheHandle, (void **)&pTableMeta, true);
|
||||
|
||||
if (pTableMetaInfo->pTableMeta) {
|
||||
|
@ -1973,7 +1977,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
tscTrace("%p force release metermeta in cache after alter-table: %s", pSql, pTableMetaInfo->name);
|
||||
tscDebug("%p force release metermeta in cache after alter-table: %s", pSql, pTableMetaInfo->name);
|
||||
taosCacheRelease(tscCacheHandle, (void **)&pTableMeta, true);
|
||||
|
||||
if (pTableMetaInfo->pTableMeta) {
|
||||
|
@ -1981,7 +1985,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
|
|||
taosCacheRelease(tscCacheHandle, (void **)&(pTableMetaInfo->pTableMeta), true);
|
||||
|
||||
if (isSuperTable) { // if it is a super table, reset whole query cache
|
||||
tscTrace("%p reset query cache since table:%s is stable", pSql, pTableMetaInfo->name);
|
||||
tscDebug("%p reset query cache since table:%s is stable", pSql, pTableMetaInfo->name);
|
||||
taosCacheEmpty(tscCacheHandle);
|
||||
}
|
||||
}
|
||||
|
@ -2045,7 +2049,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
|
|||
}
|
||||
|
||||
pRes->row = 0;
|
||||
tscTrace("%p numOfRows:%" PRId64 ", offset:%" PRId64 ", complete:%d", pSql, pRes->numOfRows, pRes->offset, pRes->completed);
|
||||
tscDebug("%p numOfRows:%" PRId64 ", offset:%" PRId64 ", complete:%d", pSql, pRes->numOfRows, pRes->offset, pRes->completed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2097,7 +2101,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
|
|||
tstrncpy(pNewMeterMetaInfo->name, pTableMetaInfo->name, sizeof(pNewMeterMetaInfo->name));
|
||||
memcpy(pNew->cmd.payload, pSql->cmd.payload, pSql->cmd.payloadLen); // tag information if table does not exists.
|
||||
pNew->cmd.payloadLen = pSql->cmd.payloadLen;
|
||||
tscTrace("%p new pSqlObj:%p to get tableMeta, auto create:%d", pSql, pNew, pNew->cmd.autoCreated);
|
||||
tscDebug("%p new pSqlObj:%p to get tableMeta, auto create:%d", pSql, pNew, pNew->cmd.autoCreated);
|
||||
|
||||
pNew->fp = tscTableMetaCallBack;
|
||||
pNew->param = pSql;
|
||||
|
@ -2121,7 +2125,7 @@ int32_t tscGetTableMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) {
|
|||
pTableMetaInfo->pTableMeta = (STableMeta *)taosCacheAcquireByName(tscCacheHandle, pTableMetaInfo->name);
|
||||
if (pTableMetaInfo->pTableMeta != NULL) {
|
||||
STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta);
|
||||
tscTrace("%p retrieve table Meta from cache, the number of columns:%d, numOfTags:%d, %p", pSql, tinfo.numOfColumns,
|
||||
tscDebug("%p retrieve table Meta from cache, the number of columns:%d, numOfTags:%d, %p", pSql, tinfo.numOfColumns,
|
||||
tinfo.numOfTags, pTableMetaInfo->pTableMeta);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2149,7 +2153,7 @@ int tscRenewTableMeta(SSqlObj *pSql, char *tableId) {
|
|||
|
||||
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
||||
if (pTableMetaInfo->pTableMeta) {
|
||||
tscTrace("%p update table meta, old meta numOfTags:%d, numOfCols:%d, uid:%" PRId64 ", addr:%p", pSql,
|
||||
tscDebug("%p update table meta, old meta numOfTags:%d, numOfCols:%d, uid:%" PRId64 ", addr:%p", pSql,
|
||||
tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->uid, pTableMeta);
|
||||
}
|
||||
|
||||
|
@ -2203,7 +2207,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
|
|||
}
|
||||
|
||||
pNewQueryInfo->numOfTables = pQueryInfo->numOfTables;
|
||||
tscTrace("%p new sqlObj:%p to get vgroupInfo, numOfTables:%d", pSql, pNew, pNewQueryInfo->numOfTables);
|
||||
tscDebug("%p new sqlObj:%p to get vgroupInfo, numOfTables:%d", pSql, pNew, pNewQueryInfo->numOfTables);
|
||||
|
||||
pNew->fp = tscTableMetaCallBack;
|
||||
pNew->param = pSql;
|
||||
|
|
|
@ -145,7 +145,7 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) {
|
|||
}
|
||||
|
||||
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
|
||||
tscTrace("try to create a connection to %s:%u, user:%s db:%s", ip, port, user, db);
|
||||
tscDebug("try to create a connection to %s:%u, user:%s db:%s", ip, port, user, db);
|
||||
if (user == NULL) user = TSDB_DEFAULT_USER;
|
||||
if (pass == NULL) pass = TSDB_DEFAULT_PASS;
|
||||
|
||||
|
@ -165,7 +165,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tscTrace("%p DB connection is opening, dnodeConn:%p", pObj, pObj->pDnodeConn);
|
||||
tscDebug("%p DB connection is opening, dnodeConn:%p", pObj, pObj->pDnodeConn);
|
||||
taos_free_result(pSql);
|
||||
|
||||
// version compare only requires the first 3 segments of the version string
|
||||
|
@ -190,7 +190,7 @@ TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port,
|
|||
}
|
||||
|
||||
pSql->res.code = tscProcessSql(pSql);
|
||||
tscTrace("%p DB async connection is opening", taos);
|
||||
tscDebug("%p DB async connection is opening", taos);
|
||||
return taos;
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
|
|||
|
||||
assert(pSql->fp == NULL);
|
||||
|
||||
tscTrace("%p try data in the next subclause:%d, total subclause:%d", pSql, pCmd->clauseIndex, pCmd->numOfClause);
|
||||
tscDebug("%p try data in the next subclause:%d, total subclause:%d", pSql, pCmd->clauseIndex, pCmd->numOfClause);
|
||||
tscProcessSql(pSql);
|
||||
|
||||
nRows = taos_fetch_block_impl(res, rows);
|
||||
|
@ -487,7 +487,7 @@ static bool tscFreeQhandleInVnode(SSqlObj* pSql) {
|
|||
(pCmd->command == TSDB_SQL_SELECT && pSql->pStream == NULL && pTableMetaInfo->pTableMeta != NULL)) {
|
||||
|
||||
pCmd->command = (pCmd->command > TSDB_SQL_MGMT) ? TSDB_SQL_RETRIEVE : TSDB_SQL_FETCH;
|
||||
tscTrace("%p send msg to dnode to free qhandle ASAP, command:%s", pSql, sqlCmd[pCmd->command]);
|
||||
tscDebug("%p send msg to dnode to free qhandle ASAP, command:%s", pSql, sqlCmd[pCmd->command]);
|
||||
tscProcessSql(pSql);
|
||||
|
||||
// in case of sync model query, waits for response and then goes on
|
||||
|
@ -495,9 +495,9 @@ static bool tscFreeQhandleInVnode(SSqlObj* pSql) {
|
|||
// sem_wait(&pSql->rspSem);
|
||||
|
||||
// tscFreeSqlObj(pSql);
|
||||
// tscTrace("%p sqlObj is freed by app", pSql);
|
||||
// tscDebug("%p sqlObj is freed by app", pSql);
|
||||
// } else {
|
||||
tscTrace("%p sqlObj will be freed while rsp received", pSql);
|
||||
tscDebug("%p sqlObj will be freed while rsp received", pSql);
|
||||
// }
|
||||
|
||||
return true;
|
||||
|
@ -510,7 +510,7 @@ void taos_free_result(TAOS_RES *res) {
|
|||
SSqlObj *pSql = (SSqlObj *)res;
|
||||
|
||||
if (pSql == NULL || pSql->signature != pSql) {
|
||||
tscTrace("%p sqlObj has been freed", pSql);
|
||||
tscDebug("%p sqlObj has been freed", pSql);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -518,7 +518,7 @@ void taos_free_result(TAOS_RES *res) {
|
|||
SSqlRes *pRes = &pSql->res;
|
||||
if (pRes == NULL || pRes->qhandle == 0) {
|
||||
tscFreeSqlObj(pSql);
|
||||
tscTrace("%p SqlObj is freed by app, qhandle is null", pSql);
|
||||
tscDebug("%p SqlObj is freed by app, qhandle is null", pSql);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -526,14 +526,14 @@ void taos_free_result(TAOS_RES *res) {
|
|||
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0);
|
||||
if (pQueryInfo == NULL) {
|
||||
tscFreeSqlObj(pSql);
|
||||
tscTrace("%p SqlObj is freed by app", pSql);
|
||||
tscDebug("%p SqlObj is freed by app", pSql);
|
||||
return;
|
||||
}
|
||||
|
||||
pQueryInfo->type = TSDB_QUERY_TYPE_FREE_RESOURCE;
|
||||
if (!tscFreeQhandleInVnode(pSql)) {
|
||||
tscFreeSqlObj(pSql);
|
||||
tscTrace("%p sqlObj is freed by app", pSql);
|
||||
tscDebug("%p sqlObj is freed by app", pSql);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ void taos_stop_query(TAOS_RES *res) {
|
|||
SSqlCmd *pCmd = &pSql->cmd;
|
||||
|
||||
if (pSql->signature != pSql) return;
|
||||
tscTrace("%p start to cancel query", res);
|
||||
tscDebug("%p start to cancel query", res);
|
||||
|
||||
pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED;
|
||||
|
||||
|
@ -630,7 +630,7 @@ void taos_stop_query(TAOS_RES *res) {
|
|||
}
|
||||
|
||||
rpcCancelRequest(pSql->pRpcCtx);
|
||||
tscTrace("%p query is cancelled", res);
|
||||
tscDebug("%p query is cancelled", res);
|
||||
}
|
||||
|
||||
int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) {
|
||||
|
@ -714,7 +714,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
|||
pRes->numOfTotal = 0;
|
||||
pRes->numOfClauseTotal = 0;
|
||||
|
||||
tscTrace("%p Valid SQL: %s pObj:%p", pSql, sql, pObj);
|
||||
tscDebug("%p Valid SQL: %s pObj:%p", pSql, sql, pObj);
|
||||
|
||||
int32_t sqlLen = strlen(sql);
|
||||
if (sqlLen > tsMaxSQLStringLen) {
|
||||
|
@ -728,7 +728,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
|||
if (pSql->sqlstr == NULL) {
|
||||
pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
tscError("%p failed to malloc sql string buffer", pSql);
|
||||
tscTrace("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||
tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||
tfree(pSql);
|
||||
return pRes->code;
|
||||
}
|
||||
|
@ -744,7 +744,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
|
|||
pRes->code = (uint8_t)tsParseSql(pSql, false);
|
||||
int code = pRes->code;
|
||||
|
||||
tscTrace("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||
tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||
taos_free_result(pSql);
|
||||
|
||||
return code;
|
||||
|
@ -848,7 +848,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
pRes->code = 0;
|
||||
|
||||
assert(pSql->fp == NULL);
|
||||
tscTrace("%p tableNameList: %s pObj:%p", pSql, tableNameList, pObj);
|
||||
tscDebug("%p tableNameList: %s pObj:%p", pSql, tableNameList, pObj);
|
||||
|
||||
int32_t tblListLen = strlen(tableNameList);
|
||||
if (tblListLen > MAX_TABLE_NAME_LENGTH) {
|
||||
|
@ -884,7 +884,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
|
||||
tscDoQuery(pSql);
|
||||
|
||||
tscTrace("%p load multi metermeta result:%d %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||
tscDebug("%p load multi metermeta result:%d %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj);
|
||||
if (pRes->code != TSDB_CODE_SUCCESS) {
|
||||
tscPartiallyFreeSqlObj(pSql);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ static void tscProcessStreamLaunchQuery(SSchedMsg *pMsg) {
|
|||
|
||||
} else {
|
||||
tscTansformSQLFuncForSTableQuery(pQueryInfo);
|
||||
tscTrace("%p stream:%p start stream query on:%s", pSql, pStream, pTableMetaInfo->name);
|
||||
tscDebug("%p stream:%p start stream query on:%s", pSql, pStream, pTableMetaInfo->name);
|
||||
tscDoQuery(pStream->pSql);
|
||||
tscIncStreamExecutionCount(pStream);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ static void tscProcessStreamTimer(void *handle, void *tmrId) {
|
|||
pStream->numOfRes = 0; // reset the numOfRes.
|
||||
SSqlObj *pSql = pStream->pSql;
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0);
|
||||
tscTrace("%p add into timer", pSql);
|
||||
tscDebug("%p add into timer", pSql);
|
||||
|
||||
if (isProjectStream(pQueryInfo)) {
|
||||
/*
|
||||
|
@ -184,7 +184,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
|||
|
||||
for(int32_t i = 0; i < numOfRows; ++i) {
|
||||
TAOS_ROW row = taos_fetch_row(res);
|
||||
tscTrace("%p stream:%p fetch result", pSql, pStream);
|
||||
tscDebug("%p stream:%p fetch result", pSql, pStream);
|
||||
if (isProjectStream(pQueryInfo)) {
|
||||
pStream->stime = *(TSKEY *)row[0];
|
||||
} else {
|
||||
|
@ -227,8 +227,8 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
|||
|
||||
// char result[512] = {0};
|
||||
// taos_print_row(result, row, pQueryInfo->fieldsInfo.pFields, pQueryInfo->fieldsInfo.numOfOutput);
|
||||
// tscPrint("%p stream:%p query result: %s", pSql, pStream, result);
|
||||
tscTrace("%p stream:%p fetch result", pSql, pStream);
|
||||
// tscInfo("%p stream:%p query result: %s", pSql, pStream, result);
|
||||
tscDebug("%p stream:%p fetch result", pSql, pStream);
|
||||
|
||||
// user callback function
|
||||
(*pStream->fp)(pStream->param, res, row);
|
||||
|
@ -250,7 +250,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
|||
}
|
||||
}
|
||||
|
||||
tscTrace("%p stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql, pStream, pTableMetaInfo->name,
|
||||
tscDebug("%p stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql, pStream, pTableMetaInfo->name,
|
||||
pStream->numOfRes);
|
||||
|
||||
// release the metric/meter meta information reference, so data in cache can be updated
|
||||
|
@ -273,7 +273,7 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
|
|||
/*
|
||||
* current time window will be closed, since it too early to exceed the maxRetentWindow value
|
||||
*/
|
||||
tscTrace("%p stream:%p, etime:%" PRId64 " is too old, exceeds the max retention time window:%" PRId64 ", stop the stream",
|
||||
tscDebug("%p stream:%p, etime:%" PRId64 " is too old, exceeds the max retention time window:%" PRId64 ", stop the stream",
|
||||
pStream->pSql, pStream, pStream->stime, pStream->etime);
|
||||
// TODO : How to terminate stream here
|
||||
if (pStream->callback) {
|
||||
|
@ -284,10 +284,10 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
|
|||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream,
|
||||
tscDebug("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream,
|
||||
now + timer, timer, delay, pStream->stime, etime);
|
||||
} else {
|
||||
tscTrace("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream,
|
||||
tscDebug("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream,
|
||||
pStream->stime, timer, delay, pStream->stime - pStream->interval, pStream->stime - 1);
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
|
|||
*/
|
||||
timer = pStream->slidingTime;
|
||||
if (pStream->stime > pStream->etime) {
|
||||
tscTrace("%p stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql, pStream,
|
||||
tscDebug("%p stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql, pStream,
|
||||
pStream->stime, pStream->etime);
|
||||
// TODO : How to terminate stream here
|
||||
if (pStream->callback) {
|
||||
|
@ -344,7 +344,7 @@ static void tscSetNextLaunchTimer(SSqlStream *pStream, SSqlObj *pSql) {
|
|||
} else {
|
||||
pStream->stime += pStream->slidingTime;
|
||||
if ((pStream->stime - pStream->interval) >= pStream->etime) {
|
||||
tscTrace("%p stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql, pStream,
|
||||
tscDebug("%p stream:%p, stime:%" PRId64 " is larger than end time: %" PRId64 ", stop the stream", pStream->pSql, pStream,
|
||||
pStream->stime, pStream->etime);
|
||||
// TODO : How to terminate stream here
|
||||
if (pStream->callback) {
|
||||
|
@ -503,7 +503,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
|
|||
}
|
||||
strtolower(pSql->sqlstr, sqlstr);
|
||||
|
||||
tscDump("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
tscDebugDump("%p SQL: %s", pSql, pSql->sqlstr);
|
||||
tsem_init(&pSql->rspSem, 0, 0);
|
||||
|
||||
int32_t code = tsParseSql(pSql, true);
|
||||
|
@ -541,7 +541,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
|
|||
pCmd->command = TSDB_SQL_SELECT;
|
||||
taosTmrReset(tscProcessStreamTimer, starttime, pStream, tscTmr, &pStream->pTimer);
|
||||
|
||||
tscTrace("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql,
|
||||
tscDebug("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql,
|
||||
pStream, pTableMetaInfo->name, pStream->interval, pStream->slidingTime, starttime, sqlstr);
|
||||
|
||||
return pStream;
|
||||
|
@ -564,7 +564,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
|
|||
|
||||
taosTmrStopA(&(pStream->pTimer));
|
||||
|
||||
tscTrace("%p stream:%p is closed", pSql, pStream);
|
||||
tscDebug("%p stream:%p is closed", pSql, pStream);
|
||||
|
||||
tscFreeSqlObj(pSql);
|
||||
pStream->pSql = NULL;
|
||||
|
|
|
@ -260,12 +260,12 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
|
|||
|
||||
FILE* fp = fopen(buf, "r");
|
||||
if (fp == NULL) {
|
||||
tscTrace("subscription progress file does not exist: %s", pSub->topic);
|
||||
tscDebug("subscription progress file does not exist: %s", pSub->topic);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fgets(buf, sizeof(buf), fp) == NULL) {
|
||||
tscTrace("invalid subscription progress file: %s", pSub->topic);
|
||||
tscDebug("invalid subscription progress file: %s", pSub->topic);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
|
|||
}
|
||||
}
|
||||
if (strcmp(buf, pSub->pSql->sqlstr) != 0) {
|
||||
tscTrace("subscription sql statement mismatch: %s", pSub->topic);
|
||||
tscDebug("subscription sql statement mismatch: %s", pSub->topic);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
|
|||
fclose(fp);
|
||||
|
||||
taosArraySort(progress, tscCompareSubscriptionProgress);
|
||||
tscTrace("subscription progress loaded, %zu tables: %s", taosArrayGetSize(progress), pSub->topic);
|
||||
tscDebug("subscription progress loaded, %zu tables: %s", taosArrayGetSize(progress), pSub->topic);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ TAOS_SUB *taos_subscribe(TAOS *taos, int restart, const char* topic, const char
|
|||
pSub->taos = taos;
|
||||
|
||||
if (restart) {
|
||||
tscTrace("restart subscription: %s", topic);
|
||||
tscDebug("restart subscription: %s", topic);
|
||||
} else {
|
||||
tscLoadSubscriptionProgress(pSub);
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ TAOS_SUB *taos_subscribe(TAOS *taos, int restart, const char* topic, const char
|
|||
|
||||
pSub->interval = interval;
|
||||
if (fp != NULL) {
|
||||
tscTrace("asynchronize subscription, create new timer: %s", topic);
|
||||
tscDebug("asynchronize subscription, create new timer: %s", topic);
|
||||
pSub->fp = fp;
|
||||
pSub->param = param;
|
||||
taosTmrReset(tscProcessSubscriptionTimer, interval, pSub, tscTmr, &pSub->pTimer);
|
||||
|
@ -379,7 +379,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
|
|||
if (pSub->pTimer == NULL) {
|
||||
int64_t duration = taosGetTimestampMs() - pSub->lastConsumeTime;
|
||||
if (duration < (int64_t)(pSub->interval)) {
|
||||
tscTrace("subscription consume too frequently, blocking...");
|
||||
tscDebug("subscription consume too frequently, blocking...");
|
||||
taosMsleep(pSub->interval - (int32_t)duration);
|
||||
}
|
||||
}
|
||||
|
@ -388,9 +388,9 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
|
|||
tscRemoveFromSqlList(pSql);
|
||||
|
||||
if (taosGetTimestampMs() - pSub->lastSyncTime > 10 * 60 * 1000) {
|
||||
tscTrace("begin table synchronization");
|
||||
tscDebug("begin table synchronization");
|
||||
if (!tscUpdateSubscription(pSub->taos, pSub)) return NULL;
|
||||
tscTrace("table synchronization completed");
|
||||
tscDebug("table synchronization completed");
|
||||
}
|
||||
|
||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0);
|
||||
|
|
|
@ -64,7 +64,7 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
|
|||
tsBufFlush(output1);
|
||||
tsBufFlush(output2);
|
||||
|
||||
tscTrace("%p input1 is empty, 0 for secondary query after ts blocks intersecting", pSql);
|
||||
tscDebug("%p input1 is empty, 0 for secondary query after ts blocks intersecting", pSql);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
|
|||
tsBufFlush(output1);
|
||||
tsBufFlush(output2);
|
||||
|
||||
tscTrace("%p input2 is empty, 0 for secondary query after ts blocks intersecting", pSql);
|
||||
tscDebug("%p input2 is empty, 0 for secondary query after ts blocks intersecting", pSql);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
|
|||
STSElem elem2 = tsBufGetElem(pSupporter2->pTSBuf);
|
||||
|
||||
#ifdef _DEBUG_VIEW
|
||||
tscPrint("%" PRId64 ", tags:%d \t %" PRId64 ", tags:%d", elem1.ts, elem1.tag, elem2.ts, elem2.tag);
|
||||
tscInfo("%" PRId64 ", tags:%d \t %" PRId64 ", tags:%d", elem1.ts, elem1.tag, elem2.ts, elem2.tag);
|
||||
#endif
|
||||
|
||||
if (elem1.tag < elem2.tag || (elem1.tag == elem2.tag && tsCompare(order, elem1.ts, elem2.ts))) {
|
||||
|
@ -149,7 +149,7 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
|
|||
tsBufDestory(pSupporter1->pTSBuf);
|
||||
tsBufDestory(pSupporter2->pTSBuf);
|
||||
|
||||
tscTrace("%p input1:%" PRId64 ", input2:%" PRId64 ", final:%" PRId64 " for secondary query after ts blocks "
|
||||
tscDebug("%p input1:%" PRId64 ", input2:%" PRId64 ", final:%" PRId64 " for secondary query after ts blocks "
|
||||
"intersecting, skey:%" PRId64 ", ekey:%" PRId64, pSql, numOfInput1, numOfInput2, output1->numOfTotal,
|
||||
win->skey, win->ekey);
|
||||
|
||||
|
@ -250,7 +250,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
assert(numOfSub > 0);
|
||||
|
||||
// scan all subquery, if one sub query has only ts, ignore it
|
||||
tscTrace("%p start to launch secondary subqueries, total:%d, only:%d needs to query", pSql, pSql->numOfSubs, numOfSub);
|
||||
tscDebug("%p start to launch secondary subqueries, total:%d, only:%d needs to query", pSql, pSql->numOfSubs, numOfSub);
|
||||
|
||||
//the subqueries that do not actually launch the secondary query to virtual node is set as completed.
|
||||
SSubqueryState* pState = pSupporter->pState;
|
||||
|
@ -266,7 +266,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
pSupporter = pPrevSub->param;
|
||||
|
||||
if (taosArrayGetSize(pSupporter->exprList) == 0) {
|
||||
tscTrace("%p subIndex: %d, no need to launch query, ignore it", pSql, i);
|
||||
tscDebug("%p subIndex: %d, no need to launch query, ignore it", pSql, i);
|
||||
|
||||
tscDestroyJoinSupporter(pSupporter);
|
||||
tscFreeSqlObj(pPrevSub);
|
||||
|
@ -355,7 +355,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
|
|||
}
|
||||
|
||||
size_t numOfCols = taosArrayGetSize(pNewQueryInfo->colList);
|
||||
tscTrace("%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%zu, colList:%zu, fieldsInfo:%d, name:%s",
|
||||
tscDebug("%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%zu, colList:%zu, fieldsInfo:%d, name:%s",
|
||||
pSql, pNew, 0, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, taosArrayGetSize(pNewQueryInfo->exprList),
|
||||
numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, pTableMetaInfo->name);
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ static UNUSED_FUNC void tSIntersectionAndLaunchSecQuery(SJoinSupporter* pSupport
|
|||
//// int32_t totalVnode = pTableMetaInfo->pMetricMeta->numOfVnodes;
|
||||
// int32_t totalVnode = 0;
|
||||
// if ((++pTableMetaInfo->vgroupIndex) < totalVnode) {
|
||||
// tscTrace("%p current vnode:%d exhausted, try next:%d. total vnode:%d. current numOfRes:%d", pSql,
|
||||
// tscDebug("%p current vnode:%d exhausted, try next:%d. total vnode:%d. current numOfRes:%d", pSql,
|
||||
// pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVnode, pRes->numOfTotal);
|
||||
//
|
||||
// pSql->cmd.command = TSDB_SQL_SELECT;
|
||||
|
@ -448,7 +448,7 @@ static UNUSED_FUNC void tSIntersectionAndLaunchSecQuery(SJoinSupporter* pSupport
|
|||
STimeWindow win = TSWINDOW_INITIALIZER;
|
||||
int64_t num = doTSBlockIntersect(pParentSql, p1, p2, &win);
|
||||
if (num <= 0) { // no result during ts intersect
|
||||
tscTrace("%p free all sub SqlObj and quit", pParentSql);
|
||||
tscDebug("%p free all sub SqlObj and quit", pParentSql);
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
} else {
|
||||
updateQueryTimeRange(pParentQueryInfo, &win);
|
||||
|
@ -495,7 +495,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
|
|||
taosArrayPush(result, &info);
|
||||
}
|
||||
|
||||
tscTrace("%p tid:%d, uid:%"PRIu64",vgId:%d added for vnode query", pSql, tt->tid, tt->uid, tt->vgId)
|
||||
tscDebug("%p tid:%d, uid:%"PRIu64",vgId:%d added for vnode query", pSql, tt->tid, tt->uid, tt->vgId)
|
||||
STableIdInfo item = {.uid = tt->uid, .tid = tt->tid, .key = INT64_MIN};
|
||||
taosArrayPush(vgTables, &item);
|
||||
prev = tt;
|
||||
|
@ -550,7 +550,7 @@ static void issueTSCompQuery(SSqlObj* pSql, SJoinSupporter* pSupporter, SSqlObj*
|
|||
|
||||
size_t numOfCols = taosArrayGetSize(pQueryInfo->colList);
|
||||
|
||||
tscTrace(
|
||||
tscDebug(
|
||||
"%p subquery:%p tableIndex:%d, vgroupIndex:%d, numOfVgroups:%d, type:%d, ts_comp query to retrieve timestamps, "
|
||||
"numOfExpr:%zu, colList:%zu, numOfOutputFields:%d, name:%s",
|
||||
pParent, pSql, 0, pTableMetaInfo->vgroupIndex, pTableMetaInfo->vgroupList->numOfVgroups, pQueryInfo->type,
|
||||
|
@ -581,7 +581,7 @@ static bool checkForDuplicateTagVal(SQueryInfo* pQueryInfo, SJoinSupporter* p1,
|
|||
}
|
||||
|
||||
static void getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pParentSql, SArray** s1, SArray** s2) {
|
||||
tscTrace("%p all subqueries retrieve <tid, tags> complete, do tags match", pParentSql);
|
||||
tscDebug("%p all subqueries retrieve <tid, tags> complete, do tags match", pParentSql);
|
||||
|
||||
SJoinSupporter* p1 = pParentSql->pSubs[0]->param;
|
||||
SJoinSupporter* p2 = pParentSql->pSubs[1]->param;
|
||||
|
@ -611,7 +611,7 @@ static void getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pParent
|
|||
|
||||
int32_t ret = doCompare(pp1->tag, pp2->tag, pColSchema->type, pColSchema->bytes);
|
||||
if (ret == 0) {
|
||||
tscTrace("%p tag matched, vgId:%d, val:%d, tid:%d, uid:%"PRIu64", tid:%d, uid:%"PRIu64, pParentSql, pp1->vgId,
|
||||
tscDebug("%p tag matched, vgId:%d, val:%d, tid:%d, uid:%"PRIu64", tid:%d, uid:%"PRIu64, pParentSql, pp1->vgId,
|
||||
*(int*) pp1->tag, pp1->tid, pp1->uid, pp2->tid, pp2->uid);
|
||||
|
||||
taosArrayPush(*s1, pp1);
|
||||
|
@ -691,7 +691,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
pTableMetaInfo->vgroupIndex += 1;
|
||||
assert(pTableMetaInfo->vgroupIndex < totalVgroups);
|
||||
|
||||
tscTrace("%p tid_tag from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%d",
|
||||
tscDebug("%p tid_tag from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%d",
|
||||
pSql, pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pSupporter->num);
|
||||
|
||||
pCmd->command = TSDB_SQL_SELECT;
|
||||
|
@ -712,7 +712,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
SArray *s1 = NULL, *s2 = NULL;
|
||||
getIntersectionOfTableTuple(pQueryInfo, pParentSql, &s1, &s2);
|
||||
if (taosArrayGetSize(s1) == 0 || taosArrayGetSize(s2) == 0) { // no results,return.
|
||||
tscTrace("%p free all sub SqlObj and quit", pParentSql);
|
||||
tscDebug("%p free all sub SqlObj and quit", pParentSql);
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
|
||||
} else {
|
||||
|
@ -782,7 +782,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
}
|
||||
|
||||
if (pSupporter->pTSBuf == NULL) {
|
||||
tscTrace("%p create tmp file for ts block:%s, size:%d bytes", pSql, pBuf->path, numOfRows);
|
||||
tscDebug("%p create tmp file for ts block:%s, size:%d bytes", pSql, pBuf->path, numOfRows);
|
||||
pSupporter->pTSBuf = pBuf;
|
||||
} else {
|
||||
assert(pQueryInfo->numOfTables == 1); // for subquery, only one
|
||||
|
@ -810,7 +810,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
pTableMetaInfo->vgroupIndex += 1;
|
||||
assert(pTableMetaInfo->vgroupIndex < totalVgroups);
|
||||
|
||||
tscTrace("%p results from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%" PRId64,
|
||||
tscDebug("%p results from vgroup index:%d completed, try next vgroup:%d. total vgroups:%d. current numOfRes:%" PRId64,
|
||||
pSql, pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups,
|
||||
pRes->numOfClauseTotal);
|
||||
|
||||
|
@ -834,7 +834,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p all subquery retrieve ts complete, do ts block intersect", pParentSql);
|
||||
tscDebug("%p all subquery retrieve ts complete, do ts block intersect", pParentSql);
|
||||
|
||||
// proceeds to launched secondary query to retrieve final data
|
||||
SJoinSupporter* p1 = pParentSql->pSubs[0]->param;
|
||||
|
@ -843,7 +843,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
|||
STimeWindow win = TSWINDOW_INITIALIZER;
|
||||
int64_t num = doTSBlockIntersect(pParentSql, p1, p2, &win);
|
||||
if (num <= 0) { // no result during ts intersect
|
||||
tscTrace("%p no results generated in ts intersection, free all sub SqlObj and quit", pParentSql);
|
||||
tscDebug("%p no results generated in ts intersection, free all sub SqlObj and quit", pParentSql);
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
|
||||
return;
|
||||
|
@ -897,11 +897,11 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
|
|||
}
|
||||
|
||||
if (atomic_sub_fetch_32(&pState->numOfRemain, 1) > 0) {
|
||||
tscTrace("%p sub:%p completed, remain:%d, total:%d", pParentSql, tres, pState->numOfRemain, pState->numOfTotal);
|
||||
tscDebug("%p sub:%p completed, remain:%d, total:%d", pParentSql, tres, pState->numOfRemain, pState->numOfTotal);
|
||||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p all %d secondary subqueries retrieval completed, code:%d", tres, pState->numOfTotal, pParentSql->res.code);
|
||||
tscDebug("%p all %d secondary subqueries retrieval completed, code:%d", tres, pState->numOfTotal, pParentSql->res.code);
|
||||
|
||||
if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
|
||||
freeJoinSubqueryObj(pParentSql);
|
||||
|
@ -1000,7 +1000,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
|
|||
}
|
||||
|
||||
// TODO multi-vnode retrieve for projection query with limitation has bugs, since the global limiation is not handled
|
||||
tscTrace("%p retrieve data from %d subqueries", pSql, numOfFetch);
|
||||
tscDebug("%p retrieve data from %d subqueries", pSql, numOfFetch);
|
||||
SJoinSupporter* pSupporter = tscUpdateSubqueryStatus(pSql, numOfFetch);
|
||||
|
||||
for (int32_t i = 0; i < pSql->numOfSubs; ++i) {
|
||||
|
@ -1021,7 +1021,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
|
|||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
|
||||
if (pRes1->row >= pRes1->numOfRows) {
|
||||
tscTrace("%p subquery:%p retrieve data from vnode, subquery:%d, vgroupIndex:%d", pSql, pSql1,
|
||||
tscDebug("%p subquery:%p retrieve data from vnode, subquery:%d, vgroupIndex:%d", pSql, pSql1,
|
||||
pSupporter->subqueryIndex, pTableMetaInfo->vgroupIndex);
|
||||
|
||||
tscResetForNextRetrieve(pRes1);
|
||||
|
@ -1041,7 +1041,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
|
|||
SSqlCmd* pCmd = &pSql->cmd;
|
||||
SSqlRes* pRes = &pSql->res;
|
||||
|
||||
tscTrace("%p all subquery response, retrieve data", pSql);
|
||||
tscDebug("%p all subquery response, retrieve data", pSql);
|
||||
|
||||
// the column transfer support struct has been built
|
||||
if (pRes->pColumnIndex != NULL) {
|
||||
|
@ -1243,7 +1243,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
|
|||
tscAddSpecialColumnForSelect(pNewQueryInfo, 0, TSDB_FUNC_TID_TAG, &index, &s1, TSDB_COL_TAG);
|
||||
size_t numOfCols = taosArrayGetSize(pNewQueryInfo->colList);
|
||||
|
||||
tscTrace(
|
||||
tscDebug(
|
||||
"%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, transfer to tid_tag query to retrieve (tableId, tags), "
|
||||
"exprInfo:%zu, colList:%zu, fieldsInfo:%d, tagIndex:%d, name:%s",
|
||||
pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo),
|
||||
|
@ -1278,7 +1278,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
|
|||
|
||||
size_t numOfCols = taosArrayGetSize(pNewQueryInfo->colList);
|
||||
|
||||
tscTrace(
|
||||
tscDebug(
|
||||
"%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%u, transfer to ts_comp query to retrieve timestamps, "
|
||||
"exprInfo:%zu, colList:%zu, fieldsInfo:%d, name:%s",
|
||||
pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo),
|
||||
|
@ -1302,7 +1302,7 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
|
|||
pState->numOfTotal = pQueryInfo->numOfTables;
|
||||
pState->numOfRemain = pState->numOfTotal;
|
||||
|
||||
tscTrace("%p start subquery, total:%d", pSql, pQueryInfo->numOfTables);
|
||||
tscDebug("%p start subquery, total:%d", pSql, pQueryInfo->numOfTables);
|
||||
for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
||||
SJoinSupporter *pSupporter = tscCreateJoinSupporter(pSql, pState, i);
|
||||
|
||||
|
@ -1384,7 +1384,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
|
||||
pSql->pSubs = calloc(pSql->numOfSubs, POINTER_BYTES);
|
||||
|
||||
tscTrace("%p retrieved query data from %d vnode(s)", pSql, pSql->numOfSubs);
|
||||
tscDebug("%p retrieved query data from %d vnode(s)", pSql, pSql->numOfSubs);
|
||||
SSubqueryState *pState = calloc(1, sizeof(SSubqueryState));
|
||||
pState->numOfTotal = pSql->numOfSubs;
|
||||
pState->numOfRemain = pSql->numOfSubs;
|
||||
|
@ -1436,7 +1436,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
assert(pNewQueryInfo->tsBuf != NULL);
|
||||
}
|
||||
|
||||
tscTrace("%p sub:%p create subquery success. orderOfSub:%d", pSql, pNew, trs->subqueryIndex);
|
||||
tscDebug("%p sub:%p create subquery success. orderOfSub:%d", pSql, pNew, trs->subqueryIndex);
|
||||
}
|
||||
|
||||
if (i < pSql->numOfSubs) {
|
||||
|
@ -1458,7 +1458,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
SSqlObj* pSub = pSql->pSubs[j];
|
||||
SRetrieveSupport* pSupport = pSub->param;
|
||||
|
||||
tscTrace("%p sub:%p launch subquery, orderOfSub:%d.", pSql, pSub, pSupport->subqueryIndex);
|
||||
tscDebug("%p sub:%p launch subquery, orderOfSub:%d.", pSql, pSub, pSupport->subqueryIndex);
|
||||
tscProcessSql(pSub);
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
|
|||
}
|
||||
|
||||
static void tscFreeSubSqlObj(SRetrieveSupport *trsupport, SSqlObj *pSql) {
|
||||
tscTrace("%p start to free subquery result", pSql);
|
||||
tscDebug("%p start to free subquery result", pSql);
|
||||
|
||||
if (pSql->res.code == TSDB_CODE_SUCCESS) {
|
||||
taos_free_result(pSql);
|
||||
|
@ -1522,12 +1522,12 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
|
|||
*/
|
||||
pSql->res.numOfRows = 0;
|
||||
trsupport->numOfRetry = MAX_NUM_OF_SUBQUERY_RETRY; // disable retry efforts
|
||||
tscTrace("%p query is cancelled, sub:%p, orderOfSub:%d abort retrieve, code:%d", pParentSql, pSql,
|
||||
tscDebug("%p query is cancelled, sub:%p, orderOfSub:%d abort retrieve, code:%d", pParentSql, pSql,
|
||||
subqueryIndex, pParentSql->res.code);
|
||||
}
|
||||
|
||||
if (numOfRows >= 0) { // current query is successful, but other sub query failed, still abort current query.
|
||||
tscTrace("%p sub:%p retrieve numOfRows:%d,orderOfSub:%d", pParentSql, pSql, numOfRows, subqueryIndex);
|
||||
tscDebug("%p sub:%p retrieve numOfRows:%d,orderOfSub:%d", pParentSql, pSql, numOfRows, subqueryIndex);
|
||||
tscError("%p sub:%p abort further retrieval due to other queries failure,orderOfSub:%d,code:%d", pParentSql, pSql,
|
||||
subqueryIndex, pParentSql->res.code);
|
||||
} else {
|
||||
|
@ -1542,7 +1542,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
|
|||
trsupport->localBuffer->num = 0;
|
||||
pthread_mutex_unlock(&trsupport->queryMutex);
|
||||
|
||||
tscTrace("%p sub:%p retrieve failed, code:%s, orderOfSub:%d, retry:%d", trsupport->pParentSqlObj, pSql,
|
||||
tscDebug("%p sub:%p retrieve failed, code:%s, orderOfSub:%d, retry:%d", trsupport->pParentSqlObj, pSql,
|
||||
tstrerror(numOfRows), subqueryIndex, trsupport->numOfRetry);
|
||||
|
||||
SSqlObj *pNew = tscCreateSqlObjForSubquery(trsupport->pParentSqlObj, trsupport, pSql);
|
||||
|
@ -1566,7 +1566,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
|
|||
|
||||
int32_t remain = -1;
|
||||
if ((remain = atomic_sub_fetch_32(&pState->numOfRemain, 1)) > 0) {
|
||||
tscTrace("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pParentSql, pSql, trsupport->subqueryIndex,
|
||||
tscDebug("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pParentSql, pSql, trsupport->subqueryIndex,
|
||||
pState->numOfTotal - remain);
|
||||
|
||||
return tscFreeSubSqlObj(trsupport, pSql);
|
||||
|
@ -1607,7 +1607,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
|
|||
|
||||
// data in from current vnode is stored in cache and disk
|
||||
uint32_t numOfRowsFromSubquery = trsupport->pExtMemBuffer[idx]->numOfTotalElems + trsupport->localBuffer->num;
|
||||
tscTrace("%p sub:%p all data retrieved from ip:%s, vgId:%d, numOfRows:%d, orderOfSub:%d", pPObj, pSql,
|
||||
tscDebug("%p sub:%p all data retrieved from ip:%s, vgId:%d, numOfRows:%d, orderOfSub:%d", pPObj, pSql,
|
||||
pTableMetaInfo->vgroupList->vgroups[0].ipAddr[0].fqdn, pTableMetaInfo->vgroupList->vgroups[0].vgId,
|
||||
numOfRowsFromSubquery, idx);
|
||||
|
||||
|
@ -1637,7 +1637,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
|
|||
|
||||
int32_t remain = -1;
|
||||
if ((remain = atomic_sub_fetch_32(&pState->numOfRemain, 1)) > 0) {
|
||||
tscTrace("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pPObj, pSql, trsupport->subqueryIndex,
|
||||
tscDebug("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pPObj, pSql, trsupport->subqueryIndex,
|
||||
pState->numOfTotal - remain);
|
||||
|
||||
return tscFreeSubSqlObj(trsupport, pSql);
|
||||
|
@ -1646,14 +1646,14 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
|
|||
// all sub-queries are returned, start to local merge process
|
||||
pDesc->pColumnModel->capacity = trsupport->pExtMemBuffer[idx]->numOfElemsPerPage;
|
||||
|
||||
tscTrace("%p retrieve from %d vnodes completed.final NumOfRows:%" PRId64 ",start to build loser tree", pPObj,
|
||||
tscDebug("%p retrieve from %d vnodes completed.final NumOfRows:%" PRId64 ",start to build loser tree", pPObj,
|
||||
pState->numOfTotal, pState->numOfRetrievedRows);
|
||||
|
||||
SQueryInfo *pPQueryInfo = tscGetQueryInfoDetail(&pPObj->cmd, 0);
|
||||
tscClearInterpInfo(pPQueryInfo);
|
||||
|
||||
tscCreateLocalReducer(trsupport->pExtMemBuffer, pState->numOfTotal, pDesc, trsupport->pFinalColModel, pPObj);
|
||||
tscTrace("%p build loser tree completed", pPObj);
|
||||
tscDebug("%p build loser tree completed", pPObj);
|
||||
|
||||
pPObj->res.precision = pSql->res.precision;
|
||||
pPObj->res.numOfRows = 0;
|
||||
|
@ -1680,7 +1680,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
|
|||
|
||||
SSqlObj *pSql = (SSqlObj *)tres;
|
||||
if (pSql == NULL) { // sql object has been released in error process, return immediately
|
||||
tscTrace("%p subquery has been released, idx:%d, abort", pPObj, idx);
|
||||
tscDebug("%p subquery has been released, idx:%d, abort", pPObj, idx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1701,7 +1701,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
|
|||
assert(pRes->numOfRows == numOfRows);
|
||||
int64_t num = atomic_add_fetch_64(&pState->numOfRetrievedRows, numOfRows);
|
||||
|
||||
tscTrace("%p sub:%p retrieve numOfRows:%" PRId64 " totalNumOfRows:%" PRIu64 " from ip:%s, orderOfSub:%d", pPObj, pSql,
|
||||
tscDebug("%p sub:%p retrieve numOfRows:%" PRId64 " totalNumOfRows:%" PRIu64 " from ip:%s, orderOfSub:%d", pPObj, pSql,
|
||||
pRes->numOfRows, pState->numOfRetrievedRows, pSql->ipList.fqdn[pSql->ipList.inUse], idx);
|
||||
|
||||
if (num > tsMaxNumOfOrderedResults && tscIsProjectionQueryOnSTable(pQueryInfo, 0)) {
|
||||
|
@ -1790,7 +1790,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
|
|||
code = pParentSql->res.code;
|
||||
}
|
||||
|
||||
tscTrace("%p query cancelled or failed, sub:%p, orderOfSub:%d abort, code:%s", pParentSql, pSql,
|
||||
tscDebug("%p query cancelled or failed, sub:%p, orderOfSub:%d abort, code:%s", pParentSql, pSql,
|
||||
trsupport->subqueryIndex, tstrerror(code));
|
||||
}
|
||||
|
||||
|
@ -1803,10 +1803,10 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
|
|||
*/
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
if (trsupport->numOfRetry++ >= MAX_NUM_OF_SUBQUERY_RETRY) {
|
||||
tscTrace("%p sub:%p reach the max retry times, set global code:%s", pParentSql, pSql, tstrerror(code));
|
||||
tscDebug("%p sub:%p reach the max retry times, set global code:%s", pParentSql, pSql, tstrerror(code));
|
||||
atomic_val_compare_exchange_32(&pParentSql->res.code, TSDB_CODE_SUCCESS, code);
|
||||
} else { // does not reach the maximum retry time, go on
|
||||
tscTrace("%p sub:%p failed code:%s, retry:%d", pParentSql, pSql, tstrerror(code), trsupport->numOfRetry);
|
||||
tscDebug("%p sub:%p failed code:%s, retry:%d", pParentSql, pSql, tstrerror(code), trsupport->numOfRetry);
|
||||
|
||||
SSqlObj *pNew = tscCreateSqlObjForSubquery(pParentSql, trsupport, pSql);
|
||||
|
||||
|
@ -1828,12 +1828,12 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
|
|||
}
|
||||
|
||||
if (pParentSql->res.code != TSDB_CODE_SUCCESS) { // at least one peer subquery failed, abort current query
|
||||
tscTrace("%p sub:%p query failed,ip:%s,vgId:%d,orderOfSub:%d,global code:%d", pParentSql, pSql,
|
||||
tscDebug("%p sub:%p query failed,ip:%s,vgId:%d,orderOfSub:%d,global code:%d", pParentSql, pSql,
|
||||
pVgroup->ipAddr[0].fqdn, pVgroup->vgId, trsupport->subqueryIndex, pParentSql->res.code);
|
||||
|
||||
tscHandleSubqueryError(param, tres, pParentSql->res.code);
|
||||
} else { // success, proceed to retrieve data from dnode
|
||||
tscTrace("%p sub:%p query complete, ip:%s, vgId:%d, orderOfSub:%d, retrieve data", trsupport->pParentSqlObj, pSql,
|
||||
tscDebug("%p sub:%p query complete, ip:%s, vgId:%d, orderOfSub:%d, retrieve data", trsupport->pParentSqlObj, pSql,
|
||||
pVgroup->ipAddr[0].fqdn, pVgroup->vgId, trsupport->subqueryIndex);
|
||||
|
||||
if (pSql->res.qhandle == 0) { // qhandle is NULL, code is TSDB_CODE_SUCCESS means no results generated from this vnode
|
||||
|
@ -1869,7 +1869,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
|||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p Async insertion completed, total inserted:%" PRId64, pParentObj, pParentObj->res.numOfRows);
|
||||
tscDebug("%p Async insertion completed, total inserted:%" PRId64, pParentObj, pParentObj->res.numOfRows);
|
||||
|
||||
// release data block data
|
||||
tfree(pState);
|
||||
|
@ -1892,7 +1892,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
pSql->pSubs = calloc(size, POINTER_BYTES);
|
||||
pSql->numOfSubs = size;
|
||||
|
||||
tscTrace("%p submit data to %zu vnode(s)", pSql, size);
|
||||
tscDebug("%p submit data to %zu vnode(s)", pSql, size);
|
||||
|
||||
SSubqueryState *pState = calloc(1, sizeof(SSubqueryState));
|
||||
pState->numOfTotal = pSql->numOfSubs;
|
||||
|
@ -1922,10 +1922,10 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
STableDataBlocks* pTableDataBlock = taosArrayGetP(pCmd->pDataBlocks, numOfSub);
|
||||
pRes->code = tscCopyDataBlockToPayload(pNew, pTableDataBlock);
|
||||
if (pRes->code == TSDB_CODE_SUCCESS) {
|
||||
tscTrace("%p sub:%p create subObj success. orderOfSub:%d", pSql, pNew, numOfSub);
|
||||
tscDebug("%p sub:%p create subObj success. orderOfSub:%d", pSql, pNew, numOfSub);
|
||||
numOfSub++;
|
||||
} else {
|
||||
tscTrace("%p prepare submit data block failed in async insertion, vnodeIdx:%d, total:%zu, code:%s", pSql, numOfSub,
|
||||
tscDebug("%p prepare submit data block failed in async insertion, vnodeIdx:%d, total:%zu, code:%s", pSql, numOfSub,
|
||||
size, tstrerror(pRes->code));
|
||||
goto _error;
|
||||
}
|
||||
|
@ -1940,7 +1940,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
// use the local variable
|
||||
for (int32_t j = 0; j < numOfSub; ++j) {
|
||||
SSqlObj *pSub = pSql->pSubs[j];
|
||||
tscTrace("%p sub:%p launch sub insert, orderOfSub:%d", pSql, pSub, j);
|
||||
tscDebug("%p sub:%p launch sub insert, orderOfSub:%d", pSql, pSub, j);
|
||||
tscProcessSql(pSub);
|
||||
}
|
||||
|
||||
|
@ -2006,7 +2006,7 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
|
|||
break;
|
||||
} else { // continue retrieve data from vnode
|
||||
if (!tscHasRemainDataInSubqueryResultSet(pSql)) {
|
||||
tscTrace("%p at least one subquery exhausted, free all other %d subqueries", pSql, pSql->numOfSubs - 1);
|
||||
tscDebug("%p at least one subquery exhausted, free all other %d subqueries", pSql, pSql->numOfSubs - 1);
|
||||
SSubqueryState *pState = NULL;
|
||||
|
||||
// free all sub sqlobj
|
||||
|
|
|
@ -72,7 +72,7 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) {
|
|||
tscError("failed to init connection to TDengine");
|
||||
return -1;
|
||||
} else {
|
||||
tscTrace("dnodeConn:%p is created, user:%s", *pDnodeConn, user);
|
||||
tscDebug("dnodeConn:%p is created, user:%s", *pDnodeConn, user);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ void taos_init_imp() {
|
|||
taosCheckGlobalCfg();
|
||||
taosPrintGlobalCfg();
|
||||
|
||||
tscTrace("starting to initialize TAOS client ...");
|
||||
tscTrace("Local End Point is:%s", tsLocalEp);
|
||||
tscDebug("starting to initialize TAOS client ...");
|
||||
tscDebug("Local End Point is:%s", tsLocalEp);
|
||||
}
|
||||
|
||||
taosSetCoreDump();
|
||||
|
@ -151,7 +151,7 @@ void taos_init_imp() {
|
|||
tscCacheHandle = taosCacheInit(refreshTime);
|
||||
}
|
||||
|
||||
tscTrace("client is initialized successfully");
|
||||
tscDebug("client is initialized successfully");
|
||||
}
|
||||
|
||||
void taos_init() { pthread_once(&tscinit, taos_init_imp); }
|
||||
|
@ -182,7 +182,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_OPTION) {
|
||||
tstrncpy(configDir, pStr, TSDB_FILENAME_LEN);
|
||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||
tscPrint("set config file directory:%s", pStr);
|
||||
tscInfo("set config file directory:%s", pStr);
|
||||
} else {
|
||||
tscWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, pStr,
|
||||
tsCfgStatusStr[cfg->cfgStatus], (char *)cfg->ptr);
|
||||
|
@ -198,7 +198,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
if (tsShellActivityTimer < 1) tsShellActivityTimer = 1;
|
||||
if (tsShellActivityTimer > 3600) tsShellActivityTimer = 3600;
|
||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||
tscPrint("set shellActivityTimer:%d", tsShellActivityTimer);
|
||||
tscInfo("set shellActivityTimer:%d", tsShellActivityTimer);
|
||||
} else {
|
||||
tscWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, pStr,
|
||||
tsCfgStatusStr[cfg->cfgStatus], *(int32_t *)cfg->ptr);
|
||||
|
@ -211,7 +211,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
|
||||
size_t len = strlen(pStr);
|
||||
if (len == 0 || len > TSDB_LOCALE_LEN) {
|
||||
tscPrint("Invalid locale:%s, use default", pStr);
|
||||
tscInfo("Invalid locale:%s, use default", pStr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -227,11 +227,11 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
char *locale = setlocale(LC_CTYPE, pStr);
|
||||
|
||||
if (locale != NULL) {
|
||||
tscPrint("locale set, prev locale:%s, new locale:%s", tsLocale, locale);
|
||||
tscInfo("locale set, prev locale:%s, new locale:%s", tsLocale, locale);
|
||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||
} else { // set the user-specified localed failed, use default LC_CTYPE as current locale
|
||||
locale = setlocale(LC_CTYPE, tsLocale);
|
||||
tscPrint("failed to set locale:%s, current locale:%s", pStr, tsLocale);
|
||||
tscInfo("failed to set locale:%s, current locale:%s", pStr, tsLocale);
|
||||
}
|
||||
|
||||
tstrncpy(tsLocale, locale, sizeof(tsLocale));
|
||||
|
@ -244,21 +244,21 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
|
||||
if (taosValidateEncodec(charset)) {
|
||||
if (strlen(tsCharset) == 0) {
|
||||
tscPrint("charset set:%s", charset);
|
||||
tscInfo("charset set:%s", charset);
|
||||
} else {
|
||||
tscPrint("charset changed from %s to %s", tsCharset, charset);
|
||||
tscInfo("charset changed from %s to %s", tsCharset, charset);
|
||||
}
|
||||
|
||||
tstrncpy(tsCharset, charset, sizeof(tsCharset));
|
||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||
|
||||
} else {
|
||||
tscPrint("charset:%s is not valid in locale, charset remains:%s", charset, tsCharset);
|
||||
tscInfo("charset:%s is not valid in locale, charset remains:%s", charset, tsCharset);
|
||||
}
|
||||
|
||||
free(charset);
|
||||
} else { // it may be windows system
|
||||
tscPrint("charset remains:%s", tsCharset);
|
||||
tscInfo("charset remains:%s", tsCharset);
|
||||
}
|
||||
} else {
|
||||
tscWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, pStr,
|
||||
|
@ -274,22 +274,22 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
|
||||
size_t len = strlen(pStr);
|
||||
if (len == 0 || len > TSDB_LOCALE_LEN) {
|
||||
tscPrint("failed to set charset:%s", pStr);
|
||||
tscInfo("failed to set charset:%s", pStr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_OPTION) {
|
||||
if (taosValidateEncodec(pStr)) {
|
||||
if (strlen(tsCharset) == 0) {
|
||||
tscPrint("charset is set:%s", pStr);
|
||||
tscInfo("charset is set:%s", pStr);
|
||||
} else {
|
||||
tscPrint("charset changed from %s to %s", tsCharset, pStr);
|
||||
tscInfo("charset changed from %s to %s", tsCharset, pStr);
|
||||
}
|
||||
|
||||
tstrncpy(tsCharset, pStr, sizeof(tsCharset));
|
||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||
} else {
|
||||
tscPrint("charset:%s not valid", pStr);
|
||||
tscInfo("charset:%s not valid", pStr);
|
||||
}
|
||||
} else {
|
||||
tscWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, pStr,
|
||||
|
@ -307,7 +307,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
|
|||
tstrncpy(tsTimezone, pStr, sizeof(tsTimezone));
|
||||
tsSetTimeZone();
|
||||
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
|
||||
tscTrace("timezone set:%s, input:%s by taos_options", tsTimezone, pStr);
|
||||
tscDebug("timezone set:%s, input:%s by taos_options", tsTimezone, pStr);
|
||||
} else {
|
||||
tscWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, pStr,
|
||||
tsCfgStatusStr[cfg->cfgStatus], (char *)cfg->ptr);
|
||||
|
@ -328,7 +328,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
|
|||
|
||||
for (int i = 1; atomic_val_compare_exchange_32(&lock, 0, 1) != 0; ++i) {
|
||||
if (i % 1000 == 0) {
|
||||
tscPrint("haven't acquire lock after spin %d times.", i);
|
||||
tscInfo("haven't acquire lock after spin %d times.", i);
|
||||
sched_yield();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -374,7 +374,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
|
|||
return;
|
||||
}
|
||||
|
||||
tscTrace("%p start to free sql object", pSql);
|
||||
tscDebug("%p start to free sql object", pSql);
|
||||
tscPartiallyFreeSqlObj(pSql);
|
||||
|
||||
pSql->signature = NULL;
|
||||
|
@ -656,7 +656,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SArray* pTableDataBlockList) {
|
|||
tscSortRemoveDataBlockDupRows(pOneTableBlock);
|
||||
char* ekey = (char*)pBlocks->data + pOneTableBlock->rowSize*(pBlocks->numOfRows-1);
|
||||
|
||||
tscTrace("%p tableId:%s, sid:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, pSql, pOneTableBlock->tableId,
|
||||
tscDebug("%p tableId:%s, sid:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, pSql, pOneTableBlock->tableId,
|
||||
pBlocks->tid, pBlocks->numOfRows, pBlocks->sversion, GET_INT64_VAL(pBlocks->data), GET_INT64_VAL(ekey));
|
||||
|
||||
|
||||
|
@ -702,7 +702,7 @@ void tscCloseTscObj(STscObj* pObj) {
|
|||
rpcClose(pObj->pDnodeConn);
|
||||
}
|
||||
|
||||
tscTrace("%p DB connection is closed, dnodeConn:%p", pObj, pObj->pDnodeConn);
|
||||
tscDebug("%p DB connection is closed, dnodeConn:%p", pObj, pObj->pDnodeConn);
|
||||
tfree(pObj);
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1562,7 @@ void tscClearSubqueryInfo(SSqlCmd* pCmd) {
|
|||
}
|
||||
|
||||
void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool removeFromCache) {
|
||||
tscTrace("%p deref the table meta in cache, numOfTables:%d", address, pQueryInfo->numOfTables);
|
||||
tscDebug("%p deref the table meta in cache, numOfTables:%d", address, pQueryInfo->numOfTables);
|
||||
|
||||
for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
|
||||
|
@ -1844,7 +1844,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
|
|||
if (cmd == TSDB_SQL_SELECT) {
|
||||
size_t size = taosArrayGetSize(pNewQueryInfo->colList);
|
||||
|
||||
tscTrace(
|
||||
tscDebug(
|
||||
"%p new subquery:%p, tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%zu, colList:%zu,"
|
||||
"fieldInfo:%d, name:%s, qrang:%" PRId64 " - %" PRId64 " order:%d, limit:%" PRId64,
|
||||
pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo),
|
||||
|
@ -1853,7 +1853,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
|
|||
|
||||
tscPrintSelectClause(pNew, 0);
|
||||
} else {
|
||||
tscTrace("%p new sub insertion: %p, vnodeIdx:%d", pSql, pNew, pTableMetaInfo->vgroupIndex);
|
||||
tscDebug("%p new sub insertion: %p, vnodeIdx:%d", pSql, pNew, pTableMetaInfo->vgroupIndex);
|
||||
}
|
||||
|
||||
return pNew;
|
||||
|
@ -1880,7 +1880,7 @@ void tscDoQuery(SSqlObj* pSql) {
|
|||
}
|
||||
|
||||
if (pCmd->dataSourceType == DATA_FROM_DATA_FILE) {
|
||||
tscProcessMultiVnodesInsertFromFile(pSql);
|
||||
tscProcessMultiVnodesImportFromFile(pSql);
|
||||
} else {
|
||||
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
|
||||
uint16_t type = pQueryInfo->type;
|
||||
|
@ -2012,7 +2012,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
|
||||
int32_t totalVgroups = pTableMetaInfo->vgroupList->numOfVgroups;
|
||||
while (++pTableMetaInfo->vgroupIndex < totalVgroups) {
|
||||
tscTrace("%p results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%" PRId64, pSql,
|
||||
tscDebug("%p results from vgroup index:%d completed, try next:%d. total vgroups:%d. current numOfRes:%" PRId64, pSql,
|
||||
pTableMetaInfo->vgroupIndex - 1, pTableMetaInfo->vgroupIndex, totalVgroups, pRes->numOfClauseTotal);
|
||||
|
||||
/*
|
||||
|
@ -2031,7 +2031,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
|
|||
pQueryInfo->limit.offset = pRes->offset;
|
||||
assert((pRes->offset >= 0 && pRes->numOfRows == 0) || (pRes->offset == 0 && pRes->numOfRows >= 0));
|
||||
|
||||
tscTrace("%p new query to next vgroup, index:%d, limit:%" PRId64 ", offset:%" PRId64 ", glimit:%" PRId64,
|
||||
tscDebug("%p new query to next vgroup, index:%d, limit:%" PRId64 ", offset:%" PRId64 ", glimit:%" PRId64,
|
||||
pSql, pTableMetaInfo->vgroupIndex, pQueryInfo->limit.limit, pQueryInfo->limit.offset, pQueryInfo->clauseLimit);
|
||||
|
||||
/*
|
||||
|
@ -2081,7 +2081,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, void (*queryFp)()) {
|
|||
assert(queryFp != NULL);
|
||||
}
|
||||
|
||||
tscTrace("%p try data in the next subclause:%d, total subclause:%d", pSql, pCmd->clauseIndex, pCmd->numOfClause);
|
||||
tscDebug("%p try data in the next subclause:%d, total subclause:%d", pSql, pCmd->clauseIndex, pCmd->numOfClause);
|
||||
if (pCmd->command > TSDB_SQL_LOCAL) {
|
||||
tscProcessLocalCmd(pSql);
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
PROJECT(TDengine)
|
||||
|
||||
FIND_PATH(HEADER_GTEST_INCLUDE_DIR gtest.h /usr/include/gtest /usr/local/include/gtest)
|
||||
FIND_LIBRARY(LIB_GTEST_STATIC_DIR libgtest.a /usr/lib/ /usr/local/lib)
|
||||
|
||||
IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR)
|
||||
MESSAGE(STATUS "gTest library found, build unit test")
|
||||
|
||||
INCLUDE_DIRECTORIES(${HEADER_GTEST_INCLUDE_DIR})
|
||||
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
||||
|
||||
ADD_EXECUTABLE(cliTest ${SOURCE_LIST})
|
||||
TARGET_LINK_LIBRARIES(cliTest taos tutil common gtest pthread)
|
||||
ENDIF()
|
|
@ -158,9 +158,10 @@ extern int32_t mqttDebugFlag;
|
|||
extern int32_t monitorDebugFlag;
|
||||
extern int32_t uDebugFlag;
|
||||
extern int32_t rpcDebugFlag;
|
||||
extern int32_t debugFlag;
|
||||
extern int32_t odbcDebugFlag;
|
||||
extern int32_t qDebugFlag;
|
||||
extern int32_t wDebugFlag;
|
||||
extern int32_t debugFlag;
|
||||
|
||||
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||
|
||||
|
|
|
@ -25,15 +25,18 @@ extern "C" {
|
|||
extern int32_t uDebugFlag;
|
||||
extern int32_t tscEmbedded;
|
||||
|
||||
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR UTL ", uDebugFlag, __VA_ARGS__); }}
|
||||
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("WARN UTL ", uDebugFlag, __VA_ARGS__); }}
|
||||
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
|
||||
#define uDump(x, y) { if (uDebugFlag & DEBUG_DUMP) { taosDumpData(x, y); }}
|
||||
#define uPrint(...) { taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
|
||||
#define uForcePrint(...) { taosPrintLog("ERROR UTL ", 255, __VA_ARGS__); }
|
||||
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL INFO ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL DEBUG ", uDebugFlag, __VA_ARGS__); }}
|
||||
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL TRACE ", uDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define pError(...) { taosPrintLog("ERROR APP ", 255, __VA_ARGS__); }
|
||||
#define pPrint(...) { taosPrintLog("APP ", 255, __VA_ARGS__); }
|
||||
#define uDebugDump(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLongString("UTL DEBUG ", uDebugFlag, __VA_ARGS__); }}
|
||||
#define uTraceDump(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLongString("UTL TRACE ", uDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define pError(...) { taosPrintLog("APP ERROR ", 255, __VA_ARGS__); }
|
||||
#define pPrint(...) { taosPrintLog("APP INFO ", 255, __VA_ARGS__); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -182,19 +182,20 @@ int32_t tsNumOfLogLines = 10000000;
|
|||
int32_t mDebugFlag = 135;
|
||||
int32_t sdbDebugFlag = 135;
|
||||
int32_t dDebugFlag = 135;
|
||||
int32_t vDebugFlag = 135;
|
||||
int32_t cDebugFlag = 135;
|
||||
int32_t vDebugFlag = 131;
|
||||
int32_t cDebugFlag = 131;
|
||||
int32_t jniDebugFlag = 131;
|
||||
int32_t odbcDebugFlag = 131;
|
||||
int32_t httpDebugFlag = 131;
|
||||
int32_t mqttDebugFlag = 131;
|
||||
int32_t monitorDebugFlag = 131;
|
||||
int32_t qDebugFlag = 131;
|
||||
int32_t rpcDebugFlag = 135;
|
||||
int32_t rpcDebugFlag = 131;
|
||||
int32_t uDebugFlag = 131;
|
||||
int32_t debugFlag = 131;
|
||||
int32_t sDebugFlag = 135;
|
||||
int32_t tsdbDebugFlag = 135;
|
||||
int32_t wDebugFlag = 135;
|
||||
int32_t tsdbDebugFlag = 131;
|
||||
|
||||
static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT;
|
||||
|
||||
|
@ -213,10 +214,11 @@ void taosSetAllDebugFlag() {
|
|||
rpcDebugFlag = debugFlag;
|
||||
uDebugFlag = debugFlag;
|
||||
sDebugFlag = debugFlag;
|
||||
wDebugFlag = debugFlag;
|
||||
tsdbDebugFlag = debugFlag;
|
||||
qDebugFlag = debugFlag;
|
||||
}
|
||||
uPrint("all debug flag are set to %d", debugFlag);
|
||||
uInfo("all debug flag are set to %d", debugFlag);
|
||||
}
|
||||
|
||||
bool taosCfgDynamicOptions(char *msg) {
|
||||
|
@ -234,7 +236,7 @@ bool taosCfgDynamicOptions(char *msg) {
|
|||
vint = atoi(value);
|
||||
}
|
||||
|
||||
uPrint("change dynamic option: %s, value: %d", option, vint);
|
||||
uInfo("change dynamic option: %s, value: %d", option, vint);
|
||||
|
||||
for (int32_t i = 0; i < tsGlobalConfigNum; ++i) {
|
||||
SGlobalCfg *cfg = tsGlobalConfig + i;
|
||||
|
@ -977,6 +979,17 @@ static void doInitGlobalConfig() {
|
|||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "wDebugFlag";
|
||||
cfg.ptr = &wDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 255;
|
||||
cfg.ptrLength = 0;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
|
||||
cfg.option = "sdbDebugFlag";
|
||||
cfg.ptr = &sdbDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
|
@ -1067,7 +1080,6 @@ static void doInitGlobalConfig() {
|
|||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
|
||||
cfg.option = "monitorDebugFlag";
|
||||
cfg.ptr = &monitorDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
|
@ -1088,6 +1100,16 @@ static void doInitGlobalConfig() {
|
|||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "vDebugFlag";
|
||||
cfg.ptr = &vDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 255;
|
||||
cfg.ptrLength = 0;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "tsdbDebugFlag";
|
||||
cfg.ptr = &tsdbDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
|
@ -1175,7 +1197,7 @@ void taosInitGlobalCfg() {
|
|||
}
|
||||
|
||||
bool taosCheckGlobalCfg() {
|
||||
if (debugFlag == 135 || debugFlag == 199) {
|
||||
if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG) {
|
||||
taosSetAllDebugFlag();
|
||||
}
|
||||
|
||||
|
@ -1184,7 +1206,7 @@ bool taosCheckGlobalCfg() {
|
|||
}
|
||||
|
||||
snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%d", tsLocalFqdn, tsServerPort);
|
||||
uPrint("localEp is: %s", tsLocalEp);
|
||||
uInfo("localEp is: %s", tsLocalEp);
|
||||
|
||||
if (tsFirst[0] == 0) {
|
||||
strcpy(tsFirst, tsLocalEp);
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
#include "tconfig.h"
|
||||
#include "tutil.h"
|
||||
|
||||
// TODO refactor to set the tz value through parameter
|
||||
void tsSetTimeZone() {
|
||||
SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone");
|
||||
uPrint("timezone is set to %s by %s", tsTimezone, tsCfgStatusStr[cfg_timezone->cfgStatus]);
|
||||
uInfo("timezone is set to %s by %s", tsTimezone, tsCfgStatusStr[cfg_timezone->cfgStatus]);
|
||||
|
||||
#ifdef WINDOWS
|
||||
char winStr[TSDB_LOCALE_LEN * 2];
|
||||
|
@ -60,5 +61,5 @@ void tsSetTimeZone() {
|
|||
sprintf(tsTimezone, "(%s, %s%02d00)", tzname[daylight], tz >= 0 ? "+" : "-", abs(tz));
|
||||
tsDaylight = daylight;
|
||||
|
||||
uPrint("timezone format changed to %s", tsTimezone);
|
||||
uInfo("timezone format changed to %s", tsTimezone);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "TDengine",
|
||||
"private": false,
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"description": "grafana datasource plugin for tdengine",
|
||||
"scripts": {
|
||||
"build": "./node_modules/grunt-cli/bin/grunt",
|
||||
|
|
|
@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED)
|
|||
ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME}
|
||||
POST_BUILD
|
||||
COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-1.0.3-dist.jar ${LIBRARY_OUTPUT_PATH}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.0-dist.jar ${LIBRARY_OUTPUT_PATH}
|
||||
COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
|
||||
COMMENT "build jdbc driver")
|
||||
ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME})
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
ulimit -c unlimited
|
||||
|
||||
function buildTDengine {
|
||||
cd /root/TDengine
|
||||
|
||||
git remote update
|
||||
REMOTE_COMMIT=`git rev-parse --short remotes/origin/develop`
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
|
||||
echo " LOCAL: $LOCAL_COMMIT"
|
||||
echo "REMOTE: $REMOTE_COMMIT"
|
||||
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
|
||||
echo "repo up-to-date"
|
||||
else
|
||||
echo "repo need to pull"
|
||||
git pull
|
||||
|
||||
LOCAL_COMMIT=`git rev-parse --short @`
|
||||
cd /root/TDengine/debug
|
||||
rm -rf /root/TDengine/debug/*
|
||||
cmake ..
|
||||
make > /dev/null
|
||||
make install
|
||||
fi
|
||||
}
|
||||
|
||||
function restartTaosd {
|
||||
systemctl stop taosd
|
||||
pkill -KILL -x taosd
|
||||
sleep 10
|
||||
|
||||
logDir=`grep 'logDir' /etc/taos/taos.cfg|awk 'END{print $2}'`
|
||||
dataDir=`grep 'dataDir' /etc/taos/taos.cfg|awk '{print $2}'`
|
||||
|
||||
rm -rf $logDir/*
|
||||
rm -rf $dataDir/*
|
||||
|
||||
taosd 2>&1 > /dev/null &
|
||||
sleep 10
|
||||
}
|
||||
|
||||
buildTDengine
|
||||
restartTaosd
|
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>2.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>JDBCDriver</name>
|
||||
<url>https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc</url>
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Properties;
|
|||
|
||||
public class TestAsyncTSDBSubscribe {
|
||||
public static void main(String[] args) throws SQLException {
|
||||
String usage = "java -cp taos-jdbcdriver-1.0.3_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName -topic topicName " +
|
||||
String usage = "java -cp taos-jdbcdriver-2.0.0_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName -topic topicName " +
|
||||
"-tname tableName -h host";
|
||||
if (args.length < 2) {
|
||||
System.err.println(usage);
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Properties;
|
|||
|
||||
public class TestTSDBSubscribe {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String usage = "java -cp taos-jdbcdriver-1.0.3_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName " +
|
||||
String usage = "java -cp taos-jdbcdriver-2.0.0_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName " +
|
||||
"-topic topicName -tname tableName -h host";
|
||||
if (args.length < 2) {
|
||||
System.err.println(usage);
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Properties;
|
|||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class AsyncSubscribeTest {
|
||||
public class AsyncSubscribeTest extends BaseTest {
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
String dbName = "test";
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.taosdata.jdbc;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class BaseTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupEnv() {
|
||||
try{
|
||||
String path = System.getProperty("user.dir");
|
||||
String bashPath = path + "/buildTDengine.sh";
|
||||
|
||||
Process ps = Runtime.getRuntime().exec(bashPath);
|
||||
ps.waitFor();
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
|
||||
while(br.readLine() != null) {
|
||||
System.out.println(br.readLine());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ import java.util.Properties;
|
|||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ConnectionTest {
|
||||
public class ConnectionTest extends BaseTest {
|
||||
static Connection connection = null;
|
||||
static Statement statement = null;
|
||||
static String dbName = "test";
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.junit.Test;
|
|||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class DatabaseMetaDataTest {
|
||||
public class DatabaseMetaDataTest extends BaseTest {
|
||||
static Connection connection = null;
|
||||
static PreparedStatement statement = null;
|
||||
static String dbName = "test";
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Properties;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ImportTest {
|
||||
public class ImportTest extends BaseTest {
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
String dbName = "test";
|
||||
|
|
|
@ -13,7 +13,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@FixMethodOrder(MethodSorters.DEFAULT)
|
||||
public class PreparedStatementTest {
|
||||
public class PreparedStatementTest extends BaseTest {
|
||||
static Connection connection = null;
|
||||
static PreparedStatement statement = null;
|
||||
static String dbName = "test";
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.Properties;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ResultSetTest {
|
||||
public class ResultSetTest extends BaseTest {
|
||||
static Connection connection = null;
|
||||
static Statement statement = null;
|
||||
static String dbName = "test";
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Properties;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class SelectTest {
|
||||
public class SelectTest extends BaseTest {
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
String dbName = "test";
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Properties;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class StableTest {
|
||||
public class StableTest extends BaseTest {
|
||||
static Connection connection = null;
|
||||
static Statement statement = null;
|
||||
static String dbName = "test";
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Properties;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class StatementTest {
|
||||
public class StatementTest extends BaseTest {
|
||||
static Connection connection = null;
|
||||
static Statement statement = null;
|
||||
static String dbName = "test";
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Properties;
|
|||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SubscribeTest {
|
||||
public class SubscribeTest extends BaseTest {
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
String dbName = "test";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "td-connector",
|
||||
"version": "1.6.1",
|
||||
"version": "2.0.0",
|
||||
"description": "A Node.js connector for TDengine.",
|
||||
"main": "tdengine.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||
|
||||
setuptools.setup(
|
||||
name="taos",
|
||||
version="1.4.15",
|
||||
version="2.0.0",
|
||||
author="Taosdata Inc.",
|
||||
author_email="support@taosdata.com",
|
||||
description="TDengine python client package",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: taos
|
||||
Version: 1.4.15
|
||||
Version: 2.0.0
|
||||
Summary: TDengine python client package
|
||||
Home-page: https://github.com/pypa/sampleproject
|
||||
Author: Taosdata Inc.
|
||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||
|
||||
setuptools.setup(
|
||||
name="taos",
|
||||
version="1.4.15",
|
||||
version="2.0.0",
|
||||
author="Taosdata Inc.",
|
||||
author_email="support@taosdata.com",
|
||||
description="TDengine python client package",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: taos
|
||||
Version: 1.4.15
|
||||
Version: 2.0.0
|
||||
Summary: TDengine python client package
|
||||
Home-page: https://github.com/pypa/sampleproject
|
||||
Author: Taosdata Inc.
|
||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||
|
||||
setuptools.setup(
|
||||
name="taos",
|
||||
version="1.4.15",
|
||||
version="2.0.0",
|
||||
author="Taosdata Inc.",
|
||||
author_email="support@taosdata.com",
|
||||
description="TDengine python client package",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: taos
|
||||
Version: 1.4.15
|
||||
Version: 2.0.0
|
||||
Summary: TDengine python client package
|
||||
Home-page: https://github.com/pypa/sampleproject
|
||||
Author: Taosdata Inc.
|
||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||
|
||||
setuptools.setup(
|
||||
name="taos",
|
||||
version="1.4.15",
|
||||
version="2.0.0",
|
||||
author="Taosdata Inc.",
|
||||
author_email="support@taosdata.com",
|
||||
description="TDengine python client package",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 2.1
|
||||
Name: taos
|
||||
Version: 1.4.15
|
||||
Version: 2.0.0
|
||||
Summary: TDengine python client package
|
||||
Home-page: https://github.com/pypa/sampleproject
|
||||
Author: Hongze Cheng
|
||||
|
|
|
@ -24,10 +24,12 @@ extern "C" {
|
|||
|
||||
extern int32_t dDebugFlag;
|
||||
|
||||
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR DND ", 255, __VA_ARGS__); }}
|
||||
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("WARN DND ", dDebugFlag, __VA_ARGS__); }}
|
||||
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
|
||||
#define dPrint(...) { taosPrintLog("DND ", 255, __VA_ARGS__); }
|
||||
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); }}
|
||||
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); }}
|
||||
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", 255, __VA_ARGS__); }}
|
||||
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND INFO ", 255, __VA_ARGS__); }}
|
||||
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND DEBUG ", dDebugFlag, __VA_ARGS__); }}
|
||||
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND TRACE ", dDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ int32_t dnodeInitMnodePeer() {
|
|||
pWorker->workerId = i;
|
||||
}
|
||||
|
||||
dPrint("dnode mpeer is opened");
|
||||
dInfo("dnode mpeer is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,9 @@ void dnodeCleanupMnodePeer() {
|
|||
}
|
||||
}
|
||||
|
||||
dPrint("dnode mpeer is closed");
|
||||
taosCloseQset(tsMPeerQset);
|
||||
tfree(tsMPeerPool.peerWorker);
|
||||
dInfo("dnode mpeer is closed");
|
||||
}
|
||||
|
||||
int32_t dnodeAllocateMnodePqueue() {
|
||||
|
@ -96,10 +98,10 @@ int32_t dnodeAllocateMnodePqueue() {
|
|||
}
|
||||
|
||||
pthread_attr_destroy(&thAttr);
|
||||
dTrace("dnode mpeer worker:%d is launched, total:%d", pWorker->workerId, tsMPeerPool.num);
|
||||
dDebug("dnode mpeer worker:%d is launched, total:%d", pWorker->workerId, tsMPeerPool.num);
|
||||
}
|
||||
|
||||
dTrace("dnode mpeer queue:%p is allocated", tsMPeerQueue);
|
||||
dDebug("dnode mpeer queue:%p is allocated", tsMPeerQueue);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -145,11 +147,11 @@ static void *dnodeProcessMnodePeerQueue(void *param) {
|
|||
|
||||
while (1) {
|
||||
if (taosReadQitemFromQset(tsMPeerQset, &type, (void **)&pPeerMsg, &unUsed) == 0) {
|
||||
dTrace("dnodeProcessMnodePeerQueue: got no message from qset, exiting...");
|
||||
dDebug("dnodeProcessMnodePeerQueue: got no message from qset, exiting...");
|
||||
break;
|
||||
}
|
||||
|
||||
dTrace("msg:%s will be processed in mpeer queue", taosMsg[pPeerMsg->rpcMsg.msgType]);
|
||||
dDebug("msg:%s will be processed in mpeer queue", taosMsg[pPeerMsg->rpcMsg.msgType]);
|
||||
int32_t code = mnodeProcessPeerReq(pPeerMsg);
|
||||
dnodeSendRpcMnodePeerRsp(pPeerMsg, code);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ int32_t dnodeInitMnodeRead() {
|
|||
pWorker->workerId = i;
|
||||
}
|
||||
|
||||
dPrint("dnode mread is opened");
|
||||
dInfo("dnode mread is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ void dnodeCleanupMnodeRead() {
|
|||
taosCloseQset(tsMReadQset);
|
||||
free(tsMReadPool.readWorker);
|
||||
|
||||
dPrint("dnode mread is closed");
|
||||
dInfo("dnode mread is closed");
|
||||
}
|
||||
|
||||
int32_t dnodeAllocateMnodeRqueue() {
|
||||
|
@ -101,10 +101,10 @@ int32_t dnodeAllocateMnodeRqueue() {
|
|||
}
|
||||
|
||||
pthread_attr_destroy(&thAttr);
|
||||
dTrace("dnode mread worker:%d is launched, total:%d", pWorker->workerId, tsMReadPool.num);
|
||||
dDebug("dnode mread worker:%d is launched, total:%d", pWorker->workerId, tsMReadPool.num);
|
||||
}
|
||||
|
||||
dTrace("dnode mread queue:%p is allocated", tsMReadQueue);
|
||||
dDebug("dnode mread queue:%p is allocated", tsMReadQueue);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -155,11 +155,11 @@ static void *dnodeProcessMnodeReadQueue(void *param) {
|
|||
|
||||
while (1) {
|
||||
if (taosReadQitemFromQset(tsMReadQset, &type, (void **)&pReadMsg, &unUsed) == 0) {
|
||||
dTrace("dnodeProcessMnodeReadQueue: got no message from qset, exiting...");
|
||||
dDebug("dnodeProcessMnodeReadQueue: got no message from qset, exiting...");
|
||||
break;
|
||||
}
|
||||
|
||||
dTrace("%p, msg:%s will be processed in mread queue", pReadMsg->rpcMsg.ahandle, taosMsg[pReadMsg->rpcMsg.msgType]);
|
||||
dDebug("%p, msg:%s will be processed in mread queue", pReadMsg->rpcMsg.ahandle, taosMsg[pReadMsg->rpcMsg.msgType]);
|
||||
int32_t code = mnodeProcessRead(pReadMsg);
|
||||
dnodeSendRpcMnodeReadRsp(pReadMsg, code);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ int32_t dnodeInitMnodeWrite() {
|
|||
pWorker->workerId = i;
|
||||
}
|
||||
|
||||
dPrint("dnode mwrite is opened");
|
||||
dInfo("dnode mwrite is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,9 @@ void dnodeCleanupMnodeWrite() {
|
|||
}
|
||||
}
|
||||
|
||||
dPrint("dnode mwrite is closed");
|
||||
taosCloseQset(tsMWriteQset);
|
||||
tfree(tsMWritePool.writeWorker);
|
||||
dInfo("dnode mwrite is closed");
|
||||
}
|
||||
|
||||
int32_t dnodeAllocateMnodeWqueue() {
|
||||
|
@ -98,10 +100,10 @@ int32_t dnodeAllocateMnodeWqueue() {
|
|||
}
|
||||
|
||||
pthread_attr_destroy(&thAttr);
|
||||
dTrace("dnode mwrite worker:%d is launched, total:%d", pWorker->workerId, tsMWritePool.num);
|
||||
dDebug("dnode mwrite worker:%d is launched, total:%d", pWorker->workerId, tsMWritePool.num);
|
||||
}
|
||||
|
||||
dTrace("dnode mwrite queue:%p is allocated", tsMWriteQueue);
|
||||
dDebug("dnode mwrite queue:%p is allocated", tsMWriteQueue);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -119,7 +121,7 @@ void dnodeDispatchToMnodeWriteQueue(SRpcMsg *pMsg) {
|
|||
SMnodeMsg *pWrite = (SMnodeMsg *)taosAllocateQitem(sizeof(SMnodeMsg));
|
||||
mnodeCreateMsg(pWrite, pMsg);
|
||||
|
||||
dTrace("app:%p:%p, msg:%s is put into mwrite queue", pWrite->rpcMsg.ahandle, pWrite, taosMsg[pWrite->rpcMsg.msgType]);
|
||||
dDebug("app:%p:%p, msg:%s is put into mwrite queue", pWrite->rpcMsg.ahandle, pWrite, taosMsg[pWrite->rpcMsg.msgType]);
|
||||
taosWriteQitem(tsMWriteQueue, TAOS_QTYPE_RPC, pWrite);
|
||||
}
|
||||
|
||||
|
@ -155,11 +157,11 @@ static void *dnodeProcessMnodeWriteQueue(void *param) {
|
|||
|
||||
while (1) {
|
||||
if (taosReadQitemFromQset(tsMWriteQset, &type, (void **)&pWrite, &unUsed) == 0) {
|
||||
dTrace("dnodeProcessMnodeWriteQueue: got no message from qset, exiting...");
|
||||
dDebug("dnodeProcessMnodeWriteQueue: got no message from qset, exiting...");
|
||||
break;
|
||||
}
|
||||
|
||||
dTrace("app:%p:%p, msg:%s will be processed in mwrite queue", pWrite->rpcMsg.ahandle, pWrite,
|
||||
dDebug("app:%p:%p, msg:%s will be processed in mwrite queue", pWrite->rpcMsg.ahandle, pWrite,
|
||||
taosMsg[pWrite->rpcMsg.msgType]);
|
||||
|
||||
int32_t code = mnodeProcessWrite(pWrite);
|
||||
|
@ -173,13 +175,13 @@ void dnodeReprocessMnodeWriteMsg(void *pMsg) {
|
|||
SMnodeMsg *pWrite = pMsg;
|
||||
|
||||
if (!mnodeIsRunning() || tsMWriteQueue == NULL) {
|
||||
dTrace("app:%p:%p, msg:%s is redirected for mnode not running, retry times:%d", pWrite->rpcMsg.ahandle, pWrite,
|
||||
dDebug("app:%p:%p, msg:%s is redirected for mnode not running, retry times:%d", pWrite->rpcMsg.ahandle, pWrite,
|
||||
taosMsg[pWrite->rpcMsg.msgType], pWrite->retry);
|
||||
|
||||
dnodeSendRedirectMsg(pMsg, true);
|
||||
dnodeFreeMnodeWriteMsg(pWrite);
|
||||
} else {
|
||||
dTrace("app:%p:%p, msg:%s is reput into mwrite queue, retry times:%d", pWrite->rpcMsg.ahandle, pWrite,
|
||||
dDebug("app:%p:%p, msg:%s is reput into mwrite queue, retry times:%d", pWrite->rpcMsg.ahandle, pWrite,
|
||||
taosMsg[pWrite->rpcMsg.msgType], pWrite->retry);
|
||||
|
||||
taosWriteQitem(tsMWriteQueue, TAOS_QTYPE_RPC, pWrite);
|
||||
|
|
|
@ -114,7 +114,7 @@ int32_t dnodeInitSystem() {
|
|||
}
|
||||
taosPrintGlobalCfg();
|
||||
|
||||
dPrint("start to initialize TDengine on %s", tsLocalEp);
|
||||
dInfo("start to initialize TDengine on %s", tsLocalEp);
|
||||
|
||||
if (dnodeInitComponents() != 0) {
|
||||
return -1;
|
||||
|
@ -124,7 +124,7 @@ int32_t dnodeInitSystem() {
|
|||
dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_RUNING);
|
||||
dnodeStartStream();
|
||||
|
||||
dPrint("TDengine is initialized successfully");
|
||||
dInfo("TDengine is initialized successfully");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ static int32_t dnodeInitStorage() {
|
|||
|
||||
dnodeCheckDataDirOpenned(tsDnodeDir);
|
||||
|
||||
dPrint("storage directory is initialized");
|
||||
dInfo("storage directory is initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ int32_t dnodeInitMgmt() {
|
|||
|
||||
taosTmrReset(dnodeSendStatusMsg, 500, NULL, tsDnodeTmr, &tsStatusTimer);
|
||||
|
||||
dPrint("dnode mgmt is initialized");
|
||||
dInfo("dnode mgmt is initialized");
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -196,11 +196,11 @@ static void *dnodeProcessMgmtQueue(void *param) {
|
|||
|
||||
while (1) {
|
||||
if (taosReadQitemFromQset(tsMgmtQset, &type, (void **) &pMsg, &handle) == 0) {
|
||||
dTrace("dnode mgmt got no message from qset, exit ...");
|
||||
dDebug("dnode mgmt got no message from qset, exit ...");
|
||||
break;
|
||||
}
|
||||
|
||||
dTrace("%p, msg:%s will be processed", pMsg->ahandle, taosMsg[pMsg->msgType]);
|
||||
dDebug("%p, msg:%s will be processed", pMsg->ahandle, taosMsg[pMsg->msgType]);
|
||||
if (dnodeProcessMgmtMsgFp[pMsg->msgType]) {
|
||||
rsp.code = (*dnodeProcessMgmtMsgFp[pMsg->msgType])(pMsg);
|
||||
} else {
|
||||
|
@ -252,7 +252,7 @@ static int32_t dnodeOpenVnodes() {
|
|||
status = dnodeGetVnodeList(vnodeList, &numOfVnodes);
|
||||
|
||||
if (status != TSDB_CODE_SUCCESS) {
|
||||
dPrint("Get dnode list failed");
|
||||
dInfo("Get dnode list failed");
|
||||
free(vnodeList);
|
||||
return status;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ static int32_t dnodeOpenVnodes() {
|
|||
}
|
||||
|
||||
free(vnodeList);
|
||||
dPrint("there are total vnodes:%d, openned:%d failed:%d", numOfVnodes, numOfVnodes-failed, failed);
|
||||
dInfo("there are total vnodes:%d, openned:%d failed:%d", numOfVnodes, numOfVnodes-failed, failed);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ void dnodeStartStream() {
|
|||
int32_t status = dnodeGetVnodeList(vnodeList, &numOfVnodes);
|
||||
|
||||
if (status != TSDB_CODE_SUCCESS) {
|
||||
dPrint("Get dnode list failed");
|
||||
dInfo("Get dnode list failed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ void dnodeStartStream() {
|
|||
vnodeStartStream(vnodeList[i]);
|
||||
}
|
||||
|
||||
dPrint("streams started");
|
||||
dInfo("streams started");
|
||||
}
|
||||
|
||||
static void dnodeCloseVnodes() {
|
||||
|
@ -292,7 +292,7 @@ static void dnodeCloseVnodes() {
|
|||
status = dnodeGetVnodeList(vnodeList, &numOfVnodes);
|
||||
|
||||
if (status != TSDB_CODE_SUCCESS) {
|
||||
dPrint("Get dnode list failed");
|
||||
dInfo("Get dnode list failed");
|
||||
free(vnodeList);
|
||||
return;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ static void dnodeCloseVnodes() {
|
|||
}
|
||||
|
||||
free(vnodeList);
|
||||
dPrint("total vnodes:%d are all closed", numOfVnodes);
|
||||
dInfo("total vnodes:%d are all closed", numOfVnodes);
|
||||
}
|
||||
|
||||
static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
|
||||
|
@ -360,10 +360,10 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
|
|||
}
|
||||
|
||||
void dnodeUpdateMnodeIpSetForPeer(SRpcIpSet *pIpSet) {
|
||||
dPrint("mnode IP list for is changed, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse);
|
||||
dInfo("mnode IP list for is changed, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse);
|
||||
for (int i = 0; i < pIpSet->numOfIps; ++i) {
|
||||
pIpSet->port[i] -= TSDB_PORT_DNODEDNODE;
|
||||
dPrint("mnode index:%d %s:%u", i, pIpSet->fqdn[i], pIpSet->port[i])
|
||||
dInfo("mnode index:%d %s:%u", i, pIpSet->fqdn[i], pIpSet->port[i])
|
||||
}
|
||||
|
||||
tsDMnodeIpSet = *pIpSet;
|
||||
|
@ -440,9 +440,9 @@ static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) {
|
|||
if (!dnodeCheckMnodeInfos(pMnodes)) return;
|
||||
|
||||
memcpy(&tsDMnodeInfos, pMnodes, sizeof(SDMMnodeInfos));
|
||||
dPrint("mnode infos is changed, nodeNum:%d inUse:%d", tsDMnodeInfos.nodeNum, tsDMnodeInfos.inUse);
|
||||
dInfo("mnode infos is changed, nodeNum:%d inUse:%d", tsDMnodeInfos.nodeNum, tsDMnodeInfos.inUse);
|
||||
for (int32_t i = 0; i < tsDMnodeInfos.nodeNum; i++) {
|
||||
dPrint("mnode index:%d, %s", tsDMnodeInfos.nodeInfos[i].nodeId, tsDMnodeInfos.nodeInfos[i].nodeEp);
|
||||
dInfo("mnode index:%d, %s", tsDMnodeInfos.nodeInfos[i].nodeId, tsDMnodeInfos.nodeInfos[i].nodeEp);
|
||||
}
|
||||
|
||||
tsDMnodeIpSet.inUse = tsDMnodeInfos.inUse;
|
||||
|
@ -461,7 +461,7 @@ static bool dnodeReadMnodeInfos() {
|
|||
sprintf(ipFile, "%s/mnodeIpList.json", tsDnodeDir);
|
||||
FILE *fp = fopen(ipFile, "r");
|
||||
if (!fp) {
|
||||
dTrace("failed to read mnodeIpList.json, file not exist");
|
||||
dDebug("failed to read mnodeIpList.json, file not exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -530,9 +530,9 @@ static bool dnodeReadMnodeInfos() {
|
|||
|
||||
ret = true;
|
||||
|
||||
dPrint("read mnode iplist successed, numOfIps:%d inUse:%d", tsDMnodeInfos.nodeNum, tsDMnodeInfos.inUse);
|
||||
dInfo("read mnode iplist successed, numOfIps:%d inUse:%d", tsDMnodeInfos.nodeNum, tsDMnodeInfos.inUse);
|
||||
for (int32_t i = 0; i < tsDMnodeInfos.nodeNum; i++) {
|
||||
dPrint("mnode:%d, %s", tsDMnodeInfos.nodeInfos[i].nodeId, tsDMnodeInfos.nodeInfos[i].nodeEp);
|
||||
dInfo("mnode:%d, %s", tsDMnodeInfos.nodeInfos[i].nodeId, tsDMnodeInfos.nodeInfos[i].nodeEp);
|
||||
}
|
||||
|
||||
PARSE_OVER:
|
||||
|
@ -572,7 +572,7 @@ static void dnodeSaveMnodeInfos() {
|
|||
fclose(fp);
|
||||
free(content);
|
||||
|
||||
dPrint("save mnode iplist successed");
|
||||
dInfo("save mnode iplist successed");
|
||||
}
|
||||
|
||||
char *dnodeGetMnodeMasterEp() {
|
||||
|
@ -645,7 +645,7 @@ static bool dnodeReadDnodeCfg() {
|
|||
|
||||
FILE *fp = fopen(dnodeCfgFile, "r");
|
||||
if (!fp) {
|
||||
dTrace("failed to read dnodeCfg.json, file not exist");
|
||||
dDebug("failed to read dnodeCfg.json, file not exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ static bool dnodeReadDnodeCfg() {
|
|||
|
||||
ret = true;
|
||||
|
||||
dPrint("read numOfVnodes successed, dnodeId:%d", tsDnodeCfg.dnodeId);
|
||||
dInfo("read numOfVnodes successed, dnodeId:%d", tsDnodeCfg.dnodeId);
|
||||
|
||||
PARSE_CFG_OVER:
|
||||
free(content);
|
||||
|
@ -705,12 +705,12 @@ static void dnodeSaveDnodeCfg() {
|
|||
fclose(fp);
|
||||
free(content);
|
||||
|
||||
dPrint("save dnodeId successed");
|
||||
dInfo("save dnodeId successed");
|
||||
}
|
||||
|
||||
void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg) {
|
||||
if (tsDnodeCfg.dnodeId == 0) {
|
||||
dPrint("dnodeId is set to %d", pCfg->dnodeId);
|
||||
dInfo("dnodeId is set to %d", pCfg->dnodeId);
|
||||
tsDnodeCfg.dnodeId = pCfg->dnodeId;
|
||||
dnodeSaveDnodeCfg();
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ int32_t dnodeGetDnodeId() {
|
|||
}
|
||||
|
||||
void dnodeSendRedirectMsg(SRpcMsg *rpcMsg, bool forShell) {
|
||||
SRpcConnInfo connInfo;
|
||||
SRpcConnInfo connInfo = {0};
|
||||
rpcGetConnInfo(rpcMsg->handle, &connInfo);
|
||||
|
||||
SRpcIpSet ipSet = {0};
|
||||
|
@ -731,11 +731,11 @@ void dnodeSendRedirectMsg(SRpcMsg *rpcMsg, bool forShell) {
|
|||
dnodeGetMnodeIpSetForPeer(&ipSet);
|
||||
}
|
||||
|
||||
dTrace("msg:%s will be redirected, dnodeIp:%s user:%s, numOfIps:%d inUse:%d", taosMsg[rpcMsg->msgType],
|
||||
dDebug("msg:%s will be redirected, dnodeIp:%s user:%s, numOfIps:%d inUse:%d", taosMsg[rpcMsg->msgType],
|
||||
taosIpStr(connInfo.clientIp), connInfo.user, ipSet.numOfIps, ipSet.inUse);
|
||||
|
||||
for (int i = 0; i < ipSet.numOfIps; ++i) {
|
||||
dTrace("mnode index:%d %s:%d", i, ipSet.fqdn[i], ipSet.port[i]);
|
||||
dDebug("mnode index:%d %s:%d", i, ipSet.fqdn[i], ipSet.port[i]);
|
||||
ipSet.port[i] = htons(ipSet.port[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,14 +127,14 @@ void dnodeProcessModuleStatus(uint32_t moduleStatus) {
|
|||
for (int32_t module = TSDB_MOD_MNODE; module < TSDB_MOD_HTTP; ++module) {
|
||||
bool enableModule = moduleStatus & (1 << module);
|
||||
if (!tsModule[module].enable && enableModule) {
|
||||
dPrint("module status:%u is received, start %s module", tsModuleStatus, tsModule[module].name);
|
||||
dInfo("module status:%u is received, start %s module", tsModuleStatus, tsModule[module].name);
|
||||
tsModule[module].enable = true;
|
||||
dnodeSetModuleStatus(module);
|
||||
(*tsModule[module].startFp)();
|
||||
}
|
||||
|
||||
if (tsModule[module].enable && !enableModule) {
|
||||
dPrint("module status:%u is received, stop %s module", tsModuleStatus, tsModule[module].name);
|
||||
dInfo("module status:%u is received, stop %s module", tsModuleStatus, tsModule[module].name);
|
||||
tsModule[module].enable = false;
|
||||
dnodeUnSetModuleStatus(module);
|
||||
(*tsModule[module].stopFp)();
|
||||
|
|
|
@ -70,7 +70,7 @@ int32_t dnodeInitServer() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
dPrint("inter-dnodes RPC server is opened");
|
||||
dInfo("inter-dnodes RPC server is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ void dnodeCleanupServer() {
|
|||
if (tsDnodeServerRpc) {
|
||||
rpcClose(tsDnodeServerRpc);
|
||||
tsDnodeServerRpc = NULL;
|
||||
dPrint("inter-dnodes RPC server is closed");
|
||||
dInfo("inter-dnodes RPC server is closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
|
|||
rspMsg.code = TSDB_CODE_RPC_NOT_READY;
|
||||
rpcSendResponse(&rspMsg);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
dTrace("RPC %p, msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]);
|
||||
dDebug("RPC %p, msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
|
|||
if (dnodeProcessReqMsgFp[pMsg->msgType]) {
|
||||
(*dnodeProcessReqMsgFp[pMsg->msgType])(pMsg);
|
||||
} else {
|
||||
dTrace("RPC %p, message:%s not processed", pMsg->handle, taosMsg[pMsg->msgType]);
|
||||
dDebug("RPC %p, message:%s not processed", pMsg->handle, taosMsg[pMsg->msgType]);
|
||||
rspMsg.code = TSDB_CODE_DND_MSG_NOT_PROCESSED;
|
||||
rpcSendResponse(&rspMsg);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
|
@ -135,7 +135,7 @@ int32_t dnodeInitClient() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
dPrint("inter-dnodes rpc client is opened");
|
||||
dInfo("inter-dnodes rpc client is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ void dnodeCleanupClient() {
|
|||
if (tsDnodeClientRpc) {
|
||||
rpcClose(tsDnodeClientRpc);
|
||||
tsDnodeClientRpc = NULL;
|
||||
dPrint("inter-dnodes rpc client is closed");
|
||||
dInfo("inter-dnodes rpc client is closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ int32_t dnodeInitShell() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
dPrint("shell rpc server is opened");
|
||||
dInfo("shell rpc server is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
|
|||
rpcMsg.contLen = sizeof(SDMAuthMsg);
|
||||
rpcMsg.msgType = TSDB_MSG_TYPE_DM_AUTH;
|
||||
|
||||
dTrace("user:%s, send auth msg to mnode", user);
|
||||
dDebug("user:%s, send auth msg to mnode", user);
|
||||
SRpcMsg rpcRsp = {0};
|
||||
dnodeSendMsgToDnodeRecv(&rpcMsg, &rpcRsp);
|
||||
|
||||
|
@ -162,7 +162,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
|
|||
dError("user:%s, auth msg received from mnode, error:%s", user, tstrerror(rpcRsp.code));
|
||||
} else {
|
||||
SDMAuthRsp *pRsp = rpcRsp.pCont;
|
||||
dTrace("user:%s, auth msg received from mnode", user);
|
||||
dDebug("user:%s, auth msg received from mnode", user);
|
||||
memcpy(secret, pRsp->secret, TSDB_KEY_LEN);
|
||||
memcpy(ckey, pRsp->ckey, TSDB_KEY_LEN);
|
||||
*spi = pRsp->spi;
|
||||
|
@ -174,7 +174,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
|
|||
}
|
||||
|
||||
void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
|
||||
dTrace("vgId:%d, sid:%d send config table msg to mnode", vgId, sid);
|
||||
dDebug("vgId:%d, sid:%d send config table msg to mnode", vgId, sid);
|
||||
|
||||
int32_t contLen = sizeof(SDMConfigTableMsg);
|
||||
SDMConfigTableMsg *pMsg = rpcMallocCont(contLen);
|
||||
|
@ -197,7 +197,7 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
|
|||
dError("vgId:%d, sid:%d failed to config table from mnode", vgId, sid);
|
||||
return NULL;
|
||||
} else {
|
||||
dPrint("vgId:%d, sid:%d config table msg is received", vgId, sid);
|
||||
dInfo("vgId:%d, sid:%d config table msg is received", vgId, sid);
|
||||
|
||||
// delete this after debug finished
|
||||
SMDCreateTableMsg *pTable = rpcRsp.pCont;
|
||||
|
@ -205,7 +205,7 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
|
|||
int16_t numOfTags = htons(pTable->numOfTags);
|
||||
int32_t sid = htonl(pTable->sid);
|
||||
uint64_t uid = htobe64(pTable->uid);
|
||||
dPrint("table:%s, numOfColumns:%d numOfTags:%d sid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, sid, uid);
|
||||
dInfo("table:%s, numOfColumns:%d numOfTags:%d sid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, sid, uid);
|
||||
|
||||
return rpcRsp.pCont;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
// Initialize the system
|
||||
if (dnodeInitSystem() < 0) {
|
||||
syslog(LOG_ERR, "Error initialize TDengine system");
|
||||
dPrint("Failed to start TDengine, please check the log at:%s", tsLogDir);
|
||||
dInfo("Failed to start TDengine, please check the log at:%s", tsLogDir);
|
||||
closelog();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
dnodeCleanUpSystem();
|
||||
// close the syslog
|
||||
syslog(LOG_INFO, "Shut down TDengine service successfully");
|
||||
dPrint("TDengine is shut down!");
|
||||
dInfo("TDengine is shut down!");
|
||||
closelog();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static void signal_handler(int32_t signum, siginfo_t *sigInfo, void *context) {
|
||||
if (signum == SIGUSR1) {
|
||||
taosCfgDynamicOptions("debugFlag 135");
|
||||
taosCfgDynamicOptions("debugFlag 151");
|
||||
return;
|
||||
}
|
||||
if (signum == SIGUSR2) {
|
||||
|
@ -127,7 +127,7 @@ static void signal_handler(int32_t signum, siginfo_t *sigInfo, void *context) {
|
|||
syslog(LOG_INFO, "Shut down signal is %d", signum);
|
||||
syslog(LOG_INFO, "Shutting down TDengine service...");
|
||||
// clean the system.
|
||||
dPrint("shut down signal is %d, sender PID:%d", signum, sigInfo->si_pid);
|
||||
dInfo("shut down signal is %d, sender PID:%d", signum, sigInfo->si_pid);
|
||||
|
||||
// protect the application from receive another signal
|
||||
struct sigaction act = {{0}};
|
||||
|
|
|
@ -59,7 +59,7 @@ int32_t dnodeInitVnodeRead() {
|
|||
pWorker->workerId = i;
|
||||
}
|
||||
|
||||
dPrint("dnode read is opened");
|
||||
dInfo("dnode read is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void dnodeCleanupVnodeRead() {
|
|||
free(readPool.readWorker);
|
||||
taosCloseQset(readQset);
|
||||
|
||||
dPrint("dnode read is closed");
|
||||
dInfo("dnode read is closed");
|
||||
}
|
||||
|
||||
void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) {
|
||||
|
@ -131,6 +131,7 @@ void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) {
|
|||
.msgType = 0
|
||||
};
|
||||
rpcSendResponse(&rpcRsp);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,11 +156,11 @@ void *dnodeAllocateVnodeRqueue(void *pVnode) {
|
|||
|
||||
pthread_attr_destroy(&thAttr);
|
||||
readPool.num++;
|
||||
dTrace("read worker:%d is launched, total:%d", pWorker->workerId, readPool.num);
|
||||
dDebug("read worker:%d is launched, total:%d", pWorker->workerId, readPool.num);
|
||||
} while (readPool.num < readPool.min);
|
||||
}
|
||||
|
||||
dTrace("pVnode:%p, read queue:%p is allocated", pVnode, queue);
|
||||
dDebug("pVnode:%p, read queue:%p is allocated", pVnode, queue);
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
@ -206,11 +207,11 @@ static void *dnodeProcessReadQueue(void *param) {
|
|||
|
||||
while (1) {
|
||||
if (taosReadQitemFromQset(readQset, &type, (void **)&pReadMsg, &pVnode) == 0) {
|
||||
dTrace("dnodeProcessReadQueee: got no message from qset, exiting...");
|
||||
dDebug("dnodeProcessReadQueee: got no message from qset, exiting...");
|
||||
break;
|
||||
}
|
||||
|
||||
dTrace("%p, msg:%s will be processed in vread queue", pReadMsg->rpcMsg.ahandle, taosMsg[pReadMsg->rpcMsg.msgType]);
|
||||
dDebug("%p, msg:%s will be processed in vread queue", pReadMsg->rpcMsg.ahandle, taosMsg[pReadMsg->rpcMsg.msgType]);
|
||||
int32_t code = vnodeProcessRead(pVnode, pReadMsg);
|
||||
dnodeSendRpcReadRsp(pVnode, pReadMsg, code);
|
||||
taosFreeQitem(pReadMsg);
|
||||
|
@ -226,7 +227,7 @@ static void dnodeHandleIdleReadWorker(SReadWorker *pWorker) {
|
|||
|
||||
if (num == 0 || (num <= readPool.min && readPool.num > readPool.min)) {
|
||||
readPool.num--;
|
||||
dTrace("read worker:%d is released, total:%d", pWorker->workerId, readPool.num);
|
||||
dDebug("read worker:%d is released, total:%d", pWorker->workerId, readPool.num);
|
||||
pthread_exit(NULL);
|
||||
} else {
|
||||
usleep(30000);
|
||||
|
|
|
@ -63,7 +63,7 @@ int32_t dnodeInitVnodeWrite() {
|
|||
wWorkerPool.writeWorker[i].workerId = i;
|
||||
}
|
||||
|
||||
dPrint("dnode write is opened");
|
||||
dInfo("dnode write is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ void dnodeCleanupVnodeWrite() {
|
|||
}
|
||||
|
||||
free(wWorkerPool.writeWorker);
|
||||
dPrint("dnode write is closed");
|
||||
dInfo("dnode write is closed");
|
||||
}
|
||||
|
||||
void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) {
|
||||
|
@ -119,6 +119,7 @@ void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) {
|
|||
.msgType = 0
|
||||
};
|
||||
rpcSendResponse(&rpcRsp);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +153,7 @@ void *dnodeAllocateVnodeWqueue(void *pVnode) {
|
|||
taosCloseQueue(queue);
|
||||
queue = NULL;
|
||||
} else {
|
||||
dTrace("write worker:%d is launched", pWorker->workerId);
|
||||
dDebug("write worker:%d is launched", pWorker->workerId);
|
||||
wWorkerPool.nextId = (wWorkerPool.nextId + 1) % wWorkerPool.max;
|
||||
}
|
||||
|
||||
|
@ -162,7 +163,7 @@ void *dnodeAllocateVnodeWqueue(void *pVnode) {
|
|||
wWorkerPool.nextId = (wWorkerPool.nextId + 1) % wWorkerPool.max;
|
||||
}
|
||||
|
||||
dTrace("pVnode:%p, write queue:%p is allocated", pVnode, queue);
|
||||
dDebug("pVnode:%p, write queue:%p is allocated", pVnode, queue);
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
@ -203,7 +204,7 @@ static void *dnodeProcessWriteQueue(void *param) {
|
|||
while (1) {
|
||||
numOfMsgs = taosReadAllQitemsFromQset(pWorker->qset, pWorker->qall, &pVnode);
|
||||
if (numOfMsgs == 0) {
|
||||
dTrace("dnodeProcessWriteQueee: got no message from qset, exiting...");
|
||||
dDebug("dnodeProcessWriteQueee: got no message from qset, exiting...");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -216,7 +217,7 @@ static void *dnodeProcessWriteQueue(void *param) {
|
|||
pHead->msgType = pWrite->rpcMsg.msgType;
|
||||
pHead->version = 0;
|
||||
pHead->len = pWrite->contLen;
|
||||
dTrace("%p, msg:%s will be processed in vwrite queue", pWrite->rpcMsg.ahandle, taosMsg[pWrite->rpcMsg.msgType]);
|
||||
dDebug("%p, msg:%s will be processed in vwrite queue", pWrite->rpcMsg.ahandle, taosMsg[pWrite->rpcMsg.msgType]);
|
||||
} else {
|
||||
pHead = (SWalHead *)item;
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ static void dnodeHandleIdleWorker(SWriteWorker *pWorker) {
|
|||
taosFreeQall(pWorker->qall);
|
||||
taosCloseQset(pWorker->qset);
|
||||
pWorker->qset = NULL;
|
||||
dTrace("write worker:%d is released", pWorker->workerId);
|
||||
dDebug("write worker:%d is released", pWorker->workerId);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ typedef struct SMnodeMsg {
|
|||
struct SDbObj * pDb;
|
||||
struct SVgObj * pVgroup;
|
||||
struct STableObj *pTable;
|
||||
struct SSuperTableObj *pSTable;
|
||||
} SMnodeMsg;
|
||||
|
||||
void mnodeCreateMsg(SMnodeMsg *pMsg, SRpcMsg *rpcMsg);
|
||||
|
|
|
@ -245,7 +245,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
|
|||
#define TSDB_DEFAULT_PKT_SIZE 65480 //same as RPC_MAX_UDP_SIZE
|
||||
|
||||
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
|
||||
#define TSDB_DEFAULT_PAYLOAD_SIZE 2048 // default payload size
|
||||
#define TSDB_DEFAULT_PAYLOAD_SIZE 5120 // default payload size, greater than PATH_MAX value
|
||||
#define TSDB_EXTRA_PAYLOAD_SIZE 128 // extra bytes for auth
|
||||
#define TSDB_CQ_SQL_SIZE 1024
|
||||
#define TSDB_MAX_VNODES 256
|
||||
|
@ -354,7 +354,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
|
|||
#define TSDB_DEFAULT_DBS_HASH_SIZE 100
|
||||
#define TSDB_DEFAULT_VGROUPS_HASH_SIZE 100
|
||||
#define TSDB_DEFAULT_STABLES_HASH_SIZE 100
|
||||
#define TSDB_DEFAULT_CTABLES_HASH_SIZE 10000
|
||||
#define TSDB_DEFAULT_CTABLES_HASH_SIZE 20000
|
||||
|
||||
#define TSDB_PORT_DNODESHELL 0
|
||||
#define TSDB_PORT_DNODEDNODE 5
|
||||
|
|
|
@ -470,11 +470,12 @@ int main(int argc, char *argv[]) {
|
|||
char command[BUFFER_SIZE] = "\0";
|
||||
|
||||
sprintf(command, "drop database %s;", db_name);
|
||||
taos_query(taos, command);
|
||||
|
||||
TAOS_RES* res = taos_query(taos, command);
|
||||
taos_free_result(res);
|
||||
|
||||
sprintf(command, "create database %s;", db_name);
|
||||
taos_query(taos, command);
|
||||
res = taos_query(taos, command);
|
||||
taos_free_result(res);
|
||||
|
||||
char cols[STRING_LEN] = "\0";
|
||||
int colIndex = 0;
|
||||
|
@ -498,7 +499,7 @@ int main(int argc, char *argv[]) {
|
|||
/* Create all the tables; */
|
||||
printf("Creating %d table(s)......\n", ntables);
|
||||
for (int i = 0; i < ntables; i++) {
|
||||
snprintf(command, BUFFER_SIZE, "create table %s.%s%d (ts timestamp%s;", db_name, tb_prefix, i, cols);
|
||||
snprintf(command, BUFFER_SIZE, "create table if not exists %s.%s%d (ts timestamp%s;", db_name, tb_prefix, i, cols);
|
||||
queryDB(taos, command);
|
||||
}
|
||||
|
||||
|
@ -508,7 +509,7 @@ int main(int argc, char *argv[]) {
|
|||
} else {
|
||||
/* Create metric table */
|
||||
printf("Creating meters super table...\n");
|
||||
snprintf(command, BUFFER_SIZE, "create table %s.meters (ts timestamp%s tags (areaid int, loc binary(10))", db_name, cols);
|
||||
snprintf(command, BUFFER_SIZE, "create table if not exists %s.meters (ts timestamp%s tags (areaid int, loc binary(10))", db_name, cols);
|
||||
queryDB(taos, command);
|
||||
printf("meters created!\n");
|
||||
|
||||
|
@ -522,9 +523,9 @@ int main(int argc, char *argv[]) {
|
|||
j = i % 10;
|
||||
}
|
||||
if (j % 2 == 0) {
|
||||
snprintf(command, BUFFER_SIZE, "create table %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "shanghai");
|
||||
snprintf(command, BUFFER_SIZE, "create table if not exists %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "shanghai");
|
||||
} else {
|
||||
snprintf(command, BUFFER_SIZE, "create table %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "beijing");
|
||||
snprintf(command, BUFFER_SIZE, "create table if not exists %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "beijing");
|
||||
}
|
||||
queryDB(taos, command);
|
||||
}
|
||||
|
@ -546,7 +547,10 @@ int main(int argc, char *argv[]) {
|
|||
threads = ntables;
|
||||
a = 1;
|
||||
}
|
||||
int b = ntables % threads;
|
||||
|
||||
int b = 0;
|
||||
if (threads != 0)
|
||||
b = ntables % threads;
|
||||
int last = 0;
|
||||
for (int i = 0; i < threads; i++) {
|
||||
info *t_info = infos + i;
|
||||
|
@ -846,10 +850,10 @@ void *syncWrite(void *sarg) {
|
|||
pstr += sprintf(pstr, "insert into %s.%s%d values", winfo->db_name, winfo->tb_prefix, tID);
|
||||
int k;
|
||||
for (k = 0; k < winfo->nrecords_per_request;) {
|
||||
int rand_num = trand() % 100;
|
||||
int rand_num = rand() % 100;
|
||||
int len = -1;
|
||||
if (winfo->data_of_order ==1 && rand_num < winfo->data_of_rate) {
|
||||
long d = tmp_time - trand() % 1000000 + rand_num;
|
||||
long d = tmp_time - rand() % 1000000 + rand_num;
|
||||
len = generateData(data, data_type, ncols_per_record, d, len_of_binary);
|
||||
} else {
|
||||
len = generateData(data, data_type, ncols_per_record, tmp_time += 1000, len_of_binary);
|
||||
|
@ -941,10 +945,10 @@ void callBack(void *param, TAOS_RES *res, int code) {
|
|||
pstr += sprintf(pstr, "insert into %s values", tb_info->tb_name);
|
||||
|
||||
for (int i = 0; i < tb_info->nrecords_per_request; i++) {
|
||||
int rand_num = trand() % 100;
|
||||
int rand_num = rand() % 100;
|
||||
if (tb_info->data_of_order ==1 && rand_num < tb_info->data_of_rate)
|
||||
{
|
||||
long d = tmp_time - trand() % 1000000 + rand_num;
|
||||
long d = tmp_time - rand() % 1000000 + rand_num;
|
||||
generateData(data, datatype, ncols_per_record, d, len_of_binary);
|
||||
} else
|
||||
{
|
||||
|
@ -993,20 +997,20 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
|
|||
|
||||
for (int i = 0; i < num_of_cols; i++) {
|
||||
if (strcasecmp(data_type[i % c], "tinyint") == 0) {
|
||||
pstr += sprintf(pstr, ", %d", (int)(trand() % 128));
|
||||
pstr += sprintf(pstr, ", %d", (int)(rand() % 128));
|
||||
} else if (strcasecmp(data_type[i % c], "smallint") == 0) {
|
||||
pstr += sprintf(pstr, ", %d", (int)(trand() % 32767));
|
||||
pstr += sprintf(pstr, ", %d", (int)(rand() % 32767));
|
||||
} else if (strcasecmp(data_type[i % c], "int") == 0) {
|
||||
pstr += sprintf(pstr, ", %d", (int)(trand() % 10));
|
||||
pstr += sprintf(pstr, ", %d", (int)(rand() % 10));
|
||||
} else if (strcasecmp(data_type[i % c], "bigint") == 0) {
|
||||
pstr += sprintf(pstr, ", %" PRId64, trand() % 2147483648);
|
||||
pstr += sprintf(pstr, ", %" PRId64, rand() % 2147483648);
|
||||
} else if (strcasecmp(data_type[i % c], "float") == 0) {
|
||||
pstr += sprintf(pstr, ", %10.4f", (float)(trand() / 1000.0));
|
||||
pstr += sprintf(pstr, ", %10.4f", (float)(rand() / 1000.0));
|
||||
} else if (strcasecmp(data_type[i % c], "double") == 0) {
|
||||
double t = (double)(trand() / 1000000.0);
|
||||
double t = (double)(rand() / 1000000.0);
|
||||
pstr += sprintf(pstr, ", %20.8f", t);
|
||||
} else if (strcasecmp(data_type[i % c], "bool") == 0) {
|
||||
bool b = trand() & 1;
|
||||
bool b = rand() & 1;
|
||||
pstr += sprintf(pstr, ", %s", b ? "true" : "false");
|
||||
} else if (strcasecmp(data_type[i % c], "binary") == 0) {
|
||||
char s[len_of_binary];
|
||||
|
@ -1032,7 +1036,7 @@ void rand_string(char *str, int size) {
|
|||
--size;
|
||||
int n;
|
||||
for (n = 0; n < size; n++) {
|
||||
int key = trand() % (int)(sizeof charset - 1);
|
||||
int key = rand() % (int)(sizeof charset - 1);
|
||||
str[n] = charset[key];
|
||||
}
|
||||
str[n] = 0;
|
||||
|
|
|
@ -27,23 +27,23 @@ extern int32_t mDebugFlag;
|
|||
extern int32_t sdbDebugFlag;
|
||||
|
||||
// mnode log function
|
||||
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND ", 255, __VA_ARGS__); }}
|
||||
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND ", mDebugFlag, __VA_ARGS__); }}
|
||||
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
|
||||
#define mPrint(...) { taosPrintLog("MND ", 255, __VA_ARGS__); }
|
||||
#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", 255, __VA_ARGS__); }}
|
||||
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", 255, __VA_ARGS__); }}
|
||||
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", 255, __VA_ARGS__); }}
|
||||
#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND INFO ", 255, __VA_ARGS__); }}
|
||||
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND DEBUG ", mDebugFlag, __VA_ARGS__); }}
|
||||
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND TRACE ", mDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define sdbFatal(...) { if (sdbDebugFlag & DEBUG_FATAL) { taosPrintLog("SDB FATAL ", 255, __VA_ARGS__); }}
|
||||
#define sdbError(...) { if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("SDB ERROR ", 255, __VA_ARGS__); }}
|
||||
#define sdbWarn(...) { if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("SDB WARN ", 255, __VA_ARGS__); }}
|
||||
#define sdbInfo(...) { if (sdbDebugFlag & DEBUG_INFO) { taosPrintLog("SDB INFO ", 255, __VA_ARGS__); }}
|
||||
#define sdbDebug(...) { if (sdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("SDB DEBUG ", sdbDebugFlag, __VA_ARGS__); }}
|
||||
#define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB TRACE ", sdbDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define mLError(...) { monitorSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) }
|
||||
#define mLWarn(...) { monitorSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) }
|
||||
#define mLPrint(...) { monitorSaveLog(0, __VA_ARGS__); mPrint(__VA_ARGS__) }
|
||||
|
||||
#define sdbError(...) { if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR SDB ", 255, __VA_ARGS__); }}
|
||||
#define sdbWarn(...) { if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("WARN SDB ", sdbDebugFlag, __VA_ARGS__); }}
|
||||
#define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__);}}
|
||||
#define sdbPrint(...) { taosPrintLog("SDB ", 255, __VA_ARGS__); }
|
||||
|
||||
#define sdbLError(...) { monitorSaveLog(2, __VA_ARGS__); sdbError(__VA_ARGS__) }
|
||||
#define sdbLWarn(...) { monitorSaveLog(1, __VA_ARGS__); sdbWarn(__VA_ARGS__) }
|
||||
#define sdbLPrint(...) { monitorSaveLog(0, __VA_ARGS__); sdbPrint(__VA_ARGS__) }
|
||||
#define mLInfo(...) { monitorSaveLog(0, __VA_ARGS__); mInfo(__VA_ARGS__) }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ static int32_t mnodeAcctActionDecode(SSdbOper *pOper) {
|
|||
static int32_t mnodeAcctActionRestored() {
|
||||
int32_t numOfRows = sdbGetNumOfRows(tsAcctSdb);
|
||||
if (numOfRows <= 0 && dnodeIsFirstDeploy()) {
|
||||
mPrint("dnode first deploy, create root acct");
|
||||
mInfo("dnode first deploy, create root acct");
|
||||
int32_t code = mnodeCreateRootAcct();
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mError("failed to create root account, reason:%s", tstrerror(code));
|
||||
|
@ -121,7 +121,7 @@ int32_t mnodeInitAccts() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mTrace("table:%s, hash is created", tableDesc.tableName);
|
||||
mDebug("table:%s, hash is created", tableDesc.tableName);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) {
|
|||
pVgroup->vnodeGid[0].dnodeId = pSelDnode->dnodeId;
|
||||
pVgroup->vnodeGid[0].pDnode = pSelDnode;
|
||||
|
||||
mTrace("dnode:%d, alloc one vnode to vgroup, openVnodes:%d", pSelDnode->dnodeId, pSelDnode->openVnodes);
|
||||
mDebug("dnode:%d, alloc one vnode to vgroup, openVnodes:%d", pSelDnode->dnodeId, pSelDnode->openVnodes);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ int32_t mnodeInitDbs() {
|
|||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DB, mnodeGetDbMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DB, mnodeRetrieveDbs);
|
||||
|
||||
mTrace("table:dbs table is created");
|
||||
mDebug("table:dbs table is created");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -311,6 +311,15 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
|
|||
if (pCfg->replications < 0) pCfg->replications = tsReplications;
|
||||
}
|
||||
|
||||
static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SDbObj *pDb = pMsg->pDb;
|
||||
if (pDb != NULL) {
|
||||
mLInfo("db:%s, is created by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMsg) {
|
||||
int32_t code = acctCheck(pAcct, ACCT_GRANT_DB);
|
||||
if (code != 0) return code;
|
||||
|
@ -319,7 +328,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
|
|||
if (pDb != NULL) {
|
||||
mnodeDecDbRef(pDb);
|
||||
if (pCreate->ignoreExist) {
|
||||
mTrace("db:%s, already exist, ignore exist is set", pCreate->db);
|
||||
mDebug("db:%s, already exist, ignore exist is set", pCreate->db);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
mError("db:%s, is already exist, ignore exist not set", pCreate->db);
|
||||
|
@ -364,18 +373,18 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
|
|||
.table = tsDbSdb,
|
||||
.pObj = pDb,
|
||||
.rowSize = sizeof(SDbObj),
|
||||
.pMsg = pMsg
|
||||
.pMsg = pMsg,
|
||||
.cb = mnodeCreateDbCb
|
||||
};
|
||||
|
||||
code = sdbInsertRow(&oper);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tfree(pDb);
|
||||
} else {
|
||||
mLPrint("db:%s, is created by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
|
||||
if (pMsg != NULL) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
mLInfo("db:%s, failed to create, reason:%s", pDb->name, tstrerror(code));
|
||||
return code;
|
||||
} else {
|
||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
}
|
||||
|
||||
bool mnodeCheckIsMonitorDB(char *db, char *monitordb) {
|
||||
|
@ -388,17 +397,17 @@ bool mnodeCheckIsMonitorDB(char *db, char *monitordb) {
|
|||
|
||||
#if 0
|
||||
void mnodePrintVgroups(SDbObj *pDb, char *oper) {
|
||||
mPrint("db:%s, vgroup link from head, oper:%s", pDb->name, oper);
|
||||
mInfo("db:%s, vgroup link from head, oper:%s", pDb->name, oper);
|
||||
SVgObj *pVgroup = pDb->pHead;
|
||||
while (pVgroup != NULL) {
|
||||
mPrint("vgId:%d", pVgroup->vgId);
|
||||
mInfo("vgId:%d", pVgroup->vgId);
|
||||
pVgroup = pVgroup->next;
|
||||
}
|
||||
|
||||
mPrint("db:%s, vgroup link from tail", pDb->name, pDb->numOfVgroups);
|
||||
mInfo("db:%s, vgroup link from tail", pDb->name, pDb->numOfVgroups);
|
||||
pVgroup = pDb->pTail;
|
||||
while (pVgroup != NULL) {
|
||||
mPrint("vgId:%d", pVgroup->vgId);
|
||||
mInfo("vgId:%d", pVgroup->vgId);
|
||||
pVgroup = pVgroup->prev;
|
||||
}
|
||||
}
|
||||
|
@ -805,12 +814,12 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
|
|||
}
|
||||
|
||||
if (totalBlocks > 0 && totalBlocks != pDb->cfg.totalBlocks) {
|
||||
mPrint("db:%s, blocks:%d change to %d", pDb->name, pDb->cfg.totalBlocks, totalBlocks);
|
||||
mInfo("db:%s, blocks:%d change to %d", pDb->name, pDb->cfg.totalBlocks, totalBlocks);
|
||||
newCfg.totalBlocks = totalBlocks;
|
||||
}
|
||||
|
||||
if (maxTables > 0) {
|
||||
mPrint("db:%s, maxTables:%d change to %d", pDb->name, pDb->cfg.maxTables, maxTables);
|
||||
mInfo("db:%s, maxTables:%d change to %d", pDb->name, pDb->cfg.maxTables, maxTables);
|
||||
newCfg.maxTables = maxTables;
|
||||
if (newCfg.maxTables < pDb->cfg.maxTables) {
|
||||
mError("db:%s, tables:%d should larger than origin:%d", pDb->name, newCfg.maxTables, pDb->cfg.maxTables);
|
||||
|
@ -824,17 +833,17 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
|
|||
}
|
||||
|
||||
if (daysToKeep > 0 && daysToKeep != pDb->cfg.daysToKeep) {
|
||||
mTrace("db:%s, daysToKeep:%d change to %d", pDb->name, pDb->cfg.daysToKeep, daysToKeep);
|
||||
mDebug("db:%s, daysToKeep:%d change to %d", pDb->name, pDb->cfg.daysToKeep, daysToKeep);
|
||||
newCfg.daysToKeep = daysToKeep;
|
||||
}
|
||||
|
||||
if (daysToKeep1 > 0 && daysToKeep1 != pDb->cfg.daysToKeep1) {
|
||||
mTrace("db:%s, daysToKeep1:%d change to %d", pDb->name, pDb->cfg.daysToKeep1, daysToKeep1);
|
||||
mDebug("db:%s, daysToKeep1:%d change to %d", pDb->name, pDb->cfg.daysToKeep1, daysToKeep1);
|
||||
newCfg.daysToKeep1 = daysToKeep1;
|
||||
}
|
||||
|
||||
if (daysToKeep2 > 0 && daysToKeep2 != pDb->cfg.daysToKeep2) {
|
||||
mTrace("db:%s, daysToKeep2:%d change to %d", pDb->name, pDb->cfg.daysToKeep2, daysToKeep2);
|
||||
mDebug("db:%s, daysToKeep2:%d change to %d", pDb->name, pDb->cfg.daysToKeep2, daysToKeep2);
|
||||
newCfg.daysToKeep2 = daysToKeep2;
|
||||
}
|
||||
|
||||
|
@ -859,7 +868,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
|
|||
}
|
||||
|
||||
if (compression >= 0 && compression != pDb->cfg.compression) {
|
||||
mTrace("db:%s, compression:%d change to %d", pDb->name, pDb->cfg.compression, compression);
|
||||
mDebug("db:%s, compression:%d change to %d", pDb->name, pDb->cfg.compression, compression);
|
||||
newCfg.compression = compression;
|
||||
}
|
||||
|
||||
|
@ -869,7 +878,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
|
|||
}
|
||||
|
||||
if (replications > 0 && replications != pDb->cfg.replications) {
|
||||
mTrace("db:%s, replications:%d change to %d", pDb->name, pDb->cfg.replications, replications);
|
||||
mDebug("db:%s, replications:%d change to %d", pDb->name, pDb->cfg.replications, replications);
|
||||
newCfg.replications = replications;
|
||||
|
||||
if (pDb->cfg.walLevel < TSDB_MIN_WAL_LEVEL) {
|
||||
|
@ -907,8 +916,8 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
|
|||
}
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mTrace("db:%s, all vgroups is altered", pDb->name);
|
||||
mLPrint("db:%s, is alterd by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
|
||||
mDebug("db:%s, all vgroups is altered", pDb->name);
|
||||
mLInfo("db:%s, is alterd by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
|
||||
|
||||
balanceAsyncNotify();
|
||||
|
||||
|
@ -948,7 +957,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SCMAlterDbMsg *pAlter, void *pMsg) {
|
|||
|
||||
static int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg) {
|
||||
SCMAlterDbMsg *pAlter = pMsg->rpcMsg.pCont;
|
||||
mTrace("db:%s, alter db msg is received from thandle:%p", pAlter->db, pMsg->rpcMsg.handle);
|
||||
mDebug("db:%s, alter db msg is received from thandle:%p", pAlter->db, pMsg->rpcMsg.handle);
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pAlter->db);
|
||||
if (pMsg->pDb == NULL) {
|
||||
|
@ -959,22 +968,33 @@ static int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg) {
|
|||
return mnodeAlterDb(pMsg->pDb, pAlter, pMsg);
|
||||
}
|
||||
|
||||
static int32_t mnodeDropDbCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SDbObj *pDb = pMsg->pDb;
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mError("db:%s, failed to drop from sdb, reason:%s", pDb->name, tstrerror(code));
|
||||
} else {
|
||||
mLInfo("db:%s, is dropped by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
|
||||
if (pMsg == NULL) return TSDB_CODE_MND_APP_ERROR;
|
||||
|
||||
SDbObj *pDb = pMsg->pDb;
|
||||
mPrint("db:%s, drop db from sdb", pDb->name);
|
||||
mInfo("db:%s, drop db from sdb", pDb->name);
|
||||
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
.table = tsDbSdb,
|
||||
.pObj = pDb,
|
||||
.pMsg = pMsg
|
||||
.pMsg = pMsg,
|
||||
.cb = mnodeDropDbCb
|
||||
};
|
||||
|
||||
int32_t code = sdbDeleteRow(&oper);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
mLPrint("db:%s, is dropped by %s", pDb->name, mnodeGetUserFromMsg(pMsg));
|
||||
code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
|
@ -983,12 +1003,12 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
|
|||
|
||||
static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg) {
|
||||
SCMDropDbMsg *pDrop = pMsg->rpcMsg.pCont;
|
||||
mTrace("db:%s, drop db msg is received from thandle:%p", pDrop->db, pMsg->rpcMsg.handle);
|
||||
mDebug("db:%s, drop db msg is received from thandle:%p", pDrop->db, pMsg->rpcMsg.handle);
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pDrop->db);
|
||||
if (pMsg->pDb == NULL) {
|
||||
if (pDrop->ignoreNotExists) {
|
||||
mTrace("db:%s, db is not exist, think drop success", pDrop->db);
|
||||
mDebug("db:%s, db is not exist, think drop success", pDrop->db);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
mError("db:%s, failed to drop, invalid db", pDrop->db);
|
||||
|
@ -1009,7 +1029,7 @@ static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
mnodeSendDropAllDbVgroupsMsg(pMsg->pDb);
|
||||
|
||||
mTrace("db:%s, all vgroups is dropped", pMsg->pDb->name);
|
||||
mDebug("db:%s, all vgroups is dropped", pMsg->pDb->name);
|
||||
return mnodeDropDb(pMsg);
|
||||
}
|
||||
|
||||
|
@ -1018,14 +1038,14 @@ void mnodeDropAllDbs(SAcctObj *pAcct) {
|
|||
SDbObj *pDb = NULL;
|
||||
void * pIter = NULL;
|
||||
|
||||
mPrint("acct:%s, all dbs will be dropped from sdb", pAcct->user);
|
||||
mInfo("acct:%s, all dbs will be dropped from sdb", pAcct->user);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextDb(pIter, &pDb);
|
||||
if (pDb == NULL) break;
|
||||
|
||||
if (pDb->pAcct == pAcct) {
|
||||
mPrint("db:%s, drop db from sdb for acct:%s is dropped", pDb->name, pAcct->user);
|
||||
mInfo("db:%s, drop db from sdb for acct:%s is dropped", pDb->name, pAcct->user);
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_LOCAL,
|
||||
.table = tsDbSdb,
|
||||
|
@ -1040,5 +1060,5 @@ void mnodeDropAllDbs(SAcctObj *pAcct) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("acct:%s, all dbs:%d is dropped from sdb", pAcct->user, numOfDbs);
|
||||
mInfo("acct:%s, all dbs:%d is dropped from sdb", pAcct->user, numOfDbs);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ static int32_t mnodeDnodeActionDelete(SSdbOper *pOper) {
|
|||
mnodeDropMnodeLocal(pDnode->dnodeId);
|
||||
balanceAsyncNotify();
|
||||
|
||||
mTrace("dnode:%d, all vgroups is dropped from sdb", pDnode->dnodeId);
|
||||
mDebug("dnode:%d, all vgroups is dropped from sdb", pDnode->dnodeId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ static int32_t mnodeDnodeActionDecode(SSdbOper *pOper) {
|
|||
static int32_t mnodeDnodeActionRestored() {
|
||||
int32_t numOfRows = sdbGetNumOfRows(tsDnodeSdb);
|
||||
if (numOfRows <= 0 && dnodeIsFirstDeploy()) {
|
||||
mPrint("dnode first deploy, create dnode:%s", tsLocalEp);
|
||||
mInfo("dnode first deploy, create dnode:%s", tsLocalEp);
|
||||
mnodeCreateDnode(tsLocalEp, NULL);
|
||||
SDnodeObj *pDnode = mnodeGetDnodeByEp(tsLocalEp);
|
||||
if (pDnode != NULL) {
|
||||
|
@ -170,7 +170,7 @@ int32_t mnodeInitDnodes() {
|
|||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mnodeGetDnodeMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DNODE, mnodeRetrieveDnodes);
|
||||
|
||||
mTrace("table:dnodes table is created");
|
||||
mDebug("table:dnodes table is created");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -272,13 +272,13 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
|
|||
};
|
||||
dnodeSendMsgToDnode(&ipSet, &rpcMdCfgDnodeMsg);
|
||||
|
||||
mPrint("dnode:%s, is configured by %s", pCmCfgDnode->ep, pMsg->pUser->user);
|
||||
mInfo("dnode:%s, is configured by %s", pCmCfgDnode->ep, pMsg->pUser->user);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) {
|
||||
mPrint("cfg dnode rsp is received");
|
||||
mInfo("cfg dnode rsp is received");
|
||||
}
|
||||
|
||||
static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) {
|
||||
|
@ -313,7 +313,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
|||
if (pStatus->dnodeId == 0) {
|
||||
pDnode = mnodeGetDnodeByEp(pStatus->dnodeEp);
|
||||
if (pDnode == NULL) {
|
||||
mTrace("dnode %s not created", pStatus->dnodeEp);
|
||||
mDebug("dnode %s not created", pStatus->dnodeEp);
|
||||
return TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||
}
|
||||
} else {
|
||||
|
@ -332,9 +332,9 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
|||
pDnode->moduleStatus = pStatus->moduleStatus;
|
||||
|
||||
if (pStatus->dnodeId == 0) {
|
||||
mTrace("dnode:%d %s, first access", pDnode->dnodeId, pDnode->dnodeEp);
|
||||
mDebug("dnode:%d %s, first access", pDnode->dnodeId, pDnode->dnodeEp);
|
||||
} else {
|
||||
//mTrace("dnode:%d, status received, access times %d", pDnode->dnodeId, pDnode->lastAccess);
|
||||
//mDebug("dnode:%d, status received, access times %d", pDnode->dnodeId, pDnode->lastAccess);
|
||||
}
|
||||
|
||||
int32_t openVnodes = htons(pStatus->openVnodes);
|
||||
|
@ -358,7 +358,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
|||
SVgObj *pVgroup = mnodeGetVgroup(pVload->vgId);
|
||||
if (pVgroup == NULL) {
|
||||
SRpcIpSet ipSet = mnodeGetIpSetFromIp(pDnode->dnodeEp);
|
||||
mPrint("dnode:%d, vgId:%d not exist in mnode, drop it", pDnode->dnodeId, pVload->vgId);
|
||||
mInfo("dnode:%d, vgId:%d not exist in mnode, drop it", pDnode->dnodeId, pVload->vgId);
|
||||
mnodeSendDropVnodeMsg(pVload->vgId, &ipSet, NULL);
|
||||
} else {
|
||||
mnodeUpdateVgroupStatus(pVgroup, pDnode, pVload);
|
||||
|
@ -380,7 +380,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
|
|||
return TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT;
|
||||
}
|
||||
|
||||
mTrace("dnode:%d, from offline to online", pDnode->dnodeId);
|
||||
mDebug("dnode:%d, from offline to online", pDnode->dnodeId);
|
||||
pDnode->status = TAOS_DN_STATUS_READY;
|
||||
balanceSyncNotify();
|
||||
balanceAsyncNotify();
|
||||
|
@ -437,7 +437,7 @@ static int32_t mnodeCreateDnode(char *ep, SMnodeMsg *pMsg) {
|
|||
tfree(pDnode);
|
||||
mError("failed to create dnode:%d, result:%s", dnodeId, tstrerror(code));
|
||||
} else {
|
||||
mPrint("dnode:%d is created, result:%s", pDnode->dnodeId, tstrerror(code));
|
||||
mInfo("dnode:%d is created, result:%s", pDnode->dnodeId, tstrerror(code));
|
||||
if (pMsg != NULL) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ int32_t mnodeDropDnode(SDnodeObj *pDnode, void *pMsg) {
|
|||
|
||||
int32_t code = sdbDeleteRow(&oper);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
mLPrint("dnode:%d, is dropped from cluster, result:%s", pDnode->dnodeId, tstrerror(code));
|
||||
mLInfo("dnode:%d, is dropped from cluster, result:%s", pDnode->dnodeId, tstrerror(code));
|
||||
if (pMsg != NULL) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ static int32_t mnodeDropDnodeByEp(char *ep, SMnodeMsg *pMsg) {
|
|||
return TSDB_CODE_MND_NO_REMOVE_MASTER;
|
||||
}
|
||||
|
||||
mPrint("dnode:%d, start to drop it", pDnode->dnodeId);
|
||||
mInfo("dnode:%d, start to drop it", pDnode->dnodeId);
|
||||
#ifndef _SYNC
|
||||
return mnodeDropDnode(pDnode, pMsg);
|
||||
#else
|
||||
|
|
|
@ -54,6 +54,7 @@ void mnodeCleanupMsg(SMnodeMsg *pMsg) {
|
|||
if (pMsg->pDb) mnodeDecDbRef(pMsg->pDb);
|
||||
if (pMsg->pVgroup) mnodeDecVgroupRef(pMsg->pVgroup);
|
||||
if (pMsg->pTable) mnodeDecTableRef(pMsg->pTable);
|
||||
if (pMsg->pSTable) mnodeDecTableRef(pMsg->pSTable);
|
||||
if (pMsg->pAcct) mnodeDecAcctRef(pMsg->pAcct);
|
||||
if (pMsg->pDnode) mnodeDecDnodeRef(pMsg->pDnode);
|
||||
}
|
||||
|
|
|
@ -83,11 +83,11 @@ static int32_t mnodeInitComponents() {
|
|||
|
||||
int32_t mnodeStartSystem() {
|
||||
if (tsMgmtIsRunning) {
|
||||
mPrint("mnode module already started...");
|
||||
mInfo("mnode module already started...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mPrint("starting to initialize mnode ...");
|
||||
mInfo("starting to initialize mnode ...");
|
||||
if (mkdir(tsMnodeDir, 0755) != 0 && errno != EEXIST) {
|
||||
mError("failed to init mnode dir:%s, reason:%s", tsMnodeDir, strerror(errno));
|
||||
return -1;
|
||||
|
@ -104,7 +104,7 @@ int32_t mnodeStartSystem() {
|
|||
grantReset(TSDB_GRANT_ALL, 0);
|
||||
tsMgmtIsRunning = true;
|
||||
|
||||
mPrint("mnode is initialized successfully");
|
||||
mInfo("mnode is initialized successfully");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -115,30 +115,30 @@ int32_t mnodeInitSystem() {
|
|||
}
|
||||
|
||||
void mnodeCleanupSystem() {
|
||||
mPrint("starting to clean up mnode");
|
||||
mInfo("starting to clean up mnode");
|
||||
tsMgmtIsRunning = false;
|
||||
|
||||
dnodeFreeMnodeWqueue();
|
||||
dnodeFreeMnodeRqueue();
|
||||
dnodeFreeMnodePqueue();
|
||||
mnodeCleanupTimer();
|
||||
mnodeCleanupComponents(sizeof(tsMnodeComponents) / sizeof(tsMnodeComponents[0]) - 1);
|
||||
mnodeCleanupTimer();
|
||||
|
||||
mPrint("mnode is cleaned up");
|
||||
mInfo("mnode is cleaned up");
|
||||
}
|
||||
|
||||
void mnodeStopSystem() {
|
||||
if (sdbIsMaster()) {
|
||||
mTrace("it is a master mnode, it could not be stopped");
|
||||
mDebug("it is a master mnode, it could not be stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
mnodeCleanupSystem();
|
||||
|
||||
if (remove(tsMnodeDir) != 0) {
|
||||
mPrint("failed to remove mnode file, reason:%s", strerror(errno));
|
||||
mInfo("failed to remove mnode file, reason:%s", strerror(errno));
|
||||
} else {
|
||||
mPrint("mnode file is removed");
|
||||
mInfo("mnode file is removed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ static int32_t mnodeMnodeActionDelete(SSdbOper *pOper) {
|
|||
pDnode->isMgmt = false;
|
||||
mnodeDecDnodeRef(pDnode);
|
||||
|
||||
mTrace("mnode:%d, is dropped from sdb", pMnode->mnodeId);
|
||||
mDebug("mnode:%d, is dropped from sdb", pMnode->mnodeId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ int32_t mnodeInitMnodes() {
|
|||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MNODE, mnodeGetMnodeMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MNODE, mnodeRetrieveMnodes);
|
||||
|
||||
mTrace("table:mnodes table is created");
|
||||
mDebug("table:mnodes table is created");
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ char *mnodeGetMnodeRoleStr(int32_t role) {
|
|||
}
|
||||
|
||||
void mnodeUpdateMnodeIpSet() {
|
||||
mPrint("update mnodes ipset, numOfIps:%d ", mnodeGetMnodesNum());
|
||||
mInfo("update mnodes ipset, numOfIps:%d ", mnodeGetMnodesNum());
|
||||
|
||||
mnodeMnodeWrLock();
|
||||
|
||||
|
@ -223,11 +223,11 @@ void mnodeUpdateMnodeIpSet() {
|
|||
if (pDnode != NULL) {
|
||||
strcpy(tsMnodeIpSetForShell.fqdn[index], pDnode->dnodeFqdn);
|
||||
tsMnodeIpSetForShell.port[index] = htons(pDnode->dnodePort);
|
||||
mTrace("mnode:%d, for shell fqdn:%s %d", pDnode->dnodeId, tsMnodeIpSetForShell.fqdn[index], htons(tsMnodeIpSetForShell.port[index]));
|
||||
mDebug("mnode:%d, for shell fqdn:%s %d", pDnode->dnodeId, tsMnodeIpSetForShell.fqdn[index], htons(tsMnodeIpSetForShell.port[index]));
|
||||
|
||||
strcpy(tsMnodeIpSetForPeer.fqdn[index], pDnode->dnodeFqdn);
|
||||
tsMnodeIpSetForPeer.port[index] = htons(pDnode->dnodePort + TSDB_PORT_DNODEDNODE);
|
||||
mTrace("mnode:%d, for peer fqdn:%s %d", pDnode->dnodeId, tsMnodeIpSetForPeer.fqdn[index], htons(tsMnodeIpSetForPeer.port[index]));
|
||||
mDebug("mnode:%d, for peer fqdn:%s %d", pDnode->dnodeId, tsMnodeIpSetForPeer.fqdn[index], htons(tsMnodeIpSetForPeer.port[index]));
|
||||
|
||||
tsMnodeInfos.nodeInfos[index].nodeId = htonl(pMnode->mnodeId);
|
||||
strcpy(tsMnodeInfos.nodeInfos[index].nodeEp, pDnode->dnodeEp);
|
||||
|
@ -238,7 +238,7 @@ void mnodeUpdateMnodeIpSet() {
|
|||
tsMnodeInfos.inUse = index;
|
||||
}
|
||||
|
||||
mPrint("mnode:%d, ep:%s %s", pDnode->dnodeId, pDnode->dnodeEp, pMnode->role == TAOS_SYNC_ROLE_MASTER ? "master" : "");
|
||||
mInfo("mnode:%d, ep:%s %s", pDnode->dnodeId, pDnode->dnodeEp, pMnode->role == TAOS_SYNC_ROLE_MASTER ? "master" : "");
|
||||
index++;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) {
|
|||
rpcRsp->rsp = ipSet;
|
||||
rpcRsp->len = sizeof(SRpcIpSet);
|
||||
|
||||
mTrace("%p, msg:%s in mpeer queue, will be redireced inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], ipSet->inUse);
|
||||
mDebug("%p, msg:%s in mpeer queue, will be redireced inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], ipSet->inUse);
|
||||
for (int32_t i = 0; i < ipSet->numOfIps; ++i) {
|
||||
mTrace("mnode index:%d ip:%s:%d", i, ipSet->fqdn[i], htons(ipSet->port[i]));
|
||||
mDebug("mnode index:%d ip:%s:%d", i, ipSet->fqdn[i], htons(ipSet->port[i]));
|
||||
}
|
||||
|
||||
return TSDB_CODE_RPC_REDIRECT;
|
||||
|
|
|
@ -74,7 +74,7 @@ int32_t mnodeInitProfile() {
|
|||
|
||||
void mnodeCleanupProfile() {
|
||||
if (tsMnodeConnCache != NULL) {
|
||||
mPrint("conn cache is cleanup");
|
||||
mInfo("conn cache is cleanup");
|
||||
taosCacheCleanup(tsMnodeConnCache);
|
||||
tsMnodeConnCache = NULL;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) {
|
|||
sprintf(key, "%u", connId);
|
||||
SConnObj *pConn = taosCachePut(tsMnodeConnCache, key, &connObj, sizeof(connObj), CONN_KEEP_TIME);
|
||||
|
||||
mTrace("connId:%d, is created, user:%s ip:%s:%u", connId, user, taosIpStr(ip), port);
|
||||
mDebug("connId:%d, is created, user:%s ip:%s:%u", connId, user, taosIpStr(ip), port);
|
||||
return pConn;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ SConnObj *mnodeAccquireConn(uint32_t connId, char *user, uint32_t ip, uint16_t p
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// mTrace("connId:%d, is incoming, user:%s ip:%s:%u", connId, pConn->user, taosIpStr(pConn->ip), pConn->port);
|
||||
// mDebug("connId:%d, is incoming, user:%s ip:%s:%u", connId, pConn->user, taosIpStr(pConn->ip), pConn->port);
|
||||
pConn->lastAccess = expireTime;
|
||||
return pConn;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ static void mnodeFreeConn(void *data) {
|
|||
tfree(pConn->pQueries);
|
||||
tfree(pConn->pStreams);
|
||||
|
||||
mTrace("connId:%d, is destroyed", pConn->connId);
|
||||
mDebug("connId:%d, is destroyed", pConn->connId);
|
||||
}
|
||||
|
||||
static void *mnodeGetNextConn(SHashMutableIterator *pIter, SConnObj **pConn) {
|
||||
|
@ -534,14 +534,14 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
|
|||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
SCMKillQueryMsg *pKill = pMsg->rpcMsg.pCont;
|
||||
mPrint("kill query msg is received, queryId:%s", pKill->queryId);
|
||||
mInfo("kill query msg is received, queryId:%s", pKill->queryId);
|
||||
|
||||
const char delim = ':';
|
||||
char* connIdStr = strtok(pKill->queryId, &delim);
|
||||
char* queryIdStr = strtok(NULL, &delim);
|
||||
|
||||
if (queryIdStr == NULL || connIdStr == NULL) {
|
||||
mPrint("failed to kill query, queryId:%s", pKill->queryId);
|
||||
mInfo("failed to kill query, queryId:%s", pKill->queryId);
|
||||
return TSDB_CODE_MND_INVALID_QUERY_ID;
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
|
|||
mError("connId:%s, failed to kill queryId:%d, conn not exist", connIdStr, queryId);
|
||||
return TSDB_CODE_MND_INVALID_CONN_ID;
|
||||
} else {
|
||||
mPrint("connId:%s, queryId:%d is killed by user:%s", connIdStr, queryId, pUser->user);
|
||||
mInfo("connId:%s, queryId:%d is killed by user:%s", connIdStr, queryId, pUser->user);
|
||||
pConn->queryId = queryId;
|
||||
taosCacheRelease(tsMnodeConnCache, (void **)&pConn, false);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -564,14 +564,14 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
|
|||
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
|
||||
|
||||
SCMKillQueryMsg *pKill = pMsg->rpcMsg.pCont;
|
||||
mPrint("kill stream msg is received, streamId:%s", pKill->queryId);
|
||||
mInfo("kill stream msg is received, streamId:%s", pKill->queryId);
|
||||
|
||||
const char delim = ':';
|
||||
char* connIdStr = strtok(pKill->queryId, &delim);
|
||||
char* streamIdStr = strtok(NULL, &delim);
|
||||
|
||||
if (streamIdStr == NULL || connIdStr == NULL) {
|
||||
mPrint("failed to kill stream, streamId:%s", pKill->queryId);
|
||||
mInfo("failed to kill stream, streamId:%s", pKill->queryId);
|
||||
return TSDB_CODE_MND_INVALID_STREAM_ID;
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
|
|||
mError("connId:%s, failed to kill streamId:%d, conn not exist", connIdStr, streamId);
|
||||
return TSDB_CODE_MND_INVALID_CONN_ID;
|
||||
} else {
|
||||
mPrint("connId:%s, streamId:%d is killed by user:%s", connIdStr, streamId, pUser->user);
|
||||
mInfo("connId:%s, streamId:%d is killed by user:%s", connIdStr, streamId, pUser->user);
|
||||
pConn->streamId = streamId;
|
||||
taosCacheRelease(tsMnodeConnCache, (void **)&pConn, false);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -599,7 +599,7 @@ static int32_t mnodeProcessKillConnectionMsg(SMnodeMsg *pMsg) {
|
|||
mError("connId:%s, failed to kill, conn not exist", pKill->queryId);
|
||||
return TSDB_CODE_MND_INVALID_CONN_ID;
|
||||
} else {
|
||||
mPrint("connId:%s, is killed by user:%s", pKill->queryId, pUser->user);
|
||||
mInfo("connId:%s, is killed by user:%s", pKill->queryId, pUser->user);
|
||||
pConn->killed = 1;
|
||||
taosCacheRelease(tsMnodeConnCache, (void**)&pConn, false);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -54,9 +54,9 @@ int32_t mnodeProcessRead(SMnodeMsg *pMsg) {
|
|||
rpcRsp->rsp = ipSet;
|
||||
rpcRsp->len = sizeof(SRpcIpSet);
|
||||
|
||||
mTrace("%p, msg:%s in mread queue, will be redireced, inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], ipSet->inUse);
|
||||
mDebug("%p, msg:%s in mread queue, will be redireced, inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], ipSet->inUse);
|
||||
for (int32_t i = 0; i < ipSet->numOfIps; ++i) {
|
||||
mTrace("mnode index:%d ip:%s:%d", i, ipSet->fqdn[i], htons(ipSet->port[i]));
|
||||
mDebug("mnode index:%d ip:%s:%d", i, ipSet->fqdn[i], htons(ipSet->port[i]));
|
||||
}
|
||||
|
||||
return TSDB_CODE_RPC_REDIRECT;
|
||||
|
|
|
@ -181,7 +181,7 @@ static int32_t sdbInitWal() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
sdbTrace("open sdb wal for restore");
|
||||
sdbInfo("open sdb wal for restore");
|
||||
walRestore(tsSdbObj.wal, NULL, sdbWrite);
|
||||
return 0;
|
||||
}
|
||||
|
@ -198,10 +198,10 @@ static void sdbRestoreTables() {
|
|||
|
||||
totalRows += pTable->numOfRows;
|
||||
numOfTables++;
|
||||
sdbTrace("table:%s, is restored, numOfRows:%" PRId64, pTable->tableName, pTable->numOfRows);
|
||||
sdbDebug("table:%s, is restored, numOfRows:%" PRId64, pTable->tableName, pTable->numOfRows);
|
||||
}
|
||||
|
||||
sdbTrace("sdb is restored, version:%" PRId64 " totalRows:%d numOfTables:%d", tsSdbObj.version, totalRows, numOfTables);
|
||||
sdbInfo("sdb is restored, version:%" PRId64 " totalRows:%d numOfTables:%d", tsSdbObj.version, totalRows, numOfTables);
|
||||
}
|
||||
|
||||
void sdbUpdateMnodeRoles() {
|
||||
|
@ -210,12 +210,12 @@ void sdbUpdateMnodeRoles() {
|
|||
SNodesRole roles = {0};
|
||||
syncGetNodesRole(tsSdbObj.sync, &roles);
|
||||
|
||||
sdbPrint("update mnodes sync roles, total:%d", tsSdbObj.cfg.replica);
|
||||
sdbInfo("update mnodes sync roles, total:%d", tsSdbObj.cfg.replica);
|
||||
for (int32_t i = 0; i < tsSdbObj.cfg.replica; ++i) {
|
||||
SMnodeObj *pMnode = mnodeGetMnode(roles.nodeId[i]);
|
||||
if (pMnode != NULL) {
|
||||
pMnode->role = roles.role[i];
|
||||
sdbPrint("mnode:%d, role:%s", pMnode->mnodeId, mnodeGetMnodeRoleStr(pMnode->role));
|
||||
sdbInfo("mnode:%d, role:%s", pMnode->mnodeId, mnodeGetMnodeRoleStr(pMnode->role));
|
||||
if (pMnode->mnodeId == dnodeGetDnodeId()) tsSdbObj.role = pMnode->role;
|
||||
mnodeDecMnodeRef(pMnode);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static int sdbGetWalInfo(void *ahandle, char *name, uint32_t *index) {
|
|||
}
|
||||
|
||||
static void sdbNotifyRole(void *ahandle, int8_t role) {
|
||||
sdbPrint("mnode role changed from %s to %s", mnodeGetMnodeRoleStr(tsSdbObj.role), mnodeGetMnodeRoleStr(role));
|
||||
sdbInfo("mnode role changed from %s to %s", mnodeGetMnodeRoleStr(tsSdbObj.role), mnodeGetMnodeRoleStr(role));
|
||||
|
||||
if (role == TAOS_SYNC_ROLE_MASTER && tsSdbObj.role != TAOS_SYNC_ROLE_MASTER) {
|
||||
balanceReset();
|
||||
|
@ -247,7 +247,7 @@ static void sdbNotifyRole(void *ahandle, int8_t role) {
|
|||
static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
|
||||
tsSdbObj.code = code;
|
||||
sem_post(&tsSdbObj.sem);
|
||||
sdbTrace("forward request confirmed, version:%" PRIu64 ", result:%s", (int64_t)param, tstrerror(code));
|
||||
sdbDebug("forward request confirmed, version:%" PRIu64 ", result:%s", (int64_t)param, tstrerror(code));
|
||||
}
|
||||
|
||||
static int32_t sdbForwardToPeer(SWalHead *pHead) {
|
||||
|
@ -255,7 +255,7 @@ static int32_t sdbForwardToPeer(SWalHead *pHead) {
|
|||
|
||||
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version, TAOS_QTYPE_RPC);
|
||||
if (code > 0) {
|
||||
sdbTrace("forward request is sent, version:%" PRIu64 ", code:%d", pHead->version, code);
|
||||
sdbDebug("forward request is sent, version:%" PRIu64 ", code:%d", pHead->version, code);
|
||||
sem_wait(&tsSdbObj.sem);
|
||||
return tsSdbObj.code;
|
||||
}
|
||||
|
@ -311,9 +311,9 @@ void sdbUpdateSync() {
|
|||
if (!hasThisDnode) return;
|
||||
if (memcmp(&syncCfg, &tsSdbObj.cfg, sizeof(SSyncCfg)) == 0) return;
|
||||
|
||||
sdbPrint("work as mnode, replica:%d", syncCfg.replica);
|
||||
sdbInfo("work as mnode, replica:%d", syncCfg.replica);
|
||||
for (int32_t i = 0; i < syncCfg.replica; ++i) {
|
||||
sdbPrint("mnode:%d, %s:%d", syncCfg.nodeInfo[i].nodeId, syncCfg.nodeInfo[i].nodeFqdn, syncCfg.nodeInfo[i].nodePort);
|
||||
sdbInfo("mnode:%d, %s:%d", syncCfg.nodeInfo[i].nodeId, syncCfg.nodeInfo[i].nodeFqdn, syncCfg.nodeInfo[i].nodePort);
|
||||
}
|
||||
|
||||
SSyncInfo syncInfo = {0};
|
||||
|
@ -388,10 +388,8 @@ void sdbIncRef(void *handle, void *pObj) {
|
|||
SSdbTable *pTable = handle;
|
||||
int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos);
|
||||
atomic_add_fetch_32(pRefCount, 1);
|
||||
if (0 && (pTable->tableId == SDB_TABLE_CTABLE || pTable->tableId == SDB_TABLE_DB)) {
|
||||
sdbTrace("add ref to table:%s record:%p:%s:%d", pTable->tableName, pObj, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
||||
}
|
||||
}
|
||||
|
||||
void sdbDecRef(void *handle, void *pObj) {
|
||||
if (pObj == NULL) return;
|
||||
|
@ -399,9 +397,7 @@ void sdbDecRef(void *handle, void *pObj) {
|
|||
SSdbTable *pTable = handle;
|
||||
int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos);
|
||||
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1);
|
||||
if (0 && (pTable->tableId == SDB_TABLE_CTABLE || pTable->tableId == SDB_TABLE_DB)) {
|
||||
sdbTrace("def ref of table:%s record:%p:%s:%d", pTable->tableName, pObj, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount);
|
||||
}
|
||||
|
||||
int8_t *updateEnd = pObj + pTable->refCountPos - 1;
|
||||
if (refCount <= 0 && *updateEnd) {
|
||||
|
@ -469,7 +465,7 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) {
|
|||
atomic_add_fetch_32(&pTable->autoIndex, 1);
|
||||
}
|
||||
|
||||
sdbTrace("table:%s, insert record:%s to hash, rowSize:%d numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName,
|
||||
sdbDebug("table:%s, insert record:%s to hash, rowSize:%d numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName,
|
||||
sdbGetKeyStrFromObj(pTable, pOper->pObj), pOper->rowSize, pTable->numOfRows, sdbGetVersion());
|
||||
|
||||
(*pTable->insertFp)(pOper);
|
||||
|
@ -488,7 +484,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
|
|||
taosHashRemove(pTable->iHandle, key, keySize);
|
||||
atomic_sub_fetch_32(&pTable->numOfRows, 1);
|
||||
|
||||
sdbTrace("table:%s, delete record:%s from hash, numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName,
|
||||
sdbDebug("table:%s, delete record:%s from hash, numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName,
|
||||
sdbGetKeyStrFromObj(pTable, pOper->pObj), pTable->numOfRows, sdbGetVersion());
|
||||
|
||||
int8_t *updateEnd = pOper->pObj + pTable->refCountPos - 1;
|
||||
|
@ -499,7 +495,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) {
|
|||
}
|
||||
|
||||
static int32_t sdbUpdateHash(SSdbTable *pTable, SSdbOper *pOper) {
|
||||
sdbTrace("table:%s, update record:%s in hash, numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName,
|
||||
sdbDebug("table:%s, update record:%s in hash, numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName,
|
||||
sdbGetKeyStrFromObj(pTable, pOper->pObj), pTable->numOfRows, sdbGetVersion());
|
||||
|
||||
(*pTable->updateFp)(pOper);
|
||||
|
@ -525,7 +521,7 @@ static int sdbWrite(void *param, void *data, int type) {
|
|||
if (pHead->version <= tsSdbObj.version) {
|
||||
pthread_mutex_unlock(&tsSdbObj.mutex);
|
||||
if (type == TAOS_QTYPE_FWD && tsSdbObj.sync != NULL) {
|
||||
sdbTrace("forward request is received, version:%" PRIu64 " confirm it", pHead->version);
|
||||
sdbDebug("forward request is received, version:%" PRIu64 " confirm it", pHead->version);
|
||||
syncConfirmForward(tsSdbObj.sync, pHead->version, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -551,16 +547,20 @@ static int sdbWrite(void *param, void *data, int type) {
|
|||
|
||||
// from app, oper is created
|
||||
if (pOper != NULL) {
|
||||
sdbTrace("record from app is disposed, version:%" PRIu64 " result:%s", pHead->version, tstrerror(code));
|
||||
sdbTrace("record from app is disposed, table:%s action:%s record:%s version:%" PRIu64 " result:%s",
|
||||
pTable->tableName, sdbGetActionStr(action), sdbGetKeyStr(pTable, pHead->cont), pHead->version,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
// from wal or forward msg, oper not created, should add into hash
|
||||
if (tsSdbObj.sync != NULL) {
|
||||
sdbTrace("record from wal forward is disposed, version:%" PRIu64 " confirm it", pHead->version);
|
||||
sdbTrace("record from wal forward is disposed, table:%s action:%s record:%s version:%" PRIu64 " confirm it",
|
||||
pTable->tableName, sdbGetActionStr(action), sdbGetKeyStr(pTable, pHead->cont), pHead->version);
|
||||
syncConfirmForward(tsSdbObj.sync, pHead->version, code);
|
||||
} else {
|
||||
sdbTrace("record from wal restore is disposed, version:%" PRIu64 , pHead->version);
|
||||
sdbTrace("record from wal restore is disposed, table:%s action:%s record:%s version:%" PRIu64, pTable->tableName,
|
||||
sdbGetActionStr(action), sdbGetKeyStr(pTable, pHead->cont), pHead->version);
|
||||
}
|
||||
|
||||
if (action == SDB_ACTION_INSERT) {
|
||||
|
@ -626,9 +626,11 @@ int32_t sdbInsertRow(SSdbOper *pOper) {
|
|||
memcpy(pNewOper, pOper, sizeof(SSdbOper));
|
||||
|
||||
if (pNewOper->pMsg != NULL) {
|
||||
sdbTrace("app:%p:%p, insert action is add to sdb queue", pNewOper->pMsg->rpcMsg.ahandle, pNewOper->pMsg);
|
||||
sdbDebug("app:%p:%p, table:%s record:%p:%s, insert action is add to sdb queue, ", pNewOper->pMsg->rpcMsg.ahandle,
|
||||
pNewOper->pMsg, pTable->tableName, pOper->pObj, sdbGetKeyStrFromObj(pTable, pOper->pObj));
|
||||
}
|
||||
|
||||
sdbIncRef(pNewOper->table, pNewOper->pObj);
|
||||
taosWriteQitem(tsSdbWriteQueue, TAOS_QTYPE_RPC, pNewOper);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -639,7 +641,7 @@ int32_t sdbDeleteRow(SSdbOper *pOper) {
|
|||
|
||||
SSdbRow *pMeta = sdbGetRowMetaFromObj(pTable, pOper->pObj);
|
||||
if (pMeta == NULL) {
|
||||
sdbTrace("table:%s, record is not there, delete failed", pTable->tableName);
|
||||
sdbDebug("table:%s, record is not there, delete failed", pTable->tableName);
|
||||
return TSDB_CODE_MND_SDB_OBJ_NOT_THERE;
|
||||
}
|
||||
|
||||
|
@ -674,9 +676,11 @@ int32_t sdbDeleteRow(SSdbOper *pOper) {
|
|||
memcpy(pNewOper, pOper, sizeof(SSdbOper));
|
||||
|
||||
if (pNewOper->pMsg != NULL) {
|
||||
sdbTrace("app:%p:%p, delete action is add to sdb queue", pNewOper->pMsg->rpcMsg.ahandle, pNewOper->pMsg);
|
||||
sdbDebug("app:%p:%p, table:%s record:%p:%s, delete action is add to sdb queue, ", pNewOper->pMsg->rpcMsg.ahandle,
|
||||
pNewOper->pMsg, pTable->tableName, pOper->pObj, sdbGetKeyStrFromObj(pTable, pOper->pObj));
|
||||
}
|
||||
|
||||
sdbIncRef(pNewOper->table, pNewOper->pObj);
|
||||
taosWriteQitem(tsSdbWriteQueue, TAOS_QTYPE_RPC, pNewOper);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -687,7 +691,7 @@ int32_t sdbUpdateRow(SSdbOper *pOper) {
|
|||
|
||||
SSdbRow *pMeta = sdbGetRowMetaFromObj(pTable, pOper->pObj);
|
||||
if (pMeta == NULL) {
|
||||
sdbTrace("table:%s, record is not there, update failed", pTable->tableName);
|
||||
sdbDebug("table:%s, record is not there, update failed", pTable->tableName);
|
||||
return TSDB_CODE_MND_SDB_OBJ_NOT_THERE;
|
||||
}
|
||||
|
||||
|
@ -722,9 +726,11 @@ int32_t sdbUpdateRow(SSdbOper *pOper) {
|
|||
memcpy(pNewOper, pOper, sizeof(SSdbOper));
|
||||
|
||||
if (pNewOper->pMsg != NULL) {
|
||||
sdbTrace("app:%p:%p, update action is add to sdb queue", pNewOper->pMsg->rpcMsg.ahandle, pNewOper->pMsg);
|
||||
sdbDebug("app:%p:%p, table:%s record:%p:%s, update action is add to sdb queue, ", pNewOper->pMsg->rpcMsg.ahandle,
|
||||
pNewOper->pMsg, pTable->tableName, pOper->pObj, sdbGetKeyStrFromObj(pTable, pOper->pObj));
|
||||
}
|
||||
|
||||
sdbIncRef(pNewOper->table, pNewOper->pObj);
|
||||
taosWriteQitem(tsSdbWriteQueue, TAOS_QTYPE_RPC, pNewOper);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -782,7 +788,7 @@ void *sdbOpenTable(SSdbTableDesc *pDesc) {
|
|||
pTable->restoredFp = pDesc->restoredFp;
|
||||
|
||||
_hash_fn_t hashFp = taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT);
|
||||
if (pTable->keyType == SDB_KEY_STRING) {
|
||||
if (pTable->keyType == SDB_KEY_STRING || pTable->keyType == SDB_KEY_VAR_STRING) {
|
||||
hashFp = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
|
||||
}
|
||||
pTable->iHandle = taosHashInit(pTable->hashSessions, hashFp, true);
|
||||
|
@ -815,7 +821,7 @@ void sdbCloseTable(void *handle) {
|
|||
taosHashDestroyIter(pIter);
|
||||
taosHashCleanup(pTable->iHandle);
|
||||
|
||||
sdbTrace("table:%s, is closed, numOfTables:%d", pTable->tableName, tsSdbObj.numOfTables);
|
||||
sdbDebug("table:%s, is closed, numOfTables:%d", pTable->tableName, tsSdbObj.numOfTables);
|
||||
free(pTable);
|
||||
}
|
||||
|
||||
|
@ -831,7 +837,7 @@ int32_t sdbInitWriteWorker() {
|
|||
|
||||
sdbAllocWriteQueue();
|
||||
|
||||
mPrint("sdb write is opened");
|
||||
mInfo("sdb write is opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -851,8 +857,9 @@ void sdbCleanupWriteWorker() {
|
|||
}
|
||||
|
||||
sdbFreeWritequeue();
|
||||
tfree(tsSdbPool.writeWorker);
|
||||
|
||||
mPrint("sdb write is closed");
|
||||
mInfo("sdb write is closed");
|
||||
}
|
||||
|
||||
int32_t sdbAllocWriteQueue() {
|
||||
|
@ -890,10 +897,10 @@ int32_t sdbAllocWriteQueue() {
|
|||
}
|
||||
|
||||
pthread_attr_destroy(&thAttr);
|
||||
mTrace("sdb write worker:%d is launched, total:%d", pWorker->workerId, tsSdbPool.num);
|
||||
mDebug("sdb write worker:%d is launched, total:%d", pWorker->workerId, tsSdbPool.num);
|
||||
}
|
||||
|
||||
mTrace("sdb write queue:%p is allocated", tsSdbWriteQueue);
|
||||
mDebug("sdb write queue:%p is allocated", tsSdbWriteQueue);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -927,7 +934,7 @@ static void *sdbWorkerFp(void *param) {
|
|||
while (1) {
|
||||
numOfMsgs = taosReadAllQitemsFromQset(tsSdbWriteQset, tsSdbWriteQall, &unUsed);
|
||||
if (numOfMsgs == 0) {
|
||||
sdbTrace("sdbWorkerFp: got no message from qset, exiting...");
|
||||
sdbDebug("sdbWorkerFp: got no message from qset, exiting...");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -942,7 +949,9 @@ static void *sdbWorkerFp(void *param) {
|
|||
}
|
||||
|
||||
if (pOper != NULL && pOper->pMsg != NULL) {
|
||||
sdbTrace("app:%p:%p, will be processed in sdb queue", pOper->pMsg->rpcMsg.ahandle, pOper->pMsg);
|
||||
sdbDebug("app:%p:%p, table:%s record:%p:%s version:%" PRIu64 ", will be processed in sdb queue",
|
||||
pOper->pMsg->rpcMsg.ahandle, pOper->pMsg, ((SSdbTable *)pOper->table)->tableName, pOper->pObj,
|
||||
sdbGetKeyStr(pOper->table, pHead->cont), pHead->version);
|
||||
}
|
||||
|
||||
int32_t code = sdbWrite(pOper, pHead, type);
|
||||
|
@ -958,6 +967,7 @@ static void *sdbWorkerFp(void *param) {
|
|||
if (type == TAOS_QTYPE_RPC) {
|
||||
pOper = (SSdbOper *)item;
|
||||
if (pOper != NULL && pOper->cb != NULL) {
|
||||
sdbTrace("app:%p:%p, will do callback func, index:%d", pOper->pMsg->rpcMsg.ahandle, pOper->pMsg, i);
|
||||
pOper->retCode = (*pOper->cb)(pOper->pMsg, pOper->retCode);
|
||||
}
|
||||
|
||||
|
@ -967,6 +977,10 @@ static void *sdbWorkerFp(void *param) {
|
|||
}
|
||||
|
||||
dnodeSendRpcMnodeWriteRsp(pOper->pMsg, pOper->retCode);
|
||||
|
||||
if (pOper != NULL) {
|
||||
sdbDecRef(pOper->table, pOper->pObj);
|
||||
}
|
||||
}
|
||||
taosFreeQitem(item);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ int32_t mnodeInitShow() {
|
|||
|
||||
void mnodeCleanUpShow() {
|
||||
if (tsMnodeShowCache != NULL) {
|
||||
mPrint("show cache is cleanup");
|
||||
mInfo("show cache is cleanup");
|
||||
taosCacheCleanup(tsMnodeShowCache);
|
||||
tsMnodeShowCache = NULL;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
|
|||
pShowRsp->qhandle = htobe64((uint64_t) pShow);
|
||||
|
||||
int32_t code = (*tsMnodeShowMetaFp[pShowMsg->type])(&pShowRsp->tableMeta, pShow, pMsg->rpcMsg.handle);
|
||||
mTrace("%p, show type:%s index:%d, get meta finished, numOfRows:%d cols:%d result:%s", pShow,
|
||||
mDebug("%p, show type:%s index:%d, get meta finished, numOfRows:%d cols:%d result:%s", pShow,
|
||||
mnodeGetShowType(pShowMsg->type), pShow->index, pShow->numOfRows, pShow->numOfColumns, tstrerror(code));
|
||||
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
|
@ -172,11 +172,11 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
|
|||
return TSDB_CODE_MND_INVALID_SHOWOBJ;
|
||||
}
|
||||
|
||||
mTrace("%p, show type:%s index:%d, start retrieve data, numOfReads:%d numOfRows:%d", pShow,
|
||||
mDebug("%p, show type:%s index:%d, start retrieve data, numOfReads:%d numOfRows:%d", pShow,
|
||||
mnodeGetShowType(pShow->type), pShow->index, pShow->numOfReads, pShow->numOfRows);
|
||||
|
||||
if (mnodeCheckShowFinished(pShow)) {
|
||||
mTrace("%p, show is already read finished, numOfReads:%d numOfRows:%d", pShow, pShow->numOfReads, pShow->numOfRows);
|
||||
mDebug("%p, show is already read finished, numOfReads:%d numOfRows:%d", pShow, pShow->numOfReads, pShow->numOfRows);
|
||||
pShow->numOfReads = pShow->numOfRows;
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
|
|||
if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE)
|
||||
rowsRead = (*tsMnodeShowRetrieveFp[pShow->type])(pShow, pRsp->data, rowsToRead, pMsg->rpcMsg.handle);
|
||||
|
||||
mTrace("%p, show type:%s index:%d, stop retrieve data, rowsRead:%d rowsToRead:%d", pShow,
|
||||
mDebug("%p, show type:%s index:%d, stop retrieve data, rowsRead:%d rowsToRead:%d", pShow,
|
||||
mnodeGetShowType(pShow->type), pShow->index, rowsRead, rowsToRead);
|
||||
|
||||
if (rowsRead < 0) {
|
||||
|
@ -219,10 +219,10 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
if (rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) {
|
||||
pRsp->completed = 1;
|
||||
mTrace("%p, retrieve completed", pShow);
|
||||
mDebug("%p, retrieve completed", pShow);
|
||||
mnodeReleaseShowObj(pShow, true);
|
||||
} else {
|
||||
mTrace("%p, retrieve not completed yet", pShow);
|
||||
mDebug("%p, retrieve not completed yet", pShow);
|
||||
mnodeReleaseShowObj(pShow, false);
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ connect_over:
|
|||
rpcFreeCont(pConnectRsp);
|
||||
mLError("user:%s login from %s, result:%s", connInfo.user, taosIpStr(connInfo.clientIp), tstrerror(code));
|
||||
} else {
|
||||
mLPrint("user:%s login from %s, result:%s", connInfo.user, taosIpStr(connInfo.clientIp), tstrerror(code));
|
||||
mLInfo("user:%s login from %s, result:%s", connInfo.user, taosIpStr(connInfo.clientIp), tstrerror(code));
|
||||
pMsg->rpcRsp.rsp = pConnectRsp;
|
||||
pMsg->rpcRsp.len = sizeof(SCMConnectRsp);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ static bool mnodeAccquireShowObj(SShowObj *pShow) {
|
|||
|
||||
SShowObj *pSaved = taosCacheAcquireByName(tsMnodeShowCache, key);
|
||||
if (pSaved == pShow) {
|
||||
mTrace("%p, show is accquired from cache", pShow);
|
||||
mDebug("%p, show is accquired from cache", pShow);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -384,7 +384,7 @@ static void *mnodePutShowObj(SShowObj *pShow, int32_t size) {
|
|||
SShowObj *newQhandle = taosCachePut(tsMnodeShowCache, key, pShow, size, 6);
|
||||
free(pShow);
|
||||
|
||||
mTrace("%p, show is put into cache, index:%s", newQhandle, key);
|
||||
mDebug("%p, show is put into cache, index:%s", newQhandle, key);
|
||||
return newQhandle;
|
||||
}
|
||||
|
||||
|
@ -394,11 +394,11 @@ static void *mnodePutShowObj(SShowObj *pShow, int32_t size) {
|
|||
static void mnodeFreeShowObj(void *data) {
|
||||
SShowObj *pShow = data;
|
||||
sdbFreeIter(pShow->pIter);
|
||||
mTrace("%p, show is destroyed", pShow);
|
||||
mDebug("%p, show is destroyed", pShow);
|
||||
}
|
||||
|
||||
static void mnodeReleaseShowObj(void *pShow, bool forceRemove) {
|
||||
mTrace("%p, show is released, force:%s", pShow, forceRemove ? "true" : "false");
|
||||
mDebug("%p, show is released, force:%s", pShow, forceRemove ? "true" : "false");
|
||||
taosCacheRelease(tsMnodeShowCache, &pShow, forceRemove);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ static int32_t mnodeInitChildTables() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mTrace("table:ctables is created");
|
||||
mDebug("table:ctables is created");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ static int32_t mnodeInitSuperTables() {
|
|||
return -1;
|
||||
}
|
||||
|
||||
mTrace("table:stables is created");
|
||||
mDebug("table:stables is created");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -690,10 +690,10 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
|
|||
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableId);
|
||||
if (pMsg->pTable != NULL && pMsg->retry == 0) {
|
||||
if (pCreate->getMeta) {
|
||||
mTrace("app:%p:%p, table:%s, continue to get meta", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
mDebug("app:%p:%p, table:%s, continue to get meta", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
return mnodeGetChildTableMeta(pMsg);
|
||||
} else if (pCreate->igExists) {
|
||||
mTrace("app:%p:%p, table:%s, is already exist", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
mDebug("app:%p:%p, table:%s, is already exist", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
mError("app:%p:%p, table:%s, failed to create, table already exist", pMsg->rpcMsg.ahandle, pMsg,
|
||||
|
@ -703,11 +703,11 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
if (pCreate->numOfTags != 0) {
|
||||
mTrace("app:%p:%p, table:%s, create stable msg is received from thandle:%p", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, create stable msg is received from thandle:%p", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pCreate->tableId, pMsg->rpcMsg.handle);
|
||||
return mnodeProcessCreateSuperTableMsg(pMsg);
|
||||
} else {
|
||||
mTrace("app:%p:%p, table:%s, create ctable msg is received from thandle:%p", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, create ctable msg is received from thandle:%p", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pCreate->tableId, pMsg->rpcMsg.handle);
|
||||
return mnodeProcessCreateChildTableMsg(pMsg);
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
|
|||
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->tableId);
|
||||
if (pMsg->pTable == NULL) {
|
||||
if (pDrop->igNotExists) {
|
||||
mTrace("app:%p:%p, table:%s, table is not exist, think drop success", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
mDebug("app:%p:%p, table:%s, table is not exist, think drop success", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
mError("app:%p:%p, table:%s, failed to drop table, table not exist", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
|
@ -739,10 +739,10 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
if (pMsg->pTable->type == TSDB_SUPER_TABLE) {
|
||||
mPrint("app:%p:%p, table:%s, start to drop stable", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
mInfo("app:%p:%p, table:%s, start to drop stable", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
return mnodeProcessDropSuperTableMsg(pMsg);
|
||||
} else {
|
||||
mPrint("app:%p:%p, table:%s, start to drop ctable", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
mInfo("app:%p:%p, table:%s, start to drop ctable", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
return mnodeProcessDropChildTableMsg(pMsg);
|
||||
}
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
|
|||
static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) {
|
||||
SCMTableInfoMsg *pInfo = pMsg->rpcMsg.pCont;
|
||||
pInfo->createFlag = htons(pInfo->createFlag);
|
||||
mTrace("app:%p:%p, table:%s, table meta msg is received from thandle:%p, createFlag:%d", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, table meta msg is received from thandle:%p, createFlag:%d", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pInfo->tableId, pMsg->rpcMsg.handle, pInfo->createFlag);
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pInfo->tableId);
|
||||
|
@ -767,7 +767,7 @@ static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) {
|
|||
pInfo->tableId);
|
||||
return TSDB_CODE_MND_INVALID_TABLE_NAME;
|
||||
} else {
|
||||
mTrace("app:%p:%p, table:%s, failed to get table meta, start auto create table ", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, failed to get table meta, start auto create table ", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pInfo->tableId);
|
||||
return mnodeAutoCreateChildTable(pMsg);
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) {
|
|||
static int32_t mnodeCreateSuperTableCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pTable = (SSuperTableObj *)pMsg->pTable;
|
||||
if (pTable != NULL) {
|
||||
mLPrint("app:%p:%p, stable:%s, create result:%s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
|
||||
mLInfo("app:%p:%p, stable:%s, is created in sdb, result:%s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
|
||||
tstrerror(code));
|
||||
}
|
||||
|
||||
|
@ -852,6 +852,17 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t mnodeDropSuperTableCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pTable = (SSuperTableObj *)pMsg->pTable;
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
mError("app:%p:%p, table:%s, failed to drop, sdb error", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId);
|
||||
} else {
|
||||
mLInfo("app:%p:%p, stable:%s, is dropped from sdb", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId);
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
|
||||
if (pMsg == NULL) return TSDB_CODE_MND_APP_ERROR;
|
||||
|
||||
|
@ -869,7 +880,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
|
|||
pDrop->uid = htobe64(pStable->uid);
|
||||
mnodeExtractTableName(pStable->info.tableId, pDrop->tableId);
|
||||
|
||||
mPrint("app:%p:%p, stable:%s, send drop stable msg to vgId:%d", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mInfo("app:%p:%p, stable:%s, send drop stable msg to vgId:%d", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
pVgroup->vgId);
|
||||
SRpcIpSet ipSet = mnodeGetIpSetFromVgroup(pVgroup);
|
||||
SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE};
|
||||
|
@ -885,15 +896,14 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
|
|||
.type = SDB_OPER_GLOBAL,
|
||||
.table = tsSuperTableSdb,
|
||||
.pObj = pStable,
|
||||
.pMsg = pMsg
|
||||
.pMsg = pMsg,
|
||||
.cb = mnodeDropSuperTableCb
|
||||
};
|
||||
|
||||
int32_t code = sdbDeleteRow(&oper);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
mLPrint("stable:%s, is dropped from sdb, result:%s", pStable->info.tableId, tstrerror(code));
|
||||
code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -910,7 +920,7 @@ static int32_t mnodeFindSuperTableTagIndex(SSuperTableObj *pStable, const char *
|
|||
|
||||
static int32_t mnodeAddSuperTableTagCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
|
||||
mLPrint("app:%p:%p, stable %s, add tag result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mLInfo("app:%p:%p, stable %s, add tag result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
tstrerror(code));
|
||||
|
||||
return code;
|
||||
|
@ -950,7 +960,7 @@ static int32_t mnodeAddSuperTableTag(SMnodeMsg *pMsg, SSchema schema[], int32_t
|
|||
pStable->numOfTags += ntags;
|
||||
pStable->tversion++;
|
||||
|
||||
mPrint("app:%p:%p, stable %s, start to add tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mInfo("app:%p:%p, stable %s, start to add tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
schema[0].name);
|
||||
|
||||
SSdbOper oper = {
|
||||
|
@ -971,7 +981,7 @@ static int32_t mnodeAddSuperTableTag(SMnodeMsg *pMsg, SSchema schema[], int32_t
|
|||
|
||||
static int32_t mnodeDropSuperTableTagCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
|
||||
mLPrint("app:%p:%p, stable %s, drop tag result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mLInfo("app:%p:%p, stable %s, drop tag result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
@ -990,7 +1000,7 @@ static int32_t mnodeDropSuperTableTag(SMnodeMsg *pMsg, char *tagName) {
|
|||
pStable->numOfTags--;
|
||||
pStable->tversion++;
|
||||
|
||||
mPrint("app:%p:%p, stable %s, start to drop tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, tagName);
|
||||
mInfo("app:%p:%p, stable %s, start to drop tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, tagName);
|
||||
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
|
@ -1010,7 +1020,7 @@ static int32_t mnodeDropSuperTableTag(SMnodeMsg *pMsg, char *tagName) {
|
|||
|
||||
static int32_t mnodeModifySuperTableTagNameCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
|
||||
mLPrint("app:%p:%p, stable %s, modify tag result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mLInfo("app:%p:%p, stable %s, modify tag result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
@ -1038,7 +1048,7 @@ static int32_t mnodeModifySuperTableTagName(SMnodeMsg *pMsg, char *oldTagName, c
|
|||
SSchema *schema = (SSchema *) (pStable->schema + pStable->numOfColumns + col);
|
||||
tstrncpy(schema->name, newTagName, sizeof(schema->name));
|
||||
|
||||
mPrint("app:%p:%p, stable %s, start to modify tag %s to %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mInfo("app:%p:%p, stable %s, start to modify tag %s to %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
oldTagName, newTagName);
|
||||
|
||||
SSdbOper oper = {
|
||||
|
@ -1070,7 +1080,7 @@ static int32_t mnodeFindSuperTableColumnIndex(SSuperTableObj *pStable, char *col
|
|||
|
||||
static int32_t mnodeAddSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
|
||||
mLPrint("app:%p:%p, stable %s, add column result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mLInfo("app:%p:%p, stable %s, add column result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
@ -1118,7 +1128,7 @@ static int32_t mnodeAddSuperTableColumn(SMnodeMsg *pMsg, SSchema schema[], int32
|
|||
mnodeDecAcctRef(pAcct);
|
||||
}
|
||||
|
||||
mPrint("app:%p:%p, stable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId);
|
||||
mInfo("app:%p:%p, stable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId);
|
||||
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
|
@ -1138,7 +1148,7 @@ static int32_t mnodeAddSuperTableColumn(SMnodeMsg *pMsg, SSchema schema[], int32
|
|||
|
||||
static int32_t mnodeDropSuperTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
|
||||
mLPrint("app:%p:%p, stable %s, delete column result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
mLInfo("app:%p:%p, stable %s, delete column result:%s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
|
||||
tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
@ -1168,7 +1178,7 @@ static int32_t mnodeDropSuperTableColumn(SMnodeMsg *pMsg, char *colName) {
|
|||
mnodeDecAcctRef(pAcct);
|
||||
}
|
||||
|
||||
mPrint("app:%p:%p, stable %s, start to delete column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId);
|
||||
mInfo("app:%p:%p, stable %s, start to delete column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId);
|
||||
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
|
@ -1316,7 +1326,7 @@ void mnodeDropAllSuperTables(SDbObj *pDropDb) {
|
|||
int32_t dbNameLen = strlen(pDropDb->name);
|
||||
SSuperTableObj *pTable = NULL;
|
||||
|
||||
mPrint("db:%s, all super tables will be dropped from sdb", pDropDb->name);
|
||||
mInfo("db:%s, all super tables will be dropped from sdb", pDropDb->name);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextSuperTable(pIter, &pTable);
|
||||
|
@ -1337,7 +1347,7 @@ void mnodeDropAllSuperTables(SDbObj *pDropDb) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("db:%s, all super tables:%d is dropped from sdb", pDropDb->name, numOfTables);
|
||||
mInfo("db:%s, all super tables:%d is dropped from sdb", pDropDb->name, numOfTables);
|
||||
}
|
||||
|
||||
static int32_t mnodeSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTable) {
|
||||
|
@ -1373,7 +1383,7 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
|
|||
|
||||
pMsg->rpcRsp.rsp = pMeta;
|
||||
|
||||
mTrace("app:%p:%p, stable:%s, uid:%" PRIu64 " table meta is retrieved", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, stable:%s, uid:%" PRIu64 " table meta is retrieved", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pTable->info.tableId, pTable->uid);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -1410,7 +1420,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
|
|||
continue;
|
||||
}
|
||||
if (pTable->vgHash == NULL) {
|
||||
mError("app:%p:%p, stable:%s, not vgroup exist while get stable vgroup info", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mError("app:%p:%p, stable:%s, no vgroup exist while get stable vgroup info", pMsg->rpcMsg.ahandle, pMsg,
|
||||
stableName);
|
||||
mnodeDecTableRef(pTable);
|
||||
|
||||
|
@ -1470,7 +1480,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
|
|||
}
|
||||
|
||||
static void mnodeProcessDropSuperTableRsp(SRpcMsg *rpcMsg) {
|
||||
mPrint("drop stable rsp received, result:%s", tstrerror(rpcMsg->code));
|
||||
mInfo("drop stable rsp received, result:%s", tstrerror(rpcMsg->code));
|
||||
}
|
||||
|
||||
static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableObj *pTable) {
|
||||
|
@ -1549,7 +1559,7 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableO
|
|||
static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
|
||||
SChildTableObj *pTable = (SChildTableObj *)pMsg->pTable;
|
||||
if (pTable != NULL) {
|
||||
mTrace("app:%p:%p, table:%s, create table in id:%d, uid:%" PRIu64 ", result:%s", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, create table in id:%d, uid:%" PRIu64 ", result:%s", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pTable->info.tableId, pTable->sid, pTable->uid, tstrerror(code));
|
||||
}
|
||||
|
||||
|
@ -1596,19 +1606,18 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
|
|||
|
||||
if (pTable->info.type == TSDB_CHILD_TABLE) {
|
||||
STagData *pTagData = (STagData *) pCreate->schema; // it is a tag key
|
||||
SSuperTableObj *pSuperTable = mnodeGetSuperTable(pTagData->name);
|
||||
if (pSuperTable == NULL) {
|
||||
if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(pTagData->name);
|
||||
if (pMsg->pSTable == NULL) {
|
||||
mError("app:%p:%p, table:%s, corresponding super table:%s does not exist", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pCreate->tableId, pTagData->name);
|
||||
mnodeDestroyChildTable(pTable);
|
||||
return TSDB_CODE_MND_INVALID_TABLE_NAME;
|
||||
}
|
||||
mnodeDecTableRef(pSuperTable);
|
||||
|
||||
pTable->suid = pSuperTable->uid;
|
||||
pTable->suid = pMsg->pSTable->uid;
|
||||
pTable->uid = (((uint64_t)pTable->vgId) << 40) + ((((uint64_t)pTable->sid) & ((1ul << 24) - 1ul)) << 16) +
|
||||
(sdbGetVersion() & ((1ul << 16) - 1ul));
|
||||
pTable->superTable = pSuperTable;
|
||||
pTable->superTable = pMsg->pSTable;
|
||||
} else {
|
||||
pTable->uid = (((uint64_t) pTable->createdTime) << 16) + (sdbGetVersion() & ((1ul << 16) - 1ul));
|
||||
pTable->sversion = 0;
|
||||
|
@ -1640,7 +1649,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
|
|||
}
|
||||
memcpy(pTable->sql, (char *) (pCreate->schema) + numOfCols * sizeof(SSchema), pTable->sqlLen);
|
||||
pTable->sql[pTable->sqlLen - 1] = 0;
|
||||
mTrace("app:%p:%p, table:%s, stream sql len:%d sql:%s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
|
||||
mDebug("app:%p:%p, table:%s, stream sql len:%d sql:%s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
|
||||
pTable->sqlLen, pTable->sql);
|
||||
}
|
||||
}
|
||||
|
@ -1661,9 +1670,10 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
|
|||
pMsg->pTable = NULL;
|
||||
mError("app:%p:%p, table:%s, update sdb error, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
||||
tstrerror(code));
|
||||
}
|
||||
|
||||
return code;
|
||||
} else {
|
||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
|
||||
|
@ -1677,7 +1687,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
SVgObj *pVgroup = mnodeGetAvailableVgroup(pMsg->pDb);
|
||||
if (pVgroup == NULL) {
|
||||
mTrace("app:%p:%p, table:%s, start to create a new vgroup", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
mDebug("app:%p:%p, table:%s, start to create a new vgroup", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
return mnodeCreateVgroup(pMsg, pMsg->pDb);
|
||||
}
|
||||
|
||||
|
@ -1685,7 +1695,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
|
|||
if (pMsg->pTable == NULL) {
|
||||
int32_t sid = taosAllocateId(pVgroup->idPool);
|
||||
if (sid <= 0) {
|
||||
mTrace("app:%p:%p, table:%s, no enough sid in vgId:%d", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
||||
mDebug("app:%p:%p, table:%s, no enough sid in vgId:%d", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
||||
pVgroup->vgId);
|
||||
return mnodeCreateVgroup(pMsg, pMsg->pDb);
|
||||
}
|
||||
|
@ -1695,15 +1705,10 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
|
|||
mnodeIncVgroupRef(pVgroup);
|
||||
}
|
||||
|
||||
mTrace("app:%p:%p, table:%s, create table in vgroup, vgId:%d sid:%d", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
||||
mDebug("app:%p:%p, table:%s, create table in vgroup, vgId:%d sid:%d", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
||||
pVgroup->vgId, sid);
|
||||
|
||||
code = mnodeDoCreateChildTable(pMsg, sid);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
} else {
|
||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
return mnodeDoCreateChildTable(pMsg, sid);
|
||||
}
|
||||
} else {
|
||||
if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableId);
|
||||
|
@ -1714,7 +1719,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
|
|||
tstrerror(terrno));
|
||||
return terrno;
|
||||
} else {
|
||||
mTrace("app:%p:%p, table:%s, send create msg to vnode again", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
mDebug("app:%p:%p, table:%s, send create msg to vnode again", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId);
|
||||
return mnodeDoCreateChildTableCb(pMsg, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
@ -1743,7 +1748,7 @@ static int32_t mnodeProcessDropChildTableMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
SRpcIpSet ipSet = mnodeGetIpSetFromVgroup(pMsg->pVgroup);
|
||||
|
||||
mPrint("app:%p:%p, table:%s, send drop ctable msg", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
mInfo("app:%p:%p, table:%s, send drop ctable msg", pMsg->rpcMsg.ahandle, pMsg, pDrop->tableId);
|
||||
SRpcMsg rpcMsg = {
|
||||
.handle = pMsg,
|
||||
.pCont = pDrop,
|
||||
|
@ -1800,7 +1805,7 @@ static int32_t mnodeAlterNormalTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
|
|||
.msgType = TSDB_MSG_TYPE_MD_ALTER_TABLE
|
||||
};
|
||||
|
||||
mTrace("app:%p:%p, ctable %s, send alter column msg to vgId:%d", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
|
||||
mDebug("app:%p:%p, ctable %s, send alter column msg to vgId:%d", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
|
||||
pMsg->pVgroup->vgId);
|
||||
|
||||
dnodeSendMsgToDnode(&ipSet, &rpcMsg);
|
||||
|
@ -1842,7 +1847,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
|
|||
mnodeDecAcctRef(pAcct);
|
||||
}
|
||||
|
||||
mPrint("app:%p:%p, ctable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId);
|
||||
mInfo("app:%p:%p, ctable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId);
|
||||
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
|
@ -1880,7 +1885,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
|
|||
mnodeDecAcctRef(pAcct);
|
||||
}
|
||||
|
||||
mPrint("app:%p:%p, ctable %s, start to drop column %s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId, colName);
|
||||
mInfo("app:%p:%p, ctable %s, start to drop column %s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId, colName);
|
||||
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
|
@ -1952,7 +1957,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
|
|||
}
|
||||
pMeta->vgroup.vgId = htonl(pMsg->pVgroup->vgId);
|
||||
|
||||
mTrace("app:%p:%p, table:%s, uid:%" PRIu64 " table meta is retrieved", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, uid:%" PRIu64 " table meta is retrieved", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pTable->info.tableId, pTable->uid);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1978,7 +1983,7 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) {
|
|||
pCreateMsg->contLen = htonl(contLen);
|
||||
|
||||
memcpy(pCreateMsg->schema, pInfo->tags, contLen - sizeof(SCMCreateTableMsg));
|
||||
mTrace("app:%p:%p, table:%s, start to create on demand, stable:%s", pMsg->rpcMsg.ahandle, pMsg, pInfo->tableId,
|
||||
mDebug("app:%p:%p, table:%s, start to create on demand, stable:%s", pMsg->rpcMsg.ahandle, pMsg, pInfo->tableId,
|
||||
((STagData *)(pCreateMsg->schema))->name);
|
||||
|
||||
rpcFreeCont(pMsg->rpcMsg.pCont);
|
||||
|
@ -2012,7 +2017,7 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) {
|
|||
int32_t numOfTables = 0;
|
||||
SChildTableObj *pTable = NULL;
|
||||
|
||||
mPrint("vgId:%d, all child tables will be dropped from sdb", pVgroup->vgId);
|
||||
mInfo("vgId:%d, all child tables will be dropped from sdb", pVgroup->vgId);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextChildTable(pIter, &pTable);
|
||||
|
@ -2032,7 +2037,7 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("vgId:%d, all child tables is dropped from sdb", pVgroup->vgId);
|
||||
mInfo("vgId:%d, all child tables is dropped from sdb", pVgroup->vgId);
|
||||
}
|
||||
|
||||
void mnodeDropAllChildTables(SDbObj *pDropDb) {
|
||||
|
@ -2041,7 +2046,7 @@ void mnodeDropAllChildTables(SDbObj *pDropDb) {
|
|||
int32_t dbNameLen = strlen(pDropDb->name);
|
||||
SChildTableObj *pTable = NULL;
|
||||
|
||||
mPrint("db:%s, all child tables will be dropped from sdb", pDropDb->name);
|
||||
mInfo("db:%s, all child tables will be dropped from sdb", pDropDb->name);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextChildTable(pIter, &pTable);
|
||||
|
@ -2061,7 +2066,7 @@ void mnodeDropAllChildTables(SDbObj *pDropDb) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("db:%s, all child tables:%d is dropped from sdb", pDropDb->name, numOfTables);
|
||||
mInfo("db:%s, all child tables:%d is dropped from sdb", pDropDb->name, numOfTables);
|
||||
}
|
||||
|
||||
static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) {
|
||||
|
@ -2069,7 +2074,7 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) {
|
|||
int32_t numOfTables = 0;
|
||||
SChildTableObj *pTable = NULL;
|
||||
|
||||
mPrint("stable:%s, all child tables(%d) will dropped from sdb", pStable->info.tableId, numOfTables);
|
||||
mInfo("stable:%s, all child tables(%d) will dropped from sdb", pStable->info.tableId, numOfTables);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextChildTable(pIter, &pTable);
|
||||
|
@ -2090,7 +2095,7 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("stable:%s, all child tables:%d is dropped from sdb", pStable->info.tableId, numOfTables);
|
||||
mInfo("stable:%s, all child tables:%d is dropped from sdb", pStable->info.tableId, numOfTables);
|
||||
}
|
||||
|
||||
static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t sid) {
|
||||
|
@ -2109,7 +2114,7 @@ static int32_t mnodeProcessTableCfgMsg(SMnodeMsg *pMsg) {
|
|||
pCfg->dnodeId = htonl(pCfg->dnodeId);
|
||||
pCfg->vgId = htonl(pCfg->vgId);
|
||||
pCfg->sid = htonl(pCfg->sid);
|
||||
mTrace("app:%p:%p, dnode:%d, vgId:%d sid:%d, receive table config msg", pMsg->rpcMsg.ahandle, pMsg, pCfg->dnodeId,
|
||||
mDebug("app:%p:%p, dnode:%d, vgId:%d sid:%d, receive table config msg", pMsg->rpcMsg.ahandle, pMsg, pCfg->dnodeId,
|
||||
pCfg->vgId, pCfg->sid);
|
||||
|
||||
SChildTableObj *pTable = mnodeGetTableByPos(pCfg->vgId, pCfg->sid);
|
||||
|
@ -2139,7 +2144,7 @@ static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg) {
|
|||
|
||||
SChildTableObj *pTable = (SChildTableObj *)mnodeMsg->pTable;
|
||||
assert(pTable);
|
||||
mPrint("app:%p:%p, table:%s, drop table rsp received, thandle:%p result:%s", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
mInfo("app:%p:%p, table:%s, drop table rsp received, thandle:%p result:%s", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
pTable->info.tableId, mnodeMsg->rpcMsg.handle, tstrerror(rpcMsg->code));
|
||||
|
||||
if (rpcMsg->code != TSDB_CODE_SUCCESS) {
|
||||
|
@ -2170,7 +2175,7 @@ static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg) {
|
|||
}
|
||||
|
||||
if (mnodeMsg->pVgroup->numOfTables <= 0) {
|
||||
mPrint("app:%p:%p, vgId:%d, all tables is dropped, drop vgroup", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
mInfo("app:%p:%p, vgId:%d, all tables is dropped, drop vgroup", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
mnodeMsg->pVgroup->vgId);
|
||||
mnodeDropVgroup(mnodeMsg->pVgroup, NULL);
|
||||
}
|
||||
|
@ -2194,21 +2199,21 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
|
|||
if (rpcMsg->code == TSDB_CODE_SUCCESS || rpcMsg->code == TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
||||
SCMCreateTableMsg *pCreate = mnodeMsg->rpcMsg.pCont;
|
||||
if (pCreate->getMeta) {
|
||||
mTrace("app:%p:%p, table:%s, created in dnode and continue to get meta, thandle:%p result:%s",
|
||||
mDebug("app:%p:%p, table:%s, created in dnode and continue to get meta, thandle:%p result:%s",
|
||||
mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->rpcMsg.handle,
|
||||
tstrerror(rpcMsg->code));
|
||||
|
||||
mnodeMsg->retry = 0;
|
||||
dnodeReprocessMnodeWriteMsg(mnodeMsg);
|
||||
} else {
|
||||
mTrace("app:%p:%p, table:%s, created in dnode, thandle:%p result:%s", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
mDebug("app:%p:%p, table:%s, created in dnode, thandle:%p result:%s", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
pTable->info.tableId, mnodeMsg->rpcMsg.handle, tstrerror(rpcMsg->code));
|
||||
|
||||
dnodeSendRpcMnodeWriteRsp(mnodeMsg, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
} else {
|
||||
if (mnodeMsg->retry++ < 10) {
|
||||
mTrace("app:%p:%p, table:%s, create table rsp received, need retry, times:%d result:%s thandle:%p",
|
||||
mDebug("app:%p:%p, table:%s, create table rsp received, need retry, times:%d result:%s thandle:%p",
|
||||
mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->retry, tstrerror(rpcMsg->code),
|
||||
mnodeMsg->rpcMsg.handle);
|
||||
|
||||
|
@ -2235,13 +2240,13 @@ static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg) {
|
|||
assert(pTable);
|
||||
|
||||
if (rpcMsg->code == TSDB_CODE_SUCCESS || rpcMsg->code == TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
|
||||
mTrace("app:%p:%p, ctable:%s, altered in dnode, thandle:%p result:%s", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
mDebug("app:%p:%p, ctable:%s, altered in dnode, thandle:%p result:%s", mnodeMsg->rpcMsg.ahandle, mnodeMsg,
|
||||
pTable->info.tableId, mnodeMsg->rpcMsg.handle, tstrerror(rpcMsg->code));
|
||||
|
||||
dnodeSendRpcMnodeWriteRsp(mnodeMsg, TSDB_CODE_SUCCESS);
|
||||
} else {
|
||||
if (mnodeMsg->retry++ < 3) {
|
||||
mTrace("app:%p:%p, table:%s, alter table rsp received, need retry, times:%d result:%s thandle:%p",
|
||||
mDebug("app:%p:%p, table:%s, alter table rsp received, need retry, times:%d result:%s thandle:%p",
|
||||
mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->retry, tstrerror(rpcMsg->code),
|
||||
mnodeMsg->rpcMsg.handle);
|
||||
|
||||
|
@ -2434,7 +2439,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
|
|||
|
||||
static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
|
||||
SCMAlterTableMsg *pAlter = pMsg->rpcMsg.pCont;
|
||||
mTrace("app:%p:%p, table:%s, alter table msg is received from thandle:%p", pMsg->rpcMsg.ahandle, pMsg,
|
||||
mDebug("app:%p:%p, table:%s, alter table msg is received from thandle:%p", pMsg->rpcMsg.ahandle, pMsg,
|
||||
pAlter->tableId, pMsg->rpcMsg.handle);
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pAlter->tableId);
|
||||
|
@ -2470,7 +2475,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
int32_t code = TSDB_CODE_COM_OPS_NOT_SUPPORT;
|
||||
if (pMsg->pTable->type == TSDB_SUPER_TABLE) {
|
||||
mTrace("app:%p:%p, table:%s, start to alter stable", pMsg->rpcMsg.ahandle, pMsg, pAlter->tableId);
|
||||
mDebug("app:%p:%p, table:%s, start to alter stable", pMsg->rpcMsg.ahandle, pMsg, pAlter->tableId);
|
||||
if (pAlter->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) {
|
||||
code = mnodeAddSuperTableTag(pMsg, pAlter->schema, 1);
|
||||
} else if (pAlter->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN) {
|
||||
|
@ -2484,7 +2489,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
|
|||
} else {
|
||||
}
|
||||
} else {
|
||||
mTrace("app:%p:%p, table:%s, start to alter ctable", pMsg->rpcMsg.ahandle, pMsg, pAlter->tableId);
|
||||
mDebug("app:%p:%p, table:%s, start to alter ctable", pMsg->rpcMsg.ahandle, pMsg, pAlter->tableId);
|
||||
if (pAlter->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) {
|
||||
return TSDB_CODE_COM_OPS_NOT_SUPPORT;
|
||||
} else if (pAlter->type == TSDB_ALTER_TABLE_ADD_COLUMN) {
|
||||
|
|
|
@ -104,7 +104,7 @@ static int32_t mnodeUserActionDecode(SSdbOper *pOper) {
|
|||
static int32_t mnodeUserActionRestored() {
|
||||
int32_t numOfRows = sdbGetNumOfRows(tsUserSdb);
|
||||
if (numOfRows <= 0 && dnodeIsFirstDeploy()) {
|
||||
mPrint("dnode first deploy, create root user");
|
||||
mInfo("dnode first deploy, create root user");
|
||||
SAcctObj *pAcct = mnodeGetAcct(TSDB_DEFAULT_USER);
|
||||
mnodeCreateUser(pAcct, TSDB_DEFAULT_USER, TSDB_DEFAULT_PASS, NULL);
|
||||
mnodeCreateUser(pAcct, "monitor", tsInternalPass, NULL);
|
||||
|
@ -148,7 +148,7 @@ int32_t mnodeInitUsers() {
|
|||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_USER, mnodeRetrieveUsers);
|
||||
mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_AUTH, mnodeProcessAuthMsg);
|
||||
|
||||
mTrace("table:%s, hash is created", tableDesc.tableName);
|
||||
mDebug("table:%s, hash is created", tableDesc.tableName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ static int32_t mnodeUpdateUser(SUserObj *pUser, void *pMsg) {
|
|||
|
||||
int32_t code = sdbUpdateRow(&oper);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
mLPrint("user:%s, is altered by %s", pUser->user, mnodeGetUserFromMsg(pMsg));
|
||||
mLInfo("user:%s, is altered by %s", pUser->user, mnodeGetUserFromMsg(pMsg));
|
||||
if (pMsg != NULL) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
|
|||
|
||||
SUserObj *pUser = mnodeGetUser(name);
|
||||
if (pUser != NULL) {
|
||||
mTrace("user:%s, is already there", name);
|
||||
mDebug("user:%s, is already there", name);
|
||||
mnodeDecUserRef(pUser);
|
||||
return TSDB_CODE_MND_USER_ALREADY_EXIST;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
|
|||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tfree(pUser);
|
||||
} else {
|
||||
mLPrint("user:%s, is created by %s", pUser->user, mnodeGetUserFromMsg(pMsg));
|
||||
mLInfo("user:%s, is created by %s", pUser->user, mnodeGetUserFromMsg(pMsg));
|
||||
if (pMsg != NULL) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ static int32_t mnodeDropUser(SUserObj *pUser, void *pMsg) {
|
|||
|
||||
int32_t code = sdbDeleteRow(&oper);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
mLPrint("user:%s, is dropped by %s", pUser->user, mnodeGetUserFromMsg(pMsg));
|
||||
mLInfo("user:%s, is dropped by %s", pUser->user, mnodeGetUserFromMsg(pMsg));
|
||||
if (pMsg != NULL) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
||||
|
@ -541,13 +541,13 @@ void mnodeDropAllUsers(SAcctObj *pAcct) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers);
|
||||
mDebug("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers);
|
||||
}
|
||||
|
||||
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
|
||||
if (!sdbIsMaster()) {
|
||||
*secret = 0;
|
||||
mTrace("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_RPC_NOT_READY));
|
||||
mDebug("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_RPC_NOT_READY));
|
||||
return TSDB_CODE_RPC_NOT_READY;
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, cha
|
|||
|
||||
memcpy(secret, pUser->pass, TSDB_KEY_LEN);
|
||||
mnodeDecUserRef(pUser);
|
||||
mTrace("user:%s, auth info is returned", user);
|
||||
mDebug("user:%s, auth info is returned", user);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ static void mnodeVgroupUpdateIdPool(SVgObj *pVgroup) {
|
|||
SDbObj *pDb = pVgroup->pDb;
|
||||
if (pDb != NULL) {
|
||||
if (pDb->cfg.maxTables != oldTables) {
|
||||
mPrint("vgId:%d tables change from %d to %d", pVgroup->vgId, oldTables, pDb->cfg.maxTables);
|
||||
mInfo("vgId:%d tables change from %d to %d", pVgroup->vgId, oldTables, pDb->cfg.maxTables);
|
||||
taosUpdateIdPool(pVgroup->idPool, pDb->cfg.maxTables);
|
||||
int32_t size = sizeof(SChildTableObj *) * pDb->cfg.maxTables;
|
||||
pVgroup->tableList = (SChildTableObj **)realloc(pVgroup->tableList, size);
|
||||
|
@ -166,7 +166,7 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) {
|
|||
|
||||
mnodeDecVgroupRef(pVgroup);
|
||||
|
||||
mTrace("vgId:%d, is updated, numOfVnode:%d", pVgroup->vgId, pVgroup->numOfVnodes);
|
||||
mDebug("vgId:%d, is updated, numOfVnode:%d", pVgroup->vgId, pVgroup->numOfVnodes);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ int32_t mnodeInitVgroups() {
|
|||
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mnodeProcessDropVnodeRsp);
|
||||
mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mnodeProcessVnodeCfgMsg);
|
||||
|
||||
mTrace("table:vgroups is created");
|
||||
mDebug("table:vgroups is created");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -342,9 +342,9 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) {
|
|||
SVgObj *pVgroup = pMsg->pVgroup;
|
||||
SDbObj *pDb = pMsg->pDb;
|
||||
|
||||
mPrint("vgId:%d, is created in mnode, db:%s replica:%d", pVgroup->vgId, pDb->name, pVgroup->numOfVnodes);
|
||||
mInfo("vgId:%d, is created in mnode, db:%s replica:%d", pVgroup->vgId, pDb->name, pVgroup->numOfVnodes);
|
||||
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
||||
mPrint("vgId:%d, index:%d, dnode:%d", pVgroup->vgId, i, pVgroup->vnodeGid[i].dnodeId);
|
||||
mInfo("vgId:%d, index:%d, dnode:%d", pVgroup->vgId, i, pVgroup->vnodeGid[i].dnodeId);
|
||||
}
|
||||
|
||||
mnodeIncVgroupRef(pVgroup);
|
||||
|
@ -394,7 +394,7 @@ void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle) {
|
|||
if (ahandle != NULL) {
|
||||
mnodeSendDropVgroupMsg(pVgroup, ahandle);
|
||||
} else {
|
||||
mTrace("vgId:%d, replica:%d is deleting from sdb", pVgroup->vgId, pVgroup->numOfVnodes);
|
||||
mDebug("vgId:%d, replica:%d is deleting from sdb", pVgroup->vgId, pVgroup->numOfVnodes);
|
||||
mnodeSendDropVgroupMsg(pVgroup, NULL);
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_GLOBAL,
|
||||
|
@ -662,11 +662,11 @@ void mnodeSendCreateVnodeMsg(SVgObj *pVgroup, SRpcIpSet *ipSet, void *ahandle) {
|
|||
}
|
||||
|
||||
void mnodeSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle) {
|
||||
mTrace("vgId:%d, send create all vnodes msg, numOfVnodes:%d db:%s", pVgroup->vgId, pVgroup->numOfVnodes,
|
||||
mDebug("vgId:%d, send create all vnodes msg, numOfVnodes:%d db:%s", pVgroup->vgId, pVgroup->numOfVnodes,
|
||||
pVgroup->dbName);
|
||||
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
||||
SRpcIpSet ipSet = mnodeGetIpSetFromIp(pVgroup->vnodeGid[i].pDnode->dnodeEp);
|
||||
mTrace("vgId:%d, index:%d, send create vnode msg to dnode %s, ahandle:%p", pVgroup->vgId,
|
||||
mDebug("vgId:%d, index:%d, send create vnode msg to dnode %s, ahandle:%p", pVgroup->vgId,
|
||||
i, pVgroup->vnodeGid[i].pDnode->dnodeEp, ahandle);
|
||||
mnodeSendCreateVnodeMsg(pVgroup, &ipSet, ahandle);
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
|
|||
}
|
||||
|
||||
SVgObj *pVgroup = mnodeMsg->pVgroup;
|
||||
mTrace("vgId:%d, create vnode rsp received, result:%s received:%d successed:%d expected:%d, thandle:%p ahandle:%p",
|
||||
mDebug("vgId:%d, create vnode rsp received, result:%s received:%d successed:%d expected:%d, thandle:%p ahandle:%p",
|
||||
pVgroup->vgId, tstrerror(rpcMsg->code), mnodeMsg->received, mnodeMsg->successed, mnodeMsg->expected,
|
||||
mnodeMsg->rpcMsg.handle, rpcMsg->handle);
|
||||
|
||||
|
@ -728,16 +728,16 @@ void mnodeSendDropVnodeMsg(int32_t vgId, SRpcIpSet *ipSet, void *ahandle) {
|
|||
}
|
||||
|
||||
static void mnodeSendDropVgroupMsg(SVgObj *pVgroup, void *ahandle) {
|
||||
mTrace("vgId:%d, send drop all vnodes msg, ahandle:%p", pVgroup->vgId, ahandle);
|
||||
mDebug("vgId:%d, send drop all vnodes msg, ahandle:%p", pVgroup->vgId, ahandle);
|
||||
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
||||
SRpcIpSet ipSet = mnodeGetIpSetFromIp(pVgroup->vnodeGid[i].pDnode->dnodeEp);
|
||||
mTrace("vgId:%d, send drop vnode msg to dnode:%d, ahandle:%p", pVgroup->vgId, pVgroup->vnodeGid[i].dnodeId, ahandle);
|
||||
mDebug("vgId:%d, send drop vnode msg to dnode:%d, ahandle:%p", pVgroup->vgId, pVgroup->vnodeGid[i].dnodeId, ahandle);
|
||||
mnodeSendDropVnodeMsg(pVgroup->vgId, &ipSet, ahandle);
|
||||
}
|
||||
}
|
||||
|
||||
static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) {
|
||||
mTrace("drop vnode rsp is received, handle:%p", rpcMsg->handle);
|
||||
mDebug("drop vnode rsp is received, handle:%p", rpcMsg->handle);
|
||||
if (rpcMsg->handle == NULL) return;
|
||||
|
||||
SMnodeMsg *mnodeMsg = rpcMsg->handle;
|
||||
|
@ -748,7 +748,7 @@ static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) {
|
|||
}
|
||||
|
||||
SVgObj *pVgroup = mnodeMsg->pVgroup;
|
||||
mTrace("vgId:%d, drop vnode rsp received, result:%s received:%d successed:%d expected:%d, thandle:%p ahandle:%p",
|
||||
mDebug("vgId:%d, drop vnode rsp received, result:%s received:%d successed:%d expected:%d, thandle:%p ahandle:%p",
|
||||
pVgroup->vgId, tstrerror(rpcMsg->code), mnodeMsg->received, mnodeMsg->successed, mnodeMsg->expected,
|
||||
mnodeMsg->rpcMsg.handle, rpcMsg->handle);
|
||||
|
||||
|
@ -774,19 +774,19 @@ static int32_t mnodeProcessVnodeCfgMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
SDnodeObj *pDnode = mnodeGetDnode(pCfg->dnodeId);
|
||||
if (pDnode == NULL) {
|
||||
mTrace("dnode:%s, vgId:%d, invalid dnode", taosIpStr(pCfg->dnodeId), pCfg->vgId);
|
||||
mDebug("dnode:%s, vgId:%d, invalid dnode", taosIpStr(pCfg->dnodeId), pCfg->vgId);
|
||||
return TSDB_CODE_MND_VGROUP_NOT_EXIST;
|
||||
}
|
||||
mnodeDecDnodeRef(pDnode);
|
||||
|
||||
SVgObj *pVgroup = mnodeGetVgroup(pCfg->vgId);
|
||||
if (pVgroup == NULL) {
|
||||
mTrace("dnode:%s, vgId:%d, no vgroup info", taosIpStr(pCfg->dnodeId), pCfg->vgId);
|
||||
mDebug("dnode:%s, vgId:%d, no vgroup info", taosIpStr(pCfg->dnodeId), pCfg->vgId);
|
||||
return TSDB_CODE_MND_VGROUP_NOT_EXIST;
|
||||
}
|
||||
mnodeDecVgroupRef(pVgroup);
|
||||
|
||||
mTrace("vgId:%d, send create vnode msg to dnode %s for vnode cfg msg", pVgroup->vgId, pDnode->dnodeEp);
|
||||
mDebug("vgId:%d, send create vnode msg to dnode %s for vnode cfg msg", pVgroup->vgId, pDnode->dnodeEp);
|
||||
SRpcIpSet ipSet = mnodeGetIpSetFromIp(pDnode->dnodeEp);
|
||||
mnodeSendCreateVnodeMsg(pVgroup, &ipSet, NULL);
|
||||
|
||||
|
@ -798,7 +798,7 @@ void mnodeDropAllDnodeVgroups(SDnodeObj *pDropDnode) {
|
|||
SVgObj *pVgroup = NULL;
|
||||
int32_t numOfVgroups = 0;
|
||||
|
||||
mPrint("dnode:%d, all vgroups will be dropped from sdb", pDropDnode->dnodeId);
|
||||
mInfo("dnode:%d, all vgroups will be dropped from sdb", pDropDnode->dnodeId);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextVgroup(pIter, &pVgroup);
|
||||
|
@ -819,14 +819,14 @@ void mnodeDropAllDnodeVgroups(SDnodeObj *pDropDnode) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("dnode:%d, all vgroups is dropped from sdb", pDropDnode->dnodeId);
|
||||
mInfo("dnode:%d, all vgroups is dropped from sdb", pDropDnode->dnodeId);
|
||||
}
|
||||
|
||||
void mnodeUpdateAllDbVgroups(SDbObj *pAlterDb) {
|
||||
void * pIter = NULL;
|
||||
SVgObj *pVgroup = NULL;
|
||||
|
||||
mPrint("db:%s, all vgroups will be update in sdb", pAlterDb->name);
|
||||
mInfo("db:%s, all vgroups will be update in sdb", pAlterDb->name);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextVgroup(pIter, &pVgroup);
|
||||
|
@ -841,7 +841,7 @@ void mnodeUpdateAllDbVgroups(SDbObj *pAlterDb) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("db:%s, all vgroups is updated in sdb", pAlterDb->name);
|
||||
mInfo("db:%s, all vgroups is updated in sdb", pAlterDb->name);
|
||||
}
|
||||
|
||||
void mnodeDropAllDbVgroups(SDbObj *pDropDb) {
|
||||
|
@ -849,7 +849,7 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb) {
|
|||
int32_t numOfVgroups = 0;
|
||||
SVgObj *pVgroup = NULL;
|
||||
|
||||
mPrint("db:%s, all vgroups will be dropped from sdb", pDropDb->name);
|
||||
mInfo("db:%s, all vgroups will be dropped from sdb", pDropDb->name);
|
||||
while (1) {
|
||||
pIter = mnodeGetNextVgroup(pIter, &pVgroup);
|
||||
if (pVgroup == NULL) break;
|
||||
|
@ -869,7 +869,7 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("db:%s, all vgroups:%d is dropped from sdb", pDropDb->name, numOfVgroups);
|
||||
mInfo("db:%s, all vgroups:%d is dropped from sdb", pDropDb->name, numOfVgroups);
|
||||
}
|
||||
|
||||
void mnodeSendDropAllDbVgroupsMsg(SDbObj *pDropDb) {
|
||||
|
@ -877,7 +877,7 @@ void mnodeSendDropAllDbVgroupsMsg(SDbObj *pDropDb) {
|
|||
int32_t numOfVgroups = 0;
|
||||
SVgObj *pVgroup = NULL;
|
||||
|
||||
mPrint("db:%s, all vgroups will be dropped in dnode", pDropDb->name);
|
||||
mInfo("db:%s, all vgroups will be dropped in dnode", pDropDb->name);
|
||||
while (1) {
|
||||
pIter = mnodeGetNextVgroup(pIter, &pVgroup);
|
||||
if (pVgroup == NULL) break;
|
||||
|
@ -891,5 +891,5 @@ void mnodeSendDropAllDbVgroupsMsg(SDbObj *pDropDb) {
|
|||
|
||||
sdbFreeIter(pIter);
|
||||
|
||||
mPrint("db:%s, all vgroups:%d drop msg is sent to dnode", pDropDb->name, numOfVgroups);
|
||||
mInfo("db:%s, all vgroups:%d drop msg is sent to dnode", pDropDb->name, numOfVgroups);
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
|
|||
rpcRsp->rsp = ipSet;
|
||||
rpcRsp->len = sizeof(SRpcIpSet);
|
||||
|
||||
mTrace("app:%p:%p, msg:%s will be redireced inUse:%d", pMsg->rpcMsg.ahandle, pMsg, taosMsg[pMsg->rpcMsg.msgType],
|
||||
mDebug("app:%p:%p, msg:%s will be redireced inUse:%d", pMsg->rpcMsg.ahandle, pMsg, taosMsg[pMsg->rpcMsg.msgType],
|
||||
ipSet->inUse);
|
||||
for (int32_t i = 0; i < ipSet->numOfIps; ++i) {
|
||||
mTrace("app:%p:%p, mnode index:%d ip:%s:%d", pMsg->rpcMsg.ahandle, pMsg, i, ipSet->fqdn[i],
|
||||
mDebug("app:%p:%p, mnode index:%d ip:%s:%d", pMsg->rpcMsg.ahandle, pMsg, i, ipSet->fqdn[i],
|
||||
htons(ipSet->port[i]));
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ int taosGetPrivateIp(char *const ip) {
|
|||
return 0;
|
||||
} else {
|
||||
if (hasLoCard) {
|
||||
uPrint("no net card was found, use lo:127.0.0.1 as default");
|
||||
uInfo("no net card was found, use lo:127.0.0.1 as default");
|
||||
strcpy(ip, "127.0.0.1");
|
||||
return 0;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ void taosGetSystemTimezone() {
|
|||
strcpy(tsTimezone, tz);
|
||||
}
|
||||
cfg_timezone->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("timezone not configured, use default");
|
||||
uInfo("timezone not configured, use default");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ void taosGetSystemLocale() {
|
|||
if (locale != NULL) {
|
||||
tstrncpy(tsLocale, locale, sizeof(tsLocale));
|
||||
cfg_locale->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("locale not configured, set to default:%s", tsLocale);
|
||||
uInfo("locale not configured, set to default:%s", tsLocale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ void taosGetSystemLocale() {
|
|||
if (cfg_charset && cfg_charset->cfgStatus < TAOS_CFG_CSTATUS_DEFAULT) {
|
||||
strcpy(tsCharset, "cp936");
|
||||
cfg_charset->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("charset not configured, set to default:%s", tsCharset);
|
||||
uInfo("charset not configured, set to default:%s", tsCharset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ static void taosGetSystemTimezone() {
|
|||
sprintf(tsTimezone, "%s (%s, %s%02d00)", buf, tzname[daylight], tz >= 0 ? "+" : "-", abs(tz));
|
||||
|
||||
// cfg_timezone->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("timezone not configured, set to system default:%s", tsTimezone);
|
||||
uInfo("timezone not configured, set to system default:%s", tsTimezone);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -410,7 +410,7 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
|
|||
double totalBytes = (double)(curBytes - lastBytes) / 1024 * 8; // Kb
|
||||
*bandSpeedKb = (float)(totalBytes / (double)(curTime - lastTime));
|
||||
|
||||
// uPrint("bandwidth lastBytes:%ld, lastTime:%ld, curBytes:%ld, curTime:%ld,
|
||||
// uInfo("bandwidth lastBytes:%ld, lastTime:%ld, curBytes:%ld, curTime:%ld,
|
||||
// speed:%f", lastBytes, lastTime, curBytes, curTime, *bandSpeed);
|
||||
|
||||
lastTime = curTime;
|
||||
|
@ -516,29 +516,29 @@ void taosGetSystemInfo() {
|
|||
}
|
||||
|
||||
void taosPrintOsInfo() {
|
||||
uPrint(" os pageSize: %" PRId64 "(KB)", tsPageSize);
|
||||
uPrint(" os openMax: %" PRId64, tsOpenMax);
|
||||
uPrint(" os streamMax: %" PRId64, tsStreamMax);
|
||||
uPrint(" os numOfCores: %d", tsNumOfCores);
|
||||
uPrint(" os totalDisk: %f(GB)", tsTotalDataDirGB);
|
||||
uPrint(" os totalMemory: %d(MB)", tsTotalMemoryMB);
|
||||
uInfo(" os pageSize: %" PRId64 "(KB)", tsPageSize);
|
||||
uInfo(" os openMax: %" PRId64, tsOpenMax);
|
||||
uInfo(" os streamMax: %" PRId64, tsStreamMax);
|
||||
uInfo(" os numOfCores: %d", tsNumOfCores);
|
||||
uInfo(" os totalDisk: %f(GB)", tsTotalDataDirGB);
|
||||
uInfo(" os totalMemory: %d(MB)", tsTotalMemoryMB);
|
||||
|
||||
struct utsname buf;
|
||||
if (uname(&buf)) {
|
||||
uPrint(" can't fetch os info");
|
||||
uInfo(" can't fetch os info");
|
||||
return;
|
||||
}
|
||||
uPrint(" os sysname: %s", buf.sysname);
|
||||
uPrint(" os nodename: %s", buf.nodename);
|
||||
uPrint(" os release: %s", buf.release);
|
||||
uPrint(" os version: %s", buf.version);
|
||||
uPrint(" os machine: %s", buf.machine);
|
||||
uPrint("==================================");
|
||||
uInfo(" os sysname: %s", buf.sysname);
|
||||
uInfo(" os nodename: %s", buf.nodename);
|
||||
uInfo(" os release: %s", buf.release);
|
||||
uInfo(" os version: %s", buf.version);
|
||||
uInfo(" os machine: %s", buf.machine);
|
||||
uInfo("==================================");
|
||||
}
|
||||
|
||||
void taosKillSystem() {
|
||||
// SIGINT
|
||||
uPrint("taosd will shut down soon");
|
||||
uInfo("taosd will shut down soon");
|
||||
kill(tsProcId, 2);
|
||||
}
|
||||
|
||||
|
@ -552,11 +552,11 @@ void taosSetCoreDump() {
|
|||
struct rlimit rlim;
|
||||
struct rlimit rlim_new;
|
||||
if (getrlimit(RLIMIT_CORE, &rlim) == 0) {
|
||||
uPrint("the old unlimited para: rlim_cur=%" PRIu64 ", rlim_max=%" PRIu64, rlim.rlim_cur, rlim.rlim_max);
|
||||
uInfo("the old unlimited para: rlim_cur=%" PRIu64 ", rlim_max=%" PRIu64, rlim.rlim_cur, rlim.rlim_max);
|
||||
rlim_new.rlim_cur = RLIM_INFINITY;
|
||||
rlim_new.rlim_max = RLIM_INFINITY;
|
||||
if (setrlimit(RLIMIT_CORE, &rlim_new) != 0) {
|
||||
uPrint("set unlimited fail, error: %s", strerror(errno));
|
||||
uInfo("set unlimited fail, error: %s", strerror(errno));
|
||||
rlim_new.rlim_cur = rlim.rlim_max;
|
||||
rlim_new.rlim_max = rlim.rlim_max;
|
||||
(void)setrlimit(RLIMIT_CORE, &rlim_new);
|
||||
|
@ -564,7 +564,7 @@ void taosSetCoreDump() {
|
|||
}
|
||||
|
||||
if (getrlimit(RLIMIT_CORE, &rlim) == 0) {
|
||||
uPrint("the new unlimited para: rlim_cur=%" PRIu64 ", rlim_max=%" PRIu64, rlim.rlim_cur, rlim.rlim_max);
|
||||
uInfo("the new unlimited para: rlim_cur=%" PRIu64 ", rlim_max=%" PRIu64, rlim.rlim_cur, rlim.rlim_max);
|
||||
}
|
||||
|
||||
#ifndef _TD_ARM_
|
||||
|
@ -588,10 +588,10 @@ void taosSetCoreDump() {
|
|||
old_len = sizeof(old_usespid);
|
||||
|
||||
if (syscall(SYS__sysctl, &args) == -1) {
|
||||
uPrint("_sysctl(kern_core_uses_pid) set fail: %s", strerror(errno));
|
||||
uInfo("_sysctl(kern_core_uses_pid) set fail: %s", strerror(errno));
|
||||
}
|
||||
|
||||
uPrint("The old core_uses_pid[%" PRIu64 "]: %d", old_len, old_usespid);
|
||||
uInfo("The old core_uses_pid[%" PRIu64 "]: %d", old_len, old_usespid);
|
||||
|
||||
|
||||
old_usespid = 0;
|
||||
|
@ -605,10 +605,10 @@ void taosSetCoreDump() {
|
|||
old_len = sizeof(old_usespid);
|
||||
|
||||
if (syscall(SYS__sysctl, &args) == -1) {
|
||||
uPrint("_sysctl(kern_core_uses_pid) get fail: %s", strerror(errno));
|
||||
uInfo("_sysctl(kern_core_uses_pid) get fail: %s", strerror(errno));
|
||||
}
|
||||
|
||||
uPrint("The new core_uses_pid[%" PRIu64 "]: %d", old_len, old_usespid);
|
||||
uInfo("The new core_uses_pid[%" PRIu64 "]: %d", old_len, old_usespid);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
@ -618,7 +618,7 @@ void taosSetCoreDump() {
|
|||
if (opendir(coredump_dir) == NULL) {
|
||||
status = mkdir(coredump_dir, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (status) {
|
||||
uPrint("mkdir fail, error: %s\n", strerror(errno));
|
||||
uInfo("mkdir fail, error: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,10 +642,10 @@ void taosSetCoreDump() {
|
|||
old_len = sizeof(old_corefile);
|
||||
|
||||
if (syscall(SYS__sysctl, &args) == -1) {
|
||||
uPrint("_sysctl(kern_core_pattern) set fail: %s", strerror(errno));
|
||||
uInfo("_sysctl(kern_core_pattern) set fail: %s", strerror(errno));
|
||||
}
|
||||
|
||||
uPrint("The old kern_core_pattern: %*s\n", old_len, old_corefile);
|
||||
uInfo("The old kern_core_pattern: %*s\n", old_len, old_corefile);
|
||||
|
||||
|
||||
memset(&args, 0, sizeof(struct __sysctl_args));
|
||||
|
@ -657,10 +657,10 @@ void taosSetCoreDump() {
|
|||
old_len = sizeof(old_corefile);
|
||||
|
||||
if (syscall(SYS__sysctl, &args) == -1) {
|
||||
uPrint("_sysctl(kern_core_pattern) get fail: %s", strerror(errno));
|
||||
uInfo("_sysctl(kern_core_pattern) get fail: %s", strerror(errno));
|
||||
}
|
||||
|
||||
uPrint("The new kern_core_pattern: %*s\n", old_len, old_corefile);
|
||||
uInfo("The new kern_core_pattern: %*s\n", old_len, old_corefile);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ void taosGetSystemTimezone() {
|
|||
strcpy(tsTimezone, tz);
|
||||
}
|
||||
cfg_timezone->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("timezone not configured, use default");
|
||||
uInfo("timezone not configured, use default");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void taosGetSystemLocale() {
|
|||
if (locale != NULL) {
|
||||
tstrncpy(tsLocale, locale, sizeof(tsLocale));
|
||||
cfg_locale->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("locale not configured, set to default:%s", tsLocale);
|
||||
uInfo("locale not configured, set to default:%s", tsLocale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ void taosGetSystemLocale() {
|
|||
if (cfg_charset && cfg_charset->cfgStatus < TAOS_CFG_CSTATUS_DEFAULT) {
|
||||
strcpy(tsCharset, "cp936");
|
||||
cfg_charset->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
|
||||
uPrint("charset not configured, set to default:%s", tsCharset);
|
||||
uInfo("charset not configured, set to default:%s", tsCharset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,14 @@
|
|||
|
||||
extern int32_t httpDebugFlag;
|
||||
|
||||
#define httpError(...) { if (httpDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR HTP ", 255, __VA_ARGS__); }}
|
||||
#define httpWarn(...) { if (httpDebugFlag & DEBUG_WARN) { taosPrintLog("WARN HTP ", httpDebugFlag, __VA_ARGS__); }}
|
||||
#define httpTrace(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLog("HTP ", httpDebugFlag, __VA_ARGS__); }}
|
||||
#define httpDump(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLongString("HTP ", httpDebugFlag, __VA_ARGS__); }}
|
||||
#define httpPrint(...) { taosPrintLog("HTP ", 255, __VA_ARGS__); }
|
||||
#define httpFatal(...) { if (httpDebugFlag & DEBUG_FATAL) { taosPrintLog("HTP FATAL ", 255, __VA_ARGS__); }}
|
||||
#define httpError(...) { if (httpDebugFlag & DEBUG_ERROR) { taosPrintLog("HTP ERROR ", 255, __VA_ARGS__); }}
|
||||
#define httpWarn(...) { if (httpDebugFlag & DEBUG_WARN) { taosPrintLog("HTP WARN ", 255, __VA_ARGS__); }}
|
||||
#define httpInfo(...) { if (httpDebugFlag & DEBUG_INFO) { taosPrintLog("HTP INFO ", 255, __VA_ARGS__); }}
|
||||
#define httpDebug(...) { if (httpDebugFlag & DEBUG_DEBUG) { taosPrintLog("HTP DEBUG ", httpDebugFlag, __VA_ARGS__); }}
|
||||
#define httpTrace(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLog("HTP TRACE ", httpDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define httpDebugDump(...) { if (httpDebugFlag & DEBUG_DEBUG) { taosPrintLongString("HTP DEBUG ", httpDebugFlag, __VA_ARGS__); }}
|
||||
#define httpTraceDump(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLongString("HTP TRACE ", httpDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -67,7 +67,7 @@ bool gcGetPassFromUrl(HttpContext* pContext) {
|
|||
}
|
||||
|
||||
bool gcProcessLoginRequest(HttpContext* pContext) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process grafana login msg", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process grafana login msg", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
pContext->reqType = HTTP_REQTYPE_LOGIN;
|
||||
return true;
|
||||
|
@ -143,7 +143,7 @@ bool gcProcessLoginRequest(HttpContext* pContext) {
|
|||
//}]
|
||||
|
||||
bool gcProcessQueryRequest(HttpContext* pContext) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, process grafana query msg", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, process grafana query msg", pContext, pContext->fd, pContext->ipstr);
|
||||
|
||||
HttpParser* pParser = &pContext->parser;
|
||||
char* filter = pParser->data.pos;
|
||||
|
@ -183,7 +183,7 @@ bool gcProcessQueryRequest(HttpContext* pContext) {
|
|||
|
||||
cJSON* refId = cJSON_GetObjectItem(query, "refId");
|
||||
if (refId == NULL || refId->valuestring == NULL || strlen(refId->valuestring) == 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, refId is null", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, refId is null", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
continue;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ bool gcProcessQueryRequest(HttpContext* pContext) {
|
|||
|
||||
cJSON* sql = cJSON_GetObjectItem(query, "sql");
|
||||
if (sql == NULL || sql->valuestring == NULL || strlen(sql->valuestring) == 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, sql is null", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, sql is null", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
continue;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ bool gcProcessQueryRequest(HttpContext* pContext) {
|
|||
}
|
||||
|
||||
bool gcProcessHeartbeatRequest(HttpContext* pContext) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, process grafana heartbeat msg", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, process grafana heartbeat msg", pContext, pContext->fd, pContext->ipstr);
|
||||
pContext->reqType = HTTP_REQTYPE_HEARTBEAT;
|
||||
pContext->encodeMethod = &gcHeartBeatMethod;
|
||||
return true;
|
||||
|
|
|
@ -63,7 +63,7 @@ bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int len) {
|
|||
pContext->pass[pass_len] = 0;
|
||||
|
||||
free(base64);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, basic token parsed success, user:%s", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, basic token parsed success, user:%s", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
return true;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int len) {
|
|||
tstrncpy(pContext->user, descrypt, sizeof(pContext->user));
|
||||
tstrncpy(pContext->pass, descrypt + TSDB_USER_LEN, sizeof(pContext->pass));
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, taosd token:%s parsed success, user:%s", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, taosd token:%s parsed success, user:%s", pContext, pContext->fd,
|
||||
pContext->ipstr, token, pContext->user);
|
||||
free(base64);
|
||||
free(descrypt);
|
||||
|
@ -116,7 +116,7 @@ bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int maxLen) {
|
|||
free(encrypt);
|
||||
free(base64);
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, gen taosd token:%s", pContext, pContext->fd, pContext->ipstr, token);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, gen taosd token:%s", pContext, pContext->fd, pContext->ipstr, token);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ static void httpDestroyContext(void *data) {
|
|||
httpFreeJsonBuf(pContext);
|
||||
httpFreeMultiCmds(pContext);
|
||||
|
||||
httpTrace("context:%p, is destroyed, refCount:%d", pContext, pContext->refCount);
|
||||
httpDebug("context:%p, is destroyed, refCount:%d", pContext, pContext->refCount);
|
||||
tfree(pContext);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ bool httpInitContexts() {
|
|||
void httpCleanupContexts() {
|
||||
if (tsHttpServer.contextCache != NULL) {
|
||||
SCacheObj *cache = tsHttpServer.contextCache;
|
||||
httpPrint("context cache is cleanuping, size:%zu", taosHashGetSize(cache->pHashTable));
|
||||
httpInfo("context cache is cleanuping, size:%zu", taosHashGetSize(cache->pHashTable));
|
||||
taosCacheCleanup(tsHttpServer.contextCache);
|
||||
tsHttpServer.contextCache = NULL;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ HttpContext *httpCreateContext(int32_t fd) {
|
|||
|
||||
HttpContext **ppContext = taosCachePut(tsHttpServer.contextCache, contextStr, &pContext, sizeof(HttpContext *), 3);
|
||||
pContext->ppContext = ppContext;
|
||||
httpTrace("context:%p, fd:%d, is created, item:%p", pContext, fd, ppContext);
|
||||
httpDebug("context:%p, fd:%d, is created, item:%p", pContext, fd, ppContext);
|
||||
|
||||
// set the ref to 0
|
||||
taosCacheRelease(tsHttpServer.contextCache, (void**)&ppContext, false);
|
||||
|
@ -131,7 +131,7 @@ HttpContext *httpGetContext(void *ptr) {
|
|||
HttpContext *pContext = *ppContext;
|
||||
if (pContext) {
|
||||
int32_t refCount = atomic_add_fetch_32(&pContext->refCount, 1);
|
||||
httpTrace("context:%p, fd:%d, is accquired, refCount:%d", pContext, pContext->fd, refCount);
|
||||
httpDebug("context:%p, fd:%d, is accquired, refCount:%d", pContext, pContext->fd, refCount);
|
||||
return pContext;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ HttpContext *httpGetContext(void *ptr) {
|
|||
void httpReleaseContext(HttpContext *pContext) {
|
||||
int32_t refCount = atomic_sub_fetch_32(&pContext->refCount, 1);
|
||||
assert(refCount >= 0);
|
||||
httpTrace("context:%p, fd:%d, is releasd, refCount:%d", pContext, pContext->fd, refCount);
|
||||
httpDebug("context:%p, fd:%d, is releasd, refCount:%d", pContext, pContext->fd, refCount);
|
||||
|
||||
HttpContext **ppContext = pContext->ppContext;
|
||||
taosCacheRelease(tsHttpServer.contextCache, (void **)(&ppContext), false);
|
||||
|
@ -164,7 +164,7 @@ bool httpInitContext(HttpContext *pContext) {
|
|||
memset(pParser, 0, sizeof(HttpParser));
|
||||
pParser->pCur = pParser->pLast = pParser->buffer;
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, thread:%s, accessTimes:%d, parsed:%d",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, thread:%s, accessTimes:%d, parsed:%d",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->pThread->label, pContext->accessTimes, pContext->parsed);
|
||||
return true;
|
||||
}
|
||||
|
@ -181,18 +181,18 @@ void httpCloseContextByApp(HttpContext *pContext) {
|
|||
|
||||
if (keepAlive) {
|
||||
if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_HANDLING, HTTP_CONTEXT_STATE_READY)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, last state:handling, keepAlive:true, reuse connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, last state:handling, keepAlive:true, reuse connect",
|
||||
pContext, pContext->fd, pContext->ipstr);
|
||||
} else if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_DROPPING, HTTP_CONTEXT_STATE_CLOSED)) {
|
||||
httpRemoveContextFromEpoll(pContext);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, last state:dropping, keepAlive:true, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, last state:dropping, keepAlive:true, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr);
|
||||
} else if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_READY)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, last state:ready, keepAlive:true, reuse connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, last state:ready, keepAlive:true, reuse connect",
|
||||
pContext, pContext->fd, pContext->ipstr);
|
||||
} else if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_CLOSED, HTTP_CONTEXT_STATE_CLOSED)) {
|
||||
httpRemoveContextFromEpoll(pContext);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, last state:ready, keepAlive:true, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, last state:ready, keepAlive:true, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr);
|
||||
} else {
|
||||
httpRemoveContextFromEpoll(pContext);
|
||||
|
@ -201,7 +201,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
|
|||
}
|
||||
} else {
|
||||
httpRemoveContextFromEpoll(pContext);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, last state:%s:%d, keepAlive:false, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, last state:%s:%d, keepAlive:false, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state), pContext->state);
|
||||
}
|
||||
|
||||
|
@ -210,13 +210,13 @@ void httpCloseContextByApp(HttpContext *pContext) {
|
|||
|
||||
void httpCloseContextByServer(HttpContext *pContext) {
|
||||
if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_HANDLING, HTTP_CONTEXT_STATE_DROPPING)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, epoll finished, still used by app", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, epoll finished, still used by app", pContext, pContext->fd, pContext->ipstr);
|
||||
} else if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_DROPPING, HTTP_CONTEXT_STATE_DROPPING)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, epoll already finished, wait app finished", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, epoll already finished, wait app finished", pContext, pContext->fd, pContext->ipstr);
|
||||
} else if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_CLOSED)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, epoll finished, close context", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, epoll finished, close context", pContext, pContext->fd, pContext->ipstr);
|
||||
} else if (httpAlterContextState(pContext, HTTP_CONTEXT_STATE_CLOSED, HTTP_CONTEXT_STATE_CLOSED)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, epoll finished, will be closed soon", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, epoll finished, will be closed soon", pContext, pContext->fd, pContext->ipstr);
|
||||
} else {
|
||||
httpError("context:%p, fd:%d, ip:%s, unknown state:%d", pContext, pContext->fd, pContext->ipstr, pContext->state);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ bool httpParseHttpVersion(HttpContext* pContext) {
|
|||
else
|
||||
pContext->httpVersion = HTTP_VERSION_10;
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, httpVersion:1.%d", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, httpVersion:1.%d", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->httpVersion);
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ bool httpGetHttpMethod(HttpContext* pContext) {
|
|||
pParser->method.pos[pParser->method.len] = 0;
|
||||
pParser->pLast = pSeek + 1;
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, httpMethod:%s", pContext, pContext->fd, pContext->ipstr, pParser->method.pos);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, httpMethod:%s", pContext, pContext->fd, pContext->ipstr, pParser->method.pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -186,23 +186,23 @@ bool httpParseHead(HttpContext* pContext) {
|
|||
HttpParser* pParser = &pContext->parser;
|
||||
if (strncasecmp(pParser->pLast, "Content-Length: ", 16) == 0) {
|
||||
pParser->data.len = (int32_t)atoi(pParser->pLast + 16);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, Content-Length:%d", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, Content-Length:%d", pContext, pContext->fd, pContext->ipstr,
|
||||
pParser->data.len);
|
||||
} else if (strncasecmp(pParser->pLast, "Accept-Encoding: ", 17) == 0) {
|
||||
if (tsHttpEnableCompress && strstr(pParser->pLast + 17, "gzip") != NULL) {
|
||||
pContext->acceptEncoding = HTTP_COMPRESS_GZIP;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, Accept-Encoding:gzip", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, Accept-Encoding:gzip", pContext, pContext->fd, pContext->ipstr);
|
||||
} else {
|
||||
pContext->acceptEncoding = HTTP_COMPRESS_IDENTITY;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, Accept-Encoding:identity", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, Accept-Encoding:identity", pContext, pContext->fd, pContext->ipstr);
|
||||
}
|
||||
} else if (strncasecmp(pParser->pLast, "Content-Encoding: ", 18) == 0) {
|
||||
if (strstr(pParser->pLast + 18, "gzip") != NULL) {
|
||||
pContext->contentEncoding = HTTP_COMPRESS_GZIP;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, Content-Encoding:gzip", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, Content-Encoding:gzip", pContext, pContext->fd, pContext->ipstr);
|
||||
} else {
|
||||
pContext->contentEncoding = HTTP_COMPRESS_IDENTITY;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, Content-Encoding:identity", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, Content-Encoding:identity", pContext, pContext->fd, pContext->ipstr);
|
||||
}
|
||||
} else if (strncasecmp(pParser->pLast, "Connection: ", 12) == 0) {
|
||||
if (strncasecmp(pParser->pLast + 12, "Keep-Alive", 10) == 0) {
|
||||
|
@ -210,7 +210,7 @@ bool httpParseHead(HttpContext* pContext) {
|
|||
} else {
|
||||
pContext->httpKeepAlive = HTTP_KEEPALIVE_DISABLE;
|
||||
}
|
||||
httpTrace("context:%p, fd:%d, ip:%s, keepAlive:%d", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, keepAlive:%d", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->httpKeepAlive);
|
||||
} else if (strncasecmp(pParser->pLast, "Transfer-Encoding: ", 19) == 0) {
|
||||
if (strncasecmp(pParser->pLast + 19, "chunked", 7) == 0) {
|
||||
|
@ -281,7 +281,7 @@ bool httpReadChunkedBody(HttpContext* pContext, HttpParser* pParser) {
|
|||
httpParseChunkedBody(pContext, pParser, false);
|
||||
return HTTP_CHECK_BODY_SUCCESS;
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, chunked body not finished, continue read", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, chunked body not finished, continue read", pContext, pContext->fd, pContext->ipstr);
|
||||
if (!httpReadDataImp(pContext)) {
|
||||
httpError("context:%p, fd:%d, ip:%s, read chunked request error", pContext, pContext->fd, pContext->ipstr);
|
||||
return HTTP_CHECK_BODY_ERROR;
|
||||
|
@ -299,7 +299,7 @@ int httpReadUnChunkedBody(HttpContext* pContext, HttpParser* pParser) {
|
|||
httpSendErrorResp(pContext, HTTP_PARSE_BODY_ERROR);
|
||||
return HTTP_CHECK_BODY_ERROR;
|
||||
} else if (dataReadLen < pParser->data.len) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, un-chunked body not finished, read size:%d dataReadLen:%d < pContext->data.len:%d, continue read",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, un-chunked body not finished, read size:%d dataReadLen:%d < pContext->data.len:%d, continue read",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->parser.bufsize, dataReadLen, pParser->data.len);
|
||||
return HTTP_CHECK_BODY_CONTINUE;
|
||||
} else {
|
||||
|
@ -313,7 +313,7 @@ bool httpParseRequest(HttpContext* pContext) {
|
|||
return true;
|
||||
}
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, thread:%s, numOfFds:%d, read size:%d, raw data:\n%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, thread:%s, numOfFds:%d, read size:%d, raw data:\n%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->pThread->label, pContext->pThread->numOfFds,
|
||||
pContext->parser.bufsize, pContext->parser.buffer);
|
||||
|
||||
|
@ -351,7 +351,7 @@ bool httpParseRequest(HttpContext* pContext) {
|
|||
pParser->pLast = ++pParser->pCur;
|
||||
} while (1);
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, parse http head ok", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, parse http head ok", pContext, pContext->fd, pContext->ipstr);
|
||||
|
||||
pContext->parsed = true;
|
||||
return true;
|
||||
|
@ -389,7 +389,7 @@ bool httpDecodeRequest(HttpContext* pContext) {
|
|||
bool httpProcessData(HttpContext* pContext) {
|
||||
|
||||
if (!httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_HANDLING)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s not in ready state, stop process request",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s not in ready state, stop process request",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state));
|
||||
httpCloseContextByApp(pContext);
|
||||
return false;
|
||||
|
@ -397,7 +397,7 @@ bool httpProcessData(HttpContext* pContext) {
|
|||
|
||||
// handle Cross-domain request
|
||||
if (strcmp(pContext->parser.method.pos, "OPTIONS") == 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, process options request", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, process options request", pContext, pContext->fd, pContext->ipstr);
|
||||
httpSendOptionResp(pContext, "process options request success");
|
||||
} else {
|
||||
if (!httpDecodeRequest(pContext)) {
|
||||
|
|
|
@ -52,13 +52,13 @@ int httpWriteBufByFd(struct HttpContext* pContext, const char* buf, int sz) {
|
|||
}
|
||||
|
||||
if (len < 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, socket write errno:%d, times:%d",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, socket write errno:%d, times:%d",
|
||||
pContext, pContext->fd, pContext->ipstr, errno, countWait);
|
||||
if (++countWait > HTTP_WRITE_RETRY_TIMES) break;
|
||||
taosMsleep(HTTP_WRITE_WAIT_TIME_MS);
|
||||
continue;
|
||||
} else if (len == 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, socket write errno:%d, connect already closed",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, socket write errno:%d, connect already closed",
|
||||
pContext, pContext->fd, pContext->ipstr, errno);
|
||||
break;
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ int httpWriteBuf(struct HttpContext *pContext, const char *buf, int sz) {
|
|||
httpError("context:%p, fd:%d, ip:%s, dataSize:%d, writeSize:%d, failed to send response:\n%s",
|
||||
pContext, pContext->fd, pContext->ipstr, sz, writeSz, buf);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, dataSize:%d, writeSize:%d, response:\n%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, dataSize:%d, writeSize:%d, response:\n%s",
|
||||
pContext, pContext->fd, pContext->ipstr, sz, writeSz, buf);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ int httpWriteJsonBufBody(JsonBuf* buf, bool isTheLast) {
|
|||
uint64_t srcLen = (uint64_t) (buf->lst - buf->buf);
|
||||
|
||||
if (buf->pContext->fd <= 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, write json body error", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, write json body error", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
buf->pContext->fd = -1;
|
||||
}
|
||||
|
||||
|
@ -113,11 +113,11 @@ int httpWriteJsonBufBody(JsonBuf* buf, bool isTheLast) {
|
|||
|
||||
if (buf->pContext->acceptEncoding == HTTP_COMPRESS_IDENTITY) {
|
||||
if (buf->lst == buf->buf) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, no data need dump", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, no data need dump", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
return 0; // there is no data to dump.
|
||||
} else {
|
||||
int len = sprintf(sLen, "%lx\r\n", srcLen);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, write body, chunkSize:%" PRIu64 ", response:\n%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, write body, chunkSize:%" PRIu64 ", response:\n%s",
|
||||
buf->pContext, buf->pContext->fd, buf->pContext->ipstr, srcLen, buf->buf);
|
||||
httpWriteBufNoTrace(buf->pContext, sLen, len);
|
||||
remain = httpWriteBufNoTrace(buf->pContext, buf->buf, (int) srcLen);
|
||||
|
@ -129,12 +129,12 @@ int httpWriteJsonBufBody(JsonBuf* buf, bool isTheLast) {
|
|||
if (ret == 0) {
|
||||
if (compressBufLen > 0) {
|
||||
int len = sprintf(sLen, "%x\r\n", compressBufLen);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, write body, chunkSize:%" PRIu64 ", compressSize:%d, last:%d, response:\n%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, write body, chunkSize:%" PRIu64 ", compressSize:%d, last:%d, response:\n%s",
|
||||
buf->pContext, buf->pContext->fd, buf->pContext->ipstr, srcLen, compressBufLen, isTheLast, buf->buf);
|
||||
httpWriteBufNoTrace(buf->pContext, sLen, len);
|
||||
remain = httpWriteBufNoTrace(buf->pContext, (const char *) compressBuf, (int) compressBufLen);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, last:%d, compress already dumped, response:\n%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, last:%d, compress already dumped, response:\n%s",
|
||||
buf->pContext, buf->pContext->fd, buf->pContext->ipstr, isTheLast, buf->buf);
|
||||
return 0; // there is no data to dump.
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ void httpWriteJsonBufHead(JsonBuf* buf) {
|
|||
|
||||
void httpWriteJsonBufEnd(JsonBuf* buf) {
|
||||
if (buf->pContext->fd <= 0) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, json buf fd is 0", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, json buf fd is 0", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
buf->pContext->fd = -1;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void httpInitJsonBuf(JsonBuf* buf, struct HttpContext* pContext) {
|
|||
httpGzipCompressInit(buf->pContext);
|
||||
}
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, json buffer initialized", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, json buffer initialized", buf->pContext, buf->pContext->fd, buf->pContext->ipstr);
|
||||
}
|
||||
|
||||
void httpJsonItemToken(JsonBuf* buf) {
|
||||
|
|
|
@ -68,7 +68,7 @@ void httpCleanUpConnect() {
|
|||
|
||||
tfree(pServer->pThreads);
|
||||
pServer->pThreads = NULL;
|
||||
httpTrace("http server:%s is cleaned up", pServer->label);
|
||||
httpDebug("http server:%s is cleaned up", pServer->label);
|
||||
}
|
||||
|
||||
bool httpReadDataImp(HttpContext *pContext) {
|
||||
|
@ -81,7 +81,7 @@ bool httpReadDataImp(HttpContext *pContext) {
|
|||
break;
|
||||
} else if (nread < 0) {
|
||||
if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, read from socket error:%d, wait another event",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, read from socket error:%d, wait another event",
|
||||
pContext, pContext->fd, pContext->ipstr, errno);
|
||||
break;
|
||||
} else {
|
||||
|
@ -109,7 +109,7 @@ bool httpReadDataImp(HttpContext *pContext) {
|
|||
|
||||
static bool httpDecompressData(HttpContext *pContext) {
|
||||
if (pContext->contentEncoding != HTTP_COMPRESS_GZIP) {
|
||||
httpDump("context:%p, fd:%d, ip:%s, content:%s", pContext, pContext->fd, pContext->ipstr, pContext->parser.data.pos);
|
||||
httpTraceDump("context:%p, fd:%d, ip:%s, content:%s", pContext, pContext->fd, pContext->ipstr, pContext->parser.data.pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ static bool httpDecompressData(HttpContext *pContext) {
|
|||
if (ret == 0) {
|
||||
memcpy(pContext->parser.data.pos, decompressBuf, decompressBufLen);
|
||||
pContext->parser.data.pos[decompressBufLen] = 0;
|
||||
httpDump("context:%p, fd:%d, ip:%s, rawSize:%d, decompressSize:%d, content:%s",
|
||||
httpTraceDump("context:%p, fd:%d, ip:%s, rawSize:%d, decompressSize:%d, content:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->parser.data.len, decompressBufLen, decompressBuf);
|
||||
pContext->parser.data.len = decompressBufLen;
|
||||
} else {
|
||||
|
@ -154,10 +154,10 @@ static bool httpReadData(HttpContext *pContext) {
|
|||
|
||||
int ret = httpCheckReadCompleted(pContext);
|
||||
if (ret == HTTP_CHECK_BODY_CONTINUE) {
|
||||
//httpTrace("context:%p, fd:%d, ip:%s, not finished yet, wait another event", pContext, pContext->fd, pContext->ipstr);
|
||||
//httpDebug("context:%p, fd:%d, ip:%s, not finished yet, wait another event", pContext, pContext->fd, pContext->ipstr);
|
||||
return false;
|
||||
} else if (ret == HTTP_CHECK_BODY_SUCCESS){
|
||||
httpTrace("context:%p, fd:%d, ip:%s, thread:%s, read size:%d, dataLen:%d",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, thread:%s, read size:%d, dataLen:%d",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->pThread->label, pContext->parser.bufsize, pContext->parser.data.len);
|
||||
if (httpDecompressData(pContext)) {
|
||||
return true;
|
||||
|
@ -188,7 +188,7 @@ static void httpProcessHttpData(void *param) {
|
|||
//-1 means uncertainty, 0-nowait, 1-wait 1 ms, set it from -1 to 1
|
||||
fdNum = epoll_wait(pThread->pollFd, events, HTTP_MAX_EVENTS, 1);
|
||||
if (pThread->stop) {
|
||||
httpTrace("%p, http thread get stop event, exiting...", pThread);
|
||||
httpDebug("%p, http thread get stop event, exiting...", pThread);
|
||||
break;
|
||||
}
|
||||
if (fdNum <= 0) continue;
|
||||
|
@ -203,42 +203,42 @@ static void httpProcessHttpData(void *param) {
|
|||
}
|
||||
|
||||
if (events[i].events & EPOLLPRI) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s, EPOLLPRI events occured, accessed:%d, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s, EPOLLPRI events occured, accessed:%d, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state), pContext->accessTimes);
|
||||
httpCloseContextByServer(pContext);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (events[i].events & EPOLLRDHUP) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s, EPOLLRDHUP events occured, accessed:%d, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s, EPOLLRDHUP events occured, accessed:%d, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state), pContext->accessTimes);
|
||||
httpCloseContextByServer(pContext);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (events[i].events & EPOLLERR) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s, EPOLLERR events occured, accessed:%d, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s, EPOLLERR events occured, accessed:%d, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state), pContext->accessTimes);
|
||||
httpCloseContextByServer(pContext);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (events[i].events & EPOLLHUP) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s, EPOLLHUP events occured, accessed:%d, close connect",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s, EPOLLHUP events occured, accessed:%d, close connect",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state), pContext->accessTimes);
|
||||
httpCloseContextByServer(pContext);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_READY)) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s, not in ready state, ignore read events",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s, not in ready state, ignore read events",
|
||||
pContext, pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state));
|
||||
httpReleaseContext(pContext);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pServer->status != HTTP_SERVER_RUNNING) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, state:%s, server is not running, accessed:%d, close connect", pContext,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, state:%s, server is not running, accessed:%d, close connect", pContext,
|
||||
pContext->fd, pContext->ipstr, httpContextStateStr(pContext->state), pContext->accessTimes);
|
||||
httpSendErrorResp(pContext, HTTP_SERVER_OFFLINE);
|
||||
httpNotifyContextClose(pContext);
|
||||
|
@ -273,7 +273,7 @@ static void *httpAcceptHttpConnection(void *arg) {
|
|||
taosIpStr(pServer->serverIp), pServer->serverPort, strerror(errno));
|
||||
return NULL;
|
||||
} else {
|
||||
httpPrint("http server init success at %u", pServer->serverPort);
|
||||
httpInfo("http server init success at %u", pServer->serverPort);
|
||||
pServer->status = HTTP_SERVER_RUNNING;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ static void *httpAcceptHttpConnection(void *arg) {
|
|||
connFd = (int)accept(pServer->fd, (struct sockaddr *)&clientAddr, &addrlen);
|
||||
if (connFd == -1) {
|
||||
if (errno == EINVAL) {
|
||||
httpTrace("http server:%s socket was shutdown, exiting...", pServer->label);
|
||||
httpDebug("http server:%s socket was shutdown, exiting...", pServer->label);
|
||||
break;
|
||||
}
|
||||
httpError("http server:%s, accept connect failure, errno:%d reason:%s", pServer->label, errno, strerror(errno));
|
||||
|
@ -331,7 +331,7 @@ static void *httpAcceptHttpConnection(void *arg) {
|
|||
|
||||
// notify the data process, add into the FdObj list
|
||||
atomic_add_fetch_32(&pThread->numOfFds, 1);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, thread:%s numOfFds:%d totalFds:%d, accept a new connection", pContext, connFd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, thread:%s numOfFds:%d totalFds:%d, accept a new connection", pContext, connFd,
|
||||
pContext->ipstr, pThread->label, pThread->numOfFds, totalFds);
|
||||
|
||||
// pick up next thread for next connection
|
||||
|
@ -365,6 +365,7 @@ bool httpInitConnect() {
|
|||
pThread->pollFd = epoll_create(HTTP_MAX_EVENTS); // size does not matter
|
||||
if (pThread->pollFd < 0) {
|
||||
httpError("http thread:%s, failed to create HTTP epoll", pThread->label);
|
||||
pthread_mutex_destroy(&(pThread->threadMutex));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -374,11 +375,12 @@ bool httpInitConnect() {
|
|||
if (pthread_create(&(pThread->thread), &thattr, (void *)httpProcessHttpData, (void *)(pThread)) != 0) {
|
||||
httpError("http thread:%s, failed to create HTTP process data thread, reason:%s", pThread->label,
|
||||
strerror(errno));
|
||||
pthread_mutex_destroy(&(pThread->threadMutex));
|
||||
return false;
|
||||
}
|
||||
pthread_attr_destroy(&thattr);
|
||||
|
||||
httpTrace("http thread:%p:%s, initialized", pThread, pThread->label);
|
||||
httpDebug("http thread:%p:%s, initialized", pThread, pThread->label);
|
||||
pThread++;
|
||||
}
|
||||
|
||||
|
@ -387,11 +389,12 @@ bool httpInitConnect() {
|
|||
pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_JOINABLE);
|
||||
if (pthread_create(&(pServer->thread), &thattr, (void *)httpAcceptHttpConnection, (void *)(pServer)) != 0) {
|
||||
httpError("http server:%s, failed to create Http accept thread, reason:%s", pServer->label, strerror(errno));
|
||||
httpCleanUpConnect();
|
||||
return false;
|
||||
}
|
||||
pthread_attr_destroy(&thattr);
|
||||
|
||||
httpTrace("http server:%s, initialized, ip:%s:%u, numOfThreads:%d", pServer->label, taosIpStr(pServer->serverIp),
|
||||
httpDebug("http server:%s, initialized, ip:%s:%u, numOfThreads:%d", pServer->label, taosIpStr(pServer->serverIp),
|
||||
pServer->serverPort, pServer->numOfThreads);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void httpCreateSession(HttpContext *pContext, void *taos) {
|
|||
return;
|
||||
}
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, create a new session:%p:%p sessionRef:%d", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, create a new session:%p:%p sessionRef:%d", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, pContext->session, pContext->session->taos, pContext->session->refCount);
|
||||
pthread_mutex_unlock(&server->serverMutex);
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ static void httpFetchSessionImp(HttpContext *pContext) {
|
|||
pContext->session = taosCacheAcquireByName(server->sessionCache, sessionId);
|
||||
if (pContext->session != NULL) {
|
||||
atomic_add_fetch_32(&pContext->session->refCount, 1);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, find an exist session:%p:%p, sessionRef:%d", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, find an exist session:%p:%p, sessionRef:%d", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, pContext->session, pContext->session->taos, pContext->session->refCount);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, session not found", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, session not found", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void httpReleaseSession(HttpContext *pContext) {
|
|||
|
||||
int32_t refCount = atomic_sub_fetch_32(&pContext->session->refCount, 1);
|
||||
assert(refCount >= 0);
|
||||
httpTrace("context:%p, release session:%p:%p, sessionRef:%d", pContext, pContext->session, pContext->session->taos,
|
||||
httpDebug("context:%p, release session:%p:%p, sessionRef:%d", pContext, pContext->session, pContext->session->taos,
|
||||
pContext->session->refCount);
|
||||
|
||||
taosCacheRelease(tsHttpServer.sessionCache, (void **)&pContext->session, false);
|
||||
|
@ -97,7 +97,7 @@ void httpReleaseSession(HttpContext *pContext) {
|
|||
|
||||
static void httpDestroySession(void *data) {
|
||||
HttpSession *session = data;
|
||||
httpTrace("session:%p:%p, is destroyed, sessionRef:%d", session, session->taos, session->refCount);
|
||||
httpDebug("session:%p:%p, is destroyed, sessionRef:%d", session, session->taos, session->refCount);
|
||||
|
||||
if (session->taos != NULL) {
|
||||
taos_close(session->taos);
|
||||
|
@ -108,7 +108,7 @@ static void httpDestroySession(void *data) {
|
|||
void httpCleanUpSessions() {
|
||||
if (tsHttpServer.sessionCache != NULL) {
|
||||
SCacheObj *cache = tsHttpServer.sessionCache;
|
||||
httpPrint("session cache is cleanuping, size:%zu", taosHashGetSize(cache->pHashTable));
|
||||
httpInfo("session cache is cleanuping, size:%zu", taosHashGetSize(cache->pHashTable));
|
||||
taosCacheCleanup(tsHttpServer.sessionCache);
|
||||
tsHttpServer.sessionCache = NULL;
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@ void httpProcessMultiSqlRetrieveCallBack(void *param, TAOS_RES *result, int numO
|
|||
|
||||
if (isContinue) {
|
||||
// retrieve next batch of rows
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, continue retrieve, numOfRows:%d, sql:%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, continue retrieve, numOfRows:%d, sql:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, multiCmds->pos, numOfRows, sql);
|
||||
taos_fetch_rows_a(result, httpProcessMultiSqlRetrieveCallBack, param);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, stop retrieve, numOfRows:%d, sql:%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, stop retrieve, numOfRows:%d, sql:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, multiCmds->pos, numOfRows, sql);
|
||||
|
||||
if (numOfRows < 0) {
|
||||
|
@ -90,7 +90,7 @@ void httpProcessMultiSqlCallBack(void *param, TAOS_RES *result, int code) {
|
|||
if (code < 0) {
|
||||
if (encode->checkFinishedFp != NULL && !encode->checkFinishedFp(pContext, singleCmd, code)) {
|
||||
singleCmd->code = code;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process pos jump to:%d, last code:%s, last sql:%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process pos jump to:%d, last code:%s, last sql:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, multiCmds->pos + 1, tstrerror(code), sql);
|
||||
} else {
|
||||
singleCmd->code = code;
|
||||
|
@ -113,7 +113,7 @@ void httpProcessMultiSqlCallBack(void *param, TAOS_RES *result, int code) {
|
|||
if (num_fields == 0) {
|
||||
// not select or show commands
|
||||
int affectRows = taos_affected_rows(result);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, affect rows:%d, sql:%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, affect rows:%d, sql:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, multiCmds->pos, affectRows, sql);
|
||||
|
||||
singleCmd->code = 0;
|
||||
|
@ -139,7 +139,7 @@ void httpProcessMultiSqlCallBack(void *param, TAOS_RES *result, int code) {
|
|||
taos_free_result(result);
|
||||
httpProcessMultiSql(pContext);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, start retrieve, sql:%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, start retrieve, sql:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, multiCmds->pos, sql);
|
||||
|
||||
if (singleCmd->cmdReturnType == HTTP_CMD_RETURN_TYPE_WITH_RETURN && encode->startJsonFp) {
|
||||
|
@ -154,7 +154,7 @@ void httpProcessMultiSql(HttpContext *pContext) {
|
|||
HttpEncodeMethod *encode = pContext->encodeMethod;
|
||||
|
||||
if (multiCmds->pos >= multiCmds->size) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, size:%d, stop mulit-querys",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, size:%d, stop mulit-querys",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, multiCmds->pos, multiCmds->size);
|
||||
if (encode->cleanJsonFp) {
|
||||
(encode->cleanJsonFp)(pContext);
|
||||
|
@ -166,7 +166,7 @@ void httpProcessMultiSql(HttpContext *pContext) {
|
|||
HttpSqlCmd *cmd = multiCmds->cmds + multiCmds->pos;
|
||||
|
||||
char *sql = httpGetCmdsString(pContext, cmd->sql);
|
||||
httpDump("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, start query, sql:%s", pContext, pContext->fd,
|
||||
httpTraceDump("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, start query, sql:%s", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, multiCmds->pos, sql);
|
||||
taosNotePrintHttp(sql);
|
||||
taos_query_a(pContext->session->taos, sql, httpProcessMultiSqlCallBack, (void *)pContext);
|
||||
|
@ -181,7 +181,7 @@ void httpProcessMultiSqlCmd(HttpContext *pContext) {
|
|||
return;
|
||||
}
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, start multi-querys pos:%d, size:%d", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, start multi-querys pos:%d, size:%d", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, multiCmds->pos, multiCmds->size);
|
||||
HttpEncodeMethod *encode = pContext->encodeMethod;
|
||||
if (encode->initJsonFp) {
|
||||
|
@ -211,11 +211,11 @@ void httpProcessSingleSqlRetrieveCallBack(void *param, TAOS_RES *result, int num
|
|||
|
||||
if (isContinue) {
|
||||
// retrieve next batch of rows
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, continue retrieve, numOfRows:%d", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, continue retrieve, numOfRows:%d", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, numOfRows);
|
||||
taos_fetch_rows_a(result, httpProcessSingleSqlRetrieveCallBack, param);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, stop retrieve, numOfRows:%d", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, stop retrieve, numOfRows:%d", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user, numOfRows);
|
||||
|
||||
if (numOfRows < 0) {
|
||||
|
@ -265,7 +265,7 @@ void httpProcessSingleSqlCallBack(void *param, TAOS_RES *result, int code) {
|
|||
// not select or show commands
|
||||
int affectRows = taos_affected_rows(result);
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, affect rows:%d, stop query, sqlObj:%p",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, affect rows:%d, stop query, sqlObj:%p",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, affectRows, result);
|
||||
|
||||
if (encode->startJsonFp) {
|
||||
|
@ -283,7 +283,7 @@ void httpProcessSingleSqlCallBack(void *param, TAOS_RES *result, int code) {
|
|||
taos_free_result(result);
|
||||
httpCloseContextByApp(pContext);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, start retrieve", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, start retrieve", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
|
||||
if (encode->startJsonFp) {
|
||||
|
@ -306,7 +306,7 @@ void httpProcessSingleSqlCmd(HttpContext *pContext) {
|
|||
return;
|
||||
}
|
||||
|
||||
httpDump("context:%p, fd:%d, ip:%s, user:%s, start query, sql:%s", pContext, pContext->fd, pContext->ipstr,
|
||||
httpTraceDump("context:%p, fd:%d, ip:%s, user:%s, start query, sql:%s", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user, sql);
|
||||
taosNotePrintHttp(sql);
|
||||
taos_query_a(pSession->taos, sql, httpProcessSingleSqlCallBack, (void *)pContext);
|
||||
|
@ -317,7 +317,7 @@ void httpProcessLoginCmd(HttpContext *pContext) {
|
|||
if (!httpGenTaosdAuthToken(pContext, token, 128)) {
|
||||
httpSendErrorResp(pContext, HTTP_GEN_TAOSD_TOKEN_ERR);
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, login via http, return token:%s",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, login via http, return token:%s",
|
||||
pContext, pContext->fd, pContext->ipstr, pContext->user, token);
|
||||
httpSendSuccResp(pContext, token);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int code) {
|
|||
return;
|
||||
}
|
||||
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, connect tdengine success, taos:%p", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, connect tdengine success, taos:%p", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, pContext->taos);
|
||||
if (pContext->taos == NULL) {
|
||||
httpError("context:%p, fd:%d, ip:%s, user:%s, login error, taos is empty", pContext, pContext->fd, pContext->ipstr,
|
||||
|
@ -393,7 +393,7 @@ void httpProcessRequest(HttpContext *pContext) {
|
|||
if (pContext->session == NULL || pContext->reqType == HTTP_REQTYPE_LOGIN) {
|
||||
taos_connect_a(NULL, pContext->user, pContext->pass, "", 0, httpProcessRequestCb, (void *)pContext,
|
||||
&(pContext->taos));
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, try connect tdengine, taos:%p", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, try connect tdengine, taos:%p", pContext, pContext->fd,
|
||||
pContext->ipstr, pContext->user, pContext->taos);
|
||||
} else {
|
||||
httpExecCmd(pContext);
|
||||
|
|
|
@ -60,7 +60,7 @@ int httpInitSystem() {
|
|||
}
|
||||
|
||||
int httpStartSystem() {
|
||||
httpPrint("start http server ...");
|
||||
httpInfo("start http server ...");
|
||||
|
||||
if (tsHttpServer.status != HTTP_SERVER_INIT) {
|
||||
httpError("http server is already started");
|
||||
|
@ -92,7 +92,7 @@ void httpStopSystem() {
|
|||
}
|
||||
|
||||
void httpCleanUpSystem() {
|
||||
httpPrint("http server cleanup");
|
||||
httpInfo("http server cleanup");
|
||||
httpStopSystem();
|
||||
|
||||
httpCleanupContexts();
|
||||
|
|
|
@ -80,14 +80,14 @@ bool restGetPassFromUrl(HttpContext* pContext) {
|
|||
}
|
||||
|
||||
bool restProcessLoginRequest(HttpContext* pContext) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process restful login msg", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process restful login msg", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
pContext->reqType = HTTP_REQTYPE_LOGIN;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool restProcessSqlRequest(HttpContext* pContext, int timestampFmt) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, process restful sql msg", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, process restful sql msg", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user);
|
||||
|
||||
char* sql = pContext->parser.data.pos;
|
||||
|
|
|
@ -151,7 +151,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
|
|||
}
|
||||
|
||||
if (cmd->numOfRows >= tsRestRowLimit) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, retrieve rows:%d larger than limit:%d, abort retrieve", pContext,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, retrieve rows:%d larger than limit:%d, abort retrieve", pContext,
|
||||
pContext->fd, pContext->ipstr, pContext->user, cmd->numOfRows, tsRestRowLimit);
|
||||
return false;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result,
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, user:%s, total rows:%d retrieved", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, user:%s, total rows:%d retrieved", pContext, pContext->fd, pContext->ipstr,
|
||||
pContext->user, cmd->numOfRows);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ int tgReadSchema(char *fileName) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
httpPrint("open telegraf schema file:%s success", fileName);
|
||||
httpInfo("open telegraf schema file:%s success", fileName);
|
||||
fseek(fp, 0, SEEK_END);
|
||||
int32_t contentSize = (int32_t)ftell(fp);
|
||||
if (contentSize <= 0) {
|
||||
|
@ -290,7 +290,7 @@ int tgReadSchema(char *fileName) {
|
|||
|
||||
free(content);
|
||||
fclose(fp);
|
||||
httpPrint("parse telegraf schema file:%s, schema size:%d", fileName, schemaNum);
|
||||
httpInfo("parse telegraf schema file:%s, schema size:%d", fileName, schemaNum);
|
||||
|
||||
return schemaNum;
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
|
|||
}
|
||||
*/
|
||||
bool tgProcessQueryRequest(HttpContext *pContext, char *db) {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, process telegraf query msg", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, process telegraf query msg", pContext, pContext->fd, pContext->ipstr);
|
||||
|
||||
HttpParser *pParser = &pContext->parser;
|
||||
char * filter = pParser->data.pos;
|
||||
|
@ -818,7 +818,7 @@ bool tgProcessQueryRequest(HttpContext *pContext, char *db) {
|
|||
cJSON *metrics = cJSON_GetObjectItem(root, "metrics");
|
||||
if (metrics != NULL) {
|
||||
int size = cJSON_GetArraySize(metrics);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, multiple metrics:%d at one time", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, multiple metrics:%d at one time", pContext, pContext->fd, pContext->ipstr,
|
||||
size);
|
||||
if (size <= 0) {
|
||||
httpSendErrorResp(pContext, HTTP_TG_METRICS_NULL);
|
||||
|
@ -859,7 +859,7 @@ bool tgProcessQueryRequest(HttpContext *pContext, char *db) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
httpTrace("context:%p, fd:%d, ip:%s, single metric", pContext, pContext->fd, pContext->ipstr);
|
||||
httpDebug("context:%p, fd:%d, ip:%s, single metric", pContext, pContext->fd, pContext->ipstr);
|
||||
|
||||
if (!httpMallocMultiCmds(pContext, 3, HTTP_BUFFER_SIZE)) {
|
||||
httpSendErrorResp(pContext, HTTP_NO_ENOUGH_MEMORY);
|
||||
|
|
|
@ -98,7 +98,7 @@ void tgBuildSqlAffectRowsJson(HttpContext *pContext, HttpSqlCmd *cmd, int affect
|
|||
|
||||
bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
|
||||
HttpSqlCmds *multiCmds = pContext->multiCmds;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, check telegraf command, code:%s, state:%d, type:%d, rettype:%d, tags:%d",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, check telegraf command, code:%s, state:%d, type:%d, rettype:%d, tags:%d",
|
||||
pContext, pContext->fd, pContext->ipstr, tstrerror(code), cmd->cmdState, cmd->cmdType, cmd->cmdReturnType, cmd->tagNum);
|
||||
|
||||
if (cmd->cmdType == HTTP_CMD_TYPE_INSERT) {
|
||||
|
@ -107,7 +107,7 @@ bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
|
|||
cmd->cmdState = HTTP_CMD_STATE_RUN_FINISHED;
|
||||
if (multiCmds->cmds[0].cmdState == HTTP_CMD_STATE_NOT_RUN_YET) {
|
||||
multiCmds->pos = (int16_t)-1;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, import failed, try create database", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, import failed, try create database", pContext, pContext->fd,
|
||||
pContext->ipstr);
|
||||
return false;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
|
|||
cmd->cmdState = HTTP_CMD_STATE_RUN_FINISHED;
|
||||
if (multiCmds->cmds[multiCmds->pos - 1].cmdState == HTTP_CMD_STATE_NOT_RUN_YET) {
|
||||
multiCmds->pos = (int16_t)(multiCmds->pos - 2);
|
||||
httpTrace("context:%p, fd:%d, ip:%s, import failed, try create stable", pContext, pContext->fd,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, import failed, try create stable", pContext, pContext->fd,
|
||||
pContext->ipstr);
|
||||
return false;
|
||||
}
|
||||
|
@ -125,11 +125,11 @@ bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
|
|||
}
|
||||
} else if (cmd->cmdType == HTTP_CMD_TYPE_CREATE_DB) {
|
||||
cmd->cmdState = HTTP_CMD_STATE_RUN_FINISHED;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, code:%s, create database failed", pContext, pContext->fd, pContext->ipstr,
|
||||
httpDebug("context:%p, fd:%d, ip:%s, code:%s, create database failed", pContext, pContext->fd, pContext->ipstr,
|
||||
tstrerror(code));
|
||||
} else if (cmd->cmdType == HTTP_CMD_TYPE_CREATE_STBALE) {
|
||||
cmd->cmdState = HTTP_CMD_STATE_RUN_FINISHED;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, code:%s, create stable failed", pContext, pContext->fd, pContext->ipstr, tstrerror(code));
|
||||
httpDebug("context:%p, fd:%d, ip:%s, code:%s, create stable failed", pContext, pContext->fd, pContext->ipstr, tstrerror(code));
|
||||
} else {
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
|
|||
|
||||
void tgSetNextCmd(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
|
||||
HttpSqlCmds *multiCmds = pContext->multiCmds;
|
||||
httpTrace("context:%p, fd:%d, ip:%s, get telegraf next command, pos:%d, code:%s, state:%d, type:%d, rettype:%d, tags:%d",
|
||||
httpDebug("context:%p, fd:%d, ip:%s, get telegraf next command, pos:%d, code:%s, state:%d, type:%d, rettype:%d, tags:%d",
|
||||
pContext, pContext->fd, pContext->ipstr, multiCmds->pos, tstrerror(code), cmd->cmdState, cmd->cmdType,
|
||||
cmd->cmdReturnType, cmd->tagNum);
|
||||
|
||||
|
|
|
@ -27,10 +27,16 @@
|
|||
#include "dnode.h"
|
||||
#include "monitor.h"
|
||||
|
||||
#define monitorError(...) { if (monitorDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MON ", 255, __VA_ARGS__); }}
|
||||
#define monitorWarn(...) { if (monitorDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MON ", monitorDebugFlag, __VA_ARGS__); }}
|
||||
#define monitorTrace(...) { if (monitorDebugFlag & DEBUG_TRACE) { taosPrintLog("MON ", monitorDebugFlag, __VA_ARGS__); }}
|
||||
#define monitorPrint(...) { taosPrintLog("MON ", 255, __VA_ARGS__); }
|
||||
|
||||
#define monitorFatal(...) { if (monitorDebugFlag & DEBUG_FATAL) { taosPrintLog("MON FATAL ", 255, __VA_ARGS__); }}
|
||||
#define monitorError(...) { if (monitorDebugFlag & DEBUG_ERROR) { taosPrintLog("MON ERROR ", 255, __VA_ARGS__); }}
|
||||
#define monitorWarn(...) { if (monitorDebugFlag & DEBUG_WARN) { taosPrintLog("MON WARN ", 255, __VA_ARGS__); }}
|
||||
#define monitorInfo(...) { if (monitorDebugFlag & DEBUG_INFO) { taosPrintLog("MON INFO ", 255, __VA_ARGS__); }}
|
||||
#define monitorDebug(...) { if (monitorDebugFlag & DEBUG_DEBUG) { taosPrintLog("MON DEBUG ", monitorDebugFlag, __VA_ARGS__); }}
|
||||
#define monitorTrace(...) { if (monitorDebugFlag & DEBUG_TRACE) { taosPrintLog("MON TRACE ", monitorDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define monitorDebugDump(...) { if (monitorDebugFlag & DEBUG_DEBUG) { taosPrintLongString("MON DEBUG ", monitorDebugFlag, __VA_ARGS__); }}
|
||||
#define monitorTraceDump(...) { if (monitorDebugFlag & DEBUG_TRACE) { taosPrintLongString("MON TRACE ", monitorDebugFlag, __VA_ARGS__); }}
|
||||
|
||||
#define SQL_LENGTH 1024
|
||||
#define LOG_LEN_STR 100
|
||||
|
@ -86,7 +92,7 @@ int32_t monitorInitSystem() {
|
|||
}
|
||||
|
||||
int32_t monitorStartSystem() {
|
||||
monitorPrint("start monitor module");
|
||||
monitorInfo("start monitor module");
|
||||
monitorInitSystem();
|
||||
taosTmrReset(monitorInitConn, 10, NULL, tscTmr, &tsMonitorConn.initTimer);
|
||||
return 0;
|
||||
|
@ -104,7 +110,7 @@ static void monitorInitConn(void *para, void *unused) {
|
|||
return;
|
||||
}
|
||||
|
||||
monitorPrint("starting to initialize monitor service ..");
|
||||
monitorInfo("starting to initialize monitor service ..");
|
||||
tsMonitorConn.state = MONITOR_STATE_INITIALIZING;
|
||||
|
||||
if (tsMonitorConn.ep[0] == 0)
|
||||
|
@ -134,7 +140,7 @@ static void monitorInitConnCb(void *param, TAOS_RES *result, int32_t code) {
|
|||
return;
|
||||
}
|
||||
|
||||
monitorTrace("monitor:%p, connect to database success, reason:%s", tsMonitorConn.conn, tstrerror(code));
|
||||
monitorDebug("monitor:%p, connect to database success, reason:%s", tsMonitorConn.conn, tstrerror(code));
|
||||
monitorInitDatabase();
|
||||
}
|
||||
|
||||
|
@ -200,7 +206,7 @@ static void monitorInitDatabase() {
|
|||
taos_query_a(tsMonitorConn.conn, tsMonitorConn.sql, monitorInitDatabaseCb, NULL);
|
||||
} else {
|
||||
tsMonitorConn.state = MONITOR_STATE_INITIALIZED;
|
||||
monitorPrint("monitor service init success");
|
||||
monitorInfo("monitor service init success");
|
||||
|
||||
monitorStartTimer();
|
||||
}
|
||||
|
@ -208,9 +214,9 @@ static void monitorInitDatabase() {
|
|||
|
||||
static void monitorInitDatabaseCb(void *param, TAOS_RES *result, int32_t code) {
|
||||
if (-code == TSDB_CODE_MND_TABLE_ALREADY_EXIST || -code == TSDB_CODE_MND_DB_ALREADY_EXIST || code >= 0) {
|
||||
monitorTrace("monitor:%p, sql success, reason:%s, %s", tsMonitorConn.conn, tstrerror(code), tsMonitorConn.sql);
|
||||
monitorDebug("monitor:%p, sql success, reason:%s, %s", tsMonitorConn.conn, tstrerror(code), tsMonitorConn.sql);
|
||||
if (tsMonitorConn.cmdIndex == MONITOR_CMD_CREATE_TB_LOG) {
|
||||
monitorPrint("dnode:%s is started", tsLocalEp);
|
||||
monitorInfo("dnode:%s is started", tsLocalEp);
|
||||
}
|
||||
tsMonitorConn.cmdIndex++;
|
||||
monitorInitDatabase();
|
||||
|
@ -222,7 +228,7 @@ static void monitorInitDatabaseCb(void *param, TAOS_RES *result, int32_t code) {
|
|||
}
|
||||
|
||||
void monitorStopSystem() {
|
||||
monitorPrint("monitor module is stopped");
|
||||
monitorInfo("monitor module is stopped");
|
||||
tsMonitorConn.state = MONITOR_STATE_STOPPED;
|
||||
if (tsMonitorConn.initTimer != NULL) {
|
||||
taosTmrStopA(&(tsMonitorConn.initTimer));
|
||||
|
@ -234,7 +240,7 @@ void monitorStopSystem() {
|
|||
|
||||
void monitorCleanUpSystem() {
|
||||
monitorStopSystem();
|
||||
monitorPrint("monitor module cleanup");
|
||||
monitorInfo("monitor module cleanup");
|
||||
}
|
||||
|
||||
static void monitorStartTimer() {
|
||||
|
@ -247,7 +253,7 @@ static void dnodeMontiorInsertAcctCallback(void *param, TAOS_RES *result, int32_
|
|||
} else if (code == 0) {
|
||||
monitorError("monitor:%p, save account info failed, affect rows:%d", tsMonitorConn.conn, code);
|
||||
} else {
|
||||
monitorTrace("monitor:%p, save account info success, code:%s", tsMonitorConn.conn, tstrerror(code));
|
||||
monitorDebug("monitor:%p, save account info success, code:%s", tsMonitorConn.conn, tstrerror(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +263,7 @@ static void dnodeMontiorInsertSysCallback(void *param, TAOS_RES *result, int32_t
|
|||
} else if (code == 0) {
|
||||
monitorError("monitor:%p, save system info failed, affect rows:%d %s", tsMonitorConn.conn, code, tsMonitorConn.sql);
|
||||
} else {
|
||||
monitorTrace("monitor:%p, save system info success, code:%s %s", tsMonitorConn.conn, tstrerror(code), tsMonitorConn.sql);
|
||||
monitorDebug("monitor:%p, save system info success, code:%s %s", tsMonitorConn.conn, tstrerror(code), tsMonitorConn.sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +273,7 @@ static void dnodeMontiorInsertLogCallback(void *param, TAOS_RES *result, int32_t
|
|||
} else if (code == 0) {
|
||||
monitorError("monitor:%p, save log failed, affect rows:%d", tsMonitorConn.conn, code);
|
||||
} else {
|
||||
monitorTrace("monitor:%p, save log info success, code:%s", tsMonitorConn.conn, tstrerror(code));
|
||||
monitorDebug("monitor:%p, save log info success, code:%s", tsMonitorConn.conn, tstrerror(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,7 +357,7 @@ static void monitorSaveSystemInfo() {
|
|||
pos += monitorBuildIoSql(sql + pos);
|
||||
pos += monitorBuildReqSql(sql + pos);
|
||||
|
||||
monitorTrace("monitor:%p, save system info, sql:%s", tsMonitorConn.conn, sql);
|
||||
monitorDebug("monitor:%p, save system info, sql:%s", tsMonitorConn.conn, sql);
|
||||
taos_query_a(tsMonitorConn.conn, sql, dnodeMontiorInsertSysCallback, "log");
|
||||
|
||||
if (tsMonitorConn.timer != NULL && tsMonitorConn.state != MONITOR_STATE_STOPPED) {
|
||||
|
@ -389,7 +395,7 @@ void monitorSaveAcctLog(SAcctMonitorObj *pMon) {
|
|||
pMon->totalConns, pMon->maxConns,
|
||||
pMon->accessState);
|
||||
|
||||
monitorTrace("monitor:%p, save account info, sql %s", tsMonitorConn.conn, sql);
|
||||
monitorDebug("monitor:%p, save account info, sql %s", tsMonitorConn.conn, sql);
|
||||
taos_query_a(tsMonitorConn.conn, sql, dnodeMontiorInsertAcctCallback, "account");
|
||||
}
|
||||
|
||||
|
@ -413,14 +419,14 @@ void monitorSaveLog(int32_t level, const char *const format, ...) {
|
|||
len += sprintf(sql + len, "', '%s')", tsLocalEp);
|
||||
sql[len++] = 0;
|
||||
|
||||
monitorTrace("monitor:%p, save log, sql: %s", tsMonitorConn.conn, sql);
|
||||
monitorDebug("monitor:%p, save log, sql: %s", tsMonitorConn.conn, sql);
|
||||
taos_query_a(tsMonitorConn.conn, sql, dnodeMontiorInsertLogCallback, "log");
|
||||
}
|
||||
|
||||
void monitorExecuteSQL(char *sql) {
|
||||
if (tsMonitorConn.state != MONITOR_STATE_INITIALIZED) return;
|
||||
|
||||
monitorTrace("monitor:%p, execute sql: %s", tsMonitorConn.conn, sql);
|
||||
monitorDebug("monitor:%p, execute sql: %s", tsMonitorConn.conn, sql);
|
||||
|
||||
// bug while insert binary
|
||||
// taos_query_a(tsMonitorConn.conn, sql, NULL, NULL);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue