Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
1f7ed15f
提交
1f7ed15f
authored
7月 23, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting.
上级
9abf5e1d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
914 行增加
和
861 行删除
+914
-861
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+287
-269
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+287
-269
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+275
-269
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
SysProperties.java
h2/src/main/org/h2/engine/SysProperties.java
+8
-5
FileStore.java
h2/src/main/org/h2/mvstore/FileStore.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+6
-5
MVStoreTool.java
h2/src/main/org/h2/mvstore/MVStoreTool.java
+6
-5
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+1
-1
FilePath.java
h2/src/main/org/h2/store/fs/FilePath.java
+2
-2
FilePathDisk.java
h2/src/main/org/h2/store/fs/FilePathDisk.java
+2
-1
FilePathMem.java
h2/src/main/org/h2/store/fs/FilePathMem.java
+1
-1
FilePathNioMem.java
h2/src/main/org/h2/store/fs/FilePathNioMem.java
+1
-1
FileUtils.java
h2/src/main/org/h2/store/fs/FileUtils.java
+3
-3
Utils.java
h2/src/main/org/h2/util/Utils.java
+9
-6
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+3
-3
TestMVStoreTool.java
h2/src/test/org/h2/test/store/TestMVStoreTool.java
+4
-3
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+16
-16
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-0
没有找到文件。
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
1f7ed15f
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
1f7ed15f
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
1f7ed15f
差异被折叠。
点击展开。
h2/src/main/org/h2/engine/Database.java
浏览文件 @
1f7ed15f
...
@@ -210,7 +210,7 @@ public class Database implements DataHandler {
...
@@ -210,7 +210,7 @@ public class Database implements DataHandler {
Constants
.
CACHE_SIZE_DEFAULT
);
Constants
.
CACHE_SIZE_DEFAULT
);
this
.
cacheSize
=
this
.
cacheSize
=
ci
.
getProperty
(
"CACHE_SIZE"
,
defaultCacheSize
);
ci
.
getProperty
(
"CACHE_SIZE"
,
defaultCacheSize
);
this
.
pageSize
=
ci
.
getProperty
(
"PAGE_SIZE"
,
this
.
pageSize
=
ci
.
getProperty
(
"PAGE_SIZE"
,
Constants
.
DEFAULT_PAGE_SIZE
);
Constants
.
DEFAULT_PAGE_SIZE
);
if
(
"r"
.
equals
(
accessModeData
))
{
if
(
"r"
.
equals
(
accessModeData
))
{
readOnly
=
true
;
readOnly
=
true
;
...
...
h2/src/main/org/h2/engine/SysProperties.java
浏览文件 @
1f7ed15f
...
@@ -250,7 +250,8 @@ public class SysProperties {
...
@@ -250,7 +250,8 @@ public class SysProperties {
Utils
.
getProperty
(
"h2.maxReconnect"
,
3
);
Utils
.
getProperty
(
"h2.maxReconnect"
,
3
);
/**
/**
* System property <code>h2.maxMemoryRows</code> (default: 40000 per GB of available RAM).<br />
* System property <code>h2.maxMemoryRows</code>
* (default: 40000 per GB of available RAM).<br />
* The default maximum number of rows to be kept in memory in a result set.
* The default maximum number of rows to be kept in memory in a result set.
*/
*/
public
static
final
int
MAX_MEMORY_ROWS
=
public
static
final
int
MAX_MEMORY_ROWS
=
...
@@ -534,10 +535,12 @@ public class SysProperties {
...
@@ -534,10 +535,12 @@ public class SysProperties {
public
static
String
getScriptDirectory
()
{
public
static
String
getScriptDirectory
()
{
return
Utils
.
getProperty
(
H2_SCRIPT_DIRECTORY
,
""
);
return
Utils
.
getProperty
(
H2_SCRIPT_DIRECTORY
,
""
);
}
}
/**
/**
* This method attempts to auto-scale some of our properties to take advantage of more powerful machines out of the box.
* This method attempts to auto-scale some of our properties to take
* We assume that our default properties are set correctly for approx. 1G of memory, and scale them up if we have more.
* advantage of more powerful machines out of the box. We assume that our
* default properties are set correctly for approx. 1G of memory, and scale
* them up if we have more.
*/
*/
private
static
int
getAutoScaledForMemoryProperty
(
String
key
,
int
defaultValue
)
{
private
static
int
getAutoScaledForMemoryProperty
(
String
key
,
int
defaultValue
)
{
String
s
=
Utils
.
getProperty
(
key
,
null
);
String
s
=
Utils
.
getProperty
(
key
,
null
);
...
@@ -550,5 +553,5 @@ public class SysProperties {
...
@@ -550,5 +553,5 @@ public class SysProperties {
}
}
return
Utils
.
scaleForAvailableMemory
(
defaultValue
);
return
Utils
.
scaleForAvailableMemory
(
defaultValue
);
}
}
}
}
h2/src/main/org/h2/mvstore/FileStore.java
浏览文件 @
1f7ed15f
...
@@ -361,7 +361,7 @@ public class FileStore {
...
@@ -361,7 +361,7 @@ public class FileStore {
/**
/**
* Get the file name.
* Get the file name.
*
*
* @return the file name
* @return the file name
*/
*/
public
String
getFileName
()
{
public
String
getFileName
()
{
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
1f7ed15f
...
@@ -299,7 +299,7 @@ public class MVStore {
...
@@ -299,7 +299,7 @@ public class MVStore {
o
=
config
.
get
(
"autoCompactFillRate"
);
o
=
config
.
get
(
"autoCompactFillRate"
);
autoCompactFillRate
=
o
==
null
?
80
:
(
Integer
)
o
;
autoCompactFillRate
=
o
==
null
?
80
:
(
Integer
)
o
;
char
[]
encryptionKey
=
(
char
[])
config
.
get
(
"encryptionKey"
);
char
[]
encryptionKey
=
(
char
[])
config
.
get
(
"encryptionKey"
);
try
{
try
{
if
(!
fileStoreIsProvided
)
{
if
(!
fileStoreIsProvided
)
{
...
@@ -1371,7 +1371,8 @@ public class MVStore {
...
@@ -1371,7 +1371,8 @@ public class MVStore {
* Chunks are overwritten irrespective of the current retention time. Before
* Chunks are overwritten irrespective of the current retention time. Before
* overwriting chunks and before resizing the file, syncFile() is called.
* overwriting chunks and before resizing the file, syncFile() is called.
*
*
* @param targetFillRate do nothing if the file store fill rate is higher than this
* @param targetFillRate do nothing if the file store fill rate is higher
* than this
* @param moveSize the number of bytes to move
* @param moveSize the number of bytes to move
* @return if anything was written
* @return if anything was written
*/
*/
...
@@ -2537,7 +2538,7 @@ public class MVStore {
...
@@ -2537,7 +2538,7 @@ public class MVStore {
public
Builder
autoCommitBufferSize
(
int
kb
)
{
public
Builder
autoCommitBufferSize
(
int
kb
)
{
return
set
(
"autoCommitBufferSize"
,
kb
);
return
set
(
"autoCommitBufferSize"
,
kb
);
}
}
/**
/**
* Set the auto-compact target fill rate. If the average fill rate (the
* Set the auto-compact target fill rate. If the average fill rate (the
* percentage of the storage space that contains active data) of the
* percentage of the storage space that contains active data) of the
...
@@ -2548,7 +2549,7 @@ public class MVStore {
...
@@ -2548,7 +2549,7 @@ public class MVStore {
* <p>
* <p>
* The default value is 80 (80%). The value 0 disables auto-compacting.
* The default value is 80 (80%). The value 0 disables auto-compacting.
* <p>
* <p>
*
*
* @param percent the target fill rate
* @param percent the target fill rate
* @return this
* @return this
*/
*/
...
@@ -2673,7 +2674,7 @@ public class MVStore {
...
@@ -2673,7 +2674,7 @@ public class MVStore {
* Please note that any kind of store (including an off-heap store) is
* Please note that any kind of store (including an off-heap store) is
* considered a "persistence", while an "in-memory store" means objects
* considered a "persistence", while an "in-memory store" means objects
* are not persisted and fully kept in the JVM heap.
* are not persisted and fully kept in the JVM heap.
*
*
* @param store the file store
* @param store the file store
* @return this
* @return this
*/
*/
...
...
h2/src/main/org/h2/mvstore/MVStoreTool.java
浏览文件 @
1f7ed15f
...
@@ -283,7 +283,7 @@ public class MVStoreTool {
...
@@ -283,7 +283,7 @@ public class MVStoreTool {
pw
.
printf
(
"Chunk length: %d\n"
,
chunkLength
);
pw
.
printf
(
"Chunk length: %d\n"
,
chunkLength
);
pw
.
printf
(
"Chunk count: %d\n"
,
chunks
.
size
());
pw
.
printf
(
"Chunk count: %d\n"
,
chunks
.
size
());
pw
.
printf
(
"Used space: %d%%\n"
,
100
*
chunkLength
/
fileLength
);
pw
.
printf
(
"Used space: %d%%\n"
,
100
*
chunkLength
/
fileLength
);
pw
.
printf
(
"Chunk fill rate: %d%%\n"
,
maxLength
==
0
?
100
:
pw
.
printf
(
"Chunk fill rate: %d%%\n"
,
maxLength
==
0
?
100
:
100
*
maxLengthLive
/
maxLength
);
100
*
maxLengthLive
/
maxLength
);
for
(
Entry
<
Integer
,
Chunk
>
e
:
chunks
.
entrySet
())
{
for
(
Entry
<
Integer
,
Chunk
>
e
:
chunks
.
entrySet
())
{
Chunk
c
=
e
.
getValue
();
Chunk
c
=
e
.
getValue
();
...
@@ -316,7 +316,7 @@ public class MVStoreTool {
...
@@ -316,7 +316,7 @@ public class MVStoreTool {
* the new file is renamed to ".newFile", then the old file is removed, and
* the new file is renamed to ".newFile", then the old file is removed, and
* the new file is renamed. This might be interrupted, so it's better to
* the new file is renamed. This might be interrupted, so it's better to
* compactCleanUp before opening a store, in case this method was used.
* compactCleanUp before opening a store, in case this method was used.
*
*
* @param fileName the file name
* @param fileName the file name
* @param compress whether to compress the data
* @param compress whether to compress the data
*/
*/
...
@@ -334,13 +334,13 @@ public class MVStoreTool {
...
@@ -334,13 +334,13 @@ public class MVStoreTool {
FileUtils
.
move
(
newName
,
fileName
);
FileUtils
.
move
(
newName
,
fileName
);
}
}
}
}
/**
/**
* Clean up if needed, in a case a compact operation was interrupted due to
* Clean up if needed, in a case a compact operation was interrupted due to
* killing the process or a power failure. This will delete temporary files
* killing the process or a power failure. This will delete temporary files
* (if any), and in case atomic file replacements were not used, rename the
* (if any), and in case atomic file replacements were not used, rename the
* new file.
* new file.
*
*
* @param fileName the file name
* @param fileName the file name
*/
*/
public
static
void
compactCleanUp
(
String
fileName
)
{
public
static
void
compactCleanUp
(
String
fileName
)
{
...
@@ -363,6 +363,7 @@ public class MVStoreTool {
...
@@ -363,6 +363,7 @@ public class MVStoreTool {
*
*
* @param sourceFileName the name of the source store
* @param sourceFileName the name of the source store
* @param targetFileName the name of the target store
* @param targetFileName the name of the target store
* @param compress whether to compress the data
*/
*/
public
static
void
compact
(
String
sourceFileName
,
String
targetFileName
,
boolean
compress
)
{
public
static
void
compact
(
String
sourceFileName
,
String
targetFileName
,
boolean
compress
)
{
MVStore
source
=
new
MVStore
.
Builder
().
MVStore
source
=
new
MVStore
.
Builder
().
...
@@ -380,7 +381,7 @@ public class MVStoreTool {
...
@@ -380,7 +381,7 @@ public class MVStoreTool {
target
.
close
();
target
.
close
();
source
.
close
();
source
.
close
();
}
}
/**
/**
* Copy all live pages from the source store to the target store.
* Copy all live pages from the source store to the target store.
*
*
...
...
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
1f7ed15f
...
@@ -333,7 +333,7 @@ public class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -333,7 +333,7 @@ public class MVSecondaryIndex extends BaseIndex implements MVIndex {
* @return the row
* @return the row
*/
*/
SearchRow
convertToSearchRow
(
ValueArray
key
)
{
SearchRow
convertToSearchRow
(
ValueArray
key
)
{
Value
[]
array
=
key
.
getList
();
Value
[]
array
=
key
.
getList
();
SearchRow
searchRow
=
mvTable
.
getTemplateRow
();
SearchRow
searchRow
=
mvTable
.
getTemplateRow
();
searchRow
.
setKey
((
array
[
array
.
length
-
1
]).
getLong
());
searchRow
.
setKey
((
array
[
array
.
length
-
1
]).
getLong
());
Column
[]
cols
=
getColumns
();
Column
[]
cols
=
getColumns
();
...
...
h2/src/main/org/h2/store/fs/FilePath.java
浏览文件 @
1f7ed15f
...
@@ -124,8 +124,8 @@ public abstract class FilePath {
...
@@ -124,8 +124,8 @@ public abstract class FilePath {
* Rename a file if this is allowed.
* Rename a file if this is allowed.
*
*
* @param newName the new fully qualified file name
* @param newName the new fully qualified file name
* @param atomicReplace whether the move should be atomic, and the target
file
* @param atomicReplace whether the move should be atomic, and the target
* should be replaced if it exists and replacing is possible
*
file
should be replaced if it exists and replacing is possible
*/
*/
public
abstract
void
moveTo
(
FilePath
newName
,
boolean
atomicReplace
);
public
abstract
void
moveTo
(
FilePath
newName
,
boolean
atomicReplace
);
...
...
h2/src/main/org/h2/store/fs/FilePathDisk.java
浏览文件 @
1f7ed15f
...
@@ -90,7 +90,8 @@ public class FilePathDisk extends FilePath {
...
@@ -90,7 +90,8 @@ public class FilePathDisk extends FilePath {
name
+
" (not found)"
,
name
+
" (not found)"
,
newName
.
name
);
newName
.
name
);
}
}
// Java 7: use java.nio.file.Files.move(Path source, Path target, CopyOption... options)
// Java 7: use java.nio.file.Files.move(Path source, Path target,
// CopyOption... options)
// with CopyOptions "REPLACE_EXISTING" and "ATOMIC_MOVE".
// with CopyOptions "REPLACE_EXISTING" and "ATOMIC_MOVE".
if
(
atomicReplace
)
{
if
(
atomicReplace
)
{
boolean
ok
=
oldFile
.
renameTo
(
newFile
);
boolean
ok
=
oldFile
.
renameTo
(
newFile
);
...
...
h2/src/main/org/h2/store/fs/FilePathMem.java
浏览文件 @
1f7ed15f
...
@@ -49,7 +49,7 @@ public class FilePathMem extends FilePath {
...
@@ -49,7 +49,7 @@ public class FilePathMem extends FilePath {
@Override
@Override
public
void
moveTo
(
FilePath
newName
,
boolean
atomicReplace
)
{
public
void
moveTo
(
FilePath
newName
,
boolean
atomicReplace
)
{
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
if
(!
atomicReplace
&&
!
newName
.
name
.
equals
(
name
)
&&
if
(!
atomicReplace
&&
!
newName
.
name
.
equals
(
name
)
&&
MEMORY_FILES
.
containsKey
(
newName
.
name
))
{
MEMORY_FILES
.
containsKey
(
newName
.
name
))
{
throw
DbException
.
get
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
throw
DbException
.
get
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]
{
name
,
newName
+
" (exists)"
});
new
String
[]
{
name
,
newName
+
" (exists)"
});
...
...
h2/src/main/org/h2/store/fs/FilePathNioMem.java
浏览文件 @
1f7ed15f
...
@@ -48,7 +48,7 @@ public class FilePathNioMem extends FilePath {
...
@@ -48,7 +48,7 @@ public class FilePathNioMem extends FilePath {
@Override
@Override
public
void
moveTo
(
FilePath
newName
,
boolean
atomicReplace
)
{
public
void
moveTo
(
FilePath
newName
,
boolean
atomicReplace
)
{
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
if
(!
atomicReplace
&&
!
name
.
equals
(
newName
.
name
)
&&
if
(!
atomicReplace
&&
!
name
.
equals
(
newName
.
name
)
&&
MEMORY_FILES
.
containsKey
(
newName
.
name
))
{
MEMORY_FILES
.
containsKey
(
newName
.
name
))
{
throw
DbException
.
get
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
throw
DbException
.
get
(
ErrorCode
.
FILE_RENAME_FAILED_2
,
new
String
[]
{
name
,
newName
+
" (exists)"
});
new
String
[]
{
name
,
newName
+
" (exists)"
});
...
...
h2/src/main/org/h2/store/fs/FileUtils.java
浏览文件 @
1f7ed15f
...
@@ -104,19 +104,19 @@ public class FileUtils {
...
@@ -104,19 +104,19 @@ public class FileUtils {
/**
/**
* Rename a file if this is allowed. This method is similar to Java 7
* Rename a file if this is allowed. This method is similar to Java 7
* <code>java.nio.file.Files.move</code>.
* <code>java.nio.file.Files.move</code>.
*
*
* @param source the old fully qualified file name
* @param source the old fully qualified file name
* @param target the new fully qualified file name
* @param target the new fully qualified file name
*/
*/
public
static
void
move
(
String
source
,
String
target
)
{
public
static
void
move
(
String
source
,
String
target
)
{
FilePath
.
get
(
source
).
moveTo
(
FilePath
.
get
(
target
),
false
);
FilePath
.
get
(
source
).
moveTo
(
FilePath
.
get
(
target
),
false
);
}
}
/**
/**
* Rename a file if this is allowed, and try to atomically replace an
* Rename a file if this is allowed, and try to atomically replace an
* existing file. This method is similar to Java 7
* existing file. This method is similar to Java 7
* <code>java.nio.file.Files.move</code>.
* <code>java.nio.file.Files.move</code>.
*
*
* @param source the old fully qualified file name
* @param source the old fully qualified file name
* @param target the new fully qualified file name
* @param target the new fully qualified file name
*/
*/
...
...
h2/src/main/org/h2/util/Utils.java
浏览文件 @
1f7ed15f
...
@@ -736,11 +736,12 @@ public class Utils {
...
@@ -736,11 +736,12 @@ public class Utils {
}
}
return
defaultValue
;
return
defaultValue
;
}
}
/**
/**
* Scale the value with the available memory. If 1 GB of RAM is available,
* Scale the value with the available memory. If 1 GB of RAM is available,
* the value is returned, if 2 GB are available, then twice the value, and so on.
* the value is returned, if 2 GB are available, then twice the value, and
*
* so on.
*
* @param value the value to scale
* @param value the value to scale
* @return the scaled value
* @return the scaled value
*/
*/
...
@@ -753,12 +754,14 @@ public class Utils {
...
@@ -753,12 +754,14 @@ public class Utils {
try
{
try
{
OperatingSystemMXBean
mxBean
=
ManagementFactory
OperatingSystemMXBean
mxBean
=
ManagementFactory
.
getOperatingSystemMXBean
();
.
getOperatingSystemMXBean
();
// this method is only available on the class com.sun.management.OperatingSystemMXBean, which mxBean
// this method is only available on the class
// is an instance of under the Oracle JDK, but it is not present on Android and other JDK's
// com.sun.management.OperatingSystemMXBean, which mxBean
// is an instance of under the Oracle JDK, but it is not present on
// Android and other JDK's
Method
method
=
Class
.
forName
(
Method
method
=
Class
.
forName
(
"com.sun.management.OperatingSystemMXBean"
).
"com.sun.management.OperatingSystemMXBean"
).
getMethod
(
"getTotalPhysicalMemorySize"
);
getMethod
(
"getTotalPhysicalMemorySize"
);
long
physicalMemorySize
=
((
Number
)
method
.
invoke
(
mxBean
)).
longValue
();
long
physicalMemorySize
=
((
Number
)
method
.
invoke
(
mxBean
)).
longValue
();
return
(
int
)
(
value
*
physicalMemorySize
/
(
1024
*
1024
*
1024
));
return
(
int
)
(
value
*
physicalMemorySize
/
(
1024
*
1024
*
1024
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// ignore
// ignore
...
...
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
1f7ed15f
...
@@ -111,17 +111,17 @@ public class TestMVStore extends TestBase {
...
@@ -111,17 +111,17 @@ public class TestMVStore extends TestBase {
// longer running tests
// longer running tests
testLargerThan2G
();
testLargerThan2G
();
}
}
private
void
testProvidedFileStoreNotOpenedAndClosed
()
{
private
void
testProvidedFileStoreNotOpenedAndClosed
()
{
final
AtomicInteger
openClose
=
new
AtomicInteger
();
final
AtomicInteger
openClose
=
new
AtomicInteger
();
FileStore
fileStore
=
new
OffHeapStore
()
{
FileStore
fileStore
=
new
OffHeapStore
()
{
@Override
@Override
public
void
open
(
String
fileName
,
boolean
readOnly
,
char
[]
encryptionKey
)
{
public
void
open
(
String
fileName
,
boolean
readOnly
,
char
[]
encryptionKey
)
{
openClose
.
incrementAndGet
();
openClose
.
incrementAndGet
();
super
.
open
(
fileName
,
readOnly
,
encryptionKey
);
super
.
open
(
fileName
,
readOnly
,
encryptionKey
);
}
}
@Override
@Override
public
void
close
()
{
public
void
close
()
{
openClose
.
incrementAndGet
();
openClose
.
incrementAndGet
();
...
...
h2/src/test/org/h2/test/store/TestMVStoreTool.java
浏览文件 @
1f7ed15f
...
@@ -75,7 +75,7 @@ public class TestMVStoreTool extends TestBase {
...
@@ -75,7 +75,7 @@ public class TestMVStoreTool extends TestBase {
}
}
}
}
s
.
close
();
s
.
close
();
MVStoreTool
.
compact
(
fileName
,
fileName
+
".new"
,
false
);
MVStoreTool
.
compact
(
fileName
,
fileName
+
".new"
,
false
);
MVStoreTool
.
compact
(
fileName
,
fileName
+
".new.compress"
,
true
);
MVStoreTool
.
compact
(
fileName
,
fileName
+
".new.compress"
,
true
);
MVStore
s1
=
new
MVStore
.
Builder
().
MVStore
s1
=
new
MVStore
.
Builder
().
...
@@ -92,7 +92,8 @@ public class TestMVStoreTool extends TestBase {
...
@@ -92,7 +92,8 @@ public class TestMVStoreTool extends TestBase {
long
size1
=
FileUtils
.
size
(
fileName
);
long
size1
=
FileUtils
.
size
(
fileName
);
long
size2
=
FileUtils
.
size
(
fileName
+
".new"
);
long
size2
=
FileUtils
.
size
(
fileName
+
".new"
);
long
size3
=
FileUtils
.
size
(
fileName
+
".new.compress"
);
long
size3
=
FileUtils
.
size
(
fileName
+
".new.compress"
);
assertTrue
(
"size1: "
+
size1
+
" size2: "
+
size2
+
" size3: "
+
size3
,
size2
<
size1
&&
size3
<
size2
);
assertTrue
(
"size1: "
+
size1
+
" size2: "
+
size2
+
" size3: "
+
size3
,
size2
<
size1
&&
size3
<
size2
);
MVStoreTool
.
compact
(
fileName
,
false
);
MVStoreTool
.
compact
(
fileName
,
false
);
assertEquals
(
size2
,
FileUtils
.
size
(
fileName
));
assertEquals
(
size2
,
FileUtils
.
size
(
fileName
));
MVStoreTool
.
compact
(
fileName
,
true
);
MVStoreTool
.
compact
(
fileName
,
true
);
...
@@ -112,7 +113,7 @@ public class TestMVStoreTool extends TestBase {
...
@@ -112,7 +113,7 @@ public class TestMVStoreTool extends TestBase {
Object
x
=
mb
.
get
(
e
.
getKey
());
Object
x
=
mb
.
get
(
e
.
getKey
());
assertEquals
(
e
.
getValue
().
toString
(),
x
.
toString
());
assertEquals
(
e
.
getValue
().
toString
(),
x
.
toString
());
}
}
}
else
{
}
else
{
MVMap
<?,
?>
ma
=
a
.
openMap
(
mapName
);
MVMap
<?,
?>
ma
=
a
.
openMap
(
mapName
);
MVMap
<?,
?>
mb
=
a
.
openMap
(
mapName
);
MVMap
<?,
?>
mb
=
a
.
openMap
(
mapName
);
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
1f7ed15f
...
@@ -350,33 +350,33 @@ public class TestFileSystem extends TestBase {
...
@@ -350,33 +350,33 @@ public class TestFileSystem extends TestBase {
}
}
private
void
testReadOnly
(
final
String
f
)
throws
IOException
{
private
void
testReadOnly
(
final
String
f
)
throws
IOException
{
new
AssertThrows
(
IOException
.
class
)
{
new
AssertThrows
(
IOException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
FileUtils
.
newOutputStream
(
f
,
false
);
FileUtils
.
newOutputStream
(
f
,
false
);
}};
}};
new
AssertThrows
(
DbException
.
class
)
{
new
AssertThrows
(
DbException
.
class
)
{
@Override
@Override
public
void
test
()
{
public
void
test
()
{
FileUtils
.
move
(
f
,
f
);
FileUtils
.
move
(
f
,
f
);
}};
}};
new
AssertThrows
(
DbException
.
class
)
{
new
AssertThrows
(
DbException
.
class
)
{
@Override
@Override
public
void
test
()
{
public
void
test
()
{
FileUtils
.
move
(
f
,
f
);
FileUtils
.
move
(
f
,
f
);
}};
}};
new
AssertThrows
(
IOException
.
class
)
{
new
AssertThrows
(
IOException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
FileUtils
.
createTempFile
(
f
,
".tmp"
,
false
,
false
);
FileUtils
.
createTempFile
(
f
,
".tmp"
,
false
,
false
);
}};
}};
final
FileChannel
channel
=
FileUtils
.
open
(
f
,
"r"
);
final
FileChannel
channel
=
FileUtils
.
open
(
f
,
"r"
);
new
AssertThrows
(
IOException
.
class
)
{
new
AssertThrows
(
IOException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
write
(
ByteBuffer
.
allocate
(
1
));
channel
.
write
(
ByteBuffer
.
allocate
(
1
));
}};
}};
new
AssertThrows
(
IOException
.
class
)
{
new
AssertThrows
(
IOException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
truncate
(
0
);
channel
.
truncate
(
0
);
...
@@ -419,12 +419,12 @@ public class TestFileSystem extends TestBase {
...
@@ -419,12 +419,12 @@ public class TestFileSystem extends TestBase {
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName
);
}
}
if
(
FileUtils
.
createFile
(
fileName
))
{
if
(
FileUtils
.
createFile
(
fileName
))
{
new
AssertThrows
(
DbException
.
class
)
{
new
AssertThrows
(
DbException
.
class
)
{
@Override
@Override
public
void
test
()
{
public
void
test
()
{
FileUtils
.
createDirectory
(
fileName
);
FileUtils
.
createDirectory
(
fileName
);
}};
}};
new
AssertThrows
(
DbException
.
class
)
{
new
AssertThrows
(
DbException
.
class
)
{
@Override
@Override
public
void
test
()
{
public
void
test
()
{
FileUtils
.
createDirectories
(
fileName
+
"/test"
);
FileUtils
.
createDirectories
(
fileName
+
"/test"
);
...
@@ -442,14 +442,14 @@ public class TestFileSystem extends TestBase {
...
@@ -442,14 +442,14 @@ public class TestFileSystem extends TestBase {
if
(
FileUtils
.
createFile
(
fileName
))
{
if
(
FileUtils
.
createFile
(
fileName
))
{
FileUtils
.
move
(
fileName
,
fileName2
);
FileUtils
.
move
(
fileName
,
fileName2
);
FileUtils
.
createFile
(
fileName
);
FileUtils
.
createFile
(
fileName
);
new
AssertThrows
(
DbException
.
class
)
{
new
AssertThrows
(
DbException
.
class
)
{
@Override
@Override
public
void
test
()
{
public
void
test
()
{
FileUtils
.
move
(
fileName2
,
fileName
);
FileUtils
.
move
(
fileName2
,
fileName
);
}};
}};
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName2
);
FileUtils
.
delete
(
fileName2
);
new
AssertThrows
(
DbException
.
class
)
{
new
AssertThrows
(
DbException
.
class
)
{
@Override
@Override
public
void
test
()
{
public
void
test
()
{
FileUtils
.
move
(
fileName
,
fileName2
);
FileUtils
.
move
(
fileName
,
fileName2
);
...
@@ -464,32 +464,32 @@ public class TestFileSystem extends TestBase {
...
@@ -464,32 +464,32 @@ public class TestFileSystem extends TestBase {
}
}
if
(
FileUtils
.
createFile
(
fileName
))
{
if
(
FileUtils
.
createFile
(
fileName
))
{
final
FileChannel
channel
=
FileUtils
.
open
(
fileName
,
"rw"
);
final
FileChannel
channel
=
FileUtils
.
open
(
fileName
,
"rw"
);
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
map
(
MapMode
.
PRIVATE
,
0
,
channel
.
size
());
channel
.
map
(
MapMode
.
PRIVATE
,
0
,
channel
.
size
());
}};
}};
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
read
(
new
ByteBuffer
[]{
ByteBuffer
.
allocate
(
10
)},
0
,
0
);
channel
.
read
(
new
ByteBuffer
[]{
ByteBuffer
.
allocate
(
10
)},
0
,
0
);
}};
}};
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
write
(
new
ByteBuffer
[]{
ByteBuffer
.
allocate
(
10
)},
0
,
0
);
channel
.
write
(
new
ByteBuffer
[]{
ByteBuffer
.
allocate
(
10
)},
0
,
0
);
}};
}};
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
transferFrom
(
channel
,
0
,
0
);
channel
.
transferFrom
(
channel
,
0
,
0
);
}};
}};
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
transferTo
(
0
,
0
,
channel
);
channel
.
transferTo
(
0
,
0
,
channel
);
}};
}};
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
new
AssertThrows
(
UnsupportedOperationException
.
class
)
{
@Override
@Override
public
void
test
()
throws
IOException
{
public
void
test
()
throws
IOException
{
channel
.
lock
();
channel
.
lock
();
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
1f7ed15f
...
@@ -761,3 +761,4 @@ reinstated uninteresting dead defendant doctrines beat factual fair suspended
...
@@ -761,3 +761,4 @@ reinstated uninteresting dead defendant doctrines beat factual fair suspended
exploit noise ongoing disclaimers shrinks remedy party desirable timely construe
exploit noise ongoing disclaimers shrinks remedy party desirable timely construe
deque synchronizers affero kevent nikolaj hohmuth grajcar jens fogh hostnames
deque synchronizers affero kevent nikolaj hohmuth grajcar jens fogh hostnames
operate resized jni yjp ownable starvation reaper biased introduce epoll hangs
operate resized jni yjp ownable starvation reaper biased introduce epoll hangs
compaction aggressive powerful
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论