Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
12ec7d71
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看板
提交
12ec7d71
编写于
10月 19, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add pre check
上级
526f46db
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
193 addition
and
15 deletion
+193
-15
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+4
-0
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+1
-1
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+114
-2
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+1
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+72
-10
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+1
-0
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
12ec7d71
...
...
@@ -118,7 +118,11 @@ typedef struct SMetaFltParam {
}
SMetaFltParam
;
// TODO, refactor later
int32_t
metaFilterTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
results
);
int32_t
metaFilterCreateTime
(
SMeta
*
pMeta
,
SMetaFltParam
*
parm
,
SArray
*
pUids
);
int32_t
metaFilterTableName
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
);
int32_t
metaFilterTtl
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
);
#if 1 // refact APIs below (TODO)
typedef
SVCreateTbReq
STbCfg
;
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
12ec7d71
...
...
@@ -152,7 +152,7 @@ typedef struct {
}
SCtimeIdxKey
;
typedef
struct
{
int
16
_t
ncol
;
int
64
_t
ncol
;
tb_uid_t
uid
;
}
SNcolIdxKey
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
12ec7d71
...
...
@@ -1033,6 +1033,117 @@ typedef struct {
int32_t
vLen
;
}
SIdxCursor
;
int32_t
metaFilterCreateTime
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
ret
=
0
;
SIdxCursor
*
pCursor
=
NULL
;
pCursor
=
(
SIdxCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SIdxCursor
));
pCursor
->
pMeta
=
pMeta
;
pCursor
->
suid
=
param
->
suid
;
pCursor
->
cid
=
param
->
cid
;
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
ret
=
tdbTbcOpen
(
pMeta
->
pCtimeIdx
,
&
pCursor
->
pCur
,
NULL
);
if
(
ret
!=
0
)
{
goto
END
;
}
int64_t
uidLimit
=
param
->
reverse
?
INT64_MAX
:
0
;
SCtimeIdxKey
ctimeKey
=
{.
ctime
=
*
(
int64_t
*
)(
param
->
val
),
.
uid
=
uidLimit
};
SCtimeIdxKey
*
pCtimeKey
=
&
ctimeKey
;
int
cmp
=
0
;
if
(
tdbTbcMoveTo
(
pCursor
->
pCur
,
&
ctimeKey
,
sizeof
(
ctimeKey
),
&
cmp
)
<
0
)
{
goto
END
;
}
bool
first
=
true
;
int32_t
valid
=
0
;
while
(
1
)
{
void
*
entryKey
=
NULL
;
int32_t
nEntryKey
=
-
1
;
valid
=
tdbTbcGet
(
pCursor
->
pCur
,
(
const
void
**
)
&
entryKey
,
&
nEntryKey
,
NULL
,
NULL
);
if
(
valid
<
0
)
break
;
SCtimeIdxKey
*
p
=
entryKey
;
if
(
first
)
{
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
break
;
continue
;
}
else
{
break
;
}
int32_t
cmp
=
(
*
param
->
filterFunc
)((
void
*
)
&
p
->
ctime
,
(
void
*
)
&
pCtimeKey
->
ctime
,
param
->
type
);
if
(
cmp
==
0
)
taosArrayPush
(
pUids
,
&
p
->
uid
);
if
(
cmp
==
-
1
)
break
;
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
break
;
}
END:
if
(
pCursor
->
pMeta
)
metaULock
(
pCursor
->
pMeta
);
if
(
pCursor
->
pCur
)
tdbTbcClose
(
pCursor
->
pCur
);
taosMemoryFree
(
pCursor
);
return
ret
;
}
int32_t
metaFilterTableName
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
ret
=
0
;
char
*
buf
=
NULL
;
STagIdxKey
*
pKey
=
NULL
;
int32_t
nKey
=
0
;
SIdxCursor
*
pCursor
=
NULL
;
pCursor
=
(
SIdxCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SIdxCursor
));
pCursor
->
pMeta
=
pMeta
;
pCursor
->
suid
=
param
->
suid
;
pCursor
->
cid
=
param
->
cid
;
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
ret
=
tdbTbcOpen
(
pMeta
->
pNameIdx
,
&
pCursor
->
pCur
,
NULL
);
END:
if
(
pCursor
->
pMeta
)
metaULock
(
pCursor
->
pMeta
);
if
(
pCursor
->
pCur
)
tdbTbcClose
(
pCursor
->
pCur
);
taosMemoryFree
(
buf
);
taosMemoryFree
(
pKey
);
taosMemoryFree
(
pCursor
);
return
ret
;
}
int32_t
metaFilterTtl
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
ret
=
0
;
char
*
buf
=
NULL
;
STtlIdxKey
*
pKey
=
NULL
;
int32_t
nKey
=
0
;
SIdxCursor
*
pCursor
=
NULL
;
pCursor
=
(
SIdxCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SIdxCursor
));
pCursor
->
pMeta
=
pMeta
;
pCursor
->
suid
=
param
->
suid
;
pCursor
->
cid
=
param
->
cid
;
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
ret
=
tdbTbcOpen
(
pMeta
->
pTtlIdx
,
&
pCursor
->
pCur
,
NULL
);
END:
if
(
pCursor
->
pMeta
)
metaULock
(
pCursor
->
pMeta
);
if
(
pCursor
->
pCur
)
tdbTbcClose
(
pCursor
->
pCur
);
taosMemoryFree
(
buf
);
taosMemoryFree
(
pKey
);
taosMemoryFree
(
pCursor
);
return
ret
;
// impl later
return
0
;
}
int32_t
metaFilterTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
ret
=
0
;
char
*
buf
=
NULL
;
...
...
@@ -1048,7 +1159,7 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
ret
=
tdbTbcOpen
(
pMeta
->
p
Tag
Idx
,
&
pCursor
->
pCur
,
NULL
);
ret
=
tdbTbcOpen
(
pMeta
->
p
Ctime
Idx
,
&
pCursor
->
pCur
,
NULL
);
if
(
ret
<
0
)
{
goto
END
;
}
...
...
@@ -1059,7 +1170,8 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
if
(
param
->
val
==
NULL
)
{
metaError
(
"vgId:%d, failed to filter NULL data"
,
TD_VID
(
pMeta
->
pVnode
));
return
-
1
;
ret
=
-
1
;
goto
END
;
}
else
{
if
(
IS_VAR_DATA_TYPE
(
param
->
type
))
{
tagData
=
varDataVal
(
param
->
val
);
...
...
source/libs/executor/src/executil.c
浏览文件 @
12ec7d71
...
...
@@ -1201,11 +1201,10 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
#if 1
// todo refactor: add the parameter for tbname function
const
char
*
name
=
"tbname"
;
int32_t
len
=
strlen
(
name
);
int32_t
len
=
strlen
(
name
);
if
(
!
pFuncNode
->
pParameterList
&&
(
memcmp
(
pExprNode
->
_function
.
functionName
,
name
,
len
)
==
0
)
&&
pExprNode
->
_function
.
functionName
[
len
]
==
0
)
{
pFuncNode
->
pParameterList
=
nodesMakeList
();
ASSERT
(
LIST_LENGTH
(
pFuncNode
->
pParameterList
)
==
0
);
SValueNode
*
res
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
12ec7d71
...
...
@@ -2906,7 +2906,8 @@ static int32_t sysFilte__DbName(void* pMeta, SNode* pNode, SArray* result) {
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
operType
);
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
int
ret
=
func
(
dbname
,
pVal
->
datum
.
p
,
TSDB_DATA_TYPE_VARCHAR
);
...
...
@@ -2923,7 +2924,9 @@ static int32_t sysFilte__VgroupId(void* pMeta, SNode* pNode, SArray* result) {
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
operType
);
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
int
ret
=
func
(
&
vgId
,
&
pVal
->
datum
.
i
,
TSDB_DATA_TYPE_BIGINT
);
...
...
@@ -2932,33 +2935,92 @@ static int32_t sysFilte__VgroupId(void* pMeta, SNode* pNode, SArray* result) {
return
-
1
;
}
static
int32_t
sysFilte__TableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
return
0
;
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
SMetaFltParam
param
=
{.
suid
=
0
,
.
cid
=
0
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
val
=
pVal
->
datum
.
p
,
.
reverse
=
reverse
,
.
filterFunc
=
func
};
int32_t
ret
=
metaFilterTableName
(
pVnode
,
&
param
,
result
);
if
(
ret
==
0
)
return
0
;
return
-
1
;
}
static
int32_t
sysFilte__CreateTime
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
return
0
;
}
static
int32_t
sysFilte__Ncolumn
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
return
0
;
}
static
int32_t
sysFilte__Ttl
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
return
0
;
}
static
int32_t
sysFilte__STableName
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
return
0
;
}
static
int32_t
sysFilte__Uid
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
return
0
;
}
static
int32_t
sysFilte__Type
(
void
*
pMeta
,
SNode
*
pNode
,
SArray
*
result
)
{
// impl later
void
*
pVnode
=
pMeta
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
pNode
;
SValueNode
*
pVal
=
(
SValueNode
*
)
pOper
->
pRight
;
bool
reverse
=
false
;
__optSysFilter
func
=
optSysGetFilterFunc
(
pOper
->
opType
,
&
reverse
);
if
(
func
==
NULL
)
return
-
1
;
return
0
;
}
static
int32_t
sysChkFilter__DBName
(
SNode
*
pNode
)
{
...
...
source/libs/transport/src/trans.c
浏览文件 @
12ec7d71
...
...
@@ -73,6 +73,7 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
idleTime
=
pInit
->
idleTime
;
pRpc
->
tcphandle
=
(
*
taosInitHandle
[
pRpc
->
connType
])(
ip
,
pInit
->
localPort
,
pRpc
->
label
,
pRpc
->
numOfThreads
,
NULL
,
pRpc
);
if
(
pRpc
->
tcphandle
==
NULL
)
{
taosMemoryFree
(
pRpc
);
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录