Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
fb14587d
提交
fb14587d
authored
9月 04, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Option to ignore problem (open files) when deleting a directory.
上级
788bc07f
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
32 行增加
和
33 行删除
+32
-33
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+1
-1
FileSystem.java
h2/src/main/org/h2/store/fs/FileSystem.java
+2
-1
FileSystemDisk.java
h2/src/main/org/h2/store/fs/FileSystemDisk.java
+7
-3
FileSystemMemory.java
h2/src/main/org/h2/store/fs/FileSystemMemory.java
+1
-1
FileSystemSplit.java
h2/src/main/org/h2/store/fs/FileSystemSplit.java
+2
-2
FileSystemZip.java
h2/src/main/org/h2/store/fs/FileSystemZip.java
+1
-1
DeleteDbFiles.java
h2/src/main/org/h2/tools/DeleteDbFiles.java
+1
-7
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+6
-6
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+2
-2
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+1
-1
TestFullText.java
h2/src/test/org/h2/test/db/TestFullText.java
+4
-4
FileSystemDatabase.java
h2/src/test/org/h2/test/unit/FileSystemDatabase.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+1
-1
FileSystemDebug.java
h2/src/test/org/h2/test/utils/FileSystemDebug.java
+2
-2
没有找到文件。
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
fb14587d
...
...
@@ -299,7 +299,7 @@ public class FullTextLucene extends FullText {
if
(
index
!=
null
)
{
removeIndexModifier
(
index
,
path
);
}
FileSystem
.
getInstance
(
path
).
deleteRecursive
(
path
);
FileSystem
.
getInstance
(
path
).
deleteRecursive
(
path
,
false
);
}
/**
...
...
h2/src/main/org/h2/store/fs/FileSystem.java
浏览文件 @
fb14587d
...
...
@@ -182,8 +182,9 @@ public abstract class FileSystem {
* Delete a directory or file and all subdirectories and files.
*
* @param directory the directory
* @param tryOnly whether errors should be ignored
*/
public
abstract
void
deleteRecursive
(
String
directory
)
throws
SQLException
;
public
abstract
void
deleteRecursive
(
String
directory
,
boolean
tryOnly
)
throws
SQLException
;
/**
* Check if a file is read-only.
...
...
h2/src/main/org/h2/store/fs/FileSystemDisk.java
浏览文件 @
fb14587d
...
...
@@ -206,15 +206,19 @@ public class FileSystemDisk extends FileSystem {
}
}
public
void
deleteRecursive
(
String
fileName
)
throws
SQLException
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
throws
SQLException
{
fileName
=
translateFileName
(
fileName
);
if
(
FileUtils
.
isDirectory
(
fileName
))
{
String
[]
list
=
listFiles
(
fileName
);
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
deleteRecursive
(
list
[
i
]);
deleteRecursive
(
list
[
i
]
,
tryOnly
);
}
}
delete
(
fileName
);
if
(
tryOnly
)
{
tryDelete
(
fileName
);
}
else
{
delete
(
fileName
);
}
}
public
boolean
isReadOnly
(
String
fileName
)
{
...
...
h2/src/main/org/h2/store/fs/FileSystemMemory.java
浏览文件 @
fb14587d
...
...
@@ -110,7 +110,7 @@ public class FileSystemMemory extends FileSystem {
}
}
public
void
deleteRecursive
(
String
fileName
)
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
{
fileName
=
normalize
(
fileName
);
synchronized
(
MEMORY_FILES
)
{
Iterator
<
String
>
it
=
MEMORY_FILES
.
keySet
().
iterator
();
...
...
h2/src/main/org/h2/store/fs/FileSystemSplit.java
浏览文件 @
fb14587d
...
...
@@ -78,9 +78,9 @@ public class FileSystemSplit extends FileSystem {
}
}
public
void
deleteRecursive
(
String
directory
)
throws
SQLException
{
public
void
deleteRecursive
(
String
directory
,
boolean
tryOnly
)
throws
SQLException
{
directory
=
translateFileName
(
directory
);
getFileSystem
(
directory
).
deleteRecursive
(
directory
);
getFileSystem
(
directory
).
deleteRecursive
(
directory
,
tryOnly
);
}
public
boolean
exists
(
String
fileName
)
{
...
...
h2/src/main/org/h2/store/fs/FileSystemZip.java
浏览文件 @
fb14587d
...
...
@@ -62,7 +62,7 @@ public class FileSystemZip extends FileSystem {
throw
Message
.
getUnsupportedException
(
"write"
);
}
public
void
deleteRecursive
(
String
fileName
)
throws
SQLException
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
throws
SQLException
{
throw
Message
.
getUnsupportedException
(
"write"
);
}
...
...
h2/src/main/org/h2/tools/DeleteDbFiles.java
浏览文件 @
fb14587d
...
...
@@ -101,13 +101,7 @@ public class DeleteDbFiles extends Tool {
private
void
process
(
String
fileName
,
boolean
quiet
)
throws
SQLException
{
if
(
FileUtils
.
isDirectory
(
fileName
))
{
try
{
FileSystem
.
getInstance
(
fileName
).
deleteRecursive
(
fileName
);
}
catch
(
SQLException
e
)
{
if
(!
quiet
)
{
throw
e
;
}
}
FileSystem
.
getInstance
(
fileName
).
deleteRecursive
(
fileName
,
quiet
);
}
else
if
(
quiet
||
fileName
.
endsWith
(
Constants
.
SUFFIX_TEMP_FILE
)
||
fileName
.
endsWith
(
Constants
.
SUFFIX_TRACE_FILE
))
{
FileUtils
.
tryDelete
(
fileName
);
}
else
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
fb14587d
...
...
@@ -345,10 +345,10 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new
TestTimer
().
runTest
(
test
);
}
}
else
{
System
.
setProperty
(
SysProperties
.
H2_PAGE_STORE
,
"true"
);
test
.
pageStore
=
true
;
test
.
runTests
();
TestPerformance
.
main
(
"-init"
,
"-db"
,
"1"
);
//
System.setProperty(SysProperties.H2_PAGE_STORE, "true");
//
test.pageStore = true;
//
test.runTests();
//
TestPerformance.main("-init", "-db", "1");
// Recover.execute("data", null);
System
.
setProperty
(
SysProperties
.
H2_PAGE_STORE
,
"false"
);
...
...
@@ -621,7 +621,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
void
beforeTest
()
throws
SQLException
{
Driver
.
load
();
DeleteDbFiles
.
execute
(
TestBase
.
baseDir
,
null
,
true
);
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
);
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
,
false
);
if
(
networked
)
{
String
[]
args
=
ssl
?
new
String
[]
{
"-tcpSSL"
,
"true"
,
"-tcpPort"
,
"9192"
}
:
new
String
[]
{
"-tcpPort"
,
"9192"
};
...
...
@@ -636,7 +636,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
}
private
void
afterTest
()
throws
SQLException
{
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
);
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
,
false
);
if
(
networked
&&
server
!=
null
)
{
server
.
stop
();
}
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
fb14587d
...
...
@@ -120,8 +120,8 @@ public abstract class TestBase {
}
}
finally
{
try
{
FileSystem
.
getInstance
(
"memFS:"
).
deleteRecursive
(
"memFS:"
);
FileSystem
.
getInstance
(
"memLZF:"
).
deleteRecursive
(
"memLZF:"
);
FileSystem
.
getInstance
(
"memFS:"
).
deleteRecursive
(
"memFS:"
,
false
);
FileSystem
.
getInstance
(
"memLZF:"
).
deleteRecursive
(
"memLZF:"
,
false
);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
...
...
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
fb14587d
...
...
@@ -77,7 +77,7 @@ public class TestPerformance {
if
(
"-db"
.
equals
(
arg
))
{
dbId
=
Integer
.
parseInt
(
args
[++
i
]);
}
else
if
(
"-init"
.
equals
(
arg
))
{
FileSystem
.
getInstance
(
"data"
).
deleteRecursive
(
"data"
);
FileSystem
.
getInstance
(
"data"
).
deleteRecursive
(
"data"
,
true
);
}
else
if
(
"-out"
.
equals
(
arg
))
{
out
=
args
[++
i
];
}
else
if
(
"-trace"
.
equals
(
arg
))
{
...
...
h2/src/test/org/h2/test/db/TestFullText.java
浏览文件 @
fb14587d
...
...
@@ -60,7 +60,7 @@ public class TestFullText extends TestBase {
private
void
testCreateDrop
()
throws
SQLException
{
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
,
false
);
Connection
conn
=
getConnection
(
"fullText"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS IF NOT EXISTS FT_INIT FOR \"org.h2.fulltext.FullText.init\""
);
...
...
@@ -71,13 +71,13 @@ public class TestFullText extends TestBase {
}
conn
.
close
();
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
,
false
);
}
private
void
testReopen
(
boolean
lucene
)
throws
SQLException
{
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
deleteDb
(
"fullTextReopen"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullTextReopen"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullTextReopen"
,
false
);
Connection
conn
=
getConnection
(
"fullTextReopen"
);
Statement
stat
=
conn
.
createStatement
();
String
className
=
lucene
?
"FullTextLucene"
:
"FullText"
;
...
...
@@ -101,7 +101,7 @@ public class TestFullText extends TestBase {
private
void
testPerformance
(
boolean
lucene
)
throws
SQLException
{
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
,
false
);
Connection
conn
=
getConnection
(
"fullText"
);
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
Statement
stat
=
conn
.
createStatement
();
...
...
h2/src/test/org/h2/test/unit/FileSystemDatabase.java
浏览文件 @
fb14587d
...
...
@@ -264,7 +264,7 @@ public class FileSystemDatabase extends FileSystem {
}
}
public
void
deleteRecursive
(
String
fileName
)
throws
SQLException
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
throws
SQLException
{
throw
Message
.
getUnsupportedException
(
"db"
);
}
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
fb14587d
...
...
@@ -179,7 +179,7 @@ public class TestFileSystem extends TestBase {
fs
.
createDirs
(
fsBase
+
"/testDir/test"
);
assertTrue
(
fs
.
isDirectory
(
fsBase
+
"/testDir"
));
if
(!
fsBase
.
startsWith
(
"jdbc:"
))
{
fs
.
deleteRecursive
(
fsBase
+
"/testDir"
);
fs
.
deleteRecursive
(
fsBase
+
"/testDir"
,
false
);
assertTrue
(!
fs
.
exists
(
fsBase
+
"/testDir"
));
}
}
...
...
h2/src/test/org/h2/test/utils/FileSystemDebug.java
浏览文件 @
fb14587d
...
...
@@ -71,10 +71,10 @@ public class FileSystemDebug extends FileSystem {
FileSystem
.
getInstance
(
fileName
).
delete
(
fileName
);
}
public
void
deleteRecursive
(
String
directory
)
throws
SQLException
{
public
void
deleteRecursive
(
String
directory
,
boolean
tryOnly
)
throws
SQLException
{
directory
=
translateFileName
(
directory
);
debug
(
"deleteRecursive"
,
directory
);
FileSystem
.
getInstance
(
directory
).
deleteRecursive
(
directory
);
FileSystem
.
getInstance
(
directory
).
deleteRecursive
(
directory
,
tryOnly
);
}
public
boolean
exists
(
String
fileName
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论