fix:cols error because delete json cols value
This commit is contained in:
parent
0f1f239425
commit
b493b8d2e1
|
@ -184,6 +184,7 @@ typedef struct {
|
|||
SSmlLineInfo *lines; // element is SSmlLineInfo
|
||||
bool parseJsonByLib;
|
||||
SArray *tagJsonArray;
|
||||
SArray *valueJsonArray;
|
||||
|
||||
//
|
||||
SArray *preLineTagKV;
|
||||
|
|
|
@ -1072,6 +1072,12 @@ void smlDestroyInfo(SSmlHandle *info) {
|
|||
}
|
||||
taosArrayDestroy(info->tagJsonArray);
|
||||
|
||||
for (int i = 0; i < taosArrayGetSize(info->valueJsonArray); i++) {
|
||||
cJSON *value = (cJSON *)taosArrayGetP(info->valueJsonArray, i);
|
||||
cJSON_Delete(value);
|
||||
}
|
||||
taosArrayDestroy(info->valueJsonArray);
|
||||
|
||||
taosArrayDestroy(info->preLineTagKV);
|
||||
taosArrayDestroy(info->maxTagKVs);
|
||||
taosArrayDestroy(info->preLineColKV);
|
||||
|
@ -1111,6 +1117,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
|
|||
info->dataFormat = true;
|
||||
|
||||
info->tagJsonArray = taosArrayInit(8, POINTER_BYTES);
|
||||
info->valueJsonArray = taosArrayInit(8, POINTER_BYTES);
|
||||
info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||
info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv));
|
||||
info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||
|
|
|
@ -1155,15 +1155,18 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
|||
char tmp = elements->cols[elements->colsLen];
|
||||
elements->cols[elements->colsLen] = '\0';
|
||||
cJSON* valueJson = cJSON_Parse(elements->cols);
|
||||
if (unlikely(valueJson == NULL)) {
|
||||
uError("SML:0x%" PRIx64 " parse json cols failed:%s", info->id, elements->cols);
|
||||
return TSDB_CODE_TSC_INVALID_JSON;
|
||||
}
|
||||
taosArrayPush(info->tagJsonArray, &valueJson);
|
||||
ret = smlParseValueFromJSONObj(valueJson, &kv);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
uError("SML:Failed to parse value from JSON Obj:%s", elements->cols);
|
||||
elements->cols[elements->colsLen] = tmp;
|
||||
cJSON_Delete(valueJson);
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
}
|
||||
elements->cols[elements->colsLen] = tmp;
|
||||
cJSON_Delete(valueJson);
|
||||
}else if(smlParseValue(&kv, &info->msgBuf) != TSDB_CODE_SUCCESS){
|
||||
uError("SML:cols invalidate:%s", elements->cols);
|
||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||
|
@ -1176,7 +1179,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
|||
cJSON* tagsJson = cJSON_Parse(elements->tags);
|
||||
*(elements->tags + elements->tagsLen) = tmp;
|
||||
if (unlikely(tagsJson == NULL)) {
|
||||
uError("SML:0x%" PRIx64 " parse json failed:%s", info->id, elements->tags);
|
||||
uError("SML:0x%" PRIx64 " parse json tag failed:%s", info->id, elements->tags);
|
||||
return TSDB_CODE_TSC_INVALID_JSON;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ class TDSimClient:
|
|||
self.testCluster = False
|
||||
self.path = path
|
||||
self.cfgDict = {
|
||||
"fqdn": "localhost",
|
||||
"numOfLogLines": "100000000",
|
||||
"locale": "en_US.UTF-8",
|
||||
"charset": "UTF-8",
|
||||
|
@ -119,6 +120,7 @@ class TDDnode:
|
|||
self.asan = False
|
||||
self.remoteIP = ""
|
||||
self.cfgDict = {
|
||||
"fqdn": "localhost",
|
||||
"monitor": "0",
|
||||
"maxShellConns": "30000",
|
||||
"locale": "en_US.UTF-8",
|
||||
|
|
Loading…
Reference in New Issue