Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dda4ddce
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看板
提交
dda4ddce
编写于
9月 15, 2022
作者:
Z
zhihaop
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add config for async batch insertion
上级
ae61d676
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
14 deletion
+51
-14
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+9
-0
src/client/inc/tscBulkWrite.h
src/client/inc/tscBulkWrite.h
+1
-6
src/client/src/tscBulkWrite.c
src/client/src/tscBulkWrite.c
+4
-1
src/common/src/tglobal.c
src/common/src/tglobal.c
+36
-6
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
未找到文件。
packaging/cfg/taos.cfg
浏览文件 @
dda4ddce
...
...
@@ -310,3 +310,12 @@ keepColumnName 1
# unit Hour. Latency of data migration
# keepTimeOffset 0
# taosc async batching insertion
# asyncBatchEnable 1
# taosc async insertion batchsize
# asyncBatchSize 256
# taosc async batching timeout in milliseconds
# asyncBatchTimeout 5
\ No newline at end of file
src/client/inc/tscBulkWrite.h
浏览文件 @
dda4ddce
...
...
@@ -78,7 +78,7 @@ SArray* dispatcherPollAll(SAsyncBulkWriteDispatcher* dispatcher);
*
* @param dispatcher the async bulk write dispatcher.
* @param pSql the sql object to offer.
* @return
int32_t
if offer success, return the current size of the buffer. otherwise returns -1.
* @return
if offer success, return the current size of the buffer. otherwise returns -1.
*/
int32_t
dispatcherTryOffer
(
SAsyncBulkWriteDispatcher
*
dispatcher
,
SSqlObj
*
pSql
);
...
...
@@ -89,11 +89,6 @@ int32_t dispatcherTryOffer(SAsyncBulkWriteDispatcher* dispatcher, SSqlObj* pSql)
*/
void
dispatcherExecute
(
SArray
*
statements
);
/**
* The thread to manage batching timeout.
*/
void
*
dispatcherTimeoutCallback
(
void
*
arg
);
/**
* Create the async bulk write dispatcher.
*
...
...
src/client/src/tscBulkWrite.c
浏览文件 @
dda4ddce
...
...
@@ -232,7 +232,10 @@ void dispatcherExecute(SArray* statements) {
taosArrayDestroy
(
&
statements
);
}
void
*
dispatcherTimeoutCallback
(
void
*
arg
)
{
/**
* The thread to manage batching timeout.
*/
static
void
*
dispatcherTimeoutCallback
(
void
*
arg
)
{
SAsyncBulkWriteDispatcher
*
dispatcher
=
arg
;
setThreadName
(
"tscBackground"
);
...
...
src/common/src/tglobal.c
浏览文件 @
dda4ddce
...
...
@@ -121,15 +121,14 @@ float tsStreamComputDelayRatio = 0.1f;
int32_t
tsProjectExecInterval
=
10000
;
// every 10sec, the projection will be executed once
int64_t
tsMaxRetentWindow
=
24
*
3600L
;
// maximum time window tolerance
// The async insertion auto batch feature.
// When user submit an insert statement to `taos_query_ra`, the statement will be buffered asynchronously in the
// execution queue instead of executing it. If the number of the buffered statements reach `tsAsyncBatchLen`, all
// the statements in the queue will be merged and sent to vnodes.
// The async insertion batching feature.
// When user submit an insert statement to `taos_query_ra`, the statement will be buffered asynchronously instead of executing it.
// If the number of the buffered statements reach `tsAsyncBatchSize`, all the statements in the queue will be merged and sent to vnodes.
// The statements will be sent to vnodes no more than `tsAsyncBatchTimeout` milliseconds. But the actual time vnodes
// received the statements depends on the network quality.
bool
tsAsyncBatchEnable
=
true
;
int32_t
tsAsyncBatchSize
=
128
;
int64_t
tsAsyncBatchTimeout
=
5
0
;
int32_t
tsAsyncBatchSize
=
256
;
int64_t
tsAsyncBatchTimeout
=
5
;
// the maximum allowed query buffer size during query processing for each data node.
// -1 no limit (default)
...
...
@@ -1833,6 +1832,37 @@ static void doInitGlobalConfig(void) {
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"asyncBatchEnable"
;
cfg
.
ptr
=
&
tsAsyncBatchEnable
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT8
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
1
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"asyncBatchSize"
;
cfg
.
ptr
=
&
tsAsyncBatchSize
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
1
;
cfg
.
maxValue
=
65536
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"asyncBatchTimeout"
;
cfg
.
ptr
=
&
tsAsyncBatchTimeout
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
65536
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
assert
(
tsGlobalConfigNum
==
TSDB_CFG_MAX_NUM
);
#else
// if TD_TSZ macro define, have 5 count configs, so must add 5
...
...
src/util/inc/tconfig.h
浏览文件 @
dda4ddce
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#define TSDB_CFG_MAX_NUM 13
4
#define TSDB_CFG_MAX_NUM 13
7
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录