Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
8ff091de
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8ff091de
编写于
5月 14, 2020
作者:
T
Tao Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-324] add affected rows in the insert cmd result
上级
36973a50
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
12 deletion
+13
-12
src/inc/tsdb.h
src/inc/tsdb.h
+1
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+7
-5
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+5
-6
未找到文件。
src/inc/tsdb.h
浏览文件 @
8ff091de
...
...
@@ -140,7 +140,7 @@ STableInfo *tsdbGetTableInfo(TsdbRepoT *pRepo, STableId tid);
*
* @return the number of points inserted, -1 for failure and the error number is set
*/
int32_t
tsdbInsertData
(
TsdbRepoT
*
pRepo
,
SSubmitMsg
*
pMsg
)
;
int32_t
tsdbInsertData
(
TsdbRepoT
*
repo
,
SSubmitMsg
*
pMsg
,
SShellSubmitRspMsg
*
pRsp
)
;
// -- FOR QUERY TIME SERIES DATA
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
8ff091de
...
...
@@ -29,7 +29,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg);
static
int32_t
tsdbSetRepoEnv
(
STsdbRepo
*
pRepo
);
static
int32_t
tsdbDestroyRepoEnv
(
STsdbRepo
*
pRepo
);
// static int tsdbOpenMetaFile(char *tsdbDir);
static
int32_t
tsdbInsertDataToTable
(
TsdbRepoT
*
repo
,
SSubmitBlk
*
pBlock
,
TSKEY
now
);
static
int32_t
tsdbInsertDataToTable
(
TsdbRepoT
*
repo
,
SSubmitBlk
*
pBlock
,
TSKEY
now
,
int
*
affectedrows
);
static
int32_t
tsdbRestoreCfg
(
STsdbRepo
*
pRepo
,
STsdbCfg
*
pCfg
);
static
int32_t
tsdbGetDataDirName
(
STsdbRepo
*
pRepo
,
char
*
fname
);
static
void
*
tsdbCommitData
(
void
*
arg
);
...
...
@@ -406,22 +406,23 @@ STableInfo *tsdbGetTableInfo(TsdbRepoT *pRepo, STableId tableId) {
}
// TODO: need to return the number of data inserted
int32_t
tsdbInsertData
(
TsdbRepoT
*
repo
,
SSubmitMsg
*
pMsg
)
{
int32_t
tsdbInsertData
(
TsdbRepoT
*
repo
,
SSubmitMsg
*
pMsg
,
SShellSubmitRspMsg
*
pRsp
)
{
SSubmitMsgIter
msgIter
;
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
tsdbInitSubmitMsgIter
(
pMsg
,
&
msgIter
);
SSubmitBlk
*
pBlock
=
NULL
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
affectedrows
=
0
;
TSKEY
now
=
taosGetTimestamp
(
pRepo
->
config
.
precision
);
while
((
pBlock
=
tsdbGetSubmitMsgNext
(
&
msgIter
))
!=
NULL
)
{
if
((
code
=
tsdbInsertDataToTable
(
repo
,
pBlock
,
now
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tsdbInsertDataToTable
(
repo
,
pBlock
,
now
,
&
affectedrows
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
pRsp
->
affectedRows
=
htonl
(
affectedrows
);
return
code
;
}
...
...
@@ -846,7 +847,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
return
0
;
}
static
int32_t
tsdbInsertDataToTable
(
TsdbRepoT
*
repo
,
SSubmitBlk
*
pBlock
,
TSKEY
now
)
{
static
int32_t
tsdbInsertDataToTable
(
TsdbRepoT
*
repo
,
SSubmitBlk
*
pBlock
,
TSKEY
now
,
int32_t
*
affectedrows
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STableId
tableId
=
{.
uid
=
pBlock
->
uid
,
.
tid
=
pBlock
->
tid
};
...
...
@@ -875,6 +876,7 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
if
(
tdInsertRowToTable
(
pRepo
,
row
,
pTable
)
<
0
)
{
return
-
1
;
}
(
*
affectedrows
)
++
;
}
return
TSDB_CODE_SUCCESS
;
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
8ff091de
...
...
@@ -91,17 +91,16 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
// save insert result into item
vTrace
(
"vgId:%d, submit msg is processed"
,
pVnode
->
vgId
);
code
=
tsdbInsertData
(
pVnode
->
tsdb
,
pCont
);
pRet
->
len
=
sizeof
(
SShellSubmitRspMsg
);
pRet
->
rsp
=
rpcMallocCont
(
pRet
->
len
);
SShellSubmitRspMsg
*
pRsp
=
pRet
->
rsp
;
code
=
tsdbInsertData
(
pVnode
->
tsdb
,
pCont
,
pRsp
);
pRsp
->
numOfFailedBlocks
=
0
;
//TODO
//pRet->len += pRsp->numOfFailedBlocks * sizeof(SShellSubmitRspBlock); //TODO
pRsp
->
code
=
0
;
pRsp
->
numOfRows
=
htonl
(
1
);
pRsp
->
affectedRows
=
htonl
(
1
);
pRsp
->
numOfFailedBlocks
=
0
;
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录