提交 37998561 编写于 作者: Z zhaoyanggh

fix asm error

上级 25562295
......@@ -160,7 +160,7 @@ extern char configDir[];
#define DEFAULT_SUB_INTERVAL 10000
#define DEFAULT_QUERY_INTERVAL 10000
#define STMT_BIND_PARAM_BATCH 1
#define SML_LINE_SQL_SYNTAX_OFFSET 7
#if _MSC_VER <= 1900
#define __func__ __FUNCTION__
......@@ -346,6 +346,7 @@ typedef struct SSuperTable_S {
// one sql
uint8_t autoCreateTable; // 0: create sub table, 1: auto create sub table
uint16_t iface; // 0: taosc, 1: rest, 2: stmt
uint16_t lineProtocol;
int64_t childTblLimit;
uint64_t childTblOffset;
......@@ -359,6 +360,7 @@ typedef struct SSuperTable_S {
// interval
int64_t insertRows;
int64_t timeStampStep;
int tsPrecision;
char startTimestamp[MAX_TB_NAME_SIZE];
char sampleFormat[SMALL_BUFF_LEN]; // csv, json
char sampleFile[MAX_FILE_NAME_LEN];
......@@ -577,6 +579,7 @@ extern char * g_aggreFuncDemo[];
extern char * g_aggreFunc[];
extern SArguments g_args;
extern SDbs g_Dbs;
extern char * g_dupstr;
extern int64_t g_totalChildTables;
extern int64_t g_actualChildTables;
extern SQueryMetaInfo g_queryInfo;
......@@ -585,7 +588,7 @@ extern FILE * g_fpOfInsertResult;
#define min(a, b) (((a) < (b)) ? (a) : (b))
/* ************ Function declares ************ */
int parse_args(int argc, char *argv[], SArguments *arguments);
int parse_args(int argc, char *argv[]);
int getInfoFromJsonFile(char *file);
void setupForAnsiEscape(void);
int taosRandom();
......
......@@ -182,6 +182,9 @@ static int calcRowLen(SSuperTable *superTbls) {
errorPrint("get error data type : %s\n", dataType);
exit(EXIT_FAILURE);
}
if (superTbls->iface == SML_IFACE) {
lenOfOneRow += SML_LINE_SQL_SYNTAX_OFFSET;
}
}
superTbls->lenOfOneRow = lenOfOneRow + TIMESTAMP_BUFF_LEN; // timestamp
......@@ -233,6 +236,15 @@ static int calcRowLen(SSuperTable *superTbls) {
errorPrint("get error tag type : %s\n", dataType);
exit(EXIT_FAILURE);
}
if (superTbls->iface == SML_IFACE) {
lenOfOneRow += SML_LINE_SQL_SYNTAX_OFFSET;
}
}
if (superTbls->iface == SML_IFACE) {
lenOfTagOfOneRow +=
2 * TSDB_TABLE_NAME_LEN * 2 + SML_LINE_SQL_SYNTAX_OFFSET;
superTbls->lenOfOneRow += lenOfTagOfOneRow;
}
superTbls->lenOfTagOfOneRow = lenOfTagOfOneRow;
......@@ -1357,7 +1369,7 @@ static int prepareSampleData() {
void postFreeResource() {
tmfclose(g_fpOfInsertResult);
tmfree(g_dupstr);
for (int i = 0; i < g_Dbs.dbCount; i++) {
for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) {
if (0 != g_Dbs.db[i].superTbls[j].colsOfCreateChildTable) {
......@@ -1918,8 +1930,10 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k) {
affectedRows = k;
break;
case SML_IFACE:
res = taos_schemaless_insert(pThreadInfo->taos, pThreadInfo->lines,
k, 0, pThreadInfo->time_precision);
res = taos_schemaless_insert(
pThreadInfo->taos, pThreadInfo->lines,
stbInfo->lineProtocol == TSDB_SML_JSON_PROTOCOL ? 0 : k,
stbInfo->lineProtocol, stbInfo->tsPrecision);
code = taos_errno(res);
affectedRows = taos_affected_rows(res);
if (code != TSDB_CODE_SUCCESS) {
......
......@@ -854,7 +854,6 @@ int getMetaFromInsertJsonFile(cJSON *root) {
g_Dbs.db[i].superTbls[j].iface = STMT_IFACE;
} else if (0 == strcasecmp(stbIface->valuestring, "sml")) {
g_Dbs.db[i].superTbls[j].iface = SML_IFACE;
g_args.iface = SML_IFACE;
} else {
errorPrint(
"failed to read json, insert_mode %s not recognized\n",
......@@ -869,6 +868,36 @@ int getMetaFromInsertJsonFile(cJSON *root) {
goto PARSE_OVER;
}
cJSON *stbLineProtocol =
cJSON_GetObjectItem(stbInfo, "line_protocol");
if (stbLineProtocol && stbLineProtocol->type == cJSON_String &&
stbLineProtocol->valuestring != NULL) {
if (0 == strcasecmp(stbLineProtocol->valuestring, "line")) {
g_Dbs.db[i].superTbls[j].lineProtocol =
TSDB_SML_LINE_PROTOCOL;
} else if (0 ==
strcasecmp(stbLineProtocol->valuestring, "telnet")) {
g_Dbs.db[i].superTbls[j].lineProtocol =
TSDB_SML_TELNET_PROTOCOL;
} else if (0 ==
strcasecmp(stbLineProtocol->valuestring, "json")) {
g_Dbs.db[i].superTbls[j].lineProtocol =
TSDB_SML_JSON_PROTOCOL;
} else {
errorPrint(
"failed to read json, line_protocol %s not "
"recognized\n",
stbLineProtocol->valuestring);
goto PARSE_OVER;
}
} else if (!stbLineProtocol) {
g_Dbs.db[i].superTbls[j].lineProtocol = TSDB_SML_LINE_PROTOCOL;
} else {
errorPrint("%s",
"failed to read json, line_protocol not found\n");
goto PARSE_OVER;
}
cJSON *childTbl_limit =
cJSON_GetObjectItem(stbInfo, "childtable_limit");
if ((childTbl_limit) && (g_Dbs.db[i].drop != true) &&
......
......@@ -17,6 +17,7 @@
int64_t g_totalChildTables = DEFAULT_CHILDTABLES;
int64_t g_actualChildTables = 0;
FILE * g_fpOfInsertResult = NULL;
char * g_dupstr = NULL;
SDbs g_Dbs;
SQueryMetaInfo g_queryInfo;
SArguments g_args = {
......@@ -66,7 +67,7 @@ SArguments g_args = {
};
int main(int argc, char *argv[]) {
if (parse_args(argc, argv, &g_args)) {
if (parse_args(argc, argv)) {
exit(EXIT_FAILURE);
}
debugPrint("meta file: %s\n", g_args.metaFile);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册