Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
97f7cca4
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
97f7cca4
编写于
11月 04, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225] refactor
上级
adf204ec
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
145 addition
and
145 deletion
+145
-145
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+6
-6
src/query/inc/qTsbuf.h
src/query/inc/qTsbuf.h
+18
-18
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+3
-3
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+117
-117
未找到文件。
src/client/src/tscServer.c
浏览文件 @
97f7cca4
...
...
@@ -882,7 +882,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
pQueryInfo
->
tsBuf
!=
NULL
)
{
// note: here used the index instead of actual vnode id.
int32_t
vnodeIndex
=
pTableMetaInfo
->
vgroupIndex
;
int32_t
code
=
dumpFileBlockBy
Vnode
Id
(
pQueryInfo
->
tsBuf
,
vnodeIndex
,
pMsg
,
&
pQueryMsg
->
tsLen
,
&
pQueryMsg
->
tsNumOfBlocks
);
int32_t
code
=
dumpFileBlockBy
Group
Id
(
pQueryInfo
->
tsBuf
,
vnodeIndex
,
pMsg
,
&
pQueryMsg
->
tsLen
,
&
pQueryMsg
->
tsNumOfBlocks
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
97f7cca4
...
...
@@ -156,8 +156,8 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
win
->
ekey
=
elem1
.
ts
;
}
tsBufAppend
(
output1
,
elem1
.
vnode
,
elem1
.
tag
,
(
const
char
*
)
&
elem1
.
ts
,
sizeof
(
elem1
.
ts
));
tsBufAppend
(
output2
,
elem2
.
vnode
,
elem2
.
tag
,
(
const
char
*
)
&
elem2
.
ts
,
sizeof
(
elem2
.
ts
));
tsBufAppend
(
output1
,
elem1
.
id
,
elem1
.
tag
,
(
const
char
*
)
&
elem1
.
ts
,
sizeof
(
elem1
.
ts
));
tsBufAppend
(
output2
,
elem2
.
id
,
elem2
.
tag
,
(
const
char
*
)
&
elem2
.
ts
,
sizeof
(
elem2
.
ts
));
}
else
{
pLimit
->
offset
-=
1
;
//offset apply to projection?
}
...
...
@@ -193,8 +193,8 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
TSKEY
et
=
taosGetTimestampUs
();
tscDebug
(
"%p input1:%"
PRId64
", input2:%"
PRId64
", final:%"
PRId64
" in %d vnodes for secondary query after ts blocks "
"intersecting, skey:%"
PRId64
", ekey:%"
PRId64
", numOfVnode:%d, elapsed time:%"
PRId64
" us"
,
pSql
,
numOfInput1
,
numOfInput2
,
output1
->
numOfTotal
,
output1
->
numOf
Vnode
s
,
win
->
skey
,
win
->
ekey
,
tsBufGetNumOf
Vnodes
(
output1
),
et
-
st
);
pSql
,
numOfInput1
,
numOfInput2
,
output1
->
numOfTotal
,
output1
->
numOf
Group
s
,
win
->
skey
,
win
->
ekey
,
tsBufGetNumOf
Group
(
output1
),
et
-
st
);
return
output1
->
numOfTotal
;
}
...
...
@@ -282,7 +282,7 @@ static UNUSED_FUNC bool needSecondaryQuery(SQueryInfo* pQueryInfo) {
static
void
filterVgroupTables
(
SQueryInfo
*
pQueryInfo
,
SArray
*
pVgroupTables
)
{
int32_t
num
=
0
;
int32_t
*
list
=
NULL
;
tsBufGet
Vnode
IdList
(
pQueryInfo
->
tsBuf
,
&
num
,
&
list
);
tsBufGet
Group
IdList
(
pQueryInfo
->
tsBuf
,
&
num
,
&
list
);
// The virtual node, of which all tables are disqualified after the timestamp intersection,
// is removed to avoid next stage query.
...
...
@@ -314,7 +314,7 @@ static void filterVgroupTables(SQueryInfo* pQueryInfo, SArray* pVgroupTables) {
static
SArray
*
buildVgroupTableByResult
(
SQueryInfo
*
pQueryInfo
,
SArray
*
pVgroupTables
)
{
int32_t
num
=
0
;
int32_t
*
list
=
NULL
;
tsBufGet
Vnode
IdList
(
pQueryInfo
->
tsBuf
,
&
num
,
&
list
);
tsBufGet
Group
IdList
(
pQueryInfo
->
tsBuf
,
&
num
,
&
list
);
int32_t
numOfGroups
=
taosArrayGetSize
(
pVgroupTables
);
...
...
src/query/inc/qTsbuf.h
浏览文件 @
97f7cca4
...
...
@@ -26,7 +26,7 @@ extern "C" {
#define MEM_BUF_SIZE (1 << 20)
#define TS_COMP_FILE_MAGIC 0x87F5EC4C
#define TS_COMP_FILE_
VNODE
_MAX 512
#define TS_COMP_FILE_
GROUP
_MAX 512
typedef
struct
STSList
{
char
*
rawBuf
;
...
...
@@ -38,7 +38,7 @@ typedef struct STSList {
typedef
struct
STSElem
{
TSKEY
ts
;
tVariant
*
tag
;
int32_t
vnode
;
int32_t
id
;
}
STSElem
;
typedef
struct
STSCursor
{
...
...
@@ -60,17 +60,17 @@ typedef struct STSBlock {
* The size of buffer file should not be greater than 2G,
* and the offset of int32_t type is enough
*/
typedef
struct
STS
Vnode
BlockInfo
{
int32_t
vnode
;
// vnode
id
typedef
struct
STS
Group
BlockInfo
{
int32_t
id
;
// group
id
int32_t
offset
;
// offset set value in file
int32_t
numOfBlocks
;
// number of total blocks
int32_t
compLen
;
// compressed size
}
STS
Vnode
BlockInfo
;
}
STS
Group
BlockInfo
;
typedef
struct
STS
Vnode
BlockInfoEx
{
STS
Vnode
BlockInfo
info
;
typedef
struct
STS
Group
BlockInfoEx
{
STS
Group
BlockInfo
info
;
int32_t
len
;
// length before compress
}
STS
Vnode
BlockInfoEx
;
}
STS
Group
BlockInfoEx
;
typedef
struct
STSBuf
{
FILE
*
f
;
...
...
@@ -78,9 +78,9 @@ typedef struct STSBuf {
uint32_t
fileSize
;
// todo use array
STS
Vnode
BlockInfoEx
*
pData
;
STS
Group
BlockInfoEx
*
pData
;
uint32_t
numOfAlloc
;
uint32_t
numOf
Vnode
s
;
uint32_t
numOf
Group
s
;
char
*
assistBuf
;
int32_t
bufSize
;
...
...
@@ -94,22 +94,22 @@ typedef struct STSBuf {
typedef
struct
STSBufFileHeader
{
uint32_t
magic
;
// file magic number
uint32_t
numOf
Vnode
;
// number of vnode
stored in current file
uint32_t
numOf
Group
;
// number of group
stored in current file
int32_t
tsOrder
;
// timestamp order in current file
}
STSBufFileHeader
;
STSBuf
*
tsBufCreate
(
bool
autoDelete
,
int32_t
order
);
STSBuf
*
tsBufCreateFromFile
(
const
char
*
path
,
bool
autoDelete
);
STSBuf
*
tsBufCreateFromCompBlocks
(
const
char
*
pData
,
int32_t
numOfBlocks
,
int32_t
len
,
int32_t
tsOrder
,
int32_t
vnodeI
d
);
STSBuf
*
tsBufCreateFromCompBlocks
(
const
char
*
pData
,
int32_t
numOfBlocks
,
int32_t
len
,
int32_t
tsOrder
,
int32_t
i
d
);
void
*
tsBufDestroy
(
STSBuf
*
pTSBuf
);
void
tsBufAppend
(
STSBuf
*
pTSBuf
,
int32_t
vnodeI
d
,
tVariant
*
tag
,
const
char
*
pData
,
int32_t
len
);
void
tsBufAppend
(
STSBuf
*
pTSBuf
,
int32_t
i
d
,
tVariant
*
tag
,
const
char
*
pData
,
int32_t
len
);
int32_t
tsBufMerge
(
STSBuf
*
pDestBuf
,
const
STSBuf
*
pSrcBuf
);
STSBuf
*
tsBufClone
(
STSBuf
*
pTSBuf
);
STS
VnodeBlockInfo
*
tsBufGetVnodeBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
vnodeI
d
);
STS
GroupBlockInfo
*
tsBufGetGroupBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
i
d
);
void
tsBufFlush
(
STSBuf
*
pTSBuf
);
...
...
@@ -118,7 +118,7 @@ STSElem tsBufGetElem(STSBuf* pTSBuf);
bool
tsBufNextPos
(
STSBuf
*
pTSBuf
);
STSElem
tsBufGetElemStartPos
(
STSBuf
*
pTSBuf
,
int32_t
vnodeI
d
,
tVariant
*
tag
);
STSElem
tsBufGetElemStartPos
(
STSBuf
*
pTSBuf
,
int32_t
i
d
,
tVariant
*
tag
);
STSCursor
tsBufGetCursor
(
STSBuf
*
pTSBuf
);
void
tsBufSetTraverseOrder
(
STSBuf
*
pTSBuf
,
int32_t
order
);
...
...
@@ -131,11 +131,11 @@ void tsBufSetCursor(STSBuf* pTSBuf, STSCursor* pCur);
*/
void
tsBufDisplay
(
STSBuf
*
pTSBuf
);
int32_t
tsBufGetNumOf
Vnodes
(
STSBuf
*
pTSBuf
);
int32_t
tsBufGetNumOf
Group
(
STSBuf
*
pTSBuf
);
void
tsBufGet
VnodeIdList
(
STSBuf
*
pTSBuf
,
int32_t
*
num
,
int32_t
**
vnodeI
d
);
void
tsBufGet
GroupIdList
(
STSBuf
*
pTSBuf
,
int32_t
*
num
,
int32_t
**
i
d
);
int32_t
dumpFileBlockBy
VnodeId
(
STSBuf
*
pTSBuf
,
int32_t
vnodeI
d
,
void
*
buf
,
int32_t
*
len
,
int32_t
*
numOfBlocks
);
int32_t
dumpFileBlockBy
GroupId
(
STSBuf
*
pTSBuf
,
int32_t
i
d
,
void
*
buf
,
int32_t
*
len
,
int32_t
*
numOfBlocks
);
STSElem
tsBufFindElemStartPosByTag
(
STSBuf
*
pTSBuf
,
tVariant
*
pTag
);
...
...
src/query/src/qExecutor.c
浏览文件 @
97f7cca4
...
...
@@ -3843,7 +3843,7 @@ int32_t setAdditionalInfo(SQInfo *pQInfo, void* pTable, STableQueryInfo *pTableQ
STSElem
elem
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
&
pTableQueryInfo
->
tag
);
// failed to find data with the specified tag value and vnodeId
if
(
elem
.
vnode
<
0
)
{
if
(
tsBufIsValidElem
(
&
elem
)
)
{
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pTag
->
pz
);
}
else
{
...
...
@@ -4777,7 +4777,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) {
if
(
pRuntimeEnv
->
cur
.
vgroupIndex
==
-
1
)
{
STSElem
elem
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
pTag
);
// failed to find data with the specified tag value and vnodeId
if
(
elem
.
vnode
<
0
)
{
if
(
tsBufIsValidElem
(
&
elem
)
)
{
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pTag
->
pz
);
}
else
{
...
...
@@ -4802,7 +4802,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) {
STSElem
elem1
=
tsBufGetElemStartPos
(
pRuntimeEnv
->
pTSBuf
,
pQInfo
->
vgId
,
pTag
);
// failed to find data with the specified tag value and vnodeId
if
(
elem1
.
vnode
<
0
)
{
if
(
tsBufIsValidElem
(
&
elem1
)
)
{
if
(
pTag
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
qError
(
"QInfo:%p failed to find tag:%s in ts_comp"
,
pQInfo
,
pTag
->
pz
);
}
else
{
...
...
src/query/src/qTsbuf.c
浏览文件 @
97f7cca4
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录