Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bb8384e8
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看板
提交
bb8384e8
编写于
4月 25, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tsdb insert
上级
3204cd68
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
126 addition
and
161 deletion
+126
-161
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-2
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+9
-136
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+107
-17
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+2
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+6
-6
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
bb8384e8
...
@@ -38,7 +38,7 @@ typedef struct STable STable;
...
@@ -38,7 +38,7 @@ typedef struct STable STable;
int
tsdbMemTableCreate
(
STsdb
*
pTsdb
,
STsdbMemTable
**
ppMemTable
);
int
tsdbMemTableCreate
(
STsdb
*
pTsdb
,
STsdbMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
);
void
tsdbMemTableDestroy
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
);
int
tsdb
MemTableInsert
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdb
InsertTableData
(
STsdb
*
pTsdb
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
);
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
...
@@ -62,7 +62,7 @@ struct STable {
...
@@ -62,7 +62,7 @@ struct STable {
int
tsdbOpen
(
SVnode
*
pVnode
,
STsdb
**
ppTsdb
);
int
tsdbOpen
(
SVnode
*
pVnode
,
STsdb
**
ppTsdb
);
int
tsdbClose
(
STsdb
*
pTsdb
);
int
tsdbClose
(
STsdb
*
pTsdb
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdbPrepareCommit
(
STsdb
*
pTsdb
);
int
tsdbPrepareCommit
(
STsdb
*
pTsdb
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbInitSma
(
STsdb
*
pTsdb
);
int32_t
tsdbInitSma
(
STsdb
*
pTsdb
);
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
bb8384e8
...
@@ -15,8 +15,6 @@
...
@@ -15,8 +15,6 @@
#include "vnodeInt.h"
#include "vnodeInt.h"
static
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
static
int
tsdbMemTableInsertTbData
(
STsdb
*
pRepo
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
);
static
STbData
*
tsdbNewTbData
(
tb_uid_t
uid
);
static
STbData
*
tsdbNewTbData
(
tb_uid_t
uid
);
static
void
tsdbFreeTbData
(
STbData
*
pTbData
);
static
void
tsdbFreeTbData
(
STbData
*
pTbData
);
static
char
*
tsdbGetTsTupleKey
(
const
void
*
data
);
static
char
*
tsdbGetTsTupleKey
(
const
void
*
data
);
...
@@ -57,6 +55,7 @@ int tsdbMemTableCreate(STsdb *pTsdb, STsdbMemTable **ppMemTable) {
...
@@ -57,6 +55,7 @@ int tsdbMemTableCreate(STsdb *pTsdb, STsdbMemTable **ppMemTable) {
return
-
1
;
return
-
1
;
}
}
*
ppMemTable
=
pMemTable
;
return
0
;
return
0
;
}
}
...
@@ -68,37 +67,6 @@ void tsdbMemTableDestroy(STsdb *pTsdb, STsdbMemTable *pMemTable) {
...
@@ -68,37 +67,6 @@ void tsdbMemTableDestroy(STsdb *pTsdb, STsdbMemTable *pMemTable) {
}
}
}
}
int
tsdbMemTableInsert
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
)
{
SSubmitBlk
*
pBlock
=
NULL
;
SSubmitMsgIter
msgIter
=
{
0
};
int32_t
affectedrows
=
0
,
numOfRows
=
0
;
if
(
tsdbScanAndConvertSubmitMsg
(
pTsdb
,
pMsg
)
<
0
)
{
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
tsdbError
(
"vgId:%d failed to insert data since %s"
,
REPO_ID
(
pTsdb
),
tstrerror
(
terrno
));
}
return
-
1
;
}
tInitSubmitMsgIter
(
pMsg
,
&
msgIter
);
while
(
true
)
{
tGetSubmitMsgNext
(
&
msgIter
,
&
pBlock
);
if
(
pBlock
==
NULL
)
break
;
if
(
tsdbMemTableInsertTbData
(
pTsdb
,
pBlock
,
&
affectedrows
)
<
0
)
{
return
-
1
;
}
numOfRows
+=
pBlock
->
numOfRows
;
}
if
(
pRsp
!=
NULL
)
{
pRsp
->
affectedRows
=
affectedrows
;
pRsp
->
numOfRows
=
numOfRows
;
}
return
0
;
}
/**
/**
* This is an important function to load data or try to load data from memory skiplist iterator.
* This is an important function to load data or try to load data from memory skiplist iterator.
*
*
...
@@ -250,78 +218,7 @@ int32_t tdScanAndConvertSubmitMsg(SSubmitReq *pMsg) {
...
@@ -250,78 +218,7 @@ int32_t tdScanAndConvertSubmitMsg(SSubmitReq *pMsg) {
return
0
;
return
0
;
}
}
static
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
)
{
int
tsdbInsertTableData
(
STsdb
*
pTsdb
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
)
{
ASSERT
(
pMsg
!=
NULL
);
// STsdbMeta * pMeta = pTsdb->tsdbMeta;
SSubmitMsgIter
msgIter
=
{
0
};
SSubmitBlk
*
pBlock
=
NULL
;
SSubmitBlkIter
blkIter
=
{
0
};
STSRow
*
row
=
NULL
;
TSKEY
now
=
taosGetTimestamp
(
pTsdb
->
config
.
precision
);
TSKEY
minKey
=
now
-
tsTickPerDay
[
pTsdb
->
config
.
precision
]
*
pTsdb
->
config
.
keep2
;
TSKEY
maxKey
=
now
+
tsTickPerDay
[
pTsdb
->
config
.
precision
]
*
pTsdb
->
config
.
days
;
terrno
=
TSDB_CODE_SUCCESS
;
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
if
(
tInitSubmitMsgIter
(
pMsg
,
&
msgIter
)
<
0
)
return
-
1
;
while
(
true
)
{
if
(
tGetSubmitMsgNext
(
&
msgIter
,
&
pBlock
)
<
0
)
return
-
1
;
if
(
pBlock
==
NULL
)
break
;
pBlock
->
uid
=
htobe64
(
pBlock
->
uid
);
pBlock
->
suid
=
htobe64
(
pBlock
->
suid
);
pBlock
->
sversion
=
htonl
(
pBlock
->
sversion
);
pBlock
->
dataLen
=
htonl
(
pBlock
->
dataLen
);
pBlock
->
schemaLen
=
htonl
(
pBlock
->
schemaLen
);
pBlock
->
numOfRows
=
htons
(
pBlock
->
numOfRows
);
#if 0
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
pBlock->tid);
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
return -1;
}
STable *pTable = pMeta->tables[pBlock->tid];
if (pTable == NULL || TABLE_UID(pTable) != pBlock->uid) {
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
pBlock->tid);
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
return -1;
}
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
tsdbError("vgId:%d invalid action trying to insert a super table %s", REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable));
terrno = TSDB_CODE_TDB_INVALID_ACTION;
return -1;
}
// Check schema version and update schema if needed
if (tsdbCheckTableSchema(pTsdb, pBlock, pTable) < 0) {
if (terrno == TSDB_CODE_TDB_TABLE_RECONFIGURE) {
continue;
} else {
return -1;
}
}
tsdbInitSubmitBlkIter(pBlock, &blkIter);
while ((row = tsdbGetSubmitBlkNext(&blkIter)) != NULL) {
if (tsdbCheckRowRange(pTsdb, pTable, row, minKey, maxKey, now) < 0) {
return -1;
}
}
#endif
}
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
return
-
1
;
return
0
;
}
static
int
tsdbMemTableInsertTbData
(
STsdb
*
pTsdb
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
)
{
// STsdbMeta *pMeta = pRepo->tsdbMeta;
// STsdbMeta *pMeta = pRepo->tsdbMeta;
// int32_t points = 0;
// int32_t points = 0;
// STable *pTable = NULL;
// STable *pTable = NULL;
...
@@ -332,11 +229,9 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
...
@@ -332,11 +229,9 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
STSRow
*
row
;
STSRow
*
row
;
TSKEY
keyMin
;
TSKEY
keyMin
;
TSKEY
keyMax
;
TSKEY
keyMax
;
SSubmitBlk
*
pBlkCopy
;
// SMemTable *pMemTable = NULL;
// create container is nedd
// STableData *pTableData = NULL;
// STsdbCfg *pCfg = &(pRepo->config);
tptr
=
taosHashGet
(
pMemTable
->
pHashIdx
,
&
(
pBlock
->
uid
),
sizeof
(
pBlock
->
uid
));
tptr
=
taosHashGet
(
pMemTable
->
pHashIdx
,
&
(
pBlock
->
uid
),
sizeof
(
pBlock
->
uid
));
if
(
tptr
==
NULL
)
{
if
(
tptr
==
NULL
)
{
pTbData
=
tsdbNewTbData
(
pBlock
->
uid
);
pTbData
=
tsdbNewTbData
(
pBlock
->
uid
);
...
@@ -353,7 +248,11 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
...
@@ -353,7 +248,11 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
pTbData
=
*
(
STbData
**
)
tptr
;
pTbData
=
*
(
STbData
**
)
tptr
;
}
}
tInitSubmitBlkIter
(
pBlock
,
&
blkIter
);
// copy data to buffer pool
pBlkCopy
=
(
SSubmitBlk
*
)
vnodeBufPoolMalloc
(
pTsdb
->
mem
->
pPool
,
pBlock
->
dataLen
+
sizeof
(
*
pBlock
));
memcpy
(
pBlkCopy
,
pBlock
,
pBlock
->
dataLen
+
sizeof
(
*
pBlock
));
tInitSubmitBlkIter
(
pBlkCopy
,
&
blkIter
);
if
(
blkIter
.
row
==
NULL
)
return
0
;
if
(
blkIter
.
row
==
NULL
)
return
0
;
keyMin
=
TD_ROW_KEY
(
blkIter
.
row
);
keyMin
=
TD_ROW_KEY
(
blkIter
.
row
);
...
@@ -372,31 +271,6 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
...
@@ -372,31 +271,6 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p
(
*
pAffectedRows
)
+=
pBlock
->
numOfRows
;
(
*
pAffectedRows
)
+=
pBlock
->
numOfRows
;
// STSRow* lastRow = NULL;
// int64_t osize = SL_SIZE(pTableData->pData);
// tsdbSetupSkipListHookFns(pTableData->pData, pRepo, pTable, &points, &lastRow);
// tSkipListPutBatchByIter(pTableData->pData, &blkIter, (iter_next_fn_t)tsdbGetSubmitBlkNext);
// int64_t dsize = SL_SIZE(pTableData->pData) - osize;
// (*pAffectedRows) += points;
// if(lastRow != NULL) {
// TSKEY lastRowKey = TD_ROW_KEY(lastRow);
// if (pMemTable->keyFirst > firstRowKey) pMemTable->keyFirst = firstRowKey;
// pMemTable->numOfRows += dsize;
// if (pTableData->keyFirst > firstRowKey) pTableData->keyFirst = firstRowKey;
// pTableData->numOfRows += dsize;
// if (pMemTable->keyLast < lastRowKey) pMemTable->keyLast = lastRowKey;
// if (pTableData->keyLast < lastRowKey) pTableData->keyLast = lastRowKey;
// if (tsdbUpdateTableLatestInfo(pRepo, pTable, lastRow) < 0) {
// return -1;
// }
// }
// STSchema *pSchema = tsdbGetTableSchemaByVersion(pTable, pBlock->sversion, -1);
// pRepo->stat.pointsWritten += points * schemaNCols(pSchema);
// pRepo->stat.totalStorage += points * schemaVLen(pSchema);
return
0
;
return
0
;
}
}
...
@@ -521,7 +395,6 @@ static int tsdbAdjustMemMaxTables(SMemTable *pMemTable, int maxTables);
...
@@ -521,7 +395,6 @@ static int tsdbAdjustMemMaxTables(SMemTable *pMemTable, int maxTables);
static int tsdbAppendTableRowToCols(STable *pTable, SDataCols *pCols, STSchema **ppSchema, STSRow* row);
static int tsdbAppendTableRowToCols(STable *pTable, SDataCols *pCols, STSchema **ppSchema, STSRow* row);
static int tsdbInitSubmitBlkIter(SSubmitBlk *pBlock, SSubmitBlkIter *pIter);
static int tsdbInitSubmitBlkIter(SSubmitBlk *pBlock, SSubmitBlkIter *pIter);
static STSRow* tsdbGetSubmitBlkNext(SSubmitBlkIter *pIter);
static STSRow* tsdbGetSubmitBlkNext(SSubmitBlkIter *pIter);
static int tsdbScanAndConvertSubmitMsg(STsdbRepo *pRepo, SSubmitReq *pMsg);
static int tsdbInsertDataToTable(STsdbRepo *pRepo, SSubmitBlk *pBlock, int32_t *affectedrows);
static int tsdbInsertDataToTable(STsdbRepo *pRepo, SSubmitBlk *pBlock, int32_t *affectedrows);
static int tsdbInitSubmitMsgIter(SSubmitReq *pMsg, SSubmitMsgIter *pIter);
static int tsdbInitSubmitMsgIter(SSubmitReq *pMsg, SSubmitMsgIter *pIter);
static int tsdbGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock);
static int tsdbGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock);
...
...
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
bb8384e8
...
@@ -15,21 +15,111 @@
...
@@ -15,21 +15,111 @@
#include "vnodeInt.h"
#include "vnodeInt.h"
/**
static
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
* @brief insert TS data
*
int
tsdbInsertData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
)
{
* @param pTsdb
SSubmitMsgIter
msgIter
=
{
0
};
* @param pMsg
SSubmitBlk
*
pBlock
=
NULL
;
* @param pRsp
int32_t
affectedrows
=
0
;
* @return int
int32_t
numOfRows
=
0
;
*/
int
tsdbInsertData
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
,
SSubmitRsp
*
pRsp
)
{
ASSERT
(
pTsdb
->
mem
!=
NULL
);
// Check if mem is there. If not, create one.
// if (pTsdb->mem == NULL) {
// scan and convert
// pTsdb->mem = tsdbMemTableCreate(pTsdb);
if
(
tsdbScanAndConvertSubmitMsg
(
pTsdb
,
pMsg
)
<
0
)
{
// if (pTsdb->mem == NULL) {
if
(
terrno
!=
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
// return -1;
tsdbError
(
"vgId:%d failed to insert data since %s"
,
REPO_ID
(
pTsdb
),
tstrerror
(
terrno
));
// }
}
// }
return
-
1
;
return
tsdbMemTableInsert
(
pTsdb
,
pTsdb
->
mem
,
pMsg
,
pRsp
);
}
// loop to insert
tInitSubmitMsgIter
(
pMsg
,
&
msgIter
);
while
(
true
)
{
tGetSubmitMsgNext
(
&
msgIter
,
&
pBlock
);
if
(
pBlock
==
NULL
)
break
;
if
(
tsdbInsertTableData
(
pTsdb
,
pBlock
,
&
affectedrows
)
<
0
)
{
return
-
1
;
}
numOfRows
+=
pBlock
->
numOfRows
;
}
if
(
pRsp
!=
NULL
)
{
pRsp
->
affectedRows
=
affectedrows
;
pRsp
->
numOfRows
=
numOfRows
;
}
return
0
;
}
static
int
tsdbScanAndConvertSubmitMsg
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
)
{
ASSERT
(
pMsg
!=
NULL
);
// STsdbMeta * pMeta = pTsdb->tsdbMeta;
SSubmitMsgIter
msgIter
=
{
0
};
SSubmitBlk
*
pBlock
=
NULL
;
SSubmitBlkIter
blkIter
=
{
0
};
STSRow
*
row
=
NULL
;
TSKEY
now
=
taosGetTimestamp
(
pTsdb
->
config
.
precision
);
TSKEY
minKey
=
now
-
tsTickPerDay
[
pTsdb
->
config
.
precision
]
*
pTsdb
->
config
.
keep2
;
TSKEY
maxKey
=
now
+
tsTickPerDay
[
pTsdb
->
config
.
precision
]
*
pTsdb
->
config
.
days
;
terrno
=
TSDB_CODE_SUCCESS
;
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
if
(
tInitSubmitMsgIter
(
pMsg
,
&
msgIter
)
<
0
)
return
-
1
;
while
(
true
)
{
if
(
tGetSubmitMsgNext
(
&
msgIter
,
&
pBlock
)
<
0
)
return
-
1
;
if
(
pBlock
==
NULL
)
break
;
pBlock
->
uid
=
htobe64
(
pBlock
->
uid
);
pBlock
->
suid
=
htobe64
(
pBlock
->
suid
);
pBlock
->
sversion
=
htonl
(
pBlock
->
sversion
);
pBlock
->
dataLen
=
htonl
(
pBlock
->
dataLen
);
pBlock
->
schemaLen
=
htonl
(
pBlock
->
schemaLen
);
pBlock
->
numOfRows
=
htons
(
pBlock
->
numOfRows
);
#if 0
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
pBlock->tid);
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
return -1;
}
STable *pTable = pMeta->tables[pBlock->tid];
if (pTable == NULL || TABLE_UID(pTable) != pBlock->uid) {
tsdbError("vgId:%d failed to get table to insert data, uid %" PRIu64 " tid %d", REPO_ID(pTsdb), pBlock->uid,
pBlock->tid);
terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
return -1;
}
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
tsdbError("vgId:%d invalid action trying to insert a super table %s", REPO_ID(pTsdb), TABLE_CHAR_NAME(pTable));
terrno = TSDB_CODE_TDB_INVALID_ACTION;
return -1;
}
// Check schema version and update schema if needed
if (tsdbCheckTableSchema(pTsdb, pBlock, pTable) < 0) {
if (terrno == TSDB_CODE_TDB_TABLE_RECONFIGURE) {
continue;
} else {
return -1;
}
}
tsdbInitSubmitBlkIter(pBlock, &blkIter);
while ((row = tsdbGetSubmitBlkNext(&blkIter)) != NULL) {
if (tsdbCheckRowRange(pTsdb, pTable, row, minKey, maxKey, now) < 0) {
return -1;
}
}
#endif
}
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
return
-
1
;
return
0
;
}
}
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
bb8384e8
...
@@ -62,6 +62,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -62,6 +62,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
metaRsp
.
tuid
=
mer1
.
me
.
uid
;
metaRsp
.
tuid
=
mer1
.
me
.
uid
;
if
(
mer1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
if
(
mer1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
strcpy
(
metaRsp
.
stbName
,
mer1
.
me
.
name
);
schema
=
mer1
.
me
.
stbEntry
.
schema
;
schema
=
mer1
.
me
.
stbEntry
.
schema
;
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
...
@@ -69,6 +70,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -69,6 +70,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
metaReaderInit
(
&
mer2
,
pVnode
,
0
);
metaReaderInit
(
&
mer2
,
pVnode
,
0
);
if
(
metaGetTableEntryByUid
(
&
mer2
,
mer1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
if
(
metaGetTableEntryByUid
(
&
mer2
,
mer1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
strcpy
(
metaRsp
.
stbName
,
mer2
.
me
.
name
);
metaRsp
.
suid
=
mer2
.
me
.
uid
;
metaRsp
.
suid
=
mer2
.
me
.
uid
;
schema
=
mer2
.
me
.
stbEntry
.
schema
;
schema
=
mer2
.
me
.
stbEntry
.
schema
;
schemaTag
=
mer2
.
me
.
stbEntry
.
schemaTag
;
schemaTag
=
mer2
.
me
.
stbEntry
.
schemaTag
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
bb8384e8
...
@@ -21,7 +21,7 @@ static int vnodeProcessDropStbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcM
...
@@ -21,7 +21,7 @@ static int vnodeProcessDropStbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcM
static
int
vnodeProcessCreateTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessCreateTbReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessAlterTbReq
(
SVnode
*
pVnode
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessAlterTbReq
(
SVnode
*
pVnode
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessDropTbReq
(
SVnode
*
pVnode
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessDropTbReq
(
SVnode
*
pVnode
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessSubmitReq
(
SVnode
*
pVnode
,
SSubmitReq
*
pSubmitReq
,
SRpcMsg
*
pRsp
);
static
int
vnodeProcessSubmitReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
int
vnodePreprocessWriteReqs
(
SVnode
*
pVnode
,
SArray
*
pMsgs
,
int64_t
*
version
)
{
int
vnodePreprocessWriteReqs
(
SVnode
*
pVnode
,
SArray
*
pMsgs
,
int64_t
*
version
)
{
SNodeMsg
*
pMsg
;
SNodeMsg
*
pMsg
;
...
@@ -92,8 +92,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
...
@@ -92,8 +92,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
}
break
;
}
break
;
/* TSDB */
/* TSDB */
case
TDMT_VND_SUBMIT
:
case
TDMT_VND_SUBMIT
:
pRsp
->
msgType
=
TDMT_VND_SUBMIT_RSP
;
if
(
vnodeProcessSubmitReq
(
pVnode
,
version
,
pMsg
->
pCont
,
pMsg
->
contLen
,
pRsp
)
<
0
)
goto
_err
;
vnodeProcessSubmitReq
(
pVnode
,
ptr
,
pRsp
);
break
;
break
;
/* TQ */
/* TQ */
case
TDMT_VND_MQ_VG_CHANGE
:
case
TDMT_VND_MQ_VG_CHANGE
:
...
@@ -352,13 +351,14 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcMs
...
@@ -352,13 +351,14 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, void *pReq, int32_t len, SRpcMs
return
0
;
return
0
;
}
}
static
int
vnodeProcessSubmitReq
(
SVnode
*
pVnode
,
SSubmitReq
*
pSubmitReq
,
SRpcMsg
*
pRsp
)
{
static
int
vnodeProcessSubmitReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SSubmitRsp
rsp
=
{
0
};
SSubmitReq
*
pSubmitReq
=
(
SSubmitReq
*
)
pReq
;
SSubmitRsp
rsp
=
{
0
};
pRsp
->
code
=
0
;
pRsp
->
code
=
0
;
// handle the request
// handle the request
if
(
tsdbInsertData
(
pVnode
->
pTsdb
,
pSubmitReq
,
&
rsp
)
<
0
)
{
if
(
tsdbInsertData
(
pVnode
->
pTsdb
,
version
,
pSubmitReq
,
&
rsp
)
<
0
)
{
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
return
-
1
;
return
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录