Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7926b5b1
提交
7926b5b1
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove SysProperties.CHECK preconditions around simple assertions
上级
88f32032
master
version-1.4.198
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
28 个修改的文件
包含
63 行增加
和
116 行删除
+63
-116
Select.java
h2/src/main/org/h2/command/dml/Select.java
+2
-3
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+2
-3
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+5
-8
DbObjectBase.java
h2/src/main/org/h2/engine/DbObjectBase.java
+1
-1
Session.java
h2/src/main/org/h2/engine/Session.java
+3
-5
UndoLogRecord.java
h2/src/main/org/h2/engine/UndoLogRecord.java
+2
-4
Comparison.java
h2/src/main/org/h2/expression/condition/Comparison.java
+1
-2
ConditionAndOr.java
h2/src/main/org/h2/expression/condition/ConditionAndOr.java
+1
-2
PageBtreeIndex.java
h2/src/main/org/h2/index/PageBtreeIndex.java
+1
-1
PageBtreeLeaf.java
h2/src/main/org/h2/index/PageBtreeLeaf.java
+1
-2
PageBtreeNode.java
h2/src/main/org/h2/index/PageBtreeNode.java
+1
-2
PageDataLeaf.java
h2/src/main/org/h2/index/PageDataLeaf.java
+1
-2
PageDataOverflow.java
h2/src/main/org/h2/index/PageDataOverflow.java
+1
-2
TreeIndex.java
h2/src/main/org/h2/index/TreeIndex.java
+1
-2
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+2
-2
Schema.java
h2/src/main/org/h2/schema/Schema.java
+1
-1
XTEA.java
h2/src/main/org/h2/security/XTEA.java
+4
-9
FileStore.java
h2/src/main/org/h2/store/FileStore.java
+4
-7
PageLog.java
h2/src/main/org/h2/store/PageLog.java
+2
-5
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+4
-8
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+1
-1
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+2
-3
CacheLRU.java
h2/src/main/org/h2/util/CacheLRU.java
+7
-12
CacheObject.java
h2/src/main/org/h2/util/CacheObject.java
+2
-5
IntArray.java
h2/src/main/org/h2/util/IntArray.java
+6
-15
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+3
-7
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
7926b5b1
...
...
@@ -16,7 +16,6 @@ import org.h2.command.Parser;
import
org.h2.engine.Constants
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.expression.Alias
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
...
...
@@ -963,7 +962,7 @@ public class Select extends Query {
@Override
public
void
init
()
{
if
(
SysProperties
.
CHECK
&&
checkInit
)
{
if
(
checkInit
)
{
DbException
.
throwInternalError
();
}
expandColumnList
();
...
...
@@ -1079,7 +1078,7 @@ public class Select extends Query {
// sometimes a subquery is prepared twice (CREATE TABLE AS SELECT)
return
;
}
if
(
SysProperties
.
CHECK
&&
!
checkInit
)
{
if
(!
checkInit
)
{
DbException
.
throwInternalError
(
"not initialized"
);
}
if
(
orderList
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
7926b5b1
...
...
@@ -12,7 +12,6 @@ import org.h2.api.ErrorCode;
import
org.h2.engine.Database
;
import
org.h2.engine.Mode
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.ExpressionVisitor
;
...
...
@@ -283,7 +282,7 @@ public class SelectUnion extends Query {
@Override
public
void
init
()
{
if
(
SysProperties
.
CHECK
&&
checkInit
)
{
if
(
checkInit
)
{
DbException
.
throwInternalError
();
}
checkInit
=
true
;
...
...
@@ -312,7 +311,7 @@ public class SelectUnion extends Query {
// sometimes a subquery is prepared twice (CREATE TABLE AS SELECT)
return
;
}
if
(
SysProperties
.
CHECK
&&
!
checkInit
)
{
if
(!
checkInit
)
{
DbException
.
throwInternalError
(
"not initialized"
);
}
isPrepared
=
true
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
7926b5b1
...
...
@@ -99,7 +99,7 @@ public class ConnectionInfo implements Cloneable {
HashSet
<
String
>
set
=
new
HashSet
<>(
128
);
set
.
addAll
(
SetTypes
.
getTypes
());
for
(
String
key
:
connectionTime
)
{
if
(!
set
.
add
(
key
)
&&
SysProperties
.
CHECK
)
{
if
(!
set
.
add
(
key
))
{
DbException
.
throwInternalError
(
key
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
7926b5b1
...
...
@@ -1076,10 +1076,8 @@ public class Database implements DataHandler {
try
{
Cursor
cursor
=
metaIdIndex
.
find
(
session
,
r
,
r
);
if
(
cursor
.
next
())
{
if
(
SysProperties
.
CHECK
)
{
if
(
lockMode
!=
Constants
.
LOCK_MODE_OFF
&&
!
wasLocked
)
{
throw
DbException
.
throwInternalError
();
}
if
(
lockMode
!=
Constants
.
LOCK_MODE_OFF
&&
!
wasLocked
)
{
throw
DbException
.
throwInternalError
();
}
Row
found
=
cursor
.
get
();
meta
.
removeRow
(
session
,
found
);
...
...
@@ -2780,7 +2778,7 @@ public class Database implements DataHandler {
}
long
now
=
System
.
nanoTime
();
if
(
now
>
reconnectCheckNext
+
reconnectCheckDelayNs
)
{
if
(
SysProperties
.
CHECK
&&
checkpointAllowed
<
0
)
{
if
(
checkpointAllowed
<
0
)
{
DbException
.
throwInternalError
(
Integer
.
toString
(
checkpointAllowed
));
}
synchronized
(
reconnectSync
)
{
...
...
@@ -2849,8 +2847,7 @@ public class Database implements DataHandler {
}
synchronized
(
reconnectSync
)
{
if
(
reconnectModified
(
true
))
{
checkpointAllowed
++;
if
(
SysProperties
.
CHECK
&&
checkpointAllowed
>
20
)
{
if
(++
checkpointAllowed
>
20
)
{
throw
DbException
.
throwInternalError
(
Integer
.
toString
(
checkpointAllowed
));
}
return
true
;
...
...
@@ -2872,7 +2869,7 @@ public class Database implements DataHandler {
synchronized
(
reconnectSync
)
{
checkpointAllowed
--;
}
if
(
SysProperties
.
CHECK
&&
checkpointAllowed
<
0
)
{
if
(
checkpointAllowed
<
0
)
{
throw
DbException
.
throwInternalError
(
Integer
.
toString
(
checkpointAllowed
));
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/DbObjectBase.java
浏览文件 @
7926b5b1
...
...
@@ -129,7 +129,7 @@ public abstract class DbObjectBase implements DbObject {
* used.
*/
protected
void
invalidate
()
{
if
(
SysProperties
.
CHECK
&&
id
==
-
1
)
{
if
(
id
==
-
1
)
{
throw
DbException
.
throwInternalError
();
}
setModified
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
7926b5b1
...
...
@@ -968,10 +968,8 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
}
private
void
unlockAll
()
{
if
(
SysProperties
.
CHECK
)
{
if
(
undoLog
!=
null
&&
undoLog
.
size
()
>
0
)
{
DbException
.
throwInternalError
();
}
if
(
undoLog
!=
null
&&
undoLog
.
size
()
>
0
)
{
DbException
.
throwInternalError
();
}
if
(!
locks
.
isEmpty
())
{
for
(
Table
t
:
locks
)
{
...
...
@@ -1349,7 +1347,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
*/
public
void
removeAtCommit
(
Value
v
)
{
final
String
key
=
v
.
toString
();
if
(
SysProperties
.
CHECK
&&
!
v
.
isLinkedToTable
())
{
if
(!
v
.
isLinkedToTable
())
{
DbException
.
throwInternalError
(
key
);
}
if
(
removeLobMap
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/UndoLogRecord.java
浏览文件 @
7926b5b1
...
...
@@ -196,10 +196,8 @@ public class UndoLogRecord {
}
int
oldOp
=
operation
;
load
(
buff
,
log
);
if
(
SysProperties
.
CHECK
)
{
if
(
operation
!=
oldOp
)
{
DbException
.
throwInternalError
(
"operation="
+
operation
+
" op="
+
oldOp
);
}
if
(
operation
!=
oldOp
)
{
DbException
.
throwInternalError
(
"operation="
+
operation
+
" op="
+
oldOp
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/condition/Comparison.java
浏览文件 @
7926b5b1
...
...
@@ -9,7 +9,6 @@ import java.util.ArrayList;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.ExpressionVisitor
;
...
...
@@ -229,7 +228,7 @@ public class Comparison extends Condition {
return
ValueExpression
.
get
(
getValue
(
session
));
}
}
else
{
if
(
SysProperties
.
CHECK
&&
(
left
==
null
||
right
==
null
)
)
{
if
(
left
==
null
||
right
==
null
)
{
DbException
.
throwInternalError
(
left
+
" "
+
right
);
}
if
(
left
==
ValueExpression
.
getNull
()
||
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/condition/ConditionAndOr.java
浏览文件 @
7926b5b1
...
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
expression
.
condition
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.expression.ValueExpression
;
...
...
@@ -39,7 +38,7 @@ public class ConditionAndOr extends Condition {
this
.
andOrType
=
andOrType
;
this
.
left
=
left
;
this
.
right
=
right
;
if
(
SysProperties
.
CHECK
&&
(
left
==
null
||
right
==
null
)
)
{
if
(
left
==
null
||
right
==
null
)
{
DbException
.
throwInternalError
(
left
+
" "
+
right
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageBtreeIndex.java
浏览文件 @
7926b5b1
...
...
@@ -176,7 +176,7 @@ public class PageBtreeIndex extends PageIndex {
private
Cursor
find
(
Session
session
,
SearchRow
first
,
boolean
bigger
,
SearchRow
last
)
{
if
(
SysProperties
.
CHECK
&&
store
==
null
)
{
if
(
store
==
null
)
{
throw
DbException
.
get
(
ErrorCode
.
OBJECT_CLOSED
);
}
PageBtree
root
=
getPage
(
rootPageId
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageBtreeLeaf.java
浏览文件 @
7926b5b1
...
...
@@ -9,7 +9,6 @@ import java.util.Arrays;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.result.SearchRow
;
import
org.h2.store.Data
;
...
...
@@ -132,7 +131,7 @@ public class PageBtreeLeaf extends PageBtree {
}
last
=
entryCount
==
0
?
pageSize
:
offsets
[
entryCount
-
1
];
rowLength
=
index
.
getRowSize
(
data
,
row
,
true
);
if
(
SysProperties
.
CHECK
&&
last
-
rowLength
<
start
+
OFFSET_LENGTH
)
{
if
(
last
-
rowLength
<
start
+
OFFSET_LENGTH
)
{
throw
DbException
.
throwInternalError
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageBtreeNode.java
浏览文件 @
7926b5b1
...
...
@@ -171,8 +171,7 @@ public class PageBtreeNode extends PageBtree {
}
last
=
entryCount
==
0
?
pageSize
:
offsets
[
entryCount
-
1
];
rowLength
=
index
.
getRowSize
(
data
,
row
,
true
);
if
(
SysProperties
.
CHECK
&&
last
-
rowLength
<
start
+
CHILD_OFFSET_PAIR_LENGTH
)
{
if
(
last
-
rowLength
<
start
+
CHILD_OFFSET_PAIR_LENGTH
)
{
throw
DbException
.
throwInternalError
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageDataLeaf.java
浏览文件 @
7926b5b1
...
...
@@ -10,7 +10,6 @@ import java.util.Arrays;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.result.Row
;
import
org.h2.store.Data
;
...
...
@@ -578,7 +577,7 @@ public class PageDataLeaf extends PageData {
* @param overflow the new overflow page id
*/
void
setOverflow
(
int
old
,
int
overflow
)
{
if
(
SysProperties
.
CHECK
&&
old
!=
firstOverflowPageId
)
{
if
(
old
!=
firstOverflowPageId
)
{
DbException
.
throwInternalError
(
"move "
+
this
+
" "
+
firstOverflowPageId
);
}
index
.
getPageStore
().
logUndo
(
this
,
data
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageDataOverflow.java
浏览文件 @
7926b5b1
...
...
@@ -8,7 +8,6 @@ package org.h2.index;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.store.Data
;
import
org.h2.store.Page
;
...
...
@@ -245,7 +244,7 @@ public class PageDataOverflow extends Page {
}
private
void
setNext
(
int
old
,
int
nextPage
)
{
if
(
SysProperties
.
CHECK
&&
old
!=
this
.
nextPage
)
{
if
(
old
!=
this
.
nextPage
)
{
DbException
.
throwInternalError
(
"move "
+
this
+
" "
+
nextPage
);
}
store
.
logUndo
(
this
,
data
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/TreeIndex.java
浏览文件 @
7926b5b1
...
...
@@ -7,7 +7,6 @@ package org.h2.index;
import
org.h2.command.dml.AllColumnsForPlan
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
...
...
@@ -205,7 +204,7 @@ public class TreeIndex extends BaseIndex {
x
.
left
=
d
.
left
;
}
if
(
SysProperties
.
CHECK
&&
x
.
right
==
null
)
{
if
(
x
.
right
==
null
)
{
DbException
.
throwInternalError
(
"tree corrupted"
);
}
x
.
right
.
parent
=
x
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
7926b5b1
...
...
@@ -609,7 +609,7 @@ public class MVTable extends TableBase {
}
else
{
addRowsToIndex
(
session
,
buffer
,
index
);
}
if
(
SysProperties
.
CHECK
&&
remaining
!=
0
)
{
if
(
remaining
!=
0
)
{
DbException
.
throwInternalError
(
"rowcount remaining="
+
remaining
+
" "
+
getName
());
}
...
...
@@ -636,7 +636,7 @@ public class MVTable extends TableBase {
remaining
--;
}
addRowsToIndex
(
session
,
buffer
,
index
);
if
(
SysProperties
.
CHECK
&&
remaining
!=
0
)
{
if
(
remaining
!=
0
)
{
DbException
.
throwInternalError
(
"rowcount remaining="
+
remaining
+
" "
+
getName
());
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
7926b5b1
...
...
@@ -270,7 +270,7 @@ public class Schema extends DbObjectBase {
* @param obj the object to add
*/
public
void
add
(
SchemaObject
obj
)
{
if
(
SysProperties
.
CHECK
&&
obj
.
getSchema
()
!=
this
)
{
if
(
obj
.
getSchema
()
!=
this
)
{
DbException
.
throwInternalError
(
"wrong schema"
);
}
String
name
=
obj
.
getName
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/security/XTEA.java
浏览文件 @
7926b5b1
...
...
@@ -5,7 +5,6 @@
*/
package
org
.
h2
.
security
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.util.Bits
;
...
...
@@ -47,10 +46,8 @@ public class XTEA implements BlockCipher {
@Override
public
void
encrypt
(
byte
[]
bytes
,
int
off
,
int
len
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
len
%
ALIGN
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned len "
+
len
);
}
if
(
len
%
ALIGN
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned len "
+
len
);
}
for
(
int
i
=
off
;
i
<
off
+
len
;
i
+=
8
)
{
encryptBlock
(
bytes
,
bytes
,
i
);
...
...
@@ -59,10 +56,8 @@ public class XTEA implements BlockCipher {
@Override
public
void
decrypt
(
byte
[]
bytes
,
int
off
,
int
len
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
len
%
ALIGN
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned len "
+
len
);
}
if
(
len
%
ALIGN
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned len "
+
len
);
}
for
(
int
i
=
off
;
i
<
off
+
len
;
i
+=
8
)
{
decryptBlock
(
bytes
,
bytes
,
i
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileStore.java
浏览文件 @
7926b5b1
...
...
@@ -273,8 +273,7 @@ public class FileStore {
* @param len the number of bytes to read
*/
public
void
readFully
(
byte
[]
b
,
int
off
,
int
len
)
{
if
(
SysProperties
.
CHECK
&&
(
len
<
0
||
len
%
Constants
.
FILE_BLOCK_SIZE
!=
0
))
{
if
(
len
<
0
||
len
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned read "
+
name
+
" len "
+
len
);
}
...
...
@@ -293,8 +292,7 @@ public class FileStore {
* @param pos the location
*/
public
void
seek
(
long
pos
)
{
if
(
SysProperties
.
CHECK
&&
pos
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
if
(
pos
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned seek "
+
name
+
" pos "
+
pos
);
}
...
...
@@ -327,8 +325,7 @@ public class FileStore {
* @param len the number of bytes to write
*/
public
void
write
(
byte
[]
b
,
int
off
,
int
len
)
{
if
(
SysProperties
.
CHECK
&&
(
len
<
0
||
len
%
Constants
.
FILE_BLOCK_SIZE
!=
0
))
{
if
(
len
<
0
||
len
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned write "
+
name
+
" len "
+
len
);
}
...
...
@@ -350,7 +347,7 @@ public class FileStore {
* @param newLength the new file size
*/
public
void
setLength
(
long
newLength
)
{
if
(
SysProperties
.
CHECK
&&
newLength
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
if
(
newLength
%
Constants
.
FILE_BLOCK_SIZE
!=
0
)
{
DbException
.
throwInternalError
(
"unaligned setLength "
+
name
+
" pos "
+
newLength
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageLog.java
浏览文件 @
7926b5b1
...
...
@@ -14,7 +14,6 @@ import java.util.HashMap;
import
org.h2.api.ErrorCode
;
import
org.h2.compress.CompressLZF
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
import
org.h2.message.Trace
;
import
org.h2.result.Row
;
...
...
@@ -498,10 +497,8 @@ public class PageLog {
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log undo "
+
pageId
);
}
if
(
SysProperties
.
CHECK
)
{
if
(
page
==
null
)
{
DbException
.
throwInternalError
(
"Undo entry not written"
);
}
if
(
page
==
null
)
{
DbException
.
throwInternalError
(
"Undo entry not written"
);
}
undo
.
set
(
pageId
);
undoAll
.
set
(
pageId
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
7926b5b1
...
...
@@ -717,8 +717,7 @@ public class PageStore implements CacheWriter {
try
{
p
.
moveTo
(
pageStoreSession
,
free
);
}
finally
{
changeCount
++;
if
(
SysProperties
.
CHECK
&&
changeCount
<
0
)
{
if
(++
changeCount
<
0
)
{
throw
DbException
.
throwInternalError
(
"changeCount has wrapped"
);
}
...
...
@@ -1670,10 +1669,8 @@ public class PageStore implements CacheWriter {
metaRootPageId
.
put
(
id
,
rootPageId
);
if
(
type
==
META_TYPE_DATA_INDEX
)
{
CreateTableData
data
=
new
CreateTableData
();
if
(
SysProperties
.
CHECK
)
{
if
(
columns
==
null
)
{
throw
DbException
.
throwInternalError
(
row
.
toString
());
}
if
(
columns
==
null
)
{
throw
DbException
.
throwInternalError
(
row
.
toString
());
}
for
(
int
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++)
{
Column
col
=
new
Column
(
"C"
+
i
,
Value
.
INT
);
...
...
@@ -1980,8 +1977,7 @@ public class PageStore implements CacheWriter {
* Increment the change count. To be done after the operation has finished.
*/
public
void
incrementChangeCount
()
{
changeCount
++;
if
(
SysProperties
.
CHECK
&&
changeCount
<
0
)
{
if
(++
changeCount
<
0
)
{
throw
DbException
.
throwInternalError
(
"changeCount has wrapped"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
7926b5b1
...
...
@@ -257,7 +257,7 @@ public class RegularTable extends TableBase {
remaining
--;
}
addRowsToIndex
(
session
,
buffer
,
index
);
if
(
SysProperties
.
CHECK
&&
remaining
!=
0
)
{
if
(
remaining
!=
0
)
{
DbException
.
throwInternalError
(
"rowcount remaining="
+
remaining
+
" "
+
getName
());
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
7926b5b1
...
...
@@ -14,7 +14,6 @@ import org.h2.command.dml.AllColumnsForPlan;
import
org.h2.command.dml.Select
;
import
org.h2.engine.Right
;
import
org.h2.engine.Session
;
import
org.h2.engine.SysProperties
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.condition.Comparison
;
...
...
@@ -321,13 +320,13 @@ public class TableFilter implements ColumnResolver {
}
}
if
(
nestedJoin
!=
null
)
{
if
(
SysProperties
.
CHECK
&&
nestedJoin
==
this
)
{
if
(
nestedJoin
==
this
)
{
DbException
.
throwInternalError
(
"self join"
);
}
nestedJoin
.
prepare
();
}
if
(
join
!=
null
)
{
if
(
SysProperties
.
CHECK
&&
join
==
this
)
{
if
(
join
==
this
)
{
DbException
.
throwInternalError
(
"self join"
);
}
join
.
prepare
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/CacheLRU.java
浏览文件 @
7926b5b1
...
...
@@ -131,11 +131,8 @@ public class CacheLRU implements Cache {
if
(
old
==
null
)
{
put
(
rec
);
}
else
{
if
(
SysProperties
.
CHECK
)
{
if
(
old
!=
rec
)
{
DbException
.
throwInternalError
(
"old!=record pos:"
+
pos
+
" old:"
+
old
+
" new:"
+
rec
);
}
if
(
old
!=
rec
)
{
DbException
.
throwInternalError
(
"old!=record pos:"
+
pos
+
" old:"
+
old
+
" new:"
+
rec
);
}
if
(!
fifo
)
{
removeFromLinkedList
(
rec
);
...
...
@@ -190,7 +187,7 @@ public class CacheLRU implements Cache {
break
;
}
}
if
(
SysProperties
.
CHECK
&&
check
==
head
)
{
if
(
check
==
head
)
{
DbException
.
throwInternalError
(
"try to remove head"
);
}
// we are not allowed to remove it if the log is not yet written
...
...
@@ -230,17 +227,15 @@ public class CacheLRU implements Cache {
for
(
i
=
0
;
i
<
size
;
i
++)
{
CacheObject
rec
=
changed
.
get
(
i
);
remove
(
rec
.
getPos
());
if
(
SysProperties
.
CHECK
)
{
if
(
rec
.
cacheNext
!=
null
)
{
throw
DbException
.
throwInternalError
();
}
if
(
rec
.
cacheNext
!=
null
)
{
throw
DbException
.
throwInternalError
();
}
}
}
}
private
void
addToFront
(
CacheObject
rec
)
{
if
(
SysProperties
.
CHECK
&&
rec
==
head
)
{
if
(
rec
==
head
)
{
DbException
.
throwInternalError
(
"try to move head"
);
}
rec
.
cacheNext
=
head
;
...
...
@@ -250,7 +245,7 @@ public class CacheLRU implements Cache {
}
private
void
removeFromLinkedList
(
CacheObject
rec
)
{
if
(
SysProperties
.
CHECK
&&
rec
==
head
)
{
if
(
rec
==
head
)
{
DbException
.
throwInternalError
(
"try to remove head"
);
}
rec
.
cachePrevious
.
cacheNext
=
rec
.
cacheNext
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/CacheObject.java
浏览文件 @
7926b5b1
...
...
@@ -5,7 +5,6 @@
*/
package
org
.
h2
.
util
;
import
org.h2.engine.SysProperties
;
import
org.h2.message.DbException
;
/**
...
...
@@ -49,10 +48,8 @@ public abstract class CacheObject implements Comparable<CacheObject> {
public
abstract
int
getMemory
();
public
void
setPos
(
int
pos
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
cachePrevious
!=
null
||
cacheNext
!=
null
||
cacheChained
!=
null
)
{
DbException
.
throwInternalError
(
"setPos too late"
);
}
if
(
cachePrevious
!=
null
||
cacheNext
!=
null
||
cacheChained
!=
null
)
{
DbException
.
throwInternalError
(
"setPos too late"
);
}
this
.
pos
=
pos
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/IntArray.java
浏览文件 @
7926b5b1
...
...
@@ -7,8 +7,6 @@ package org.h2.util;
import
java.util.Arrays
;
import
org.h2.engine.SysProperties
;
/**
* An array with integer element.
*/
...
...
@@ -63,10 +61,8 @@ public class IntArray {
* @return the value
*/
public
int
get
(
int
index
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
index
>=
size
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"i="
+
index
+
" size="
+
size
);
}
if
(
index
>=
size
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"i="
+
index
+
" size="
+
size
);
}
return
data
[
index
];
}
...
...
@@ -77,10 +73,8 @@ public class IntArray {
* @param index the index
*/
public
void
remove
(
int
index
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
index
>=
size
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"i="
+
index
+
" size="
+
size
);
}
if
(
index
>=
size
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"i="
+
index
+
" size="
+
size
);
}
System
.
arraycopy
(
data
,
index
+
1
,
data
,
index
,
size
-
index
-
1
);
size
--;
...
...
@@ -164,11 +158,8 @@ public class IntArray {
* @param toIndex upper bound (exclusive)
*/
public
void
removeRange
(
int
fromIndex
,
int
toIndex
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
fromIndex
>
toIndex
||
toIndex
>
size
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"from="
+
fromIndex
+
" to="
+
toIndex
+
" size="
+
size
);
}
if
(
fromIndex
>
toIndex
||
toIndex
>
size
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"from="
+
fromIndex
+
" to="
+
toIndex
+
" size="
+
size
);
}
System
.
arraycopy
(
data
,
toIndex
,
data
,
fromIndex
,
size
-
toIndex
);
size
-=
toIndex
-
fromIndex
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
7926b5b1
...
...
@@ -433,14 +433,10 @@ public class StringUtils {
}
else
if
(
ch
==
'%'
)
{
buff
[
j
++]
=
(
byte
)
Integer
.
parseInt
(
encoded
.
substring
(
i
+
1
,
i
+
3
),
16
);
i
+=
2
;
}
else
{
if
(
SysProperties
.
CHECK
)
{
if
(
ch
>
127
||
ch
<
' '
)
{
throw
new
IllegalArgumentException
(
"Unexpected char "
+
(
int
)
ch
+
" decoding "
+
encoded
);
}
}
}
else
if
(
ch
<=
127
&&
ch
>=
' '
)
{
buff
[
j
++]
=
(
byte
)
ch
;
}
else
{
throw
new
IllegalArgumentException
(
"Unexpected char "
+
(
int
)
ch
+
" decoding "
+
encoded
);
}
}
return
new
String
(
buff
,
0
,
j
,
StandardCharsets
.
UTF_8
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
7926b5b1
...
...
@@ -208,7 +208,7 @@ public class ValueLob extends Value {
private
static
String
getFileName
(
DataHandler
handler
,
int
tableId
,
int
objectId
)
{
if
(
SysProperties
.
CHECK
&&
tableId
==
0
&&
objectId
==
0
)
{
if
(
tableId
==
0
&&
objectId
==
0
)
{
DbException
.
throwInternalError
(
"0 LOB"
);
}
String
table
=
tableId
<
0
?
".temp"
:
".t"
+
tableId
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论