Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0f00862d
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看板
提交
0f00862d
编写于
1月 30, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix/TD-22070' of
https://github.com/taosdata/TDengine
into fix/3.0_merge_main
上级
3deedfb5
76e37205
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
56 addition
and
33 deletion
+56
-33
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+14
-12
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-1
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+38
-1
source/os/src/osMath.c
source/os/src/osMath.c
+1
-1
source/util/src/talgo.c
source/util/src/talgo.c
+0
-16
tests/parallel_test/container_build.sh
tests/parallel_test/container_build.sh
+2
-2
未找到文件。
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
0f00862d
...
@@ -678,7 +678,7 @@ static int32_t tsdbSnapReadTimeSeriesData(STsdbSnapReader* pReader, uint8_t** pp
...
@@ -678,7 +678,7 @@ static int32_t tsdbSnapReadTimeSeriesData(STsdbSnapReader* pReader, uint8_t** pp
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
tBlockData
Clear
(
&
pReader
->
bData
);
tBlockData
Reset
(
&
pReader
->
bData
);
for
(;;)
{
for
(;;)
{
// start a new file read if need
// start a new file read if need
...
@@ -925,6 +925,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
...
@@ -925,6 +925,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
int32_t
lino
=
0
;
int32_t
lino
=
0
;
STsdbSnapReader
*
pReader
=
*
ppReader
;
STsdbSnapReader
*
pReader
=
*
ppReader
;
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
// tombstone
// tombstone
if
(
pReader
->
pTIter
)
{
if
(
pReader
->
pTIter
)
{
...
@@ -957,9 +958,9 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
...
@@ -957,9 +958,9 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
p
Reader
->
p
Tsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
}
else
{
tsdbDebug
(
"vgId:%d %s done"
,
TD_VID
(
p
Reader
->
p
Tsdb
->
pVnode
),
__func__
);
tsdbDebug
(
"vgId:%d %s done"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
);
}
}
*
ppReader
=
NULL
;
*
ppReader
=
NULL
;
return
code
;
return
code
;
...
@@ -1901,6 +1902,8 @@ _exit:
...
@@ -1901,6 +1902,8 @@ _exit:
int32_t
tsdbSnapWriterClose
(
STsdbSnapWriter
**
ppWriter
,
int8_t
rollback
)
{
int32_t
tsdbSnapWriterClose
(
STsdbSnapWriter
**
ppWriter
,
int8_t
rollback
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
lino
=
0
;
STsdbSnapWriter
*
pWriter
=
*
ppWriter
;
STsdbSnapWriter
*
pWriter
=
*
ppWriter
;
STsdb
*
pTsdb
=
pWriter
->
pTsdb
;
STsdb
*
pTsdb
=
pWriter
->
pTsdb
;
...
@@ -1913,7 +1916,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
...
@@ -1913,7 +1916,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
code
=
tsdbFSCommit
(
pWriter
->
pTsdb
);
code
=
tsdbFSCommit
(
pWriter
->
pTsdb
);
if
(
code
)
{
if
(
code
)
{
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
goto
_err
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
}
// unlock
// unlock
...
@@ -1936,16 +1939,15 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
...
@@ -1936,16 +1939,15 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
for
(
int32_t
iBuf
=
0
;
iBuf
<
sizeof
(
pWriter
->
aBuf
)
/
sizeof
(
uint8_t
*
);
iBuf
++
)
{
for
(
int32_t
iBuf
=
0
;
iBuf
<
sizeof
(
pWriter
->
aBuf
)
/
sizeof
(
uint8_t
*
);
iBuf
++
)
{
tFree
(
pWriter
->
aBuf
[
iBuf
]);
tFree
(
pWriter
->
aBuf
[
iBuf
]);
}
}
tsdbInfo
(
"vgId:%d, %s done"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
);
taosMemoryFree
(
pWriter
);
taosMemoryFree
(
pWriter
);
*
ppWriter
=
NULL
;
*
ppWriter
=
NULL
;
return
code
;
_err:
_exit:
tsdbError
(
"vgId:%d, vnode snapshot tsdb writer close for %s failed since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
if
(
code
)
{
pWriter
->
pTsdb
->
path
,
tstrerror
(
code
));
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
taosMemoryFree
(
pWriter
);
}
else
{
*
ppWriter
=
NULL
;
tsdbInfo
(
"vgId:%d %s done"
,
TD_VID
(
pTsdb
->
pVnode
),
__func__
);
}
return
code
;
return
code
;
}
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
0f00862d
...
@@ -306,7 +306,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
...
@@ -306,7 +306,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
if
(
pSyncNode
->
replicaNum
>
1
)
{
if
(
pSyncNode
->
replicaNum
>
1
)
{
// multi replicas
// multi replicas
lastApplyIndex
-=
SYNC_VNODE_LOG_RETENTION
;
lastApplyIndex
=
TMAX
(
lastApplyIndex
-
SYNC_VNODE_LOG_RETENTION
,
beginIndex
-
1
)
;
if
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_LEADER
)
{
if
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_LEADER
)
{
pSyncNode
->
minMatchIndex
=
syncMinMatchIndex
(
pSyncNode
);
pSyncNode
->
minMatchIndex
=
syncMinMatchIndex
(
pSyncNode
);
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
0f00862d
...
@@ -322,6 +322,35 @@ bool walLogEntriesComplete(const SWal* pWal) {
...
@@ -322,6 +322,35 @@ bool walLogEntriesComplete(const SWal* pWal) {
return
complete
;
return
complete
;
}
}
int
walTrimIdxFile
(
SWal
*
pWal
,
int32_t
fileIdx
)
{
SWalFileInfo
*
pFileInfo
=
taosArrayGet
(
pWal
->
fileInfoSet
,
fileIdx
);
ASSERT
(
pFileInfo
!=
NULL
);
char
fnameStr
[
WAL_FILE_LEN
];
walBuildIdxName
(
pWal
,
pFileInfo
->
firstVer
,
fnameStr
);
int64_t
fileSize
=
0
;
taosStatFile
(
fnameStr
,
&
fileSize
,
NULL
);
int64_t
records
=
TMAX
(
0
,
pFileInfo
->
lastVer
-
pFileInfo
->
firstVer
+
1
);
int64_t
lastEndOffset
=
records
*
sizeof
(
SWalIdxEntry
);
if
(
fileSize
<=
lastEndOffset
)
{
return
0
;
}
TdFilePtr
pFile
=
taosOpenFile
(
fnameStr
,
TD_FILE_READ
|
TD_FILE_WRITE
);
if
(
pFile
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
wInfo
(
"vgId:%d, trim idx file. file: %s, size: %"
PRId64
", offset: %"
PRId64
,
pWal
->
cfg
.
vgId
,
fnameStr
,
fileSize
,
lastEndOffset
);
taosFtruncateFile
(
pFile
,
lastEndOffset
);
taosCloseFile
(
&
pFile
);
return
0
;
}
int
walCheckAndRepairMeta
(
SWal
*
pWal
)
{
int
walCheckAndRepairMeta
(
SWal
*
pWal
)
{
// load log files, get first/snapshot/last version info
// load log files, get first/snapshot/last version info
const
char
*
logPattern
=
"^[0-9]+.log$"
;
const
char
*
logPattern
=
"^[0-9]+.log$"
;
...
@@ -396,6 +425,8 @@ int walCheckAndRepairMeta(SWal* pWal) {
...
@@ -396,6 +425,8 @@ int walCheckAndRepairMeta(SWal* pWal) {
}
}
updateMeta
=
true
;
updateMeta
=
true
;
(
void
)
walTrimIdxFile
(
pWal
,
fileIdx
);
int64_t
lastVer
=
walScanLogGetLastVer
(
pWal
,
fileIdx
);
int64_t
lastVer
=
walScanLogGetLastVer
(
pWal
,
fileIdx
);
if
(
lastVer
<
0
)
{
if
(
lastVer
<
0
)
{
if
(
terrno
!=
TSDB_CODE_WAL_LOG_NOT_EXIST
)
{
if
(
terrno
!=
TSDB_CODE_WAL_LOG_NOT_EXIST
)
{
...
@@ -558,6 +589,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
...
@@ -558,6 +589,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
goto
_err
;
goto
_err
;
}
}
int64_t
count
=
0
;
while
(
idxEntry
.
ver
<
pFileInfo
->
lastVer
)
{
while
(
idxEntry
.
ver
<
pFileInfo
->
lastVer
)
{
/*A(idxEntry.ver == ckHead.head.version);*/
/*A(idxEntry.ver == ckHead.head.version);*/
...
@@ -569,11 +601,11 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
...
@@ -569,11 +601,11 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
idxEntry
.
offset
,
fLogNameStr
);
idxEntry
.
offset
,
fLogNameStr
);
goto
_err
;
goto
_err
;
}
}
wWarn
(
"vgId:%d, wal idx append new entry %"
PRId64
" %"
PRId64
,
pWal
->
cfg
.
vgId
,
idxEntry
.
ver
,
idxEntry
.
offset
);
if
(
taosWriteFile
(
pIdxFile
,
&
idxEntry
,
sizeof
(
SWalIdxEntry
))
<
0
)
{
if
(
taosWriteFile
(
pIdxFile
,
&
idxEntry
,
sizeof
(
SWalIdxEntry
))
<
0
)
{
wError
(
"vgId:%d, failed to append file since %s. file:%s"
,
pWal
->
cfg
.
vgId
,
terrstr
(),
fnameStr
);
wError
(
"vgId:%d, failed to append file since %s. file:%s"
,
pWal
->
cfg
.
vgId
,
terrstr
(),
fnameStr
);
goto
_err
;
goto
_err
;
}
}
count
++
;
}
}
if
(
taosFsyncFile
(
pIdxFile
)
<
0
)
{
if
(
taosFsyncFile
(
pIdxFile
)
<
0
)
{
...
@@ -581,6 +613,11 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
...
@@ -581,6 +613,11 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
goto
_err
;
goto
_err
;
}
}
if
(
count
>
0
)
{
wInfo
(
"vgId:%d, rebuilt %"
PRId64
" wal idx entries until lastVer: %"
PRId64
,
pWal
->
cfg
.
vgId
,
count
,
pFileInfo
->
lastVer
);
}
(
void
)
taosCloseFile
(
&
pLogFile
);
(
void
)
taosCloseFile
(
&
pLogFile
);
(
void
)
taosCloseFile
(
&
pIdxFile
);
(
void
)
taosCloseFile
(
&
pIdxFile
);
return
0
;
return
0
;
...
...
source/os/src/osMath.c
浏览文件 @
0f00862d
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
#define ALLOW_FORBID_FUNC
#define ALLOW_FORBID_FUNC
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include <stdlib.h>
#include <stdlib.h>
#include "os.h"
#ifdef WINDOWS
#ifdef WINDOWS
void
swapStr
(
char
*
j
,
char
*
J
,
int
width
)
{
void
swapStr
(
char
*
j
,
char
*
J
,
int
width
)
{
...
...
source/util/src/talgo.c
浏览文件 @
0f00862d
...
@@ -41,12 +41,6 @@ static void median(void *src, int64_t size, int64_t s, int64_t e, const void *pa
...
@@ -41,12 +41,6 @@ static void median(void *src, int64_t size, int64_t s, int64_t e, const void *pa
ASSERT
(
comparFn
(
elePtrAt
(
src
,
size
,
mid
),
elePtrAt
(
src
,
size
,
s
),
param
)
<=
0
&&
ASSERT
(
comparFn
(
elePtrAt
(
src
,
size
,
mid
),
elePtrAt
(
src
,
size
,
s
),
param
)
<=
0
&&
comparFn
(
elePtrAt
(
src
,
size
,
s
),
elePtrAt
(
src
,
size
,
e
),
param
)
<=
0
);
comparFn
(
elePtrAt
(
src
,
size
,
s
),
elePtrAt
(
src
,
size
,
e
),
param
)
<=
0
);
#ifdef _DEBUG_VIEW
// tTagsPrints(src[s], pOrderDesc->pColumnModel, &pOrderDesc->orderIdx);
// tTagsPrints(src[mid], pOrderDesc->pColumnModel, &pOrderDesc->orderIdx);
// tTagsPrints(src[e], pOrderDesc->pColumnModel, &pOrderDesc->orderIdx);
#endif
}
}
static
void
tInsertSort
(
void
*
src
,
int64_t
size
,
int32_t
s
,
int32_t
e
,
const
void
*
param
,
__ext_compar_fn_t
comparFn
,
static
void
tInsertSort
(
void
*
src
,
int64_t
size
,
int32_t
s
,
int32_t
e
,
const
void
*
param
,
__ext_compar_fn_t
comparFn
,
...
@@ -278,14 +272,4 @@ void taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar,
...
@@ -278,14 +272,4 @@ void taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar,
}
}
taosMemoryFree
(
buf
);
taosMemoryFree
(
buf
);
/*
char *buf = taosMemoryCalloc(1, size);
for (i = len - 1; i > 0; i--) {
doswap(elePtrAt(base, size, 0), elePtrAt(base, size, i));
taosheapadjust(base, size, 0, i - 1, parcompar, compar, parswap, swap, maxroot);
}
taosMemoryFreeClear(buf);
*/
}
}
tests/parallel_test/container_build.sh
浏览文件 @
0f00862d
...
@@ -55,7 +55,7 @@ fi
...
@@ -55,7 +55,7 @@ fi
date
date
docker run
\
docker run
\
-v
$REP_MOUNT_PARAM
\
-v
$REP_MOUNT_PARAM
\
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true;make -j || exit 1"
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true
-DBUILD_TAOSX=true
;make -j || exit 1"
if
[[
-d
${
WORKDIR
}
/debugNoSan
]]
;
then
if
[[
-d
${
WORKDIR
}
/debugNoSan
]]
;
then
echo
"delete
${
WORKDIR
}
/debugNoSan"
echo
"delete
${
WORKDIR
}
/debugNoSan"
...
@@ -70,7 +70,7 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
...
@@ -70,7 +70,7 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
date
date
docker run
\
docker run
\
-v
$REP_MOUNT_PARAM
\
-v
$REP_MOUNT_PARAM
\
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug;make -j || exit 1 "
--rm
--ulimit
core
=
-1
taos_test:v1.0 sh
-c
"cd
$REP_DIR
;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug
-DBUILD_TAOSX=true
;make -j || exit 1 "
mv
${
REP_REAL_PATH
}
/debug
${
WORKDIR
}
/debugSan
mv
${
REP_REAL_PATH
}
/debug
${
WORKDIR
}
/debugSan
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录