提交 5a9fd5e9 编写于 作者: S shenglian zhou

Merge branch 'develop' into szhou/hotfix/tbname-group-limit

...@@ -152,6 +152,17 @@ IF (TD_BUILD_HTTP) ...@@ -152,6 +152,17 @@ IF (TD_BUILD_HTTP)
ADD_DEFINITIONS(-DHTTP_EMBEDDED) ADD_DEFINITIONS(-DHTTP_EMBEDDED)
ENDIF () ENDIF ()
IF (${BUILD_LUA} MATCHES "false")
SET(TD_BUILD_LUA FALSE)
ENDIF ()
IF (TD_BUILD_LUA)
MESSAGE("Enable lua")
ADD_DEFINITIONS(-DLUA_EMBEDDED)
ELSE ()
MESSAGE("Disable lua")
ENDIF ()
IF ("${AVRO_SUPPORT}" MATCHES "true") IF ("${AVRO_SUPPORT}" MATCHES "true")
SET(TD_AVRO_SUPPORT TRUE) SET(TD_AVRO_SUPPORT TRUE)
ELSEIF ("${AVRO_SUPPORT}" MATCHES "false") ELSEIF ("${AVRO_SUPPORT}" MATCHES "false")
......
...@@ -92,6 +92,8 @@ ENDIF () ...@@ -92,6 +92,8 @@ ENDIF ()
SET(TD_BUILD_HTTP FALSE) SET(TD_BUILD_HTTP FALSE)
SET(TD_BUILD_LUA TRUE)
SET(TD_AVRO_SUPPORT FALSE) SET(TD_AVRO_SUPPORT FALSE)
SET(TD_MEMORY_SANITIZER FALSE) SET(TD_MEMORY_SANITIZER FALSE)
......
...@@ -15,7 +15,10 @@ ADD_SUBDIRECTORY(cJson) ...@@ -15,7 +15,10 @@ ADD_SUBDIRECTORY(cJson)
ADD_SUBDIRECTORY(wepoll) ADD_SUBDIRECTORY(wepoll)
ADD_SUBDIRECTORY(MsvcLibX) ADD_SUBDIRECTORY(MsvcLibX)
ADD_SUBDIRECTORY(rmonotonic) ADD_SUBDIRECTORY(rmonotonic)
ADD_SUBDIRECTORY(lua)
IF (TD_BUILD_LUA)
ADD_SUBDIRECTORY(lua)
ENDIF ()
IF (TD_LINUX AND TD_MQTT) IF (TD_LINUX AND TD_MQTT)
ADD_SUBDIRECTORY(MQTT-C) ADD_SUBDIRECTORY(MQTT-C)
......
...@@ -190,7 +190,7 @@ taosdemo 详细使用方法请参照 [如何使用taosdemo对TDengine进行性 ...@@ -190,7 +190,7 @@ taosdemo 详细使用方法请参照 [如何使用taosdemo对TDengine进行性
### TDengine 服务器支持的平台列表 ### TDengine 服务器支持的平台列表
| | **CentOS 6/7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | **华为 EulerOS** | | | **CentOS 7/8** | **Ubuntu 16/18/20** | **Other Linux** | **统信 UOS** | **银河/中标麒麟** | **凝思 V60/V80** | **华为 EulerOS** |
| -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- | --------------------- | | -------------- | --------------------- | ------------------------ | --------------- | --------------- | ------------------------- | --------------------- | --------------------- |
| X64 | ● | ● | | ○ | ● | ● | ● | | X64 | ● | ● | | ○ | ● | ● | ● |
| 龙芯 MIPS64 | | | ● | | | | | | 龙芯 MIPS64 | | | ● | | | | |
......
...@@ -468,8 +468,8 @@ function install_service_on_systemd() { ...@@ -468,8 +468,8 @@ function install_service_on_systemd() {
function install_taosadapter_service() { function install_taosadapter_service() {
if ((${service_mod}==0)); then if ((${service_mod}==0)); then
[ -f ${script_dir}/cfg/taosadapter.service ] &&\ [ -f ${script_dir}/../cfg/taosadapter.service ] &&\
${csudo} cp ${script_dir}/cfg/taosadapter.service \ ${csudo} cp ${script_dir}/../cfg/taosadapter.service \
${service_config_dir}/ || : ${service_config_dir}/ || :
${csudo} systemctl daemon-reload ${csudo} systemctl daemon-reload
fi fi
......
...@@ -62,7 +62,7 @@ typedef struct SRetrieveSupport { ...@@ -62,7 +62,7 @@ typedef struct SRetrieveSupport {
uint32_t numOfRetry; // record the number of retry times uint32_t numOfRetry; // record the number of retry times
} SRetrieveSupport; } SRetrieveSupport;
int32_t tscCreateGlobalMergerEnv(SQueryInfo* pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub, tOrderDescriptor **pDesc, uint32_t nBufferSize, int64_t id); int32_t tscCreateGlobalMergerEnv(SQueryInfo* pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub, tOrderDescriptor **pDesc, uint32_t* nBufferSize, int64_t id);
void tscDestroyGlobalMergerEnv(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDesc, int32_t numOfVnodes); void tscDestroyGlobalMergerEnv(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDesc, int32_t numOfVnodes);
......
...@@ -407,8 +407,8 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo* ...@@ -407,8 +407,8 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo*
} }
int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub, int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBuffer, int32_t numOfSub,
tOrderDescriptor **pOrderDesc, uint32_t nBufferSizes, int64_t id) { tOrderDescriptor **pOrderDesc, uint32_t* nBufferSizes, int64_t id) {
SSchema *pSchema = NULL; SSchema1 *pSchema = NULL;
SColumnModel *pModel = NULL; SColumnModel *pModel = NULL;
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
...@@ -421,7 +421,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu ...@@ -421,7 +421,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
size_t size = tscNumOfExprs(pQueryInfo); size_t size = tscNumOfExprs(pQueryInfo);
pSchema = (SSchema *)calloc(1, sizeof(SSchema) * size); pSchema = (SSchema1 *)calloc(1, sizeof(SSchema1) * size);
if (pSchema == NULL) { if (pSchema == NULL) {
tscError("0x%"PRIx64" failed to allocate memory", id); tscError("0x%"PRIx64" failed to allocate memory", id);
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
...@@ -440,7 +440,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu ...@@ -440,7 +440,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
int32_t capacity = 0; int32_t capacity = 0;
if (rlen != 0) { if (rlen != 0) {
capacity = nBufferSizes / rlen; if ((*nBufferSizes) < rlen) {
(*nBufferSizes) = rlen * 2;
}
capacity = (*nBufferSizes) / rlen;
} }
pModel = createColumnModel(pSchema, (int32_t)size, capacity); pModel = createColumnModel(pSchema, (int32_t)size, capacity);
...@@ -457,7 +460,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu ...@@ -457,7 +460,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
assert(numOfSub <= pTableMetaInfo->vgroupList->numOfVgroups); assert(numOfSub <= pTableMetaInfo->vgroupList->numOfVgroups);
for (int32_t i = 0; i < numOfSub; ++i) { for (int32_t i = 0; i < numOfSub; ++i) {
(*pMemBuffer)[i] = createExtMemBuffer(nBufferSizes, rlen, pg, pModel); (*pMemBuffer)[i] = createExtMemBuffer(*nBufferSizes, rlen, pg, pModel);
(*pMemBuffer)[i]->flushModel = MULTIPLE_APPEND_MODEL; (*pMemBuffer)[i]->flushModel = MULTIPLE_APPEND_MODEL;
} }
......
...@@ -156,13 +156,15 @@ static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableNa ...@@ -156,13 +156,15 @@ static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableNa
SStringBuilder sb; memset(&sb, 0, sizeof(sb)); SStringBuilder sb; memset(&sb, 0, sizeof(sb));
char sTableName[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; char sTableName[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0};
strtolower(sTableName, point->stableName); strncpy(sTableName, point->stableName, strlen(point->stableName));
//strtolower(sTableName, point->stableName);
taosStringBuilderAppendString(&sb, sTableName); taosStringBuilderAppendString(&sb, sTableName);
for (int j = 0; j < point->tagNum; ++j) { for (int j = 0; j < point->tagNum; ++j) {
taosStringBuilderAppendChar(&sb, ','); taosStringBuilderAppendChar(&sb, ',');
TAOS_SML_KV* tagKv = point->tags + j; TAOS_SML_KV* tagKv = point->tags + j;
char tagName[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; char tagName[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0};
strtolower(tagName, tagKv->key); strncpy(tagName, tagKv->key, strlen(tagKv->key));
//strtolower(tagName, tagKv->key);
taosStringBuilderAppendString(&sb, tagName); taosStringBuilderAppendString(&sb, tagName);
taosStringBuilderAppendChar(&sb, '='); taosStringBuilderAppendChar(&sb, '=');
taosStringBuilderAppend(&sb, tagKv->value, tagKv->length); taosStringBuilderAppend(&sb, tagKv->value, tagKv->length);
...@@ -261,10 +263,10 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint, ...@@ -261,10 +263,10 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint,
static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash, SArray* dbAttrArray, bool isTag, char sTableName[], static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash, SArray* dbAttrArray, bool isTag, char sTableName[],
SSchemaAction* action, bool* actionNeeded, SSmlLinesInfo* info) { SSchemaAction* action, bool* actionNeeded, SSmlLinesInfo* info) {
char fieldNameLowerCase[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0}; char fieldName[TSDB_COL_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0};
strtolower(fieldNameLowerCase, pointColField->name); strcpy(fieldName, pointColField->name);
size_t* pDbIndex = taosHashGet(dbAttrHash, fieldNameLowerCase, strlen(fieldNameLowerCase)); size_t* pDbIndex = taosHashGet(dbAttrHash, fieldName, strlen(fieldName));
if (pDbIndex) { if (pDbIndex) {
SSchema* dbAttr = taosArrayGet(dbAttrArray, *pDbIndex); SSchema* dbAttr = taosArrayGet(dbAttrArray, *pDbIndex);
assert(strcasecmp(dbAttr->name, pointColField->name) == 0); assert(strcasecmp(dbAttr->name, pointColField->name) == 0);
...@@ -297,7 +299,7 @@ static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash ...@@ -297,7 +299,7 @@ static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash
*actionNeeded = true; *actionNeeded = true;
} }
if (*actionNeeded) { if (*actionNeeded) {
tscDebug("SML:0x%" PRIx64 " generate schema action. column name: %s, action: %d", info->id, fieldNameLowerCase, tscDebug("SML:0x%" PRIx64 " generate schema action. column name: %s, action: %d", info->id, fieldName,
action->action); action->action);
} }
return 0; return 0;
...@@ -536,11 +538,8 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl ...@@ -536,11 +538,8 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl
tscDebug("SML:0x%" PRIx64 " retrieve table meta. super table name: %s", info->id, tableName); tscDebug("SML:0x%" PRIx64 " retrieve table meta. super table name: %s", info->id, tableName);
char tableNameLowerCase[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE];
strtolower(tableNameLowerCase, tableName);
char sql[256]; char sql[256];
snprintf(sql, 256, "describe %s", tableNameLowerCase); snprintf(sql, 256, "describe %s", tableName);
TAOS_RES* res = taos_query(taos, sql); TAOS_RES* res = taos_query(taos, sql);
code = taos_errno(res); code = taos_errno(res);
if (code != 0) { if (code != 0) {
...@@ -561,8 +560,10 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl ...@@ -561,8 +560,10 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl
pSql->fp = NULL; pSql->fp = NULL;
registerSqlObj(pSql); registerSqlObj(pSql);
SStrToken tableToken = {.z = tableNameLowerCase, .n = (uint32_t)strlen(tableNameLowerCase), .type = TK_ID}; char tableNameBuf[TSDB_TABLE_NAME_LEN + TS_ESCAPE_CHAR_SIZE] = {0};
tGetToken(tableNameLowerCase, &tableToken.type); memcpy(tableNameBuf, tableName, strlen(tableName));
SStrToken tableToken = {.z = tableNameBuf, .n = (uint32_t)strlen(tableName), .type = TK_ID};
tGetToken(tableNameBuf, &tableToken.type);
bool dbIncluded = false; bool dbIncluded = false;
// Check if the table name available or not // Check if the table name available or not
if (tscValidateName(&tableToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) { if (tscValidateName(&tableToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) {
...@@ -1870,24 +1871,14 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLine ...@@ -1870,24 +1871,14 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLine
bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) { bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) {
char *val = NULL; char *val = NULL;
char *cur = key; val = taosHashGet(pHash, key, strlen(key));
char keyLower[TSDB_COL_NAME_LEN];
size_t keyLen = 0;
while(*cur != '\0') {
keyLower[keyLen] = tolower(*cur);
keyLen++;
cur++;
}
keyLower[keyLen] = '\0';
val = taosHashGet(pHash, keyLower, keyLen);
if (val) { if (val) {
tscError("SML:0x%"PRIx64" Duplicate key detected:%s", info->id, keyLower); tscError("SML:0x%"PRIx64" Duplicate key detected:%s", info->id, key);
return true; return true;
} }
uint8_t dummy_val = 0; uint8_t dummy_val = 0;
taosHashPut(pHash, keyLower, strlen(key), &dummy_val, sizeof(uint8_t)); taosHashPut(pHash, key, strlen(key), &dummy_val, sizeof(uint8_t));
return false; return false;
} }
...@@ -1925,7 +1916,6 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash ...@@ -1925,7 +1916,6 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
pKV->key = calloc(len + TS_ESCAPE_CHAR_SIZE + 1, 1); pKV->key = calloc(len + TS_ESCAPE_CHAR_SIZE + 1, 1);
memcpy(pKV->key, key, len + 1); memcpy(pKV->key, key, len + 1);
strntolower_s(pKV->key, pKV->key, (int32_t)len);
addEscapeCharToString(pKV->key, len); addEscapeCharToString(pKV->key, len);
tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len); tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
*index = cur + 1; *index = cur + 1;
...@@ -2053,7 +2043,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index ...@@ -2053,7 +2043,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
if (*cur == '\\') { if (*cur == '\\') {
escapeSpecialCharacter(1, &cur); escapeSpecialCharacter(1, &cur);
} }
pSml->stableName[len] = tolower(*cur); pSml->stableName[len] = *cur;
cur++; cur++;
len++; len++;
} }
...@@ -2129,7 +2119,6 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, ...@@ -2129,7 +2119,6 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
if (!isField && childTableNameLen != 0 && strcasecmp(pkv->key, childTableName) == 0) { if (!isField && childTableNameLen != 0 && strcasecmp(pkv->key, childTableName) == 0) {
smlData->childTableName = malloc(pkv->length + TS_ESCAPE_CHAR_SIZE + 1); smlData->childTableName = malloc(pkv->length + TS_ESCAPE_CHAR_SIZE + 1);
memcpy(smlData->childTableName, pkv->value, pkv->length); memcpy(smlData->childTableName, pkv->value, pkv->length);
strntolower_s(smlData->childTableName, smlData->childTableName, (int32_t)pkv->length);
addEscapeCharToString(smlData->childTableName, (int32_t)pkv->length); addEscapeCharToString(smlData->childTableName, (int32_t)pkv->length);
free(pkv->key); free(pkv->key);
free(pkv->value); free(pkv->value);
......
...@@ -65,7 +65,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index, ...@@ -65,7 +65,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
} }
} }
pSml->stableName[len] = tolower(*cur); pSml->stableName[len] = *cur;
cur++; cur++;
len++; len++;
...@@ -241,7 +241,6 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj ...@@ -241,7 +241,6 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
pKV->key = tcalloc(len + TS_ESCAPE_CHAR_SIZE + 1, 1); pKV->key = tcalloc(len + TS_ESCAPE_CHAR_SIZE + 1, 1);
memcpy(pKV->key, key, len + 1); memcpy(pKV->key, key, len + 1);
strntolower_s(pKV->key, pKV->key, (int32_t)len);
addEscapeCharToString(pKV->key, len); addEscapeCharToString(pKV->key, len);
//tscDebug("OTD:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len); //tscDebug("OTD:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
*index = cur + 1; *index = cur + 1;
...@@ -327,7 +326,6 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs, ...@@ -327,7 +326,6 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs,
*childTableName = tcalloc(pkv->length + TS_ESCAPE_CHAR_SIZE + 1, 1); *childTableName = tcalloc(pkv->length + TS_ESCAPE_CHAR_SIZE + 1, 1);
memcpy(*childTableName, pkv->value, pkv->length); memcpy(*childTableName, pkv->value, pkv->length);
(*childTableName)[pkv->length] = '\0'; (*childTableName)[pkv->length] = '\0';
strntolower_s(*childTableName, *childTableName, (int32_t)pkv->length);
addEscapeCharToString(*childTableName, pkv->length); addEscapeCharToString(*childTableName, pkv->length);
tfree(pkv->key); tfree(pkv->key);
tfree(pkv->value); tfree(pkv->value);
...@@ -515,7 +513,6 @@ static int32_t parseMetricFromJSON(cJSON *root, TAOS_SML_DATA_POINT* pSml, SSmlL ...@@ -515,7 +513,6 @@ static int32_t parseMetricFromJSON(cJSON *root, TAOS_SML_DATA_POINT* pSml, SSmlL
*/ */
tstrncpy(pSml->stableName, metric->valuestring, stableLen + 1); tstrncpy(pSml->stableName, metric->valuestring, stableLen + 1);
strntolower_s(pSml->stableName, pSml->stableName, (int32_t)stableLen);
addEscapeCharToString(pSml->stableName, (int32_t)stableLen); addEscapeCharToString(pSml->stableName, (int32_t)stableLen);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -546,7 +543,6 @@ static int32_t parseTimestampFromJSONObj(cJSON *root, int64_t *tsVal, SSmlLinesI ...@@ -546,7 +543,6 @@ static int32_t parseTimestampFromJSONObj(cJSON *root, int64_t *tsVal, SSmlLinesI
} }
size_t typeLen = strlen(type->valuestring); size_t typeLen = strlen(type->valuestring);
strntolower_s(type->valuestring, type->valuestring, (int32_t)typeLen);
if (typeLen == 1 && type->valuestring[0] == 's') { if (typeLen == 1 && type->valuestring[0] == 's') {
//seconds //seconds
*tsVal = (int64_t)(*tsVal * 1e9); *tsVal = (int64_t)(*tsVal * 1e9);
...@@ -915,7 +911,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, ...@@ -915,7 +911,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
size_t idLen = strlen(id->valuestring); size_t idLen = strlen(id->valuestring);
*childTableName = tcalloc(idLen + TS_ESCAPE_CHAR_SIZE + 1, sizeof(char)); *childTableName = tcalloc(idLen + TS_ESCAPE_CHAR_SIZE + 1, sizeof(char));
memcpy(*childTableName, id->valuestring, idLen); memcpy(*childTableName, id->valuestring, idLen);
strntolower_s(*childTableName, *childTableName, (int32_t)idLen);
addEscapeCharToString(*childTableName, (int32_t)idLen); addEscapeCharToString(*childTableName, (int32_t)idLen);
//check duplicate IDs //check duplicate IDs
...@@ -954,7 +949,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs, ...@@ -954,7 +949,6 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
} }
pkv->key = tcalloc(keyLen + TS_ESCAPE_CHAR_SIZE + 1, sizeof(char)); pkv->key = tcalloc(keyLen + TS_ESCAPE_CHAR_SIZE + 1, sizeof(char));
strncpy(pkv->key, tag->string, keyLen); strncpy(pkv->key, tag->string, keyLen);
strntolower_s(pkv->key, pkv->key, (int32_t)keyLen);
addEscapeCharToString(pkv->key, (int32_t)keyLen); addEscapeCharToString(pkv->key, (int32_t)keyLen);
//value //value
ret = parseValueFromJSON(tag, pkv, info); ret = parseValueFromJSON(tag, pkv, info);
......
...@@ -1623,7 +1623,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { ...@@ -1623,7 +1623,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
pRes->qId = 0; pRes->qId = 0;
pRes->numOfRows = 0; pRes->numOfRows = 0;
strtolower(pSql->sqlstr, sql); strcpy(pSql->sqlstr, sql);
tscDebugL("0x%"PRIx64" SQL: %s", pSql->self, pSql->sqlstr); tscDebugL("0x%"PRIx64" SQL: %s", pSql->self, pSql->sqlstr);
if (tscIsInsertData(pSql->sqlstr)) { if (tscIsInsertData(pSql->sqlstr)) {
......
...@@ -439,7 +439,9 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -439,7 +439,9 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char *msg1 = "invalidate function name"; const char *msg1 = "invalidate function name";
const char *msg2 = "path is too long"; const char *msg2 = "path is too long";
const char *msg3 = "invalid outputtype"; const char *msg3 = "invalid outputtype";
#ifdef LUA_EMBEDDED
const char *msg4 = "invalid script"; const char *msg4 = "invalid script";
#endif
const char *msg5 = "invalid dyn lib"; const char *msg5 = "invalid dyn lib";
SSqlCmd *pCmd = &pSql->cmd; SSqlCmd *pCmd = &pSql->cmd;
...@@ -478,9 +480,12 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -478,9 +480,12 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} }
//validate *.lua or .so //validate *.lua or .so
int32_t pathLen = (int32_t)strlen(createInfo->path.z); int32_t pathLen = (int32_t)strlen(createInfo->path.z);
#ifdef LUA_EMBEDDED
if ((pathLen > 4) && (0 == strncmp(createInfo->path.z + pathLen - 4, ".lua", 4)) && !isValidScript(buf, len)) { if ((pathLen > 4) && (0 == strncmp(createInfo->path.z + pathLen - 4, ".lua", 4)) && !isValidScript(buf, len)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
} else if (pathLen > 3 && (0 == strncmp(createInfo->path.z + pathLen - 3, ".so", 3))) { } else
#endif
if (pathLen > 3 && (0 == strncmp(createInfo->path.z + pathLen - 3, ".so", 3))) {
void *handle = taosLoadDll(createInfo->path.z); void *handle = taosLoadDll(createInfo->path.z);
taosCloseDll(handle); taosCloseDll(handle);
if (handle == NULL) { if (handle == NULL) {
...@@ -2394,7 +2399,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS ...@@ -2394,7 +2399,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
} }
int16_t resType = 0; int16_t resType = 0;
int16_t resBytes = 0; int32_t resBytes = 0;
int32_t interBufSize = 0; int32_t interBufSize = 0;
getResultDataInfo(pSchema->type, pSchema->bytes, f, 0, &resType, &resBytes, &interBufSize, 0, false, pUdfInfo); getResultDataInfo(pSchema->type, pSchema->bytes, f, 0, &resType, &resBytes, &interBufSize, 0, false, pUdfInfo);
...@@ -2633,7 +2638,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2633,7 +2638,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
} }
int16_t resultType = 0; int16_t resultType = 0;
int16_t resultSize = 0; int32_t resultSize = 0;
int32_t intermediateResSize = 0; int32_t intermediateResSize = 0;
if (getResultDataInfo(pSchema->type, pSchema->bytes, functionId, 0, &resultType, &resultSize, if (getResultDataInfo(pSchema->type, pSchema->bytes, functionId, 0, &resultType, &resultSize,
...@@ -2892,7 +2897,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2892,7 +2897,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tVariant* pVariant = &pParamElem[1].pNode->value; tVariant* pVariant = &pParamElem[1].pNode->value;
int16_t resultType = pSchema->type; int16_t resultType = pSchema->type;
int16_t resultSize = pSchema->bytes; int32_t resultSize = pSchema->bytes;
int32_t interResult = 0; int32_t interResult = 0;
char val[8] = {0}; char val[8] = {0};
...@@ -3074,7 +3079,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -3074,7 +3079,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
s = pTagSchema[index.columnIndex]; s = pTagSchema[index.columnIndex];
} }
int16_t bytes = 0; int32_t bytes = 0;
int16_t type = 0; int16_t type = 0;
int32_t inter = 0; int32_t inter = 0;
...@@ -3101,7 +3106,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -3101,7 +3106,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
int32_t inter = 0; int32_t inter = 0;
int16_t resType = 0; int16_t resType = 0;
int16_t bytes = 0; int32_t bytes = 0;
getResultDataInfo(TSDB_DATA_TYPE_INT, 4, TSDB_FUNC_BLKINFO, 0, &resType, &bytes, &inter, 0, 0, NULL); getResultDataInfo(TSDB_DATA_TYPE_INT, 4, TSDB_FUNC_BLKINFO, 0, &resType, &bytes, &inter, 0, 0, NULL);
...@@ -3154,7 +3159,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -3154,7 +3159,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
int32_t inter = 0; int32_t inter = 0;
int16_t resType = 0; int16_t resType = 0;
int16_t bytes = 0; int32_t bytes = 0;
getResultDataInfo(TSDB_DATA_TYPE_INT, 4, functionId, 0, &resType, &bytes, &inter, 0, false, pUdfInfo); getResultDataInfo(TSDB_DATA_TYPE_INT, 4, functionId, 0, &resType, &bytes, &inter, 0, false, pUdfInfo);
SExprInfo* pExpr = tscExprAppend(pQueryInfo, functionId, &index, resType, bytes, getNewResColId(pCmd), inter, false); SExprInfo* pExpr = tscExprAppend(pQueryInfo, functionId, &index, resType, bytes, getNewResColId(pCmd), inter, false);
...@@ -3474,7 +3479,7 @@ int32_t tscTansformFuncForSTableQuery(SQueryInfo* pQueryInfo) { ...@@ -3474,7 +3479,7 @@ int32_t tscTansformFuncForSTableQuery(SQueryInfo* pQueryInfo) {
assert(tscGetNumOfTags(pTableMetaInfo->pTableMeta) >= 0); assert(tscGetNumOfTags(pTableMetaInfo->pTableMeta) >= 0);
int16_t bytes = 0; int32_t bytes = 0;
int16_t type = 0; int16_t type = 0;
int32_t interBytes = 0; int32_t interBytes = 0;
...@@ -6361,6 +6366,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -6361,6 +6366,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
// the schema is located after the pMsg body, then followed by true tag value // the schema is located after the pMsg body, then followed by true tag value
char* d = pUpdateMsg->data; char* d = pUpdateMsg->data;
SSchema* pTagCols = tscGetTableTagSchema(pTableMeta); SSchema* pTagCols = tscGetTableTagSchema(pTableMeta);
for (int i = 0; i < numOfTags; ++i) { for (int i = 0; i < numOfTags; ++i) {
STColumn* pCol = (STColumn*) d; STColumn* pCol = (STColumn*) d;
pCol->colId = htons(pTagCols[i].colId); pCol->colId = htons(pTagCols[i].colId);
...@@ -6415,6 +6421,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -6415,6 +6421,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen}; SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen};
//handle Escape character backstick
bool inEscape = false;
if (name.z[0] == TS_ESCAPE_CHAR && name.z[name.n - 1] == TS_ESCAPE_CHAR) {
inEscape = true;
name.type = TK_ID;
}
if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) { if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(pMsg, msg17); return invalidOperationMsg(pMsg, msg17);
} }
...@@ -6425,6 +6439,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -6425,6 +6439,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char name1[TSDB_COL_NAME_LEN] = {0}; char name1[TSDB_COL_NAME_LEN] = {0};
tstrncpy(name1, pItem->pVar.pz, sizeof(name1)); tstrncpy(name1, pItem->pVar.pz, sizeof(name1));
int32_t nameLen = pItem->pVar.nLen;
if (inEscape) {
memmove(name1, name1 + 1, nameLen);
name1[nameLen - TS_ESCAPE_CHAR_SIZE] = '\0';
}
TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes); TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) { } else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) {
...@@ -6440,11 +6461,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -6440,11 +6461,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER; SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)}; SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)};
//handle Escape character backstick //handle Escape character backstick
bool inEscape = false;
if (name.z[0] == TS_ESCAPE_CHAR && name.z[name.n - 1] == TS_ESCAPE_CHAR) { if (name.z[0] == TS_ESCAPE_CHAR && name.z[name.n - 1] == TS_ESCAPE_CHAR) {
memmove(name.z, name.z + 1, name.n); inEscape = true;
name.z[name.n - TS_ESCAPE_CHAR_SIZE] = '\0'; name.type = TK_ID;
name.n -= TS_ESCAPE_CHAR_SIZE;
} }
if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) { if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
...@@ -6480,6 +6502,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -6480,6 +6502,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if (nLen >= TSDB_MAX_BYTES_PER_ROW) { if (nLen >= TSDB_MAX_BYTES_PER_ROW) {
return invalidOperationMsg(pMsg, msg24); return invalidOperationMsg(pMsg, msg24);
} }
if (inEscape) {
memmove(name.z, name.z + 1, name.n);
name.z[name.n - TS_ESCAPE_CHAR_SIZE] = '\0';
name.n -= TS_ESCAPE_CHAR_SIZE;
}
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes); TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
}else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) { }else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) {
......
...@@ -1536,7 +1536,17 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1536,7 +1536,17 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg += sizeof(SCreateTableMsg); pMsg += sizeof(SCreateTableMsg);
SCreatedTableInfo* p = taosArrayGet(list, i); SCreatedTableInfo* p = taosArrayGet(list, i);
strcpy(pCreate->tableName, p->fullname); //what pCreate->tableName point is a fixed char array which size is 237
//what p->fullname point is a char*
//before the time we copy p->fullname to pCreate->tableName , we need to check the length of p->fullname
if (strlen(p->fullname) > 237) {
tscError("failed to write this name, which is over 237, just save the first 237 char here");
strncpy(pCreate->tableName, p->fullname,237);
pCreate->tableName[236]='\0';//I don't know if this line is working properly
}else{
strcpy(pCreate->tableName, p->fullname);
}
pCreate->igExists = (p->igExist)? 1 : 0; pCreate->igExists = (p->igExist)? 1 : 0;
// use dbinfo from table id without modifying current db info // use dbinfo from table id without modifying current db info
......
...@@ -2000,7 +2000,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter ...@@ -2000,7 +2000,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
colIndex.columnIndex = tscGetTagColIndexById(pTableMetaInfo->pTableMeta, tagColId); colIndex.columnIndex = tscGetTagColIndexById(pTableMetaInfo->pTableMeta, tagColId);
int16_t bytes = 0; int32_t bytes = 0;
int16_t type = 0; int16_t type = 0;
int32_t inter = 0; int32_t inter = 0;
...@@ -2636,7 +2636,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { ...@@ -2636,7 +2636,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
pRes->qId = 0x1; // hack the qhandle check pRes->qId = 0x1; // hack the qhandle check
const uint32_t nBufferSize = (1u << 18u); // 256KB, default buffer size uint32_t nBufferSize = (1u << 18u); // 256KB, default buffer size
SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd); SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd);
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
...@@ -2652,7 +2652,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { ...@@ -2652,7 +2652,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
return ret; return ret;
} }
ret = tscCreateGlobalMergerEnv(pQueryInfo, &pMemoryBuf, pSql->subState.numOfSub, &pDesc, nBufferSize, pSql->self); ret = tscCreateGlobalMergerEnv(pQueryInfo, &pMemoryBuf, pSql->subState.numOfSub, &pDesc, &nBufferSize, pSql->self);
if (ret != 0) { if (ret != 0) {
pRes->code = ret; pRes->code = ret;
tscAsyncResultOnError(pSql); tscAsyncResultOnError(pSql);
......
...@@ -210,9 +210,9 @@ void taos_init_imp(void) { ...@@ -210,9 +210,9 @@ void taos_init_imp(void) {
taosInitNotes(); taosInitNotes();
rpcInit(); rpcInit();
#ifdef LUA_EMBEDDED
scriptEnvPoolInit(); scriptEnvPoolInit();
#endif
tscDebug("starting to initialize TAOS client ..."); tscDebug("starting to initialize TAOS client ...");
tscDebug("Local End Point is:%s", tsLocalEp); tscDebug("Local End Point is:%s", tsLocalEp);
} }
...@@ -276,7 +276,9 @@ void taos_cleanup(void) { ...@@ -276,7 +276,9 @@ void taos_cleanup(void) {
} }
if (tscEmbedded == 0) { if (tscEmbedded == 0) {
#ifdef LUA_EMBEDDED
scriptEnvPoolCleanup(); scriptEnvPoolCleanup();
#endif
} }
int32_t id = tscObjRef; int32_t id = tscObjRef;
......
...@@ -148,6 +148,7 @@ extern char tsMqttTopic[]; ...@@ -148,6 +148,7 @@ extern char tsMqttTopic[];
// monitor // monitor
extern int8_t tsEnableMonitorModule; extern int8_t tsEnableMonitorModule;
extern int8_t tsMonitorReplica;
extern char tsMonitorDbName[]; extern char tsMonitorDbName[];
extern char tsInternalPass[]; extern char tsInternalPass[];
extern int32_t tsMonitorInterval; extern int32_t tsMonitorInterval;
......
...@@ -51,7 +51,7 @@ typedef struct SSqlExpr { ...@@ -51,7 +51,7 @@ typedef struct SSqlExpr {
int16_t functionId; // function id in aAgg array int16_t functionId; // function id in aAgg array
int16_t resType; // return value type int16_t resType; // return value type
int16_t resBytes; // length of return value int32_t resBytes; // length of return value
int32_t interBytes; // inter result buffer size int32_t interBytes; // inter result buffer size
int16_t colType; // table column type int16_t colType; // table column type
......
...@@ -39,7 +39,7 @@ typedef struct tVariant { ...@@ -39,7 +39,7 @@ typedef struct tVariant {
bool tVariantIsValid(tVariant *pVar); bool tVariantIsValid(tVariant *pVar);
void tVariantCreate(tVariant *pVar, SStrToken *token); void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape);
void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32_t type); void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32_t type);
......
...@@ -193,6 +193,7 @@ char tsMqttTopic[TSDB_MQTT_TOPIC_LEN] = "/test"; // # ...@@ -193,6 +193,7 @@ char tsMqttTopic[TSDB_MQTT_TOPIC_LEN] = "/test"; // #
// monitor // monitor
int8_t tsEnableMonitorModule = 1; int8_t tsEnableMonitorModule = 1;
int8_t tsMonitorReplica = 1;
char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log"; char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log";
char tsInternalPass[] = "secretkey"; char tsInternalPass[] = "secretkey";
int32_t tsMonitorInterval = 30; // seconds int32_t tsMonitorInterval = 30; // seconds
...@@ -669,6 +670,16 @@ static void doInitGlobalConfig(void) { ...@@ -669,6 +670,16 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_SECOND; cfg.unitType = TAOS_CFG_UTYPE_SECOND;
taosInitConfigOption(cfg); taosInitConfigOption(cfg);
cfg.option = "monitorReplica";
cfg.ptr = &tsMonitorReplica;
cfg.valType = TAOS_CFG_VTYPE_INT8;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 1;
cfg.maxValue = 3;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "offlineThreshold"; cfg.option = "offlineThreshold";
cfg.ptr = &tsOfflineThreshold; cfg.ptr = &tsOfflineThreshold;
cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.valType = TAOS_CFG_VTYPE_INT32;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
assert(0); \ assert(0); \
} while (0) } while (0)
void tVariantCreate(tVariant *pVar, SStrToken *token) { void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) {
int32_t ret = 0; int32_t ret = 0;
int32_t type = token->type; int32_t type = token->type;
...@@ -81,7 +81,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) { ...@@ -81,7 +81,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case TSDB_DATA_TYPE_BINARY: { case TSDB_DATA_TYPE_BINARY: {
pVar->pz = strndup(token->z, token->n); pVar->pz = strndup(token->z, token->n);
pVar->nLen = strRmquoteEscape(pVar->pz, token->n); pVar->nLen = needRmquoteEscape ? strRmquoteEscape(pVar->pz, token->n) : token->n;
break; break;
} }
case TSDB_DATA_TYPE_TIMESTAMP: { case TSDB_DATA_TYPE_TIMESTAMP: {
......
...@@ -29,8 +29,8 @@ extern "C" { ...@@ -29,8 +29,8 @@ extern "C" {
extern int32_t dDebugFlag; extern int32_t dDebugFlag;
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); }} #define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); dnodeIncDnodeError(); }}
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); }} #define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); dnodeIncDnodeError(); }}
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", 255, __VA_ARGS__); }} #define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", 255, __VA_ARGS__); }}
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", 255, __VA_ARGS__); }} #define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", 255, __VA_ARGS__); }}
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }} #define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
......
...@@ -54,6 +54,7 @@ void moduleStop() {} ...@@ -54,6 +54,7 @@ void moduleStop() {}
void *tsDnodeTmr = NULL; void *tsDnodeTmr = NULL;
static SRunStatus tsRunStatus = TSDB_RUN_STATUS_STOPPED; static SRunStatus tsRunStatus = TSDB_RUN_STATUS_STOPPED;
static int64_t tsDnodeErrors = 0;
static int32_t dnodeInitStorage(); static int32_t dnodeInitStorage();
static void dnodeCleanupStorage(); static void dnodeCleanupStorage();
...@@ -88,7 +89,9 @@ static SStep tsDnodeSteps[] = { ...@@ -88,7 +89,9 @@ static SStep tsDnodeSteps[] = {
{"dnode-shell", dnodeInitShell, dnodeCleanupShell}, {"dnode-shell", dnodeInitShell, dnodeCleanupShell},
{"dnode-statustmr", dnodeInitStatusTimer,dnodeCleanupStatusTimer}, {"dnode-statustmr", dnodeInitStatusTimer,dnodeCleanupStatusTimer},
{"dnode-telemetry", dnodeInitTelemetry, dnodeCleanupTelemetry}, {"dnode-telemetry", dnodeInitTelemetry, dnodeCleanupTelemetry},
#ifdef LUA_EMBEDDED
{"dnode-script", scriptEnvPoolInit, scriptEnvPoolCleanup}, {"dnode-script", scriptEnvPoolInit, scriptEnvPoolCleanup},
#endif
{"dnode-grant", grantInit, grantCleanUp}, {"dnode-grant", grantInit, grantCleanUp},
}; };
...@@ -225,6 +228,14 @@ static void dnodeSetRunStatus(SRunStatus status) { ...@@ -225,6 +228,14 @@ static void dnodeSetRunStatus(SRunStatus status) {
tsRunStatus = status; tsRunStatus = status;
} }
int64_t dnodeGetDnodeError() {
return tsDnodeErrors;
}
void dnodeIncDnodeError() {
atomic_add_fetch_64(&tsDnodeErrors, 1);
}
static void dnodeCheckDataDirOpenned(char *dir) { static void dnodeCheckDataDirOpenned(char *dir) {
char filepath[256] = {0}; char filepath[256] = {0};
sprintf(filepath, "%s/.running", dir); sprintf(filepath, "%s/.running", dir);
......
...@@ -28,8 +28,8 @@ static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); ...@@ -28,8 +28,8 @@ static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *);
static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *); static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *);
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey); static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey);
static void * tsShellRpc = NULL; static void * tsShellRpc = NULL;
static int32_t tsQueryReqNum = 0; static int64_t tsQueryReqNum = 0;
static int32_t tsSubmitReqNum = 0; static int64_t tsSubmitReqNum = 0;
int32_t dnodeInitShell() { int32_t dnodeInitShell() {
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeDispatchToVWriteQueue; dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeDispatchToVWriteQueue;
...@@ -136,9 +136,9 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) { ...@@ -136,9 +136,9 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
} }
if (pMsg->msgType == TSDB_MSG_TYPE_QUERY) { if (pMsg->msgType == TSDB_MSG_TYPE_QUERY) {
atomic_fetch_add_32(&tsQueryReqNum, 1); atomic_fetch_add_64(&tsQueryReqNum, 1);
} else if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) { } else if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) {
atomic_fetch_add_32(&tsSubmitReqNum, 1); atomic_fetch_add_64(&tsSubmitReqNum, 1);
} else {} } else {}
if ( dnodeProcessShellMsgFp[pMsg->msgType] ) { if ( dnodeProcessShellMsgFp[pMsg->msgType] ) {
...@@ -237,15 +237,31 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid) { ...@@ -237,15 +237,31 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid) {
} }
} }
SStatisInfo dnodeGetStatisInfo() { SDnodeStatisInfo dnodeGetStatisInfo() {
SStatisInfo info = {0}; SDnodeStatisInfo info = {0};
if (dnodeGetRunStatus() == TSDB_RUN_STATUS_RUNING) { if (dnodeGetRunStatus() == TSDB_RUN_STATUS_RUNING) {
#ifdef HTTP_EMBEDDED #ifdef HTTP_EMBEDDED
info.httpReqNum = httpGetReqCount(); info.httpReqNum = httpGetReqCount();
#endif #endif
info.queryReqNum = atomic_exchange_32(&tsQueryReqNum, 0); info.queryReqNum = atomic_exchange_64(&tsQueryReqNum, 0);
info.submitReqNum = atomic_exchange_32(&tsSubmitReqNum, 0); info.submitReqNum = atomic_exchange_64(&tsSubmitReqNum, 0);
} }
return info; return info;
} }
int32_t dnodeGetHttpStatusInfo(int32_t index) {
int32_t httpStatus = 0;
#ifdef HTTP_EMBEDDED
httpStatus = httpGetStatusCodeCount(index);
#endif
return httpStatus;
}
void dnodeClearHttpStatusInfo() {
#ifdef HTTP_EMBEDDED
for (int i = 0; i < MAX_HTTP_STATUS_CODE_NUM; ++i) {
httpClearStatusCodeCount(i);
}
#endif
}
...@@ -23,13 +23,16 @@ extern "C" { ...@@ -23,13 +23,16 @@ extern "C" {
#include "trpc.h" #include "trpc.h"
#include "taosmsg.h" #include "taosmsg.h"
#define MAX_HTTP_STATUS_CODE_NUM 63
typedef struct { typedef struct {
int32_t queryReqNum; int64_t queryReqNum;
int32_t submitReqNum; int64_t submitReqNum;
int32_t httpReqNum; int64_t httpReqNum;
} SStatisInfo; } SDnodeStatisInfo;
SStatisInfo dnodeGetStatisInfo(); SDnodeStatisInfo dnodeGetStatisInfo();
int32_t dnodeGetHttpStatusInfo(int32_t index);
void dnodeClearHttpStatusInfo();
bool dnodeIsFirstDeploy(); bool dnodeIsFirstDeploy();
bool dnodeIsMasterEp(char *ep); bool dnodeIsMasterEp(char *ep);
...@@ -37,6 +40,8 @@ void dnodeGetEpSetForPeer(SRpcEpSet *epSet); ...@@ -37,6 +40,8 @@ void dnodeGetEpSetForPeer(SRpcEpSet *epSet);
void dnodeGetEpSetForShell(SRpcEpSet *epSet); void dnodeGetEpSetForShell(SRpcEpSet *epSet);
int32_t dnodeGetDnodeId(); int32_t dnodeGetDnodeId();
void dnodeGetClusterId(char *clusterId); void dnodeGetClusterId(char *clusterId);
int64_t dnodeGetDnodeError();
void dnodeIncDnodeError();
void dnodeUpdateEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port); void dnodeUpdateEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
bool dnodeCheckEpChanged(int32_t dnodeId, char *epstr); bool dnodeCheckEpChanged(int32_t dnodeId, char *epstr);
......
...@@ -22,7 +22,9 @@ extern "C" { ...@@ -22,7 +22,9 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
int32_t httpGetReqCount(); int64_t httpGetReqCount();
int32_t httpGetStatusCodeCount(int index);
int32_t httpClearStatusCodeCount(int index);
int32_t httpInitSystem(); int32_t httpInitSystem();
int32_t httpStartSystem(); int32_t httpStartSystem();
void httpStopSystem(); void httpStopSystem();
......
...@@ -22,6 +22,17 @@ extern "C" { ...@@ -22,6 +22,17 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#define monSaveLogs(level, ...) { \
monSaveLog(level, __VA_ARGS__); \
monSaveDnodeLog(level, __VA_ARGS__); \
}
typedef struct {
const char * name;
int32_t code;
int32_t index;
} SMonHttpStatus;
typedef struct { typedef struct {
char * acctId; char * acctId;
int64_t currentPointsPerSecond; int64_t currentPointsPerSecond;
...@@ -53,9 +64,16 @@ void monStopSystem(); ...@@ -53,9 +64,16 @@ void monStopSystem();
void monCleanupSystem(); void monCleanupSystem();
void monSaveAcctLog(SAcctMonitorObj *pMonObj); void monSaveAcctLog(SAcctMonitorObj *pMonObj);
void monSaveLog(int32_t level, const char *const format, ...); void monSaveLog(int32_t level, const char *const format, ...);
void monSaveDnodeLog(int32_t level, const char *const format, ...);
void monExecuteSQL(char *sql); void monExecuteSQL(char *sql);
typedef void (*MonExecuteSQLCbFP)(void *param, TAOS_RES *, int code); typedef void (*MonExecuteSQLCbFP)(void *param, TAOS_RES *, int code);
void monExecuteSQLWithResultCallback(char *sql, MonExecuteSQLCbFP callback, void* param); void monExecuteSQLWithResultCallback(char *sql, MonExecuteSQLCbFP callback, void* param);
void monIncQueryReqCnt();
void monIncSubmitReqCnt();
int32_t monFetchQueryReqCnt();
int32_t monFetchSubmitReqCnt();
SMonHttpStatus *monGetHttpStatusHashTableEntry(int32_t code);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -438,7 +438,7 @@ typedef struct SColumnFilterList { ...@@ -438,7 +438,7 @@ typedef struct SColumnFilterList {
typedef struct SColumnInfo { typedef struct SColumnInfo {
int16_t colId; int16_t colId;
int16_t type; int16_t type;
int16_t bytes; int32_t bytes;
SColumnFilterList flist; SColumnFilterList flist;
} SColumnInfo; } SColumnInfo;
......
...@@ -22,6 +22,12 @@ extern "C" { ...@@ -22,6 +22,12 @@ extern "C" {
#include "trpc.h" #include "trpc.h"
#include "twal.h" #include "twal.h"
typedef struct {
int64_t submitReqSucNum;
int64_t submitRowNum;
int64_t submitRowSucNum;
} SVnodeStatisInfo;
typedef struct { typedef struct {
int32_t len; int32_t len;
void * rsp; void * rsp;
...@@ -62,7 +68,7 @@ int32_t vnodeOpen(int32_t vgId); ...@@ -62,7 +68,7 @@ int32_t vnodeOpen(int32_t vgId);
int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg); int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg);
int32_t vnodeSync(int32_t vgId); int32_t vnodeSync(int32_t vgId);
int32_t vnodeClose(int32_t vgId); int32_t vnodeClose(int32_t vgId);
int32_t vnodeCompact(int32_t vgId); int32_t vnodeCompact(int32_t vgId);
// vnodeMgmt // vnodeMgmt
int32_t vnodeInitMgmt(); int32_t vnodeInitMgmt();
...@@ -80,6 +86,8 @@ int32_t vnodeWriteToWQueue(void *pVnode, void *pHead, int32_t qtype, void *pRpcM ...@@ -80,6 +86,8 @@ int32_t vnodeWriteToWQueue(void *pVnode, void *pHead, int32_t qtype, void *pRpcM
void vnodeFreeFromWQueue(void *pVnode, SVWriteMsg *pWrite); void vnodeFreeFromWQueue(void *pVnode, SVWriteMsg *pWrite);
int32_t vnodeProcessWrite(void *pVnode, void *pHead, int32_t qtype, void *pRspRet); int32_t vnodeProcessWrite(void *pVnode, void *pHead, int32_t qtype, void *pRspRet);
SVnodeStatisInfo vnodeGetStatisInfo();
// vnodeSync // vnodeSync
void vnodeConfirmForward(void *pVnode, uint64_t version, int32_t code, bool force); void vnodeConfirmForward(void *pVnode, uint64_t version, int32_t code, bool force);
......
...@@ -262,7 +262,7 @@ int32_t shellRunCommand(TAOS* con, char* command) { ...@@ -262,7 +262,7 @@ int32_t shellRunCommand(TAOS* con, char* command) {
} }
if (c == '\\') { if (c == '\\') {
if (quote != 0 && (*command == '_' || *command == '\\')) { if (quote != 0 && (*command == '_' || *command == '%' || *command == '\\')) {
//DO nothing //DO nothing
} else { } else {
esc = true; esc = true;
......
...@@ -141,6 +141,8 @@ extern char configDir[]; ...@@ -141,6 +141,8 @@ extern char configDir[];
{ TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT } { TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT }
#define DEFAULT_DATATYPE \ #define DEFAULT_DATATYPE \
{ "FLOAT", "INT", "FLOAT" } { "FLOAT", "INT", "FLOAT" }
#define DEFAULT_DATALENGTH \
{ 4, 4, 4 }
#define DEFAULT_BINWIDTH 64 #define DEFAULT_BINWIDTH 64
#define DEFAULT_COL_COUNT 4 #define DEFAULT_COL_COUNT 4
#define DEFAULT_LEN_ONE_ROW 76 #define DEFAULT_LEN_ONE_ROW 76
...@@ -306,6 +308,7 @@ typedef struct SArguments_S { ...@@ -306,6 +308,7 @@ typedef struct SArguments_S {
bool async_mode; bool async_mode;
char data_type[MAX_NUM_COLUMNS + 1]; char data_type[MAX_NUM_COLUMNS + 1];
char * dataType[MAX_NUM_COLUMNS + 1]; char * dataType[MAX_NUM_COLUMNS + 1];
int32_t data_length[MAX_NUM_COLUMNS + 1];
uint32_t binwidth; uint32_t binwidth;
uint32_t columnCount; uint32_t columnCount;
uint64_t lenOfOneRow; uint64_t lenOfOneRow;
......
...@@ -1338,9 +1338,10 @@ void setParaFromArg() { ...@@ -1338,9 +1338,10 @@ void setParaFromArg() {
g_args.prepared_rand = min(g_args.insertRows, MAX_PREPARED_RAND); g_args.prepared_rand = min(g_args.insertRows, MAX_PREPARED_RAND);
g_Dbs.aggr_func = g_args.aggr_func; g_Dbs.aggr_func = g_args.aggr_func;
char dataString[TSDB_MAX_BYTES_PER_ROW]; char dataString[TSDB_MAX_BYTES_PER_ROW];
char * data_type = g_args.data_type; char * data_type = g_args.data_type;
char **dataType = g_args.dataType; char ** dataType = g_args.dataType;
int32_t *data_length = g_args.data_length;
memset(dataString, 0, TSDB_MAX_BYTES_PER_ROW); memset(dataString, 0, TSDB_MAX_BYTES_PER_ROW);
...@@ -1469,6 +1470,47 @@ void setParaFromArg() { ...@@ -1469,6 +1470,47 @@ void setParaFromArg() {
} else { } else {
g_Dbs.threadCountForCreateTbl = g_args.nthreads; g_Dbs.threadCountForCreateTbl = g_args.nthreads;
g_Dbs.db[0].superTbls[0].tagCount = 0; g_Dbs.db[0].superTbls[0].tagCount = 0;
for (int i = 0; i < MAX_NUM_COLUMNS; i++) {
if (data_type[i] == TSDB_DATA_TYPE_NULL) {
break;
}
if (1 == regexMatch(dataType[i],
"^(NCHAR|BINARY)(\\([1-9][0-9]*\\))$",
REG_ICASE | REG_EXTENDED)) {
sscanf(dataType[i], "%[^(](%[^)]", type, length);
data_length[i] = atoi(length);
} else {
switch (data_type[i]) {
case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_UTINYINT:
case TSDB_DATA_TYPE_TINYINT:
data_length[i] = sizeof(char);
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
data_length[i] = sizeof(int16_t);
break;
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
data_length[i] = sizeof(int32_t);
break;
case TSDB_DATA_TYPE_TIMESTAMP:
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
data_length[i] = sizeof(int64_t);
break;
case TSDB_DATA_TYPE_FLOAT:
data_length[i] = sizeof(float);
break;
case TSDB_DATA_TYPE_DOUBLE:
data_length[i] = sizeof(double);
break;
default:
data_length[i] = g_args.binwidth;
break;
}
}
}
} }
} }
...@@ -1698,8 +1740,15 @@ void *queryNtableAggrFunc(void *sarg) { ...@@ -1698,8 +1740,15 @@ void *queryNtableAggrFunc(void *sarg) {
double totalT = 0; double totalT = 0;
uint64_t count = 0; uint64_t count = 0;
for (int64_t i = 0; i < ntables; i++) { for (int64_t i = 0; i < ntables; i++) {
sprintf(command, "SELECT %s FROM %s%" PRId64 " WHERE ts>= %" PRIu64, if (g_args.escapeChar) {
aggreFunc[j], tb_prefix, i, startTime); sprintf(command,
"SELECT %s FROM `%s%" PRId64 "` WHERE ts>= %" PRIu64,
aggreFunc[j], tb_prefix, i, startTime);
} else {
sprintf(command,
"SELECT %s FROM %s%" PRId64 " WHERE ts>= %" PRIu64,
aggreFunc[j], tb_prefix, i, startTime);
}
double t = (double)taosGetTimestampUs(); double t = (double)taosGetTimestampUs();
debugPrint("%s() LN%d, sql command: %s\n", __func__, __LINE__, debugPrint("%s() LN%d, sql command: %s\n", __func__, __LINE__,
...@@ -1708,9 +1757,9 @@ void *queryNtableAggrFunc(void *sarg) { ...@@ -1708,9 +1757,9 @@ void *queryNtableAggrFunc(void *sarg) {
int32_t code = taos_errno(pSql); int32_t code = taos_errno(pSql);
if (code != 0) { if (code != 0) {
errorPrint("Failed to query:%s\n", taos_errstr(pSql)); errorPrint("Failed to query <%s>, reason:%s\n", command,
taos_errstr(pSql));
taos_free_result(pSql); taos_free_result(pSql);
taos_close(taos);
fclose(fp); fclose(fp);
free(command); free(command);
return NULL; return NULL;
......
...@@ -868,8 +868,8 @@ int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf, ...@@ -868,8 +868,8 @@ int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
return strlen(recBuf); return strlen(recBuf);
} }
static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp, static int64_t generateData(char *recBuf, char *data_type, int32_t *data_length,
int lenOfBinary) { int64_t timestamp) {
memset(recBuf, 0, MAX_DATA_SIZE); memset(recBuf, 0, MAX_DATA_SIZE);
char *pstr = recBuf; char *pstr = recBuf;
pstr += sprintf(pstr, "(%" PRId64 "", timestamp); pstr += sprintf(pstr, "(%" PRId64 "", timestamp);
...@@ -915,13 +915,13 @@ static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp, ...@@ -915,13 +915,13 @@ static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp,
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
s = calloc(1, lenOfBinary + 1); s = calloc(1, data_length[i] + 1);
if (NULL == s) { if (NULL == s) {
errorPrint("%s", "failed to allocate memory\n"); errorPrint("%s", "failed to allocate memory\n");
return -1; return -1;
} }
rand_string(s, lenOfBinary); rand_string(s, data_length[i]);
pstr += sprintf(pstr, ",\"%s\"", s); pstr += sprintf(pstr, ",\"%s\"", s);
free(s); free(s);
break; break;
...@@ -1156,20 +1156,18 @@ static int32_t generateDataTailWithoutStb( ...@@ -1156,20 +1156,18 @@ static int32_t generateDataTailWithoutStb(
int64_t retLen = 0; int64_t retLen = 0;
char *data_type = g_args.data_type; char * data_type = g_args.data_type;
int lenOfBinary = g_args.binwidth; int32_t *data_length = g_args.data_length;
if (g_args.disorderRatio) { if (g_args.disorderRatio) {
retLen = retLen =
generateData(data, data_type, generateData(data, data_type, data_length,
startTime + getTSRandTail(g_args.timestamp_step, k, startTime + getTSRandTail(g_args.timestamp_step, k,
g_args.disorderRatio, g_args.disorderRatio,
g_args.disorderRange), g_args.disorderRange));
lenOfBinary);
} else { } else {
retLen = generateData(data, data_type, retLen = generateData(data, data_type, data_length,
startTime + g_args.timestamp_step * k, startTime + g_args.timestamp_step * k);
lenOfBinary);
} }
if (len > remainderBufLen) break; if (len > remainderBufLen) break;
......
...@@ -1043,10 +1043,8 @@ int createChildTables() { ...@@ -1043,10 +1043,8 @@ int createChildTables() {
// normal table // normal table
len = snprintf(tblColsBuf, TSDB_MAX_BYTES_PER_ROW, "(TS TIMESTAMP"); len = snprintf(tblColsBuf, TSDB_MAX_BYTES_PER_ROW, "(TS TIMESTAMP");
for (int j = 0; j < g_args.columnCount; j++) { for (int j = 0; j < g_args.columnCount; j++) {
if ((strncasecmp(g_args.dataType[j], "BINARY", if ((strcasecmp(g_args.dataType[j], "BINARY") == 0) ||
strlen("BINARY")) == 0) || (strcasecmp(g_args.dataType[j], "NCHAR") == 0)) {
(strncasecmp(g_args.dataType[j], "NCHAR",
strlen("NCHAR")) == 0)) {
snprintf(tblColsBuf + len, TSDB_MAX_BYTES_PER_ROW - len, snprintf(tblColsBuf + len, TSDB_MAX_BYTES_PER_ROW - len,
",C%d %s(%d)", j, g_args.dataType[j], ",C%d %s(%d)", j, g_args.dataType[j],
g_args.binwidth); g_args.binwidth);
......
...@@ -45,6 +45,7 @@ SArguments g_args = { ...@@ -45,6 +45,7 @@ SArguments g_args = {
DEFAULT_SYNC_MODE, // mode : sync or async DEFAULT_SYNC_MODE, // mode : sync or async
DEFAULT_DATA_TYPE, // data_type DEFAULT_DATA_TYPE, // data_type
DEFAULT_DATATYPE, // dataType DEFAULT_DATATYPE, // dataType
DEFAULT_DATALENGTH, // data_length
DEFAULT_BINWIDTH, // binwidth DEFAULT_BINWIDTH, // binwidth
DEFAULT_COL_COUNT, // columnCount, timestamp + float + int + float DEFAULT_COL_COUNT, // columnCount, timestamp + float + int + float
DEFAULT_LEN_ONE_ROW, // lenOfOneRow DEFAULT_LEN_ONE_ROW, // lenOfOneRow
......
...@@ -41,9 +41,9 @@ extern int32_t sdbDebugFlag; ...@@ -41,9 +41,9 @@ extern int32_t sdbDebugFlag;
#define sdbDebug(...) { if (sdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }} #define sdbDebug(...) { if (sdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }}
#define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }} #define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("SDB ", sdbDebugFlag, __VA_ARGS__); }}
#define mLError(...) { monSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) } #define mLError(...) { monSaveLogs(2, __VA_ARGS__); mError(__VA_ARGS__) }
#define mLWarn(...) { monSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) } #define mLWarn(...) { monSaveLogs(1, __VA_ARGS__); mWarn(__VA_ARGS__) }
#define mLInfo(...) { monSaveLog(0, __VA_ARGS__); mInfo(__VA_ARGS__) } #define mLInfo(...) { monSaveLogs(0, __VA_ARGS__); mInfo(__VA_ARGS__) }
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -1177,8 +1177,8 @@ static int32_t mnodeGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC ...@@ -1177,8 +1177,8 @@ static int32_t mnodeGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
int32_t cols = 0; int32_t cols = 0;
SUserObj *pUser = mnodeGetUserFromConn(pConn); SUserObj *pUser = mnodeGetUserFromConn(pConn);
if (pUser == NULL) return 0; if (pUser == NULL) return 0;
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) { if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0 ) {
mnodeDecUserRef(pUser); mnodeDecUserRef(pUser);
return TSDB_CODE_MND_NO_RIGHTS; return TSDB_CODE_MND_NO_RIGHTS;
} }
...@@ -1256,10 +1256,10 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo ...@@ -1256,10 +1256,10 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo
STR_TO_VARSTR(pWrite, syncRole[pVgid->role]); STR_TO_VARSTR(pWrite, syncRole[pVgid->role]);
cols++; cols++;
numOfRows++; numOfRows++;
} }
} }
if (numOfRows >= rows) { if (numOfRows >= rows) {
mnodeDecVgroupRef(pVgroup);
break; break;
} }
......
...@@ -166,7 +166,7 @@ static void mnodeCancelGetNextConn(void *pIter) { ...@@ -166,7 +166,7 @@ static void mnodeCancelGetNextConn(void *pIter) {
static int32_t mnodeGetConnsMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { static int32_t mnodeGetConnsMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
SUserObj *pUser = mnodeGetUserFromConn(pConn); SUserObj *pUser = mnodeGetUserFromConn(pConn);
if (pUser == NULL) return 0; if (pUser == NULL) return 0;
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS; if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
int32_t cols = 0; int32_t cols = 0;
SSchema *pSchema = pMeta->schema; SSchema *pSchema = pMeta->schema;
...@@ -322,7 +322,7 @@ int32_t mnodeSaveQueryStreamList(SConnObj *pConn, SHeartBeatMsg *pHBMsg) { ...@@ -322,7 +322,7 @@ int32_t mnodeSaveQueryStreamList(SConnObj *pConn, SHeartBeatMsg *pHBMsg) {
static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
SUserObj *pUser = mnodeGetUserFromConn(pConn); SUserObj *pUser = mnodeGetUserFromConn(pConn);
if (pUser == NULL) return 0; if (pUser == NULL) return 0;
if (strcmp(pUser->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS; if (strcmp(pUser->pAcct->user, TSDB_DEFAULT_USER) != 0) return TSDB_CODE_MND_NO_RIGHTS;
int32_t cols = 0; int32_t cols = 0;
SSchema *pSchema = pMeta->schema; SSchema *pSchema = pMeta->schema;
......
...@@ -30,10 +30,11 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize); ...@@ -30,10 +30,11 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize);
int32_t taosGetCpuCores(); int32_t taosGetCpuCores();
void taosGetSystemInfo(); void taosGetSystemInfo();
bool taosReadProcIO(int64_t* rchars, int64_t* wchars); bool taosReadProcIO(int64_t* rchars, int64_t* wchars, int64_t* rbytes, int64_t* wbytes);
bool taosGetProcIO(float *readKB, float *writeKB); bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float* wbyteKB);
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes); bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes);
bool taosGetBandSpeed(float *bandSpeedKb); bool taosGetBandSpeed(float *bandSpeedKb);
bool taosGetNetworkIO(float *netInKb, float *netOutKb);
void taosGetDisk(); void taosGetDisk();
bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) ; bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) ;
bool taosGetProcMemory(float *memoryUsedMB) ; bool taosGetProcMemory(float *memoryUsedMB) ;
......
...@@ -191,15 +191,19 @@ void taosGetSystemInfo() { ...@@ -191,15 +191,19 @@ void taosGetSystemInfo() {
taosGetSystemLocale(); taosGetSystemLocale();
} }
bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { bool taosReadProcIO(int64_t *rchars, int64_t *wchars, int64_t *rbytes, int64_t *wbytes) {
if (rchars) *rchars = 0; if (rchars) *rchars = 0;
if (wchars) *wchars = 0; if (wchars) *wchars = 0;
if (rbytes) *rbytes = 0;
if (wbytes) *wbytes = 0;
return true; return true;
} }
bool taosGetProcIO(float *readKB, float *writeKB) { bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float *wbyteKB) {
*readKB = 0; *rcharKB = 0;
*writeKB = 0; *wcharKB = 0;
*rbyteKB = 0;
*wbyteKB = 0;
return true; return true;
} }
...@@ -215,6 +219,12 @@ bool taosGetBandSpeed(float *bandSpeedKb) { ...@@ -215,6 +219,12 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
return true; return true;
} }
bool taosGetNetworkIO(float *netInKb, float *netOutKb) {
*netInKb = 0;
*netOutKb = 0;
return true;
}
bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) { bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
*sysCpuUsage = 0; *sysCpuUsage = 0;
*procCpuUsage = 0; *procCpuUsage = 0;
......
...@@ -335,7 +335,9 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) { ...@@ -335,7 +335,9 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
} }
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) { bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) {
*bytes = 0; if (bytes) *bytes = 0;
if (rbytes) *rbytes = 0;
if (tbytes) *tbytes = 0;
FILE *fp = fopen(tsSysNetFile, "r"); FILE *fp = fopen(tsSysNetFile, "r");
if (fp == NULL) { if (fp == NULL) {
uError("open file:%s failed", tsSysNetFile); uError("open file:%s failed", tsSysNetFile);
...@@ -350,7 +352,7 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) { ...@@ -350,7 +352,7 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) {
memset(line, 0, len); memset(line, 0, len);
int64_t o_rbytes = 0; int64_t o_rbytes = 0;
int64_t rpackts = 0; int64_t rpackets = 0;
int64_t o_tbytes = 0; int64_t o_tbytes = 0;
int64_t tpackets = 0; int64_t tpackets = 0;
int64_t nouse1 = 0; int64_t nouse1 = 0;
...@@ -376,10 +378,10 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) { ...@@ -376,10 +378,10 @@ bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) {
sscanf(line, sscanf(line,
"%s %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 "%s %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64
" %" PRId64, " %" PRId64,
nouse0, &o_rbytes, &rpackts, &nouse1, &nouse2, &nouse3, &nouse4, &nouse5, &nouse6, &o_tbytes, &tpackets); nouse0, &o_rbytes, &rpackets, &nouse1, &nouse2, &nouse3, &nouse4, &nouse5, &nouse6, &o_tbytes, &tpackets);
if (rbytes) *rbytes = o_rbytes; if (rbytes) *rbytes = o_rbytes;
if (tbytes) *tbytes = o_tbytes; if (tbytes) *tbytes = o_tbytes;
*bytes += (o_rbytes + o_tbytes); if (bytes) *bytes += (o_rbytes + o_tbytes);
} }
tfree(line); tfree(line);
...@@ -424,7 +426,46 @@ bool taosGetBandSpeed(float *bandSpeedKb) { ...@@ -424,7 +426,46 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
return true; return true;
} }
bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { bool taosGetNetworkIO(float *netInKb, float *netOutKb) {
static int64_t lastBytesIn = 0, lastBytesOut = 0;
static time_t lastTimeIO = 0;
int64_t curBytesIn = 0, curBytesOut = 0;
time_t curTime = time(NULL);
if (!taosGetCardInfo(NULL, &curBytesIn, &curBytesOut)) {
return false;
}
if (lastTimeIO == 0 || lastBytesIn == 0 || lastBytesOut == 0) {
lastTimeIO = curTime;
lastBytesIn = curBytesIn; lastBytesOut = curBytesOut;
*netInKb = 0;
*netOutKb = 0;
return true;
}
if (lastTimeIO >= curTime || lastBytesIn > curBytesIn || lastBytesOut > curBytesOut) {
lastTimeIO = curTime;
lastBytesIn = curBytesIn; lastBytesOut = curBytesOut;
*netInKb = 0;
*netOutKb = 0;
return true;
}
double totalBytesIn = (double)(curBytesIn - lastBytesIn) / 1024 * 8; // Kb
*netInKb = (float)(totalBytesIn / (double)(curTime - lastTimeIO));
double totalBytesOut = (double)(curBytesOut - lastBytesOut) / 1024 * 8; // Kb
*netOutKb = (float)(totalBytesOut / (double)(curTime - lastTimeIO));
lastTimeIO = curTime;
lastBytesIn = curBytesIn;
lastBytesOut = curBytesOut;
return true;
}
bool taosReadProcIO(int64_t *rchars, int64_t *wchars, int64_t *rbytes, int64_t *wbytes) {
FILE *fp = fopen(tsProcIOFile, "r"); FILE *fp = fopen(tsProcIOFile, "r");
if (fp == NULL) { if (fp == NULL) {
uError("open file:%s failed", tsProcIOFile); uError("open file:%s failed", tsProcIOFile);
...@@ -434,7 +475,7 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { ...@@ -434,7 +475,7 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) {
ssize_t _bytes = 0; ssize_t _bytes = 0;
size_t len; size_t len;
char * line = NULL; char * line = NULL;
char tmp[10]; char tmp[15];
int readIndex = 0; int readIndex = 0;
while (!feof(fp)) { while (!feof(fp)) {
...@@ -450,16 +491,21 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { ...@@ -450,16 +491,21 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) {
} else if (strstr(line, "wchar:") != NULL) { } else if (strstr(line, "wchar:") != NULL) {
sscanf(line, "%s %" PRId64, tmp, wchars); sscanf(line, "%s %" PRId64, tmp, wchars);
readIndex++; readIndex++;
} else { } else if (strstr(line, "read_bytes:") != NULL){
sscanf(line, "%s %" PRId64, tmp, rbytes);
readIndex++;
} else if (strstr(line, "write_bytes:") != NULL){
sscanf(line, "%s %" PRId64, tmp, wbytes);
readIndex++;
} }
if (readIndex >= 2) break; if (readIndex >= 4) break;
} }
tfree(line); tfree(line);
fclose(fp); fclose(fp);
if (readIndex < 2) { if (readIndex < 4) {
uError("read file:%s failed", tsProcIOFile); uError("read file:%s failed", tsProcIOFile);
return false; return false;
} }
...@@ -467,30 +513,43 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) { ...@@ -467,30 +513,43 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) {
return true; return true;
} }
bool taosGetProcIO(float *readKB, float *writeKB) { bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float *wbyteKB) {
static int64_t lastReadbyte = -1; static int64_t lastRchar = -1, lastRbyte = -1;
static int64_t lastWritebyte = -1; static int64_t lastWchar = -1, lastWbyte = -1;
static time_t lastTime = 0;
time_t curTime = time(NULL);
int64_t curReadbyte = 0; int64_t curRchar = 0, curRbyte = 0;
int64_t curWritebyte = 0; int64_t curWchar = 0, curWbyte = 0;
if (!taosReadProcIO(&curReadbyte, &curWritebyte)) { if (!taosReadProcIO(&curRchar, &curWchar, &curRbyte, &curWbyte)) {
return false; return false;
} }
if (lastReadbyte == -1 || lastWritebyte == -1) { if (lastTime == 0 || lastRchar == -1 || lastWchar == -1 || lastRbyte == -1 || lastWbyte == -1) {
lastReadbyte = curReadbyte; lastTime = curTime;
lastWritebyte = curWritebyte; lastRchar = curRchar;
lastWchar = curWchar;
lastRbyte = curRbyte;
lastWbyte = curWbyte;
return false; return false;
} }
*readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024); *rcharKB = (float)((double)(curRchar - lastRchar) / 1024 / (double)(curTime - lastTime));
*writeKB = (float)((double)(curWritebyte - lastWritebyte) / 1024); *wcharKB = (float)((double)(curWchar - lastWchar) / 1024 / (double)(curTime - lastTime));
if (*readKB < 0) *readKB = 0; if (*rcharKB < 0) *rcharKB = 0;
if (*writeKB < 0) *writeKB = 0; if (*wcharKB < 0) *wcharKB = 0;
*rbyteKB = (float)((double)(curRbyte - lastRbyte) / 1024 / (double)(curTime - lastTime));
*wbyteKB = (float)((double)(curWbyte - lastWbyte) / 1024 / (double)(curTime - lastTime));
if (*rbyteKB < 0) *rbyteKB = 0;
if (*wbyteKB < 0) *wbyteKB = 0;
lastReadbyte = curReadbyte; lastRchar = curRchar;
lastWritebyte = curWritebyte; lastWchar = curWchar;
lastRbyte = curRbyte;
lastWbyte = curWbyte;
lastTime = curTime;
return true; return true;
} }
...@@ -501,13 +560,13 @@ void taosGetSystemInfo() { ...@@ -501,13 +560,13 @@ void taosGetSystemInfo() {
tsNumOfCores = taosGetCpuCores(); tsNumOfCores = taosGetCpuCores();
tsTotalMemoryMB = taosGetTotalMemory(); tsTotalMemoryMB = taosGetTotalMemory();
float tmp1, tmp2; float tmp1, tmp2, tmp3, tmp4;
taosGetSysMemory(&tmp1); taosGetSysMemory(&tmp1);
taosGetProcMemory(&tmp2); taosGetProcMemory(&tmp2);
// taosGetDisk(); // taosGetDisk();
taosGetBandSpeed(&tmp1); taosGetBandSpeed(&tmp1);
taosGetCpuUsage(&tmp1, &tmp2); taosGetCpuUsage(&tmp1, &tmp2);
taosGetProcIO(&tmp1, &tmp2); taosGetProcIO(&tmp1, &tmp2, &tmp3, &tmp4);
taosGetSystemTimezone(); taosGetSystemTimezone();
taosGetSystemLocale(); taosGetSystemLocale();
......
...@@ -169,40 +169,59 @@ bool taosGetBandSpeed(float *bandSpeedKb) { ...@@ -169,40 +169,59 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
return true; return true;
} }
bool taosReadProcIO(int64_t *readbyte, int64_t *writebyte) { bool taosGetNetworkIO(float *netInKb, float *netOutKb) {
*netInKb = 0;
*netOutKb = 0;
return true;
}
bool taosReadProcIO(int64_t *rchars, int64_t *wchars, int64_t *rbytes, int64_t *wbytes) {
IO_COUNTERS io_counter; IO_COUNTERS io_counter;
if (GetProcessIoCounters(GetCurrentProcess(), &io_counter)) { if (GetProcessIoCounters(GetCurrentProcess(), &io_counter)) {
if (readbyte) *readbyte = io_counter.ReadTransferCount; if (rchars) *rchars = io_counter.ReadTransferCount;
if (writebyte) *writebyte = io_counter.WriteTransferCount; if (wchars) *wchars = io_counter.WriteTransferCount;
return true; return true;
} }
return false; return false;
} }
bool taosGetProcIO(float *readKB, float *writeKB) { bool taosGetProcIO(float *rcharKB, float *wcharKB, float *rbyteKB, float *wbyteKB) {
static int64_t lastReadbyte = -1; static int64_t lastRchar = -1, lastRbyte = -1;
static int64_t lastWritebyte = -1; static int64_t lastWchar = -1, lastWbyte = -1;
static time_t lastTime = 0;
time_t curTime = time(NULL);
int64_t curReadbyte = 0; int64_t curRchar = 0, curRbyte = 0;
int64_t curWritebyte = 0; int64_t curWchar = 0, curWbyte = 0;
if (!taosReadProcIO(&curReadbyte, &curWritebyte)) { if (!taosReadProcIO(&curRchar, &curWchar, &curRbyte, &curWbyte)) {
return false; return false;
} }
if (lastReadbyte == -1 || lastWritebyte == -1) { if (lastTime == 0 || lastRchar == -1 || lastWchar == -1 || lastRbyte == -1 || lastWbyte == -1) {
lastReadbyte = curReadbyte; lastTime = curTime;
lastWritebyte = curWritebyte; lastRchar = curRchar;
lastWchar = curWchar;
lastRbyte = curRbyte;
lastWbyte = curWbyte;
return false; return false;
} }
*readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024); *rcharKB = (float)((double)(curRchar - lastRchar) / 1024 / (double)(curTime - lastTime));
*writeKB = (float)((double)(curWritebyte - lastWritebyte) / 1024); *wcharKB = (float)((double)(curWchar - lastWchar) / 1024 / (double)(curTime - lastTime));
if (*readKB < 0) *readKB = 0; if (*rcharKB < 0) *rcharKB = 0;
if (*writeKB < 0) *writeKB = 0; if (*wcharKB < 0) *wcharKB = 0;
*rbyteKB = (float)((double)(curRbyte - lastRbyte) / 1024 / (double)(curTime - lastTime));
*wbyteKB = (float)((double)(curWbyte - lastWbyte) / 1024 / (double)(curTime - lastTime));
if (*rbyteKB < 0) *rbyteKB = 0;
if (*wbyteKB < 0) *wbyteKB = 0;
lastReadbyte = curReadbyte; lastRchar = curRchar;
lastWritebyte = curWritebyte; lastWchar = curWchar;
lastRbyte = curRbyte;
lastWbyte = curWbyte;
lastTime = curTime;
return true; return true;
} }
...@@ -211,11 +230,11 @@ void taosGetSystemInfo() { ...@@ -211,11 +230,11 @@ void taosGetSystemInfo() {
tsNumOfCores = taosGetCpuCores(); tsNumOfCores = taosGetCpuCores();
tsTotalMemoryMB = taosGetTotalMemory(); tsTotalMemoryMB = taosGetTotalMemory();
float tmp1, tmp2; float tmp1, tmp2, tmp3, tmp4;
// taosGetDisk(); // taosGetDisk();
taosGetBandSpeed(&tmp1); taosGetBandSpeed(&tmp1);
taosGetCpuUsage(&tmp1, &tmp2); taosGetCpuUsage(&tmp1, &tmp2);
taosGetProcIO(&tmp1, &tmp2); taosGetProcIO(&tmp1, &tmp2, &tmp3, &tmp4);
taosGetSystemTimezone(); taosGetSystemTimezone();
taosGetSystemLocale(); taosGetSystemLocale();
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#define HTTP_WRITE_WAIT_TIME_MS 5 #define HTTP_WRITE_WAIT_TIME_MS 5
#define HTTP_PASSWORD_LEN TSDB_UNI_LEN #define HTTP_PASSWORD_LEN TSDB_UNI_LEN
#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + HTTP_PASSWORD_LEN) #define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + HTTP_PASSWORD_LEN)
#define HTTP_STATUS_CODE_NUM 63
typedef enum HttpReqType { typedef enum HttpReqType {
HTTP_REQTYPE_OTHERS = 0, HTTP_REQTYPE_OTHERS = 0,
...@@ -187,8 +188,9 @@ typedef struct HttpServer { ...@@ -187,8 +188,9 @@ typedef struct HttpServer {
SOCKET fd; SOCKET fd;
int32_t numOfThreads; int32_t numOfThreads;
int32_t methodScannerLen; int32_t methodScannerLen;
int32_t requestNum; int64_t requestNum;
int32_t status; int32_t status;
int32_t statusCodeErrs[HTTP_STATUS_CODE_NUM];
pthread_t thread; pthread_t thread;
HttpThread * pThreads; HttpThread * pThreads;
void * contextCache; void * contextCache;
......
...@@ -123,9 +123,9 @@ bool metricsProcessRequest(HttpContext* pContext) { ...@@ -123,9 +123,9 @@ bool metricsProcessRequest(HttpContext* pContext) {
} }
{ {
int64_t rchars = 0; int64_t rchars = 0, rbytes = 0;
int64_t wchars = 0; int64_t wchars = 0, wbytes = 0;
bool succeeded = taosReadProcIO(&rchars, &wchars); bool succeeded = taosReadProcIO(&rchars, &wchars, &rbytes, &wbytes);
if (!succeeded) { if (!succeeded) {
httpError("failed to get io info"); httpError("failed to get io info");
} else { } else {
...@@ -164,7 +164,7 @@ bool metricsProcessRequest(HttpContext* pContext) { ...@@ -164,7 +164,7 @@ bool metricsProcessRequest(HttpContext* pContext) {
} }
{ {
SStatisInfo info = dnodeGetStatisInfo(); SDnodeStatisInfo info = dnodeGetStatisInfo();
{ {
char* keyReqHttp = "req_http"; char* keyReqHttp = "req_http";
char* keyReqSelect = "req_select"; char* keyReqSelect = "req_select";
...@@ -181,4 +181,4 @@ bool metricsProcessRequest(HttpContext* pContext) { ...@@ -181,4 +181,4 @@ bool metricsProcessRequest(HttpContext* pContext) {
pContext->reqType = HTTP_REQTYPE_OTHERS; pContext->reqType = HTTP_REQTYPE_OTHERS;
httpFreeJsonBuf(pContext); httpFreeJsonBuf(pContext);
return false; return false;
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "httpResp.h" #include "httpResp.h"
#include "httpJson.h" #include "httpJson.h"
#include "httpContext.h" #include "httpContext.h"
#include "monitor.h"
const char *httpKeepAliveStr[] = {"", "Connection: Keep-Alive\r\n", "Connection: Close\r\n"}; const char *httpKeepAliveStr[] = {"", "Connection: Keep-Alive\r\n", "Connection: Close\r\n"};
...@@ -153,6 +154,10 @@ void httpSendErrorResp(HttpContext *pContext, int32_t errNo) { ...@@ -153,6 +154,10 @@ void httpSendErrorResp(HttpContext *pContext, int32_t errNo) {
httpCode = pContext->parser->httpCode; httpCode = pContext->parser->httpCode;
} }
HttpServer *pServer = &tsHttpServer;
SMonHttpStatus *httpStatus = monGetHttpStatusHashTableEntry(httpCode);
pServer->statusCodeErrs[httpStatus->index] += 1;
pContext->error = true; pContext->error = true;
char *httpCodeStr = httpGetStatusDesc(httpCode); char *httpCodeStr = httpGetStatusDesc(httpCode);
......
...@@ -190,7 +190,7 @@ static void httpProcessHttpData(void *param) { ...@@ -190,7 +190,7 @@ static void httpProcessHttpData(void *param) {
} else { } else {
if (httpReadData(pContext)) { if (httpReadData(pContext)) {
(*(pThread->processData))(pContext); (*(pThread->processData))(pContext);
atomic_fetch_add_32(&pServer->requestNum, 1); atomic_fetch_add_64(&pServer->requestNum, 1);
} }
} }
} }
......
...@@ -120,4 +120,10 @@ void httpCleanUpSystem() { ...@@ -120,4 +120,10 @@ void httpCleanUpSystem() {
tsHttpServer.status = HTTP_SERVER_CLOSED; tsHttpServer.status = HTTP_SERVER_CLOSED;
} }
int32_t httpGetReqCount() { return atomic_exchange_32(&tsHttpServer.requestNum, 0); } int64_t httpGetReqCount() { return atomic_exchange_64(&tsHttpServer.requestNum, 0); }
int32_t httpGetStatusCodeCount(int index) {
return atomic_load_32(&tsHttpServer.statusCodeErrs[index]);
}
int32_t httpClearStatusCodeCount(int index) {
return atomic_exchange_32(&tsHttpServer.statusCodeErrs[index], 0);
}
此差异已折叠。
...@@ -11,11 +11,19 @@ SET_SOURCE_FILES_PROPERTIES(src/sql.c PROPERTIES COMPILE_FLAGS -w) ...@@ -11,11 +11,19 @@ SET_SOURCE_FILES_PROPERTIES(src/sql.c PROPERTIES COMPILE_FLAGS -w)
TARGET_LINK_LIBRARIES(query tsdb tutil lua) TARGET_LINK_LIBRARIES(query tsdb tutil lua)
IF (TD_LINUX) IF (TD_LINUX)
TARGET_LINK_LIBRARIES(query m rt lua) IF (TD_BUILD_LUA)
TARGET_LINK_LIBRARIES(query m rt lua)
ELSE ()
TARGET_LINK_LIBRARIES(query m rt)
ENDIF ()
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tests)
ENDIF () ENDIF ()
IF (TD_DARWIN) IF (TD_DARWIN)
TARGET_LINK_LIBRARIES(query m lua) IF (TD_BUILD_LUA)
TARGET_LINK_LIBRARIES(query m lua)
ELSE ()
TARGET_LINK_LIBRARIES(query m)
ENDIF ()
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tests)
ENDIF () ENDIF ()
...@@ -183,7 +183,7 @@ typedef struct SQLFunctionCtx { ...@@ -183,7 +183,7 @@ typedef struct SQLFunctionCtx {
int16_t inputBytes; int16_t inputBytes;
int16_t outputType; int16_t outputType;
int16_t outputBytes; // size of results, determined by function and input column data type int32_t outputBytes; // size of results, determined by function and input column data type
int32_t interBufBytes; // internal buffer size int32_t interBufBytes; // internal buffer size
bool hasNull; // null value exist in current block bool hasNull; // null value exist in current block
bool requireNull; // require null in some function bool requireNull; // require null in some function
...@@ -227,7 +227,7 @@ typedef struct SAggFunctionInfo { ...@@ -227,7 +227,7 @@ typedef struct SAggFunctionInfo {
#define GET_RES_INFO(ctx) ((ctx)->resultInfo) #define GET_RES_INFO(ctx) ((ctx)->resultInfo)
int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type,
int16_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo); int32_t *len, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo);
int32_t isValidFunction(const char* name, int32_t len); int32_t isValidFunction(const char* name, int32_t len);
#define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0) #define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0)
......
...@@ -75,8 +75,15 @@ typedef struct tFilePagesItem { ...@@ -75,8 +75,15 @@ typedef struct tFilePagesItem {
tFilePage item; tFilePage item;
} tFilePagesItem; } tFilePagesItem;
typedef struct SSchema1 {
uint8_t type;
char name[TSDB_COL_NAME_LEN];
int16_t colId;
int32_t bytes;
} SSchema1;
typedef struct SSchemaEx { typedef struct SSchemaEx {
struct SSchema field; SSchema1 field;
int32_t offset; int32_t offset;
} SSchemaEx; } SSchemaEx;
...@@ -178,7 +185,7 @@ bool tExtMemBufferIsAllDataInMem(tExtMemBuffer *pMemBuffer); ...@@ -178,7 +185,7 @@ bool tExtMemBufferIsAllDataInMem(tExtMemBuffer *pMemBuffer);
* @param blockCapacity * @param blockCapacity
* @return * @return
*/ */
SColumnModel *createColumnModel(SSchema *fields, int32_t numOfCols, int32_t blockCapacity); SColumnModel *createColumnModel(SSchema1 *fields, int32_t numOfCols, int32_t blockCapacity);
/** /**
* *
...@@ -199,7 +206,7 @@ void destroyColumnModel(SColumnModel *pModel); ...@@ -199,7 +206,7 @@ void destroyColumnModel(SColumnModel *pModel);
void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxElemsCapacity); void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxElemsCapacity);
void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxCapacity, int32_t s, int32_t e); void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxCapacity, int32_t s, int32_t e);
SSchema *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index); SSchema1 *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index);
int16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t index); int16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t index);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#ifndef TDENGINE_QSCRIPT_H #ifndef TDENGINE_QSCRIPT_H
#define TDENGINE_QSCRIPT_H #define TDENGINE_QSCRIPT_H
#ifdef LUA_EMBEDDED
#include <lua.h> #include <lua.h>
#include <lauxlib.h> #include <lauxlib.h>
#include <lualib.h> #include <lualib.h>
...@@ -78,5 +78,5 @@ void destroyScriptCtx(void *pScriptCtx); ...@@ -78,5 +78,5 @@ void destroyScriptCtx(void *pScriptCtx);
int32_t scriptEnvPoolInit(); int32_t scriptEnvPoolInit();
void scriptEnvPoolCleanup(); void scriptEnvPoolCleanup();
bool isValidScript(char *script, int32_t len); bool isValidScript(char *script, int32_t len);
#endif //LUA_EMBEDDED
#endif //TDENGINE_QSCRIPT_H #endif //TDENGINE_QSCRIPT_H
...@@ -281,7 +281,7 @@ typedef struct tSqlExprItem { ...@@ -281,7 +281,7 @@ typedef struct tSqlExprItem {
SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder); SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder);
SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int32_t index); SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int32_t index);
SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t sortOrder); SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t sortOrder, bool needRmquoteEscape);
SRelationInfo *setTableNameList(SRelationInfo* pFromInfo, SStrToken *pName, SStrToken* pAlias); SRelationInfo *setTableNameList(SRelationInfo* pFromInfo, SStrToken *pName, SStrToken* pAlias);
void *destroyRelationInfo(SRelationInfo* pFromInfo); void *destroyRelationInfo(SRelationInfo* pFromInfo);
......
...@@ -253,7 +253,7 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K ...@@ -253,7 +253,7 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K
intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); } intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); }
intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); } intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); }
intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
%type keep {SArray*} %type keep {SArray*}
%destructor keep {taosArrayDestroy($$);} %destructor keep {taosArrayDestroy($$);}
...@@ -438,39 +438,39 @@ column(A) ::= ids(X) typename(Y). { ...@@ -438,39 +438,39 @@ column(A) ::= ids(X) typename(Y). {
tagitemlist(A) ::= tagitemlist(X) COMMA tagitem(Y). { A = tVariantListAppend(X, &Y, -1); } tagitemlist(A) ::= tagitemlist(X) COMMA tagitem(Y). { A = tVariantListAppend(X, &Y, -1); }
tagitemlist(A) ::= tagitem(X). { A = tVariantListAppend(NULL, &X, -1); } tagitemlist(A) ::= tagitem(X). { A = tVariantListAppend(NULL, &X, -1); }
tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); } tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X, true); }
tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X);} tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X, true);}
tagitem(A) ::= MINUS(X) INTEGER(Y).{ tagitem(A) ::= MINUS(X) INTEGER(Y).{
X.n += Y.n; X.n += Y.n;
X.type = Y.type; X.type = Y.type;
toTSDBType(X.type); toTSDBType(X.type);
tVariantCreate(&A, &X); tVariantCreate(&A, &X, true);
} }
tagitem(A) ::= MINUS(X) FLOAT(Y). { tagitem(A) ::= MINUS(X) FLOAT(Y). {
X.n += Y.n; X.n += Y.n;
X.type = Y.type; X.type = Y.type;
toTSDBType(X.type); toTSDBType(X.type);
tVariantCreate(&A, &X); tVariantCreate(&A, &X, true);
} }
tagitem(A) ::= PLUS(X) INTEGER(Y). { tagitem(A) ::= PLUS(X) INTEGER(Y). {
X.n += Y.n; X.n += Y.n;
X.type = Y.type; X.type = Y.type;
toTSDBType(X.type); toTSDBType(X.type);
tVariantCreate(&A, &X); tVariantCreate(&A, &X, true);
} }
tagitem(A) ::= PLUS(X) FLOAT(Y). { tagitem(A) ::= PLUS(X) FLOAT(Y). {
X.n += Y.n; X.n += Y.n;
X.type = Y.type; X.type = Y.type;
toTSDBType(X.type); toTSDBType(X.type);
tVariantCreate(&A, &X); tVariantCreate(&A, &X, true);
} }
//////////////////////// The SELECT statement ///////////////////////////////// //////////////////////// The SELECT statement /////////////////////////////////
...@@ -609,7 +609,7 @@ fill_opt(N) ::= . { N = 0; } ...@@ -609,7 +609,7 @@ fill_opt(N) ::= . { N = 0; }
fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. { fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. {
tVariant A = {0}; tVariant A = {0};
toTSDBType(Y.type); toTSDBType(Y.type);
tVariantCreate(&A, &Y); tVariantCreate(&A, &Y, true);
tVariantListInsert(X, &A, -1, 0); tVariantListInsert(X, &A, -1, 0);
N = X; N = X;
...@@ -617,7 +617,7 @@ fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. { ...@@ -617,7 +617,7 @@ fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. {
fill_opt(N) ::= FILL LP ID(Y) RP. { fill_opt(N) ::= FILL LP ID(Y) RP. {
toTSDBType(Y.type); toTSDBType(Y.type);
N = tVariantListAppendToken(NULL, &Y, -1); N = tVariantListAppendToken(NULL, &Y, -1, true);
} }
%type sliding_opt {SStrToken} %type sliding_opt {SStrToken}
...@@ -649,7 +649,7 @@ item(A) ::= ids(X) cpxName(Y). { ...@@ -649,7 +649,7 @@ item(A) ::= ids(X) cpxName(Y). {
toTSDBType(X.type); toTSDBType(X.type);
X.n += Y.n; X.n += Y.n;
tVariantCreate(&A, &X); tVariantCreate(&A, &X, true);
} }
%type sortorder {int} %type sortorder {int}
...@@ -796,7 +796,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). { ...@@ -796,7 +796,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
X.n += F.n; X.n += F.n;
toTSDBType(A.type); toTSDBType(A.type);
SArray* K = tVariantListAppendToken(NULL, &A, -1); SArray* K = tVariantListAppendToken(NULL, &A, -1, false);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -818,7 +818,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). { ...@@ -818,7 +818,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
X.n += Z.n; X.n += Z.n;
toTSDBType(Y.type); toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1); SArray* A = tVariantListAppendToken(NULL, &Y, -1, true);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -828,10 +828,10 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { ...@@ -828,10 +828,10 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
X.n += F.n; X.n += F.n;
toTSDBType(Y.type); toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1); SArray* A = tVariantListAppendToken(NULL, &Y, -1, true);
toTSDBType(Z.type); toTSDBType(Z.type);
A = tVariantListAppendToken(A, &Z, -1); A = tVariantListAppendToken(A, &Z, -1, true);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -841,7 +841,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { ...@@ -841,7 +841,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
X.n += F.n; X.n += F.n;
toTSDBType(Y.type); toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1); SArray* A = tVariantListAppendToken(NULL, &Y, -1, true);
A = tVariantListAppend(A, &Z, -1); A = tVariantListAppend(A, &Z, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
...@@ -865,7 +865,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). { ...@@ -865,7 +865,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
X.n += F.n; X.n += F.n;
toTSDBType(A.type); toTSDBType(A.type);
SArray* K = tVariantListAppendToken(NULL, &A, -1); SArray* K = tVariantListAppendToken(NULL, &A, -1, true);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -887,7 +887,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). { ...@@ -887,7 +887,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
X.n += Z.n; X.n += Z.n;
toTSDBType(Y.type); toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1); SArray* A = tVariantListAppendToken(NULL, &Y, -1, true);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -897,10 +897,10 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { ...@@ -897,10 +897,10 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
X.n += F.n; X.n += F.n;
toTSDBType(Y.type); toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1); SArray* A = tVariantListAppendToken(NULL, &Y, -1, true);
toTSDBType(Z.type); toTSDBType(Z.type);
A = tVariantListAppendToken(A, &Z, -1); A = tVariantListAppendToken(A, &Z, -1, true);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...@@ -910,7 +910,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { ...@@ -910,7 +910,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
X.n += F.n; X.n += F.n;
toTSDBType(Y.type); toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1); SArray* A = tVariantListAppendToken(NULL, &Y, -1, true);
A = tVariantListAppend(A, &Z, -1); A = tVariantListAppend(A, &Z, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE);
......
...@@ -205,7 +205,7 @@ typedef struct { ...@@ -205,7 +205,7 @@ typedef struct {
} SDiffFuncInfo; } SDiffFuncInfo;
int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type,
int16_t *bytes, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo) { int32_t *bytes, int32_t *interBytes, int16_t extLength, bool isSuperTable, SUdfInfo* pUdfInfo) {
if (!isValidDataType(dataType)) { if (!isValidDataType(dataType)) {
qError("Illegal data type %d or data type length %d", dataType, dataBytes); qError("Illegal data type %d or data type length %d", dataType, dataBytes);
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
...@@ -218,7 +218,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -218,7 +218,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
functionId == TSDB_FUNC_FLOOR || functionId == TSDB_FUNC_ROUND) functionId == TSDB_FUNC_FLOOR || functionId == TSDB_FUNC_ROUND)
{ {
*type = (int16_t)dataType; *type = (int16_t)dataType;
*bytes = (int16_t)dataBytes; *bytes = dataBytes;
if (functionId == TSDB_FUNC_INTERP) { if (functionId == TSDB_FUNC_INTERP) {
*interBytes = sizeof(SInterpInfoDetail); *interBytes = sizeof(SInterpInfoDetail);
...@@ -235,7 +235,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -235,7 +235,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
// (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE // (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE
if (functionId == TSDB_FUNC_TID_TAG) { // todo use struct if (functionId == TSDB_FUNC_TID_TAG) { // todo use struct
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (int16_t)(dataBytes + sizeof(int16_t) + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE); *bytes = (dataBytes + sizeof(int16_t) + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE);
*interBytes = 0; *interBytes = 0;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -313,7 +313,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -313,7 +313,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) { if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (int16_t)(dataBytes + DATA_SET_FLAG_SIZE); *bytes = (dataBytes + DATA_SET_FLAG_SIZE);
*interBytes = *bytes; *interBytes = *bytes;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -336,13 +336,13 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -336,13 +336,13 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (int16_t)(sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param); *bytes = (sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param);
*interBytes = *bytes; *interBytes = *bytes;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else if (functionId == TSDB_FUNC_SAMPLE) { } else if (functionId == TSDB_FUNC_SAMPLE) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (int16_t)(sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param); *bytes = (sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param);
*interBytes = *bytes; *interBytes = *bytes;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -355,14 +355,14 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -355,14 +355,14 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
} else if (functionId == TSDB_FUNC_APERCT) { } else if (functionId == TSDB_FUNC_APERCT) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
int16_t bytesHist = sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1) + sizeof(SHistogramInfo) + sizeof(SAPercentileInfo); int16_t bytesHist = sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1) + sizeof(SHistogramInfo) + sizeof(SAPercentileInfo);
int16_t bytesDigest = (int16_t)(sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); int32_t bytesDigest = (int32_t) (sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION));
*bytes = MAX(bytesHist, bytesDigest); *bytes = MAX(bytesHist, bytesDigest);
*interBytes = *bytes; *interBytes = *bytes;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else if (functionId == TSDB_FUNC_LAST_ROW) { } else if (functionId == TSDB_FUNC_LAST_ROW) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (int16_t)(sizeof(SLastrowInfo) + dataBytes); *bytes = (sizeof(SLastrowInfo) + dataBytes);
*interBytes = *bytes; *interBytes = *bytes;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
...@@ -390,7 +390,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -390,7 +390,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*type = TSDB_DATA_TYPE_DOUBLE; *type = TSDB_DATA_TYPE_DOUBLE;
*bytes = sizeof(double); *bytes = sizeof(double);
int16_t bytesHist = sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1); int16_t bytesHist = sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1);
int16_t bytesDigest = (int16_t)(sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); int32_t bytesDigest = (int32_t) (sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION));
*interBytes = MAX(bytesHist, bytesDigest); *interBytes = MAX(bytesHist, bytesDigest);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else if (functionId == TSDB_FUNC_TWA) { } else if (functionId == TSDB_FUNC_TWA) {
...@@ -427,31 +427,31 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -427,31 +427,31 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*interBytes = sizeof(SStddevInfo); *interBytes = sizeof(SStddevInfo);
} else if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) { } else if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) {
*type = (int16_t)dataType; *type = (int16_t)dataType;
*bytes = (int16_t)dataBytes; *bytes = dataBytes;
*interBytes = dataBytes + DATA_SET_FLAG_SIZE; *interBytes = dataBytes + DATA_SET_FLAG_SIZE;
} else if (functionId == TSDB_FUNC_FIRST || functionId == TSDB_FUNC_LAST) { } else if (functionId == TSDB_FUNC_FIRST || functionId == TSDB_FUNC_LAST) {
*type = (int16_t)dataType; *type = (int16_t)dataType;
*bytes = (int16_t)dataBytes; *bytes = dataBytes;
*interBytes = (int16_t)(dataBytes + sizeof(SFirstLastInfo)); *interBytes = (dataBytes + sizeof(SFirstLastInfo));
} else if (functionId == TSDB_FUNC_SPREAD) { } else if (functionId == TSDB_FUNC_SPREAD) {
*type = (int16_t)TSDB_DATA_TYPE_DOUBLE; *type = (int16_t)TSDB_DATA_TYPE_DOUBLE;
*bytes = sizeof(double); *bytes = sizeof(double);
*interBytes = sizeof(SSpreadInfo); *interBytes = sizeof(SSpreadInfo);
} else if (functionId == TSDB_FUNC_PERCT) { } else if (functionId == TSDB_FUNC_PERCT) {
*type = (int16_t)TSDB_DATA_TYPE_DOUBLE; *type = (int16_t)TSDB_DATA_TYPE_DOUBLE;
*bytes = (int16_t)sizeof(double); *bytes = sizeof(double);
*interBytes = (int16_t)sizeof(SPercentileInfo); *interBytes = sizeof(SPercentileInfo);
} else if (functionId == TSDB_FUNC_LEASTSQR) { } else if (functionId == TSDB_FUNC_LEASTSQR) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = MAX(TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE, sizeof(SLeastsquaresInfo)); // string *bytes = MAX(TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE, sizeof(SLeastsquaresInfo)); // string
*interBytes = *bytes; *interBytes = *bytes;
} else if (functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_LAST_DST) { } else if (functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_LAST_DST) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
*bytes = (int16_t)(dataBytes + sizeof(SFirstLastInfo)); *bytes = (dataBytes + sizeof(SFirstLastInfo));
*interBytes = *bytes; *interBytes = *bytes;
} else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
*type = (int16_t)dataType; *type = (int16_t)dataType;
*bytes = (int16_t)dataBytes; *bytes = dataBytes;
size_t size = sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param; size_t size = sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param;
...@@ -459,12 +459,12 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI ...@@ -459,12 +459,12 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*interBytes = (int32_t)size; *interBytes = (int32_t)size;
} else if (functionId == TSDB_FUNC_SAMPLE) { } else if (functionId == TSDB_FUNC_SAMPLE) {
*type = (int16_t)dataType; *type = (int16_t)dataType;
*bytes = (int16_t)dataBytes; *bytes = dataBytes;
size_t size = sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param; size_t size = sizeof(SSampleFuncInfo) + dataBytes*param + sizeof(int64_t)*param + extLength*param;
*interBytes = (int32_t)size; *interBytes = (int32_t)size;
} else if (functionId == TSDB_FUNC_LAST_ROW) { } else if (functionId == TSDB_FUNC_LAST_ROW) {
*type = (int16_t)dataType; *type = (int16_t)dataType;
*bytes = (int16_t)dataBytes; *bytes = dataBytes;
*interBytes = dataBytes; *interBytes = dataBytes;
} else if (functionId == TSDB_FUNC_STDDEV_DST) { } else if (functionId == TSDB_FUNC_STDDEV_DST) {
*type = TSDB_DATA_TYPE_BINARY; *type = TSDB_DATA_TYPE_BINARY;
......
...@@ -2639,6 +2639,14 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i ...@@ -2639,6 +2639,14 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i
while(((*rowsize) * MIN_ROWS_PER_PAGE) > (*ps) - overhead) { while(((*rowsize) * MIN_ROWS_PER_PAGE) > (*ps) - overhead) {
*ps = ((*ps) << 1u); *ps = ((*ps) << 1u);
} }
if (*ps > 5 * 1024 * 1024) {
MIN_ROWS_PER_PAGE = 2;
*ps = DEFAULT_INTERN_BUF_PAGE_SIZE;
while(((*rowsize) * MIN_ROWS_PER_PAGE) > (*ps) - overhead) {
*ps = ((*ps) << 1u);
}
}
} }
#define IS_PREFILTER_TYPE(_t) ((_t) != TSDB_DATA_TYPE_BINARY && (_t) != TSDB_DATA_TYPE_NCHAR) #define IS_PREFILTER_TYPE(_t) ((_t) != TSDB_DATA_TYPE_BINARY && (_t) != TSDB_DATA_TYPE_NCHAR)
...@@ -4792,8 +4800,8 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr ...@@ -4792,8 +4800,8 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
int32_t ps = DEFAULT_PAGE_SIZE; int32_t ps = DEFAULT_PAGE_SIZE;
getIntermediateBufInfo(pRuntimeEnv, &ps, &pQueryAttr->intermediateResultRowSize); getIntermediateBufInfo(pRuntimeEnv, &ps, &pQueryAttr->intermediateResultRowSize);
int32_t TENMB = 1024*1024*10; int32_t TWENTYMB = 1024*1024*20;
int32_t code = createDiskbasedResultBuffer(&pRuntimeEnv->pResultBuf, ps, TENMB, pQInfo->qId); int32_t code = createDiskbasedResultBuffer(&pRuntimeEnv->pResultBuf, ps, TWENTYMB, pQInfo->qId);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
return code; return code;
} }
...@@ -5710,6 +5718,11 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { ...@@ -5710,6 +5718,11 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
} }
} }
if (pOperator->status == OP_EXEC_DONE) {
*newgroup = false;
return NULL;
}
while(1) { while(1) {
bool prevVal = *newgroup; bool prevVal = *newgroup;
...@@ -5722,7 +5735,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) { ...@@ -5722,7 +5735,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
//assert(*newgroup == false); //assert(*newgroup == false);
*newgroup = prevVal; *newgroup = prevVal;
setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); doSetOperatorCompleted(pOperator);
break; break;
} }
...@@ -8235,7 +8248,7 @@ void destroyUdfInfo(SUdfInfo* pUdfInfo) { ...@@ -8235,7 +8248,7 @@ void destroyUdfInfo(SUdfInfo* pUdfInfo) {
taosCloseDll(pUdfInfo->handle); taosCloseDll(pUdfInfo->handle);
tfree(pUdfInfo); tfree(pUdfInfo);
} }
#ifdef LUA_EMBEDDED
static char* getUdfFuncName(char* funcname, char* name, int type) { static char* getUdfFuncName(char* funcname, char* name, int type) {
switch (type) { switch (type) {
case TSDB_UDF_FUNC_NORMAL: case TSDB_UDF_FUNC_NORMAL:
...@@ -8260,8 +8273,9 @@ static char* getUdfFuncName(char* funcname, char* name, int type) { ...@@ -8260,8 +8273,9 @@ static char* getUdfFuncName(char* funcname, char* name, int type) {
return funcname; return funcname;
} }
#endif
int32_t initUdfInfo(SUdfInfo* pUdfInfo) { int32_t initUdfInfo(SUdfInfo* pUdfInfo) {
#ifdef LUA_EMBEDDED
if (pUdfInfo == NULL || pUdfInfo->handle) { if (pUdfInfo == NULL || pUdfInfo->handle) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -8345,7 +8359,7 @@ int32_t initUdfInfo(SUdfInfo* pUdfInfo) { ...@@ -8345,7 +8359,7 @@ int32_t initUdfInfo(SUdfInfo* pUdfInfo) {
return (*(udfInitFunc)pUdfInfo->funcs[TSDB_UDF_FUNC_INIT])(&pUdfInfo->init); return (*(udfInitFunc)pUdfInfo->funcs[TSDB_UDF_FUNC_INIT])(&pUdfInfo->init);
} }
} }
#endif //LUA_EMBEDDED
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -521,7 +521,7 @@ static void swap(SColumnModel *pColumnModel, int32_t count, int32_t s1, char *da ...@@ -521,7 +521,7 @@ static void swap(SColumnModel *pColumnModel, int32_t count, int32_t s1, char *da
void *first = COLMODEL_GET_VAL(data1, pColumnModel, count, s1, i); void *first = COLMODEL_GET_VAL(data1, pColumnModel, count, s1, i);
void *second = COLMODEL_GET_VAL(data1, pColumnModel, count, s2, i); void *second = COLMODEL_GET_VAL(data1, pColumnModel, count, s2, i);
SSchema* pSchema = &pColumnModel->pFields[i].field; SSchema1* pSchema = &pColumnModel->pFields[i].field;
tsDataSwap(first, second, pSchema->type, pSchema->bytes, buf); tsDataSwap(first, second, pSchema->type, pSchema->bytes, buf);
} }
} }
...@@ -833,7 +833,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta ...@@ -833,7 +833,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
size_t width = 0; size_t width = 0;
for(int32_t i = 0; i < pModel->numOfCols; ++i) { for(int32_t i = 0; i < pModel->numOfCols; ++i) {
SSchema* pSchema = &pModel->pFields[i].field; SSchema1* pSchema = &pModel->pFields[i].field;
if (width < pSchema->bytes) { if (width < pSchema->bytes) {
width = pSchema->bytes; width = pSchema->bytes;
} }
...@@ -882,7 +882,7 @@ void tColDataMergeSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t ...@@ -882,7 +882,7 @@ void tColDataMergeSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t
/* /*
* deep copy of sschema * deep copy of sschema
*/ */
SColumnModel *createColumnModel(SSchema *fields, int32_t numOfCols, int32_t blockCapacity) { SColumnModel *createColumnModel(SSchema1 *fields, int32_t numOfCols, int32_t blockCapacity) {
SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + numOfCols * sizeof(SSchemaEx)); SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + numOfCols * sizeof(SSchemaEx));
if (pColumnModel == NULL) { if (pColumnModel == NULL) {
return NULL; return NULL;
...@@ -1134,7 +1134,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE ...@@ -1134,7 +1134,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
} }
} }
SSchema* getColumnModelSchema(SColumnModel *pColumnModel, int32_t index) { SSchema1* getColumnModelSchema(SColumnModel *pColumnModel, int32_t index) {
assert(pColumnModel != NULL && index >= 0 && index < pColumnModel->numOfCols); assert(pColumnModel != NULL && index >= 0 && index < pColumnModel->numOfCols);
return &pColumnModel->pFields[index].field; return &pColumnModel->pFields[index].field;
} }
...@@ -1156,7 +1156,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC ...@@ -1156,7 +1156,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC
/* start from the second column */ /* start from the second column */
for (int32_t i = 0; i < pModel->numOfCols; ++i) { for (int32_t i = 0; i < pModel->numOfCols; ++i) {
int16_t offset = getColumnModelOffset(pModel, i); int16_t offset = getColumnModelOffset(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i); SSchema1* pSchema = getColumnModelSchema(pModel, i);
char *startPos = inputBuffer->data + offset * blockCapacity + s * pSchema->bytes; char *startPos = inputBuffer->data + offset * blockCapacity + s * pSchema->bytes;
char *endPos = startPos + pSchema->bytes * removed; char *endPos = startPos + pSchema->bytes * removed;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef LUA_EMBEDDED
#include "os.h" #include "os.h"
#include "qScript.h" #include "qScript.h"
#include "ttype.h" #include "ttype.h"
...@@ -444,3 +444,4 @@ bool isValidScript(char *script, int32_t len) { ...@@ -444,3 +444,4 @@ bool isValidScript(char *script, int32_t len) {
return ret; return ret;
} }
#endif
...@@ -143,14 +143,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr ...@@ -143,14 +143,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr
if (optrType == TK_NULL) { if (optrType == TK_NULL) {
if (pToken){ if (pToken){
pToken->type = TSDB_DATA_TYPE_NULL; pToken->type = TSDB_DATA_TYPE_NULL;
tVariantCreate(&pSqlExpr->value, pToken); tVariantCreate(&pSqlExpr->value, pToken, true);
} }
pSqlExpr->tokenId = optrType; pSqlExpr->tokenId = optrType;
pSqlExpr->type = SQL_NODE_VALUE; pSqlExpr->type = SQL_NODE_VALUE;
} else if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) { } else if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) {
if (pToken) { if (pToken) {
toTSDBType(pToken->type); toTSDBType(pToken->type);
tVariantCreate(&pSqlExpr->value, pToken); tVariantCreate(&pSqlExpr->value, pToken, true);
} }
pSqlExpr->tokenId = optrType; pSqlExpr->tokenId = optrType;
pSqlExpr->type = SQL_NODE_VALUE; pSqlExpr->type = SQL_NODE_VALUE;
...@@ -203,7 +203,7 @@ tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType) { ...@@ -203,7 +203,7 @@ tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType) {
if (optrType == TK_INTEGER || optrType == TK_STRING) { if (optrType == TK_INTEGER || optrType == TK_STRING) {
if (pToken) { if (pToken) {
toTSDBType(pToken->type); toTSDBType(pToken->type);
tVariantCreate(&pSqlExpr->value, pToken); tVariantCreate(&pSqlExpr->value, pToken, true);
} }
pSqlExpr->tokenId = optrType; pSqlExpr->tokenId = optrType;
pSqlExpr->type = SQL_NODE_VALUE; pSqlExpr->type = SQL_NODE_VALUE;
...@@ -559,14 +559,14 @@ void tSqlExprDestroy(tSqlExpr *pExpr) { ...@@ -559,14 +559,14 @@ void tSqlExprDestroy(tSqlExpr *pExpr) {
doDestroySqlExprNode(pExpr); doDestroySqlExprNode(pExpr);
} }
SArray *tVariantListAppendToken(SArray *pList, SStrToken *pToken, uint8_t order) { SArray *tVariantListAppendToken(SArray *pList, SStrToken *pToken, uint8_t order, bool needRmquoteEscape) {
if (pList == NULL) { if (pList == NULL) {
pList = taosArrayInit(4, sizeof(tVariantListItem)); pList = taosArrayInit(4, sizeof(tVariantListItem));
} }
if (pToken) { if (pToken) {
tVariantListItem item; tVariantListItem item;
tVariantCreate(&item.pVar, pToken); tVariantCreate(&item.pVar, pToken, needRmquoteEscape);
item.sortOrder = order; item.sortOrder = order;
taosArrayPush(pList, &item); taosArrayPush(pList, &item);
......
此差异已折叠。
...@@ -97,7 +97,7 @@ TEST(testCase, colunmnwise_sort_test) { ...@@ -97,7 +97,7 @@ TEST(testCase, colunmnwise_sort_test) {
} }
TEST(testCase, columnsort_test) { TEST(testCase, columnsort_test) {
SSchema field[1] = { SSchema1 field[1] = {
{TSDB_DATA_TYPE_INT, "k", sizeof(int32_t)}, {TSDB_DATA_TYPE_INT, "k", sizeof(int32_t)},
}; };
......
...@@ -192,7 +192,7 @@ void largeDataTest() { ...@@ -192,7 +192,7 @@ void largeDataTest() {
void qsortTest() { void qsortTest() {
printf("running : %s\n", __FUNCTION__); printf("running : %s\n", __FUNCTION__);
SSchema field[1] = { SSchema1 field[1] = {
{TSDB_DATA_TYPE_INT, "k", sizeof(int32_t)}, {TSDB_DATA_TYPE_INT, "k", sizeof(int32_t)},
}; };
......
...@@ -57,7 +57,7 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR ...@@ -57,7 +57,7 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR
STsdbRepo * pRepo = repo; STsdbRepo * pRepo = repo;
SSubmitMsgIter msgIter = {0}; SSubmitMsgIter msgIter = {0};
SSubmitBlk * pBlock = NULL; SSubmitBlk * pBlock = NULL;
int32_t affectedrows = 0; int32_t affectedrows = 0, numOfRows = 0;
if (tsdbScanAndConvertSubmitMsg(pRepo, pMsg) < 0) { if (tsdbScanAndConvertSubmitMsg(pRepo, pMsg) < 0) {
if (terrno != TSDB_CODE_TDB_TABLE_RECONFIGURE) { if (terrno != TSDB_CODE_TDB_TABLE_RECONFIGURE) {
...@@ -73,9 +73,13 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR ...@@ -73,9 +73,13 @@ int32_t tsdbInsertData(STsdbRepo *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pR
if (tsdbInsertDataToTable(pRepo, pBlock, &affectedrows) < 0) { if (tsdbInsertDataToTable(pRepo, pBlock, &affectedrows) < 0) {
return -1; return -1;
} }
numOfRows += pBlock->numOfRows;
} }
if (pRsp != NULL) pRsp->affectedRows = htonl(affectedrows); if (pRsp != NULL) {
pRsp->affectedRows = htonl(affectedrows);
pRsp->numOfRows = htonl(numOfRows);
}
if (tsdbCheckCommit(pRepo) < 0) return -1; if (tsdbCheckCommit(pRepo) < 0) return -1;
return 0; return 0;
......
...@@ -278,6 +278,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat ...@@ -278,6 +278,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat
if (j <= size) { if (j <= size) {
if (c == '\\' && patterStr[i] == '_' && c1 == '_') { i++; continue; } if (c == '\\' && patterStr[i] == '_' && c1 == '_') { i++; continue; }
if (c == '\\' && patterStr[i] == '%' && c1 == '%') { i++; continue; }
if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->matchOne && c1 != 0)) { if (c == c1 || tolower(c) == tolower(c1) || (c == pInfo->matchOne && c1 != 0)) {
continue; continue;
} }
......
...@@ -334,8 +334,9 @@ bool taosReadConfigOption(const char *option, char *value, char *value2, char *v ...@@ -334,8 +334,9 @@ bool taosReadConfigOption(const char *option, char *value, char *value2, char *v
if (taosReadDirectoryConfig(cfg, value)) { if (taosReadDirectoryConfig(cfg, value)) {
taosReadDataDirCfg(value, value2, value3); taosReadDataDirCfg(value, value2, value3);
ret = true; ret = true;
} else {
ret = false;
} }
ret = false;
break; break;
default: default:
uError("config option:%s, input value:%s, can't be recognized", option, value); uError("config option:%s, input value:%s, can't be recognized", option, value);
......
...@@ -64,7 +64,7 @@ int32_t strRmquote(char *z, int32_t len){ ...@@ -64,7 +64,7 @@ int32_t strRmquote(char *z, int32_t len){
int32_t j = 0; int32_t j = 0;
for (uint32_t k = 1; k < len - 1; ++k) { for (uint32_t k = 1; k < len - 1; ++k) {
if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) { if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) {
if (z[k] == '\\' && z[k + 1] == '_') { if ((z[k] == '\\' && z[k + 1] == '_') || (z[k] == '\\' && z[k + 1] == '%')) {
//match '_' self //match '_' self
} else { } else {
z[j] = z[k + 1]; z[j] = z[k + 1];
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
#define MAX_QUEUED_MSG_NUM 100000 #define MAX_QUEUED_MSG_NUM 100000
#define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB #define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB
static int64_t tsSubmitReqSucNum = 0;
static int64_t tsSubmitRowNum = 0;
static int64_t tsSubmitRowSucNum = 0;
extern void * tsDnodeTmr; extern void * tsDnodeTmr;
static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, SRspRet *); static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, SRspRet *);
static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *); static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *);
...@@ -163,7 +167,16 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR ...@@ -163,7 +167,16 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
pRsp = pRet->rsp; pRsp = pRet->rsp;
} }
if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) code = terrno; if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) {
code = terrno;
} else {
if (pRsp != NULL) atomic_fetch_add_64(&tsSubmitReqSucNum, 1);
}
if (pRsp) {
atomic_fetch_add_64(&tsSubmitRowNum, ntohl(pRsp->numOfRows));
atomic_fetch_add_64(&tsSubmitRowSucNum, ntohl(pRsp->affectedRows));
}
return code; return code;
} }
...@@ -425,3 +438,12 @@ void vnodeWaitWriteCompleted(SVnodeObj *pVnode) { ...@@ -425,3 +438,12 @@ void vnodeWaitWriteCompleted(SVnodeObj *pVnode) {
if (extraSleep) if (extraSleep)
taosMsleep(900); taosMsleep(900);
} }
SVnodeStatisInfo vnodeGetStatisInfo() {
SVnodeStatisInfo info = {0};
info.submitReqSucNum = atomic_exchange_64(&tsSubmitReqSucNum, 0);
info.submitRowNum = atomic_exchange_64(&tsSubmitRowNum, 0);
info.submitRowSucNum = atomic_exchange_64(&tsSubmitRowSucNum, 0);
return info;
}
...@@ -63,6 +63,7 @@ else ...@@ -63,6 +63,7 @@ else
end end
--[[
local flag = false local flag = false
function query_callback(res) function query_callback(res)
if res.code ~=0 then if res.code ~=0 then
...@@ -80,9 +81,10 @@ end ...@@ -80,9 +81,10 @@ end
driver.query_a(conn,"insert into m1 values ('2019-09-01 00:00:00.001', 3, 'robotspace'),('2019-09-01 00:00:00.006', 4, 'Hilink'),('2019-09-01 00:00:00.007', 6, 'Harmony')", query_callback) driver.query_a(conn,"insert into m1 values ('2019-09-01 00:00:00.001', 3, 'robotspace'),('2019-09-01 00:00:00.006', 4, 'Hilink'),('2019-09-01 00:00:00.007', 6, 'Harmony')", query_callback)
while not flag do while not flag do
-- ngx.say("i am here once...") ngx.say("i am here once...")
ngx.sleep(0.001) -- time unit is second ngx.sleep(0.001) -- time unit is second
end end
--]]
ngx.say("pool water_mark:"..pool:get_water_mark()) ngx.say("pool water_mark:"..pool:get_water_mark())
......
# TDengine driver connector for Lua # TDengine driver connector for Lua
It's a Lua implementation for [TDengine](https://github.com/taosdata/TDengine), an open-sourced big data platform designed and optimized for the Internet of Things (IoT), Connected Cars, Industrial IoT, and IT Infrastructure and Application Monitoring. You may need to install Lua5.3 . It's a Lua implementation for [TDengine](https://github.com/taosdata/TDengine), an open-sourced big data platform designed and optimized for the Internet of Things (IoT), Connected Cars, Industrial IoT, and IT Infrastructure and Application Monitoring. You may need to install Lua5.3 .
As TDengine is built with lua-enable, the built-in lua module conflicts with external lua. The following commands require TDengine built with lua-disable.
To disable built-in lua:
mkdir debug && cd debug
cmake .. -DBUILD_LUA=false && cmake --build .
## Lua Dependencies ## Lua Dependencies
- Lua: - Lua:
``` ```
......
...@@ -102,7 +102,7 @@ static int l_query(lua_State *L){ ...@@ -102,7 +102,7 @@ static int l_query(lua_State *L){
printf("failed, reason:%s\n", taos_errstr(result)); printf("failed, reason:%s\n", taos_errstr(result));
lua_pushinteger(L, -1); lua_pushinteger(L, -1);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos)); lua_pushstring(L, taos_errstr(result));
lua_setfield(L, table_index, "error"); lua_setfield(L, table_index, "error");
return 1; return 1;
......
...@@ -102,7 +102,7 @@ static int l_query(lua_State *L){ ...@@ -102,7 +102,7 @@ static int l_query(lua_State *L){
printf("failed, reason:%s\n", taos_errstr(result)); printf("failed, reason:%s\n", taos_errstr(result));
lua_pushinteger(L, -1); lua_pushinteger(L, -1);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos)); lua_pushstring(L, taos_errstr(result));
lua_setfield(L, table_index, "error"); lua_setfield(L, table_index, "error");
return 1; return 1;
......
...@@ -23,7 +23,7 @@ sql create table $table2 (ts timestamp, b binary(20)) ...@@ -23,7 +23,7 @@ sql create table $table2 (ts timestamp, b binary(20))
sql insert into $table1 values(now, "table_name") sql insert into $table1 values(now, "table_name")
sql insert into $table1 values(now-1m, "tablexname") sql insert into $table1 values(now-1m, "tablexname")
sql insert into $table1 values(now-2m, "tablexxx") sql insert into $table1 values(now-2m, "tablexxx")
sql insert into $table1 values(now-2m, "table") sql insert into $table1 values(now-3m, "table")
sql select b from $table1 sql select b from $table1
if $rows != 4 then if $rows != 4 then
...@@ -56,6 +56,45 @@ if $rows != 1 then ...@@ -56,6 +56,45 @@ if $rows != 1 then
return -1 return -1
endi endi
sql create database escape_percentage;
sql use escape_percentage;
$table1 = tablename
$table2 = `table%`
sql create table $table1 (ts timestamp, b binary(20))
sql create table $table2 (ts timestamp, b binary(20))
sql insert into $table1 values(now, "table%name")
sql insert into $table1 values(now-1m, "table%")
sql insert into $table1 values(now-2m, "table%%%")
sql insert into $table1 values(now-3m, "table")
sql select b from $table1 where b like 'table\%'
print $rows
if $rows != 1 then
return -1
endi
sql select b from $table1 where b like 'table\%\%\%'
print $rows
if $rows != 1 then
return -1
endi
sql select b from $table1 where b like 'table%'
print $rows
if $rows != 4 then
return -1
endi
sql show tables like 'table\%'
print $rows
if $rows != 1 then
return -1
endi
sql show tables like 'table%'
print $rows
if $rows != 2 then
return -1
endi
sql drop database escape_percentage
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -41,7 +41,7 @@ sql create dnode $hostname2 ...@@ -41,7 +41,7 @@ sql create dnode $hostname2
sleep 10000 sleep 10000
sql show log.tables; sql show log.tables;
if $rows > 6 then if $rows > 20 then
return -1 return -1
endi endi
...@@ -50,7 +50,7 @@ print ===>rows $rows ...@@ -50,7 +50,7 @@ print ===>rows $rows
print $data00 $data01 $data02 print $data00 $data01 $data02
print $data10 $data11 $data12 print $data10 $data11 $data12
print $data20 $data21 $data22 print $data20 $data21 $data22
if $rows < 10 then if $rows < 9 then
return -1 return -1
endi endi
......
...@@ -42,7 +42,7 @@ print dnode2 openVnodes $data2_2 ...@@ -42,7 +42,7 @@ print dnode2 openVnodes $data2_2
if $data2_1 != 0 then if $data2_1 != 0 then
return -1 return -1
endi endi
if $data2_2 != 1 then if $data2_2 != 2 then
return -1 return -1
endi endi
...@@ -56,7 +56,25 @@ print $data30 ...@@ -56,7 +56,25 @@ print $data30
print $data40 print $data40
print $data50 print $data50
if $rows > 6 then print *num of tables $rows
if $rows > 17 then
return -1
endi
sql show log.stables
print $data00
print $data10
print $data20
print $data30
print $data40
print $data50
print $data60
print *num of stables $rows
if $rows > 7 then
return -1 return -1
endi endi
......
...@@ -19,7 +19,7 @@ sleep 3000 ...@@ -19,7 +19,7 @@ sleep 3000
sql show dnodes sql show dnodes
print dnode1 openVnodes $data2_1 print dnode1 openVnodes $data2_1
if $data2_1 > 2 then if $data2_1 > 4 then
return -1 return -1
endi endi
...@@ -28,20 +28,20 @@ sql create dnode $hostname2 ...@@ -28,20 +28,20 @@ sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode2 -s start
$x = 0 $x = 0
show2: show2:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 10 then if $x == 10 then
return -1 return -1
endi endi
sql show dnodes sql show dnodes
print dnode1 openVnodes $data2_1 print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2 print dnode2 openVnodes $data2_2
if $data2_1 != 0 then if $data2_1 != 0 then
goto show2 goto show2
endi endi
if $data2_2 > 2 then if $data2_2 > 4 then
goto show2 goto show2
endi endi
...@@ -55,7 +55,7 @@ print $data30 ...@@ -55,7 +55,7 @@ print $data30
print $data40 print $data40
print $data50 print $data50
if $rows > 5 then if $rows > 14 then
return -1 return -1
endi endi
...@@ -74,4 +74,4 @@ if $rows2 <= $rows1 then ...@@ -74,4 +74,4 @@ if $rows2 <= $rows1 then
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册