Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0cd6a4cf
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看板
未验证
提交
0cd6a4cf
编写于
3月 04, 2022
作者:
wafwerar
提交者:
GitHub
3月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10554 from taosdata/fix/ZhiqiangWang/TD-13756-file-system-remove-func
[TD-13756]<fix>: file system remove func.
上级
1cdc5afe
71e4c419
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
32 addition
and
26 deletion
+32
-26
include/os/osFile.h
include/os/osFile.h
+6
-2
source/common/src/ttszip.c
source/common/src/ttszip.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+4
-4
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+1
-1
source/libs/tfs/src/tfs.c
source/libs/tfs/src/tfs.c
+1
-1
source/libs/transport/test/pushServer.c
source/libs/transport/test/pushServer.c
+1
-1
source/libs/transport/test/rserver.c
source/libs/transport/test/rserver.c
+1
-1
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+1
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+4
-4
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+2
-2
source/os/src/osDir.c
source/os/src/osDir.c
+2
-2
source/os/src/osFile.c
source/os/src/osFile.c
+3
-1
source/util/src/tlog.c
source/util/src/tlog.c
+2
-2
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+1
-1
未找到文件。
include/os/osFile.h
浏览文件 @
0cd6a4cf
...
...
@@ -22,6 +22,7 @@ extern "C" {
#include "osSocket.h"
// If the error is in a third-party library, place this header file under the third-party library header file.
#ifndef ALLOW_FORBID_FUNC
#define open OPEN_FUNC_TAOS_FORBID
#define fopen FOPEN_FUNC_TAOS_FORBID
...
...
@@ -31,6 +32,8 @@ extern "C" {
#define fstat FSTAT_FUNC_TAOS_FORBID
#define close CLOSE_FUNC_TAOS_FORBID
#define fclose FCLOSE_FUNC_TAOS_FORBID
#define fsync FSYNC_FUNC_TAOS_FORBID
// #define fflush FFLUSH_FUNC_TAOS_FORBID
#endif
#ifndef PATH_MAX
...
...
@@ -47,13 +50,13 @@ typedef struct TdFile *TdFilePtr;
#define TD_FILE_TEXT 0x0020
#define TD_FILE_AUTO_DEL 0x0040
#define TD_FILE_EXCL 0x0080
#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taos
GetLineFile, taos
EOFFile
#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taosEOFFile
TdFilePtr
taosOpenFile
(
const
char
*
path
,
int32_t
tdFileOptions
);
#define TD_FILE_ACCESS_EXIST_OK 0x1
#define TD_FILE_ACCESS_READ_OK 0x2
#define TD_FILE_ACCESS_WRITE_OK 0x4
bool
taosCheckAccessFile
(
const
char
*
pathname
,
int
mode
);
bool
taosCheckAccessFile
(
const
char
*
pathname
,
int
mode
);
int32_t
taosLockFile
(
TdFilePtr
pFile
);
int32_t
taosUnLockFile
(
TdFilePtr
pFile
);
...
...
@@ -80,6 +83,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile);
int32_t
taosRenameFile
(
const
char
*
oldName
,
const
char
*
newName
);
int64_t
taosCopyFile
(
const
char
*
from
,
const
char
*
to
);
int32_t
taosRemoveFile
(
const
char
*
path
);
void
taosGetTmpfilePath
(
const
char
*
inputTmpDir
,
const
char
*
fileNamePrefix
,
char
*
dstPath
);
...
...
source/common/src/ttszip.c
浏览文件 @
0cd6a4cf
...
...
@@ -46,7 +46,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
}
if
(
!
autoDelete
)
{
remov
e
(
pTSBuf
->
path
);
taosRemoveFil
e
(
pTSBuf
->
path
);
}
if
(
NULL
==
allocResForTSBuf
(
pTSBuf
))
{
...
...
@@ -178,7 +178,7 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
if
(
pTSBuf
->
autoDelete
)
{
// ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path);
remov
e
(
pTSBuf
->
path
);
taosRemoveFil
e
(
pTSBuf
->
path
);
}
else
{
// tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path);
}
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
0cd6a4cf
...
...
@@ -1054,7 +1054,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
// pfs->metaCacheComp = NULL;
// } else {
// // remove meta.tmp file
//
remov
e(mf.f.aname);
//
taosRemoveFil
e(mf.f.aname);
// taosHashCleanup(pfs->metaCacheComp);
// pfs->metaCacheComp = NULL;
// }
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
0cd6a4cf
...
...
@@ -439,7 +439,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
taosWriteFile
(
pFile
,
hbuf
,
TSDB_FILE_HEAD_SIZE
)
<
TSDB_FILE_HEAD_SIZE
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosCloseFile
(
&
pFile
);
remov
e
(
tfname
);
taosRemoveFil
e
(
tfname
);
return
-
1
;
}
...
...
@@ -447,7 +447,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
fsheader
.
len
>
0
)
{
if
(
tsdbMakeRoom
(
&
(
pBuf
),
fsheader
.
len
)
<
0
)
{
taosCloseFile
(
&
pFile
);
remov
e
(
tfname
);
taosRemoveFil
e
(
tfname
);
return
-
1
;
}
...
...
@@ -458,7 +458,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
taosWriteFile
(
pFile
,
pBuf
,
fsheader
.
len
)
<
fsheader
.
len
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosCloseFile
(
&
pFile
);
(
void
)
remov
e
(
tfname
);
(
void
)
taosRemoveFil
e
(
tfname
);
taosTZfree
(
pBuf
);
return
-
1
;
}
...
...
@@ -468,7 +468,7 @@ static int tsdbSaveFSStatus(STsdb *pRepo, SFSStatus *pStatus) {
if
(
taosFsyncFile
(
pFile
)
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosCloseFile
(
&
pFile
);
remov
e
(
tfname
);
taosRemoveFil
e
(
tfname
);
taosTZfree
(
pBuf
);
return
-
1
;
}
...
...
source/libs/index/test/fstTest.cc
浏览文件 @
0cd6a4cf
...
...
@@ -19,7 +19,7 @@ static std::string fileName = "/tmp/tindex.tindex";
class
FstWriter
{
public:
FstWriter
()
{
remov
e
(
fileName
.
c_str
());
taosRemoveFil
e
(
fileName
.
c_str
());
_wc
=
writerCtxCreate
(
TFile
,
fileName
.
c_str
(),
false
,
64
*
1024
*
1024
);
_b
=
fstBuilderCreate
(
_wc
,
0
);
}
...
...
source/libs/tfs/src/tfs.c
浏览文件 @
0cd6a4cf
...
...
@@ -202,7 +202,7 @@ void tfsDirname(const STfsFile *pFile, char *dest) {
tstrncpy
(
dest
,
dirname
(
tname
),
TSDB_FILENAME_LEN
);
}
int32_t
tfsRemoveFile
(
const
STfsFile
*
pFile
)
{
return
remov
e
(
pFile
->
aname
);
}
int32_t
tfsRemoveFile
(
const
STfsFile
*
pFile
)
{
return
taosRemoveFil
e
(
pFile
->
aname
);
}
int32_t
tfsCopyFile
(
const
STfsFile
*
pFile1
,
const
STfsFile
*
pFile2
)
{
return
taosCopyFile
(
pFile1
->
aname
,
pFile2
->
aname
);
...
...
source/libs/transport/test/pushServer.c
浏览文件 @
0cd6a4cf
...
...
@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
if
(
pDataFile
!=
NULL
)
{
taosCloseFile
(
&
pDataFile
);
remov
e
(
dataName
);
taosRemoveFil
e
(
dataName
);
}
return
0
;
...
...
source/libs/transport/test/rserver.c
浏览文件 @
0cd6a4cf
...
...
@@ -181,7 +181,7 @@ int main(int argc, char *argv[]) {
if
(
pDataFile
!=
NULL
)
{
taosCloseFile
(
&
pDataFile
);
remov
e
(
dataName
);
taosRemoveFil
e
(
dataName
);
}
return
0
;
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
0cd6a4cf
...
...
@@ -379,7 +379,7 @@ int walSaveMeta(SWal* pWal) {
// delete old file
if
(
metaVer
>
-
1
)
{
walBuildMetaName
(
pWal
,
metaVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
}
free
(
serialized
);
return
0
;
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
0cd6a4cf
...
...
@@ -55,9 +55,9 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
int
fileSetSize
=
taosArrayGetSize
(
pWal
->
fileInfoSet
);
for
(
int
i
=
pWal
->
writeCur
;
i
<
fileSetSize
;
i
++
)
{
walBuildLogName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
walBuildIdxName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
}
// pop from fileInfoSet
taosArraySetSize
(
pWal
->
fileInfoSet
,
pWal
->
writeCur
+
1
);
...
...
@@ -174,9 +174,9 @@ int32_t walEndSnapshot(SWal *pWal) {
for
(
int
i
=
0
;
i
<
deleteCnt
;
i
++
)
{
SWalFileInfo
*
pInfo
=
taosArrayGet
(
pWal
->
fileInfoSet
,
i
);
walBuildLogName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
walBuildIdxName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
remov
e
(
fnameStr
);
taosRemoveFil
e
(
fnameStr
);
}
// make new array, remove files
...
...
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
0cd6a4cf
...
...
@@ -339,9 +339,9 @@ TEST_F(WalRetentionEnv, repairMeta1) {
//getchar();
char
buf
[
100
];
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
0
);
remov
e
(
buf
);
taosRemoveFil
e
(
buf
);
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
1
);
remov
e
(
buf
);
taosRemoveFil
e
(
buf
);
SetUp
();
//getchar();
...
...
source/os/src/osDir.c
浏览文件 @
0cd6a4cf
...
...
@@ -49,7 +49,7 @@ void taosRemoveDir(const char *dirname) {
if
(
de
->
d_type
&
DT_DIR
)
{
taosRemoveDir
(
filename
);
}
else
{
(
void
)
remov
e
(
filename
);
(
void
)
taosRemoveFil
e
(
filename
);
//printf("file:%s is removed\n", filename);
}
}
...
...
@@ -102,7 +102,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
if
(
fileSec
<=
100
)
continue
;
int32_t
days
=
(
int32_t
)(
TABS
(
sec
-
fileSec
)
/
86400
+
1
);
if
(
days
>
keepDays
)
{
(
void
)
remov
e
(
filename
);
(
void
)
taosRemoveFil
e
(
filename
);
//printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
}
else
{
//printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
...
...
source/os/src/osFile.c
浏览文件 @
0cd6a4cf
...
...
@@ -142,11 +142,13 @@ int64_t taosCopyFile(const char *from, const char *to) {
_err:
if
(
pFileFrom
!=
NULL
)
taosCloseFile
(
&
pFileFrom
);
if
(
pFileTo
!=
NULL
)
taosCloseFile
(
&
pFileTo
);
remov
e
(
to
);
taosRemoveFil
e
(
to
);
return
-
1
;
#endif
}
int32_t
taosRemoveFile
(
const
char
*
path
)
{
return
remove
(
path
);
}
int32_t
taosRenameFile
(
const
char
*
oldName
,
const
char
*
newName
)
{
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
int32_t
code
=
MoveFileEx
(
oldName
,
newName
,
MOVEFILE_REPLACE_EXISTING
|
MOVEFILE_COPY_ALLOWED
);
...
...
source/util/src/tlog.c
浏览文件 @
0cd6a4cf
...
...
@@ -180,7 +180,7 @@ static void taosKeepOldLog(char *oldName) {
char
compressFileName
[
LOG_FILE_NAME_LEN
+
20
];
snprintf
(
compressFileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
".gz"
,
tsLogObj
.
logName
,
fileSec
);
if
(
taosCompressFile
(
fileName
,
compressFileName
)
==
0
)
{
(
void
)
remov
e
(
fileName
);
(
void
)
taosRemoveFil
e
(
fileName
);
}
}
...
...
@@ -251,7 +251,7 @@ void taosResetLog() {
tsLogObj
.
lines
=
tsLogObj
.
maxLines
+
10
;
taosOpenNewLogFile
();
(
void
)
remov
e
(
lastName
);
(
void
)
taosRemoveFil
e
(
lastName
);
uInfo
(
"=================================="
);
uInfo
(
" reset log file "
);
...
...
source/util/src/tpagedbuf.c
浏览文件 @
0cd6a4cf
...
...
@@ -563,7 +563,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
ps
->
loadPages
,
ps
->
loadBytes
/
(
1024
.
0
*
ps
->
loadPages
));
}
remov
e
(
pBuf
->
path
);
taosRemoveFil
e
(
pBuf
->
path
);
tfree
(
pBuf
->
path
);
SArray
**
p
=
taosHashIterate
(
pBuf
->
groupSet
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录