Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5b98a16d
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,发现更多精彩内容 >>
未验证
提交
5b98a16d
编写于
4月 02, 2022
作者:
wafwerar
提交者:
GitHub
4月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11218 from taosdata/fix/ZhiqiangWang/TD-13756-log-file-open-fail-error
[TD-13756]<fix>: log file open fail error.
上级
bf916610
eb18ad24
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
15 deletion
+12
-15
source/os/src/osFile.c
source/os/src/osFile.c
+9
-9
source/util/src/tlog.c
source/util/src/tlog.c
+3
-6
未找到文件。
source/os/src/osFile.c
浏览文件 @
5b98a16d
...
...
@@ -325,7 +325,7 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
#if FILE_WITH_LOCK
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
int64_t
leftbytes
=
count
;
int64_t
readbytes
;
char
*
tbuf
=
(
char
*
)
buf
;
...
...
@@ -365,7 +365,7 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
#if FILE_WITH_LOCK
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
int64_t
ret
=
pread
(
pFile
->
fd
,
buf
,
count
,
offset
);
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
...
...
@@ -380,7 +380,7 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
#if FILE_WITH_LOCK
taosThreadRwlockWrlock
(
&
(
pFile
->
rwlock
));
#endif
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
int64_t
nleft
=
count
;
int64_t
nwritten
=
0
;
...
...
@@ -414,7 +414,7 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
#if FILE_WITH_LOCK
taosThreadRwlockRdlock
(
&
(
pFile
->
rwlock
));
#endif
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
int64_t
ret
=
lseek
(
pFile
->
fd
,
(
long
)
offset
,
whence
);
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
...
...
@@ -429,7 +429,7 @@ int32_t taosFStatFile(TdFilePtr pFile, int64_t *size, int32_t *mtime) {
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
struct
stat
fileStat
;
int32_t
code
=
fstat
(
pFile
->
fd
,
&
fileStat
);
...
...
@@ -456,7 +456,7 @@ int32_t taosLockFile(TdFilePtr pFile) {
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
return
(
int32_t
)
flock
(
pFile
->
fd
,
LOCK_EX
|
LOCK_NB
);
#endif
...
...
@@ -469,7 +469,7 @@ int32_t taosUnLockFile(TdFilePtr pFile) {
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
return
(
int32_t
)
flock
(
pFile
->
fd
,
LOCK_UN
|
LOCK_NB
);
#endif
...
...
@@ -529,7 +529,7 @@ int32_t taosFtruncateFile(TdFilePtr pFile, int64_t l_size) {
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
return
ftruncate
(
pFile
->
fd
,
l_size
);
#endif
...
...
@@ -750,7 +750,7 @@ void *taosMmapReadOnlyFile(TdFilePtr pFile, int64_t length) {
if
(
pFile
==
NULL
)
{
return
NULL
;
}
assert
(
pFile
->
fd
>=
0
);
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
void
*
ptr
=
mmap
(
NULL
,
length
,
PROT_READ
,
MAP_SHARED
,
pFile
->
fd
,
0
);
return
ptr
;
...
...
source/util/src/tlog.c
浏览文件 @
5b98a16d
...
...
@@ -214,6 +214,7 @@ static void *taosThreadToOpenNewFile(void *param) {
tsLogObj
.
logHandle
->
pFile
=
pFile
;
tsLogObj
.
lines
=
0
;
tsLogObj
.
openInProgress
=
0
;
taosSsleep
(
3
);
taosCloseLogByFd
(
pOldFile
);
uInfo
(
" new log file:%d is opened"
,
tsLogObj
.
flag
);
...
...
@@ -347,16 +348,12 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
taosThreadMutexInit
(
&
tsLogObj
.
logMutex
,
NULL
);
taosUmaskFile
(
0
);
TdFilePtr
pFile
=
taosOpenFile
(
fileName
,
TD_FILE_CTEATE
|
TD_FILE_WRITE
);
tsLogObj
.
logHandle
->
pFile
=
taosOpenFile
(
fileName
,
TD_FILE_CTEATE
|
TD_FILE_WRITE
);
if
(
pFile
==
NULL
)
{
if
(
tsLogObj
.
logHandle
->
pFile
==
NULL
)
{
printf
(
"
\n
failed to open log file:%s, reason:%s
\n
"
,
fileName
,
strerror
(
errno
));
return
-
1
;
}
TdFilePtr
pOldFile
=
tsLogObj
.
logHandle
->
pFile
;
tsLogObj
.
logHandle
->
pFile
=
pFile
;
taosUnLockLogFile
(
pOldFile
);
taosCloseFile
(
&
pOldFile
);
taosLockLogFile
(
tsLogObj
.
logHandle
->
pFile
);
// only an estimate for number of lines
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录