Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
19d64d7c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
19d64d7c
编写于
5月 18, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: check ts in submit req msg
上级
5fdaa434
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
7 deletion
+44
-7
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+38
-7
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+5
-0
未找到文件。
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
19d64d7c
...
...
@@ -104,6 +104,7 @@ int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeep
int
tsdbClose
(
STsdb
**
pTsdb
);
int
tsdbBegin
(
STsdb
*
pTsdb
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdbInsertTableData
(
STsdb
*
pTsdb
,
SSubmitMsgIter
*
pMsgIter
,
SSubmitBlk
*
pBlock
,
SSubmitBlkRsp
*
pRsp
);
tsdbReaderT
*
tsdbQueryTables
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
...
...
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
19d64d7c
...
...
@@ -15,7 +15,7 @@
#include "tsdb.h"
static
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
//
static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
)
{
SSubmitMsgIter
msgIter
=
{
0
};
...
...
@@ -54,7 +54,38 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp *
return
0
;
}
static
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
)
{
#if 0
static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, STable *pTable, STSRow *row, TSKEY minKey, TSKEY maxKey,
TSKEY now) {
TSKEY rowKey = TD_ROW_KEY(row);
if (rowKey < minKey || rowKey > maxKey) {
tsdbError("vgId:%d table %s tid %d uid %" PRIu64 " timestamp is out of range! now %" PRId64 " minKey %" PRId64
" maxKey %" PRId64 " row key %" PRId64,
REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable), TABLE_TID(pTable), TABLE_UID(pTable), now, minKey, maxKey,
rowKey);
terrno = TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE;
return -1;
}
return 0;
}
#endif
static
FORCE_INLINE
int
tsdbCheckRowRange
(
STsdb
*
pTsdb
,
tb_uid_t
uid
,
STSRow
*
row
,
TSKEY
minKey
,
TSKEY
maxKey
,
TSKEY
now
)
{
TSKEY
rowKey
=
TD_ROW_KEY
(
row
);
if
(
rowKey
<
minKey
||
rowKey
>
maxKey
)
{
tsdbError
(
"vgId:%d table uid %"
PRIu64
" timestamp is out of range! now %"
PRId64
" minKey %"
PRId64
" maxKey %"
PRId64
" row key %"
PRId64
,
REPO_ID
(
pTsdb
),
uid
,
now
,
minKey
,
maxKey
,
rowKey
);
terrno
=
TSDB_CODE_TDB_TIMESTAMP_OUT_OF_RANGE
;
return
-
1
;
}
return
0
;
}
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
)
{
ASSERT
(
pMsg
!=
NULL
);
// STsdbMeta * pMeta = pTsdb->tsdbMeta;
SSubmitMsgIter
msgIter
=
{
0
};
...
...
@@ -112,14 +143,14 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
return -1;
}
}
t
sdbInitSubmitBlkIter(
pBlock, &blkIter);
while ((row = t
sdb
GetSubmitBlkNext(&blkIter)) != NULL) {
if (tsdbCheckRowRange(pTsdb,
pTable
, row, minKey, maxKey, now) < 0) {
#endif
t
InitSubmitBlkIter
(
&
msgIter
,
pBlock
,
&
blkIter
);
while
((
row
=
tGetSubmitBlkNext
(
&
blkIter
))
!=
NULL
)
{
if
(
tsdbCheckRowRange
(
pTsdb
,
msgIter
.
uid
,
row
,
minKey
,
maxKey
,
now
)
<
0
)
{
return
-
1
;
}
}
#endif
}
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
return
-
1
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
19d64d7c
...
...
@@ -626,6 +626,11 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
vnodeDebugPrintSubmitMsg
(
pVnode
,
pReq
,
__func__
);
#endif
if
(
tsdbScanAndConvertSubmitMsg
(
pVnode
->
pTsdb
,
pSubmitReq
)
<
0
)
{
pRsp
->
code
=
terrno
;
goto
_exit
;
}
// handle the request
if
(
tInitSubmitMsgIter
(
pSubmitReq
,
&
msgIter
)
<
0
)
{
pRsp
->
code
=
TSDB_CODE_INVALID_MSG
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录