Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
b011e201
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,发现更多精彩内容 >>
提交
b011e201
编写于
10月 26, 2014
作者:
F
fyrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Integrated review comments by ankgup87
- Added tests - Minor code-style changes
上级
2c1bd884
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
119 addition
and
8 deletion
+119
-8
java/Makefile
java/Makefile
+2
-0
java/org/rocksdb/BlockBasedTableConfig.java
java/org/rocksdb/BlockBasedTableConfig.java
+2
-0
java/org/rocksdb/ChecksumType.java
java/org/rocksdb/ChecksumType.java
+2
-2
java/org/rocksdb/EncodingType.java
java/org/rocksdb/EncodingType.java
+2
-2
java/org/rocksdb/IndexType.java
java/org/rocksdb/IndexType.java
+1
-1
java/org/rocksdb/PlainTableConfig.java
java/org/rocksdb/PlainTableConfig.java
+3
-3
java/org/rocksdb/test/BlockBasedTableConfigTest.java
java/org/rocksdb/test/BlockBasedTableConfigTest.java
+64
-0
java/org/rocksdb/test/PlainTableConfigTest.java
java/org/rocksdb/test/PlainTableConfigTest.java
+43
-0
未找到文件。
java/Makefile
浏览文件 @
b011e201
...
...
@@ -39,11 +39,13 @@ test: java
javac org/rocksdb/test/
*
.java
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.WriteBatchTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.BackupableDBTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.BlockBasedTableConfigTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.ColumnFamilyTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.FilterTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.KeyMayExistTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.MemTableTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.OptionsTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.PlainTableConfigTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.ReadOnlyTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.MergeTest
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(ROCKSDB_JAR)
:.:./*"
org.rocksdb.test.ReadOptionsTest
...
...
java/org/rocksdb/BlockBasedTableConfig.java
浏览文件 @
b011e201
...
...
@@ -14,6 +14,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
public
BlockBasedTableConfig
()
{
noBlockCache_
=
false
;
blockCacheSize_
=
8
*
1024
*
1024
;
blockCacheNumShardBits_
=
0
;
blockSize_
=
4
*
1024
;
blockSizeDeviation_
=
10
;
blockRestartInterval_
=
16
;
...
...
@@ -22,6 +23,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
cacheIndexAndFilterBlocks_
=
false
;
hashIndexAllowCollision_
=
true
;
blockCacheCompressedSize_
=
0
;
blockCacheCompressedNumShardBits_
=
0
;
checksumType_
=
ChecksumType
.
kCRC32c
;
indexType_
=
IndexType
.
kBinarySearch
;
}
...
...
java/org/rocksdb/ChecksumType.java
浏览文件 @
b011e201
...
...
@@ -16,11 +16,11 @@ public enum ChecksumType {
/**
* CRC32 Checksum
*/
kCRC32c
((
byte
)
1
),
kCRC32c
((
byte
)
1
),
/**
* XX Hash
*/
kxxHash
((
byte
)
2
);
kxxHash
((
byte
)
2
);
private
final
byte
value_
;
...
...
java/org/rocksdb/EncodingType.java
浏览文件 @
b011e201
...
...
@@ -22,7 +22,7 @@ public enum EncodingType {
/**
* Always write full keys without any special encoding.
*/
kPlain
((
byte
)
0
),
kPlain
((
byte
)
0
),
/**
* <p>Find opportunity to write the same prefix once for multiple rows.
* In some cases, when a key follows a previous key with the same prefix,
...
...
@@ -36,7 +36,7 @@ public enum EncodingType {
* bitwise compared to the prefix extractors stored in the file. An error
* will be returned if the two don't match.</p>
*/
kPrefix
((
byte
)
1
);
kPrefix
((
byte
)
1
);
private
final
byte
value_
;
...
...
java/org/rocksdb/IndexType.java
浏览文件 @
b011e201
...
...
@@ -18,7 +18,7 @@ public enum IndexType {
* The hash index, if enabled, will do the hash lookup when
* {@code Options.prefix_extractor} is provided.
*/
kHashSearch
((
byte
)
1
);
kHashSearch
((
byte
)
1
);
private
final
byte
value_
;
...
...
java/org/rocksdb/PlainTableConfig.java
浏览文件 @
b011e201
...
...
@@ -131,11 +131,11 @@ public class PlainTableConfig extends TableFormatConfig {
*
* <p>See linux doc Documentation/vm/hugetlbpage.txt</p>
*
* @param hugePageTlbSize
_
* @param hugePageTlbSize
* @return the reference to the current config.
*/
public
PlainTableConfig
setHugePageTlbSize
_
(
int
hugePageTlbSize_
)
{
this
.
hugePageTlbSize_
=
hugePageTlbSize
_
;
public
PlainTableConfig
setHugePageTlbSize
(
int
hugePageTlbSize
)
{
this
.
hugePageTlbSize_
=
hugePageTlbSize
;
return
this
;
}
...
...
java/org/rocksdb/test/BlockBasedTableConfigTest.java
0 → 100644
浏览文件 @
b011e201
// 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.rocksdb.BlockBasedTableConfig
;
import
org.rocksdb.ChecksumType
;
import
org.rocksdb.IndexType
;
public
class
BlockBasedTableConfigTest
{
public
static
void
main
(
String
[]
args
)
{
BlockBasedTableConfig
blockBasedTableConfig
=
new
BlockBasedTableConfig
();
assert
(!
blockBasedTableConfig
.
noBlockCache
());
blockBasedTableConfig
.
setNoBlockCache
(
true
);
assert
(
blockBasedTableConfig
.
noBlockCache
());
assert
(
blockBasedTableConfig
.
blockCacheSize
()
==
(
8
*
1024
*
1024
));
blockBasedTableConfig
.
setBlockCacheSize
(
8
*
1024
);
assert
(
blockBasedTableConfig
.
blockCacheSize
()
==
(
8
*
1024
));
assert
(
blockBasedTableConfig
.
blockSizeDeviation
()
==
10
);
blockBasedTableConfig
.
setBlockSizeDeviation
(
12
);
assert
(
blockBasedTableConfig
.
blockSizeDeviation
()
==
12
);
assert
(
blockBasedTableConfig
.
blockRestartInterval
()
==
16
);
blockBasedTableConfig
.
setBlockRestartInterval
(
15
);
assert
(
blockBasedTableConfig
.
blockRestartInterval
()
==
15
);
assert
(
blockBasedTableConfig
.
wholeKeyFiltering
());
blockBasedTableConfig
.
setWholeKeyFiltering
(
false
);
assert
(!
blockBasedTableConfig
.
wholeKeyFiltering
());
assert
(!
blockBasedTableConfig
.
cacheIndexAndFilterBlocks
());
blockBasedTableConfig
.
setCacheIndexAndFilterBlocks
(
true
);
assert
(
blockBasedTableConfig
.
cacheIndexAndFilterBlocks
());
assert
(
blockBasedTableConfig
.
hashIndexAllowCollision
());
blockBasedTableConfig
.
setHashIndexAllowCollision
(
false
);
assert
(!
blockBasedTableConfig
.
hashIndexAllowCollision
());
assert
(
blockBasedTableConfig
.
blockCacheCompressedSize
()
==
0
);
blockBasedTableConfig
.
setBlockCacheCompressedSize
(
40
);
assert
(
blockBasedTableConfig
.
blockCacheCompressedSize
()
==
40
);
assert
(
blockBasedTableConfig
.
checksumType
().
equals
(
ChecksumType
.
kCRC32c
));
blockBasedTableConfig
.
setChecksumType
(
ChecksumType
.
kNoChecksum
);
assert
(
blockBasedTableConfig
.
checksumType
().
equals
(
ChecksumType
.
kNoChecksum
));
blockBasedTableConfig
.
setChecksumType
(
ChecksumType
.
kxxHash
);
assert
(
blockBasedTableConfig
.
checksumType
().
equals
(
ChecksumType
.
kxxHash
));
assert
(
blockBasedTableConfig
.
indexType
().
equals
(
IndexType
.
kBinarySearch
));
blockBasedTableConfig
.
setIndexType
(
IndexType
.
kHashSearch
);
assert
(
blockBasedTableConfig
.
indexType
().
equals
(
IndexType
.
kHashSearch
));
assert
(
blockBasedTableConfig
.
blockCacheCompressedNumShardBits
()
==
0
);
blockBasedTableConfig
.
setBlockCacheCompressedNumShardBits
(
4
);
assert
(
blockBasedTableConfig
.
blockCacheCompressedNumShardBits
()
==
4
);
assert
(
blockBasedTableConfig
.
cacheNumShardBits
()
==
0
);
blockBasedTableConfig
.
setCacheNumShardBits
(
5
);
assert
(
blockBasedTableConfig
.
cacheNumShardBits
()
==
5
);
System
.
out
.
println
(
"BlockBasedTableConfig test passed"
);
}
}
java/org/rocksdb/test/PlainTableConfigTest.java
0 → 100644
浏览文件 @
b011e201
// 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.rocksdb.EncodingType
;
import
org.rocksdb.PlainTableConfig
;
public
class
PlainTableConfigTest
{
public
static
void
main
(
String
[]
args
)
{
PlainTableConfig
plainTableConfig
=
new
PlainTableConfig
();
assert
(
plainTableConfig
.
keySize
()
==
0
);
plainTableConfig
.
setKeySize
(
5
);
assert
(
plainTableConfig
.
keySize
()
==
5
);
assert
(
plainTableConfig
.
bloomBitsPerKey
()
==
10
);
plainTableConfig
.
setBloomBitsPerKey
(
11
);
assert
(
plainTableConfig
.
bloomBitsPerKey
()
==
11
);
assert
(
plainTableConfig
.
hashTableRatio
()
==
0.75
);
plainTableConfig
.
setHashTableRatio
(
0.95
);
assert
(
plainTableConfig
.
hashTableRatio
()
==
0.95
);
assert
(
plainTableConfig
.
indexSparseness
()
==
16
);
plainTableConfig
.
setIndexSparseness
(
18
);
assert
(
plainTableConfig
.
indexSparseness
()
==
18
);
assert
(
plainTableConfig
.
hugePageTlbSize
()
==
0
);
plainTableConfig
.
setHugePageTlbSize
(
1
);
assert
(
plainTableConfig
.
hugePageTlbSize
()
==
1
);
assert
(
plainTableConfig
.
encodingType
().
equals
(
EncodingType
.
kPlain
));
plainTableConfig
.
setEncodingType
(
EncodingType
.
kPrefix
);
assert
(
plainTableConfig
.
encodingType
().
equals
(
EncodingType
.
kPrefix
));
assert
(!
plainTableConfig
.
fullScanMode
());
plainTableConfig
.
setFullScanMode
(
true
);
assert
(
plainTableConfig
.
fullScanMode
());
assert
(!
plainTableConfig
.
storeIndexInFile
());
plainTableConfig
.
setStoreIndexInFile
(
true
);
assert
(
plainTableConfig
.
storeIndexInFile
());
System
.
out
.
println
(
"PlainTableConfig test passed"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录