Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
a280af2a
R
rocksdb
项目概览
kvdb
/
rocksdb
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a280af2a
编写于
11月 15, 2014
作者:
F
fyrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RocksJava] Sigsegv fix for MergerOperatorByName
上级
274ba627
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
67 addition
and
10 deletion
+67
-10
java/Makefile
java/Makefile
+3
-1
java/org/rocksdb/ColumnFamilyOptions.java
java/org/rocksdb/ColumnFamilyOptions.java
+2
-0
java/org/rocksdb/Options.java
java/org/rocksdb/Options.java
+2
-0
java/org/rocksdb/test/MergeTest.java
java/org/rocksdb/test/MergeTest.java
+47
-0
java/rocksjni.pom
java/rocksjni.pom
+1
-1
java/rocksjni/options.cc
java/rocksjni/options.cc
+12
-8
未找到文件。
java/Makefile
浏览文件 @
a280af2a
...
...
@@ -56,6 +56,7 @@ JAVA_TESTS = org.rocksdb.test.BackupableDBOptionsTest\
org.rocksdb.test.ComparatorTest
\
org.rocksdb.test.DBOptionsTest
\
org.rocksdb.test.DirectComparatorTest
\
org.rocksdb.test.EnvironmentTest
\
org.rocksdb.test.FilterTest
\
org.rocksdb.test.FlushTest
\
org.rocksdb.test.InfoLogLevelTest
\
...
...
@@ -70,6 +71,7 @@ JAVA_TESTS = org.rocksdb.test.BackupableDBOptionsTest\
org.rocksdb.test.RocksDBTest
\
org.rocksdb.test.RocksEnvTest
\
org.rocksdb.test.RocksIteratorTest
\
org.rocksdb.test.SizeUnitTest
\
org.rocksdb.test.SnapshotTest
\
org.rocksdb.test.StatisticsCollectorTest
\
org.rocksdb.test.WriteBatchHandlerTest
\
...
...
@@ -130,7 +132,7 @@ resolve_test_deps:
test
-s
"
$(JAVA_ASSERTJ_JAR)
"
||
curl
-k
-L
-o
"
$(JAVA_ASSERTJ_JAR)
"
http://central.maven.org/maven2/org/assertj/assertj-core/1.7.0/assertj-core-1.7.0.jar
test
:
java resolve_test_deps
java
-ea
-Djava
.library.path
=
.:../
-cp
"
$(JAVA_TESTCLASSPATH)
"
org.rocksdb.test.RocksJunitRunner
$(JAVA_TESTS)
java
-ea
-
Xcheck
:jni
-
Djava
.library.path
=
.:../
-cp
"
$(JAVA_TESTCLASSPATH)
"
org.rocksdb.test.RocksJunitRunner
$(JAVA_TESTS)
db_bench
:
java
javac org/rocksdb/benchmark/
*
.java
java/org/rocksdb/ColumnFamilyOptions.java
浏览文件 @
a280af2a
...
...
@@ -127,6 +127,8 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public
ColumnFamilyOptions
setMergeOperatorName
(
String
name
)
{
assert
(
isInitialized
());
assert
(
name
!=
null
);
setMergeOperatorName
(
nativeHandle_
,
name
);
return
this
;
}
...
...
java/org/rocksdb/Options.java
浏览文件 @
a280af2a
...
...
@@ -165,6 +165,8 @@ public class Options extends RocksObject
@Override
public
Options
setMergeOperatorName
(
String
name
)
{
assert
(
isInitialized
());
assert
(
name
!=
null
);
setMergeOperatorName
(
nativeHandle_
,
name
);
return
this
;
}
...
...
java/org/rocksdb/test/MergeTest.java
浏览文件 @
a280af2a
...
...
@@ -8,6 +8,7 @@ package org.rocksdb.test;
import
java.util.List
;
import
java.util.ArrayList
;
import
org.junit.Assert
;
import
org.junit.ClassRule
;
import
org.junit.Rule
;
import
org.junit.Test
;
...
...
@@ -252,4 +253,50 @@ public class MergeTest {
}
}
}
@Test
public
void
emptyStringInSetMergeOperatorByName
()
{
Options
opt
=
null
;
ColumnFamilyOptions
cOpt
=
null
;
try
{
opt
=
new
Options
();
cOpt
=
new
ColumnFamilyOptions
();
opt
.
setMergeOperatorName
(
""
);
cOpt
.
setMergeOperatorName
(
""
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
if
(
cOpt
!=
null
)
{
cOpt
.
dispose
();
}
}
}
@Test
(
expected
=
AssertionError
.
class
)
public
void
nullStringInSetMergeOperatorByNameOptions
()
{
Options
opt
=
null
;
try
{
opt
=
new
Options
();
opt
.
setMergeOperatorName
(
null
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
@Test
(
expected
=
AssertionError
.
class
)
public
void
nullStringInSetMergeOperatorByNameColumnFamilyOptions
()
{
ColumnFamilyOptions
opt
=
null
;
try
{
opt
=
new
ColumnFamilyOptions
();
opt
.
setMergeOperatorName
(
null
);
}
finally
{
if
(
opt
!=
null
)
{
opt
.
dispose
();
}
}
}
}
java/rocksjni.pom
浏览文件 @
a280af2a
...
...
@@ -118,7 +118,7 @@
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.17
</version>
<configuration>
<argLine>
${argLine}
</argLine>
<argLine>
${argLine}
-Xcheck:jni
</argLine>
</configuration>
</plugin>
<plugin>
...
...
java/rocksjni/options.cc
浏览文件 @
a280af2a
...
...
@@ -146,10 +146,12 @@ void Java_org_rocksdb_Options_setComparatorHandle__JJ(
* Signature: (JJjava/lang/String)V
*/
void
Java_org_rocksdb_Options_setMergeOperatorName
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
jhandle
,
jstring
name
)
{
const
char
*
op_name
=
env
->
GetStringUTFChars
(
name
,
0
);
reinterpret_cast
<
rocksdb
::
Options
*>
(
jhandle
)
->
merge_operator
=
rocksdb
::
MergeOperators
::
CreateFromStringId
(
op_name
);
JNIEnv
*
env
,
jobject
jobj
,
jlong
jhandle
,
jstring
jop_name
)
{
auto
options
=
reinterpret_cast
<
rocksdb
::
Options
*>
(
jhandle
);
const
char
*
op_name
=
env
->
GetStringUTFChars
(
jop_name
,
0
);
options
->
merge_operator
=
rocksdb
::
MergeOperators
::
CreateFromStringId
(
op_name
);
env
->
ReleaseStringUTFChars
(
jop_name
,
op_name
);
}
/*
...
...
@@ -1884,10 +1886,12 @@ void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JI(
* Signature: (JJjava/lang/String)V
*/
void
Java_org_rocksdb_ColumnFamilyOptions_setMergeOperatorName
(
JNIEnv
*
env
,
jobject
jobj
,
jlong
jhandle
,
jstring
name
)
{
const
char
*
op_name
=
env
->
GetStringUTFChars
(
name
,
0
);
reinterpret_cast
<
rocksdb
::
ColumnFamilyOptions
*>
(
jhandle
)
->
merge_operator
=
rocksdb
::
MergeOperators
::
CreateFromStringId
(
op_name
);
JNIEnv
*
env
,
jobject
jobj
,
jlong
jhandle
,
jstring
jop_name
)
{
auto
options
=
reinterpret_cast
<
rocksdb
::
ColumnFamilyOptions
*>
(
jhandle
);
const
char
*
op_name
=
env
->
GetStringUTFChars
(
jop_name
,
0
);
options
->
merge_operator
=
rocksdb
::
MergeOperators
::
CreateFromStringId
(
op_name
);
env
->
ReleaseStringUTFChars
(
jop_name
,
op_name
);
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录