Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1c98d780
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1c98d780
编写于
5月 12, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(wal): int overflow
上级
a52a6ec7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
13 addition
and
29 deletion
+13
-29
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+2
-0
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+2
-2
source/os/src/osFile.c
source/os/src/osFile.c
+9
-27
未找到文件。
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
1c98d780
...
...
@@ -485,8 +485,10 @@ static int32_t mndProcessDropTopicReq(SNodeMsg *pReq) {
return
-
1
;
}
}
// TODO: check ref
int32_t
code
=
mndDropTopic
(
pMnode
,
pReq
,
pTopic
);
// TODO: iterate and drop related subscriptions and offsets
mndReleaseTopic
(
pMnode
,
pTopic
);
if
(
code
!=
0
)
{
...
...
source/libs/wal/src/walRead.c
浏览文件 @
1c98d780
...
...
@@ -55,7 +55,7 @@ int32_t walRegisterRead(SWalReadHandle *pRead, int64_t ver) {
}
static
int32_t
walReadSeekFilePos
(
SWalReadHandle
*
pRead
,
int64_t
fileFirstVer
,
int64_t
ver
)
{
int
ret
=
0
;
int
64_t
ret
=
0
;
TdFilePtr
pIdxTFile
=
pRead
->
pReadIdxTFile
;
TdFilePtr
pLogTFile
=
pRead
->
pReadLogTFile
;
...
...
@@ -68,7 +68,7 @@ static int32_t walReadSeekFilePos(SWalReadHandle *pRead, int64_t fileFirstVer, i
wError
(
"failed to seek idx file, ver %ld, pos: %ld, since %s"
,
ver
,
offset
,
terrstr
());
return
-
1
;
}
SWalIdxEntry
entry
;
SWalIdxEntry
entry
=
{
0
}
;
if
((
ret
=
taosReadFile
(
pIdxTFile
,
&
entry
,
sizeof
(
SWalIdxEntry
)))
!=
sizeof
(
SWalIdxEntry
))
{
if
(
ret
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
source/os/src/osFile.c
浏览文件 @
1c98d780
...
...
@@ -246,11 +246,11 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
access
|=
(
tdFileOptions
&
TD_FILE_APPEND
)
?
O_APPEND
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_TEXT
)
?
O_TEXT
:
0
;
access
|=
(
tdFileOptions
&
TD_FILE_EXCL
)
?
O_EXCL
:
0
;
#ifdef WINDOWS
fd
=
_open
(
path
,
access
,
_S_IREAD
|
_S_IWRITE
);
#else
#ifdef WINDOWS
fd
=
_open
(
path
,
access
,
_S_IREAD
|
_S_IWRITE
);
#else
fd
=
open
(
path
,
access
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
#endif
#endif
if
(
fd
==
-
1
)
{
return
NULL
;
}
...
...
@@ -310,9 +310,6 @@ int64_t taosCloseFile(TdFilePtr *ppFile) {
}
int64_t
taosReadFile
(
TdFilePtr
pFile
,
void
*
buf
,
int64_t
count
)
{
if
(
pFile
==
NULL
)
{
return
0
;
}
#if FILE_WITH_LOCK
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
...
...
@@ -359,7 +356,7 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
#ifdef WINDOWS
size_t
pos
=
lseek
(
pFile
->
fd
,
0
,
SEEK_CUR
);
lseek
(
pFile
->
fd
,
(
long
)
offset
,
SEEK_SET
);
lseek
(
pFile
->
fd
,
offset
,
SEEK_SET
);
int64_t
ret
=
read
(
pFile
->
fd
,
buf
,
count
);
lseek
(
pFile
->
fd
,
pos
,
SEEK_SET
);
#else
...
...
@@ -372,9 +369,6 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
}
int64_t
taosWriteFile
(
TdFilePtr
pFile
,
const
void
*
buf
,
int64_t
count
)
{
if
(
pFile
==
NULL
)
{
return
0
;
}
#if FILE_WITH_LOCK
taosThreadRwlockWrlock
(
&
(
pFile
->
rwlock
));
#endif
...
...
@@ -406,14 +400,11 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
}
int64_t
taosLSeekFile
(
TdFilePtr
pFile
,
int64_t
offset
,
int32_t
whence
)
{
if
(
pFile
==
NULL
)
{
return
0
;
}
#if FILE_WITH_LOCK
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
int64_t
ret
=
lseek
(
pFile
->
fd
,
(
long
)
offset
,
whence
);
int64_t
ret
=
lseek
(
pFile
->
fd
,
offset
,
whence
);
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
#endif
...
...
@@ -424,9 +415,6 @@ int32_t taosFStatFile(TdFilePtr pFile, int64_t *size, int32_t *mtime) {
#ifdef WINDOWS
return
0
;
#else
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
struct
stat
fileStat
;
...
...
@@ -451,9 +439,6 @@ int32_t taosLockFile(TdFilePtr pFile) {
#ifdef WINDOWS
return
0
;
#else
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
return
(
int32_t
)
flock
(
pFile
->
fd
,
LOCK_EX
|
LOCK_NB
);
...
...
@@ -464,9 +449,6 @@ int32_t taosUnLockFile(TdFilePtr pFile) {
#ifdef WINDOWS
return
0
;
#else
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
return
(
int32_t
)
flock
(
pFile
->
fd
,
LOCK_UN
|
LOCK_NB
);
...
...
@@ -667,7 +649,7 @@ int32_t taosUmaskFile(int32_t maskVal) {
int32_t
taosGetErrorFile
(
TdFilePtr
pFile
)
{
return
errno
;
}
int64_t
taosGetLineFile
(
TdFilePtr
pFile
,
char
**
__restrict
ptrBuf
)
{
if
(
pFile
==
NULL
||
ptrBuf
==
NULL
)
{
if
(
pFile
==
NULL
||
ptrBuf
==
NULL
)
{
return
-
1
;
}
if
(
*
ptrBuf
!=
NULL
)
{
...
...
@@ -689,7 +671,7 @@ int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) {
#endif
}
int64_t
taosGetsFile
(
TdFilePtr
pFile
,
int32_t
maxSize
,
char
*
__restrict
buf
)
{
if
(
pFile
==
NULL
||
buf
==
NULL
)
{
if
(
pFile
==
NULL
||
buf
==
NULL
)
{
return
-
1
;
}
assert
(
pFile
->
fp
!=
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录