From c284d848da2f7be953a4e911fc38546fcf5948f7 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 31 May 2021 15:36:48 +0800 Subject: [PATCH] [td-4446]: fix repeat import caused crash. --- src/client/src/tscUtil.c | 6 +++++- tests/script/general/parser/import_file.sim | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index c5bf04d142..cc8e7fded1 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -3320,7 +3320,11 @@ void doExecuteQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) { tscHandleMasterSTableQuery(pSql); tscUnlockByThread(&pSql->squeryLock); } else if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_INSERT)) { - tscHandleMultivnodeInsert(pSql); + if (TSDB_QUERY_HAS_TYPE(pSql->cmd.insertParam.insertType, TSDB_QUERY_TYPE_FILE_INSERT)) { + tscImportDataFromFile(pSql); + } else { + tscHandleMultivnodeInsert(pSql); + } } else if (pSql->cmd.command > TSDB_SQL_LOCAL) { tscProcessLocalCmd(pSql); } else { // send request to server directly diff --git a/tests/script/general/parser/import_file.sim b/tests/script/general/parser/import_file.sim index a39d79af17..e9f0f1ed08 100644 --- a/tests/script/general/parser/import_file.sim +++ b/tests/script/general/parser/import_file.sim @@ -18,6 +18,7 @@ system general/parser/gendata.sh sql create table tbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2)) print ====== create tables success, starting import data +sql import into tbx file '~/data.sql' sql import into tbx file '~/data.sql' sql select count(*) from tbx -- GitLab