2017-11-28 20:13:20 +00:00
|
|
|
cmake_minimum_required(VERSION 3.4)
|
2016-07-18 14:37:49 +00:00
|
|
|
|
2023-10-18 19:51:50 +00:00
|
|
|
set(JAVA_JUNIT_VERSION "4.13.1")
|
|
|
|
set(JAVA_HAMCR_VERSION "2.2")
|
|
|
|
set(JAVA_MOCKITO_VERSION "1.10.19")
|
|
|
|
set(JAVA_CGLIB_VERSION "3.3.0")
|
|
|
|
set(JAVA_ASSERTJ_VERSION "2.9.0")
|
|
|
|
|
|
|
|
|
2019-06-17 17:15:58 +00:00
|
|
|
if(${CMAKE_VERSION} VERSION_LESS "3.11.4")
|
|
|
|
message("Please consider switching to CMake 3.11.4 or newer")
|
|
|
|
endif()
|
|
|
|
|
2023-04-18 18:15:25 +00:00
|
|
|
set(CMAKE_JAVA_COMPILE_FLAGS -source 8)
|
2020-03-12 19:22:03 +00:00
|
|
|
|
2016-01-28 14:44:31 +00:00
|
|
|
set(JNI_NATIVE_SOURCES
|
2022-04-05 16:52:33 +00:00
|
|
|
rocksjni/backup_engine_options.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/backupenginejni.cc
|
2024-04-03 18:03:11 +00:00
|
|
|
rocksjni/cache.cc
|
2018-07-18 19:24:07 +00:00
|
|
|
rocksjni/cassandra_compactionfilterjni.cc
|
|
|
|
rocksjni/cassandra_value_operator.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/checkpoint.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/clock_cache.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/columnfamilyhandle.cc
|
2024-04-03 18:03:11 +00:00
|
|
|
rocksjni/compact_range_options.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/compaction_filter.cc
|
2018-01-03 20:22:40 +00:00
|
|
|
rocksjni/compaction_filter_factory.cc
|
|
|
|
rocksjni/compaction_filter_factory_jnicallback.cc
|
2019-06-17 17:15:58 +00:00
|
|
|
rocksjni/compaction_job_info.cc
|
|
|
|
rocksjni/compaction_job_stats.cc
|
|
|
|
rocksjni/compaction_options.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/compaction_options_fifo.cc
|
|
|
|
rocksjni/compaction_options_universal.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/comparator.cc
|
|
|
|
rocksjni/comparatorjnicallback.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/compression_options.cc
|
2020-09-09 19:42:54 +00:00
|
|
|
rocksjni/concurrent_task_limiter.cc
|
2020-04-22 00:35:28 +00:00
|
|
|
rocksjni/config_options.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/env.cc
|
2016-09-29 21:04:41 +00:00
|
|
|
rocksjni/env_options.cc
|
2020-10-14 18:32:10 +00:00
|
|
|
rocksjni/event_listener.cc
|
|
|
|
rocksjni/event_listener_jnicallback.cc
|
2023-11-06 15:38:42 +00:00
|
|
|
rocksjni/export_import_files_metadatajni.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/filter.cc
|
2023-11-16 23:46:31 +00:00
|
|
|
rocksjni/hyper_clock_cache.cc
|
2024-04-03 18:03:11 +00:00
|
|
|
rocksjni/import_column_family_options.cc
|
2017-05-24 18:13:25 +00:00
|
|
|
rocksjni/ingest_external_file_options.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/iterator.cc
|
JNI get_helper code sharing / multiGet() use efficient batch C++ support (#12344)
Summary:
Implement RAII-based helpers for JNIGet() and multiGet()
Replace JNI C++ helpers `rocksdb_get_helper, rocksdb_get_helper_direct`, `multi_get_helper`, `multi_get_helper_direct`, `multi_get_helper_release_keys`, `txn_get_helper`, and `txn_multi_get_helper`.
The model is to entirely do away with a single helper, instead a number of utility methods allow each separate
JNI `Get()` and `MultiGet()` method to organise their parameters efficiently, then call the underlying C++ `db->Get()`,
`db->MultiGet()`, `txn->Get()`, or `txn->MultiGet()` method itself, and use further utilities to retrieve results.
Roughly speaking:
* get keys into C++ form
* Call C++ Get()
* get results and status into Java form
We achieve a useful performance gain as part of this work; by using the updated C++ multiGet we immediately pick up its performance gains (batch improvements to multiGet C++ were previously implemented, but not until now used by Java/JNI). multiGetBB already uses the batched C++ multiGet(), and all other benchmarks show consistent improvement after the changes:
## Before:
```
Benchmark (columnFamilyTestType) (keyCount) (keySize) (multiGetSize) (valueSize) Mode Cnt Score Error Units
MultiGetNewBenchmarks.multiGetBB200 no_column_family 10000 1024 100 256 thrpt 25 5315.459 ± 20.465 ops/s
MultiGetNewBenchmarks.multiGetBB200 no_column_family 10000 1024 100 1024 thrpt 25 5673.115 ± 78.299 ops/s
MultiGetNewBenchmarks.multiGetBB200 no_column_family 10000 1024 100 4096 thrpt 25 2616.860 ± 46.994 ops/s
MultiGetNewBenchmarks.multiGetBB200 no_column_family 10000 1024 100 16384 thrpt 25 1700.058 ± 24.034 ops/s
MultiGetNewBenchmarks.multiGetBB200 no_column_family 10000 1024 100 65536 thrpt 25 791.171 ± 13.955 ops/s
MultiGetNewBenchmarks.multiGetList10 no_column_family 10000 1024 100 256 thrpt 25 6129.929 ± 94.200 ops/s
MultiGetNewBenchmarks.multiGetList10 no_column_family 10000 1024 100 1024 thrpt 25 7012.405 ± 97.886 ops/s
MultiGetNewBenchmarks.multiGetList10 no_column_family 10000 1024 100 4096 thrpt 25 2799.014 ± 39.352 ops/s
MultiGetNewBenchmarks.multiGetList10 no_column_family 10000 1024 100 16384 thrpt 25 1417.205 ± 22.272 ops/s
MultiGetNewBenchmarks.multiGetList10 no_column_family 10000 1024 100 65536 thrpt 25 655.594 ± 13.050 ops/s
MultiGetNewBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 256 thrpt 25 6147.247 ± 82.711 ops/s
MultiGetNewBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 1024 thrpt 25 7004.213 ± 79.251 ops/s
MultiGetNewBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 4096 thrpt 25 2715.154 ± 110.017 ops/s
MultiGetNewBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 16384 thrpt 25 1408.070 ± 31.714 ops/s
MultiGetNewBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 65536 thrpt 25 623.829 ± 57.374 ops/s
MultiGetNewBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 256 thrpt 25 6119.243 ± 116.313 ops/s
MultiGetNewBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 1024 thrpt 25 6931.873 ± 128.094 ops/s
MultiGetNewBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 4096 thrpt 25 2678.253 ± 39.113 ops/s
MultiGetNewBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 16384 thrpt 25 1337.384 ± 19.500 ops/s
MultiGetNewBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 65536 thrpt 25 625.596 ± 14.525 ops/s
```
## After:
```
Benchmark (columnFamilyTestType) (keyCount) (keySize) (multiGetSize) (valueSize) Mode Cnt Score Error Units
MultiGetBenchmarks.multiGetBB200 no_column_family 10000 1024 100 256 thrpt 25 5191.074 ± 78.250 ops/s
MultiGetBenchmarks.multiGetBB200 no_column_family 10000 1024 100 1024 thrpt 25 5378.692 ± 260.682 ops/s
MultiGetBenchmarks.multiGetBB200 no_column_family 10000 1024 100 4096 thrpt 25 2590.183 ± 34.844 ops/s
MultiGetBenchmarks.multiGetBB200 no_column_family 10000 1024 100 16384 thrpt 25 1634.793 ± 34.022 ops/s
MultiGetBenchmarks.multiGetBB200 no_column_family 10000 1024 100 65536 thrpt 25 786.455 ± 8.462 ops/s
MultiGetBenchmarks.multiGetBB200 1_column_family 10000 1024 100 256 thrpt 25 5285.055 ± 11.676 ops/s
MultiGetBenchmarks.multiGetBB200 1_column_family 10000 1024 100 1024 thrpt 25 5586.758 ± 213.008 ops/s
MultiGetBenchmarks.multiGetBB200 1_column_family 10000 1024 100 4096 thrpt 25 2527.172 ± 17.106 ops/s
MultiGetBenchmarks.multiGetBB200 1_column_family 10000 1024 100 16384 thrpt 25 1819.547 ± 12.958 ops/s
MultiGetBenchmarks.multiGetBB200 1_column_family 10000 1024 100 65536 thrpt 25 803.861 ± 9.963 ops/s
MultiGetBenchmarks.multiGetBB200 20_column_families 10000 1024 100 256 thrpt 25 5253.793 ± 28.020 ops/s
MultiGetBenchmarks.multiGetBB200 20_column_families 10000 1024 100 1024 thrpt 25 5705.591 ± 20.556 ops/s
MultiGetBenchmarks.multiGetBB200 20_column_families 10000 1024 100 4096 thrpt 25 2523.377 ± 15.415 ops/s
MultiGetBenchmarks.multiGetBB200 20_column_families 10000 1024 100 16384 thrpt 25 1815.344 ± 11.309 ops/s
MultiGetBenchmarks.multiGetBB200 20_column_families 10000 1024 100 65536 thrpt 25 820.792 ± 3.192 ops/s
MultiGetBenchmarks.multiGetBB200 100_column_families 10000 1024 100 256 thrpt 25 5262.184 ± 20.477 ops/s
MultiGetBenchmarks.multiGetBB200 100_column_families 10000 1024 100 1024 thrpt 25 5706.959 ± 23.123 ops/s
MultiGetBenchmarks.multiGetBB200 100_column_families 10000 1024 100 4096 thrpt 25 2520.362 ± 9.170 ops/s
MultiGetBenchmarks.multiGetBB200 100_column_families 10000 1024 100 16384 thrpt 25 1789.185 ± 14.239 ops/s
MultiGetBenchmarks.multiGetBB200 100_column_families 10000 1024 100 65536 thrpt 25 818.401 ± 12.132 ops/s
MultiGetBenchmarks.multiGetList10 no_column_family 10000 1024 100 256 thrpt 25 6978.310 ± 14.084 ops/s
MultiGetBenchmarks.multiGetList10 no_column_family 10000 1024 100 1024 thrpt 25 7664.242 ± 22.304 ops/s
MultiGetBenchmarks.multiGetList10 no_column_family 10000 1024 100 4096 thrpt 25 2881.778 ± 81.054 ops/s
MultiGetBenchmarks.multiGetList10 no_column_family 10000 1024 100 16384 thrpt 25 1599.826 ± 7.190 ops/s
MultiGetBenchmarks.multiGetList10 no_column_family 10000 1024 100 65536 thrpt 25 737.520 ± 6.809 ops/s
MultiGetBenchmarks.multiGetList10 1_column_family 10000 1024 100 256 thrpt 25 6974.376 ± 10.716 ops/s
MultiGetBenchmarks.multiGetList10 1_column_family 10000 1024 100 1024 thrpt 25 7637.440 ± 45.877 ops/s
MultiGetBenchmarks.multiGetList10 1_column_family 10000 1024 100 4096 thrpt 25 2820.472 ± 42.231 ops/s
MultiGetBenchmarks.multiGetList10 1_column_family 10000 1024 100 16384 thrpt 25 1716.663 ± 8.527 ops/s
MultiGetBenchmarks.multiGetList10 1_column_family 10000 1024 100 65536 thrpt 25 755.848 ± 7.514 ops/s
MultiGetBenchmarks.multiGetList10 20_column_families 10000 1024 100 256 thrpt 25 6943.651 ± 20.040 ops/s
MultiGetBenchmarks.multiGetList10 20_column_families 10000 1024 100 1024 thrpt 25 7679.415 ± 9.114 ops/s
MultiGetBenchmarks.multiGetList10 20_column_families 10000 1024 100 4096 thrpt 25 2844.564 ± 13.388 ops/s
MultiGetBenchmarks.multiGetList10 20_column_families 10000 1024 100 16384 thrpt 25 1729.545 ± 5.983 ops/s
MultiGetBenchmarks.multiGetList10 20_column_families 10000 1024 100 65536 thrpt 25 783.218 ± 1.530 ops/s
MultiGetBenchmarks.multiGetList10 100_column_families 10000 1024 100 256 thrpt 25 6944.276 ± 29.995 ops/s
MultiGetBenchmarks.multiGetList10 100_column_families 10000 1024 100 1024 thrpt 25 7670.301 ± 8.986 ops/s
MultiGetBenchmarks.multiGetList10 100_column_families 10000 1024 100 4096 thrpt 25 2839.828 ± 12.421 ops/s
MultiGetBenchmarks.multiGetList10 100_column_families 10000 1024 100 16384 thrpt 25 1730.005 ± 9.209 ops/s
MultiGetBenchmarks.multiGetList10 100_column_families 10000 1024 100 65536 thrpt 25 787.096 ± 1.977 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 256 thrpt 25 6896.944 ± 21.530 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 1024 thrpt 25 7622.407 ± 12.824 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 4096 thrpt 25 2927.538 ± 19.792 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 16384 thrpt 25 1598.041 ± 4.312 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 no_column_family 10000 1024 100 65536 thrpt 25 744.564 ± 9.236 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 1_column_family 10000 1024 100 256 thrpt 25 6853.760 ± 78.041 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 1_column_family 10000 1024 100 1024 thrpt 25 7360.917 ± 355.365 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 1_column_family 10000 1024 100 4096 thrpt 25 2848.774 ± 13.409 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 1_column_family 10000 1024 100 16384 thrpt 25 1727.688 ± 3.329 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 1_column_family 10000 1024 100 65536 thrpt 25 776.088 ± 7.517 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 20_column_families 10000 1024 100 256 thrpt 25 6910.339 ± 14.366 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 20_column_families 10000 1024 100 1024 thrpt 25 7633.660 ± 10.830 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 20_column_families 10000 1024 100 4096 thrpt 25 2787.799 ± 81.775 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 20_column_families 10000 1024 100 16384 thrpt 25 1726.517 ± 6.830 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 20_column_families 10000 1024 100 65536 thrpt 25 787.597 ± 3.362 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 100_column_families 10000 1024 100 256 thrpt 25 6922.445 ± 10.493 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 100_column_families 10000 1024 100 1024 thrpt 25 7604.710 ± 48.043 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 100_column_families 10000 1024 100 4096 thrpt 25 2848.788 ± 15.783 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 100_column_families 10000 1024 100 16384 thrpt 25 1730.837 ± 6.497 ops/s
MultiGetBenchmarks.multiGetListExplicitCF20 100_column_families 10000 1024 100 65536 thrpt 25 794.557 ± 1.869 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 256 thrpt 25 6918.716 ± 15.766 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 1024 thrpt 25 7626.692 ± 9.394 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 4096 thrpt 25 2871.382 ± 72.155 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 16384 thrpt 25 1598.786 ± 4.819 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 no_column_family 10000 1024 100 65536 thrpt 25 748.469 ± 7.234 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 1_column_family 10000 1024 100 256 thrpt 25 6922.666 ± 17.131 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 1_column_family 10000 1024 100 1024 thrpt 25 7623.890 ± 8.805 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 1_column_family 10000 1024 100 4096 thrpt 25 2850.698 ± 18.004 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 1_column_family 10000 1024 100 16384 thrpt 25 1727.623 ± 4.868 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 1_column_family 10000 1024 100 65536 thrpt 25 774.534 ± 10.025 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 20_column_families 10000 1024 100 256 thrpt 25 5486.251 ± 13.582 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 20_column_families 10000 1024 100 1024 thrpt 25 4920.656 ± 44.557 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 20_column_families 10000 1024 100 4096 thrpt 25 3922.913 ± 25.686 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 20_column_families 10000 1024 100 16384 thrpt 25 2873.106 ± 4.336 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 20_column_families 10000 1024 100 65536 thrpt 25 802.404 ± 8.967 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 100_column_families 10000 1024 100 256 thrpt 25 4817.996 ± 18.042 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 100_column_families 10000 1024 100 1024 thrpt 25 4243.922 ± 13.929 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 100_column_families 10000 1024 100 4096 thrpt 25 3175.998 ± 7.773 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 100_column_families 10000 1024 100 16384 thrpt 25 2321.990 ± 12.501 ops/s
MultiGetBenchmarks.multiGetListRandomCF30 100_column_families 10000 1024 100 65536 thrpt 25 1753.028 ± 7.130 ops/s
```
Closes https://github.com/facebook/rocksdb/issues/11518
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12344
Reviewed By: cbi42
Differential Revision: D54809714
Pulled By: pdillinger
fbshipit-source-id: bee3b949720abac073bce043b59ce976a11e99eb
2024-03-12 19:42:08 +00:00
|
|
|
rocksjni/jni_multiget_helpers.cc
|
2024-04-03 18:03:11 +00:00
|
|
|
rocksjni/jni_perf_context.cc
|
2018-01-03 20:22:40 +00:00
|
|
|
rocksjni/jnicallback.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/loggerjnicallback.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/lru_cache.cc
|
2018-10-08 18:03:34 +00:00
|
|
|
rocksjni/memory_util.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/memtablejni.cc
|
|
|
|
rocksjni/merge_operator.cc
|
2018-03-08 19:16:46 +00:00
|
|
|
rocksjni/native_comparator_wrapper_test.cc
|
2018-07-18 19:24:07 +00:00
|
|
|
rocksjni/optimistic_transaction_db.cc
|
|
|
|
rocksjni/optimistic_transaction_options.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/options.cc
|
2017-10-12 23:45:01 +00:00
|
|
|
rocksjni/options_util.cc
|
2019-02-22 22:36:38 +00:00
|
|
|
rocksjni/persistent_cache.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/ratelimiterjni.cc
|
|
|
|
rocksjni/remove_emptyvalue_compactionfilterjni.cc
|
|
|
|
rocksjni/restorejni.cc
|
2018-07-18 19:24:07 +00:00
|
|
|
rocksjni/rocks_callback_object.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/rocksdb_exception_test.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/rocksjni.cc
|
|
|
|
rocksjni/slice.cc
|
|
|
|
rocksjni/snapshot.cc
|
2018-04-07 04:22:37 +00:00
|
|
|
rocksjni/sst_file_manager.cc
|
2019-09-10 01:11:02 +00:00
|
|
|
rocksjni/sst_file_reader_iterator.cc
|
2024-04-03 18:03:11 +00:00
|
|
|
rocksjni/sst_file_readerjni.cc
|
|
|
|
rocksjni/sst_file_writerjni.cc
|
2020-07-24 20:43:14 +00:00
|
|
|
rocksjni/sst_partitioner.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/statistics.cc
|
2017-07-12 06:19:53 +00:00
|
|
|
rocksjni/statisticsjni.cc
|
Add native logger support to RocksJava (#12213)
Summary:
## Overview
In this PR, we introduce support for setting the RocksDB native logger through Java. As mentioned in the discussion on the [Google Group discussion](https://groups.google.com/g/rocksdb/c/xYmbEs4sqRM/m/e73E4whJAQAJ), this work is primarily motivated by the JDK 17 [performance regression in JNI thread attach/detach calls](https://bugs.openjdk.org/browse/JDK-8314859): the only existing RocksJava logging configuration call, `setLogger`, invokes the provided logger over the JNI.
## Changes
Specifically, these changes add support for the `devnull` and `stderr` native loggers. For the `stderr` logger, we add the ability to prefix every log with a `logPrefix`, so that it becomes possible know which database a particular log is coming from (if multiple databases are in use). The API looks like the following:
```java
Options opts = new Options();
NativeLogger stderrNativeLogger = NativeLogger.newStderrLogger(
InfoLogLevel.DEBUG_LEVEL, "[my prefix here]");
options.setLogger(stderrNativeLogger);
try (final RocksDB db = RocksDB.open(options, ...)) {...}
// Cleanup
stderrNativeLogger.close()
opts.close();
```
Note that the API to set the logger is the same, via `Options::setLogger` (or `DBOptions::setLogger`). However, it will set the RocksDB logger to be native when the provided logger is an instance of `NativeLogger`.
## Testing
Two tests have been added in `NativeLoggerTest.java`. The first test creates both the `devnull` and `stderr` loggers, and sets them on the associated `Options`. However, to avoid polluting the testing output with logs from `stderr`, only the `devnull` logger is actually used in the test. The second test does the same logic, but for `DBOptions`.
It is possible to manually verify the `stderr` logger by modifying the tests slightly, and observing that the console indeed gets cluttered with logs from `stderr`.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12213
Reviewed By: cbi42
Differential Revision: D52772306
Pulled By: ajkr
fbshipit-source-id: 4026895f78f9cc250daf6bfa57427957e2d8b053
2024-01-18 01:51:36 +00:00
|
|
|
rocksjni/stderr_logger.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/table.cc
|
2019-02-22 22:36:38 +00:00
|
|
|
rocksjni/table_filter.cc
|
|
|
|
rocksjni/table_filter_jnicallback.cc
|
2023-12-18 21:43:01 +00:00
|
|
|
rocksjni/table_properties_collector_factory.cc
|
2021-01-16 01:51:20 +00:00
|
|
|
rocksjni/testable_event_listener.cc
|
2019-02-22 22:36:38 +00:00
|
|
|
rocksjni/thread_status.cc
|
|
|
|
rocksjni/trace_writer.cc
|
|
|
|
rocksjni/trace_writer_jnicallback.cc
|
2018-07-18 19:24:07 +00:00
|
|
|
rocksjni/transaction.cc
|
|
|
|
rocksjni/transaction_db.cc
|
|
|
|
rocksjni/transaction_db_options.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/transaction_log.cc
|
2018-07-18 19:24:07 +00:00
|
|
|
rocksjni/transaction_notifier.cc
|
|
|
|
rocksjni/transaction_notifier_jnicallback.cc
|
|
|
|
rocksjni/transaction_options.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/ttl.cc
|
2019-02-22 22:36:38 +00:00
|
|
|
rocksjni/wal_filter.cc
|
|
|
|
rocksjni/wal_filter_jnicallback.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
rocksjni/write_batch.cc
|
|
|
|
rocksjni/write_batch_test.cc
|
2017-04-22 03:41:37 +00:00
|
|
|
rocksjni/write_batch_with_index.cc
|
2018-10-17 18:47:51 +00:00
|
|
|
rocksjni/write_buffer_manager.cc
|
2024-04-03 18:03:11 +00:00
|
|
|
rocksjni/writebatchhandlerjnicallback.cc
|
2024-05-01 06:37:16 +00:00
|
|
|
rocksjni/parsed_entry_info.cc
|
|
|
|
rocksjni/type_util.cc
|
2016-01-28 14:44:31 +00:00
|
|
|
)
|
|
|
|
|
2019-06-17 17:15:58 +00:00
|
|
|
set(JAVA_MAIN_CLASSES
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractCompactionFilter.java
|
2019-06-17 17:15:58 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractCompactionFilterFactory.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractComparator.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractComparatorJniBridge.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractEventListener.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractImmutableNativeReference.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractMutableOptions.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractNativeReference.java
|
|
|
|
src/main/java/org/rocksdb/AbstractRocksIterator.java
|
|
|
|
src/main/java/org/rocksdb/AbstractSlice.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractTableFilter.java
|
|
|
|
src/main/java/org/rocksdb/AbstractTraceWriter.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractTransactionNotifier.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractWalFilter.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/AbstractWriteBatch.java
|
|
|
|
src/main/java/org/rocksdb/AdvancedColumnFamilyOptionsInterface.java
|
|
|
|
src/main/java/org/rocksdb/AdvancedMutableColumnFamilyOptionsInterface.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/BackgroundErrorReason.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/BackupEngine.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/BackupEngineOptions.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/BackupInfo.java
|
|
|
|
src/main/java/org/rocksdb/BlockBasedTableConfig.java
|
|
|
|
src/main/java/org/rocksdb/BloomFilter.java
|
|
|
|
src/main/java/org/rocksdb/BuiltinComparator.java
|
2021-12-16 02:07:37 +00:00
|
|
|
src/main/java/org/rocksdb/ByteBufferGetStatus.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/Cache.java
|
|
|
|
src/main/java/org/rocksdb/CassandraCompactionFilter.java
|
|
|
|
src/main/java/org/rocksdb/CassandraValueMergeOperator.java
|
|
|
|
src/main/java/org/rocksdb/Checkpoint.java
|
|
|
|
src/main/java/org/rocksdb/ChecksumType.java
|
|
|
|
src/main/java/org/rocksdb/ClockCache.java
|
|
|
|
src/main/java/org/rocksdb/ColumnFamilyDescriptor.java
|
|
|
|
src/main/java/org/rocksdb/ColumnFamilyHandle.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/ColumnFamilyMetaData.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/ColumnFamilyOptions.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java
|
|
|
|
src/main/java/org/rocksdb/CompactRangeOptions.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/CompactionJobInfo.java
|
|
|
|
src/main/java/org/rocksdb/CompactionJobStats.java
|
|
|
|
src/main/java/org/rocksdb/CompactionOptions.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/CompactionOptionsFIFO.java
|
|
|
|
src/main/java/org/rocksdb/CompactionOptionsUniversal.java
|
|
|
|
src/main/java/org/rocksdb/CompactionPriority.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/CompactionReason.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/CompactionStopStyle.java
|
|
|
|
src/main/java/org/rocksdb/CompactionStyle.java
|
|
|
|
src/main/java/org/rocksdb/ComparatorOptions.java
|
2018-03-08 19:16:46 +00:00
|
|
|
src/main/java/org/rocksdb/ComparatorType.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/CompressionOptions.java
|
|
|
|
src/main/java/org/rocksdb/CompressionType.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/ConcurrentTaskLimiter.java
|
|
|
|
src/main/java/org/rocksdb/ConcurrentTaskLimiterImpl.java
|
2020-04-22 00:35:28 +00:00
|
|
|
src/main/java/org/rocksdb/ConfigOptions.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/DBOptions.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/DBOptionsInterface.java
|
|
|
|
src/main/java/org/rocksdb/DataBlockIndexType.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/DbPath.java
|
|
|
|
src/main/java/org/rocksdb/DirectSlice.java
|
|
|
|
src/main/java/org/rocksdb/EncodingType.java
|
|
|
|
src/main/java/org/rocksdb/Env.java
|
|
|
|
src/main/java/org/rocksdb/EnvOptions.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/EventListener.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/Experimental.java
|
2023-11-06 15:38:42 +00:00
|
|
|
src/main/java/org/rocksdb/ExportImportFilesMetaData.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/ExternalFileIngestionInfo.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/FileOperationInfo.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/Filter.java
|
2023-10-12 16:39:01 +00:00
|
|
|
src/main/java/org/rocksdb/FilterPolicyType.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/FlushJobInfo.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/FlushOptions.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/FlushReason.java
|
Java API consistency between RocksDB.put() , .merge() and Transaction.put() , .merge() (#11019)
Summary:
### Implement new Java API get()/put()/merge() methods, and transactional variants.
The Java API methods are very inconsistent in terms of how they pass parameters (byte[], ByteBuffer), and what variants and defaulted parameters they support. We try to bring some consistency to this.
* All APIs should support calls with ByteBuffer parameters.
* Similar methods (RocksDB.get() vs Transaction.get()) should support as similar as possible sets of parameters for predictability.
* get()-like methods should provide variants where the caller supplies the target buffer, for the sake of efficiency. Allocation costs in Java can be significant when large buffers are repeatedly allocated and freed.
### API Additions
1. RockDB.get implement indirect ByteBuffers. Added indirect ByteBuffers and supporting native methods for get().
2. RocksDB.Iterator implement missing (byte[], offset, length) variants for key() and value() parameters.
3. Transaction.get() implement missing methods, based on RocksDB.get. Added ByteBuffer.get with and without column family. Added byte[]-as-target get.
4. Transaction.iterator() implement a getIterator() which defaults ReadOptions; as per RocksDB.iterator(). Rationalize support API for this and RocksDB.iterator()
5. RocksDB.merge implement ByteBuffer methods; both direct and indirect buffers. Shadow the methods of RocksDB.put; RocksDB.put only offers ByteBuffer API with explicit WriteOptions. Duplicated this with RocksDB.merge
6. Transaction.merge implement methods as per RocksDB.merge methods. Transaction is already constructed with WriteOptions, so no explicit WriteOptions methods required.
7. Transaction.mergeUntracked implement the same API methods as Transaction.merge except the ones that use assumeTracked, because that’s not a feature of merge untracked.
### Support Changes (C++)
The current JNI code in C++ supports multiple variants of methods through a number of helper functions. There are numerous TODO suggestions in the code proposing that the helpers be re-factored/shared.
We have taken a different approach for the new methods; we have created wrapper classes `JDirectBufferSlice`, `JDirectBufferPinnableSlice`, `JByteArraySlice` and `JByteArrayPinnableSlice` RAII classes which construct slices from JNI parameters and can then be passed directly to RocksDB methods. For instance, the `Java_org_rocksdb_Transaction_getDirect` method is implemented like this:
```
try {
ROCKSDB_NAMESPACE::JDirectBufferSlice key(env, jkey_bb, jkey_off,
jkey_part_len);
ROCKSDB_NAMESPACE::JDirectBufferPinnableSlice value(env, jval_bb, jval_off,
jval_part_len);
ROCKSDB_NAMESPACE::KVException::ThrowOnError(
env, txn->Get(*read_options, column_family_handle, key.slice(),
&value.pinnable_slice()));
return value.Fetch();
} catch (const ROCKSDB_NAMESPACE::KVException& e) {
return e.Code();
}
```
Notice the try/catch mechanism with the `KVException` class, which combined with RAII and the wrapper classes means that there is no ad-hoc cleanup necessary in the JNI methods.
We propose to extend this mechanism to existing JNI methods as further work.
### Support Changes (Java)
Where there are multiple parameter-variant versions of the same method, we use fewer or just one supporting native method for all of them. This makes maintenance a bit easier and reduces the opportunity for coding errors mixing up (untyped) object handles.
In order to support this efficiently, some classes need to have default values for column families and read options added and cached so that they are not re-constructed on every method call.
This PR closes https://github.com/facebook/rocksdb/issues/9776
Pull Request resolved: https://github.com/facebook/rocksdb/pull/11019
Reviewed By: ajkr
Differential Revision: D52039446
Pulled By: jowlyzhang
fbshipit-source-id: 45d0140a4887e42134d2e56520e9b8efbd349660
2023-12-11 19:03:17 +00:00
|
|
|
src/main/java/org/rocksdb/GetStatus.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/HashLinkedListMemTableConfig.java
|
|
|
|
src/main/java/org/rocksdb/HashSkipListMemTableConfig.java
|
|
|
|
src/main/java/org/rocksdb/HistogramData.java
|
|
|
|
src/main/java/org/rocksdb/HistogramType.java
|
2019-12-20 22:25:52 +00:00
|
|
|
src/main/java/org/rocksdb/Holder.java
|
2023-11-16 23:46:31 +00:00
|
|
|
src/main/java/org/rocksdb/HyperClockCache.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/ImportColumnFamilyOptions.java
|
2020-07-10 21:31:25 +00:00
|
|
|
src/main/java/org/rocksdb/IndexShorteningMode.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/IndexType.java
|
|
|
|
src/main/java/org/rocksdb/InfoLogLevel.java
|
|
|
|
src/main/java/org/rocksdb/IngestExternalFileOptions.java
|
2021-10-19 00:19:04 +00:00
|
|
|
src/main/java/org/rocksdb/KeyMayExist.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/LRUCache.java
|
|
|
|
src/main/java/org/rocksdb/LevelMetaData.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/LiveFileMetaData.java
|
|
|
|
src/main/java/org/rocksdb/LogFile.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/Logger.java
|
Add native logger support to RocksJava (#12213)
Summary:
## Overview
In this PR, we introduce support for setting the RocksDB native logger through Java. As mentioned in the discussion on the [Google Group discussion](https://groups.google.com/g/rocksdb/c/xYmbEs4sqRM/m/e73E4whJAQAJ), this work is primarily motivated by the JDK 17 [performance regression in JNI thread attach/detach calls](https://bugs.openjdk.org/browse/JDK-8314859): the only existing RocksJava logging configuration call, `setLogger`, invokes the provided logger over the JNI.
## Changes
Specifically, these changes add support for the `devnull` and `stderr` native loggers. For the `stderr` logger, we add the ability to prefix every log with a `logPrefix`, so that it becomes possible know which database a particular log is coming from (if multiple databases are in use). The API looks like the following:
```java
Options opts = new Options();
NativeLogger stderrNativeLogger = NativeLogger.newStderrLogger(
InfoLogLevel.DEBUG_LEVEL, "[my prefix here]");
options.setLogger(stderrNativeLogger);
try (final RocksDB db = RocksDB.open(options, ...)) {...}
// Cleanup
stderrNativeLogger.close()
opts.close();
```
Note that the API to set the logger is the same, via `Options::setLogger` (or `DBOptions::setLogger`). However, it will set the RocksDB logger to be native when the provided logger is an instance of `NativeLogger`.
## Testing
Two tests have been added in `NativeLoggerTest.java`. The first test creates both the `devnull` and `stderr` loggers, and sets them on the associated `Options`. However, to avoid polluting the testing output with logs from `stderr`, only the `devnull` logger is actually used in the test. The second test does the same logic, but for `DBOptions`.
It is possible to manually verify the `stderr` logger by modifying the tests slightly, and observing that the console indeed gets cluttered with logs from `stderr`.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12213
Reviewed By: cbi42
Differential Revision: D52772306
Pulled By: ajkr
fbshipit-source-id: 4026895f78f9cc250daf6bfa57427957e2d8b053
2024-01-18 01:51:36 +00:00
|
|
|
src/main/java/org/rocksdb/LoggerInterface.java
|
|
|
|
src/main/java/org/rocksdb/LoggerType.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/MemTableConfig.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/MemTableInfo.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/MemoryUsageType.java
|
|
|
|
src/main/java/org/rocksdb/MemoryUtil.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/MergeOperator.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/MutableColumnFamilyOptions.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/MutableColumnFamilyOptionsInterface.java
|
|
|
|
src/main/java/org/rocksdb/MutableDBOptions.java
|
|
|
|
src/main/java/org/rocksdb/MutableDBOptionsInterface.java
|
|
|
|
src/main/java/org/rocksdb/MutableOptionKey.java
|
|
|
|
src/main/java/org/rocksdb/MutableOptionValue.java
|
2018-03-08 19:16:46 +00:00
|
|
|
src/main/java/org/rocksdb/NativeComparatorWrapper.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/NativeLibraryLoader.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/OperationStage.java
|
|
|
|
src/main/java/org/rocksdb/OperationType.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/OptimisticTransactionDB.java
|
|
|
|
src/main/java/org/rocksdb/OptimisticTransactionOptions.java
|
2021-10-19 16:20:56 +00:00
|
|
|
src/main/java/org/rocksdb/OptionString.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/Options.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/OptionsUtil.java
|
2023-10-10 18:07:33 +00:00
|
|
|
src/main/java/org/rocksdb/PerfContext.java
|
|
|
|
src/main/java/org/rocksdb/PerfLevel.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/PersistentCache.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/PlainTableConfig.java
|
2022-07-17 14:13:59 +00:00
|
|
|
src/main/java/org/rocksdb/PrepopulateBlobCache.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/Priority.java
|
|
|
|
src/main/java/org/rocksdb/Range.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/RateLimiter.java
|
2018-01-10 00:27:01 +00:00
|
|
|
src/main/java/org/rocksdb/RateLimiterMode.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/ReadOptions.java
|
|
|
|
src/main/java/org/rocksdb/ReadTier.java
|
|
|
|
src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java
|
|
|
|
src/main/java/org/rocksdb/RestoreOptions.java
|
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 20:28:25 +00:00
|
|
|
src/main/java/org/rocksdb/ReusedSynchronisationType.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/RocksCallbackObject.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/RocksDB.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/RocksDBException.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/RocksEnv.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/RocksIterator.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/RocksIteratorInterface.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/RocksMemEnv.java
|
|
|
|
src/main/java/org/rocksdb/RocksMutableObject.java
|
|
|
|
src/main/java/org/rocksdb/RocksObject.java
|
2020-04-22 00:35:28 +00:00
|
|
|
src/main/java/org/rocksdb/SanityLevel.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/SizeApproximationFlag.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/SkipListMemTableConfig.java
|
|
|
|
src/main/java/org/rocksdb/Slice.java
|
|
|
|
src/main/java/org/rocksdb/Snapshot.java
|
2018-04-07 04:22:37 +00:00
|
|
|
src/main/java/org/rocksdb/SstFileManager.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/SstFileMetaData.java
|
2019-09-10 01:11:02 +00:00
|
|
|
src/main/java/org/rocksdb/SstFileReader.java
|
|
|
|
src/main/java/org/rocksdb/SstFileReaderIterator.java
|
2020-07-24 20:43:14 +00:00
|
|
|
src/main/java/org/rocksdb/SstFileWriter.java
|
|
|
|
src/main/java/org/rocksdb/SstPartitionerFactory.java
|
|
|
|
src/main/java/org/rocksdb/SstPartitionerFixedPrefixFactory.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/StateType.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/Statistics.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/StatisticsCollector.java
|
|
|
|
src/main/java/org/rocksdb/StatisticsCollectorCallback.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/StatsCollectorInput.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/StatsLevel.java
|
|
|
|
src/main/java/org/rocksdb/Status.java
|
|
|
|
src/main/java/org/rocksdb/StringAppendOperator.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/TableFileCreationBriefInfo.java
|
|
|
|
src/main/java/org/rocksdb/TableFileCreationInfo.java
|
|
|
|
src/main/java/org/rocksdb/TableFileCreationReason.java
|
|
|
|
src/main/java/org/rocksdb/TableFileDeletionInfo.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/TableFilter.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/TableFormatConfig.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/TableProperties.java
|
2023-12-18 21:43:01 +00:00
|
|
|
src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/ThreadStatus.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/ThreadType.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/TickerType.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/TimedEnv.java
|
|
|
|
src/main/java/org/rocksdb/TraceOptions.java
|
|
|
|
src/main/java/org/rocksdb/TraceWriter.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/Transaction.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/TransactionDB.java
|
|
|
|
src/main/java/org/rocksdb/TransactionDBOptions.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/TransactionLogIterator.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/TransactionOptions.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/TransactionalDB.java
|
|
|
|
src/main/java/org/rocksdb/TransactionalOptions.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/TtlDB.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/TxnDBWritePolicy.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/UInt64AddOperator.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/VectorMemTableConfig.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/WALRecoveryMode.java
|
|
|
|
src/main/java/org/rocksdb/WBWIRocksIterator.java
|
2019-02-22 22:36:38 +00:00
|
|
|
src/main/java/org/rocksdb/WalFileType.java
|
|
|
|
src/main/java/org/rocksdb/WalFilter.java
|
|
|
|
src/main/java/org/rocksdb/WalProcessingOption.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/WriteBatch.java
|
2019-06-17 17:15:58 +00:00
|
|
|
src/main/java/org/rocksdb/WriteBatchInterface.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/main/java/org/rocksdb/WriteBatchWithIndex.java
|
2018-10-17 18:47:51 +00:00
|
|
|
src/main/java/org/rocksdb/WriteBufferManager.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/WriteOptions.java
|
2020-10-14 18:32:10 +00:00
|
|
|
src/main/java/org/rocksdb/WriteStallCondition.java
|
|
|
|
src/main/java/org/rocksdb/WriteStallInfo.java
|
Java API consistency between RocksDB.put() , .merge() and Transaction.put() , .merge() (#11019)
Summary:
### Implement new Java API get()/put()/merge() methods, and transactional variants.
The Java API methods are very inconsistent in terms of how they pass parameters (byte[], ByteBuffer), and what variants and defaulted parameters they support. We try to bring some consistency to this.
* All APIs should support calls with ByteBuffer parameters.
* Similar methods (RocksDB.get() vs Transaction.get()) should support as similar as possible sets of parameters for predictability.
* get()-like methods should provide variants where the caller supplies the target buffer, for the sake of efficiency. Allocation costs in Java can be significant when large buffers are repeatedly allocated and freed.
### API Additions
1. RockDB.get implement indirect ByteBuffers. Added indirect ByteBuffers and supporting native methods for get().
2. RocksDB.Iterator implement missing (byte[], offset, length) variants for key() and value() parameters.
3. Transaction.get() implement missing methods, based on RocksDB.get. Added ByteBuffer.get with and without column family. Added byte[]-as-target get.
4. Transaction.iterator() implement a getIterator() which defaults ReadOptions; as per RocksDB.iterator(). Rationalize support API for this and RocksDB.iterator()
5. RocksDB.merge implement ByteBuffer methods; both direct and indirect buffers. Shadow the methods of RocksDB.put; RocksDB.put only offers ByteBuffer API with explicit WriteOptions. Duplicated this with RocksDB.merge
6. Transaction.merge implement methods as per RocksDB.merge methods. Transaction is already constructed with WriteOptions, so no explicit WriteOptions methods required.
7. Transaction.mergeUntracked implement the same API methods as Transaction.merge except the ones that use assumeTracked, because that’s not a feature of merge untracked.
### Support Changes (C++)
The current JNI code in C++ supports multiple variants of methods through a number of helper functions. There are numerous TODO suggestions in the code proposing that the helpers be re-factored/shared.
We have taken a different approach for the new methods; we have created wrapper classes `JDirectBufferSlice`, `JDirectBufferPinnableSlice`, `JByteArraySlice` and `JByteArrayPinnableSlice` RAII classes which construct slices from JNI parameters and can then be passed directly to RocksDB methods. For instance, the `Java_org_rocksdb_Transaction_getDirect` method is implemented like this:
```
try {
ROCKSDB_NAMESPACE::JDirectBufferSlice key(env, jkey_bb, jkey_off,
jkey_part_len);
ROCKSDB_NAMESPACE::JDirectBufferPinnableSlice value(env, jval_bb, jval_off,
jval_part_len);
ROCKSDB_NAMESPACE::KVException::ThrowOnError(
env, txn->Get(*read_options, column_family_handle, key.slice(),
&value.pinnable_slice()));
return value.Fetch();
} catch (const ROCKSDB_NAMESPACE::KVException& e) {
return e.Code();
}
```
Notice the try/catch mechanism with the `KVException` class, which combined with RAII and the wrapper classes means that there is no ad-hoc cleanup necessary in the JNI methods.
We propose to extend this mechanism to existing JNI methods as further work.
### Support Changes (Java)
Where there are multiple parameter-variant versions of the same method, we use fewer or just one supporting native method for all of them. This makes maintenance a bit easier and reduces the opportunity for coding errors mixing up (untyped) object handles.
In order to support this efficiently, some classes need to have default values for column families and read options added and cached so that they are not re-constructed on every method call.
This PR closes https://github.com/facebook/rocksdb/issues/9776
Pull Request resolved: https://github.com/facebook/rocksdb/pull/11019
Reviewed By: ajkr
Differential Revision: D52039446
Pulled By: jowlyzhang
fbshipit-source-id: 45d0140a4887e42134d2e56520e9b8efbd349660
2023-12-11 19:03:17 +00:00
|
|
|
src/main/java/org/rocksdb/util/BufferUtil.java
|
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 20:28:25 +00:00
|
|
|
src/main/java/org/rocksdb/util/ByteUtil.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/util/BytewiseComparator.java
|
|
|
|
src/main/java/org/rocksdb/util/Environment.java
|
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 20:28:25 +00:00
|
|
|
src/main/java/org/rocksdb/util/IntComparator.java
|
2018-07-18 19:24:07 +00:00
|
|
|
src/main/java/org/rocksdb/util/ReverseBytewiseComparator.java
|
|
|
|
src/main/java/org/rocksdb/util/SizeUnit.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/main/java/org/rocksdb/util/StdErrLogger.java
|
2018-03-08 19:16:46 +00:00
|
|
|
src/test/java/org/rocksdb/NativeComparatorWrapperTest.java
|
2017-11-28 20:13:20 +00:00
|
|
|
src/test/java/org/rocksdb/RocksDBExceptionTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/RocksNativeLibraryResource.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/WriteBatchTest.java
|
|
|
|
src/test/java/org/rocksdb/test/TestableEventListener.java
|
2018-03-02 23:33:08 +00:00
|
|
|
src/test/java/org/rocksdb/util/CapturingWriteBatchHandler.java
|
|
|
|
src/test/java/org/rocksdb/util/WriteBatchGetter.java
|
2024-05-01 06:37:16 +00:00
|
|
|
src/main/java/org/rocksdb/ParsedEntryInfo.java
|
|
|
|
src/main/java/org/rocksdb/EntryType.java
|
|
|
|
src/main/java/org/rocksdb/TypeUtil.java
|
2023-10-18 19:51:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(JAVA_TEST_CLASSES
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/AbstractTransactionTest.java
|
|
|
|
src/test/java/org/rocksdb/BackupEngineOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/BackupEngineTest.java
|
|
|
|
src/test/java/org/rocksdb/BlobOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/BlockBasedTableConfigTest.java
|
|
|
|
src/test/java/org/rocksdb/BuiltinComparatorTest.java
|
|
|
|
src/test/java/org/rocksdb/ByteBufferUnsupportedOperationTest.java
|
|
|
|
src/test/java/org/rocksdb/BytewiseComparatorRegressionTest.java
|
|
|
|
src/test/java/org/rocksdb/CheckPointTest.java
|
|
|
|
src/test/java/org/rocksdb/ClockCacheTest.java
|
|
|
|
src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/ColumnFamilyTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactRangeOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionFilterFactoryTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionJobInfoTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionJobStatsTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionOptionsFIFOTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionOptionsUniversalTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionPriorityTest.java
|
|
|
|
src/test/java/org/rocksdb/CompactionStopStyleTest.java
|
|
|
|
src/test/java/org/rocksdb/ComparatorOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/CompressionOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/CompressionTypesTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/ConcurrentTaskLimiterTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/DBOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/DefaultEnvTest.java
|
|
|
|
src/test/java/org/rocksdb/DirectSliceTest.java
|
|
|
|
src/test/java/org/rocksdb/EnvOptionsTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/EventListenerTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/FilterTest.java
|
|
|
|
src/test/java/org/rocksdb/FlushOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/FlushTest.java
|
|
|
|
src/test/java/org/rocksdb/HyperClockCacheTest.java
|
|
|
|
src/test/java/org/rocksdb/ImportColumnFamilyTest.java
|
|
|
|
src/test/java/org/rocksdb/InfoLogLevelTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/IngestExternalFileOptionsTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/KeyExistsTest.java
|
|
|
|
src/test/java/org/rocksdb/KeyMayExistTest.java
|
|
|
|
src/test/java/org/rocksdb/LRUCacheTest.java
|
|
|
|
src/test/java/org/rocksdb/LoggerTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/MemTableTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/MemoryUtilTest.java
|
|
|
|
src/test/java/org/rocksdb/MergeCFVariantsTest.java
|
|
|
|
src/test/java/org/rocksdb/MergeTest.java
|
|
|
|
src/test/java/org/rocksdb/MergeVariantsTest.java
|
|
|
|
src/test/java/org/rocksdb/MixedOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/MultiColumnRegressionTest.java
|
|
|
|
src/test/java/org/rocksdb/MultiGetManyKeysTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/MultiGetTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/MutableColumnFamilyOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/MutableDBOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/MutableOptionsGetSetTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/NativeLibraryLoaderTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/OptimisticTransactionDBTest.java
|
|
|
|
src/test/java/org/rocksdb/OptimisticTransactionOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/OptimisticTransactionTest.java
|
|
|
|
src/test/java/org/rocksdb/OptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/OptionsUtilTest.java
|
|
|
|
src/test/java/org/rocksdb/PerfContextTest.java
|
|
|
|
src/test/java/org/rocksdb/PerfLevelTest.java
|
|
|
|
src/test/java/org/rocksdb/PlainTableConfigTest.java
|
|
|
|
src/test/java/org/rocksdb/PlatformRandomHelper.java
|
|
|
|
src/test/java/org/rocksdb/PutCFVariantsTest.java
|
|
|
|
src/test/java/org/rocksdb/PutMultiplePartsTest.java
|
|
|
|
src/test/java/org/rocksdb/PutVariantsTest.java
|
|
|
|
src/test/java/org/rocksdb/RateLimiterTest.java
|
|
|
|
src/test/java/org/rocksdb/ReadOnlyTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/ReadOptionsTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/RocksDBTest.java
|
|
|
|
src/test/java/org/rocksdb/RocksIteratorTest.java
|
|
|
|
src/test/java/org/rocksdb/RocksMemEnvTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/SecondaryDBTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/SliceTest.java
|
|
|
|
src/test/java/org/rocksdb/SnapshotTest.java
|
|
|
|
src/test/java/org/rocksdb/SstFileManagerTest.java
|
|
|
|
src/test/java/org/rocksdb/SstFileReaderTest.java
|
|
|
|
src/test/java/org/rocksdb/SstFileWriterTest.java
|
|
|
|
src/test/java/org/rocksdb/SstPartitionerTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/StatisticsCollectorTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/StatisticsTest.java
|
|
|
|
src/test/java/org/rocksdb/StatsCallbackMock.java
|
|
|
|
src/test/java/org/rocksdb/TableFilterTest.java
|
|
|
|
src/test/java/org/rocksdb/TimedEnvTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/TransactionDBOptionsTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/TransactionDBTest.java
|
|
|
|
src/test/java/org/rocksdb/TransactionLogIteratorTest.java
|
|
|
|
src/test/java/org/rocksdb/TransactionOptionsTest.java
|
|
|
|
src/test/java/org/rocksdb/TransactionTest.java
|
|
|
|
src/test/java/org/rocksdb/TtlDBTest.java
|
|
|
|
src/test/java/org/rocksdb/Types.java
|
|
|
|
src/test/java/org/rocksdb/VerifyChecksumsTest.java
|
|
|
|
src/test/java/org/rocksdb/WALRecoveryModeTest.java
|
|
|
|
src/test/java/org/rocksdb/WalFilterTest.java
|
|
|
|
src/test/java/org/rocksdb/WriteBatchHandlerTest.java
|
|
|
|
src/test/java/org/rocksdb/WriteBatchThreadedTest.java
|
|
|
|
src/test/java/org/rocksdb/WriteBatchWithIndexTest.java
|
|
|
|
src/test/java/org/rocksdb/WriteOptionsTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/test/RemoveEmptyValueCompactionFilterFactory.java
|
|
|
|
src/test/java/org/rocksdb/test/RemoveEmptyValueCompactionFilterFactory.java
|
|
|
|
src/test/java/org/rocksdb/test/RemoveEmptyValueCompactionFilterFactory.java
|
|
|
|
src/test/java/org/rocksdb/test/RocksJunitRunner.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/test/TestableEventListener.java
|
|
|
|
src/test/java/org/rocksdb/test/TestableEventListener.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/util/ByteBufferAllocator.java
|
|
|
|
src/test/java/org/rocksdb/util/BytewiseComparatorIntTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/util/BytewiseComparatorTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/util/DirectByteBufferAllocator.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/util/EnvironmentTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/util/HeapByteBufferAllocator.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/util/IntComparatorTest.java
|
|
|
|
src/test/java/org/rocksdb/util/JNIComparatorTest.java
|
2023-10-18 19:51:50 +00:00
|
|
|
src/test/java/org/rocksdb/util/ReverseBytewiseComparatorIntTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/util/SizeUnitTest.java
|
Add native logger support to RocksJava (#12213)
Summary:
## Overview
In this PR, we introduce support for setting the RocksDB native logger through Java. As mentioned in the discussion on the [Google Group discussion](https://groups.google.com/g/rocksdb/c/xYmbEs4sqRM/m/e73E4whJAQAJ), this work is primarily motivated by the JDK 17 [performance regression in JNI thread attach/detach calls](https://bugs.openjdk.org/browse/JDK-8314859): the only existing RocksJava logging configuration call, `setLogger`, invokes the provided logger over the JNI.
## Changes
Specifically, these changes add support for the `devnull` and `stderr` native loggers. For the `stderr` logger, we add the ability to prefix every log with a `logPrefix`, so that it becomes possible know which database a particular log is coming from (if multiple databases are in use). The API looks like the following:
```java
Options opts = new Options();
NativeLogger stderrNativeLogger = NativeLogger.newStderrLogger(
InfoLogLevel.DEBUG_LEVEL, "[my prefix here]");
options.setLogger(stderrNativeLogger);
try (final RocksDB db = RocksDB.open(options, ...)) {...}
// Cleanup
stderrNativeLogger.close()
opts.close();
```
Note that the API to set the logger is the same, via `Options::setLogger` (or `DBOptions::setLogger`). However, it will set the RocksDB logger to be native when the provided logger is an instance of `NativeLogger`.
## Testing
Two tests have been added in `NativeLoggerTest.java`. The first test creates both the `devnull` and `stderr` loggers, and sets them on the associated `Options`. However, to avoid polluting the testing output with logs from `stderr`, only the `devnull` logger is actually used in the test. The second test does the same logic, but for `DBOptions`.
It is possible to manually verify the `stderr` logger by modifying the tests slightly, and observing that the console indeed gets cluttered with logs from `stderr`.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12213
Reviewed By: cbi42
Differential Revision: D52772306
Pulled By: ajkr
fbshipit-source-id: 4026895f78f9cc250daf6bfa57427957e2d8b053
2024-01-18 01:51:36 +00:00
|
|
|
src/test/java/org/rocksdb/util/StdErrLoggerTest.java
|
2024-04-03 18:03:11 +00:00
|
|
|
src/test/java/org/rocksdb/util/TestUtil.java
|
2023-10-18 19:51:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(JAVA_TEST_RUNNING_CLASSES
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.BackupEngineOptionsTest
|
|
|
|
org.rocksdb.BackupEngineTest
|
|
|
|
org.rocksdb.BlobOptionsTest
|
|
|
|
org.rocksdb.BlockBasedTableConfigTest
|
|
|
|
org.rocksdb.BuiltinComparatorTest
|
|
|
|
org.rocksdb.ByteBufferUnsupportedOperationTest
|
|
|
|
org.rocksdb.BytewiseComparatorRegressionTest
|
|
|
|
org.rocksdb.CheckPointTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.ClockCacheTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.ColumnFamilyOptionsTest
|
|
|
|
org.rocksdb.ColumnFamilyTest
|
|
|
|
org.rocksdb.CompactRangeOptionsTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.CompactionFilterFactoryTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.CompactionJobInfoTest
|
|
|
|
org.rocksdb.CompactionJobStatsTest
|
|
|
|
org.rocksdb.CompactionOptionsFIFOTest
|
|
|
|
org.rocksdb.CompactionOptionsTest
|
|
|
|
org.rocksdb.CompactionOptionsUniversalTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.CompactionPriorityTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.CompactionStopStyleTest
|
|
|
|
org.rocksdb.ComparatorOptionsTest
|
|
|
|
org.rocksdb.CompressionOptionsTest
|
|
|
|
org.rocksdb.CompressionTypesTest
|
|
|
|
org.rocksdb.ConcurrentTaskLimiterTest
|
|
|
|
org.rocksdb.DBOptionsTest
|
|
|
|
org.rocksdb.DefaultEnvTest
|
|
|
|
org.rocksdb.DirectSliceTest
|
|
|
|
org.rocksdb.EnvOptionsTest
|
|
|
|
org.rocksdb.EventListenerTest
|
|
|
|
org.rocksdb.FilterTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.FlushOptionsTest
|
|
|
|
org.rocksdb.FlushTest
|
2023-11-16 23:46:31 +00:00
|
|
|
org.rocksdb.HyperClockCacheTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.ImportColumnFamilyTest
|
|
|
|
org.rocksdb.InfoLogLevelTest
|
|
|
|
org.rocksdb.IngestExternalFileOptionsTest
|
|
|
|
org.rocksdb.KeyExistsTest
|
|
|
|
org.rocksdb.KeyMayExistTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.LRUCacheTest
|
|
|
|
org.rocksdb.LoggerTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.MemTableTest
|
|
|
|
org.rocksdb.MemoryUtilTest
|
|
|
|
org.rocksdb.MergeCFVariantsTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.MergeTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.MergeVariantsTest
|
|
|
|
org.rocksdb.MixedOptionsTest
|
|
|
|
org.rocksdb.MultiColumnRegressionTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.MultiGetManyKeysTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.MultiGetTest
|
|
|
|
org.rocksdb.MutableColumnFamilyOptionsTest
|
|
|
|
org.rocksdb.MutableDBOptionsTest
|
|
|
|
org.rocksdb.MutableOptionsGetSetTest
|
|
|
|
org.rocksdb.NativeComparatorWrapperTest
|
|
|
|
org.rocksdb.NativeLibraryLoaderTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.OptimisticTransactionDBTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.OptimisticTransactionOptionsTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.OptimisticTransactionTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.OptionsTest
|
|
|
|
org.rocksdb.OptionsUtilTest
|
|
|
|
org.rocksdb.PerfContextTest
|
|
|
|
org.rocksdb.PerfLevelTest
|
|
|
|
org.rocksdb.PlainTableConfigTest
|
|
|
|
org.rocksdb.PutCFVariantsTest
|
|
|
|
org.rocksdb.PutMultiplePartsTest
|
|
|
|
org.rocksdb.PutVariantsTest
|
|
|
|
org.rocksdb.RateLimiterTest
|
|
|
|
org.rocksdb.ReadOnlyTest
|
|
|
|
org.rocksdb.ReadOptionsTest
|
|
|
|
org.rocksdb.RocksDBExceptionTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.RocksDBTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.RocksIteratorTest
|
|
|
|
org.rocksdb.RocksMemEnvTest
|
|
|
|
org.rocksdb.SecondaryDBTest
|
|
|
|
org.rocksdb.SliceTest
|
|
|
|
org.rocksdb.SnapshotTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.SstFileManagerTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.SstFileReaderTest
|
|
|
|
org.rocksdb.SstFileWriterTest
|
|
|
|
org.rocksdb.SstPartitionerTest
|
|
|
|
org.rocksdb.StatisticsCollectorTest
|
|
|
|
org.rocksdb.StatisticsTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.TableFilterTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.TimedEnvTest
|
|
|
|
org.rocksdb.TransactionDBOptionsTest
|
|
|
|
org.rocksdb.TransactionDBTest
|
|
|
|
org.rocksdb.TransactionLogIteratorTest
|
|
|
|
org.rocksdb.TransactionOptionsTest
|
|
|
|
org.rocksdb.TransactionTest
|
2023-10-18 19:51:50 +00:00
|
|
|
org.rocksdb.TtlDBTest
|
2024-04-03 18:03:11 +00:00
|
|
|
org.rocksdb.VerifyChecksumsTest
|
|
|
|
org.rocksdb.WALRecoveryModeTest
|
|
|
|
org.rocksdb.WalFilterTest
|
|
|
|
org.rocksdb.WriteBatchHandlerTest
|
|
|
|
org.rocksdb.WriteBatchTest
|
|
|
|
org.rocksdb.WriteBatchThreadedTest
|
|
|
|
org.rocksdb.WriteBatchWithIndexTest
|
|
|
|
org.rocksdb.WriteOptionsTest
|
|
|
|
org.rocksdb.util.BytewiseComparatorIntTest
|
|
|
|
org.rocksdb.util.BytewiseComparatorTest
|
|
|
|
org.rocksdb.util.EnvironmentTest
|
|
|
|
org.rocksdb.util.IntComparatorTest
|
|
|
|
org.rocksdb.util.JNIComparatorTest
|
|
|
|
org.rocksdb.util.ReverseBytewiseComparatorIntTest
|
|
|
|
org.rocksdb.util.SizeUnitTest
|
Add native logger support to RocksJava (#12213)
Summary:
## Overview
In this PR, we introduce support for setting the RocksDB native logger through Java. As mentioned in the discussion on the [Google Group discussion](https://groups.google.com/g/rocksdb/c/xYmbEs4sqRM/m/e73E4whJAQAJ), this work is primarily motivated by the JDK 17 [performance regression in JNI thread attach/detach calls](https://bugs.openjdk.org/browse/JDK-8314859): the only existing RocksJava logging configuration call, `setLogger`, invokes the provided logger over the JNI.
## Changes
Specifically, these changes add support for the `devnull` and `stderr` native loggers. For the `stderr` logger, we add the ability to prefix every log with a `logPrefix`, so that it becomes possible know which database a particular log is coming from (if multiple databases are in use). The API looks like the following:
```java
Options opts = new Options();
NativeLogger stderrNativeLogger = NativeLogger.newStderrLogger(
InfoLogLevel.DEBUG_LEVEL, "[my prefix here]");
options.setLogger(stderrNativeLogger);
try (final RocksDB db = RocksDB.open(options, ...)) {...}
// Cleanup
stderrNativeLogger.close()
opts.close();
```
Note that the API to set the logger is the same, via `Options::setLogger` (or `DBOptions::setLogger`). However, it will set the RocksDB logger to be native when the provided logger is an instance of `NativeLogger`.
## Testing
Two tests have been added in `NativeLoggerTest.java`. The first test creates both the `devnull` and `stderr` loggers, and sets them on the associated `Options`. However, to avoid polluting the testing output with logs from `stderr`, only the `devnull` logger is actually used in the test. The second test does the same logic, but for `DBOptions`.
It is possible to manually verify the `stderr` logger by modifying the tests slightly, and observing that the console indeed gets cluttered with logs from `stderr`.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12213
Reviewed By: cbi42
Differential Revision: D52772306
Pulled By: ajkr
fbshipit-source-id: 4026895f78f9cc250daf6bfa57427957e2d8b053
2024-01-18 01:51:36 +00:00
|
|
|
org.rocksdb.util.StdErrLoggerTest
|
2017-11-28 20:13:20 +00:00
|
|
|
)
|
2016-01-28 14:44:31 +00:00
|
|
|
|
2019-06-17 17:15:58 +00:00
|
|
|
include(FindJava)
|
|
|
|
include(UseJava)
|
|
|
|
find_package(JNI)
|
|
|
|
|
|
|
|
include_directories(${JNI_INCLUDE_DIRS})
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/java)
|
|
|
|
|
|
|
|
set(JAVA_TEST_LIBDIR ${PROJECT_SOURCE_DIR}/java/test-libs)
|
|
|
|
set(JAVA_TMP_JAR ${JAVA_TEST_LIBDIR}/tmp.jar)
|
2023-10-18 19:51:50 +00:00
|
|
|
set(JAVA_JUNIT_JAR ${JAVA_TEST_LIBDIR}/junit-${JAVA_JUNIT_VERSION}.jar)
|
|
|
|
set(JAVA_HAMCR_JAR ${JAVA_TEST_LIBDIR}/hamcrest-${JAVA_HAMCR_VERSION}.jar)
|
|
|
|
set(JAVA_MOCKITO_JAR ${JAVA_TEST_LIBDIR}/mockito-all-${JAVA_MOCKITO_VERSION}.jar)
|
|
|
|
set(JAVA_CGLIB_JAR ${JAVA_TEST_LIBDIR}/cglib-${JAVA_CGLIB_VERSION}.jar)
|
|
|
|
set(JAVA_ASSERTJ_JAR ${JAVA_TEST_LIBDIR}/assertj-core-${JAVA_ASSERTJ_VERSION}.jar)
|
2019-06-17 17:15:58 +00:00
|
|
|
set(JAVA_TESTCLASSPATH ${JAVA_JUNIT_JAR} ${JAVA_HAMCR_JAR} ${JAVA_MOCKITO_JAR} ${JAVA_CGLIB_JAR} ${JAVA_ASSERTJ_JAR})
|
2023-10-18 19:51:50 +00:00
|
|
|
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
|
|
|
message("MINGW: ${MINGW}")
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
set(JAVA_RUN_TESTCLASSPATH ${JAVA_JUNIT_JAR}$<SEMICOLON>${JAVA_HAMCR_JAR}$<SEMICOLON>${JAVA_MOCKITO_JAR}$<SEMICOLON>${JAVA_CGLIB_JAR}$<SEMICOLON>${JAVA_ASSERTJ_JAR})
|
|
|
|
else()
|
|
|
|
set(JAVA_RUN_TESTCLASSPATH ${JAVA_JUNIT_JAR}:${JAVA_HAMCR_JAR}:${JAVA_MOCKITO_JAR}:${JAVA_CGLIB_JAR}:${JAVA_ASSERTJ_JAR})
|
|
|
|
endif()
|
2019-06-17 17:15:58 +00:00
|
|
|
|
|
|
|
set(JNI_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/java/include)
|
|
|
|
file(MAKE_DIRECTORY ${JNI_OUTPUT_DIR})
|
|
|
|
|
2022-02-17 21:28:09 +00:00
|
|
|
if(${Java_VERSION_MINOR} VERSION_LESS_EQUAL "7" AND ${Java_VERSION_MAJOR} STREQUAL "1")
|
|
|
|
message(FATAL_ERROR "Detected Java 7 or older (${Java_VERSION_STRING}), minimum required version in now Java 8")
|
|
|
|
endif()
|
|
|
|
|
2019-06-17 17:15:58 +00:00
|
|
|
if(${Java_VERSION_MAJOR} VERSION_GREATER_EQUAL "10" AND ${CMAKE_VERSION} VERSION_LESS "3.11.4")
|
|
|
|
# Java 10 and newer don't have javah, but the alternative GENERATE_NATIVE_HEADERS requires CMake 3.11.4 or newer
|
|
|
|
message(FATAL_ERROR "Detected Java 10 or newer (${Java_VERSION_STRING}), to build with CMake please upgrade CMake to 3.11.4 or newer")
|
|
|
|
|
2022-02-17 21:28:09 +00:00
|
|
|
elseif(${CMAKE_VERSION} VERSION_LESS "3.11.4")
|
|
|
|
# Old CMake
|
|
|
|
message("Using an old CMAKE (${CMAKE_VERSION}) - JNI headers generated in separate step")
|
2019-06-17 17:15:58 +00:00
|
|
|
add_jar(
|
|
|
|
rocksdbjni_classes
|
2023-10-18 19:51:50 +00:00
|
|
|
SOURCES ${JAVA_MAIN_CLASSES}
|
2019-06-17 17:15:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
else ()
|
|
|
|
# Java 1.8 or newer prepare the JAR...
|
|
|
|
message("Preparing Jar for JDK ${Java_VERSION_STRING}")
|
2023-10-18 19:51:50 +00:00
|
|
|
message("JAVA_TESTCLASSPATH=${JAVA_TESTCLASSPATH}")
|
2019-06-17 17:15:58 +00:00
|
|
|
add_jar(
|
|
|
|
rocksdbjni_classes
|
2023-10-18 19:51:50 +00:00
|
|
|
SOURCES ${JAVA_MAIN_CLASSES}
|
|
|
|
INCLUDE_JARS ${ROCKSDBJNI_CLASSES_JAR_FILE} ${JAVA_TESTCLASSPATH}
|
2019-06-17 17:15:58 +00:00
|
|
|
GENERATE_NATIVE_HEADERS rocksdbjni_headers DESTINATION ${JNI_OUTPUT_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2023-10-18 19:51:50 +00:00
|
|
|
add_jar(
|
|
|
|
rocksdbjni_test_classes
|
|
|
|
SOURCES
|
|
|
|
${JAVA_MAIN_CLASSES}
|
|
|
|
${JAVA_TEST_CLASSES}
|
2023-10-30 17:08:19 +00:00
|
|
|
INCLUDE_JARS ${JAVA_TESTCLASSPATH}
|
2023-10-18 19:51:50 +00:00
|
|
|
GENERATE_NATIVE_HEADERS rocksdbjni_test_headers DESTINATION ${JNI_OUTPUT_DIR}
|
|
|
|
)
|
|
|
|
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/java/classes)
|
2016-08-17 23:59:22 +00:00
|
|
|
file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/java/classes)
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT EXISTS ${JAVA_TEST_LIBDIR})
|
2016-08-17 23:59:22 +00:00
|
|
|
file(MAKE_DIRECTORY mkdir ${JAVA_TEST_LIBDIR})
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
|
2020-01-30 19:00:08 +00:00
|
|
|
if (DEFINED CUSTOM_DEPS_URL)
|
|
|
|
set(DEPS_URL ${CUSTOM_DEPS_URL}/)
|
2017-04-22 03:41:37 +00:00
|
|
|
else ()
|
2020-03-13 20:36:45 +00:00
|
|
|
# Using a Facebook AWS account for S3 storage. (maven.org has a history
|
|
|
|
# of failing in Travis builds.)
|
|
|
|
set(DEPS_URL "https://rocksdb-deps.s3-us-west-2.amazonaws.com/jars")
|
2017-04-22 03:41:37 +00:00
|
|
|
endif()
|
|
|
|
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT EXISTS ${JAVA_JUNIT_JAR})
|
|
|
|
message("Downloading ${JAVA_JUNIT_JAR}")
|
2023-10-18 19:51:50 +00:00
|
|
|
file(DOWNLOAD ${DEPS_URL}/junit-${JAVA_JUNIT_VERSION}.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 14:44:31 +00:00
|
|
|
list(GET downloadStatus 0 error_code)
|
2020-03-11 15:50:20 +00:00
|
|
|
list(GET downloadStatus 1 error_message)
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT error_code EQUAL 0)
|
2020-03-11 15:50:20 +00:00
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_JUNIT_JAR}: ${error_message}")
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_JUNIT_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_HAMCR_JAR})
|
|
|
|
message("Downloading ${JAVA_HAMCR_JAR}")
|
2023-10-18 19:51:50 +00:00
|
|
|
file(DOWNLOAD ${DEPS_URL}/hamcrest-${JAVA_HAMCR_VERSION}.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 14:44:31 +00:00
|
|
|
list(GET downloadStatus 0 error_code)
|
2020-03-11 15:50:20 +00:00
|
|
|
list(GET downloadStatus 1 error_message)
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT error_code EQUAL 0)
|
2020-03-11 15:50:20 +00:00
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_HAMCR_JAR}: ${error_message}")
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_HAMCR_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_MOCKITO_JAR})
|
|
|
|
message("Downloading ${JAVA_MOCKITO_JAR}")
|
2023-10-18 19:51:50 +00:00
|
|
|
file(DOWNLOAD ${DEPS_URL}/mockito-all-${JAVA_MOCKITO_VERSION}.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 14:44:31 +00:00
|
|
|
list(GET downloadStatus 0 error_code)
|
2020-03-11 15:50:20 +00:00
|
|
|
list(GET downloadStatus 1 error_message)
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT error_code EQUAL 0)
|
2020-03-11 15:50:20 +00:00
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_MOCKITO_JAR}: ${error_message}")
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_MOCKITO_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_CGLIB_JAR})
|
|
|
|
message("Downloading ${JAVA_CGLIB_JAR}")
|
2023-10-18 19:51:50 +00:00
|
|
|
file(DOWNLOAD ${DEPS_URL}/cglib-${JAVA_CGLIB_VERSION}.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 14:44:31 +00:00
|
|
|
list(GET downloadStatus 0 error_code)
|
2020-03-11 15:50:20 +00:00
|
|
|
list(GET downloadStatus 1 error_message)
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT error_code EQUAL 0)
|
2020-03-11 15:50:20 +00:00
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_CGLIB_JAR}: ${error_message}")
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_CGLIB_JAR})
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS ${JAVA_ASSERTJ_JAR})
|
|
|
|
message("Downloading ${JAVA_ASSERTJ_JAR}")
|
2023-10-18 19:51:50 +00:00
|
|
|
file(DOWNLOAD ${DEPS_URL}/assertj-core-${JAVA_ASSERTJ_VERSION}.jar ${JAVA_TMP_JAR} STATUS downloadStatus)
|
2016-01-28 14:44:31 +00:00
|
|
|
list(GET downloadStatus 0 error_code)
|
2020-03-11 15:50:20 +00:00
|
|
|
list(GET downloadStatus 1 error_message)
|
2016-01-28 14:44:31 +00:00
|
|
|
if(NOT error_code EQUAL 0)
|
2020-03-11 15:50:20 +00:00
|
|
|
message(FATAL_ERROR "Failed downloading ${JAVA_ASSERTJ_JAR}: ${error_message}")
|
2016-01-28 14:44:31 +00:00
|
|
|
endif()
|
|
|
|
file(RENAME ${JAVA_TMP_JAR} ${JAVA_ASSERTJ_JAR})
|
|
|
|
endif()
|
|
|
|
|
2022-02-17 21:28:09 +00:00
|
|
|
if(${CMAKE_VERSION} VERSION_LESS "3.11.4")
|
|
|
|
# Old CMake ONLY generate JNI headers, otherwise JNI is handled in add_jar step above
|
|
|
|
message("Preparing JNI headers for old CMake (${CMAKE_VERSION})")
|
2019-06-17 17:15:58 +00:00
|
|
|
set(NATIVE_JAVA_CLASSES
|
|
|
|
org.rocksdb.AbstractCompactionFilter
|
|
|
|
org.rocksdb.AbstractCompactionFilterFactory
|
|
|
|
org.rocksdb.AbstractComparator
|
2020-10-14 18:32:10 +00:00
|
|
|
org.rocksdb.AbstractEventListener
|
2019-06-17 17:15:58 +00:00
|
|
|
org.rocksdb.AbstractImmutableNativeReference
|
|
|
|
org.rocksdb.AbstractNativeReference
|
|
|
|
org.rocksdb.AbstractRocksIterator
|
|
|
|
org.rocksdb.AbstractSlice
|
|
|
|
org.rocksdb.AbstractTableFilter
|
|
|
|
org.rocksdb.AbstractTraceWriter
|
|
|
|
org.rocksdb.AbstractTransactionNotifier
|
|
|
|
org.rocksdb.AbstractWalFilter
|
2022-01-27 23:44:23 +00:00
|
|
|
org.rocksdb.BackupEngineOptions
|
2019-06-17 17:15:58 +00:00
|
|
|
org.rocksdb.BackupEngine
|
|
|
|
org.rocksdb.BlockBasedTableConfig
|
|
|
|
org.rocksdb.BloomFilter
|
|
|
|
org.rocksdb.CassandraCompactionFilter
|
|
|
|
org.rocksdb.CassandraValueMergeOperator
|
|
|
|
org.rocksdb.Checkpoint
|
|
|
|
org.rocksdb.ClockCache
|
2021-03-17 16:28:47 +00:00
|
|
|
org.rocksdb.Cache
|
2019-06-17 17:15:58 +00:00
|
|
|
org.rocksdb.ColumnFamilyHandle
|
|
|
|
org.rocksdb.ColumnFamilyOptions
|
|
|
|
org.rocksdb.CompactionJobInfo
|
|
|
|
org.rocksdb.CompactionJobStats
|
|
|
|
org.rocksdb.CompactionOptions
|
|
|
|
org.rocksdb.CompactionOptionsFIFO
|
|
|
|
org.rocksdb.CompactionOptionsUniversal
|
|
|
|
org.rocksdb.CompactRangeOptions
|
|
|
|
org.rocksdb.ComparatorOptions
|
|
|
|
org.rocksdb.CompressionOptions
|
2021-01-16 01:51:20 +00:00
|
|
|
org.rocksdb.ConcurrentTaskLimiterImpl
|
|
|
|
org.rocksdb.ConfigOptions
|
2019-06-17 17:15:58 +00:00
|
|
|
org.rocksdb.DBOptions
|
|
|
|
org.rocksdb.DirectSlice
|
|
|
|
org.rocksdb.Env
|
|
|
|
org.rocksdb.EnvOptions
|
|
|
|
org.rocksdb.Filter
|
|
|
|
org.rocksdb.FlushOptions
|
|
|
|
org.rocksdb.HashLinkedListMemTableConfig
|
|
|
|
org.rocksdb.HashSkipListMemTableConfig
|
2023-11-16 23:46:31 +00:00
|
|
|
org.rocksdb.HyperClockCache
|
2019-06-17 17:15:58 +00:00
|
|
|
org.rocksdb.IngestExternalFileOptions
|
|
|
|
org.rocksdb.Logger
|
|
|
|
org.rocksdb.LRUCache
|
|
|
|
org.rocksdb.MemoryUtil
|
|
|
|
org.rocksdb.MemTableConfig
|
|
|
|
org.rocksdb.NativeComparatorWrapper
|
|
|
|
org.rocksdb.NativeLibraryLoader
|
|
|
|
org.rocksdb.OptimisticTransactionDB
|
|
|
|
org.rocksdb.OptimisticTransactionOptions
|
|
|
|
org.rocksdb.Options
|
|
|
|
org.rocksdb.OptionsUtil
|
|
|
|
org.rocksdb.PersistentCache
|
|
|
|
org.rocksdb.PlainTableConfig
|
|
|
|
org.rocksdb.RateLimiter
|
|
|
|
org.rocksdb.ReadOptions
|
|
|
|
org.rocksdb.RemoveEmptyValueCompactionFilter
|
|
|
|
org.rocksdb.RestoreOptions
|
|
|
|
org.rocksdb.RocksCallbackObject
|
|
|
|
org.rocksdb.RocksDB
|
|
|
|
org.rocksdb.RocksEnv
|
|
|
|
org.rocksdb.RocksIterator
|
|
|
|
org.rocksdb.RocksIteratorInterface
|
|
|
|
org.rocksdb.RocksMemEnv
|
|
|
|
org.rocksdb.RocksMutableObject
|
|
|
|
org.rocksdb.RocksObject
|
|
|
|
org.rocksdb.SkipListMemTableConfig
|
|
|
|
org.rocksdb.Slice
|
|
|
|
org.rocksdb.Snapshot
|
|
|
|
org.rocksdb.SstFileManager
|
|
|
|
org.rocksdb.SstFileWriter
|
2019-09-10 01:11:02 +00:00
|
|
|
org.rocksdb.SstFileReader
|
|
|
|
org.rocksdb.SstFileReaderIterator
|
2020-07-24 20:43:14 +00:00
|
|
|
org.rocksdb.SstPartitionerFactory
|
|
|
|
org.rocksdb.SstPartitionerFixedPrefixFactory
|
2019-06-17 17:15:58 +00:00
|
|
|
org.rocksdb.Statistics
|
|
|
|
org.rocksdb.StringAppendOperator
|
|
|
|
org.rocksdb.TableFormatConfig
|
|
|
|
org.rocksdb.ThreadStatus
|
|
|
|
org.rocksdb.TimedEnv
|
|
|
|
org.rocksdb.Transaction
|
|
|
|
org.rocksdb.TransactionDB
|
|
|
|
org.rocksdb.TransactionDBOptions
|
|
|
|
org.rocksdb.TransactionLogIterator
|
|
|
|
org.rocksdb.TransactionOptions
|
|
|
|
org.rocksdb.TtlDB
|
|
|
|
org.rocksdb.UInt64AddOperator
|
|
|
|
org.rocksdb.VectorMemTableConfig
|
|
|
|
org.rocksdb.WBWIRocksIterator
|
|
|
|
org.rocksdb.WriteBatch
|
|
|
|
org.rocksdb.WriteBatch.Handler
|
|
|
|
org.rocksdb.WriteBatchInterface
|
|
|
|
org.rocksdb.WriteBatchWithIndex
|
|
|
|
org.rocksdb.WriteOptions
|
|
|
|
org.rocksdb.NativeComparatorWrapperTest
|
|
|
|
org.rocksdb.RocksDBExceptionTest
|
|
|
|
org.rocksdb.SnapshotTest
|
|
|
|
org.rocksdb.WriteBatchTest
|
|
|
|
org.rocksdb.WriteBatchTestInternalHelper
|
|
|
|
org.rocksdb.WriteBufferManager
|
2021-01-16 01:51:20 +00:00
|
|
|
org.rocksdb.test.TestableEventListener
|
2019-06-17 17:15:58 +00:00
|
|
|
)
|
2017-11-28 20:13:20 +00:00
|
|
|
|
2019-06-17 17:15:58 +00:00
|
|
|
create_javah(
|
|
|
|
TARGET rocksdbjni_headers
|
|
|
|
CLASSES ${NATIVE_JAVA_CLASSES}
|
|
|
|
CLASSPATH rocksdbjni_classes ${JAVA_TESTCLASSPATH}
|
|
|
|
OUTPUT_DIR ${JNI_OUTPUT_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
2017-11-28 20:13:20 +00:00
|
|
|
|
|
|
|
if(NOT MSVC)
|
|
|
|
set_property(TARGET ${ROCKSDB_STATIC_LIB} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
2016-07-26 23:18:49 +00:00
|
|
|
endif()
|
|
|
|
|
2017-11-28 20:13:20 +00:00
|
|
|
set(ROCKSDBJNI_STATIC_LIB rocksdbjni${ARTIFACT_SUFFIX})
|
2023-10-18 19:51:50 +00:00
|
|
|
if(MINGW)
|
|
|
|
# Build mingw only as staic library.
|
|
|
|
add_library(${ROCKSDBJNI_STATIC_LIB} ${JNI_NATIVE_SOURCES})
|
|
|
|
else()
|
|
|
|
add_library(${ROCKSDBJNI_STATIC_LIB} SHARED ${JNI_NATIVE_SOURCES})
|
|
|
|
endif()
|
2017-11-28 20:13:20 +00:00
|
|
|
add_dependencies(${ROCKSDBJNI_STATIC_LIB} rocksdbjni_headers)
|
2019-12-10 23:19:24 +00:00
|
|
|
target_link_libraries(${ROCKSDBJNI_STATIC_LIB} ${ROCKSDB_STATIC_LIB} ${ROCKSDB_LIB})
|
2017-11-28 20:13:20 +00:00
|
|
|
|
|
|
|
if(NOT MINGW)
|
|
|
|
set(ROCKSDBJNI_SHARED_LIB rocksdbjni-shared${ARTIFACT_SUFFIX})
|
|
|
|
add_library(${ROCKSDBJNI_SHARED_LIB} SHARED ${JNI_NATIVE_SOURCES})
|
|
|
|
add_dependencies(${ROCKSDBJNI_SHARED_LIB} rocksdbjni_headers)
|
2019-12-10 23:19:24 +00:00
|
|
|
target_link_libraries(${ROCKSDBJNI_SHARED_LIB} ${ROCKSDB_STATIC_LIB} ${ROCKSDB_LIB})
|
2017-11-28 20:13:20 +00:00
|
|
|
|
|
|
|
set_target_properties(
|
|
|
|
${ROCKSDBJNI_SHARED_LIB}
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_CFG_INTDIR}
|
|
|
|
COMPILE_PDB_NAME ${ROCKSDBJNI_STATIC_LIB}.pdb
|
|
|
|
)
|
|
|
|
endif()
|
2023-10-18 19:51:50 +00:00
|
|
|
|
2024-02-27 23:46:12 +00:00
|
|
|
# Javadoc Jar
|
|
|
|
set(ROCKSDB_JAVADOC_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-javadoc.jar)
|
|
|
|
create_javadoc(rocksdb
|
|
|
|
PACKAGES org.rocksdb org.rocksdb.util
|
|
|
|
SOURCEPATH "${PROJECT_SOURCE_DIR}/java/src/main/java"
|
|
|
|
WINDOWTITLE "RocksDB Java API JavaDoc"
|
|
|
|
AUTHOR FALSE
|
|
|
|
USE FALSE
|
|
|
|
VERSION TRUE
|
|
|
|
)
|
|
|
|
add_custom_target(rocksdb_javadocs_jar ALL
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} cvf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAVADOC_JAR} -C ${CMAKE_CURRENT_BINARY_DIR}/javadoc/rocksdb .
|
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAVADOC_JAR}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2024-03-06 18:33:17 +00:00
|
|
|
DEPENDS rocksdb_javadoc
|
2024-01-10 17:46:00 +00:00
|
|
|
)
|
|
|
|
|
2024-02-27 23:46:12 +00:00
|
|
|
# Sources Jar
|
|
|
|
set(ROCKSDB_SOURCES_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-sources.jar)
|
|
|
|
add_custom_target(rocksdb_sources_jar ALL
|
|
|
|
${Java_JAR_EXECUTABLE} cvf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_SOURCES_JAR} -C ${PROJECT_SOURCE_DIR}/java/src/main/java/ .
|
2024-01-10 17:46:00 +00:00
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_SOURCES_JAR}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2024-02-27 23:46:12 +00:00
|
|
|
)
|
2024-01-10 17:46:00 +00:00
|
|
|
|
2024-01-25 20:36:03 +00:00
|
|
|
set(bitness 32)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(bitness 64)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
set_target_properties(
|
|
|
|
${ROCKSDBJNI_STATIC_LIB}
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME librocksdbjni-win${bitness}
|
|
|
|
)
|
|
|
|
set(ROCKSDB_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-win${bitness}.jar)
|
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
set_target_properties(
|
|
|
|
${ROCKSDBJNI_STATIC_LIB}
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "rocksdbjni-linux${bitness}"
|
|
|
|
)
|
|
|
|
set(ROCKSDB_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-linux${bitness}.jar)
|
|
|
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set_target_properties(
|
|
|
|
${ROCKSDBJNI_STATIC_LIB}
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME rocksdbjni-osx-${CMAKE_SYSTEM_PROCESSOR}
|
|
|
|
)
|
|
|
|
set_target_properties(
|
|
|
|
${ROCKSDBJNI_STATIC_LIB}
|
|
|
|
PROPERTIES
|
|
|
|
SUFFIX ".jnilib"
|
|
|
|
)
|
|
|
|
set(ROCKSDB_JAR rocksdbjni-${CMAKE_PROJECT_VERSION}-osx.jar)
|
|
|
|
else()
|
|
|
|
set(ROCKSDB_JAR rocksdb-${CMAKE_PROJECT_VERSION}.jar)
|
|
|
|
endif()
|
2024-01-10 17:46:00 +00:00
|
|
|
|
2024-01-25 20:36:03 +00:00
|
|
|
get_target_property(ROCKS_JAR_FILE rocksdbjni_classes JAR_FILE)
|
|
|
|
|
|
|
|
add_custom_target(rocksdbjava ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${ROCKS_JAR_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR}
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} -uf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR} -C $<TARGET_FILE_DIR:${ROCKSDBJNI_STATIC_LIB}> $<TARGET_FILE_NAME:${ROCKSDBJNI_STATIC_LIB}>
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} -uf ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR} -C ${CMAKE_CURRENT_SOURCE_DIR} HISTORY-JAVA.md
|
|
|
|
DEPENDS ${ROCKSDBJNI_STATIC_LIB} rocksdbjni_classes
|
|
|
|
BYPRODUCTS ${ROCKSDB_JAR}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
2024-01-10 17:46:00 +00:00
|
|
|
|
2023-10-18 19:51:50 +00:00
|
|
|
enable_testing()
|
|
|
|
get_target_property(ROCKSDBJNI_CLASSES_TEST_JAR_FILE rocksdbjni_test_classes JAR_FILE)
|
|
|
|
foreach (CLAZZ ${JAVA_TEST_RUNNING_CLASSES})
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
|
|
add_test(
|
|
|
|
NAME jtest_${CLAZZ}
|
2024-01-25 20:36:03 +00:00
|
|
|
COMMAND ${Java_JAVA_EXECUTABLE} ${JVMARGS} -ea -Xcheck:jni -Djava.library.path=${PROJECT_BINARY_DIR}/java/${CMAKE_BUILD_TYPE} -classpath ${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR}$<SEMICOLON>${JAVA_RUN_TESTCLASSPATH}$<SEMICOLON>${ROCKSDBJNI_CLASSES_TEST_JAR_FILE} org.rocksdb.test.RocksJunitRunner ${CLAZZ}
|
2023-10-18 19:51:50 +00:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_test(
|
|
|
|
NAME jtest_${CLAZZ}
|
2024-04-03 18:03:11 +00:00
|
|
|
COMMAND ${Java_JAVA_EXECUTABLE} ${JVMARGS} -ea -Xcheck:jni -Djava.library.path=${PROJECT_BINARY_DIR}/java -classpath ${JAVA_RUN_TESTCLASSPATH}:${ROCKSDBJNI_CLASSES_TEST_JAR_FILE}:${CMAKE_CURRENT_BINARY_DIR}/${ROCKSDB_JAR} org.rocksdb.test.RocksJunitRunner ${CLAZZ}
|
2023-10-18 19:51:50 +00:00
|
|
|
)
|
|
|
|
endif()
|
2024-02-05 21:35:19 +00:00
|
|
|
endforeach(CLAZZ)
|