Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3bf8fd6a
Unverified
提交
3bf8fd6a
authored
6 年前
作者:
Noel Grandin
提交者:
GitHub
6 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1241 from grandinj/misc1
Various tweaks in attempting to fix TestDiskFull test
上级
b523811f
21dff6f9
master
version-1.4.198
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
84 行增加
和
21 行删除
+84
-21
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+6
-3
FakeFileChannel.java
h2/src/main/org/h2/store/fs/FakeFileChannel.java
+8
-0
FilePathMem.java
h2/src/main/org/h2/store/fs/FilePathMem.java
+27
-6
FilePathNioMem.java
h2/src/main/org/h2/store/fs/FilePathNioMem.java
+20
-4
FilePathZip.java
h2/src/main/org/h2/store/fs/FilePathZip.java
+1
-2
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+21
-4
FilePathZip2.java
h2/src/tools/org/h2/dev/fs/FilePathZip2.java
+1
-2
没有找到文件。
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
3bf8fd6a
...
...
@@ -10,7 +10,6 @@ import java.util.Iterator;
import
java.util.List
;
import
java.util.PriorityQueue
;
import
java.util.Queue
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.dml.AllColumnsForPlan
;
import
org.h2.engine.Database
;
...
...
@@ -69,7 +68,9 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
dataMap
=
t
.
openMap
(
mapName
,
keyType
,
valueType
);
t
.
commit
();
if
(!
keyType
.
equals
(
dataMap
.
getKeyType
()))
{
throw
DbException
.
throwInternalError
(
"Incompatible key type"
);
throw
DbException
.
throwInternalError
(
"Incompatible key type, expected "
+
keyType
+
" but got "
+
dataMap
.
getKeyType
()
+
" for index "
+
indexName
);
}
}
...
...
@@ -174,7 +175,9 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
MVMap
<
ValueArray
,
Value
>
map
=
database
.
getMvStore
().
getStore
().
openMap
(
mapName
,
builder
);
if
(!
keyType
.
equals
(
map
.
getKeyType
()))
{
throw
DbException
.
throwInternalError
(
"Incompatible key type"
);
throw
DbException
.
throwInternalError
(
"Incompatible key type, expected "
+
keyType
+
" but got "
+
map
.
getKeyType
()
+
" for map "
+
mapName
);
}
return
map
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FakeFileChannel.java
浏览文件 @
3bf8fd6a
...
...
@@ -17,6 +17,14 @@ import java.nio.channels.WritableByteChannel;
* Fake file channel to use by in-memory and ZIP file systems.
*/
public
class
FakeFileChannel
extends
FileChannel
{
/**
* No need to allocate these, they have no state
*/
public
static
final
FakeFileChannel
INSTANCE
=
new
FakeFileChannel
();
private
FakeFileChannel
()
{}
@Override
protected
void
implCloseChannel
()
throws
IOException
{
throw
new
IOException
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathMem.java
浏览文件 @
3bf8fd6a
...
...
@@ -9,6 +9,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.ClosedChannelException
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileLock
;
import
java.nio.channels.NonWritableChannelException
;
...
...
@@ -19,7 +20,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.concurrent.atomic.AtomicReference
;
import
org.h2.api.ErrorCode
;
import
org.h2.compress.CompressLZF
;
import
org.h2.message.DbException
;
...
...
@@ -268,7 +268,7 @@ class FileMem extends FileBase {
/**
* The file data.
*/
final
FileMemData
data
;
FileMemData
data
;
private
final
boolean
readOnly
;
private
long
pos
;
...
...
@@ -289,6 +289,9 @@ class FileMem extends FileBase {
if
(
readOnly
)
{
throw
new
NonWritableChannelException
();
}
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
if
(
newLength
<
size
())
{
data
.
touch
(
readOnly
);
pos
=
Math
.
min
(
pos
,
newLength
);
...
...
@@ -305,6 +308,9 @@ class FileMem extends FileBase {
@Override
public
int
write
(
ByteBuffer
src
,
long
position
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
src
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -318,6 +324,9 @@ class FileMem extends FileBase {
@Override
public
int
write
(
ByteBuffer
src
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
src
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -331,6 +340,9 @@ class FileMem extends FileBase {
@Override
public
int
read
(
ByteBuffer
dst
,
long
position
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
dst
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -347,6 +359,9 @@ class FileMem extends FileBase {
@Override
public
int
read
(
ByteBuffer
dst
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
dst
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -370,6 +385,7 @@ class FileMem extends FileBase {
@Override
public
void
implCloseChannel
()
throws
IOException
{
pos
=
0
;
data
=
null
;
}
@Override
...
...
@@ -380,6 +396,9 @@ class FileMem extends FileBase {
@Override
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
if
(
shared
)
{
if
(!
data
.
lockShared
())
{
return
null
;
...
...
@@ -390,7 +409,7 @@ class FileMem extends FileBase {
}
}
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
@@ -406,7 +425,7 @@ class FileMem extends FileBase {
@Override
public
String
toString
()
{
return
data
.
getName
();
return
data
==
null
?
"<closed>"
:
data
.
getName
();
}
}
...
...
@@ -521,11 +540,13 @@ class FileMemData {
/**
* Unlock the file.
*/
synchronized
void
unlock
()
{
synchronized
void
unlock
()
throws
IOException
{
if
(
isLockedExclusive
)
{
isLockedExclusive
=
false
;
}
else
if
(
sharedLockCount
>
0
)
{
sharedLockCount
--;
}
else
{
sharedLockCount
=
Math
.
max
(
0
,
sharedLockCount
-
1
);
throw
new
IOException
(
"not locked"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathNioMem.java
浏览文件 @
3bf8fd6a
...
...
@@ -9,6 +9,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.ClosedChannelException
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileLock
;
import
java.nio.channels.NonWritableChannelException
;
...
...
@@ -19,7 +20,6 @@ import java.util.Map;
import
java.util.TreeMap
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.locks.ReentrantReadWriteLock
;
import
org.h2.api.ErrorCode
;
import
org.h2.compress.CompressLZF
;
import
org.h2.message.DbException
;
...
...
@@ -277,7 +277,7 @@ class FileNioMem extends FileBase {
/**
* The file data.
*/
final
FileNioMemData
data
;
FileNioMemData
data
;
private
final
boolean
readOnly
;
private
long
pos
;
...
...
@@ -298,6 +298,9 @@ class FileNioMem extends FileBase {
if
(
readOnly
)
{
throw
new
NonWritableChannelException
();
}
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
if
(
newLength
<
size
())
{
data
.
touch
(
readOnly
);
pos
=
Math
.
min
(
pos
,
newLength
);
...
...
@@ -314,6 +317,9 @@ class FileNioMem extends FileBase {
@Override
public
int
write
(
ByteBuffer
src
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
src
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -327,6 +333,9 @@ class FileNioMem extends FileBase {
@Override
public
int
read
(
ByteBuffer
dst
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
dst
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -343,6 +352,9 @@ class FileNioMem extends FileBase {
@Override
public
int
read
(
ByteBuffer
dst
,
long
position
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
int
len
=
dst
.
remaining
();
if
(
len
==
0
)
{
return
0
;
...
...
@@ -365,6 +377,7 @@ class FileNioMem extends FileBase {
@Override
public
void
implCloseChannel
()
throws
IOException
{
pos
=
0
;
data
=
null
;
}
@Override
...
...
@@ -375,6 +388,9 @@ class FileNioMem extends FileBase {
@Override
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
if
(
data
==
null
)
{
throw
new
ClosedChannelException
();
}
if
(
shared
)
{
if
(!
data
.
lockShared
())
{
return
null
;
...
...
@@ -385,7 +401,7 @@ class FileNioMem extends FileBase {
}
}
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
@@ -401,7 +417,7 @@ class FileNioMem extends FileBase {
@Override
public
String
toString
()
{
return
data
.
getName
();
return
data
==
null
?
"<closed>"
:
data
.
getName
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathZip.java
浏览文件 @
3bf8fd6a
...
...
@@ -16,7 +16,6 @@ import java.util.ArrayList;
import
java.util.Enumeration
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
org.h2.message.DbException
;
import
org.h2.util.IOUtils
;
...
...
@@ -354,7 +353,7 @@ class FileZip extends FileBase {
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
if
(
shared
)
{
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
3bf8fd6a
...
...
@@ -14,7 +14,6 @@ import java.io.Reader;
import
java.nio.charset.StandardCharsets
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Mode
;
import
org.h2.engine.SysProperties
;
...
...
@@ -45,20 +44,38 @@ public class ValueLobDb extends Value {
* the value type (Value.BLOB or CLOB)
*/
private
final
int
valueType
;
/**
* If the LOB is managed by the one the LobStorageBackend classes, these are the
* unique key inside that storage.
*/
private
final
int
tableId
;
private
final
long
lobId
;
/**
* If this is a client-side ValueLobDb object returned by a ResultSet, the
* hmac acts a security cookie that the client can send back to the server
* to ask for data related to this LOB.
*/
private
final
byte
[]
hmac
;
/**
* If the LOB is below the inline size, we just store/load it directly
* here.
*/
private
final
byte
[]
small
;
private
final
DataHandler
handler
;
/**
* For a BLOB, precision is length in bytes.
* For a CLOB, precision is length in chars.
*/
private
final
long
precision
;
/**
* If the LOB is a temporary LOB being managed by a temporary ResultSet,
* it is stored in a temporary file.
*/
private
final
String
fileName
;
private
final
FileStore
tempFile
;
private
final
int
tableId
;
/**
* Cache the hashCode because it can be expensive to compute.
*/
private
int
hash
;
//Arbonaut: 13.07.2016
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/fs/FilePathZip2.java
浏览文件 @
3bf8fd6a
...
...
@@ -15,7 +15,6 @@ import java.nio.channels.FileLock;
import
java.util.ArrayList
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
import
org.h2.engine.Constants
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FakeFileChannel
;
...
...
@@ -427,7 +426,7 @@ class FileZip2 extends FileBase {
public
synchronized
FileLock
tryLock
(
long
position
,
long
size
,
boolean
shared
)
throws
IOException
{
if
(
shared
)
{
return
new
FileLock
(
new
FakeFileChannel
()
,
position
,
size
,
shared
)
{
return
new
FileLock
(
FakeFileChannel
.
INSTANCE
,
position
,
size
,
shared
)
{
@Override
public
boolean
isValid
()
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论