Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6818ee3a
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看板
提交
6818ee3a
编写于
5月 05, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auto create table
上级
65e7a864
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
34 deletion
+62
-34
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+0
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+0
-4
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+4
-6
source/dnode/vnode/src/tsdb/tsdbSma.c
source/dnode/vnode/src/tsdb/tsdbSma.c
+15
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+42
-22
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
6818ee3a
...
...
@@ -40,7 +40,6 @@ typedef struct STable STable;
int
tsdbMemTableCreate
(
STsdb
*
pTsdb
,
STsdbMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
);
int
tsdbInsertTableData
(
STsdb
*
pTsdb
,
SSubmitMsgIter
*
pMsgIter
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
);
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
6818ee3a
...
...
@@ -100,6 +100,7 @@ int32_t tsdbUpdateSmaWindow(STsdb* pTsdb, SSubmitReq* pMsg, int64_t version
int32_t
tsdbCreateTSma
(
STsdb
*
pTsdb
,
char
*
pMsg
);
int32_t
tsdbInsertTSmaData
(
STsdb
*
pTsdb
,
int64_t
indexUid
,
const
char
*
msg
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdbInsertTableData
(
STsdb
*
pTsdb
,
SSubmitMsgIter
*
pMsgIter
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
);
tsdbReaderT
*
tsdbQueryTables
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
uint64_t
taskId
);
tsdbReaderT
tsdbQueryCacheLastT
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
...
...
@@ -125,7 +126,6 @@ int32_t tsdbUpdateTbUidList(STsdb* pTsdb, STbUidStore* pUidStore);
void
tsdbUidStoreDestory
(
STbUidStore
*
pStore
);
void
*
tsdbUidStoreFree
(
STbUidStore
*
pStore
);
int32_t
tsdbTriggerRSma
(
STsdb
*
pTsdb
,
void
*
pMsg
,
int32_t
inputType
);
int32_t
tsdbProcessSubmitReq
(
STsdb
*
pTsdb
,
int64_t
version
,
void
*
pReq
);
typedef
struct
{
int8_t
streamType
;
// sma or other
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
6818ee3a
...
...
@@ -69,10 +69,6 @@ static void tsdbDestroyCommitIters(SCommitH *pCommith);
static
int
tsdbCommitToFile
(
SCommitH
*
pCommith
,
SDFileSet
*
pSet
,
int
fid
);
static
void
tsdbResetCommitFile
(
SCommitH
*
pCommith
);
static
int
tsdbSetAndOpenCommitFile
(
SCommitH
*
pCommith
,
SDFileSet
*
pSet
,
int
fid
);
// static int tsdbCommitMeta(STsdbRepo *pRepo);
// static int tsdbUpdateMetaRecord(STsdbFS *pfs, SMFile *pMFile, uint64_t uid, void *cont, int contLen, bool compact);
// static int tsdbDropMetaRecord(STsdbFS *pfs, SMFile *pMFile, uint64_t uid);
// static int tsdbCompactMetaFile(STsdbRepo *pRepo, STsdbFS *pfs, SMFile *pMFile);
static
int
tsdbCommitToTable
(
SCommitH
*
pCommith
,
int
tid
);
static
int
tsdbSetCommitTable
(
SCommitH
*
pCommith
,
STable
*
pTable
);
static
int
tsdbComparKeyBlock
(
const
void
*
arg1
,
const
void
*
arg2
);
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
6818ee3a
...
...
@@ -191,9 +191,6 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
}
int
tsdbInsertTableData
(
STsdb
*
pTsdb
,
SSubmitMsgIter
*
pMsgIter
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
)
{
// STsdbMeta *pMeta = pRepo->tsdbMeta;
// int32_t points = 0;
// STable *pTable = NULL;
SSubmitBlkIter
blkIter
=
{
0
};
STsdbMemTable
*
pMemTable
=
pTsdb
->
mem
;
void
*
tptr
;
...
...
@@ -221,8 +218,9 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo
}
// copy data to buffer pool
pBlkCopy
=
(
SSubmitBlk
*
)
vnodeBufPoolMalloc
(
pTsdb
->
mem
->
pPool
,
pMsgIter
->
dataLen
+
sizeof
(
*
pBlock
));
memcpy
(
pBlkCopy
,
pBlock
,
pMsgIter
->
dataLen
+
sizeof
(
*
pBlock
));
int32_t
tlen
=
pMsgIter
->
dataLen
+
pMsgIter
->
schemaLen
+
sizeof
(
*
pBlock
);
pBlkCopy
=
(
SSubmitBlk
*
)
vnodeBufPoolMalloc
(
pTsdb
->
mem
->
pPool
,
tlen
);
memcpy
(
pBlkCopy
,
pBlock
,
tlen
);
tInitSubmitBlkIter
(
pMsgIter
,
pBlkCopy
,
&
blkIter
);
if
(
blkIter
.
row
==
NULL
)
return
0
;
...
...
@@ -241,7 +239,7 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo
if
(
pMemTable
->
keyMin
>
keyMin
)
pMemTable
->
keyMin
=
keyMin
;
if
(
pMemTable
->
keyMax
<
keyMax
)
pMemTable
->
keyMax
=
keyMax
;
(
*
pAffectedRows
)
+
=
pMsgIter
->
numOfRows
;
(
*
pAffectedRows
)
=
pMsgIter
->
numOfRows
;
return
0
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbSma.c
浏览文件 @
6818ee3a
...
...
@@ -1962,6 +1962,21 @@ int32_t tsdbUpdateTbUidList(STsdb *pTsdb, STbUidStore *pStore) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
tsdbProcessSubmitReq
(
STsdb
*
pTsdb
,
int64_t
version
,
void
*
pReq
)
{
if
(
!
pReq
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
return
TSDB_CODE_FAILED
;
}
SSubmitReq
*
pSubmitReq
=
(
SSubmitReq
*
)
pReq
;
if
(
tsdbInsertData
(
pTsdb
,
version
,
pSubmitReq
,
NULL
)
<
0
)
{
return
TSDB_CODE_FAILED
;
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
tsdbFetchSubmitReqSuids
(
SSubmitReq
*
pMsg
,
STbUidStore
*
pStore
)
{
ASSERT
(
pMsg
!=
NULL
);
SSubmitMsgIter
msgIter
=
{
0
};
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
6818ee3a
...
...
@@ -488,20 +488,55 @@ _exit:
}
static
int
vnodeProcessSubmitReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SSubmitReq
*
pSubmitReq
=
(
SSubmitReq
*
)
pReq
;
SSubmitRsp
rsp
=
{
0
};
SSubmitReq
*
pSubmitReq
=
(
SSubmitReq
*
)
pReq
;
SSubmitMsgIter
msgIter
=
{
0
};
SSubmitBlk
*
pBlock
;
SSubmitRsp
rsp
=
{
0
};
SVCreateTbReq
createTbReq
=
{
0
};
SCoder
coder
=
{
0
};
int32_t
nRows
;
pRsp
->
code
=
0
;
// handle the request
if
(
t
sdbInsertData
(
pVnode
->
pTsdb
,
version
,
pSubmitReq
,
&
rsp
)
<
0
)
{
pRsp
->
code
=
terrno
;
return
-
1
;
if
(
t
InitSubmitMsgIter
(
pSubmitReq
,
&
msgIter
)
<
0
)
{
pRsp
->
code
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
}
// pRsp->msgType = TDMT_VND_SUBMIT_RSP;
// vnodeProcessSubmitReq(pVnode, ptr, pRsp);
for
(;;)
{
tGetSubmitMsgNext
(
&
msgIter
,
&
pBlock
);
if
(
pBlock
==
NULL
)
break
;
// create table for auto create table mode
if
(
msgIter
.
schemaLen
>
0
)
{
tCoderInit
(
&
coder
,
TD_LITTLE_ENDIAN
,
pBlock
->
data
,
msgIter
.
schemaLen
,
TD_DECODER
);
if
(
tDecodeSVCreateTbReq
(
&
coder
,
&
createTbReq
)
<
0
)
{
pRsp
->
code
=
TSDB_CODE_INVALID_MSG
;
tCoderClear
(
&
coder
);
goto
_exit
;
}
if
(
metaCreateTable
(
pVnode
->
pMeta
,
version
,
&
createTbReq
)
<
0
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_ALREADY_EXIST
)
{
pRsp
->
code
=
terrno
;
tCoderClear
(
&
coder
);
goto
_exit
;
}
}
tCoderClear
(
&
coder
);
}
if
(
tsdbInsertTableData
(
pVnode
->
pTsdb
,
&
msgIter
,
pBlock
,
&
nRows
)
<
0
)
{
pRsp
->
code
=
terrno
;
goto
_exit
;
}
rsp
.
numOfRows
+=
nRows
;
}
_exit:
// encode the response (TODO)
pRsp
->
pCont
=
rpcMallocCont
(
sizeof
(
SSubmitRsp
));
memcpy
(
pRsp
->
pCont
,
&
rsp
,
sizeof
(
rsp
));
...
...
@@ -511,18 +546,3 @@ static int vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq, in
return
0
;
}
int32_t
tsdbProcessSubmitReq
(
STsdb
*
pTsdb
,
int64_t
version
,
void
*
pReq
)
{
if
(
!
pReq
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
return
TSDB_CODE_FAILED
;
}
SSubmitReq
*
pSubmitReq
=
(
SSubmitReq
*
)
pReq
;
if
(
tsdbInsertData
(
pTsdb
,
version
,
pSubmitReq
,
NULL
)
<
0
)
{
return
TSDB_CODE_FAILED
;
}
return
TSDB_CODE_SUCCESS
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录