Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5bedf6b1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5bedf6b1
编写于
5月 23, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: support config batch rows number when import data from csv file
上级
09a99142
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
8 deletion
+45
-8
include/common/tglobal.h
include/common/tglobal.h
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+5
-5
source/libs/parser/src/parInsertSql.c
source/libs/parser/src/parInsertSql.c
+3
-1
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+36
-1
未找到文件。
include/common/tglobal.h
浏览文件 @
5bedf6b1
...
...
@@ -122,7 +122,7 @@ extern bool tsUseAdapter;
// client
extern
int32_t
tsMinSlidingTime
;
extern
int32_t
tsMinIntervalTime
;
extern
int32_t
tsMax
MemUsedByInsert
;
extern
int32_t
tsMax
InsertBatchRows
;
// build info
extern
char
version
[];
...
...
source/common/src/tglobal.c
浏览文件 @
5bedf6b1
...
...
@@ -148,8 +148,8 @@ int32_t tsMaxNumOfDistinctResults = 1000 * 10000;
// 1 database precision unit for interval time range, changed accordingly
int32_t
tsMinIntervalTime
=
1
;
// maximum
memory allowed to be allocated for a single csv load (in MB)
int32_t
tsMax
MemUsedByInsert
=
1024
;
// maximum
batch rows numbers imported from a single csv load
int32_t
tsMax
InsertBatchRows
=
1000000
;
float
tsSelectivityRatio
=
1
.
0
;
int32_t
tsTagFilterResCacheSize
=
1024
*
10
;
...
...
@@ -340,7 +340,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if
(
cfgAddString
(
pCfg
,
"smlTagName"
,
tsSmlTagName
,
1
)
!=
0
)
return
-
1
;
// if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
// if (cfgAddInt32(pCfg, "smlBatchSize", tsSmlBatchSize, 1, INT32_MAX, true) != 0) return -1;
if
(
cfgAddInt32
(
pCfg
,
"max
MemUsedByInsert"
,
tsMaxMemUsedByInsert
,
1
,
INT32_MAX
,
true
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"max
InsertBatchRows"
,
tsMaxInsertBatchRows
,
1
,
INT32_MAX
,
true
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxRetryWaitTime"
,
tsMaxRetryWaitTime
,
0
,
86400000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"useAdapter"
,
tsUseAdapter
,
true
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"crashReporting"
,
tsEnableCrashReport
,
true
)
!=
0
)
return
-
1
;
...
...
@@ -725,7 +725,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
// tsSmlDataFormat = cfgGetItem(pCfg, "smlDataFormat")->bval;
// tsSmlBatchSize = cfgGetItem(pCfg, "smlBatchSize")->i32;
tsMax
MemUsedByInsert
=
cfgGetItem
(
pCfg
,
"maxMemUsedByInsert
"
)
->
i32
;
tsMax
InsertBatchRows
=
cfgGetItem
(
pCfg
,
"maxInsertBatchRows
"
)
->
i32
;
tsShellActivityTimer
=
cfgGetItem
(
pCfg
,
"shellActivityTimer"
)
->
i32
;
tsCompressMsgSize
=
cfgGetItem
(
pCfg
,
"compressMsgSize"
)
->
i32
;
...
...
@@ -987,7 +987,7 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
}
else
if
(
strcasecmp
(
"maxNumOfDistinctRes"
,
name
)
==
0
)
{
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
}
else
if
(
strcasecmp
(
"maxMemUsedByInsert"
,
name
)
==
0
)
{
tsMax
MemUsedByInsert
=
cfgGetItem
(
pCfg
,
"maxMemUsedByInsert
"
)
->
i32
;
tsMax
InsertBatchRows
=
cfgGetItem
(
pCfg
,
"maxInsertBatchRows
"
)
->
i32
;
}
else
if
(
strcasecmp
(
"maxRetryWaitTime"
,
name
)
==
0
)
{
tsMaxRetryWaitTime
=
cfgGetItem
(
pCfg
,
"maxRetryWaitTime"
)
->
i32
;
}
...
...
source/libs/parser/src/parInsertSql.c
浏览文件 @
5bedf6b1
...
...
@@ -1552,7 +1552,7 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt
(
*
pNumOfRows
)
++
;
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
*
pNumOfRows
)
>
tsMax
MemUsedByInsert
*
1024
*
1024
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
*
pNumOfRows
)
>
tsMax
InsertBatchRows
)
{
pStmt
->
fileProcessing
=
true
;
break
;
}
...
...
@@ -1561,6 +1561,8 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt
}
taosMemoryFree
(
pLine
);
parserDebug
(
"0x%"
PRIx64
" %d rows have been parsed"
,
pCxt
->
pComCxt
->
requestId
,
*
pNumOfRows
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
0
==
(
*
pNumOfRows
)
&&
(
!
TSDB_QUERY_HAS_TYPE
(
pStmt
->
insertType
,
TSDB_QUERY_TYPE_STMT_INSERT
))
&&
!
pStmt
->
fileProcessing
)
{
code
=
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
"no any data points"
,
NULL
);
...
...
source/libs/parser/src/parInsertUtil.c
浏览文件 @
5bedf6b1
...
...
@@ -272,6 +272,41 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
return
code
;
}
static
int32_t
rebuildTableData
(
SSubmitTbData
*
pSrc
,
SSubmitTbData
**
pDst
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SSubmitTbData
*
pTmp
=
taosMemoryCalloc
(
1
,
sizeof
(
SSubmitTbData
));
if
(
NULL
==
pTmp
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
pTmp
->
flags
=
pSrc
->
flags
;
pTmp
->
suid
=
pSrc
->
suid
;
pTmp
->
uid
=
pSrc
->
uid
;
pTmp
->
sver
=
pSrc
->
sver
;
pTmp
->
pCreateTbReq
=
pSrc
->
pCreateTbReq
;
if
(
pTmp
->
flags
&
SUBMIT_REQ_COLUMN_DATA_FORMAT
)
{
pTmp
->
aCol
=
taosArrayInit
(
128
,
sizeof
(
SColData
));
if
(
NULL
==
pTmp
->
aCol
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
taosMemoryFree
(
pTmp
);
}
}
else
{
pTmp
->
aRowP
=
taosArrayInit
(
128
,
POINTER_BYTES
);
if
(
NULL
==
pTmp
->
aRowP
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
taosMemoryFree
(
pTmp
);
}
}
}
taosMemoryFree
(
pSrc
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pDst
=
pTmp
;
}
return
code
;
}
static
void
resetColValues
(
SArray
*
pValues
)
{
int32_t
num
=
taosArrayGetSize
(
pValues
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
...
...
@@ -381,7 +416,7 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx
}
}
taosArrayPush
(
pVgCxt
->
pData
->
aSubmitTbData
,
pTableCxt
->
pData
);
taosMemoryFreeClear
(
pTableCxt
->
pData
);
rebuildTableData
(
pTableCxt
->
pData
,
&
pTableCxt
->
pData
);
qDebug
(
"add tableDataCxt uid:%"
PRId64
" to vgId:%d"
,
pTableCxt
->
pMeta
->
uid
,
pVgCxt
->
vgId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录