Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
608f9b86
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
608f9b86
编写于
10月 19, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into xiaoping/add_test_case
上级
bd4dc362
49413180
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
5 deletion
+39
-5
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+1
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+6
-2
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+7
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+25
-2
未找到文件。
src/common/src/tdataformat.c
浏览文件 @
608f9b86
...
@@ -566,7 +566,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
...
@@ -566,7 +566,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
SKVRow
nrow
=
NULL
;
SKVRow
nrow
=
NULL
;
void
*
ptr
=
taosbsearch
(
&
colId
,
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
comparTagId
,
TD_GE
);
void
*
ptr
=
taosbsearch
(
&
colId
,
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
comparTagId
,
TD_GE
);
if
(
ptr
==
NULL
||
((
SColIdx
*
)
ptr
)
->
colId
<
colId
)
{
// need to add a column value to the row
if
(
ptr
==
NULL
||
((
SColIdx
*
)
ptr
)
->
colId
>
colId
)
{
// need to add a column value to the row
int
diff
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
value
)
:
TYPE_BYTES
[
type
];
int
diff
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
value
)
:
TYPE_BYTES
[
type
];
nrow
=
malloc
(
kvRowLen
(
row
)
+
sizeof
(
SColIdx
)
+
diff
);
nrow
=
malloc
(
kvRowLen
(
row
)
+
sizeof
(
SColIdx
)
+
diff
);
if
(
nrow
==
NULL
)
return
-
1
;
if
(
nrow
==
NULL
)
return
-
1
;
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
608f9b86
...
@@ -2224,16 +2224,20 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) {
...
@@ -2224,16 +2224,20 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) {
void
mnodeDropAllChildTables
(
SDbObj
*
pDropDb
)
{
void
mnodeDropAllChildTables
(
SDbObj
*
pDropDb
)
{
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
int32_t
numOfTables
=
0
;
int32_t
numOfTables
=
0
;
int32_t
dbNameLen
=
strlen
(
pDropDb
->
name
);
SChildTableObj
*
pTable
=
NULL
;
SChildTableObj
*
pTable
=
NULL
;
char
prefix
[
64
]
=
{
0
};
tstrncpy
(
prefix
,
pDropDb
->
name
,
64
);
strcat
(
prefix
,
TS_PATH_DELIMITER
);
int32_t
prefixLen
=
strlen
(
prefix
);
mInfo
(
"db:%s, all child tables will be dropped from sdb"
,
pDropDb
->
name
);
mInfo
(
"db:%s, all child tables will be dropped from sdb"
,
pDropDb
->
name
);
while
(
1
)
{
while
(
1
)
{
pIter
=
mnodeGetNextChildTable
(
pIter
,
&
pTable
);
pIter
=
mnodeGetNextChildTable
(
pIter
,
&
pTable
);
if
(
pTable
==
NULL
)
break
;
if
(
pTable
==
NULL
)
break
;
if
(
strncmp
(
p
DropDb
->
name
,
pTable
->
info
.
tableId
,
dbName
Len
)
==
0
)
{
if
(
strncmp
(
p
refix
,
pTable
->
info
.
tableId
,
prefix
Len
)
==
0
)
{
SSdbOper
oper
=
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_LOCAL
,
.
type
=
SDB_OPER_LOCAL
,
.
table
=
tsChildTableSdb
,
.
table
=
tsChildTableSdb
,
...
...
src/query/inc/qExecutor.h
浏览文件 @
608f9b86
...
@@ -185,11 +185,18 @@ enum {
...
@@ -185,11 +185,18 @@ enum {
QUERY_RESULT_READY
=
2
,
QUERY_RESULT_READY
=
2
,
};
};
typedef
struct
SMemRef
{
int32_t
ref
;
void
*
mem
;
void
*
imem
;
}
SMemRef
;
typedef
struct
SQInfo
{
typedef
struct
SQInfo
{
void
*
signature
;
void
*
signature
;
int32_t
code
;
// error code to returned to client
int32_t
code
;
// error code to returned to client
int64_t
owner
;
// if it is in execution
int64_t
owner
;
// if it is in execution
void
*
tsdb
;
void
*
tsdb
;
SMemRef
memRef
;
int32_t
vgId
;
int32_t
vgId
;
STableGroupInfo
tableGroupInfo
;
// table <tid, last_key> list SArray<STableKeyInfo>
STableGroupInfo
tableGroupInfo
;
// table <tid, last_key> list SArray<STableKeyInfo>
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
608f9b86
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "exception.h"
#include "exception.h"
#include "../../query/inc/qAst.h" // todo move to common module
#include "../../query/inc/qAst.h" // todo move to common module
#include "../../query/inc/qExecutor.h" // todo move to common module
#include "tlosertree.h"
#include "tlosertree.h"
#include "tsdb.h"
#include "tsdb.h"
#include "tsdbMain.h"
#include "tsdbMain.h"
...
@@ -143,6 +144,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey,
...
@@ -143,6 +144,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey,
STsdbQueryHandle
*
pQueryHandle
);
STsdbQueryHandle
*
pQueryHandle
);
static
int
tsdbCheckInfoCompar
(
const
void
*
key1
,
const
void
*
key2
);
static
int
tsdbCheckInfoCompar
(
const
void
*
key1
,
const
void
*
key2
);
static
void
tsdbInitDataBlockLoadInfo
(
SDataBlockLoadInfo
*
pBlockLoadInfo
)
{
static
void
tsdbInitDataBlockLoadInfo
(
SDataBlockLoadInfo
*
pBlockLoadInfo
)
{
pBlockLoadInfo
->
slot
=
-
1
;
pBlockLoadInfo
->
slot
=
-
1
;
pBlockLoadInfo
->
tid
=
-
1
;
pBlockLoadInfo
->
tid
=
-
1
;
...
@@ -182,6 +184,27 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS
...
@@ -182,6 +184,27 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS
return
pLocalIdList
;
return
pLocalIdList
;
}
}
static
void
tsdbMayTakeMemSnapshot
(
TsdbQueryHandleT
pHandle
)
{
STsdbQueryHandle
*
pSecQueryHandle
=
(
STsdbQueryHandle
*
)
pHandle
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)(
pSecQueryHandle
->
qinfo
);
if
(
pQInfo
->
memRef
.
ref
++
==
0
)
{
tsdbTakeMemSnapshot
(
pSecQueryHandle
->
pTsdb
,
&
pSecQueryHandle
->
mem
,
&
pSecQueryHandle
->
imem
);
pQInfo
->
memRef
.
mem
=
pSecQueryHandle
->
mem
;
pQInfo
->
memRef
.
imem
=
pSecQueryHandle
->
imem
;
}
else
{
pSecQueryHandle
->
mem
=
(
SMemTable
*
)(
pQInfo
->
memRef
.
mem
);
pSecQueryHandle
->
imem
=
(
SMemTable
*
)(
pQInfo
->
memRef
.
imem
);
}
}
static
void
tsdbMayUnTakeMemSnapshot
(
TsdbQueryHandleT
pHandle
)
{
STsdbQueryHandle
*
pSecQueryHandle
=
(
STsdbQueryHandle
*
)
pHandle
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)(
pSecQueryHandle
->
qinfo
);
if
(
--
pQInfo
->
memRef
.
ref
==
0
)
{
tsdbUnTakeMemSnapShot
(
pSecQueryHandle
->
pTsdb
,
pSecQueryHandle
->
mem
,
pSecQueryHandle
->
imem
);
}
}
static
SArray
*
createCheckInfoFromTableGroup
(
STsdbQueryHandle
*
pQueryHandle
,
STableGroupInfo
*
pGroupList
,
STsdbMeta
*
pMeta
)
{
static
SArray
*
createCheckInfoFromTableGroup
(
STsdbQueryHandle
*
pQueryHandle
,
STableGroupInfo
*
pGroupList
,
STsdbMeta
*
pMeta
)
{
size_t
sizeOfGroup
=
taosArrayGetSize
(
pGroupList
->
pGroupList
);
size_t
sizeOfGroup
=
taosArrayGetSize
(
pGroupList
->
pGroupList
);
assert
(
sizeOfGroup
>=
1
&&
pMeta
!=
NULL
);
assert
(
sizeOfGroup
>=
1
&&
pMeta
!=
NULL
);
...
@@ -270,7 +293,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(TSDB_REPO_T* tsdb, STsdbQueryCond*
...
@@ -270,7 +293,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(TSDB_REPO_T* tsdb, STsdbQueryCond*
goto
out_of_memory
;
goto
out_of_memory
;
}
}
tsdb
TakeMemSnapshot
(
pQueryHandle
->
pTsdb
,
&
pQueryHandle
->
mem
,
&
pQueryHandle
->
imem
);
tsdb
MayTakeMemSnapshot
(
pQueryHandle
);
assert
(
pCond
!=
NULL
&&
pCond
->
numOfCols
>
0
);
assert
(
pCond
!=
NULL
&&
pCond
->
numOfCols
>
0
);
if
(
ASCENDING_TRAVERSE
(
pCond
->
order
))
{
if
(
ASCENDING_TRAVERSE
(
pCond
->
order
))
{
...
@@ -2701,7 +2724,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
...
@@ -2701,7 +2724,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
taosTFree
(
pQueryHandle
->
statis
);
taosTFree
(
pQueryHandle
->
statis
);
// todo check error
// todo check error
tsdb
UnTakeMemSnapShot
(
pQueryHandle
->
pTsdb
,
pQueryHandle
->
mem
,
pQueryHandle
->
imem
);
tsdb
MayUnTakeMemSnapshot
(
pQueryHandle
);
tsdbDestroyHelper
(
&
pQueryHandle
->
rhelper
);
tsdbDestroyHelper
(
&
pQueryHandle
->
rhelper
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录