Merge pull request #19366 from taosdata/refact/submit_req_marks
fix:memory leak in schemaless
This commit is contained in:
commit
ad6681b424
|
@ -182,6 +182,7 @@ typedef struct {
|
||||||
int8_t offset[OTD_JSON_FIELDS_NUM];
|
int8_t offset[OTD_JSON_FIELDS_NUM];
|
||||||
SSmlLineInfo *lines; // element is SSmlLineInfo
|
SSmlLineInfo *lines; // element is SSmlLineInfo
|
||||||
bool parseJsonByLib;
|
bool parseJsonByLib;
|
||||||
|
SArray *tagJsonArray;
|
||||||
|
|
||||||
//
|
//
|
||||||
SArray *preLineTagKV;
|
SArray *preLineTagKV;
|
||||||
|
@ -230,6 +231,7 @@ int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32
|
||||||
int32_t smlClearForRerun(SSmlHandle *info);
|
int32_t smlClearForRerun(SSmlHandle *info);
|
||||||
int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg);
|
int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg);
|
||||||
uint8_t smlGetTimestampLen(int64_t num);
|
uint8_t smlGetTimestampLen(int64_t num);
|
||||||
|
void clearColValArray(SArray* pCols);
|
||||||
|
|
||||||
int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements);
|
int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements);
|
||||||
int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements);
|
int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements);
|
||||||
|
|
|
@ -1024,6 +1024,16 @@ static void smlDestroyTableInfo(SSmlHandle *info, SSmlTableInfo *tag) {
|
||||||
taosMemoryFree(tag);
|
taosMemoryFree(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearColValArray(SArray* pCols) {
|
||||||
|
int32_t num = taosArrayGetSize(pCols);
|
||||||
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
|
SColVal* pCol = taosArrayGet(pCols, i);
|
||||||
|
if (TSDB_DATA_TYPE_NCHAR == pCol->type) {
|
||||||
|
taosMemoryFreeClear(pCol->value.pData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void smlDestroyInfo(SSmlHandle *info) {
|
void smlDestroyInfo(SSmlHandle *info) {
|
||||||
if (!info) return;
|
if (!info) return;
|
||||||
qDestroyQuery(info->pQuery);
|
qDestroyQuery(info->pQuery);
|
||||||
|
@ -1053,6 +1063,12 @@ void smlDestroyInfo(SSmlHandle *info) {
|
||||||
// destroy info->pVgHash
|
// destroy info->pVgHash
|
||||||
taosHashCleanup(info->pVgHash);
|
taosHashCleanup(info->pVgHash);
|
||||||
|
|
||||||
|
for(int i = 0; i< taosArrayGetSize(info->tagJsonArray); i++){
|
||||||
|
cJSON *tags = (cJSON *)taosArrayGetP(info->tagJsonArray, i);
|
||||||
|
cJSON_Delete(tags);
|
||||||
|
}
|
||||||
|
taosArrayDestroy(info->tagJsonArray);
|
||||||
|
|
||||||
taosArrayDestroy(info->preLineTagKV);
|
taosArrayDestroy(info->preLineTagKV);
|
||||||
taosArrayDestroy(info->maxTagKVs);
|
taosArrayDestroy(info->maxTagKVs);
|
||||||
taosArrayDestroy(info->preLineColKV);
|
taosArrayDestroy(info->preLineColKV);
|
||||||
|
@ -1067,6 +1083,7 @@ void smlDestroyInfo(SSmlHandle *info) {
|
||||||
taosMemoryFree(info->lines);
|
taosMemoryFree(info->lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cJSON_Delete(info->root);
|
||||||
taosMemoryFreeClear(info);
|
taosMemoryFreeClear(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1090,6 +1107,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
|
||||||
info->pQuery = smlInitHandle();
|
info->pQuery = smlInitHandle();
|
||||||
info->dataFormat = true;
|
info->dataFormat = true;
|
||||||
|
|
||||||
|
info->tagJsonArray = taosArrayInit(8, POINTER_BYTES);
|
||||||
info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv));
|
info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||||
info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv));
|
info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv));
|
||||||
info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv));
|
info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||||
|
|
|
@ -335,6 +335,9 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset){
|
||||||
(*start)++;
|
(*start)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(*(*start) == '\0'){
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(*(*start) == '}'){
|
if(*(*start) == '}'){
|
||||||
(*start)++;
|
(*start)++;
|
||||||
break;
|
break;
|
||||||
|
@ -655,14 +658,14 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
|
||||||
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL);
|
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL);
|
||||||
|
|
||||||
if(unlikely(sMeta == NULL)){
|
if(unlikely(sMeta == NULL)){
|
||||||
sMeta = smlBuildSTableMeta(info->dataFormat);
|
|
||||||
STableMeta * pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen);
|
STableMeta * pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen);
|
||||||
sMeta->tableMeta = pTableMeta;
|
|
||||||
if(pTableMeta == NULL){
|
if(pTableMeta == NULL){
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
sMeta = smlBuildSTableMeta(info->dataFormat);
|
||||||
|
sMeta->tableMeta = pTableMeta;
|
||||||
nodeListSet(&info->superTables, elements->measure, elements->measureLen, sMeta, NULL);
|
nodeListSet(&info->superTables, elements->measure, elements->measureLen, sMeta, NULL);
|
||||||
}
|
}
|
||||||
info->currSTableMeta = sMeta->tableMeta;
|
info->currSTableMeta = sMeta->tableMeta;
|
||||||
|
@ -923,9 +926,6 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
|
||||||
cJSON *tsJson = NULL;
|
cJSON *tsJson = NULL;
|
||||||
cJSON *valueJson = NULL;
|
cJSON *valueJson = NULL;
|
||||||
cJSON *tagsJson = NULL;
|
cJSON *tagsJson = NULL;
|
||||||
char* rootStr = cJSON_PrintUnformatted(root);
|
|
||||||
uError("rootStr:%s", rootStr);
|
|
||||||
taosMemoryFree(rootStr);
|
|
||||||
|
|
||||||
int32_t size = cJSON_GetArraySize(root);
|
int32_t size = cJSON_GetArraySize(root);
|
||||||
// outmost json fields has to be exactly 4
|
// outmost json fields has to be exactly 4
|
||||||
|
@ -956,6 +956,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse tags
|
// Parse tags
|
||||||
|
bool needFree = info->dataFormat;
|
||||||
elements->tags = cJSON_PrintUnformatted(tagsJson);
|
elements->tags = cJSON_PrintUnformatted(tagsJson);
|
||||||
elements->tagsLen = strlen(elements->tags);
|
elements->tagsLen = strlen(elements->tags);
|
||||||
if(is_same_child_table_telnet(elements, &info->preLine) != 0) {
|
if(is_same_child_table_telnet(elements, &info->preLine) != 0) {
|
||||||
|
@ -968,7 +969,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(info->dataFormat){
|
if(needFree){
|
||||||
taosMemoryFree(elements->tags);
|
taosMemoryFree(elements->tags);
|
||||||
elements->tags = NULL;
|
elements->tags = NULL;
|
||||||
}
|
}
|
||||||
|
@ -994,6 +995,7 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
|
||||||
if(ret == TSDB_CODE_SUCCESS){
|
if(ret == TSDB_CODE_SUCCESS){
|
||||||
ret = smlBuildRow(info->currTableDataCtx);
|
ret = smlBuildRow(info->currTableDataCtx);
|
||||||
}
|
}
|
||||||
|
clearColValArray(info->currTableDataCtx->pValues);
|
||||||
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||||
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1095,6 +1097,11 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
||||||
|
|
||||||
if(unlikely(**start == '\0' && elements->measure == NULL)) return TSDB_CODE_SUCCESS;
|
if(unlikely(**start == '\0' && elements->measure == NULL)) return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
if (unlikely(IS_INVALID_TABLE_LEN(elements->measureLen))) {
|
||||||
|
smlBuildInvalidDataMsg(&info->msgBuf, "measure is empty or too large than 192", NULL);
|
||||||
|
return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH;
|
||||||
|
}
|
||||||
|
|
||||||
SSmlKv kv = {.key = VALUE, .keyLen = VALUE_LEN, .value = elements->cols, .length = (size_t)elements->colsLen};
|
SSmlKv kv = {.key = VALUE, .keyLen = VALUE_LEN, .value = elements->cols, .length = (size_t)elements->colsLen};
|
||||||
if (elements->colsLen == 0 || smlParseValue(&kv, &info->msgBuf) != TSDB_CODE_SUCCESS) {
|
if (elements->colsLen == 0 || smlParseValue(&kv, &info->msgBuf) != TSDB_CODE_SUCCESS) {
|
||||||
uError("SML:cols invalidate:%s", elements->cols);
|
uError("SML:cols invalidate:%s", elements->cols);
|
||||||
|
@ -1112,8 +1119,8 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
||||||
return TSDB_CODE_TSC_INVALID_JSON;
|
return TSDB_CODE_TSC_INVALID_JSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosArrayPush(info->tagJsonArray, &tagsJson);
|
||||||
ret = smlParseTagsFromJSON(info, tagsJson, elements);
|
ret = smlParseTagsFromJSON(info, tagsJson, elements);
|
||||||
cJSON_free(tagsJson);
|
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
|
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1141,6 +1148,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
||||||
if(ret == TSDB_CODE_SUCCESS){
|
if(ret == TSDB_CODE_SUCCESS){
|
||||||
ret = smlBuildRow(info->currTableDataCtx);
|
ret = smlBuildRow(info->currTableDataCtx);
|
||||||
}
|
}
|
||||||
|
clearColValArray(info->currTableDataCtx->pValues);
|
||||||
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||||
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -151,14 +151,14 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
|
||||||
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL);
|
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL);
|
||||||
|
|
||||||
if(unlikely(sMeta == NULL)){
|
if(unlikely(sMeta == NULL)){
|
||||||
sMeta = smlBuildSTableMeta(info->dataFormat);
|
|
||||||
STableMeta * pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen);
|
STableMeta * pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen);
|
||||||
sMeta->tableMeta = pTableMeta;
|
|
||||||
if(pTableMeta == NULL){
|
if(pTableMeta == NULL){
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
sMeta = smlBuildSTableMeta(info->dataFormat);
|
||||||
|
sMeta->tableMeta = pTableMeta;
|
||||||
nodeListSet(&info->superTables, currElement->measure, currElement->measureLen, sMeta, NULL);
|
nodeListSet(&info->superTables, currElement->measure, currElement->measureLen, sMeta, NULL);
|
||||||
}
|
}
|
||||||
info->currSTableMeta = sMeta->tableMeta;
|
info->currSTableMeta = sMeta->tableMeta;
|
||||||
|
@ -353,14 +353,14 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
|
||||||
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL);
|
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, currElement->measure, currElement->measureLen, NULL);
|
||||||
|
|
||||||
if(unlikely(sMeta == NULL)){
|
if(unlikely(sMeta == NULL)){
|
||||||
sMeta = smlBuildSTableMeta(info->dataFormat);
|
|
||||||
STableMeta * pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen);
|
STableMeta * pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen);
|
||||||
sMeta->tableMeta = pTableMeta;
|
|
||||||
if(pTableMeta == NULL){
|
if(pTableMeta == NULL){
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
sMeta = smlBuildSTableMeta(info->dataFormat);
|
||||||
|
sMeta->tableMeta = pTableMeta;
|
||||||
nodeListSet(&info->superTables, currElement->measure, currElement->measureLen, sMeta, NULL);
|
nodeListSet(&info->superTables, currElement->measure, currElement->measureLen, sMeta, NULL);
|
||||||
}
|
}
|
||||||
info->currSTableMeta = sMeta->tableMeta;
|
info->currSTableMeta = sMeta->tableMeta;
|
||||||
|
@ -646,6 +646,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
|
||||||
if(info->dataFormat){
|
if(info->dataFormat){
|
||||||
smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0);
|
smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0);
|
||||||
smlBuildRow(info->currTableDataCtx);
|
smlBuildRow(info->currTableDataCtx);
|
||||||
|
clearColValArray(info->currTableDataCtx->pValues);
|
||||||
}else{
|
}else{
|
||||||
taosArraySet(elements->colArray, 0, &kv);
|
taosArraySet(elements->colArray, 0, &kv);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,14 +86,14 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
|
||||||
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL);
|
SSmlSTableMeta *sMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL);
|
||||||
|
|
||||||
if(unlikely(sMeta == NULL)){
|
if(unlikely(sMeta == NULL)){
|
||||||
sMeta = smlBuildSTableMeta(info->dataFormat);
|
|
||||||
STableMeta * pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen);
|
STableMeta * pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen);
|
||||||
sMeta->tableMeta = pTableMeta;
|
|
||||||
if(pTableMeta == NULL){
|
if(pTableMeta == NULL){
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
sMeta = smlBuildSTableMeta(info->dataFormat);
|
||||||
|
sMeta->tableMeta = pTableMeta;
|
||||||
nodeListSet(&info->superTables, elements->measure, elements->measureLen, sMeta, NULL);
|
nodeListSet(&info->superTables, elements->measure, elements->measureLen, sMeta, NULL);
|
||||||
}
|
}
|
||||||
info->currSTableMeta = sMeta->tableMeta;
|
info->currSTableMeta = sMeta->tableMeta;
|
||||||
|
@ -324,6 +324,7 @@ int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
|
||||||
if(ret == TSDB_CODE_SUCCESS){
|
if(ret == TSDB_CODE_SUCCESS){
|
||||||
ret = smlBuildRow(info->currTableDataCtx);
|
ret = smlBuildRow(info->currTableDataCtx);
|
||||||
}
|
}
|
||||||
|
clearColValArray(info->currTableDataCtx->pValues);
|
||||||
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||||
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -18,6 +18,16 @@
|
||||||
#include "parToken.h"
|
#include "parToken.h"
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
|
|
||||||
|
static void clearColValArray(SArray* pCols) {
|
||||||
|
int32_t num = taosArrayGetSize(pCols);
|
||||||
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
|
SColVal* pCol = taosArrayGet(pCols, i);
|
||||||
|
if (TSDB_DATA_TYPE_NCHAR == pCol->type) {
|
||||||
|
taosMemoryFreeClear(pCol->value.pData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf,
|
int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf,
|
||||||
int32_t msgBufLen) {
|
int32_t msgBufLen) {
|
||||||
SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen};
|
SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen};
|
||||||
|
@ -189,7 +199,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
||||||
SSchema* pColSchema = schema + index;
|
SSchema* pColSchema = schema + index;
|
||||||
SColVal* pVal = taosArrayGet(pTableCxt->pValues, index);
|
SColVal* pVal = taosArrayGet(pTableCxt->pValues, index);
|
||||||
SSmlKv* kv = (SSmlKv*)data;
|
SSmlKv* kv = (SSmlKv*)data;
|
||||||
if(kv->keyLen != strlen(pColSchema->name) || memcmp(kv->key, pColSchema->name, kv->keyLen) != 0){
|
if(kv->keyLen != strlen(pColSchema->name) || memcmp(kv->key, pColSchema->name, kv->keyLen) != 0 || kv->type != pColSchema->type){
|
||||||
ret = TSDB_CODE_SML_INVALID_DATA;
|
ret = TSDB_CODE_SML_INVALID_DATA;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -207,9 +217,11 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
||||||
}
|
}
|
||||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)pUcs4, size, &len)) {
|
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)pUcs4, size, &len)) {
|
||||||
if (errno == E2BIG) {
|
if (errno == E2BIG) {
|
||||||
|
taosMemoryFree(pUcs4);
|
||||||
ret = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
ret = TSDB_CODE_PAR_VALUE_TOO_LONG;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
taosMemoryFree(pUcs4);
|
||||||
ret = TSDB_CODE_TSC_INVALID_VALUE;
|
ret = TSDB_CODE_TSC_INVALID_VALUE;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -316,7 +328,10 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SSmlKv* kv = *(SSmlKv**)p;
|
SSmlKv* kv = *(SSmlKv**)p;
|
||||||
|
if(kv->type != pColSchema->type){
|
||||||
|
ret = buildInvalidOperationMsg(&pBuf, "kv type not equal to col type");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
|
if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||||
kv->i = convertTimePrecision(kv->i, TSDB_TIME_PRECISION_NANO, pTableMeta->tableInfo.precision);
|
kv->i = convertTimePrecision(kv->i, TSDB_TIME_PRECISION_NANO, pTableMeta->tableInfo.precision);
|
||||||
}
|
}
|
||||||
|
@ -354,10 +369,12 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
insCheckTableDataOrder(pTableCxt, TD_ROW_KEY(*pRow));
|
insCheckTableDataOrder(pTableCxt, TD_ROW_KEY(*pRow));
|
||||||
|
clearColValArray(pTableCxt->pValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
insDestroyBoundColInfo(&bindTags);
|
insDestroyBoundColInfo(&bindTags);
|
||||||
|
tdDestroySVCreateTbReq(pCreateTblReq);
|
||||||
taosMemoryFree(pCreateTblReq);
|
taosMemoryFree(pCreateTblReq);
|
||||||
taosArrayDestroy(tagName);
|
taosArrayDestroy(tagName);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -426,8 +426,8 @@
|
||||||
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py
|
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
|
||||||
,,n,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
|
||||||
,,n,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
|
||||||
|
|
|
@ -211,8 +211,7 @@ int smlProcess_json3_Test() {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
const char *sql[] = {
|
const char *sql[] = {
|
||||||
// "[{\"metric\":\"sys.cpu.nice3\",\"timestamp\":0,\"value\":\"18\",\"tags\":{\"host\":\"web01\",\"id\":\"t1\",\"dc\":\"lga\"}}]"
|
"[{\"metric\":\"sys.cpu.nice3\",\"timestamp\":0,\"value\":\"18\",\"tags\":{\"host\":\"web01\",\"id\":\"t1\",\"dc\":\"lga\"}}]"
|
||||||
"{\"metric\": \"dcxnmr\", \"timestamp\": {\"value\": 1626006833639000000, \"type\": \"ns\"}, \"value\": {\"value\": false, \"type\": \"bool\"}, \"tags\": {\"t0\": {\"value\": false, \"type\": \"bool\"}, \"t1\": {\"value\": 127, \"type\": \"tinyint\"}, \"t2\": {\"value\": 32767, \"type\": \"smallint\"}, \"t3\": {\"value\": 2147483647, \"type\": \"int\"}, \"t4\": {\"value\": 9223372036854775807, \"type\": \"bigint\"}, \"t5\": {\"value\": 11.12345027923584, \"type\": \"float\"}, \"t6\": {\"value\": 22.123456789, \"type\": \"double\"}, \"t7\": {\"value\": \"binaryTagValue\", \"type\": \"binary\"}, \"t8\": {\"value\": \"abc{aaa\", \"type\": \"nchar\"}}}"
|
|
||||||
};
|
};
|
||||||
char *sql1[1] = {0};
|
char *sql1[1] = {0};
|
||||||
for(int i = 0; i < 1; i++){
|
for(int i = 0; i < 1; i++){
|
||||||
|
@ -741,26 +740,11 @@ int sml_dup_time_Test() {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
const char *sql[] = {//"test_ms,t0=t c0=f 1626006833641",
|
const char *sql[] = {//"test_ms,t0=t c0=f 1626006833641",
|
||||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000",
|
||||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000",
|
||||||
"c0=false,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000",
|
||||||
"123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000",
|
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000",
|
||||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"};
|
||||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
|
||||||
"c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
|
||||||
"123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000",
|
|
||||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
|
||||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
|
||||||
"c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
|
||||||
"123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000",
|
|
||||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
|
||||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
|
||||||
"c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
|
||||||
"123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000",
|
|
||||||
"ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
|
|
||||||
"12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
|
|
||||||
"c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
|
|
||||||
"123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"};
|
|
||||||
pRes = taos_query(taos, "use sml_db");
|
pRes = taos_query(taos, "use sml_db");
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
@ -943,8 +927,10 @@ int sml_ttl_Test() {
|
||||||
pRes = taos_query(taos, "select `ttl` from information_schema.ins_tables where table_name='t_be97833a0e1f523fcdaeb6291d6fdf27'");
|
pRes = taos_query(taos, "select `ttl` from information_schema.ins_tables where table_name='t_be97833a0e1f523fcdaeb6291d6fdf27'");
|
||||||
printf("%s result2:%s\n", __FUNCTION__, taos_errstr(pRes));
|
printf("%s result2:%s\n", __FUNCTION__, taos_errstr(pRes));
|
||||||
TAOS_ROW row = taos_fetch_row(pRes);
|
TAOS_ROW row = taos_fetch_row(pRes);
|
||||||
int32_t ttl = *(int32_t*)row[0];
|
if(row != NULL && *row != NULL){
|
||||||
ASSERT(ttl == 20);
|
int32_t ttl = *(int32_t*)row[0];
|
||||||
|
ASSERT(ttl == 20);
|
||||||
|
}
|
||||||
|
|
||||||
int code = taos_errno(pRes);
|
int code = taos_errno(pRes);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
Loading…
Reference in New Issue