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 {
...
@@ -299,7 +299,7 @@ public class FullTextLucene extends FullText {
if
(
index
!=
null
)
{
if
(
index
!=
null
)
{
removeIndexModifier
(
index
,
path
);
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 {
...
@@ -182,8 +182,9 @@ public abstract class FileSystem {
* Delete a directory or file and all subdirectories and files.
* Delete a directory or file and all subdirectories and files.
*
*
* @param directory the directory
* @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.
* Check if a file is read-only.
...
...
h2/src/main/org/h2/store/fs/FileSystemDisk.java
浏览文件 @
fb14587d
...
@@ -206,16 +206,20 @@ public class FileSystemDisk extends FileSystem {
...
@@ -206,16 +206,20 @@ public class FileSystemDisk extends FileSystem {
}
}
}
}
public
void
deleteRecursive
(
String
fileName
)
throws
SQLException
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
throws
SQLException
{
fileName
=
translateFileName
(
fileName
);
fileName
=
translateFileName
(
fileName
);
if
(
FileUtils
.
isDirectory
(
fileName
))
{
if
(
FileUtils
.
isDirectory
(
fileName
))
{
String
[]
list
=
listFiles
(
fileName
);
String
[]
list
=
listFiles
(
fileName
);
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
deleteRecursive
(
list
[
i
]);
deleteRecursive
(
list
[
i
]
,
tryOnly
);
}
}
}
}
if
(
tryOnly
)
{
tryDelete
(
fileName
);
}
else
{
delete
(
fileName
);
delete
(
fileName
);
}
}
}
public
boolean
isReadOnly
(
String
fileName
)
{
public
boolean
isReadOnly
(
String
fileName
)
{
fileName
=
translateFileName
(
fileName
);
fileName
=
translateFileName
(
fileName
);
...
...
h2/src/main/org/h2/store/fs/FileSystemMemory.java
浏览文件 @
fb14587d
...
@@ -110,7 +110,7 @@ public class FileSystemMemory extends FileSystem {
...
@@ -110,7 +110,7 @@ public class FileSystemMemory extends FileSystem {
}
}
}
}
public
void
deleteRecursive
(
String
fileName
)
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
{
fileName
=
normalize
(
fileName
);
fileName
=
normalize
(
fileName
);
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
Iterator
<
String
>
it
=
MEMORY_FILES
.
keySet
().
iterator
();
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 {
...
@@ -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
);
directory
=
translateFileName
(
directory
);
getFileSystem
(
directory
).
deleteRecursive
(
directory
);
getFileSystem
(
directory
).
deleteRecursive
(
directory
,
tryOnly
);
}
}
public
boolean
exists
(
String
fileName
)
{
public
boolean
exists
(
String
fileName
)
{
...
...
h2/src/main/org/h2/store/fs/FileSystemZip.java
浏览文件 @
fb14587d
...
@@ -62,7 +62,7 @@ public class FileSystemZip extends FileSystem {
...
@@ -62,7 +62,7 @@ public class FileSystemZip extends FileSystem {
throw
Message
.
getUnsupportedException
(
"write"
);
throw
Message
.
getUnsupportedException
(
"write"
);
}
}
public
void
deleteRecursive
(
String
fileName
)
throws
SQLException
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
throws
SQLException
{
throw
Message
.
getUnsupportedException
(
"write"
);
throw
Message
.
getUnsupportedException
(
"write"
);
}
}
...
...
h2/src/main/org/h2/tools/DeleteDbFiles.java
浏览文件 @
fb14587d
...
@@ -101,13 +101,7 @@ public class DeleteDbFiles extends Tool {
...
@@ -101,13 +101,7 @@ public class DeleteDbFiles extends Tool {
private
void
process
(
String
fileName
,
boolean
quiet
)
throws
SQLException
{
private
void
process
(
String
fileName
,
boolean
quiet
)
throws
SQLException
{
if
(
FileUtils
.
isDirectory
(
fileName
))
{
if
(
FileUtils
.
isDirectory
(
fileName
))
{
try
{
FileSystem
.
getInstance
(
fileName
).
deleteRecursive
(
fileName
,
quiet
);
FileSystem
.
getInstance
(
fileName
).
deleteRecursive
(
fileName
);
}
catch
(
SQLException
e
)
{
if
(!
quiet
)
{
throw
e
;
}
}
}
else
if
(
quiet
||
fileName
.
endsWith
(
Constants
.
SUFFIX_TEMP_FILE
)
||
fileName
.
endsWith
(
Constants
.
SUFFIX_TRACE_FILE
))
{
}
else
if
(
quiet
||
fileName
.
endsWith
(
Constants
.
SUFFIX_TEMP_FILE
)
||
fileName
.
endsWith
(
Constants
.
SUFFIX_TRACE_FILE
))
{
FileUtils
.
tryDelete
(
fileName
);
FileUtils
.
tryDelete
(
fileName
);
}
else
{
}
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`
...
@@ -345,10 +345,10 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new
TestTimer
().
runTest
(
test
);
new
TestTimer
().
runTest
(
test
);
}
}
}
else
{
}
else
{
System
.
setProperty
(
SysProperties
.
H2_PAGE_STORE
,
"true"
);
//
System.setProperty(SysProperties.H2_PAGE_STORE, "true");
test
.
pageStore
=
true
;
//
test.pageStore = true;
test
.
runTests
();
//
test.runTests();
TestPerformance
.
main
(
"-init"
,
"-db"
,
"1"
);
//
TestPerformance.main("-init", "-db", "1");
// Recover.execute("data", null);
// Recover.execute("data", null);
System
.
setProperty
(
SysProperties
.
H2_PAGE_STORE
,
"false"
);
System
.
setProperty
(
SysProperties
.
H2_PAGE_STORE
,
"false"
);
...
@@ -621,7 +621,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -621,7 +621,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
void
beforeTest
()
throws
SQLException
{
void
beforeTest
()
throws
SQLException
{
Driver
.
load
();
Driver
.
load
();
DeleteDbFiles
.
execute
(
TestBase
.
baseDir
,
null
,
true
);
DeleteDbFiles
.
execute
(
TestBase
.
baseDir
,
null
,
true
);
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
);
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
,
false
);
if
(
networked
)
{
if
(
networked
)
{
String
[]
args
=
ssl
?
new
String
[]
{
"-tcpSSL"
,
"true"
,
"-tcpPort"
,
"9192"
}
:
new
String
[]
{
"-tcpPort"
,
String
[]
args
=
ssl
?
new
String
[]
{
"-tcpSSL"
,
"true"
,
"-tcpPort"
,
"9192"
}
:
new
String
[]
{
"-tcpPort"
,
"9192"
};
"9192"
};
...
@@ -636,7 +636,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -636,7 +636,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
}
}
private
void
afterTest
()
throws
SQLException
{
private
void
afterTest
()
throws
SQLException
{
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
);
FileSystemDisk
.
getInstance
().
deleteRecursive
(
"trace.db"
,
false
);
if
(
networked
&&
server
!=
null
)
{
if
(
networked
&&
server
!=
null
)
{
server
.
stop
();
server
.
stop
();
}
}
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
fb14587d
...
@@ -120,8 +120,8 @@ public abstract class TestBase {
...
@@ -120,8 +120,8 @@ public abstract class TestBase {
}
}
}
finally
{
}
finally
{
try
{
try
{
FileSystem
.
getInstance
(
"memFS:"
).
deleteRecursive
(
"memFS:"
);
FileSystem
.
getInstance
(
"memFS:"
).
deleteRecursive
(
"memFS:"
,
false
);
FileSystem
.
getInstance
(
"memLZF:"
).
deleteRecursive
(
"memLZF:"
);
FileSystem
.
getInstance
(
"memLZF:"
).
deleteRecursive
(
"memLZF:"
,
false
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
fb14587d
...
@@ -77,7 +77,7 @@ public class TestPerformance {
...
@@ -77,7 +77,7 @@ public class TestPerformance {
if
(
"-db"
.
equals
(
arg
))
{
if
(
"-db"
.
equals
(
arg
))
{
dbId
=
Integer
.
parseInt
(
args
[++
i
]);
dbId
=
Integer
.
parseInt
(
args
[++
i
]);
}
else
if
(
"-init"
.
equals
(
arg
))
{
}
else
if
(
"-init"
.
equals
(
arg
))
{
FileSystem
.
getInstance
(
"data"
).
deleteRecursive
(
"data"
);
FileSystem
.
getInstance
(
"data"
).
deleteRecursive
(
"data"
,
true
);
}
else
if
(
"-out"
.
equals
(
arg
))
{
}
else
if
(
"-out"
.
equals
(
arg
))
{
out
=
args
[++
i
];
out
=
args
[++
i
];
}
else
if
(
"-trace"
.
equals
(
arg
))
{
}
else
if
(
"-trace"
.
equals
(
arg
))
{
...
...
h2/src/test/org/h2/test/db/TestFullText.java
浏览文件 @
fb14587d
...
@@ -60,7 +60,7 @@ public class TestFullText extends TestBase {
...
@@ -60,7 +60,7 @@ public class TestFullText extends TestBase {
private
void
testCreateDrop
()
throws
SQLException
{
private
void
testCreateDrop
()
throws
SQLException
{
deleteDb
(
"fullText"
);
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
,
false
);
Connection
conn
=
getConnection
(
"fullText"
);
Connection
conn
=
getConnection
(
"fullText"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS IF NOT EXISTS FT_INIT FOR \"org.h2.fulltext.FullText.init\""
);
stat
.
execute
(
"CREATE ALIAS IF NOT EXISTS FT_INIT FOR \"org.h2.fulltext.FullText.init\""
);
...
@@ -71,13 +71,13 @@ public class TestFullText extends TestBase {
...
@@ -71,13 +71,13 @@ public class TestFullText extends TestBase {
}
}
conn
.
close
();
conn
.
close
();
deleteDb
(
"fullText"
);
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
,
false
);
}
}
private
void
testReopen
(
boolean
lucene
)
throws
SQLException
{
private
void
testReopen
(
boolean
lucene
)
throws
SQLException
{
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
deleteDb
(
"fullTextReopen"
);
deleteDb
(
"fullTextReopen"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullTextReopen"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullTextReopen"
,
false
);
Connection
conn
=
getConnection
(
"fullTextReopen"
);
Connection
conn
=
getConnection
(
"fullTextReopen"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
String
className
=
lucene
?
"FullTextLucene"
:
"FullText"
;
String
className
=
lucene
?
"FullTextLucene"
:
"FullText"
;
...
@@ -101,7 +101,7 @@ public class TestFullText extends TestBase {
...
@@ -101,7 +101,7 @@ public class TestFullText extends TestBase {
private
void
testPerformance
(
boolean
lucene
)
throws
SQLException
{
private
void
testPerformance
(
boolean
lucene
)
throws
SQLException
{
deleteDb
(
"fullText"
);
deleteDb
(
"fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
);
FileSystem
.
getInstance
(
baseDir
).
deleteRecursive
(
baseDir
+
"/fullText"
,
false
);
Connection
conn
=
getConnection
(
"fullText"
);
Connection
conn
=
getConnection
(
"fullText"
);
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
String
prefix
=
lucene
?
"FTL"
:
"FT"
;
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
...
...
h2/src/test/org/h2/test/unit/FileSystemDatabase.java
浏览文件 @
fb14587d
...
@@ -264,7 +264,7 @@ public class FileSystemDatabase extends FileSystem {
...
@@ -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"
);
throw
Message
.
getUnsupportedException
(
"db"
);
}
}
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
fb14587d
...
@@ -179,7 +179,7 @@ public class TestFileSystem extends TestBase {
...
@@ -179,7 +179,7 @@ public class TestFileSystem extends TestBase {
fs
.
createDirs
(
fsBase
+
"/testDir/test"
);
fs
.
createDirs
(
fsBase
+
"/testDir/test"
);
assertTrue
(
fs
.
isDirectory
(
fsBase
+
"/testDir"
));
assertTrue
(
fs
.
isDirectory
(
fsBase
+
"/testDir"
));
if
(!
fsBase
.
startsWith
(
"jdbc:"
))
{
if
(!
fsBase
.
startsWith
(
"jdbc:"
))
{
fs
.
deleteRecursive
(
fsBase
+
"/testDir"
);
fs
.
deleteRecursive
(
fsBase
+
"/testDir"
,
false
);
assertTrue
(!
fs
.
exists
(
fsBase
+
"/testDir"
));
assertTrue
(!
fs
.
exists
(
fsBase
+
"/testDir"
));
}
}
}
}
...
...
h2/src/test/org/h2/test/utils/FileSystemDebug.java
浏览文件 @
fb14587d
...
@@ -71,10 +71,10 @@ public class FileSystemDebug extends FileSystem {
...
@@ -71,10 +71,10 @@ public class FileSystemDebug extends FileSystem {
FileSystem
.
getInstance
(
fileName
).
delete
(
fileName
);
FileSystem
.
getInstance
(
fileName
).
delete
(
fileName
);
}
}
public
void
deleteRecursive
(
String
directory
)
throws
SQLException
{
public
void
deleteRecursive
(
String
directory
,
boolean
tryOnly
)
throws
SQLException
{
directory
=
translateFileName
(
directory
);
directory
=
translateFileName
(
directory
);
debug
(
"deleteRecursive"
,
directory
);
debug
(
"deleteRecursive"
,
directory
);
FileSystem
.
getInstance
(
directory
).
deleteRecursive
(
directory
);
FileSystem
.
getInstance
(
directory
).
deleteRecursive
(
directory
,
tryOnly
);
}
}
public
boolean
exists
(
String
fileName
)
{
public
boolean
exists
(
String
fileName
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论