Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57331cd7
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看板
提交
57331cd7
编写于
3月 24, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'main' of
https://github.com/taosdata/TDengine
into fix/TD023101
上级
5d06474f
31152651
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
88 addition
and
85 deletion
+88
-85
examples/JDBC/taosdemo/pom.xml
examples/JDBC/taosdemo/pom.xml
+1
-1
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-0
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+30
-70
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+26
-1
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+27
-11
tests/system-test/0-others/check_assert.py
tests/system-test/0-others/check_assert.py
+2
-2
未找到文件。
examples/JDBC/taosdemo/pom.xml
浏览文件 @
57331cd7
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<description>
Demo project for TDengine
</description>
<description>
Demo project for TDengine
</description>
<properties>
<properties>
<spring.version>
5.3.2
0
</spring.version>
<spring.version>
5.3.2
6
</spring.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
57331cd7
...
@@ -687,6 +687,8 @@ typedef struct SSttBlockLoadInfo {
...
@@ -687,6 +687,8 @@ typedef struct SSttBlockLoadInfo {
STSchema
*
pSchema
;
STSchema
*
pSchema
;
int16_t
*
colIds
;
int16_t
*
colIds
;
int32_t
numOfCols
;
int32_t
numOfCols
;
bool
checkRemainingRow
;
bool
isLast
;
bool
sttBlockLoaded
;
bool
sttBlockLoaded
;
int32_t
numOfStt
;
int32_t
numOfStt
;
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
57331cd7
...
@@ -590,6 +590,7 @@ typedef struct {
...
@@ -590,6 +590,7 @@ typedef struct {
SDataFReader
**
pDataFReader
;
SDataFReader
**
pDataFReader
;
TSDBROW
row
;
TSDBROW
row
;
bool
checkRemainingRow
;
SMergeTree
mergeTree
;
SMergeTree
mergeTree
;
SMergeTree
*
pMergeTree
;
SMergeTree
*
pMergeTree
;
SSttBlockLoadInfo
*
pLoadInfo
;
SSttBlockLoadInfo
*
pLoadInfo
;
...
@@ -600,7 +601,6 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
...
@@ -600,7 +601,6 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
int
nCols
)
{
int
nCols
)
{
SFSLastNextRowIter
*
state
=
(
SFSLastNextRowIter
*
)
iter
;
SFSLastNextRowIter
*
state
=
(
SFSLastNextRowIter
*
)
iter
;
int32_t
code
=
0
;
int32_t
code
=
0
;
bool
checkRemainingRow
=
true
;
switch
(
state
->
state
)
{
switch
(
state
->
state
)
{
case
SFSLASTNEXTROW_FS
:
case
SFSLASTNEXTROW_FS
:
...
@@ -633,12 +633,25 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
...
@@ -633,12 +633,25 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
if
(
code
)
goto
_err
;
if
(
code
)
goto
_err
;
}
}
state
->
pLoadInfo
->
colIds
=
aCols
;
for
(
int
i
=
0
;
i
<
state
->
pLoadInfo
->
numOfStt
;
++
i
)
{
state
->
pLoadInfo
->
numOfCols
=
nCols
;
state
->
pLoadInfo
[
i
].
colIds
=
aCols
;
state
->
pLoadInfo
[
i
].
numOfCols
=
nCols
;
state
->
pLoadInfo
[
i
].
isLast
=
isLast
;
}
tMergeTreeOpen
(
&
state
->
mergeTree
,
1
,
*
state
->
pDataFReader
,
state
->
suid
,
state
->
uid
,
tMergeTreeOpen
(
&
state
->
mergeTree
,
1
,
*
state
->
pDataFReader
,
state
->
suid
,
state
->
uid
,
&
(
STimeWindow
){.
skey
=
state
->
lastTs
,
.
ekey
=
TSKEY_MAX
},
&
(
STimeWindow
){.
skey
=
state
->
lastTs
,
.
ekey
=
TSKEY_MAX
},
&
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
},
state
->
pLoadInfo
,
false
,
NULL
,
true
);
&
(
SVersionRange
){.
minVer
=
0
,
.
maxVer
=
UINT64_MAX
},
state
->
pLoadInfo
,
false
,
NULL
,
true
);
state
->
pMergeTree
=
&
state
->
mergeTree
;
state
->
pMergeTree
=
&
state
->
mergeTree
;
state
->
state
=
SFSLASTNEXTROW_BLOCKROW
;
}
case
SFSLASTNEXTROW_BLOCKROW
:
{
if
(
nCols
!=
state
->
pLoadInfo
->
numOfCols
)
{
for
(
int
i
=
0
;
i
<
state
->
pLoadInfo
->
numOfStt
;
++
i
)
{
state
->
pLoadInfo
[
i
].
numOfCols
=
nCols
;
state
->
pLoadInfo
[
i
].
checkRemainingRow
=
state
->
checkRemainingRow
;
}
}
bool
hasVal
=
tMergeTreeNext
(
&
state
->
mergeTree
);
bool
hasVal
=
tMergeTreeNext
(
&
state
->
mergeTree
);
if
(
!
hasVal
)
{
if
(
!
hasVal
)
{
if
(
tMergeTreeIgnoreEarlierTs
(
&
state
->
mergeTree
))
{
if
(
tMergeTreeIgnoreEarlierTs
(
&
state
->
mergeTree
))
{
...
@@ -649,76 +662,23 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
...
@@ -649,76 +662,23 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa
state
->
state
=
SFSLASTNEXTROW_FILESET
;
state
->
state
=
SFSLASTNEXTROW_FILESET
;
goto
_next_fileset
;
goto
_next_fileset
;
}
}
state
->
state
=
SFSLASTNEXTROW_BLOCKROW
;
state
->
row
=
tMergeTreeGetRow
(
&
state
->
mergeTree
);
checkRemainingRow
=
false
;
*
ppRow
=
&
state
->
row
;
}
case
SFSLASTNEXTROW_BLOCKROW
:
{
bool
skipRow
=
false
;
do
{
bool
hasVal
=
false
;
state
->
row
=
tMergeTreeGetRow
(
&
state
->
mergeTree
);
*
ppRow
=
&
state
->
row
;
if
(
nCols
!=
state
->
pLoadInfo
->
numOfCols
)
{
state
->
pLoadInfo
->
numOfCols
=
nCols
;
}
hasVal
=
tMergeTreeNext
(
&
state
->
mergeTree
);
if
(
TSDBROW_TS
(
&
state
->
row
)
<=
state
->
lastTs
)
{
*
pIgnoreEarlierTs
=
true
;
*
ppRow
=
NULL
;
return
code
;
}
*
pIgnoreEarlierTs
=
false
;
if
(
!
hasVal
)
{
state
->
state
=
SFSLASTNEXTROW_FILESET
;
break
;
}
if
(
checkRemainingRow
)
{
bool
skipBlock
=
true
;
SBlockData
*
pBlockData
=
state
->
row
.
pBlockData
;
for
(
int
inputColIndex
=
0
;
inputColIndex
<
nCols
;
++
inputColIndex
)
{
if
(
TSDBROW_TS
(
&
state
->
row
)
<=
state
->
lastTs
)
{
for
(
int
colIndex
=
0
;
colIndex
<
pBlockData
->
nColData
;
++
colIndex
)
{
*
pIgnoreEarlierTs
=
true
;
SColData
*
pColData
=
&
pBlockData
->
aColData
[
colIndex
];
*
ppRow
=
NULL
;
int16_t
cid
=
pColData
->
cid
;
return
code
;
}
if
(
cid
==
aCols
[
inputColIndex
])
{
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
skipBlock
=
false
;
break
;
}
}
}
}
/*
for (int colIndex = 0; colIndex < pBlockData->nColData; ++colIndex) {
SColData *pColData = &pBlockData->aColData[colIndex];
int16_t cid = pColData->cid;
if (inputColIndex < nCols && cid == aCols[inputColIndex]) {
if (isLast && (pColData->flag & HAS_VALUE)) {
skipBlock = false;
break;
} else if (pColData->flag & (HAS_VALUE | HAS_NULL)) {
skipBlock = false;
break;
}
++inputColIndex;
*
pIgnoreEarlierTs
=
false
;
}
if
(
!
hasVal
)
{
}
state
->
state
=
SFSLASTNEXTROW_FILESET
;
*/
}
if
(
skipBlock
)
{
skipRow
=
true
;
}
}
}
while
(
skipRow
);
if
(
!
state
->
checkRemainingRow
)
{
state
->
checkRemainingRow
=
true
;
}
return
code
;
return
code
;
}
}
default:
default:
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
57331cd7
...
@@ -504,9 +504,34 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) {
...
@@ -504,9 +504,34 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) {
pIter
->
iRow
+=
step
;
pIter
->
iRow
+=
step
;
while
(
1
)
{
while
(
1
)
{
bool
skipBlock
=
false
;
findNextValidRow
(
pIter
,
idStr
);
findNextValidRow
(
pIter
,
idStr
);
if
(
pIter
->
iRow
>=
pBlockData
->
nRow
||
pIter
->
iRow
<
0
)
{
if
(
pIter
->
pBlockLoadInfo
->
checkRemainingRow
)
{
skipBlock
=
true
;
int16_t
*
aCols
=
pIter
->
pBlockLoadInfo
->
colIds
;
int
nCols
=
pIter
->
pBlockLoadInfo
->
numOfCols
;
bool
isLast
=
pIter
->
pBlockLoadInfo
->
isLast
;
for
(
int
inputColIndex
=
0
;
inputColIndex
<
nCols
;
++
inputColIndex
)
{
for
(
int
colIndex
=
0
;
colIndex
<
pBlockData
->
nColData
;
++
colIndex
)
{
SColData
*
pColData
=
&
pBlockData
->
aColData
[
colIndex
];
int16_t
cid
=
pColData
->
cid
;
if
(
cid
==
aCols
[
inputColIndex
])
{
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
skipBlock
=
false
;
break
;
}
}
}
}
}
if
(
skipBlock
||
pIter
->
iRow
>=
pBlockData
->
nRow
||
pIter
->
iRow
<
0
)
{
tLDataIterNextBlock
(
pIter
,
idStr
);
tLDataIterNextBlock
(
pIter
,
idStr
);
if
(
pIter
->
pSttBlk
==
NULL
)
{
// no more data
if
(
pIter
->
pSttBlk
==
NULL
)
{
// no more data
goto
_exit
;
goto
_exit
;
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
57331cd7
...
@@ -947,6 +947,12 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) {
...
@@ -947,6 +947,12 @@ static int tdbPagerRestore(SPager *pPager, const char *jFileName) {
return
0
;
return
0
;
}
}
static
int32_t
txnIdCompareDesc
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
lhs
=
*
(
int64_t
*
)
pLeft
;
int64_t
rhs
=
*
(
int64_t
*
)
pRight
;
return
lhs
>
rhs
?
-
1
:
1
;
}
int
tdbPagerRestoreJournals
(
SPager
*
pPager
)
{
int
tdbPagerRestoreJournals
(
SPager
*
pPager
)
{
tdbDirEntryPtr
pDirEntry
;
tdbDirEntryPtr
pDirEntry
;
tdbDirPtr
pDir
=
taosOpenDir
(
pPager
->
pEnv
->
dbName
);
tdbDirPtr
pDir
=
taosOpenDir
(
pPager
->
pEnv
->
dbName
);
...
@@ -955,23 +961,33 @@ int tdbPagerRestoreJournals(SPager *pPager) {
...
@@ -955,23 +961,33 @@ int tdbPagerRestoreJournals(SPager *pPager) {
return
-
1
;
return
-
1
;
}
}
SArray
*
pTxnList
=
taosArrayInit
(
16
,
sizeof
(
int64_t
));
while
((
pDirEntry
=
tdbReadDir
(
pDir
))
!=
NULL
)
{
while
((
pDirEntry
=
tdbReadDir
(
pDir
))
!=
NULL
)
{
char
*
name
=
tdbDirEntryBaseName
(
tdbGetDirEntryName
(
pDirEntry
));
char
*
name
=
tdbDirEntryBaseName
(
tdbGetDirEntryName
(
pDirEntry
));
if
(
strncmp
(
TDB_MAINDB_NAME
"-journal"
,
name
,
16
)
==
0
)
{
if
(
strncmp
(
TDB_MAINDB_NAME
"-journal"
,
name
,
16
)
==
0
)
{
char
jname
[
TD_PATH_MAX
]
=
{
0
};
int64_t
txnId
=
-
1
;
int
dirLen
=
strlen
(
pPager
->
pEnv
->
dbName
);
sscanf
(
name
,
TDB_MAINDB_NAME
"-journal.%"
PRId64
,
&
txnId
);
memcpy
(
jname
,
pPager
->
pEnv
->
dbName
,
dirLen
);
taosArrayPush
(
pTxnList
,
&
txnId
);
jname
[
dirLen
]
=
'/'
;
}
memcpy
(
jname
+
dirLen
+
1
,
name
,
strlen
(
name
));
}
if
(
tdbPagerRestore
(
pPager
,
jname
)
<
0
)
{
taosArraySort
(
pTxnList
,
txnIdCompareDesc
);
tdbCloseDir
(
&
pDir
);
for
(
int
i
=
0
;
i
<
TARRAY_SIZE
(
pTxnList
);
++
i
)
{
int64_t
*
pTxnId
=
taosArrayGet
(
pTxnList
,
i
);
tdbError
(
"failed to restore file due to %s. jFileName:%s"
,
strerror
(
errno
),
name
);
char
jname
[
TD_PATH_MAX
]
=
{
0
};
return
-
1
;
int
dirLen
=
strlen
(
pPager
->
pEnv
->
dbName
);
}
memcpy
(
jname
,
pPager
->
pEnv
->
dbName
,
dirLen
);
jname
[
dirLen
]
=
'/'
;
sprintf
(
jname
+
dirLen
+
1
,
TDB_MAINDB_NAME
"-journal.%"
PRId64
,
*
pTxnId
);
if
(
tdbPagerRestore
(
pPager
,
jname
)
<
0
)
{
tdbCloseDir
(
&
pDir
);
tdbError
(
"failed to restore file due to %s. jFileName:%s"
,
strerror
(
errno
),
jname
);
return
-
1
;
}
}
}
}
taosArrayDestroy
(
pTxnList
);
tdbCloseDir
(
&
pDir
);
tdbCloseDir
(
&
pDir
);
return
0
;
return
0
;
...
...
tests/system-test/0-others/check_assert.py
浏览文件 @
57331cd7
...
@@ -28,10 +28,10 @@ import os
...
@@ -28,10 +28,10 @@ import os
NO_FOUND
=
0
# not found assert or ASSERT
NO_FOUND
=
0
# not found assert or ASSERT
FOUND_OK
=
1
# found ASSERT and valid usage
FOUND_OK
=
1
# found ASSERT and valid usage
FOUND_NOIF
=
2
# found ASSERT but no if like ASSERT(...)
FOUND_NOIF
=
2
# found ASSERT but no if like ASSERT(...)
FOUND_LOWER
=
3
# found assert write with
lower letters
FOUND_LOWER
=
3
# found assert write with
system assert
FOUND_HAVENOT
=
4
# found ASSERT have if but have not like if(!ASSERT)
FOUND_HAVENOT
=
4
# found ASSERT have if but have not like if(!ASSERT)
code_strs
=
[
"not found"
,
"valid"
,
"found but no if"
,
"
lower
assert"
,
"found but have not"
]
code_strs
=
[
"not found"
,
"valid"
,
"found but no if"
,
"
system
assert"
,
"found but have not"
]
#
#
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录