Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
NATIVE_JAVA_CLASSES = \
|
|
|
|
org.rocksdb.AbstractCompactionFilter\
|
2017-10-12 20:06:51 +02:00
|
|
|
org.rocksdb.AbstractCompactionFilterFactory\
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
org.rocksdb.AbstractComparator\
|
2020-10-14 20:32:10 +02:00
|
|
|
org.rocksdb.AbstractEventListener\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.AbstractSlice\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.AbstractTableFilter\
|
|
|
|
org.rocksdb.AbstractTraceWriter\
|
2018-03-02 19:22:38 +01:00
|
|
|
org.rocksdb.AbstractTransactionNotifier\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.AbstractWalFilter\
|
2015-08-05 01:07:17 +02:00
|
|
|
org.rocksdb.BackupEngine\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.BackupableDBOptions\
|
|
|
|
org.rocksdb.BlockBasedTableConfig\
|
|
|
|
org.rocksdb.BloomFilter\
|
2014-11-21 21:57:32 +01:00
|
|
|
org.rocksdb.Checkpoint\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.ClockCache\
|
2017-07-21 23:42:32 +02:00
|
|
|
org.rocksdb.CassandraCompactionFilter\
|
2017-06-16 23:12:52 +02:00
|
|
|
org.rocksdb.CassandraValueMergeOperator\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.ColumnFamilyHandle\
|
2014-10-31 23:39:14 +01:00
|
|
|
org.rocksdb.ColumnFamilyOptions\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.CompactionJobInfo\
|
|
|
|
org.rocksdb.CompactionJobStats\
|
|
|
|
org.rocksdb.CompactionOptions\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.CompactionOptionsFIFO\
|
|
|
|
org.rocksdb.CompactionOptionsUniversal\
|
2018-08-17 19:52:58 +02:00
|
|
|
org.rocksdb.CompactRangeOptions\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.ComparatorOptions\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.CompressionOptions\
|
2020-04-22 02:35:28 +02:00
|
|
|
org.rocksdb.ConfigOptions\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.DBOptions\
|
|
|
|
org.rocksdb.DirectSlice\
|
2015-03-22 18:30:51 +01:00
|
|
|
org.rocksdb.Env\
|
2016-09-29 23:04:41 +02:00
|
|
|
org.rocksdb.EnvOptions\
|
2014-11-09 20:09:39 +01:00
|
|
|
org.rocksdb.FlushOptions\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.Filter\
|
2017-05-22 19:22:49 +02:00
|
|
|
org.rocksdb.IngestExternalFileOptions\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.HashLinkedListMemTableConfig\
|
|
|
|
org.rocksdb.HashSkipListMemTableConfig\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.HdfsEnv\
|
2020-09-09 21:42:54 +02:00
|
|
|
org.rocksdb.ConcurrentTaskLimiter\
|
|
|
|
org.rocksdb.ConcurrentTaskLimiterImpl\
|
2015-03-10 23:16:21 +01:00
|
|
|
org.rocksdb.Logger\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.LRUCache\
|
2018-10-08 20:03:34 +02:00
|
|
|
org.rocksdb.MemoryUsageType\
|
|
|
|
org.rocksdb.MemoryUtil\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.MergeOperator\
|
2018-03-08 20:16:46 +01:00
|
|
|
org.rocksdb.NativeComparatorWrapper\
|
2018-03-02 19:22:38 +01:00
|
|
|
org.rocksdb.OptimisticTransactionDB\
|
|
|
|
org.rocksdb.OptimisticTransactionOptions\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.Options\
|
2017-09-22 02:15:27 +02:00
|
|
|
org.rocksdb.OptionsUtil\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.PersistentCache\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.PlainTableConfig\
|
2016-10-07 21:32:21 +02:00
|
|
|
org.rocksdb.RateLimiter\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.ReadOptions\
|
2015-07-14 18:48:16 +02:00
|
|
|
org.rocksdb.RemoveEmptyValueCompactionFilter\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.RestoreOptions\
|
2017-10-12 20:06:51 +02:00
|
|
|
org.rocksdb.RocksCallbackObject\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.RocksDB\
|
|
|
|
org.rocksdb.RocksEnv\
|
|
|
|
org.rocksdb.RocksIterator\
|
2015-03-22 18:30:51 +01:00
|
|
|
org.rocksdb.RocksMemEnv\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.SkipListMemTableConfig\
|
|
|
|
org.rocksdb.Slice\
|
2018-04-07 06:22:37 +02:00
|
|
|
org.rocksdb.SstFileManager\
|
2016-09-29 23:04:41 +02:00
|
|
|
org.rocksdb.SstFileWriter\
|
2019-09-10 03:11:02 +02:00
|
|
|
org.rocksdb.SstFileReader\
|
|
|
|
org.rocksdb.SstFileReaderIterator\
|
2020-07-24 22:43:14 +02:00
|
|
|
org.rocksdb.SstPartitionerFactory\
|
|
|
|
org.rocksdb.SstPartitionerFixedPrefixFactory\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.Statistics\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.ThreadStatus\
|
|
|
|
org.rocksdb.TimedEnv\
|
2018-03-02 19:22:38 +01:00
|
|
|
org.rocksdb.Transaction\
|
|
|
|
org.rocksdb.TransactionDB\
|
|
|
|
org.rocksdb.TransactionDBOptions\
|
|
|
|
org.rocksdb.TransactionOptions\
|
2015-01-25 22:05:29 +01:00
|
|
|
org.rocksdb.TransactionLogIterator\
|
2014-11-17 19:22:44 +01:00
|
|
|
org.rocksdb.TtlDB\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.VectorMemTableConfig\
|
2015-01-30 21:05:45 +01:00
|
|
|
org.rocksdb.Snapshot\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.StringAppendOperator\
|
2018-10-13 02:33:55 +02:00
|
|
|
org.rocksdb.UInt64AddOperator\
|
2014-11-09 20:08:35 +01:00
|
|
|
org.rocksdb.WriteBatch\
|
|
|
|
org.rocksdb.WriteBatch.Handler\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.WriteOptions\
|
2015-01-03 15:52:07 +01:00
|
|
|
org.rocksdb.WriteBatchWithIndex\
|
2018-10-17 20:47:51 +02:00
|
|
|
org.rocksdb.WriteBufferManager\
|
2015-01-03 15:52:07 +01:00
|
|
|
org.rocksdb.WBWIRocksIterator
|
2014-05-14 07:22:21 +02:00
|
|
|
|
2020-12-17 00:58:56 +01:00
|
|
|
NATIVE_JAVA_TEST_CLASSES = \
|
|
|
|
org.rocksdb.RocksDBExceptionTest\
|
|
|
|
org.rocksdb.test.TestableEventListener\
|
2018-03-08 20:16:46 +01:00
|
|
|
org.rocksdb.NativeComparatorWrapperTest.NativeStringComparatorWrapper\
|
2016-08-22 20:01:42 +02:00
|
|
|
org.rocksdb.WriteBatchTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.WriteBatchTestInternalHelper
|
|
|
|
|
2014-10-07 20:43:04 +02:00
|
|
|
ROCKSDB_MAJOR = $(shell egrep "ROCKSDB_MAJOR.[0-9]" ../include/rocksdb/version.h | cut -d ' ' -f 3)
|
|
|
|
ROCKSDB_MINOR = $(shell egrep "ROCKSDB_MINOR.[0-9]" ../include/rocksdb/version.h | cut -d ' ' -f 3)
|
|
|
|
ROCKSDB_PATCH = $(shell egrep "ROCKSDB_PATCH.[0-9]" ../include/rocksdb/version.h | cut -d ' ' -f 3)
|
2014-10-02 20:07:45 +02:00
|
|
|
|
Add a jni library for rocksdb which supports Open, Get, Put, and Close.
Summary:
This diff contains a simple jni library for rocksdb which supports open, get,
put and closeusing default options (including Options, ReadOptions, and
WriteOptions.) In the usual case, Java developers can use the c++ rocksdb
library in the way similar to the following:
RocksDB db = RocksDB.open(path_to_db);
...
db.put("hello".getBytes(), "world".getBytes();
byte[] value = db.get("hello".getBytes());
...
db.close();
Specifically, this diff has the following major classes:
* RocksDB: a Java wrapper class which forwards the operations
from the java side to c++ rocksdb library.
* RocksDBException: ncapsulates the error of an operation.
This exception type is used to describe an internal error from
the c++ rocksdb library.
This diff also include a simple java sample code calling c++ rocksdb library.
To build the rocksdb jni library, simply run make jni, and make jtest will try to
build and run the sample code.
Note that if the rocksdb is not built with the default glibc that Java uses,
java will try to load the wrong glibc during the run time. As a result,
the sample code might not work properly during the run time.
Test Plan:
* make jni
* make jtest
Reviewers: haobo, dhruba, sdong, igor, ljin
Reviewed By: dhruba
CC: leveldb, xjin
Differential Revision: https://reviews.facebook.net/D17109
2014-03-28 22:19:21 +01:00
|
|
|
NATIVE_INCLUDE = ./include
|
2014-09-26 22:57:12 +02:00
|
|
|
ARCH := $(shell getconf LONG_BIT)
|
2014-10-02 20:07:45 +02:00
|
|
|
ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-linux$(ARCH).jar
|
2014-09-26 22:57:12 +02:00
|
|
|
ifeq ($(PLATFORM), OS_MACOSX)
|
2014-10-02 20:07:45 +02:00
|
|
|
ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-osx.jar
|
2014-09-26 22:57:12 +02:00
|
|
|
endif
|
Add a jni library for rocksdb which supports Open, Get, Put, and Close.
Summary:
This diff contains a simple jni library for rocksdb which supports open, get,
put and closeusing default options (including Options, ReadOptions, and
WriteOptions.) In the usual case, Java developers can use the c++ rocksdb
library in the way similar to the following:
RocksDB db = RocksDB.open(path_to_db);
...
db.put("hello".getBytes(), "world".getBytes();
byte[] value = db.get("hello".getBytes());
...
db.close();
Specifically, this diff has the following major classes:
* RocksDB: a Java wrapper class which forwards the operations
from the java side to c++ rocksdb library.
* RocksDBException: ncapsulates the error of an operation.
This exception type is used to describe an internal error from
the c++ rocksdb library.
This diff also include a simple java sample code calling c++ rocksdb library.
To build the rocksdb jni library, simply run make jni, and make jtest will try to
build and run the sample code.
Note that if the rocksdb is not built with the default glibc that Java uses,
java will try to load the wrong glibc during the run time. As a result,
the sample code might not work properly during the run time.
Test Plan:
* make jni
* make jtest
Reviewers: haobo, dhruba, sdong, igor, ljin
Reviewed By: dhruba
CC: leveldb, xjin
Differential Revision: https://reviews.facebook.net/D17109
2014-03-28 22:19:21 +01:00
|
|
|
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
JAVA_TESTS = \
|
|
|
|
org.rocksdb.BackupableDBOptionsTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.BackupEngineTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.BlockBasedTableConfigTest\
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
org.rocksdb.BuiltinComparatorTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.util.BytewiseComparatorTest\
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
org.rocksdb.util.BytewiseComparatorIntTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.CheckPointTest\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.ClockCacheTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.ColumnFamilyOptionsTest\
|
|
|
|
org.rocksdb.ColumnFamilyTest\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.CompactionFilterFactoryTest\
|
|
|
|
org.rocksdb.CompactionJobInfoTest\
|
|
|
|
org.rocksdb.CompactionJobStatsTest\
|
|
|
|
org.rocksdb.CompactionOptionsTest\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.CompactionOptionsFIFOTest\
|
|
|
|
org.rocksdb.CompactionOptionsUniversalTest\
|
|
|
|
org.rocksdb.CompactionPriorityTest\
|
|
|
|
org.rocksdb.CompactionStopStyleTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.ComparatorOptionsTest\
|
|
|
|
org.rocksdb.CompressionOptionsTest\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.CompressionTypesTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.DBOptionsTest\
|
|
|
|
org.rocksdb.DirectSliceTest\
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
org.rocksdb.util.EnvironmentTest\
|
2016-09-29 23:04:41 +02:00
|
|
|
org.rocksdb.EnvOptionsTest\
|
2020-10-14 20:32:10 +02:00
|
|
|
org.rocksdb.EventListenerTest\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.HdfsEnvTest\
|
2017-05-22 19:22:49 +02:00
|
|
|
org.rocksdb.IngestExternalFileOptionsTest\
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
org.rocksdb.util.IntComparatorTest\
|
|
|
|
org.rocksdb.util.JNIComparatorTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.FilterTest\
|
|
|
|
org.rocksdb.FlushTest\
|
|
|
|
org.rocksdb.InfoLogLevelTest\
|
|
|
|
org.rocksdb.KeyMayExistTest\
|
2020-09-09 21:42:54 +02:00
|
|
|
org.rocksdb.ConcurrentTaskLimiterTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.LoggerTest\
|
2017-09-22 02:15:27 +02:00
|
|
|
org.rocksdb.LRUCacheTest\
|
2018-10-08 20:03:34 +02:00
|
|
|
org.rocksdb.MemoryUtilTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.MemTableTest\
|
|
|
|
org.rocksdb.MergeTest\
|
|
|
|
org.rocksdb.MixedOptionsTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.MutableColumnFamilyOptionsTest\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.MutableDBOptionsTest\
|
2018-03-08 20:16:46 +01:00
|
|
|
org.rocksdb.NativeComparatorWrapperTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.NativeLibraryLoaderTest\
|
2018-03-02 19:22:38 +01:00
|
|
|
org.rocksdb.OptimisticTransactionTest\
|
|
|
|
org.rocksdb.OptimisticTransactionDBTest\
|
|
|
|
org.rocksdb.OptimisticTransactionOptionsTest\
|
2017-09-22 02:15:27 +02:00
|
|
|
org.rocksdb.OptionsUtilTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.OptionsTest\
|
|
|
|
org.rocksdb.PlainTableConfigTest\
|
2017-02-28 01:26:12 +01:00
|
|
|
org.rocksdb.RateLimiterTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.ReadOnlyTest\
|
|
|
|
org.rocksdb.ReadOptionsTest\
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
org.rocksdb.util.ReverseBytewiseComparatorIntTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.RocksDBTest\
|
2016-08-22 20:01:42 +02:00
|
|
|
org.rocksdb.RocksDBExceptionTest\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.DefaultEnvTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.RocksIteratorTest\
|
2015-03-22 18:30:51 +01:00
|
|
|
org.rocksdb.RocksMemEnvTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.util.SizeUnitTest\
|
2020-07-06 20:47:00 +02:00
|
|
|
org.rocksdb.SecondaryDBTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.SliceTest\
|
|
|
|
org.rocksdb.SnapshotTest\
|
2018-04-07 06:22:37 +02:00
|
|
|
org.rocksdb.SstFileManagerTest\
|
2016-09-29 23:04:41 +02:00
|
|
|
org.rocksdb.SstFileWriterTest\
|
2019-09-10 03:11:02 +02:00
|
|
|
org.rocksdb.SstFileReaderTest\
|
2020-07-24 22:43:14 +02:00
|
|
|
org.rocksdb.SstPartitionerTest\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.TableFilterTest\
|
|
|
|
org.rocksdb.TimedEnvTest\
|
2018-03-02 19:22:38 +01:00
|
|
|
org.rocksdb.TransactionTest\
|
|
|
|
org.rocksdb.TransactionDBTest\
|
|
|
|
org.rocksdb.TransactionOptionsTest\
|
|
|
|
org.rocksdb.TransactionDBOptionsTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.TransactionLogIteratorTest\
|
|
|
|
org.rocksdb.TtlDBTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.StatisticsTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.StatisticsCollectorTest\
|
2019-02-22 23:36:38 +01:00
|
|
|
org.rocksdb.WalFilterTest\
|
2017-03-30 21:04:09 +02:00
|
|
|
org.rocksdb.WALRecoveryModeTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.WriteBatchHandlerTest\
|
|
|
|
org.rocksdb.WriteBatchTest\
|
2017-07-12 08:19:53 +02:00
|
|
|
org.rocksdb.WriteBatchThreadedTest\
|
2015-01-31 20:43:09 +01:00
|
|
|
org.rocksdb.WriteOptionsTest\
|
|
|
|
org.rocksdb.WriteBatchWithIndexTest
|
|
|
|
|
2015-01-31 23:23:59 +01:00
|
|
|
MAIN_SRC = src/main/java
|
2015-01-31 20:43:09 +01:00
|
|
|
TEST_SRC = src/test/java
|
|
|
|
OUTPUT = target
|
2015-01-31 23:23:59 +01:00
|
|
|
MAIN_CLASSES = $(OUTPUT)/classes
|
2015-01-31 20:43:09 +01:00
|
|
|
TEST_CLASSES = $(OUTPUT)/test-classes
|
2015-01-31 23:23:59 +01:00
|
|
|
JAVADOC = $(OUTPUT)/apidocs
|
2014-11-02 01:08:41 +01:00
|
|
|
|
2015-01-31 23:42:13 +01:00
|
|
|
BENCHMARK_MAIN_SRC = benchmark/src/main/java
|
|
|
|
BENCHMARK_OUTPUT = benchmark/target
|
|
|
|
BENCHMARK_MAIN_CLASSES = $(BENCHMARK_OUTPUT)/classes
|
|
|
|
|
2015-02-01 00:43:01 +01:00
|
|
|
SAMPLES_MAIN_SRC = samples/src/main/java
|
|
|
|
SAMPLES_OUTPUT = samples/target
|
|
|
|
SAMPLES_MAIN_CLASSES = $(SAMPLES_OUTPUT)/classes
|
|
|
|
|
2015-02-01 00:21:19 +01:00
|
|
|
JAVA_TEST_LIBDIR = test-libs
|
2020-12-17 00:58:56 +01:00
|
|
|
JAVA_JUNIT_VER = 4.12
|
|
|
|
JAVA_JUNIT_JAR = junit-$(JAVA_JUNIT_VER).jar
|
|
|
|
JAVA_JUNIT_JAR_PATH = $(JAVA_TEST_LIBDIR)/$(JAVA_JUNIT_JAR)
|
|
|
|
JAVA_HAMCREST_VER = 1.3
|
|
|
|
JAVA_HAMCREST_JAR = hamcrest-core-$(JAVA_HAMCREST_VER).jar
|
|
|
|
JAVA_HAMCREST_JAR_PATH = $(JAVA_TEST_LIBDIR)/$(JAVA_HAMCREST_JAR)
|
|
|
|
JAVA_MOCKITO_VER = 1.10.19
|
|
|
|
JAVA_MOCKITO_JAR = mockito-all-$(JAVA_MOCKITO_VER).jar
|
|
|
|
JAVA_MOCKITO_JAR_PATH = $(JAVA_TEST_LIBDIR)/$(JAVA_MOCKITO_JAR)
|
|
|
|
JAVA_CGLIB_VER = 2.2.2
|
|
|
|
JAVA_CGLIB_JAR = cglib-$(JAVA_CGLIB_VER).jar
|
|
|
|
JAVA_CGLIB_JAR_PATH = $(JAVA_TEST_LIBDIR)/$(JAVA_CGLIB_JAR)
|
|
|
|
JAVA_ASSERTJ_VER = 1.7.1
|
|
|
|
JAVA_ASSERTJ_JAR = assertj-core-$(JAVA_ASSERTJ_VER).jar
|
|
|
|
JAVA_ASSERTJ_JAR_PATH = $(JAVA_TEST_LIBDIR)/$(JAVA_ASSERTJ_JAR)
|
|
|
|
JAVA_TESTCLASSPATH = $(JAVA_JUNIT_JAR_PATH):$(JAVA_HAMCREST_JAR_PATH):$(JAVA_MOCKITO_JAR_PATH):$(JAVA_CGLIB_JAR_PATH):$(JAVA_ASSERTJ_JAR_PATH)
|
2014-11-02 01:08:41 +01:00
|
|
|
|
2015-07-14 19:39:22 +02:00
|
|
|
MVN_LOCAL = ~/.m2/repository
|
|
|
|
|
2017-02-28 01:26:12 +01:00
|
|
|
# Set the default JAVA_ARGS to "" for DEBUG_LEVEL=0
|
2020-03-12 20:22:03 +01:00
|
|
|
JAVA_ARGS ?=
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2020-03-12 20:22:03 +01:00
|
|
|
JAVAC_ARGS ?=
|
2017-07-12 21:04:55 +02:00
|
|
|
|
2017-02-28 01:26:12 +01:00
|
|
|
# When debugging add -Xcheck:jni to the java args
|
|
|
|
ifneq ($(DEBUG_LEVEL),0)
|
2020-03-12 20:22:03 +01:00
|
|
|
JAVA_ARGS += -ea -Xcheck:jni
|
|
|
|
JAVAC_ARGS += -Xlint:deprecation -Xlint:unchecked
|
2017-02-28 01:26:12 +01:00
|
|
|
endif
|
|
|
|
|
2020-03-13 21:36:45 +01:00
|
|
|
# Using a Facebook AWS account for S3 storage. (maven.org has a history
|
|
|
|
# of failing in Travis builds.)
|
|
|
|
DEPS_URL?=https://rocksdb-deps.s3-us-west-2.amazonaws.com/jars
|
2017-04-22 05:41:37 +02:00
|
|
|
|
2020-01-29 17:00:16 +01:00
|
|
|
clean: clean-not-downloaded clean-downloaded
|
|
|
|
|
|
|
|
clean-not-downloaded:
|
|
|
|
$(AM_V_at)rm -rf $(NATIVE_INCLUDE)
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)rm -rf $(OUTPUT)
|
|
|
|
$(AM_V_at)rm -rf $(BENCHMARK_OUTPUT)
|
|
|
|
$(AM_V_at)rm -rf $(SAMPLES_OUTPUT)
|
2014-11-19 21:15:01 +01:00
|
|
|
|
2020-01-29 17:00:16 +01:00
|
|
|
clean-downloaded:
|
|
|
|
$(AM_V_at)rm -rf $(JAVA_TEST_LIBDIR)
|
|
|
|
|
Add a jni library for rocksdb which supports Open, Get, Put, and Close.
Summary:
This diff contains a simple jni library for rocksdb which supports open, get,
put and closeusing default options (including Options, ReadOptions, and
WriteOptions.) In the usual case, Java developers can use the c++ rocksdb
library in the way similar to the following:
RocksDB db = RocksDB.open(path_to_db);
...
db.put("hello".getBytes(), "world".getBytes();
byte[] value = db.get("hello".getBytes());
...
db.close();
Specifically, this diff has the following major classes:
* RocksDB: a Java wrapper class which forwards the operations
from the java side to c++ rocksdb library.
* RocksDBException: ncapsulates the error of an operation.
This exception type is used to describe an internal error from
the c++ rocksdb library.
This diff also include a simple java sample code calling c++ rocksdb library.
To build the rocksdb jni library, simply run make jni, and make jtest will try to
build and run the sample code.
Note that if the rocksdb is not built with the default glibc that Java uses,
java will try to load the wrong glibc during the run time. As a result,
the sample code might not work properly during the run time.
Test Plan:
* make jni
* make jtest
Reviewers: haobo, dhruba, sdong, igor, ljin
Reviewed By: dhruba
CC: leveldb, xjin
Differential Revision: https://reviews.facebook.net/D17109
2014-03-28 22:19:21 +01:00
|
|
|
|
2016-09-16 19:54:31 +02:00
|
|
|
javadocs: java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_GEN)mkdir -p $(JAVADOC)
|
|
|
|
$(AM_V_at)javadoc -d $(JAVADOC) -sourcepath $(MAIN_SRC) -subpackages org
|
2014-10-02 22:57:54 +02:00
|
|
|
|
2015-01-31 20:43:09 +01:00
|
|
|
javalib: java java_test javadocs
|
2014-11-19 21:21:21 +01:00
|
|
|
|
2015-01-31 20:43:09 +01:00
|
|
|
java:
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_GEN)mkdir -p $(MAIN_CLASSES)
|
2019-06-17 19:15:58 +02:00
|
|
|
ifeq ($(shell java -version 2>&1 | grep 1.7.0 > /dev/null; printf $$?), 0)
|
2017-07-12 21:04:55 +02:00
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -d $(MAIN_CLASSES)\
|
2015-01-31 23:23:59 +01:00
|
|
|
$(MAIN_SRC)/org/rocksdb/util/*.java\
|
|
|
|
$(MAIN_SRC)/org/rocksdb/*.java
|
2019-06-17 19:15:58 +02:00
|
|
|
else
|
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -h $(NATIVE_INCLUDE) -d $(MAIN_CLASSES)\
|
|
|
|
$(MAIN_SRC)/org/rocksdb/util/*.java\
|
|
|
|
$(MAIN_SRC)/org/rocksdb/*.java
|
|
|
|
endif
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)@cp ../HISTORY.md ./HISTORY-CPP.md
|
|
|
|
$(AM_V_at)@rm -f ./HISTORY-CPP.md
|
2019-06-17 19:15:58 +02:00
|
|
|
ifeq ($(shell java -version 2>&1 | grep 1.7.0 > /dev/null; printf $$?), 0)
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)javah -cp $(MAIN_CLASSES) -d $(NATIVE_INCLUDE) -jni $(NATIVE_JAVA_CLASSES)
|
2019-06-17 19:15:58 +02:00
|
|
|
endif
|
Add a jni library for rocksdb which supports Open, Get, Put, and Close.
Summary:
This diff contains a simple jni library for rocksdb which supports open, get,
put and closeusing default options (including Options, ReadOptions, and
WriteOptions.) In the usual case, Java developers can use the c++ rocksdb
library in the way similar to the following:
RocksDB db = RocksDB.open(path_to_db);
...
db.put("hello".getBytes(), "world".getBytes();
byte[] value = db.get("hello".getBytes());
...
db.close();
Specifically, this diff has the following major classes:
* RocksDB: a Java wrapper class which forwards the operations
from the java side to c++ rocksdb library.
* RocksDBException: ncapsulates the error of an operation.
This exception type is used to describe an internal error from
the c++ rocksdb library.
This diff also include a simple java sample code calling c++ rocksdb library.
To build the rocksdb jni library, simply run make jni, and make jtest will try to
build and run the sample code.
Note that if the rocksdb is not built with the default glibc that Java uses,
java will try to load the wrong glibc during the run time. As a result,
the sample code might not work properly during the run time.
Test Plan:
* make jni
* make jtest
Reviewers: haobo, dhruba, sdong, igor, ljin
Reviewed By: dhruba
CC: leveldb, xjin
Differential Revision: https://reviews.facebook.net/D17109
2014-03-28 22:19:21 +01:00
|
|
|
|
2014-04-09 09:48:20 +02:00
|
|
|
sample: java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_GEN)mkdir -p $(SAMPLES_MAIN_CLASSES)
|
2017-07-12 21:04:55 +02:00
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -cp $(MAIN_CLASSES) -d $(SAMPLES_MAIN_CLASSES) $(SAMPLES_MAIN_SRC)/RocksDBSample.java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni_not_found
|
2017-02-28 01:26:12 +01:00
|
|
|
java $(JAVA_ARGS) -Djava.library.path=target -cp $(MAIN_CLASSES):$(SAMPLES_MAIN_CLASSES) RocksDBSample /tmp/rocksdbjni
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni_not_found
|
2014-04-02 22:14:55 +02:00
|
|
|
|
2014-11-08 18:58:35 +01:00
|
|
|
column_family_sample: java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_GEN)mkdir -p $(SAMPLES_MAIN_CLASSES)
|
2017-07-12 21:04:55 +02:00
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -cp $(MAIN_CLASSES) -d $(SAMPLES_MAIN_CLASSES) $(SAMPLES_MAIN_SRC)/RocksDBColumnFamilySample.java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
2017-02-28 01:26:12 +01:00
|
|
|
java $(JAVA_ARGS) -Djava.library.path=target -cp $(MAIN_CLASSES):$(SAMPLES_MAIN_CLASSES) RocksDBColumnFamilySample /tmp/rocksdbjni
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
2014-11-08 18:58:35 +01:00
|
|
|
|
2018-03-02 19:22:38 +01:00
|
|
|
transaction_sample: java
|
|
|
|
$(AM_V_GEN)mkdir -p $(SAMPLES_MAIN_CLASSES)
|
|
|
|
$(AM_V_at)javac -cp $(MAIN_CLASSES) -d $(SAMPLES_MAIN_CLASSES) $(SAMPLES_MAIN_SRC)/TransactionSample.java
|
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
|
|
|
java -ea -Xcheck:jni -Djava.library.path=target -cp $(MAIN_CLASSES):$(SAMPLES_MAIN_CLASSES) TransactionSample /tmp/rocksdbjni
|
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
|
|
|
|
|
|
|
optimistic_transaction_sample: java
|
|
|
|
$(AM_V_GEN)mkdir -p $(SAMPLES_MAIN_CLASSES)
|
|
|
|
$(AM_V_at)javac -cp $(MAIN_CLASSES) -d $(SAMPLES_MAIN_CLASSES) $(SAMPLES_MAIN_SRC)/OptimisticTransactionSample.java
|
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
|
|
|
java -ea -Xcheck:jni -Djava.library.path=target -cp $(MAIN_CLASSES):$(SAMPLES_MAIN_CLASSES) OptimisticTransactionSample /tmp/rocksdbjni
|
|
|
|
$(AM_V_at)@rm -rf /tmp/rocksdbjni
|
|
|
|
|
2020-12-17 00:58:56 +01:00
|
|
|
$(JAVA_TEST_LIBDIR):
|
|
|
|
mkdir -p "$(JAVA_TEST_LIBDIR)"
|
|
|
|
|
|
|
|
$(JAVA_JUNIT_JAR_PATH): $(JAVA_TEST_LIBDIR)
|
|
|
|
ifneq (,$(wildcard $(MVN_LOCAL)/junit/junit/$(JAVA_JUNIT_VER)/$(JAVA_JUNIT_JAR)))
|
|
|
|
cp -v $(MVN_LOCAL)/junit/junit/$(JAVA_JUNIT_VER)/$(JAVA_JUNIT_JAR) $(JAVA_TEST_LIBDIR)
|
|
|
|
else
|
|
|
|
curl --fail --insecure --output $(JAVA_JUNIT_JAR_PATH) --location $(DEPS_URL)/$(JAVA_JUNIT_JAR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(JAVA_HAMCREST_JAR_PATH): $(JAVA_TEST_LIBDIR)
|
|
|
|
ifneq (,$(wildcard $(MVN_LOCAL)/org/hamcrest/hamcrest-core/$(JAVA_HAMCREST_VER)/$(JAVA_HAMCREST_JAR)))
|
|
|
|
cp -v $(MVN_LOCAL)/org/hamcrest/hamcrest-core/$(JAVA_HAMCREST_VER)/$(JAVA_HAMCREST_JAR) $(JAVA_TEST_LIBDIR)
|
|
|
|
else
|
|
|
|
curl --fail --insecure --output $(JAVA_HAMCREST_JAR_PATH) --location $(DEPS_URL)/$(JAVA_HAMCREST_JAR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(JAVA_MOCKITO_JAR_PATH): $(JAVA_TEST_LIBDIR)
|
|
|
|
ifneq (,$(wildcard $(MVN_LOCAL)/org/mockito/mockito-all/$(JAVA_MOCKITO_VER)/$(JAVA_MOCKITO_JAR)))
|
|
|
|
cp -v $(MVN_LOCAL)/org/mockito/mockito-all/$(JAVA_MOCKITO_VER)/$(JAVA_MOCKITO_JAR) $(JAVA_TEST_LIBDIR)
|
|
|
|
else
|
|
|
|
curl --fail --insecure --output "$(JAVA_MOCKITO_JAR_PATH)" --location $(DEPS_URL)/$(JAVA_MOCKITO_JAR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(JAVA_CGLIB_JAR_PATH): $(JAVA_TEST_LIBDIR)
|
|
|
|
ifneq (,$(wildcard $(MVN_LOCAL)/cglib/cglib/$(JAVA_CGLIB_VER)/$(JAVA_CGLIB_JAR)))
|
|
|
|
cp -v $(MVN_LOCAL)/cglib/cglib/$(JAVA_CGLIB_VER)/$(JAVA_CGLIB_JAR) $(JAVA_TEST_LIBDIR)
|
|
|
|
else
|
|
|
|
curl --fail --insecure --output "$(JAVA_CGLIB_JAR_PATH)" --location $(DEPS_URL)/$(JAVA_CGLIB_JAR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(JAVA_ASSERTJ_JAR_PATH): $(JAVA_TEST_LIBDIR)
|
|
|
|
ifneq (,$(wildcard $(MVN_LOCAL)/org/assertj/assertj-core/$(JAVA_ASSERTJ_VER)/$(JAVA_ASSERTJ_JAR)))
|
|
|
|
cp -v $(MVN_LOCAL)/org/assertj/assertj-core/$(JAVA_ASSERTJ_VER)/$(JAVA_ASSERTJ_JAR) $(JAVA_TEST_LIBDIR)
|
|
|
|
else
|
|
|
|
curl --fail --insecure --output "$(JAVA_ASSERTJ_JAR_PATH)" --location $(DEPS_URL)/$(JAVA_ASSERTJ_JAR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
resolve_test_deps: $(JAVA_JUNIT_JAR_PATH) $(JAVA_HAMCREST_JAR_PATH) $(JAVA_MOCKITO_JAR_PATH) $(JAVA_CGLIB_JAR_PATH) $(JAVA_ASSERTJ_JAR_PATH)
|
2014-11-02 01:08:41 +01:00
|
|
|
|
2016-09-16 19:54:31 +02:00
|
|
|
java_test: java resolve_test_deps
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_GEN)mkdir -p $(TEST_CLASSES)
|
2019-06-17 19:15:58 +02:00
|
|
|
ifeq ($(shell java -version 2>&1|grep 1.7.0 >/dev/null; printf $$?),0)
|
2017-07-12 21:04:55 +02:00
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -cp $(MAIN_CLASSES):$(JAVA_TESTCLASSPATH) -d $(TEST_CLASSES)\
|
2015-01-31 23:23:59 +01:00
|
|
|
$(TEST_SRC)/org/rocksdb/test/*.java\
|
|
|
|
$(TEST_SRC)/org/rocksdb/util/*.java\
|
|
|
|
$(TEST_SRC)/org/rocksdb/*.java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_at)javah -cp $(MAIN_CLASSES):$(TEST_CLASSES) -d $(NATIVE_INCLUDE) -jni $(NATIVE_JAVA_TEST_CLASSES)
|
2019-06-17 19:15:58 +02:00
|
|
|
else
|
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -cp $(MAIN_CLASSES):$(JAVA_TESTCLASSPATH) -h $(NATIVE_INCLUDE) -d $(TEST_CLASSES)\
|
|
|
|
$(TEST_SRC)/org/rocksdb/test/*.java\
|
|
|
|
$(TEST_SRC)/org/rocksdb/util/*.java\
|
|
|
|
$(TEST_SRC)/org/rocksdb/*.java
|
|
|
|
endif
|
2015-01-31 20:43:09 +01:00
|
|
|
|
2016-09-16 19:54:31 +02:00
|
|
|
test: java java_test run_test
|
2016-07-29 21:55:54 +02:00
|
|
|
|
|
|
|
run_test:
|
2017-02-28 01:26:12 +01:00
|
|
|
java $(JAVA_ARGS) -Djava.library.path=target -cp "$(MAIN_CLASSES):$(TEST_CLASSES):$(JAVA_TESTCLASSPATH):target/*" org.rocksdb.test.RocksJunitRunner $(JAVA_TESTS)
|
2014-04-09 09:48:20 +02:00
|
|
|
|
|
|
|
db_bench: java
|
2015-09-16 21:38:17 +02:00
|
|
|
$(AM_V_GEN)mkdir -p $(BENCHMARK_MAIN_CLASSES)
|
2017-07-12 21:04:55 +02:00
|
|
|
$(AM_V_at)javac $(JAVAC_ARGS) -cp $(MAIN_CLASSES) -d $(BENCHMARK_MAIN_CLASSES) $(BENCHMARK_MAIN_SRC)/org/rocksdb/benchmark/*.java
|