Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
21ea4e3a
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看板
提交
21ea4e3a
编写于
6月 20, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
0767b57e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
95 deletion
+87
-95
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+4
-5
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+0
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+0
-45
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+48
-1
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+34
-41
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
21ea4e3a
...
...
@@ -70,6 +70,10 @@ int32_t vnodeSnapshotReaderOpen(SVnode *pVnode, SVSnapshotReader **ppReader, int
int32_t
vnodeSnapshotReaderClose
(
SVSnapshotReader
*
pReader
);
int32_t
vnodeSnapshotRead
(
SVSnapshotReader
*
pReader
,
const
void
**
ppData
,
uint32_t
*
nData
);
int32_t
vnodeProcessCreateTSma
(
SVnode
*
pVnode
,
void
*
pCont
,
uint32_t
contLen
);
int32_t
vnodeGetAllTableList
(
SVnode
*
pVnode
,
uint64_t
uid
,
SArray
*
list
);
int32_t
vnodeGetCtbIdList
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
);
void
*
vnodeGetIdx
(
SVnode
*
pVnode
);
void
*
vnodeGetIvtIdx
(
SVnode
*
pVnode
);
void
vnodeProposeMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
void
vnodeApplyMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
...
...
@@ -127,11 +131,6 @@ void tsdbResetReadHandle(STsdbReader *pReader, SQueryTableDataCond *pCond, in
int32_t
tsdbGetFileBlocksDistInfo
(
STsdbReader
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
int64_t
tsdbGetNumOfRowsInMemTable
(
STsdbReader
*
pHandle
);
int32_t
tsdbGetAllTableList
(
SMeta
*
pMeta
,
uint64_t
uid
,
SArray
*
list
);
int32_t
tsdbGetCtbIdList
(
SMeta
*
pMeta
,
int64_t
suid
,
SArray
*
list
);
void
*
tsdbGetIdx
(
SMeta
*
pMeta
);
void
*
tsdbGetIvtIdx
(
SMeta
*
pMeta
);
// tq
typedef
struct
STqReadHandle
STqReadHandle
;
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
21ea4e3a
...
...
@@ -345,7 +345,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
}
else
if
(
pHandle
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
pHandle
->
execHandle
.
execTb
.
suid
=
req
.
suid
;
SArray
*
tbUidList
=
taosArrayInit
(
0
,
sizeof
(
int64_t
));
tsdbGetCtbIdList
(
pTq
->
pVnode
->
pMeta
,
req
.
suid
,
tbUidList
);
vnodeGetCtbIdList
(
pTq
->
pVnode
,
req
.
suid
,
tbUidList
);
tqDebug
(
"vg %d, tq try get suid: %ld"
,
pTq
->
pVnode
->
config
.
vgId
,
req
.
suid
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
tbUidList
);
i
++
)
{
int64_t
tbUid
=
*
(
int64_t
*
)
taosArrayGet
(
tbUidList
,
i
);
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
21ea4e3a
...
...
@@ -25,8 +25,6 @@
#define SL_MOVE_BACKWARD 0x1
#define SL_MOVE_FROM_POS 0x2
static
int32_t
tPutTSDBRow
(
uint8_t
*
p
,
TSDBROW
*
pRow
);
static
int32_t
tGetTSDBRow
(
uint8_t
*
p
,
TSDBROW
*
pRow
);
static
void
tbDataMovePosTo
(
STbData
*
pTbData
,
SMemSkipListNode
**
pos
,
TSDBKEY
*
pKey
,
int32_t
flags
);
static
int32_t
tsdbGetOrCreateTbData
(
SMemTable
*
pMemTable
,
tb_uid_t
suid
,
tb_uid_t
uid
,
STbData
**
ppTbData
);
static
int32_t
tsdbInsertTableDataImpl
(
SMemTable
*
pMemTable
,
STbData
*
pTbData
,
int64_t
version
,
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
21ea4e3a
...
...
@@ -2375,51 +2375,6 @@ _err:
// return numOfRows;
// }
// void* tsdbGetIdx(SMeta* pMeta) {
// if (pMeta == NULL) {
// return NULL;
// }
// return metaGetIdx(pMeta);
// }
// void* tsdbGetIvtIdx(SMeta* pMeta) {
// if (pMeta == NULL) {
// return NULL;
// }
// return metaGetIvtIdx(pMeta);
// }
// int32_t tsdbGetAllTableList(SMeta* pMeta, uint64_t uid, SArray* list) {
// SMCtbCursor* pCur = metaOpenCtbCursor(pMeta, uid);
// while (1) {
// tb_uid_t id = metaCtbCursorNext(pCur);
// if (id == 0) {
// break;
// }
// STableKeyInfo info = {.lastKey = TSKEY_INITIAL_VAL, uid = id};
// taosArrayPush(list, &info);
// }
// metaCloseCtbCursor(pCur);
// return TSDB_CODE_SUCCESS;
// }
// int32_t tsdbGetCtbIdList(SMeta* pMeta, int64_t suid, SArray* list) {
// SMCtbCursor* pCur = metaOpenCtbCursor(pMeta, suid);
// while (1) {
// tb_uid_t id = metaCtbCursorNext(pCur);
// if (id == 0) {
// break;
// }
// taosArrayPush(list, &id);
// }
// metaCloseCtbCursor(pCur);
// return TSDB_CODE_SUCCESS;
// }
// static void destroyHelper(void* param) {
// if (param == NULL) {
// return;
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
21ea4e3a
...
...
@@ -148,4 +148,51 @@ void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId) {
if
(
vgId
)
{
*
vgId
=
TD_VID
(
pVnode
);
}
}
\ No newline at end of file
}
int32_t
vnodeGetAllTableList
(
SVnode
*
pVnode
,
uint64_t
uid
,
SArray
*
list
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pVnode
->
pMeta
,
uid
);
while
(
1
)
{
tb_uid_t
id
=
metaCtbCursorNext
(
pCur
);
if
(
id
==
0
)
{
break
;
}
STableKeyInfo
info
=
{.
lastKey
=
TSKEY_INITIAL_VAL
,
uid
=
id
};
taosArrayPush
(
list
,
&
info
);
}
metaCloseCtbCursor
(
pCur
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
vnodeGetCtbIdList
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pVnode
->
pMeta
,
suid
);
while
(
1
)
{
tb_uid_t
id
=
metaCtbCursorNext
(
pCur
);
if
(
id
==
0
)
{
break
;
}
taosArrayPush
(
list
,
&
id
);
}
metaCloseCtbCursor
(
pCur
);
return
TSDB_CODE_SUCCESS
;
}
void
*
vnodeGetIdx
(
SVnode
*
pVnode
)
{
if
(
pVnode
==
NULL
)
{
return
NULL
;
}
return
metaGetIdx
(
pVnode
->
pMeta
);
}
void
*
vnodeGetIvtIdx
(
SVnode
*
pVnode
)
{
if
(
pVnode
==
NULL
)
{
return
NULL
;
}
return
metaGetIvtIdx
(
pVnode
->
pMeta
);
}
source/libs/executor/src/executil.c
浏览文件 @
21ea4e3a
...
...
@@ -13,10 +13,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "index.h"
#include "function.h"
#include "functionMgt.h"
#include "index.h"
#include "os.h"
#include "tdatablock.h"
#include "thash.h"
#include "tmsg.h"
...
...
@@ -25,45 +25,41 @@
#include "executorimpl.h"
#include "tcompression.h"
void
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
)
{
pResultRowInfo
->
size
=
0
;
void
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
)
{
pResultRowInfo
->
size
=
0
;
pResultRowInfo
->
cur
.
pageId
=
-
1
;
}
void
cleanupResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
)
{
void
cleanupResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
)
{
if
(
pResultRowInfo
==
NULL
)
{
return
;
}
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
// if (pResultRowInfo->pResult[i]) {
// taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
// }
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
// if (pResultRowInfo->pResult[i]) {
// taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
// }
}
}
void
closeAllResultRows
(
SResultRowInfo
*
pResultRowInfo
)
{
// do nothing
void
closeAllResultRows
(
SResultRowInfo
*
pResultRowInfo
)
{
// do nothing
}
bool
isResultRowClosed
(
SResultRow
*
pRow
)
{
return
(
pRow
->
closed
==
true
);
}
bool
isResultRowClosed
(
SResultRow
*
pRow
)
{
return
(
pRow
->
closed
==
true
);
}
void
closeResultRow
(
SResultRow
*
pResultRow
)
{
pResultRow
->
closed
=
true
;
}
void
closeResultRow
(
SResultRow
*
pResultRow
)
{
pResultRow
->
closed
=
true
;
}
// TODO refactor: use macro
SResultRowEntryInfo
*
getResultEntryInfo
(
const
SResultRow
*
pRow
,
int32_t
index
,
const
int32_t
*
offset
)
{
assert
(
index
>=
0
&&
offset
!=
NULL
);
return
(
SResultRowEntryInfo
*
)((
char
*
)
pRow
->
pEntryInfo
+
offset
[
index
]);
return
(
SResultRowEntryInfo
*
)((
char
*
)
pRow
->
pEntryInfo
+
offset
[
index
]);
}
size_t
getResultRowSize
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
int32_t
rowSize
=
(
numOfOutput
*
sizeof
(
SResultRowEntryInfo
))
+
sizeof
(
SResultRow
);
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
rowSize
+=
pCtx
[
i
].
resDataInfo
.
interBufSize
;
}
...
...
@@ -74,31 +70,29 @@ void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) {
assert
(
pGroupResInfo
!=
NULL
);
taosArrayDestroy
(
pGroupResInfo
->
pRows
);
pGroupResInfo
->
pRows
=
NULL
;
pGroupResInfo
->
index
=
0
;
pGroupResInfo
->
pRows
=
NULL
;
pGroupResInfo
->
index
=
0
;
}
static
int32_t
resultrowComparAsc
(
const
void
*
p1
,
const
void
*
p2
)
{
SResKeyPos
*
pp1
=
*
(
SResKeyPos
**
)
p1
;
SResKeyPos
*
pp2
=
*
(
SResKeyPos
**
)
p2
;
SResKeyPos
*
pp1
=
*
(
SResKeyPos
**
)
p1
;
SResKeyPos
*
pp2
=
*
(
SResKeyPos
**
)
p2
;
if
(
pp1
->
groupId
==
pp2
->
groupId
)
{
int64_t
pts1
=
*
(
int64_t
*
)
pp1
->
key
;
int64_t
pts2
=
*
(
int64_t
*
)
pp2
->
key
;
int64_t
pts1
=
*
(
int64_t
*
)
pp1
->
key
;
int64_t
pts2
=
*
(
int64_t
*
)
pp2
->
key
;
if
(
pts1
==
pts2
)
{
return
0
;
}
else
{
return
pts1
<
pts2
?
-
1
:
1
;
return
pts1
<
pts2
?
-
1
:
1
;
}
}
else
{
return
pp1
->
groupId
<
pp2
->
groupId
?
-
1
:
1
;
return
pp1
->
groupId
<
pp2
->
groupId
?
-
1
:
1
;
}
}
static
int32_t
resultrowComparDesc
(
const
void
*
p1
,
const
void
*
p2
)
{
return
resultrowComparAsc
(
p2
,
p1
);
}
static
int32_t
resultrowComparDesc
(
const
void
*
p1
,
const
void
*
p2
)
{
return
resultrowComparAsc
(
p2
,
p1
);
}
void
initGroupedResultInfo
(
SGroupResInfo
*
pGroupResInfo
,
SHashObj
*
pHashmap
,
int32_t
order
)
{
if
(
pGroupResInfo
->
pRows
!=
NULL
)
{
...
...
@@ -110,20 +104,20 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int
pGroupResInfo
->
pRows
=
taosArrayInit
(
10
,
POINTER_BYTES
);
size_t
keyLen
=
0
;
while
((
pData
=
taosHashIterate
(
pHashmap
,
pData
))
!=
NULL
)
{
while
((
pData
=
taosHashIterate
(
pHashmap
,
pData
))
!=
NULL
)
{
void
*
key
=
taosHashGetKey
(
pData
,
&
keyLen
);
SResKeyPos
*
p
=
taosMemoryMalloc
(
keyLen
+
sizeof
(
SResultRowPosition
));
p
->
groupId
=
*
(
uint64_t
*
)
key
;
p
->
pos
=
*
(
SResultRowPosition
*
)
pData
;
p
->
groupId
=
*
(
uint64_t
*
)
key
;
p
->
pos
=
*
(
SResultRowPosition
*
)
pData
;
memcpy
(
p
->
key
,
(
char
*
)
key
+
sizeof
(
uint64_t
),
keyLen
-
sizeof
(
uint64_t
));
taosArrayPush
(
pGroupResInfo
->
pRows
,
&
p
);
}
if
(
order
==
TSDB_ORDER_ASC
||
order
==
TSDB_ORDER_DESC
)
{
__compar_fn_t
fn
=
(
order
==
TSDB_ORDER_ASC
)
?
resultrowComparAsc
:
resultrowComparDesc
;
__compar_fn_t
fn
=
(
order
==
TSDB_ORDER_ASC
)
?
resultrowComparAsc
:
resultrowComparDesc
;
qsort
(
pGroupResInfo
->
pRows
->
pData
,
taosArrayGetSize
(
pGroupResInfo
->
pRows
),
POINTER_BYTES
,
fn
);
}
...
...
@@ -155,7 +149,7 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo) {
return
0
;
}
return
(
int32_t
)
taosArrayGetSize
(
pGroupResInfo
->
pRows
);
return
(
int32_t
)
taosArrayGetSize
(
pGroupResInfo
->
pRows
);
}
SArray
*
createSortInfo
(
SNodeList
*
pNodeList
)
{
...
...
@@ -223,7 +217,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
pTagCond
)
{
SIndexMetaArg
metaArg
=
{
.
metaEx
=
metaHandle
,
.
idx
=
tsdbGetIdx
(
metaHandle
),
.
ivtIdx
=
tsdb
GetIvtIdx
(
metaHandle
),
.
suid
=
tableUid
};
.
metaEx
=
metaHandle
,
.
idx
=
vnodeGetIdx
(
metaHandle
),
.
ivtIdx
=
vnode
GetIvtIdx
(
metaHandle
),
.
suid
=
tableUid
};
SArray
*
res
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
code
=
doFilterTag
(
pTagCond
,
&
metaArg
,
res
);
...
...
@@ -244,7 +238,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
}
taosArrayDestroy
(
res
);
}
else
{
code
=
tsdb
GetAllTableList
(
metaHandle
,
tableUid
,
pListInfo
->
pTableList
);
code
=
vnode
GetAllTableList
(
metaHandle
,
tableUid
,
pListInfo
->
pTableList
);
}
}
else
{
// Create one table group.
STableKeyInfo
info
=
{.
lastKey
=
0
,
.
uid
=
tableUid
};
...
...
@@ -255,7 +249,7 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
}
SArray
*
extractPartitionColInfo
(
SNodeList
*
pNodeList
)
{
if
(
!
pNodeList
)
{
if
(
!
pNodeList
)
{
return
NULL
;
}
...
...
@@ -284,7 +278,6 @@ SArray* extractPartitionColInfo(SNodeList* pNodeList) {
return
pList
;
}
SArray
*
extractColMatchInfo
(
SNodeList
*
pNodeList
,
SDataBlockDescNode
*
pOutputNodeList
,
int32_t
*
numOfOutputCols
,
int32_t
type
)
{
size_t
numOfCols
=
LIST_LENGTH
(
pNodeList
);
...
...
@@ -569,8 +562,8 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
}
for
(
int32_t
i
=
1
;
i
<
numOfOutput
;
++
i
)
{
(
*
rowEntryInfoOffset
)[
i
]
=
(
int32_t
)((
*
rowEntryInfoOffset
)[
i
-
1
]
+
sizeof
(
SResultRowEntryInfo
)
+
pFuncCtx
[
i
-
1
].
resDataInfo
.
interBufSize
);
(
*
rowEntryInfoOffset
)[
i
]
=
(
int32_t
)((
*
rowEntryInfoOffset
)[
i
-
1
]
+
sizeof
(
SResultRowEntryInfo
)
+
pFuncCtx
[
i
-
1
].
resDataInfo
.
interBufSize
);
}
setSelectValueColumnInfo
(
pFuncCtx
,
numOfOutput
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录