Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
e46450da
T
Terarkdb
项目概览
indiff7643
/
Terarkdb
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Terarkdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e46450da
编写于
11月 13, 2014
作者:
F
fyrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RocksJava] Rebased + integrated CF tests
上级
cd82beb0
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1375 addition
and
464 deletion
+1375
-464
java/Makefile
java/Makefile
+2
-3
java/org/rocksdb/test/AbstractComparatorTest.java
java/org/rocksdb/test/AbstractComparatorTest.java
+3
-2
java/org/rocksdb/test/ColumnFamilyOptionsTest.java
java/org/rocksdb/test/ColumnFamilyOptionsTest.java
+452
-93
java/org/rocksdb/test/ColumnFamilyTest.java
java/org/rocksdb/test/ColumnFamilyTest.java
+438
-172
java/org/rocksdb/test/FlushTest.java
java/org/rocksdb/test/FlushTest.java
+65
-54
java/org/rocksdb/test/KeyMayExistTest.java
java/org/rocksdb/test/KeyMayExistTest.java
+1
-1
java/org/rocksdb/test/MergeTest.java
java/org/rocksdb/test/MergeTest.java
+3
-2
java/org/rocksdb/test/MixedOptionsTest.java
java/org/rocksdb/test/MixedOptionsTest.java
+15
-8
java/org/rocksdb/test/OptionsTest.java
java/org/rocksdb/test/OptionsTest.java
+394
-127
java/org/rocksdb/test/WriteBatchHandlerTest.java
java/org/rocksdb/test/WriteBatchHandlerTest.java
+2
-2
未找到文件。
java/Makefile
浏览文件 @
e46450da
...
...
@@ -47,8 +47,7 @@ ifeq ($(PLATFORM), OS_MACOSX)
ROCKSDB_JAR
=
rocksdbjni-
$(ROCKSDB_MAJOR)
.
$(ROCKSDB_MINOR)
.
$(ROCKSDB_PATCH)
-osx
.jar
endif
JAVA_TESTS
=
org.rocksdb.test.AbstractComparatorTest
\
org.rocksdb.test.BackupableDBTest
\
JAVA_TESTS
=
org.rocksdb.test.BackupableDBTest
\
org.rocksdb.test.BlockBasedTableConfigTest
\
org.rocksdb.test.ColumnFamilyOptionsTest
\
org.rocksdb.test.ColumnFamilyTest
\
...
...
@@ -71,7 +70,7 @@ JAVA_TESTS = org.rocksdb.test.AbstractComparatorTest\
org.rocksdb.test.RocksIteratorTest
\
org.rocksdb.test.SnapshotTest
\
org.rocksdb.test.StatisticsCollectorTest
\
org.rocksdb.test.W
ir
teBatchHandlerTest
\
org.rocksdb.test.W
ri
teBatchHandlerTest
\
org.rocksdb.test.WriteBatchTest
\
org.rocksdb.test.WriteOptionsTest
\
...
...
java/org/rocksdb/test/AbstractComparatorTest.java
浏览文件 @
e46450da
...
...
@@ -12,6 +12,7 @@ import java.nio.file.*;
import
java.nio.file.attribute.BasicFileAttributes
;
import
java.util.Random
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
rocksdb
.
test
.
Types
.
byteToInt
;
import
static
org
.
rocksdb
.
test
.
Types
.
intToByte
;
...
...
@@ -75,13 +76,13 @@ public abstract class AbstractComparatorTest {
int
count
=
0
;
for
(
it
.
seekToFirst
();
it
.
isValid
();
it
.
next
())
{
final
int
thisKey
=
byteToInt
(
it
.
key
());
assert
(
thisKey
>
lastKey
);
assert
That
(
thisKey
).
isGreaterThan
(
lastKey
);
lastKey
=
thisKey
;
count
++;
}
db
.
close
();
assert
(
count
==
ITERATIONS
);
assert
That
(
count
).
isEqualTo
(
ITERATIONS
);
}
catch
(
final
RocksDBException
e
)
{
System
.
err
.
format
(
"[ERROR]: %s%n"
,
e
);
...
...
java/org/rocksdb/test/ColumnFamilyOptionsTest.java
浏览文件 @
e46450da
...
...
@@ -5,225 +5,584 @@
package
org.rocksdb.test
;
import
org.junit.ClassRule
;
import
org.junit.Test
;
import
org.rocksdb.*
;
import
java.util.Random
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
class
ColumnFamilyOptionsTest
{
static
{
RocksDB
.
loadLibrary
();
}
public
static
void
testCFOptions
(
ColumnFamilyOptionsInterface
opt
)
{
Random
rand
=
PlatformRandomHelper
.
getPlatformSpecificRandomFactory
();
{
// WriteBufferSize test
try
{
long
longValue
=
rand
.
nextLong
();
opt
.
setWriteBufferSize
(
longValue
);
assert
(
opt
.
writeBufferSize
()
==
longValue
);
}
catch
(
RocksDBException
e
)
{
assert
(
false
);
@ClassRule
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
public
static
final
Random
rand
=
PlatformRandomHelper
.
getPlatformSpecificRandomFactory
();
@Test
public
void
writeBufferSize
()
throws
RocksDBException
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
long
longValue
=
rand
.
nextLong
();
opt
.
setWriteBufferSize
(
longValue
);
assertThat
(
opt
.
writeBufferSize
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxWriteBufferNumber test
@Test
public
void
maxWriteBufferNumber
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxWriteBufferNumber
(
intValue
);
assert
(
opt
.
maxWriteBufferNumber
()
==
intValue
);
assertThat
(
opt
.
maxWriteBufferNumber
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MinWriteBufferNumberToMerge test
@Test
public
void
minWriteBufferNumberToMerge
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMinWriteBufferNumberToMerge
(
intValue
);
assert
(
opt
.
minWriteBufferNumberToMerge
()
==
intValue
);
assertThat
(
opt
.
minWriteBufferNumberToMerge
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// NumLevels test
@Test
public
void
numLevels
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setNumLevels
(
intValue
);
assert
(
opt
.
numLevels
()
==
intValue
);
assertThat
(
opt
.
numLevels
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// LevelFileNumCompactionTrigger test
@Test
public
void
levelZeroFileNumCompactionTrigger
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroFileNumCompactionTrigger
(
intValue
);
assert
(
opt
.
levelZeroFileNumCompactionTrigger
()
==
intValue
);
assertThat
(
opt
.
levelZeroFileNumCompactionTrigger
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// LevelSlowdownWritesTrigger test
@Test
public
void
levelZeroSlowdownWritesTrigger
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroSlowdownWritesTrigger
(
intValue
);
assert
(
opt
.
levelZeroSlowdownWritesTrigger
()
==
intValue
);
assertThat
(
opt
.
levelZeroSlowdownWritesTrigger
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// LevelStopWritesTrigger test
@Test
public
void
levelZeroStopWritesTrigger
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroStopWritesTrigger
(
intValue
);
assert
(
opt
.
levelZeroStopWritesTrigger
()
==
intValue
);
assertThat
(
opt
.
levelZeroStopWritesTrigger
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxMemCompactionLevel test
@Test
public
void
maxMemCompactionLevel
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxMemCompactionLevel
(
intValue
);
assert
(
opt
.
maxMemCompactionLevel
()
==
intValue
);
assertThat
(
opt
.
maxMemCompactionLevel
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// TargetFileSizeBase test
@Test
public
void
targetFileSizeBase
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
long
longValue
=
rand
.
nextLong
();
opt
.
setTargetFileSizeBase
(
longValue
);
assert
(
opt
.
targetFileSizeBase
()
==
longValue
);
assertThat
(
opt
.
targetFileSizeBase
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// TargetFileSizeMultiplier test
@Test
public
void
targetFileSizeMultiplier
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setTargetFileSizeMultiplier
(
intValue
);
assert
(
opt
.
targetFileSizeMultiplier
()
==
intValue
);
assertThat
(
opt
.
targetFileSizeMultiplier
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxBytesForLevelBase test
@Test
public
void
maxBytesForLevelBase
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxBytesForLevelBase
(
longValue
);
assert
(
opt
.
maxBytesForLevelBase
()
==
longValue
);
assertThat
(
opt
.
maxBytesForLevelBase
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxBytesForLevelMultiplier test
@Test
public
void
maxBytesForLevelMultiplier
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxBytesForLevelMultiplier
(
intValue
);
assert
(
opt
.
maxBytesForLevelMultiplier
()
==
intValue
);
assertThat
(
opt
.
maxBytesForLevelMultiplier
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// ExpandedCompactionFactor test
@Test
public
void
expandedCompactionFactor
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setExpandedCompactionFactor
(
intValue
);
assert
(
opt
.
expandedCompactionFactor
()
==
intValue
);
assertThat
(
opt
.
expandedCompactionFactor
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// SourceCompactionFactor test
@Test
public
void
sourceCompactionFactor
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setSourceCompactionFactor
(
intValue
);
assert
(
opt
.
sourceCompactionFactor
()
==
intValue
);
assertThat
(
opt
.
sourceCompactionFactor
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxGrandparentOverlapFactor test
@Test
public
void
maxGrandparentOverlapFactor
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxGrandparentOverlapFactor
(
intValue
);
assert
(
opt
.
maxGrandparentOverlapFactor
()
==
intValue
);
assertThat
(
opt
.
maxGrandparentOverlapFactor
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// SoftRateLimit test
@Test
public
void
softRateLimit
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
double
doubleValue
=
rand
.
nextDouble
();
opt
.
setSoftRateLimit
(
doubleValue
);
assert
(
opt
.
softRateLimit
()
==
doubleValue
);
assertThat
(
opt
.
softRateLimit
()).
isEqualTo
(
doubleValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// HardRateLimit test
@Test
public
void
hardRateLimit
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
double
doubleValue
=
rand
.
nextDouble
();
opt
.
setHardRateLimit
(
doubleValue
);
assert
(
opt
.
hardRateLimit
()
==
doubleValue
);
assertThat
(
opt
.
hardRateLimit
()).
isEqualTo
(
doubleValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// RateLimitDelayMaxMilliseconds test
@Test
public
void
rateLimitDelayMaxMilliseconds
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setRateLimitDelayMaxMilliseconds
(
intValue
);
assert
(
opt
.
rateLimitDelayMaxMilliseconds
()
==
intValue
);
assertThat
(
opt
.
rateLimitDelayMaxMilliseconds
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// ArenaBlockSize test
try
{
long
longValue
=
rand
.
nextLong
();
opt
.
setArenaBlockSize
(
longValue
);
assert
(
opt
.
arenaBlockSize
()
==
longValue
);
}
catch
(
RocksDBException
e
)
{
assert
(
false
);
@Test
public
void
arenaBlockSize
()
throws
RocksDBException
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
long
longValue
=
rand
.
nextLong
();
opt
.
setArenaBlockSize
(
longValue
);
assertThat
(
opt
.
arenaBlockSize
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// DisableAutoCompactions test
@Test
public
void
disableAutoCompactions
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setDisableAutoCompactions
(
boolValue
);
assert
(
opt
.
disableAutoCompactions
()
==
boolValue
);
assertThat
(
opt
.
disableAutoCompactions
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// PurgeRedundantKvsWhileFlush test
@Test
public
void
purgeRedundantKvsWhileFlush
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setPurgeRedundantKvsWhileFlush
(
boolValue
);
assert
(
opt
.
purgeRedundantKvsWhileFlush
()
==
boolValue
);
assertThat
(
opt
.
purgeRedundantKvsWhileFlush
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// VerifyChecksumsInCompaction test
@Test
public
void
verifyChecksumsInCompaction
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setVerifyChecksumsInCompaction
(
boolValue
);
assert
(
opt
.
verifyChecksumsInCompaction
()
==
boolValue
);
assertThat
(
opt
.
verifyChecksumsInCompaction
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// FilterDeletes test
@Test
public
void
filterDeletes
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setFilterDeletes
(
boolValue
);
assert
(
opt
.
filterDeletes
()
==
boolValue
);
assertThat
(
opt
.
filterDeletes
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxSequentialSkipInIterations test
@Test
public
void
maxSequentialSkipInIterations
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxSequentialSkipInIterations
(
longValue
);
assert
(
opt
.
maxSequentialSkipInIterations
()
==
longValue
);
assertThat
(
opt
.
maxSequentialSkipInIterations
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// InplaceUpdateSupport test
@Test
public
void
inplaceUpdateSupport
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setInplaceUpdateSupport
(
boolValue
);
assert
(
opt
.
inplaceUpdateSupport
()
==
boolValue
);
assertThat
(
opt
.
inplaceUpdateSupport
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// InplaceUpdateNumLocks test
try
{
long
longValue
=
rand
.
nextLong
();
opt
.
setInplaceUpdateNumLocks
(
longValue
);
assert
(
opt
.
inplaceUpdateNumLocks
()
==
longValue
);
}
catch
(
RocksDBException
e
)
{
assert
(
false
);
@Test
public
void
inplaceUpdateNumLocks
()
throws
RocksDBException
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
long
longValue
=
rand
.
nextLong
();
opt
.
setInplaceUpdateNumLocks
(
longValue
);
assertThat
(
opt
.
inplaceUpdateNumLocks
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MemtablePrefixBloomBits test
@Test
public
void
memtablePrefixBloomBits
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMemtablePrefixBloomBits
(
intValue
);
assert
(
opt
.
memtablePrefixBloomBits
()
==
intValue
);
assertThat
(
opt
.
memtablePrefixBloomBits
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MemtablePrefixBloomProbes test
@Test
public
void
memtablePrefixBloomProbes
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
int
intValue
=
rand
.
nextInt
();
opt
=
new
ColumnFamilyOptions
();
opt
.
setMemtablePrefixBloomProbes
(
intValue
);
assert
(
opt
.
memtablePrefixBloomProbes
()
==
intValue
);
assertThat
(
opt
.
memtablePrefixBloomProbes
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// BloomLocality test
@Test
public
void
bloomLocality
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
int
intValue
=
rand
.
nextInt
();
opt
=
new
ColumnFamilyOptions
();
opt
.
setBloomLocality
(
intValue
);
assert
(
opt
.
bloomLocality
()
==
intValue
);
assertThat
(
opt
.
bloomLocality
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxSuccessiveMerges test
try
{
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxSuccessiveMerges
(
longValue
);
assert
(
opt
.
maxSuccessiveMerges
()
==
longValue
);
}
catch
(
RocksDBException
e
){
assert
(
false
);
@Test
public
void
maxSuccessiveMerges
()
throws
RocksDBException
{
ColumnFamilyOptions
opt
=
null
;
try
{
long
longValue
=
rand
.
nextLong
();
opt
=
new
ColumnFamilyOptions
();
opt
.
setMaxSuccessiveMerges
(
longValue
);
assertThat
(
opt
.
maxSuccessiveMerges
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MinPartialMergeOperands test
@Test
public
void
minPartialMergeOperands
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
int
intValue
=
rand
.
nextInt
();
opt
=
new
ColumnFamilyOptions
();
opt
.
setMinPartialMergeOperands
(
intValue
);
assert
(
opt
.
minPartialMergeOperands
()
==
intValue
);
assertThat
(
opt
.
minPartialMergeOperands
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
@Test
public
void
memTable
()
throws
RocksDBException
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
opt
.
setMemTableConfig
(
new
HashLinkedListMemTableConfig
());
assertThat
(
opt
.
memTableFactoryName
()).
isEqualTo
(
"HashLinkedListRepFactory"
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
@Test
public
void
comparator
()
throws
RocksDBException
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
opt
.
setComparator
(
BuiltinComparator
.
BYTEWISE_COMPARATOR
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
@Test
public
void
linkageOfPrepMethods
()
{
ColumnFamilyOptions
options
=
null
;
try
{
options
=
new
ColumnFamilyOptions
();
options
.
optimizeUniversalStyleCompaction
();
options
.
optimizeUniversalStyleCompaction
(
4000
);
options
.
optimizeLevelStyleCompaction
();
options
.
optimizeLevelStyleCompaction
(
3000
);
options
.
optimizeForPointLookup
(
10
);
}
finally
{
if
(
options
!=
null
)
{
options
.
dispose
();
}
}
}
@Test
public
void
shouldSetTestPrefixExtractor
()
{
ColumnFamilyOptions
options
=
null
;
try
{
options
=
new
ColumnFamilyOptions
();
options
.
useFixedLengthPrefixExtractor
(
100
);
options
.
useFixedLengthPrefixExtractor
(
10
);
}
finally
{
if
(
options
!=
null
)
{
options
.
dispose
();
}
}
}
public
static
void
main
(
String
[]
args
)
{
ColumnFamilyOptions
opt
=
new
ColumnFamilyOptions
();
testCFOptions
(
opt
);
opt
.
dispose
();
System
.
out
.
println
(
"Passed DBOptionsTest"
);
@Test
public
void
compressionTypes
()
{
ColumnFamilyOptions
ColumnFamilyOptions
=
null
;
try
{
ColumnFamilyOptions
=
new
ColumnFamilyOptions
();
for
(
CompressionType
compressionType
:
CompressionType
.
values
())
{
ColumnFamilyOptions
.
setCompressionType
(
compressionType
);
assertThat
(
ColumnFamilyOptions
.
compressionType
()).
isEqualTo
(
compressionType
);
assertThat
(
CompressionType
.
valueOf
(
"NO_COMPRESSION"
)).
isEqualTo
(
CompressionType
.
NO_COMPRESSION
);
}
}
finally
{
if
(
ColumnFamilyOptions
!=
null
)
{
ColumnFamilyOptions
.
dispose
();
}
}
}
@Test
public
void
compactionStyles
()
{
ColumnFamilyOptions
ColumnFamilyOptions
=
null
;
try
{
ColumnFamilyOptions
=
new
ColumnFamilyOptions
();
for
(
CompactionStyle
compactionStyle
:
CompactionStyle
.
values
())
{
ColumnFamilyOptions
.
setCompactionStyle
(
compactionStyle
);
assertThat
(
ColumnFamilyOptions
.
compactionStyle
()).
isEqualTo
(
compactionStyle
);
assertThat
(
CompactionStyle
.
valueOf
(
"FIFO"
)).
isEqualTo
(
CompactionStyle
.
FIFO
);
}
}
finally
{
if
(
ColumnFamilyOptions
!=
null
)
{
ColumnFamilyOptions
.
dispose
();
}
}
}
}
java/org/rocksdb/test/ColumnFamilyTest.java
浏览文件 @
e46450da
此差异已折叠。
点击以展开。
java/org/rocksdb/test/FlushTest.java
浏览文件 @
e46450da
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
package
org.rocksdb.test
;
import
org.junit.ClassRule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
import
org.rocksdb.*
;
public
class
FlushTest
{
@ClassRule
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
@Rule
public
TemporaryFolder
dbFolder
=
new
TemporaryFolder
();
@Test
public
void
flush
()
{
RocksDB
db
=
null
;
Options
options
=
new
Options
();
WriteOptions
wOpt
=
new
WriteOptions
();
FlushOptions
flushOptions
=
new
FlushOptions
();
try
{
// Setup options
options
.
setCreateIfMissing
(
true
);
options
.
setMaxWriteBufferNumber
(
10
);
options
.
setMinWriteBufferNumberToMerge
(
10
);
flushOptions
.
setWaitForFlush
(
true
);
wOpt
.
setDisableWAL
(
true
);
db
=
RocksDB
.
open
(
options
,
dbFolder
.
getRoot
().
getAbsolutePath
());
db
.
put
(
wOpt
,
"key1"
.
getBytes
(),
"value1"
.
getBytes
());
db
.
put
(
wOpt
,
"key2"
.
getBytes
(),
"value2"
.
getBytes
());
db
.
put
(
wOpt
,
"key3"
.
getBytes
(),
"value3"
.
getBytes
());
db
.
put
(
wOpt
,
"key4"
.
getBytes
(),
"value4"
.
getBytes
());
assert
(
db
.
getProperty
(
"rocksdb.num-entries-active-mem-table"
).
equals
(
"4"
));
db
.
flush
(
flushOptions
);
assert
(
db
.
getProperty
(
"rocksdb.num-entries-active-mem-table"
).
equals
(
"0"
));
}
catch
(
RocksDBException
e
)
{
assert
(
false
);
}
db
.
close
();
options
.
dispose
();
wOpt
.
dispose
();
flushOptions
.
dispose
();
}
}
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
package
org.rocksdb.test
;
import
org.junit.ClassRule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
import
org.rocksdb.*
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
class
FlushTest
{
@ClassRule
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
@Rule
public
TemporaryFolder
dbFolder
=
new
TemporaryFolder
();
@Test
public
void
flush
()
throws
RocksDBException
{
RocksDB
db
=
null
;
Options
options
=
null
;
WriteOptions
wOpt
=
null
;
FlushOptions
flushOptions
=
null
;
try
{
options
=
new
Options
();
// Setup options
options
.
setCreateIfMissing
(
true
);
options
.
setMaxWriteBufferNumber
(
10
);
options
.
setMinWriteBufferNumberToMerge
(
10
);
wOpt
=
new
WriteOptions
();
flushOptions
=
new
FlushOptions
();
flushOptions
.
setWaitForFlush
(
true
);
wOpt
.
setDisableWAL
(
true
);
db
=
RocksDB
.
open
(
options
,
dbFolder
.
getRoot
().
getAbsolutePath
());
db
.
put
(
wOpt
,
"key1"
.
getBytes
(),
"value1"
.
getBytes
());
db
.
put
(
wOpt
,
"key2"
.
getBytes
(),
"value2"
.
getBytes
());
db
.
put
(
wOpt
,
"key3"
.
getBytes
(),
"value3"
.
getBytes
());
db
.
put
(
wOpt
,
"key4"
.
getBytes
(),
"value4"
.
getBytes
());
assertThat
(
db
.
getProperty
(
"rocksdb.num-entries-active-mem-table"
)).
isEqualTo
(
"4"
);
db
.
flush
(
flushOptions
);
assertThat
(
db
.
getProperty
(
"rocksdb.num-entries-active-mem-table"
)).
isEqualTo
(
"0"
);
}
finally
{
if
(
flushOptions
!=
null
)
{
flushOptions
.
dispose
();
}
if
(
db
!=
null
)
{
db
.
close
();
}
if
(
options
!=
null
)
{
options
.
dispose
();
}
if
(
wOpt
!=
null
)
{
wOpt
.
dispose
();
}
}
}
}
java/org/rocksdb/test/KeyMayExistTest.java
浏览文件 @
e46450da
...
...
@@ -34,7 +34,7 @@ public class KeyMayExistTest {
.
setCreateMissingColumnFamilies
(
true
);
// open database using cf names
List
<
ColumnFamilyDescriptor
>
cfDescriptors
=
new
ArrayList
<
ColumnFamilyDescriptor
>();
new
ArrayList
<>();
List
<
ColumnFamilyHandle
>
columnFamilyHandleList
=
new
ArrayList
<>();
cfDescriptors
.
add
(
new
ColumnFamilyDescriptor
(
"default"
));
...
...
java/org/rocksdb/test/MergeTest.java
浏览文件 @
e46450da
...
...
@@ -177,11 +177,12 @@ public class MergeTest {
// Test also with createColumnFamily
columnFamilyHandle
=
db
.
createColumnFamily
(
new
ColumnFamilyDescriptor
(
"new_cf2"
));
new
ColumnFamilyDescriptor
(
"new_cf2"
,
new
ColumnFamilyOptions
().
setMergeOperator
(
stringAppendOperator
)));
// writing xx under cfkey2
db
.
put
(
columnFamilyHandle
,
"cfkey2"
.
getBytes
(),
"xx"
.
getBytes
());
// merge yy under cfkey2
db
.
merge
(
columnFamilyHandle
,
"cfkey2"
.
getBytes
(),
"yy"
.
getBytes
());
db
.
merge
(
columnFamilyHandle
,
new
WriteOptions
(),
"cfkey2"
.
getBytes
(),
"yy"
.
getBytes
());
value
=
db
.
get
(
columnFamilyHandle
,
"cfkey2"
.
getBytes
());
String
strValueTmpCf
=
new
String
(
value
);
...
...
java/org/rocksdb/test/MixedOptionsTest.java
浏览文件 @
e46450da
...
...
@@ -5,26 +5,33 @@
package
org.rocksdb.test
;
import
org.junit.ClassRule
;
import
org.junit.Test
;
import
org.rocksdb.*
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
class
MixedOptionsTest
{
static
{
RocksDB
.
loadLibrary
();
}
public
static
void
main
(
String
[]
args
)
{
@ClassRule
public
static
final
RocksMemoryResource
rocksMemoryResource
=
new
RocksMemoryResource
();
@Test
public
void
mixedOptionsTest
(){
// Set a table factory and check the names
ColumnFamilyOptions
cfOptions
=
new
ColumnFamilyOptions
();
cfOptions
.
setTableFormatConfig
(
new
BlockBasedTableConfig
().
setFilter
(
new
BloomFilter
()));
assert
(
cfOptions
.
tableFactoryName
().
equals
(
"BlockBasedTable"
)
)
;
assert
That
(
cfOptions
.
tableFactoryName
()).
isEqualTo
(
"BlockBasedTable"
);
cfOptions
.
setTableFormatConfig
(
new
PlainTableConfig
());
assert
(
cfOptions
.
tableFactoryName
().
equals
(
"PlainTable"
)
);
assert
That
(
cfOptions
.
tableFactoryName
()).
isEqualTo
(
"PlainTable"
);
// Initialize a dbOptions object from cf options and
// db options
DBOptions
dbOptions
=
new
DBOptions
();
Options
options
=
new
Options
(
dbOptions
,
cfOptions
);
assert
(
options
.
tableFactoryName
().
equals
(
"PlainTable"
)
);
assert
That
(
options
.
tableFactoryName
()).
isEqualTo
(
"PlainTable"
);
// Free instances
options
.
dispose
();
options
=
null
;
...
...
java/org/rocksdb/test/OptionsTest.java
浏览文件 @
e46450da
...
...
@@ -23,196 +23,463 @@ public class OptionsTest {
getPlatformSpecificRandomFactory
();
@Test
public
void
options
()
throws
RocksDBException
{
public
void
writeBufferSize
()
throws
RocksDBException
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
{
// WriteBufferSize test
long
longValue
=
rand
.
nextLong
();
opt
.
setWriteBufferSize
(
longValue
);
assert
(
opt
.
writeBufferSize
()
==
longValue
);
long
longValue
=
rand
.
nextLong
();
opt
.
setWriteBufferSize
(
longValue
);
assertThat
(
opt
.
writeBufferSize
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxWriteBufferNumber test
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxWriteBufferNumber
(
intValue
);
assert
(
opt
.
maxWriteBufferNumber
()
==
intValue
);
@Test
public
void
maxWriteBufferNumber
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxWriteBufferNumber
(
intValue
);
assertThat
(
opt
.
maxWriteBufferNumber
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MinWriteBufferNumberToMerge test
int
intValue
=
rand
.
nextInt
();
opt
.
setMinWriteBufferNumberToMerge
(
intValue
);
assert
(
opt
.
minWriteBufferNumberToMerge
()
==
intValue
);
@Test
public
void
minWriteBufferNumberToMerge
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMinWriteBufferNumberToMerge
(
intValue
);
assertThat
(
opt
.
minWriteBufferNumberToMerge
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// NumLevels test
int
intValue
=
rand
.
nextInt
();
opt
.
setNumLevels
(
intValue
);
assert
(
opt
.
numLevels
()
==
intValue
);
@Test
public
void
numLevels
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setNumLevels
(
intValue
);
assertThat
(
opt
.
numLevels
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// LevelFileNumCompactionTrigger test
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroFileNumCompactionTrigger
(
intValue
);
assert
(
opt
.
levelZeroFileNumCompactionTrigger
()
==
intValue
);
@Test
public
void
levelZeroFileNumCompactionTrigger
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroFileNumCompactionTrigger
(
intValue
);
assertThat
(
opt
.
levelZeroFileNumCompactionTrigger
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// LevelSlowdownWritesTrigger test
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroSlowdownWritesTrigger
(
intValue
);
assert
(
opt
.
levelZeroSlowdownWritesTrigger
()
==
intValue
);
@Test
public
void
levelZeroSlowdownWritesTrigger
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroSlowdownWritesTrigger
(
intValue
);
assertThat
(
opt
.
levelZeroSlowdownWritesTrigger
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// LevelStopWritesTrigger test
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroStopWritesTrigger
(
intValue
);
assert
(
opt
.
levelZeroStopWritesTrigger
()
==
intValue
);
@Test
public
void
levelZeroStopWritesTrigger
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setLevelZeroStopWritesTrigger
(
intValue
);
assertThat
(
opt
.
levelZeroStopWritesTrigger
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxMemCompactionLevel test
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxMemCompactionLevel
(
intValue
);
assert
(
opt
.
maxMemCompactionLevel
()
==
intValue
);
@Test
public
void
maxMemCompactionLevel
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxMemCompactionLevel
(
intValue
);
assertThat
(
opt
.
maxMemCompactionLevel
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// TargetFileSizeBase test
long
longValue
=
rand
.
nextLong
();
opt
.
setTargetFileSizeBase
(
longValue
);
assert
(
opt
.
targetFileSizeBase
()
==
longValue
);
@Test
public
void
targetFileSizeBase
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
long
longValue
=
rand
.
nextLong
();
opt
.
setTargetFileSizeBase
(
longValue
);
assertThat
(
opt
.
targetFileSizeBase
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// TargetFileSizeMultiplier test
int
intValue
=
rand
.
nextInt
();
opt
.
setTargetFileSizeMultiplier
(
intValue
);
assert
(
opt
.
targetFileSizeMultiplier
()
==
intValue
);
@Test
public
void
targetFileSizeMultiplier
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setTargetFileSizeMultiplier
(
intValue
);
assertThat
(
opt
.
targetFileSizeMultiplier
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxBytesForLevelBase test
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxBytesForLevelBase
(
longValue
);
assert
(
opt
.
maxBytesForLevelBase
()
==
longValue
);
@Test
public
void
maxBytesForLevelBase
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxBytesForLevelBase
(
longValue
);
assertThat
(
opt
.
maxBytesForLevelBase
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxBytesForLevelMultiplier test
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxBytesForLevelMultiplier
(
intValue
);
assert
(
opt
.
maxBytesForLevelMultiplier
()
==
intValue
);
@Test
public
void
maxBytesForLevelMultiplier
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxBytesForLevelMultiplier
(
intValue
);
assertThat
(
opt
.
maxBytesForLevelMultiplier
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// ExpandedCompactionFactor test
int
intValue
=
rand
.
nextInt
();
opt
.
setExpandedCompactionFactor
(
intValue
);
assert
(
opt
.
expandedCompactionFactor
()
==
intValue
);
@Test
public
void
expandedCompactionFactor
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setExpandedCompactionFactor
(
intValue
);
assertThat
(
opt
.
expandedCompactionFactor
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// SourceCompactionFactor test
int
intValue
=
rand
.
nextInt
();
opt
.
setSourceCompactionFactor
(
intValue
);
assert
(
opt
.
sourceCompactionFactor
()
==
intValue
);
@Test
public
void
sourceCompactionFactor
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setSourceCompactionFactor
(
intValue
);
assertThat
(
opt
.
sourceCompactionFactor
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxGrandparentOverlapFactor test
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxGrandparentOverlapFactor
(
intValue
);
assert
(
opt
.
maxGrandparentOverlapFactor
()
==
intValue
);
@Test
public
void
maxGrandparentOverlapFactor
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMaxGrandparentOverlapFactor
(
intValue
);
assertThat
(
opt
.
maxGrandparentOverlapFactor
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// SoftRateLimit test
double
doubleValue
=
rand
.
nextDouble
();
opt
.
setSoftRateLimit
(
doubleValue
);
assert
(
opt
.
softRateLimit
()
==
doubleValue
);
@Test
public
void
softRateLimit
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
double
doubleValue
=
rand
.
nextDouble
();
opt
.
setSoftRateLimit
(
doubleValue
);
assertThat
(
opt
.
softRateLimit
()).
isEqualTo
(
doubleValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// HardRateLimit test
double
doubleValue
=
rand
.
nextDouble
();
opt
.
setHardRateLimit
(
doubleValue
);
assert
(
opt
.
hardRateLimit
()
==
doubleValue
);
@Test
public
void
hardRateLimit
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
double
doubleValue
=
rand
.
nextDouble
();
opt
.
setHardRateLimit
(
doubleValue
);
assertThat
(
opt
.
hardRateLimit
()).
isEqualTo
(
doubleValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// RateLimitDelayMaxMilliseconds test
int
intValue
=
rand
.
nextInt
();
opt
.
setRateLimitDelayMaxMilliseconds
(
intValue
);
assert
(
opt
.
rateLimitDelayMaxMilliseconds
()
==
intValue
);
@Test
public
void
rateLimitDelayMaxMilliseconds
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setRateLimitDelayMaxMilliseconds
(
intValue
);
assertThat
(
opt
.
rateLimitDelayMaxMilliseconds
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// ArenaBlockSize test
long
longValue
=
rand
.
nextLong
();
opt
.
setArenaBlockSize
(
longValue
);
assert
(
opt
.
arenaBlockSize
()
==
longValue
);
@Test
public
void
arenaBlockSize
()
throws
RocksDBException
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
long
longValue
=
rand
.
nextLong
();
opt
.
setArenaBlockSize
(
longValue
);
assertThat
(
opt
.
arenaBlockSize
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// DisableAutoCompactions test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setDisableAutoCompactions
(
boolValue
);
assert
(
opt
.
disableAutoCompactions
()
==
boolValue
);
@Test
public
void
disableAutoCompactions
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setDisableAutoCompactions
(
boolValue
);
assertThat
(
opt
.
disableAutoCompactions
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// PurgeRedundantKvsWhileFlush test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setPurgeRedundantKvsWhileFlush
(
boolValue
);
assert
(
opt
.
purgeRedundantKvsWhileFlush
()
==
boolValue
);
@Test
public
void
purgeRedundantKvsWhileFlush
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setPurgeRedundantKvsWhileFlush
(
boolValue
);
assertThat
(
opt
.
purgeRedundantKvsWhileFlush
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// VerifyChecksumsInCompaction test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setVerifyChecksumsInCompaction
(
boolValue
);
assert
(
opt
.
verifyChecksumsInCompaction
()
==
boolValue
);
@Test
public
void
verifyChecksumsInCompaction
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setVerifyChecksumsInCompaction
(
boolValue
);
assertThat
(
opt
.
verifyChecksumsInCompaction
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// FilterDeletes test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setFilterDeletes
(
boolValue
);
assert
(
opt
.
filterDeletes
()
==
boolValue
);
@Test
public
void
filterDeletes
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setFilterDeletes
(
boolValue
);
assertThat
(
opt
.
filterDeletes
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxSequentialSkipInIterations test
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxSequentialSkipInIterations
(
longValue
);
assert
(
opt
.
maxSequentialSkipInIterations
()
==
longValue
);
@Test
public
void
maxSequentialSkipInIterations
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxSequentialSkipInIterations
(
longValue
);
assertThat
(
opt
.
maxSequentialSkipInIterations
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// InplaceUpdateSupport test
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setInplaceUpdateSupport
(
boolValue
);
assert
(
opt
.
inplaceUpdateSupport
()
==
boolValue
);
@Test
public
void
inplaceUpdateSupport
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
boolean
boolValue
=
rand
.
nextBoolean
();
opt
.
setInplaceUpdateSupport
(
boolValue
);
assertThat
(
opt
.
inplaceUpdateSupport
()).
isEqualTo
(
boolValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// InplaceUpdateNumLocks test
long
longValue
=
rand
.
nextLong
();
opt
.
setInplaceUpdateNumLocks
(
longValue
);
assert
(
opt
.
inplaceUpdateNumLocks
()
==
longValue
);
@Test
public
void
inplaceUpdateNumLocks
()
throws
RocksDBException
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
long
longValue
=
rand
.
nextLong
();
opt
.
setInplaceUpdateNumLocks
(
longValue
);
assertThat
(
opt
.
inplaceUpdateNumLocks
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MemtablePrefixBloomBits test
int
intValue
=
rand
.
nextInt
();
opt
.
setMemtablePrefixBloomBits
(
intValue
);
assert
(
opt
.
memtablePrefixBloomBits
()
==
intValue
);
@Test
public
void
memtablePrefixBloomBits
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
int
intValue
=
rand
.
nextInt
();
opt
.
setMemtablePrefixBloomBits
(
intValue
);
assertThat
(
opt
.
memtablePrefixBloomBits
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MemtablePrefixBloomProbes test
int
intValue
=
rand
.
nextInt
();
opt
.
setMemtablePrefixBloomProbes
(
intValue
);
assert
(
opt
.
memtablePrefixBloomProbes
()
==
intValue
);
@Test
public
void
memtablePrefixBloomProbes
()
{
Options
opt
=
null
;
try
{
int
intValue
=
rand
.
nextInt
();
opt
=
new
Options
();
opt
.
setMemtablePrefixBloomProbes
(
intValue
);
assertThat
(
opt
.
memtablePrefixBloomProbes
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// BloomLocality test
int
intValue
=
rand
.
nextInt
();
opt
.
setBloomLocality
(
intValue
);
assert
(
opt
.
bloomLocality
()
==
intValue
);
@Test
public
void
bloomLocality
()
{
Options
opt
=
null
;
try
{
int
intValue
=
rand
.
nextInt
();
opt
=
new
Options
();
opt
.
setBloomLocality
(
intValue
);
assertThat
(
opt
.
bloomLocality
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MaxSuccessiveMerges test
long
longValue
=
rand
.
nextLong
();
opt
.
setMaxSuccessiveMerges
(
longValue
);
assert
(
opt
.
maxSuccessiveMerges
()
==
longValue
);
@Test
public
void
maxSuccessiveMerges
()
throws
RocksDBException
{
Options
opt
=
null
;
try
{
long
longValue
=
rand
.
nextLong
();
opt
=
new
Options
();
opt
.
setMaxSuccessiveMerges
(
longValue
);
assertThat
(
opt
.
maxSuccessiveMerges
()).
isEqualTo
(
longValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
{
// MinPartialMergeOperands test
int
intValue
=
rand
.
nextInt
();
opt
.
setMinPartialMergeOperands
(
intValue
);
assert
(
opt
.
minPartialMergeOperands
()
==
intValue
);
}
@Test
public
void
minPartialMergeOperands
()
{
Options
opt
=
null
;
try
{
int
intValue
=
rand
.
nextInt
();
opt
=
new
Options
();
opt
.
setMinPartialMergeOperands
(
intValue
);
assertThat
(
opt
.
minPartialMergeOperands
()).
isEqualTo
(
intValue
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
...
...
java/org/rocksdb/test/WriteBatchHandlerTest.java
浏览文件 @
e46450da
...
...
@@ -75,10 +75,10 @@ public class WriteBatchHandlerTest {
// compare the results to the test data
final
List
<
Tuple
<
Action
,
Tuple
<
byte
[],
byte
[]>>>
actualEvents
=
handler
.
getEvents
();
assert
(
testEvents
.
size
()
==
actualEvents
.
size
());
assert
That
(
testEvents
.
size
()).
isSameAs
(
actualEvents
.
size
());
for
(
int
i
=
0
;
i
<
testEvents
.
size
();
i
++)
{
assert
(
equals
(
testEvents
.
get
(
i
),
actualEvents
.
get
(
i
))
);
assert
That
(
equals
(
testEvents
.
get
(
i
),
actualEvents
.
get
(
i
))).
isTrue
(
);
}
System
.
out
.
println
(
"Passed WriteBatchHandler Test"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录