2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2014-04-02 01:59:05 +02:00
|
|
|
//
|
|
|
|
// This file implements the "bridge" between Java and C++ for rocksdb::Options.
|
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
#include <jni.h>
|
2014-04-02 01:59:05 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2014-04-15 06:06:13 +02:00
|
|
|
#include <memory>
|
2017-03-30 21:04:09 +02:00
|
|
|
#include <vector>
|
2014-04-02 01:59:05 +02:00
|
|
|
|
2014-10-31 23:39:14 +01:00
|
|
|
#include "include/org_rocksdb_ColumnFamilyOptions.h"
|
2014-08-15 14:34:10 +02:00
|
|
|
#include "include/org_rocksdb_ComparatorOptions.h"
|
2018-04-13 02:55:14 +02:00
|
|
|
#include "include/org_rocksdb_DBOptions.h"
|
2014-11-09 20:09:39 +01:00
|
|
|
#include "include/org_rocksdb_FlushOptions.h"
|
2018-04-13 02:55:14 +02:00
|
|
|
#include "include/org_rocksdb_Options.h"
|
|
|
|
#include "include/org_rocksdb_ReadOptions.h"
|
|
|
|
#include "include/org_rocksdb_WriteOptions.h"
|
2014-08-15 14:34:10 +02:00
|
|
|
|
2014-08-21 22:55:51 +02:00
|
|
|
#include "rocksjni/comparatorjnicallback.h"
|
2014-04-02 01:59:05 +02:00
|
|
|
#include "rocksjni/portal.h"
|
2017-07-12 08:19:53 +02:00
|
|
|
#include "rocksjni/statisticsjni.h"
|
2019-02-22 23:36:38 +01:00
|
|
|
#include "rocksjni/table_filter_jnicallback.h"
|
2014-11-09 20:09:39 +01:00
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
#include "rocksdb/comparator.h"
|
|
|
|
#include "rocksdb/convenience.h"
|
2014-04-02 01:59:05 +02:00
|
|
|
#include "rocksdb/db.h"
|
2018-04-13 02:55:14 +02:00
|
|
|
#include "rocksdb/memtablerep.h"
|
|
|
|
#include "rocksdb/merge_operator.h"
|
2014-04-02 22:14:55 +02:00
|
|
|
#include "rocksdb/options.h"
|
2018-04-13 02:55:14 +02:00
|
|
|
#include "rocksdb/rate_limiter.h"
|
|
|
|
#include "rocksdb/slice_transform.h"
|
2014-04-15 06:06:13 +02:00
|
|
|
#include "rocksdb/statistics.h"
|
2014-04-22 00:40:46 +02:00
|
|
|
#include "rocksdb/table.h"
|
2014-09-16 22:58:49 +02:00
|
|
|
#include "utilities/merge_operators.h"
|
2014-04-02 01:59:05 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: newOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: ()J
|
2014-04-02 01:59:05 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_newOptions__(
|
|
|
|
JNIEnv*, jclass) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* op = new rocksdb::Options();
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(op);
|
2014-04-02 01:59:05 +02:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: newOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: (JJ)J
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_newOptions__JJ(
|
|
|
|
JNIEnv*, jclass, jlong jdboptions, jlong jcfoptions) {
|
2016-01-20 18:05:41 +01:00
|
|
|
auto* dbOpt = reinterpret_cast<const rocksdb::DBOptions*>(jdboptions);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* cfOpt =
|
|
|
|
reinterpret_cast<const rocksdb::ColumnFamilyOptions*>(jcfoptions);
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* op = new rocksdb::Options(*dbOpt, *cfOpt);
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(op);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2018-02-02 19:46:41 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: copyOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_copyOptions(
|
|
|
|
JNIEnv*, jclass, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
auto new_opt =
|
|
|
|
new rocksdb::Options(*(reinterpret_cast<rocksdb::Options*>(jhandle)));
|
2018-02-02 19:46:41 +01:00
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
|
|
|
}
|
|
|
|
|
2014-04-02 01:59:05 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
[Java] Generalize dis-own native handle and refine dispose framework.
Summary:
1. Move disOwnNativeHandle() function from RocksDB to RocksObject
to allow other RocksObject to use disOwnNativeHandle() when its
ownership of native handle has been transferred.
2. RocksObject now has an abstract implementation of dispose(),
which does the following two things. First, it checks whether
both isOwningNativeHandle() and isInitialized() return true.
If so, it will call the protected abstract function dispose0(),
which all the subclasses of RocksObject should implement. Second,
it sets nativeHandle_ = 0. This redesign ensure all subclasses
of RocksObject have the same dispose behavior.
3. All subclasses of RocksObject now should implement dispose0()
instead of dispose(), and dispose0() will be called only when
isInitialized() returns true.
Test Plan:
make rocksdbjava
make jtest
Reviewers: dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett, haobo
Reviewed By: haobo
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D18801
2014-05-29 03:16:29 +02:00
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
2014-04-02 01:59:05 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong handle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* op = reinterpret_cast<rocksdb::Options*>(handle);
|
|
|
|
assert(op != nullptr);
|
|
|
|
delete op;
|
2014-04-02 01:59:05 +02:00
|
|
|
}
|
|
|
|
|
2014-12-05 14:41:39 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setIncreaseParallelism
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setIncreaseParallelism(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint totalThreads) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->IncreaseParallelism(
|
|
|
|
static_cast<int>(totalThreads));
|
2014-12-05 14:41:39 +01:00
|
|
|
}
|
|
|
|
|
2014-04-02 01:59:05 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCreateIfMissing
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setCreateIfMissing(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean flag) {
|
2014-04-02 01:59:05 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->create_if_missing = flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: createIfMissing
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_createIfMissing(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-02 01:59:05 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->create_if_missing;
|
|
|
|
}
|
2014-04-02 22:14:55 +02:00
|
|
|
|
2014-10-13 10:34:52 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCreateMissingColumnFamilies
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setCreateMissingColumnFamilies(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean flag) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->create_missing_column_families =
|
|
|
|
flag;
|
2014-10-13 10:34:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: createMissingColumnFamilies
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_createMissingColumnFamilies(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->create_missing_column_families;
|
2014-10-13 10:34:52 +02:00
|
|
|
}
|
|
|
|
|
2014-09-26 10:35:12 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2014-10-28 22:38:08 +01:00
|
|
|
* Method: setComparatorHandle
|
2014-09-26 10:35:12 +02:00
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setComparatorHandle__JI(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint builtinComparator) {
|
2014-10-09 23:16:41 +02:00
|
|
|
switch (builtinComparator) {
|
2014-09-26 10:35:12 +02:00
|
|
|
case 1:
|
2014-10-03 09:10:58 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->comparator =
|
|
|
|
rocksdb::ReverseBytewiseComparator();
|
|
|
|
break;
|
2014-09-26 10:35:12 +02:00
|
|
|
default:
|
2014-10-03 09:10:58 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->comparator =
|
|
|
|
rocksdb::BytewiseComparator();
|
|
|
|
break;
|
2014-09-26 10:35:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setComparatorHandle
|
2018-03-08 20:16:46 +01:00
|
|
|
* Signature: (JJB)V
|
2017-10-12 20:06:51 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setComparatorHandle__JJB(
|
|
|
|
JNIEnv*, jobject, jlong jopt_handle, jlong jcomparator_handle,
|
|
|
|
jbyte jcomparator_type) {
|
2018-04-13 02:55:14 +02:00
|
|
|
rocksdb::Comparator* comparator = nullptr;
|
|
|
|
switch (jcomparator_type) {
|
|
|
|
// JAVA_COMPARATOR
|
|
|
|
case 0x0:
|
|
|
|
comparator =
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallback*>(jcomparator_handle);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// JAVA_NATIVE_COMPARATOR_WRAPPER
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
case 0x1:
|
2018-04-13 02:55:14 +02:00
|
|
|
comparator = reinterpret_cast<rocksdb::Comparator*>(jcomparator_handle);
|
|
|
|
break;
|
2017-10-12 20:06:51 +02:00
|
|
|
}
|
2018-03-08 20:16:46 +01:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jopt_handle);
|
|
|
|
opt->comparator = comparator;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMergeOperatorName
|
|
|
|
* Signature: (JJjava/lang/String)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMergeOperatorName(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jstring jop_name) {
|
2017-02-28 01:26:12 +01:00
|
|
|
const char* op_name = env->GetStringUTFChars(jop_name, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (op_name == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
options->merge_operator =
|
|
|
|
rocksdb::MergeOperators::CreateFromStringId(op_name);
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2014-11-15 12:37:51 +01:00
|
|
|
env->ReleaseStringUTFChars(jop_name, op_name);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMergeOperator
|
|
|
|
* Signature: (JJjava/lang/String)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMergeOperator(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong mergeOperatorHandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->merge_operator =
|
2018-04-13 02:55:14 +02:00
|
|
|
*(reinterpret_cast<std::shared_ptr<rocksdb::MergeOperator>*>(
|
|
|
|
mergeOperatorHandle));
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2018-12-11 00:51:19 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionFilterHandle
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompactionFilterHandle(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jopt_handle,
|
2018-12-11 00:51:19 +01:00
|
|
|
jlong jcompactionfilter_handle) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jopt_handle)->
|
|
|
|
compaction_filter = reinterpret_cast<rocksdb::CompactionFilter*>
|
|
|
|
(jcompactionfilter_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionFilterFactoryHandle
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void JNICALL Java_org_rocksdb_Options_setCompactionFilterFactoryHandle(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jopt_handle,
|
2018-12-11 00:51:19 +01:00
|
|
|
jlong jcompactionfilterfactory_handle) {
|
|
|
|
auto* cff_factory =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::CompactionFilterFactory> *>(
|
|
|
|
jcompactionfilterfactory_handle);
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jopt_handle)->
|
|
|
|
compaction_filter_factory = *cff_factory;
|
|
|
|
}
|
|
|
|
|
2014-04-06 18:33:31 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWriteBufferSize
|
2014-04-14 23:03:43 +02:00
|
|
|
* Signature: (JJ)I
|
2014-04-06 18:33:31 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWriteBufferSize(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jwrite_buffer_size) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jwrite_buffer_size);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->write_buffer_size =
|
|
|
|
jwrite_buffer_size;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-06 18:33:31 +02:00
|
|
|
}
|
|
|
|
|
2018-10-17 20:47:51 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWriteBufferManager
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWriteBufferManager(
|
|
|
|
JNIEnv*, jobject, jlong joptions_handle,
|
|
|
|
jlong jwrite_buffer_manager_handle) {
|
2018-10-17 20:47:51 +02:00
|
|
|
auto* write_buffer_manager =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::WriteBufferManager> *>(jwrite_buffer_manager_handle);
|
|
|
|
reinterpret_cast<rocksdb::Options*>(joptions_handle)->write_buffer_manager =
|
|
|
|
*write_buffer_manager;
|
|
|
|
}
|
|
|
|
|
2014-04-06 18:33:31 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: writeBufferSize
|
2014-04-14 23:03:43 +02:00
|
|
|
* Signature: (J)J
|
2014-04-06 18:33:31 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_writeBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-08 03:32:09 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->write_buffer_size;
|
2014-04-06 18:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxWriteBufferNumber
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxWriteBufferNumber(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jint jmax_write_buffer_number) {
|
2014-04-08 03:32:09 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_write_buffer_number =
|
2018-04-13 02:55:14 +02:00
|
|
|
jmax_write_buffer_number;
|
2014-04-06 18:33:31 +02:00
|
|
|
}
|
|
|
|
|
2014-04-15 06:06:13 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-07-12 08:19:53 +02:00
|
|
|
* Method: setStatistics
|
|
|
|
* Signature: (JJ)V
|
2014-04-15 06:06:13 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setStatistics(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jstatistics_handle) {
|
2017-07-12 08:19:53 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* pSptr = reinterpret_cast<std::shared_ptr<rocksdb::StatisticsJni>*>(
|
|
|
|
jstatistics_handle);
|
2017-07-12 08:19:53 +02:00
|
|
|
opt->statistics = *pSptr;
|
2014-04-15 06:06:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-07-12 08:19:53 +02:00
|
|
|
* Method: statistics
|
2014-04-15 06:06:13 +02:00
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_statistics(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-07-12 08:19:53 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
std::shared_ptr<rocksdb::Statistics> sptr = opt->statistics;
|
|
|
|
if (sptr == nullptr) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
std::shared_ptr<rocksdb::Statistics>* pSptr =
|
|
|
|
new std::shared_ptr<rocksdb::Statistics>(sptr);
|
|
|
|
return reinterpret_cast<jlong>(pSptr);
|
|
|
|
}
|
2014-04-15 06:06:13 +02:00
|
|
|
}
|
2014-04-06 18:33:31 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxWriteBufferNumber
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxWriteBufferNumber(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-08 03:32:09 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_write_buffer_number;
|
2014-04-06 18:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2014-04-18 10:14:29 +02:00
|
|
|
* Method: errorIfExists
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_errorIfExists(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->error_if_exists;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setErrorIfExists
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setErrorIfExists(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean error_if_exists) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->error_if_exists =
|
|
|
|
static_cast<bool>(error_if_exists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: paranoidChecks
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_paranoidChecks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->paranoid_checks;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setParanoidChecks
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setParanoidChecks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean paranoid_checks) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->paranoid_checks =
|
|
|
|
static_cast<bool>(paranoid_checks);
|
|
|
|
}
|
|
|
|
|
2014-11-07 14:38:21 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setEnv
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setEnv(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jenv) {
|
2014-11-07 14:38:21 +01:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->env =
|
|
|
|
reinterpret_cast<rocksdb::Env*>(jenv);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxTotalWalSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMaxTotalWalSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_total_wal_size) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_total_wal_size =
|
|
|
|
static_cast<jlong>(jmax_total_wal_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxTotalWalSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxTotalWalSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_total_wal_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxOpenFiles
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxOpenFiles(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_open_files;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxOpenFiles
|
2014-04-06 18:33:31 +02:00
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMaxOpenFiles(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max_open_files) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_open_files =
|
|
|
|
static_cast<int>(max_open_files);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxFileOpeningThreads
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxFileOpeningThreads(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmax_file_opening_threads) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_file_opening_threads =
|
|
|
|
static_cast<int>(jmax_file_opening_threads);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxFileOpeningThreads
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxFileOpeningThreads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<int>(opt->max_file_opening_threads);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: useFsync
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_useFsync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->use_fsync;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setUseFsync
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setUseFsync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean use_fsync) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->use_fsync =
|
|
|
|
static_cast<bool>(use_fsync);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDbPaths
|
|
|
|
* Signature: (J[Ljava/lang/String;[J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setDbPaths(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths,
|
|
|
|
jlongArray jtarget_sizes) {
|
2017-03-30 21:04:09 +02:00
|
|
|
std::vector<rocksdb::DbPath> db_paths;
|
|
|
|
jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (ptr_jtarget_size == nullptr) {
|
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jboolean has_exception = JNI_FALSE;
|
|
|
|
const jsize len = env->GetArrayLength(jpaths);
|
2018-04-13 02:55:14 +02:00
|
|
|
for (jsize i = 0; i < len; i++) {
|
|
|
|
jobject jpath =
|
|
|
|
reinterpret_cast<jstring>(env->GetObjectArrayElement(jpaths, i));
|
|
|
|
if (env->ExceptionCheck()) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
2018-04-13 02:55:14 +02:00
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
2017-03-30 21:04:09 +02:00
|
|
|
return;
|
|
|
|
}
|
2017-10-12 20:06:51 +02:00
|
|
|
std::string path = rocksdb::JniUtil::copyStdString(
|
2017-03-30 21:04:09 +02:00
|
|
|
env, static_cast<jstring>(jpath), &has_exception);
|
|
|
|
env->DeleteLocalRef(jpath);
|
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
if (has_exception == JNI_TRUE) {
|
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
|
|
|
return;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jlong jtarget_size = ptr_jtarget_size[i];
|
|
|
|
|
|
|
|
db_paths.push_back(
|
|
|
|
rocksdb::DbPath(path, static_cast<uint64_t>(jtarget_size)));
|
|
|
|
}
|
|
|
|
|
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
|
|
|
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->db_paths = db_paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: dbPathsLen
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_dbPathsLen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->db_paths.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: dbPaths
|
|
|
|
* Signature: (J[Ljava/lang/String;[J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_dbPaths(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths,
|
|
|
|
jlongArray jtarget_sizes) {
|
2017-03-30 21:04:09 +02:00
|
|
|
jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (ptr_jtarget_size == nullptr) {
|
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
const jsize len = env->GetArrayLength(jpaths);
|
2018-04-13 02:55:14 +02:00
|
|
|
for (jsize i = 0; i < len; i++) {
|
2017-03-30 21:04:09 +02:00
|
|
|
rocksdb::DbPath db_path = opt->db_paths[i];
|
|
|
|
|
|
|
|
jstring jpath = env->NewStringUTF(db_path.path.c_str());
|
2018-04-13 02:55:14 +02:00
|
|
|
if (jpath == nullptr) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: OutOfMemoryError
|
2018-04-13 02:55:14 +02:00
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
2017-03-30 21:04:09 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
env->SetObjectArrayElement(jpaths, i, jpath);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (env->ExceptionCheck()) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
|
|
|
env->DeleteLocalRef(jpath);
|
2018-04-13 02:55:14 +02:00
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
2017-03-30 21:04:09 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr_jtarget_size[i] = static_cast<jint>(db_path.target_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_COMMIT);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: dbLogDir
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_Options_dbLogDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return env->NewStringUTF(
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->db_log_dir.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDbLogDir
|
|
|
|
* Signature: (JLjava/lang/String)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setDbLogDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jstring jdb_log_dir) {
|
2017-02-28 01:26:12 +01:00
|
|
|
const char* log_dir = env->GetStringUTFChars(jdb_log_dir, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (log_dir == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
|
|
|
}
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->db_log_dir.assign(log_dir);
|
|
|
|
env->ReleaseStringUTFChars(jdb_log_dir, log_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: walDir
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_Options_walDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return env->NewStringUTF(
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->wal_dir.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWalDir
|
|
|
|
* Signature: (JLjava/lang/String)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWalDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jstring jwal_dir) {
|
2017-02-28 01:26:12 +01:00
|
|
|
const char* wal_dir = env->GetStringUTFChars(jwal_dir, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (wal_dir == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
|
|
|
}
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->wal_dir.assign(wal_dir);
|
|
|
|
env->ReleaseStringUTFChars(jwal_dir, wal_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: deleteObsoleteFilesPeriodMicros
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_deleteObsoleteFilesPeriodMicros(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->delete_obsolete_files_period_micros;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDeleteObsoleteFilesPeriodMicros
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong micros) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
2018-04-13 02:55:14 +02:00
|
|
|
->delete_obsolete_files_period_micros = static_cast<int64_t>(micros);
|
2014-04-06 18:33:31 +02:00
|
|
|
}
|
|
|
|
|
2016-06-14 17:51:56 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setBaseBackgroundCompactions
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setBaseBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->base_background_compactions =
|
|
|
|
static_cast<int>(max);
|
2016-06-14 17:51:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: baseBackgroundCompactions
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_baseBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-06-14 17:51:56 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->base_background_compactions;
|
|
|
|
}
|
|
|
|
|
2014-04-06 18:33:31 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxBackgroundCompactions
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_background_compactions;
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxBackgroundCompactions
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMaxBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_background_compactions =
|
|
|
|
static_cast<int>(max);
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
2016-06-14 17:51:56 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxSubcompactions
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMaxSubcompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_subcompactions =
|
|
|
|
static_cast<int32_t>(max);
|
2016-06-14 17:51:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxSubcompactions
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxSubcompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_subcompactions;
|
2016-06-14 17:51:56 +02:00
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxBackgroundFlushes
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxBackgroundFlushes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_background_flushes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxBackgroundFlushes
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxBackgroundFlushes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max_background_flushes) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_background_flushes =
|
|
|
|
static_cast<int>(max_background_flushes);
|
|
|
|
}
|
|
|
|
|
2017-09-20 19:23:51 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxBackgroundJobs
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxBackgroundJobs(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-09-20 19:23:51 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_background_jobs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxBackgroundJobs
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMaxBackgroundJobs(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max_background_jobs) {
|
2017-09-20 19:23:51 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_background_jobs =
|
|
|
|
static_cast<int>(max_background_jobs);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxLogFileSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxLogFileSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_log_file_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxLogFileSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMaxLogFileSize(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong max_log_file_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(max_log_file_size);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_log_file_size =
|
|
|
|
max_log_file_size;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: logFileTimeToRoll
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_logFileTimeToRoll(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->log_file_time_to_roll;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLogFileTimeToRoll
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLogFileTimeToRoll(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong log_file_time_to_roll) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(log_file_time_to_roll);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->log_file_time_to_roll =
|
|
|
|
log_file_time_to_roll;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: keepLogFileNum
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_keepLogFileNum(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->keep_log_file_num;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setKeepLogFileNum
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setKeepLogFileNum(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong keep_log_file_num) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->keep_log_file_num =
|
|
|
|
keep_log_file_num;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
2015-10-08 03:06:28 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: recycleLogFileNum
|
2015-10-08 03:06:28 +02:00
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_recycleLogFileNum(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2015-10-08 03:06:28 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->recycle_log_file_num;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setRecycleLogFileNum
|
2015-10-08 03:06:28 +02:00
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setRecycleLogFileNum(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong recycle_log_file_num) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(recycle_log_file_num);
|
2015-10-08 03:06:28 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->recycle_log_file_num =
|
|
|
|
recycle_log_file_num;
|
|
|
|
} else {
|
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxManifestFileSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxManifestFileSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_manifest_file_size;
|
|
|
|
}
|
|
|
|
|
2014-04-22 00:40:46 +02:00
|
|
|
/*
|
|
|
|
* Method: memTableFactoryName
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_Options_memTableFactoryName(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2014-04-22 00:40:46 +02:00
|
|
|
rocksdb::MemTableRepFactory* tf = opt->memtable_factory.get();
|
|
|
|
|
|
|
|
// Should never be nullptr.
|
|
|
|
// Default memtable factory is SkipListFactory
|
|
|
|
assert(tf);
|
|
|
|
|
|
|
|
// temporarly fix for the historical typo
|
|
|
|
if (strcmp(tf->Name(), "HashLinkListRepFactory") == 0) {
|
|
|
|
return env->NewStringUTF("HashLinkedListRepFactory");
|
|
|
|
}
|
|
|
|
|
|
|
|
return env->NewStringUTF(tf->Name());
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxManifestFileSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxManifestFileSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong max_manifest_file_size) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_manifest_file_size =
|
|
|
|
static_cast<int64_t>(max_manifest_file_size);
|
|
|
|
}
|
|
|
|
|
2014-04-22 00:40:46 +02:00
|
|
|
/*
|
|
|
|
* Method: setMemTableFactory
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setMemTableFactory(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) {
|
2014-04-22 00:40:46 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->memtable_factory.reset(
|
|
|
|
reinterpret_cast<rocksdb::MemTableRepFactory*>(jfactory_handle));
|
|
|
|
}
|
|
|
|
|
2016-10-07 21:32:21 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setRateLimiter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setRateLimiter(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jrate_limiter_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
std::shared_ptr<rocksdb::RateLimiter>* pRateLimiter =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::RateLimiter>*>(
|
2016-10-07 21:32:21 +02:00
|
|
|
jrate_limiter_handle);
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->rate_limiter = *pRateLimiter;
|
2016-10-07 21:32:21 +02:00
|
|
|
}
|
|
|
|
|
2018-04-07 06:22:37 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setSstFileManager
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setSstFileManager(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jsst_file_manager_handle) {
|
2018-04-07 06:22:37 +02:00
|
|
|
auto* sptr_sst_file_manager =
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::SstFileManager>*>(
|
|
|
|
jsst_file_manager_handle);
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->sst_file_manager =
|
|
|
|
*sptr_sst_file_manager;
|
2018-04-07 06:22:37 +02:00
|
|
|
}
|
|
|
|
|
2015-02-10 21:59:40 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLogger
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setLogger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jlogger_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
std::shared_ptr<rocksdb::LoggerJniCallback>* pLogger =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::LoggerJniCallback>*>(
|
2015-02-10 21:59:40 +01:00
|
|
|
jlogger_handle);
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->info_log = *pLogger;
|
|
|
|
}
|
|
|
|
|
2014-11-14 23:40:20 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setInfoLogLevel
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setInfoLogLevel(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jlog_level) {
|
2014-11-14 23:40:20 +01:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->info_log_level =
|
|
|
|
static_cast<rocksdb::InfoLogLevel>(jlog_level);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: infoLogLevel
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_infoLogLevel(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-11-14 23:40:20 +01:00
|
|
|
return static_cast<jbyte>(
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->info_log_level);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: tableCacheNumshardbits
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_tableCacheNumshardbits(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->table_cache_numshardbits;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setTableCacheNumshardbits
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setTableCacheNumshardbits(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint table_cache_numshardbits) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->table_cache_numshardbits =
|
|
|
|
static_cast<int>(table_cache_numshardbits);
|
|
|
|
}
|
|
|
|
|
2014-04-22 00:40:46 +02:00
|
|
|
/*
|
|
|
|
* Method: useFixedLengthPrefixExtractor
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_useFixedLengthPrefixExtractor(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jprefix_length) {
|
2014-04-22 00:40:46 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->prefix_extractor.reset(
|
2018-04-13 02:55:14 +02:00
|
|
|
rocksdb::NewFixedPrefixTransform(static_cast<int>(jprefix_length)));
|
2014-04-22 00:40:46 +02:00
|
|
|
}
|
|
|
|
|
2015-07-29 07:15:15 +02:00
|
|
|
/*
|
|
|
|
* Method: useCappedPrefixExtractor
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_useCappedPrefixExtractor(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jprefix_length) {
|
2015-07-29 07:15:15 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->prefix_extractor.reset(
|
2018-04-13 02:55:14 +02:00
|
|
|
rocksdb::NewCappedPrefixTransform(static_cast<int>(jprefix_length)));
|
2015-07-29 07:15:15 +02:00
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: walTtlSeconds
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_walTtlSeconds(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->WAL_ttl_seconds;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
[Java] Enable filluniquerandom, readseq, BloomFilter, and 70+ command-line options to DbBenchmark.java
Summary:
* Add filluniquerandom
* Add readseq, implemented using iterator.
* Realize most command-line-arguments from db_bench.cc (70+).
* Some code are commented out as some of the options in Options
not yet have Java bindings.
* Add default option to DbBenchmark.
* RocksDB will now take the ownership of all c++ raw-pointers from Options, which includes a c++ raw-pointer for Filter.
Test Plan: ./jdb_bench.sh --db=/tmp/rocksjava-bench/db --num_levels=6 --key_size=20 --prefix_size=20 --keys_per_prefix=0 --value_size=100 --block_size=4096 --cache_size=17179869184 --cache_numshardbits=6 --compression_ratio=1 --min_level_to_compress=-1 --disable_seek_compaction=1 --hard_rate_limit=2 --write_buffer_size=134217728 --max_write_buffer_number=2 --level0_file_num_compaction_trigger=8 --target_file_size_base=134217728 --max_bytes_for_level_base=1073741824 --disable_wal=0 --wal_dir=/tmp/rocksjava-bench/wal --sync=0 --disable_data_sync=1 --verify_checksum=1 --delete_obsolete_files_period_micros=314572800 --max_grandparent_overlap_factor=10 --max_background_compactions=4 --max_background_flushes=0 --level0_slowdown_writes_trigger=16 --level0_stop_writes_trigger=24 --statistics=0 --stats_per_interval=0 --stats_interval=1048576 --histogram=0 --use_plain_table=1 --open_files=-1 --mmap_read=1 --mmap_write=0 --memtablerep=prefix_hash --bloom_bits=10 --bloom_locality=1 --perf_level=0 --benchmarks=filluniquerandom,readseq,readrandom --use_existing_db=0 --threads=4
Reviewers: haobo, dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett
Reviewed By: haobo
CC: leveldb
Differential Revision: https://reviews.facebook.net/D18267
2014-04-24 22:43:57 +02:00
|
|
|
* Method: setWalTtlSeconds
|
2014-04-18 10:14:29 +02:00
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWalTtlSeconds(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong WAL_ttl_seconds) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->WAL_ttl_seconds =
|
|
|
|
static_cast<int64_t>(WAL_ttl_seconds);
|
|
|
|
}
|
|
|
|
|
[Java] Enable filluniquerandom, readseq, BloomFilter, and 70+ command-line options to DbBenchmark.java
Summary:
* Add filluniquerandom
* Add readseq, implemented using iterator.
* Realize most command-line-arguments from db_bench.cc (70+).
* Some code are commented out as some of the options in Options
not yet have Java bindings.
* Add default option to DbBenchmark.
* RocksDB will now take the ownership of all c++ raw-pointers from Options, which includes a c++ raw-pointer for Filter.
Test Plan: ./jdb_bench.sh --db=/tmp/rocksjava-bench/db --num_levels=6 --key_size=20 --prefix_size=20 --keys_per_prefix=0 --value_size=100 --block_size=4096 --cache_size=17179869184 --cache_numshardbits=6 --compression_ratio=1 --min_level_to_compress=-1 --disable_seek_compaction=1 --hard_rate_limit=2 --write_buffer_size=134217728 --max_write_buffer_number=2 --level0_file_num_compaction_trigger=8 --target_file_size_base=134217728 --max_bytes_for_level_base=1073741824 --disable_wal=0 --wal_dir=/tmp/rocksjava-bench/wal --sync=0 --disable_data_sync=1 --verify_checksum=1 --delete_obsolete_files_period_micros=314572800 --max_grandparent_overlap_factor=10 --max_background_compactions=4 --max_background_flushes=0 --level0_slowdown_writes_trigger=16 --level0_stop_writes_trigger=24 --statistics=0 --stats_per_interval=0 --stats_interval=1048576 --histogram=0 --use_plain_table=1 --open_files=-1 --mmap_read=1 --mmap_write=0 --memtablerep=prefix_hash --bloom_bits=10 --bloom_locality=1 --perf_level=0 --benchmarks=filluniquerandom,readseq,readrandom --use_existing_db=0 --threads=4
Reviewers: haobo, dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett
Reviewed By: haobo
CC: leveldb
Differential Revision: https://reviews.facebook.net/D18267
2014-04-24 22:43:57 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: walTtlSeconds
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_walSizeLimitMB(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
[Java] Enable filluniquerandom, readseq, BloomFilter, and 70+ command-line options to DbBenchmark.java
Summary:
* Add filluniquerandom
* Add readseq, implemented using iterator.
* Realize most command-line-arguments from db_bench.cc (70+).
* Some code are commented out as some of the options in Options
not yet have Java bindings.
* Add default option to DbBenchmark.
* RocksDB will now take the ownership of all c++ raw-pointers from Options, which includes a c++ raw-pointer for Filter.
Test Plan: ./jdb_bench.sh --db=/tmp/rocksjava-bench/db --num_levels=6 --key_size=20 --prefix_size=20 --keys_per_prefix=0 --value_size=100 --block_size=4096 --cache_size=17179869184 --cache_numshardbits=6 --compression_ratio=1 --min_level_to_compress=-1 --disable_seek_compaction=1 --hard_rate_limit=2 --write_buffer_size=134217728 --max_write_buffer_number=2 --level0_file_num_compaction_trigger=8 --target_file_size_base=134217728 --max_bytes_for_level_base=1073741824 --disable_wal=0 --wal_dir=/tmp/rocksjava-bench/wal --sync=0 --disable_data_sync=1 --verify_checksum=1 --delete_obsolete_files_period_micros=314572800 --max_grandparent_overlap_factor=10 --max_background_compactions=4 --max_background_flushes=0 --level0_slowdown_writes_trigger=16 --level0_stop_writes_trigger=24 --statistics=0 --stats_per_interval=0 --stats_interval=1048576 --histogram=0 --use_plain_table=1 --open_files=-1 --mmap_read=1 --mmap_write=0 --memtablerep=prefix_hash --bloom_bits=10 --bloom_locality=1 --perf_level=0 --benchmarks=filluniquerandom,readseq,readrandom --use_existing_db=0 --threads=4
Reviewers: haobo, dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett
Reviewed By: haobo
CC: leveldb
Differential Revision: https://reviews.facebook.net/D18267
2014-04-24 22:43:57 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->WAL_size_limit_MB;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWalSizeLimitMB
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWalSizeLimitMB(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong WAL_size_limit_MB) {
|
[Java] Enable filluniquerandom, readseq, BloomFilter, and 70+ command-line options to DbBenchmark.java
Summary:
* Add filluniquerandom
* Add readseq, implemented using iterator.
* Realize most command-line-arguments from db_bench.cc (70+).
* Some code are commented out as some of the options in Options
not yet have Java bindings.
* Add default option to DbBenchmark.
* RocksDB will now take the ownership of all c++ raw-pointers from Options, which includes a c++ raw-pointer for Filter.
Test Plan: ./jdb_bench.sh --db=/tmp/rocksjava-bench/db --num_levels=6 --key_size=20 --prefix_size=20 --keys_per_prefix=0 --value_size=100 --block_size=4096 --cache_size=17179869184 --cache_numshardbits=6 --compression_ratio=1 --min_level_to_compress=-1 --disable_seek_compaction=1 --hard_rate_limit=2 --write_buffer_size=134217728 --max_write_buffer_number=2 --level0_file_num_compaction_trigger=8 --target_file_size_base=134217728 --max_bytes_for_level_base=1073741824 --disable_wal=0 --wal_dir=/tmp/rocksjava-bench/wal --sync=0 --disable_data_sync=1 --verify_checksum=1 --delete_obsolete_files_period_micros=314572800 --max_grandparent_overlap_factor=10 --max_background_compactions=4 --max_background_flushes=0 --level0_slowdown_writes_trigger=16 --level0_stop_writes_trigger=24 --statistics=0 --stats_per_interval=0 --stats_interval=1048576 --histogram=0 --use_plain_table=1 --open_files=-1 --mmap_read=1 --mmap_write=0 --memtablerep=prefix_hash --bloom_bits=10 --bloom_locality=1 --perf_level=0 --benchmarks=filluniquerandom,readseq,readrandom --use_existing_db=0 --threads=4
Reviewers: haobo, dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett
Reviewed By: haobo
CC: leveldb
Differential Revision: https://reviews.facebook.net/D18267
2014-04-24 22:43:57 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->WAL_size_limit_MB =
|
|
|
|
static_cast<int64_t>(WAL_size_limit_MB);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: manifestPreallocationSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_manifestPreallocationSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->manifest_preallocation_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setManifestPreallocationSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setManifestPreallocationSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong preallocation_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(preallocation_size);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->manifest_preallocation_size =
|
|
|
|
preallocation_size;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
2014-04-22 00:40:46 +02:00
|
|
|
/*
|
|
|
|
* Method: setTableFactory
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setTableFactory(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jtable_factory_handle) {
|
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
auto* table_factory =
|
|
|
|
reinterpret_cast<rocksdb::TableFactory*>(jtable_factory_handle);
|
|
|
|
options->table_factory.reset(table_factory);
|
2014-04-22 00:40:46 +02:00
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: allowMmapReads
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_allowMmapReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->allow_mmap_reads;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAllowMmapReads
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setAllowMmapReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_reads) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->allow_mmap_reads =
|
|
|
|
static_cast<bool>(allow_mmap_reads);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: allowMmapWrites
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_allowMmapWrites(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->allow_mmap_writes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAllowMmapWrites
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setAllowMmapWrites(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_writes) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->allow_mmap_writes =
|
|
|
|
static_cast<bool>(allow_mmap_writes);
|
|
|
|
}
|
|
|
|
|
2016-12-22 21:51:29 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: useDirectReads
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_useDirectReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-12-22 21:51:29 +01:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->use_direct_reads;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setUseDirectReads
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setUseDirectReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) {
|
2016-12-22 21:51:29 +01:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->use_direct_reads =
|
|
|
|
static_cast<bool>(use_direct_reads);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-04-13 22:07:33 +02:00
|
|
|
* Method: useDirectIoForFlushAndCompaction
|
2016-12-22 21:51:29 +01:00
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2017-04-13 22:07:33 +02:00
|
|
|
jboolean Java_org_rocksdb_Options_useDirectIoForFlushAndCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-04-13 22:07:33 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->use_direct_io_for_flush_and_compaction;
|
2016-12-22 21:51:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-04-13 22:07:33 +02:00
|
|
|
* Method: setUseDirectIoForFlushAndCompaction
|
2016-12-22 21:51:29 +01:00
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2017-04-13 22:07:33 +02:00
|
|
|
void Java_org_rocksdb_Options_setUseDirectIoForFlushAndCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-04-13 22:07:33 +02:00
|
|
|
jboolean use_direct_io_for_flush_and_compaction) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->use_direct_io_for_flush_and_compaction =
|
|
|
|
static_cast<bool>(use_direct_io_for_flush_and_compaction);
|
2016-12-22 21:51:29 +01:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAllowFAllocate
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setAllowFAllocate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_fallocate) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->allow_fallocate =
|
|
|
|
static_cast<bool>(jallow_fallocate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: allowFAllocate
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_allowFAllocate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->allow_fallocate);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: isFdCloseOnExec
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_isFdCloseOnExec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->is_fd_close_on_exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setIsFdCloseOnExec
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setIsFdCloseOnExec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean is_fd_close_on_exec) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->is_fd_close_on_exec =
|
|
|
|
static_cast<bool>(is_fd_close_on_exec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: statsDumpPeriodSec
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_statsDumpPeriodSec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->stats_dump_period_sec;
|
2014-04-06 18:33:31 +02:00
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setStatsDumpPeriodSec
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setStatsDumpPeriodSec(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2019-12-12 20:58:26 +01:00
|
|
|
jint jstats_dump_period_sec) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->stats_dump_period_sec =
|
2019-12-12 20:58:26 +01:00
|
|
|
static_cast<unsigned int>(jstats_dump_period_sec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: statsPersistPeriodSec
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_Options_statsPersistPeriodSec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->stats_persist_period_sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setStatsPersistPeriodSec
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setStatsPersistPeriodSec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jstats_persist_period_sec) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->stats_persist_period_sec =
|
|
|
|
static_cast<unsigned int>(jstats_persist_period_sec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: statsHistoryBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_Options_statsHistoryBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->stats_history_buffer_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setStatsHistoryBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setStatsHistoryBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jstats_history_buffer_size) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->stats_history_buffer_size =
|
|
|
|
static_cast<size_t>(jstats_history_buffer_size);
|
2014-04-18 10:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: adviseRandomOnOpen
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_adviseRandomOnOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->advise_random_on_open;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAdviseRandomOnOpen
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setAdviseRandomOnOpen(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jboolean advise_random_on_open) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->advise_random_on_open =
|
|
|
|
static_cast<bool>(advise_random_on_open);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDbWriteBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setDbWriteBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jlong jdb_write_buffer_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->db_write_buffer_size = static_cast<size_t>(jdb_write_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: dbWriteBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_dbWriteBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->db_write_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAccessHintOnCompactionStart
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setAccessHintOnCompactionStart(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jbyte jaccess_hint_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->access_hint_on_compaction_start =
|
|
|
|
rocksdb::AccessHintJni::toCppAccessHint(jaccess_hint_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: accessHintOnCompactionStart
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_accessHintOnCompactionStart(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return rocksdb::AccessHintJni::toJavaAccessHint(
|
|
|
|
opt->access_hint_on_compaction_start);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setNewTableReaderForCompactionInputs
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setNewTableReaderForCompactionInputs(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jboolean jnew_table_reader_for_compaction_inputs) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->new_table_reader_for_compaction_inputs =
|
|
|
|
static_cast<bool>(jnew_table_reader_for_compaction_inputs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: newTableReaderForCompactionInputs
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_newTableReaderForCompactionInputs(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<bool>(opt->new_table_reader_for_compaction_inputs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionReadaheadSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompactionReadaheadSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jlong jcompaction_readahead_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->compaction_readahead_size =
|
|
|
|
static_cast<size_t>(jcompaction_readahead_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: compactionReadaheadSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_compactionReadaheadSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->compaction_readahead_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setRandomAccessMaxBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setRandomAccessMaxBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jrandom_access_max_buffer_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->random_access_max_buffer_size =
|
|
|
|
static_cast<size_t>(jrandom_access_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: randomAccessMaxBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->random_access_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWritableFileMaxBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setWritableFileMaxBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jlong jwritable_file_max_buffer_size) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->writable_file_max_buffer_size =
|
|
|
|
static_cast<size_t>(jwritable_file_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: writableFileMaxBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_writableFileMaxBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->writable_file_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
2014-04-18 10:14:29 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: useAdaptiveMutex
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_useAdaptiveMutex(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->use_adaptive_mutex;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setUseAdaptiveMutex
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setUseAdaptiveMutex(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean use_adaptive_mutex) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->use_adaptive_mutex =
|
|
|
|
static_cast<bool>(use_adaptive_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: bytesPerSync
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_bytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-18 10:14:29 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->bytes_per_sync;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setBytesPerSync
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) {
|
2014-04-18 10:14:29 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->bytes_per_sync =
|
|
|
|
static_cast<int64_t>(bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWalBytesPerSync
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWalBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jwal_bytes_per_sync) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->wal_bytes_per_sync =
|
|
|
|
static_cast<int64_t>(jwal_bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: walBytesPerSync
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_walBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->wal_bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:58:26 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setStrictBytesPerSync
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setStrictBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jstrict_bytes_per_sync) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->strict_bytes_per_sync =
|
|
|
|
jstrict_bytes_per_sync == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: strictBytesPerSync
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_strictBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->strict_bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setEnableThreadTracking
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setEnableThreadTracking(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jenable_thread_tracking) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->enable_thread_tracking = static_cast<bool>(jenable_thread_tracking);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: enableThreadTracking
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_enableThreadTracking(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->enable_thread_tracking);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDelayedWriteRate
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setDelayedWriteRate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jdelayed_write_rate) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->delayed_write_rate = static_cast<uint64_t>(jdelayed_write_rate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: delayedWriteRate
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_delayedWriteRate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->delayed_write_rate);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setEnablePipelinedWrite
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setEnablePipelinedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jenable_pipelined_write) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->enable_pipelined_write = jenable_pipelined_write == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: enablePipelinedWrite
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_enablePipelinedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->enable_pipelined_write);
|
|
|
|
}
|
|
|
|
|
2019-09-27 19:18:18 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setUnorderedWrite
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setUnorderedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean unordered_write) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->unordered_write = static_cast<bool>(unordered_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: unorderedWrite
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_unorderedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->unordered_write;
|
|
|
|
}
|
|
|
|
|
2016-06-14 17:52:25 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAllowConcurrentMemtableWrite
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setAllowConcurrentMemtableWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean allow) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->allow_concurrent_memtable_write = static_cast<bool>(allow);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: allowConcurrentMemtableWrite
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_allowConcurrentMemtableWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->allow_concurrent_memtable_write;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setEnableWriteThreadAdaptiveYield
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setEnableWriteThreadAdaptiveYield(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean yield) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->enable_write_thread_adaptive_yield = static_cast<bool>(yield);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: enableWriteThreadAdaptiveYield
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_enableWriteThreadAdaptiveYield(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->enable_write_thread_adaptive_yield;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWriteThreadMaxYieldUsec
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWriteThreadMaxYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->write_thread_max_yield_usec =
|
|
|
|
static_cast<int64_t>(max);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: writeThreadMaxYieldUsec
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_writeThreadMaxYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->write_thread_max_yield_usec;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWriteThreadSlowYieldUsec
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setWriteThreadSlowYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong slow) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->write_thread_slow_yield_usec =
|
|
|
|
static_cast<int64_t>(slow);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: writeThreadSlowYieldUsec
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_writeThreadSlowYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->write_thread_slow_yield_usec;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
2014-04-22 00:40:46 +02:00
|
|
|
/*
|
2017-03-30 21:04:09 +02:00
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setSkipStatsUpdateOnDbOpen
|
|
|
|
* Signature: (JZ)V
|
2014-04-22 00:40:46 +02:00
|
|
|
*/
|
2017-03-30 21:04:09 +02:00
|
|
|
void Java_org_rocksdb_Options_setSkipStatsUpdateOnDbOpen(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jboolean jskip_stats_update_on_db_open) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->skip_stats_update_on_db_open =
|
|
|
|
static_cast<bool>(jskip_stats_update_on_db_open);
|
2014-04-22 00:40:46 +02:00
|
|
|
}
|
|
|
|
|
2014-04-24 05:54:35 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: skipStatsUpdateOnDbOpen
|
|
|
|
* Signature: (J)Z
|
2014-04-24 05:54:35 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_skipStatsUpdateOnDbOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->skip_stats_update_on_db_open);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
Add an option to prevent DB::Open() from querying sizes of all sst files (#6353)
Summary:
When paranoid_checks is on, DBImpl::CheckConsistency() iterates over all sst files and calls Env::GetFileSize() for each of them. As far as I could understand, this is pretty arbitrary and doesn't affect correctness - if filesystem doesn't corrupt fsynced files, the file sizes will always match; if it does, it may as well corrupt contents as well as sizes, and rocksdb doesn't check contents on open.
If there are thousands of sst files, getting all their sizes takes a while. If, on top of that, Env is overridden to use some remote storage instead of local filesystem, it can be *really* slow and overload the remote storage service. This PR adds an option to not do GetFileSize(); instead it does GetChildren() for parent directory to check that all the expected sst files are at least present, but doesn't check their sizes.
We can't just disable paranoid_checks instead because paranoid_checks do a few other important things: make the DB read-only on write errors, print error messages on read errors, etc.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6353
Test Plan: ran the added sanity check unit test. Will try it out in a LogDevice test cluster where the GetFileSize() calls are causing a lot of trouble.
Differential Revision: D19656425
Pulled By: al13n321
fbshipit-source-id: c2c421b367633033760d1f56747bad206d1fbf82
2020-02-04 10:24:29 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setSkipCheckingSstFileSizesOnDbOpen
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setSkipCheckingSstFileSizesOnDbOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
|
|
|
jboolean jskip_checking_sst_file_sizes_on_db_open) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->skip_checking_sst_file_sizes_on_db_open =
|
|
|
|
static_cast<bool>(jskip_checking_sst_file_sizes_on_db_open);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: skipCheckingSstFileSizesOnDbOpen
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_skipCheckingSstFileSizesOnDbOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->skip_checking_sst_file_sizes_on_db_open);
|
|
|
|
}
|
|
|
|
|
2014-04-24 05:54:35 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setWalRecoveryMode
|
|
|
|
* Signature: (JB)V
|
2014-04-24 05:54:35 +02:00
|
|
|
*/
|
2017-03-30 21:04:09 +02:00
|
|
|
void Java_org_rocksdb_Options_setWalRecoveryMode(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jbyte jwal_recovery_mode_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->wal_recovery_mode = rocksdb::WALRecoveryModeJni::toCppWALRecoveryMode(
|
|
|
|
jwal_recovery_mode_value);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
2017-03-30 21:04:09 +02:00
|
|
|
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: walRecoveryMode
|
|
|
|
* Signature: (J)B
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_walRecoveryMode(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return rocksdb::WALRecoveryModeJni::toJavaWALRecoveryMode(
|
|
|
|
opt->wal_recovery_mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAllow2pc
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setAllow2pc(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_2pc) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->allow_2pc = static_cast<bool>(jallow_2pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: allow2pc
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_allow2pc(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->allow_2pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setRowCache
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setRowCache(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jrow_cache_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* row_cache =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::Cache>*>(jrow_cache_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->row_cache = *row_cache;
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setWalFilter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setWalFilter(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jwal_filter_handle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
auto* wal_filter =
|
|
|
|
reinterpret_cast<rocksdb::WalFilterJniCallback*>(jwal_filter_handle);
|
|
|
|
opt->wal_filter = wal_filter;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setFailIfOptionsFileError
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setFailIfOptionsFileError(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jfail_if_options_file_error) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->fail_if_options_file_error =
|
|
|
|
static_cast<bool>(jfail_if_options_file_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: failIfOptionsFileError
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_failIfOptionsFileError(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->fail_if_options_file_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDumpMallocStats
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setDumpMallocStats(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jdump_malloc_stats) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->dump_malloc_stats = static_cast<bool>(jdump_malloc_stats);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: dumpMallocStats
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_dumpMallocStats(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->dump_malloc_stats);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAvoidFlushDuringRecovery
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setAvoidFlushDuringRecovery(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_recovery) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->avoid_flush_during_recovery =
|
|
|
|
static_cast<bool>(javoid_flush_during_recovery);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: avoidFlushDuringRecovery
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_avoidFlushDuringRecovery(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->avoid_flush_during_recovery);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAvoidFlushDuringShutdown
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setAvoidFlushDuringShutdown(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_shutdown) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->avoid_flush_during_shutdown =
|
|
|
|
static_cast<bool>(javoid_flush_during_shutdown);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: avoidFlushDuringShutdown
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_avoidFlushDuringShutdown(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->avoid_flush_during_shutdown);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAllowIngestBehind
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setAllowIngestBehind(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_ingest_behind) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->allow_ingest_behind = jallow_ingest_behind == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: allowIngestBehind
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_allowIngestBehind(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->allow_ingest_behind);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setPreserveDeletes
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setPreserveDeletes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jpreserve_deletes) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->preserve_deletes = jpreserve_deletes == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: preserveDeletes
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_preserveDeletes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->preserve_deletes);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setTwoWriteQueues
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setTwoWriteQueues(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jtwo_write_queues) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->two_write_queues = jtwo_write_queues == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: twoWriteQueues
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_twoWriteQueues(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->two_write_queues);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setManualWalFlush
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setManualWalFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jmanual_wal_flush) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->manual_wal_flush = jmanual_wal_flush == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: manualWalFlush
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_manualWalFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->manual_wal_flush);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setAtomicFlush
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setAtomicFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jatomic_flush) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->atomic_flush = jatomic_flush == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: atomicFlush
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_atomicFlush(
|
|
|
|
JNIEnv *, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->atomic_flush);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Method: tableFactoryName
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_Options_tableFactoryName(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
rocksdb::TableFactory* tf = opt->table_factory.get();
|
|
|
|
|
|
|
|
// Should never be nullptr.
|
|
|
|
// Default memtable factory is SkipListFactory
|
|
|
|
assert(tf);
|
|
|
|
|
|
|
|
return env->NewStringUTF(tf->Name());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: minWriteBufferNumberToMerge
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_minWriteBufferNumberToMerge(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->min_write_buffer_number_to_merge;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMinWriteBufferNumberToMerge
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMinWriteBufferNumberToMerge(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmin_write_buffer_number_to_merge) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->min_write_buffer_number_to_merge =
|
|
|
|
static_cast<int>(jmin_write_buffer_number_to_merge);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxWriteBufferNumberToMaintain
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_maxWriteBufferNumberToMaintain(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_write_buffer_number_to_maintain;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxWriteBufferNumberToMaintain
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxWriteBufferNumberToMaintain(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
jint jmax_write_buffer_number_to_maintain) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_write_buffer_number_to_maintain =
|
|
|
|
static_cast<int>(jmax_write_buffer_number_to_maintain);
|
|
|
|
}
|
2014-04-24 05:54:35 +02:00
|
|
|
|
2014-07-07 18:58:54 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompressionType
|
2014-07-07 21:26:06 +02:00
|
|
|
* Signature: (JB)V
|
2014-07-07 18:58:54 +02:00
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompressionType(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opts->compression = rocksdb::CompressionTypeJni::toCppCompressionType(
|
|
|
|
jcompression_type_value);
|
2014-07-07 18:58:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: compressionType
|
2014-07-07 21:26:06 +02:00
|
|
|
* Signature: (J)B
|
2014-07-07 18:58:54 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_compressionType(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
return rocksdb::CompressionTypeJni::toJavaCompressionType(opts->compression);
|
2014-07-07 18:58:54 +02:00
|
|
|
}
|
|
|
|
|
2017-02-28 01:26:12 +01:00
|
|
|
/**
|
|
|
|
* Helper method to convert a Java byte array of compression levels
|
|
|
|
* to a C++ vector of rocksdb::CompressionType
|
|
|
|
*
|
|
|
|
* @param env A pointer to the Java environment
|
|
|
|
* @param jcompression_levels A reference to a java byte array
|
|
|
|
* where each byte indicates a compression level
|
|
|
|
*
|
2018-11-09 20:17:34 +01:00
|
|
|
* @return A std::unique_ptr to the vector, or std::unique_ptr(nullptr) if a JNI
|
|
|
|
* exception occurs
|
2017-02-28 01:26:12 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
std::unique_ptr<std::vector<rocksdb::CompressionType>>rocksdb_compression_vector_helper(
|
|
|
|
JNIEnv* env, jbyteArray jcompression_levels) {
|
2017-02-28 01:26:12 +01:00
|
|
|
jsize len = env->GetArrayLength(jcompression_levels);
|
|
|
|
jbyte* jcompression_level =
|
|
|
|
env->GetByteArrayElements(jcompression_levels, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (jcompression_level == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return std::unique_ptr<std::vector<rocksdb::CompressionType>>();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* compression_levels = new std::vector<rocksdb::CompressionType>();
|
2018-04-13 02:55:14 +02:00
|
|
|
std::unique_ptr<std::vector<rocksdb::CompressionType>>
|
|
|
|
uptr_compression_levels(compression_levels);
|
2016-02-10 15:21:23 +01:00
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
for (jsize i = 0; i < len; i++) {
|
2017-02-28 01:26:12 +01:00
|
|
|
jbyte jcl = jcompression_level[i];
|
|
|
|
compression_levels->push_back(static_cast<rocksdb::CompressionType>(jcl));
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
2017-02-28 01:26:12 +01:00
|
|
|
|
|
|
|
env->ReleaseByteArrayElements(jcompression_levels, jcompression_level,
|
2018-04-13 02:55:14 +02:00
|
|
|
JNI_ABORT);
|
2016-02-03 18:47:38 +01:00
|
|
|
|
2017-02-28 01:26:12 +01:00
|
|
|
return uptr_compression_levels;
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
|
|
|
|
2017-02-28 01:26:12 +01:00
|
|
|
/**
|
|
|
|
* Helper method to convert a C++ vector of rocksdb::CompressionType
|
|
|
|
* to a Java byte array of compression levels
|
|
|
|
*
|
|
|
|
* @param env A pointer to the Java environment
|
|
|
|
* @param jcompression_levels A reference to a java byte array
|
|
|
|
* where each byte indicates a compression level
|
|
|
|
*
|
|
|
|
* @return A jbytearray or nullptr if an exception occurs
|
2015-03-19 23:50:45 +01:00
|
|
|
*/
|
2018-04-13 02:55:14 +02:00
|
|
|
jbyteArray rocksdb_compression_list_helper(
|
|
|
|
JNIEnv* env, std::vector<rocksdb::CompressionType> compression_levels) {
|
2017-02-28 01:26:12 +01:00
|
|
|
const size_t len = compression_levels.size();
|
|
|
|
jbyte* jbuf = new jbyte[len];
|
|
|
|
|
|
|
|
for (size_t i = 0; i < len; i++) {
|
2018-04-13 02:55:14 +02:00
|
|
|
jbuf[i] = compression_levels[i];
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2016-02-03 18:47:38 +01:00
|
|
|
// insert in java array
|
2017-02-28 01:26:12 +01:00
|
|
|
jbyteArray jcompression_levels = env->NewByteArray(static_cast<jsize>(len));
|
2018-04-13 02:55:14 +02:00
|
|
|
if (jcompression_levels == nullptr) {
|
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
delete[] jbuf;
|
|
|
|
return nullptr;
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
|
|
|
env->SetByteArrayRegion(jcompression_levels, 0, static_cast<jsize>(len),
|
2018-04-13 02:55:14 +02:00
|
|
|
jbuf);
|
|
|
|
if (env->ExceptionCheck()) {
|
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
|
|
|
env->DeleteLocalRef(jcompression_levels);
|
|
|
|
delete[] jbuf;
|
|
|
|
return nullptr;
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
delete[] jbuf;
|
2017-02-28 01:26:12 +01:00
|
|
|
|
|
|
|
return jcompression_levels;
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompressionPerLevel
|
2016-02-03 18:47:38 +01:00
|
|
|
* Signature: (J[B)V
|
2015-03-19 23:50:45 +01:00
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompressionPerLevel(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jbyteArray jcompressionLevels) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto uptr_compression_levels =
|
2015-03-19 23:50:45 +01:00
|
|
|
rocksdb_compression_vector_helper(env, jcompressionLevels);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (!uptr_compression_levels) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception occurred
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
options->compression_per_level = *(uptr_compression_levels.get());
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: compressionPerLevel
|
2016-02-03 18:47:38 +01:00
|
|
|
* Signature: (J)[B
|
2015-03-19 23:50:45 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyteArray Java_org_rocksdb_Options_compressionPerLevel(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2015-03-19 23:50:45 +01:00
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
return rocksdb_compression_list_helper(env, options->compression_per_level);
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setBottommostCompressionType
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setBottommostCompressionType(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
options->bottommost_compression =
|
|
|
|
rocksdb::CompressionTypeJni::toCppCompressionType(
|
|
|
|
jcompression_type_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: bottommostCompressionType
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_bottommostCompressionType(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return rocksdb::CompressionTypeJni::toJavaCompressionType(
|
|
|
|
options->bottommost_compression);
|
|
|
|
}
|
|
|
|
|
2018-06-28 02:34:07 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setBottommostCompressionOptions
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setBottommostCompressionOptions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-06-28 02:34:07 +02:00
|
|
|
jlong jbottommost_compression_options_handle) {
|
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
auto* bottommost_compression_options =
|
|
|
|
reinterpret_cast<rocksdb::CompressionOptions*>(
|
|
|
|
jbottommost_compression_options_handle);
|
|
|
|
options->bottommost_compression_opts = *bottommost_compression_options;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompressionOptions
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompressionOptions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jcompression_options_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* compression_options = reinterpret_cast<rocksdb::CompressionOptions*>(
|
|
|
|
jcompression_options_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
options->compression_opts = *compression_options;
|
|
|
|
}
|
2015-03-19 23:50:45 +01:00
|
|
|
|
2014-07-24 00:44:25 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionStyle
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setCompactionStyle(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_style) {
|
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
options->compaction_style =
|
|
|
|
rocksdb::CompactionStyleJni::toCppCompactionStyle(
|
|
|
|
jcompaction_style);
|
2014-07-24 00:44:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: compactionStyle
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_compactionStyle(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* options = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return rocksdb::CompactionStyleJni::toJavaCompactionStyle(
|
|
|
|
options->compaction_style);
|
2014-07-24 00:44:25 +02:00
|
|
|
}
|
|
|
|
|
2015-06-20 10:23:22 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxTableFilesSizeFIFO
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxTableFilesSizeFIFO(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_table_files_size) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->compaction_options_fifo.max_table_files_size =
|
|
|
|
static_cast<uint64_t>(jmax_table_files_size);
|
2015-06-20 10:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxTableFilesSizeFIFO
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->compaction_options_fifo.max_table_files_size;
|
2015-06-20 10:23:22 +02:00
|
|
|
}
|
|
|
|
|
2014-04-24 05:54:35 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: numLevels
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_numLevels(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-24 05:54:35 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->num_levels;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setNumLevels
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setNumLevels(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jnum_levels) {
|
2014-04-24 05:54:35 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->num_levels =
|
|
|
|
static_cast<int>(jnum_levels);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: levelZeroFileNumCompactionTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_Options_levelZeroFileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevelZeroFileNumCompactionTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevelZeroFileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2014-04-24 05:54:35 +02:00
|
|
|
jint jlevel0_file_num_compaction_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger =
|
|
|
|
static_cast<int>(jlevel0_file_num_compaction_trigger);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: levelZeroSlowdownWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_levelZeroSlowdownWritesTrigger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_slowdown_writes_trigger;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevelSlowdownWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevelZeroSlowdownWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->level0_slowdown_writes_trigger =
|
|
|
|
static_cast<int>(jlevel0_slowdown_writes_trigger);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: levelZeroStopWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_levelZeroStopWritesTrigger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_stop_writes_trigger;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevelStopWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevelZeroStopWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) {
|
2014-04-24 05:54:35 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->level0_stop_writes_trigger =
|
|
|
|
static_cast<int>(jlevel0_stop_writes_trigger);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: targetFileSizeBase
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (J)J
|
2014-04-24 05:54:35 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_targetFileSizeBase(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-24 05:54:35 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->target_file_size_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setTargetFileSizeBase
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (JJ)V
|
2014-04-24 05:54:35 +02:00
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setTargetFileSizeBase(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jtarget_file_size_base) {
|
2014-04-24 05:54:35 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->target_file_size_base =
|
2014-10-28 22:38:08 +01:00
|
|
|
static_cast<uint64_t>(jtarget_file_size_base);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: targetFileSizeMultiplier
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_targetFileSizeMultiplier(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->target_file_size_multiplier;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setTargetFileSizeMultiplier
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setTargetFileSizeMultiplier(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jtarget_file_size_multiplier) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->target_file_size_multiplier =
|
|
|
|
static_cast<int>(jtarget_file_size_multiplier);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxBytesForLevelBase
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxBytesForLevelBase(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_bytes_for_level_base;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxBytesForLevelBase
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxBytesForLevelBase(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_bytes_for_level_base) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_bytes_for_level_base =
|
|
|
|
static_cast<int64_t>(jmax_bytes_for_level_base);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
2015-03-11 21:50:10 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: levelCompactionDynamicLevelBytes
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_Options_levelCompactionDynamicLevelBytes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level_compaction_dynamic_level_bytes;
|
2015-03-11 21:50:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevelCompactionDynamicLevelBytes
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevelCompactionDynamicLevelBytes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jenable_dynamic_level_bytes) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level_compaction_dynamic_level_bytes = (jenable_dynamic_level_bytes);
|
2015-03-11 21:50:10 +01:00
|
|
|
}
|
|
|
|
|
2014-04-24 05:54:35 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxBytesForLevelMultiplier
|
2016-11-02 05:05:32 +01:00
|
|
|
* Signature: (J)D
|
2014-04-24 05:54:35 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jdouble Java_org_rocksdb_Options_maxBytesForLevelMultiplier(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_bytes_for_level_multiplier;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxBytesForLevelMultiplier
|
2016-11-02 05:05:32 +01:00
|
|
|
* Signature: (JD)V
|
2014-04-24 05:54:35 +02:00
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplier(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jdouble jmax_bytes_for_level_multiplier) {
|
2016-11-02 05:05:32 +01:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_bytes_for_level_multiplier =
|
|
|
|
static_cast<double>(jmax_bytes_for_level_multiplier);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2016-06-17 01:02:52 +02:00
|
|
|
* Method: maxCompactionBytes
|
2014-04-24 05:54:35 +02:00
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxCompactionBytes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-06-17 01:02:52 +02:00
|
|
|
return static_cast<jlong>(
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_compaction_bytes);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2016-06-17 01:02:52 +02:00
|
|
|
* Method: setMaxCompactionBytes
|
2014-04-24 05:54:35 +02:00
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2016-06-17 01:02:52 +02:00
|
|
|
void Java_org_rocksdb_Options_setMaxCompactionBytes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_compaction_bytes) {
|
2016-06-17 01:02:52 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_compaction_bytes =
|
|
|
|
static_cast<uint64_t>(jmax_compaction_bytes);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: arenaBlockSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_arenaBlockSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-24 05:54:35 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->arena_block_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setArenaBlockSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setArenaBlockSize(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jarena_block_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jarena_block_size);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->arena_block_size =
|
|
|
|
jarena_block_size;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: disableAutoCompactions
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_disableAutoCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->disable_auto_compactions;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setDisableAutoCompactions
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setDisableAutoCompactions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jdisable_auto_compactions) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->disable_auto_compactions =
|
|
|
|
static_cast<bool>(jdisable_auto_compactions);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxSequentialSkipInIterations
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxSequentialSkipInIterations(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_sequential_skip_in_iterations;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxSequentialSkipInIterations
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxSequentialSkipInIterations(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2014-04-24 05:54:35 +02:00
|
|
|
jlong jmax_sequential_skip_in_iterations) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_sequential_skip_in_iterations =
|
|
|
|
static_cast<int64_t>(jmax_sequential_skip_in_iterations);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: inplaceUpdateSupport
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_inplaceUpdateSupport(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->inplace_update_support;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setInplaceUpdateSupport
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setInplaceUpdateSupport(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jinplace_update_support) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->inplace_update_support =
|
|
|
|
static_cast<bool>(jinplace_update_support);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: inplaceUpdateNumLocks
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_inplaceUpdateNumLocks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->inplace_update_num_locks;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setInplaceUpdateNumLocks
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setInplaceUpdateNumLocks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jinplace_update_num_locks) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jinplace_update_num_locks);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->inplace_update_num_locks =
|
|
|
|
jinplace_update_num_locks;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2016-06-04 02:02:10 +02:00
|
|
|
* Method: memtablePrefixBloomSizeRatio
|
2014-04-24 05:54:35 +02:00
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jdouble Java_org_rocksdb_Options_memtablePrefixBloomSizeRatio(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-06-04 02:02:10 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->memtable_prefix_bloom_size_ratio;
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2016-06-04 02:02:10 +02:00
|
|
|
* Method: setMemtablePrefixBloomSizeRatio
|
2014-04-24 05:54:35 +02:00
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2016-06-04 02:02:10 +02:00
|
|
|
void Java_org_rocksdb_Options_setMemtablePrefixBloomSizeRatio(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2016-06-04 02:02:10 +02:00
|
|
|
jdouble jmemtable_prefix_bloom_size_ratio) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->memtable_prefix_bloom_size_ratio =
|
|
|
|
static_cast<double>(jmemtable_prefix_bloom_size_ratio);
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: bloomLocality
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_bloomLocality(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-24 05:54:35 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->bloom_locality;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setBloomLocality
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setBloomLocality(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jbloom_locality) {
|
2014-04-24 05:54:35 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->bloom_locality =
|
|
|
|
static_cast<int32_t>(jbloom_locality);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxSuccessiveMerges
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_maxSuccessiveMerges(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-04-24 05:54:35 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->max_successive_merges;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxSuccessiveMerges
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxSuccessiveMerges(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jmax_successive_merges) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jmax_successive_merges);
|
2014-10-09 23:16:41 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->max_successive_merges =
|
|
|
|
jmax_successive_merges;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-09 23:16:41 +02:00
|
|
|
}
|
2014-04-24 05:54:35 +02:00
|
|
|
}
|
|
|
|
|
2015-02-28 22:38:58 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: optimizeFiltersForHits
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_optimizeFiltersForHits(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->optimize_filters_for_hits;
|
2015-02-28 22:38:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setOptimizeFiltersForHits
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setOptimizeFiltersForHits(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean joptimize_filters_for_hits) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->optimize_filters_for_hits =
|
|
|
|
static_cast<bool>(joptimize_filters_for_hits);
|
2015-02-28 22:38:58 +01:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
2017-03-30 21:04:09 +02:00
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: optimizeForSmallDb
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_optimizeForSmallDb(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->OptimizeForSmallDb();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2014-10-28 22:38:08 +01:00
|
|
|
* Method: optimizeForPointLookup
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_optimizeForPointLookup(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong block_cache_size_mb) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->OptimizeForPointLookup(
|
|
|
|
block_cache_size_mb);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2017-03-30 21:04:09 +02:00
|
|
|
* Class: org_rocksdb_Options
|
2014-10-28 22:38:08 +01:00
|
|
|
* Method: optimizeLevelStyleCompaction
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_optimizeLevelStyleCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->OptimizeLevelStyleCompaction(
|
|
|
|
memtable_memory_budget);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2014-09-16 22:58:49 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2014-10-28 22:38:08 +01:00
|
|
|
* Method: optimizeUniversalStyleCompaction
|
|
|
|
* Signature: (JJ)V
|
2014-09-16 22:58:49 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_Options_optimizeUniversalStyleCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->OptimizeUniversalStyleCompaction(memtable_memory_budget);
|
2014-09-16 22:58:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
2014-10-28 22:38:08 +01:00
|
|
|
* Method: prepareForBulkLoad
|
|
|
|
* Signature: (J)V
|
2014-09-16 22:58:49 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_prepareForBulkLoad(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->PrepareForBulkLoad();
|
2014-09-16 22:58:49 +02:00
|
|
|
}
|
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: memtableHugePageSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_memtableHugePageSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->memtable_huge_page_size;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMemtableHugePageSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMemtableHugePageSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jmemtable_huge_page_size) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jmemtable_huge_page_size);
|
2016-08-06 21:03:47 +02:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->memtable_huge_page_size =
|
|
|
|
jmemtable_huge_page_size;
|
2016-08-06 21:03:47 +02:00
|
|
|
} else {
|
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: softPendingCompactionBytesLimit
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_softPendingCompactionBytesLimit(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->soft_pending_compaction_bytes_limit;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setSoftPendingCompactionBytesLimit
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setSoftPendingCompactionBytesLimit(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jlong jsoft_pending_compaction_bytes_limit) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->soft_pending_compaction_bytes_limit =
|
|
|
|
static_cast<int64_t>(jsoft_pending_compaction_bytes_limit);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: softHardCompactionBytesLimit
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_Options_hardPendingCompactionBytesLimit(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->hard_pending_compaction_bytes_limit;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setHardPendingCompactionBytesLimit
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setHardPendingCompactionBytesLimit(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jlong jhard_pending_compaction_bytes_limit) {
|
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->hard_pending_compaction_bytes_limit =
|
|
|
|
static_cast<int64_t>(jhard_pending_compaction_bytes_limit);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: level0FileNumCompactionTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_level0FileNumCompactionTrigger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevel0FileNumCompactionTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevel0FileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2016-08-06 21:03:47 +02:00
|
|
|
jint jlevel0_file_num_compaction_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger =
|
|
|
|
static_cast<int32_t>(jlevel0_file_num_compaction_trigger);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: level0SlowdownWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_level0SlowdownWritesTrigger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_slowdown_writes_trigger;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevel0SlowdownWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevel0SlowdownWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->level0_slowdown_writes_trigger =
|
|
|
|
static_cast<int32_t>(jlevel0_slowdown_writes_trigger);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: level0StopWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_Options_level0StopWritesTrigger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->level0_stop_writes_trigger;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setLevel0StopWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setLevel0StopWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->level0_stop_writes_trigger =
|
|
|
|
static_cast<int32_t>(jlevel0_stop_writes_trigger);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: maxBytesForLevelMultiplierAdditional
|
|
|
|
* Signature: (J)[I
|
|
|
|
*/
|
|
|
|
jintArray Java_org_rocksdb_Options_maxBytesForLevelMultiplierAdditional(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
auto mbflma = reinterpret_cast<rocksdb::Options*>(jhandle)
|
|
|
|
->max_bytes_for_level_multiplier_additional;
|
2016-08-06 21:03:47 +02:00
|
|
|
|
|
|
|
const size_t size = mbflma.size();
|
|
|
|
|
2016-08-25 19:16:26 +02:00
|
|
|
jint* additionals = new jint[size];
|
2016-08-06 21:03:47 +02:00
|
|
|
for (size_t i = 0; i < size; i++) {
|
2016-11-01 17:55:29 +01:00
|
|
|
additionals[i] = static_cast<jint>(mbflma[i]);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jsize jlen = static_cast<jsize>(size);
|
|
|
|
jintArray result = env->NewIntArray(jlen);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (result == nullptr) {
|
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
delete[] additionals;
|
|
|
|
return nullptr;
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
env->SetIntArrayRegion(result, 0, jlen, additionals);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (env->ExceptionCheck()) {
|
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
|
|
|
env->DeleteLocalRef(result);
|
|
|
|
delete[] additionals;
|
|
|
|
return nullptr;
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
2016-08-25 19:16:26 +02:00
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
delete[] additionals;
|
2016-08-25 19:16:26 +02:00
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setMaxBytesForLevelMultiplierAdditional
|
|
|
|
* Signature: (J[I)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setMaxBytesForLevelMultiplierAdditional(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle,
|
2016-08-06 21:03:47 +02:00
|
|
|
jintArray jmax_bytes_for_level_multiplier_additional) {
|
|
|
|
jsize len = env->GetArrayLength(jmax_bytes_for_level_multiplier_additional);
|
2018-04-13 02:55:14 +02:00
|
|
|
jint* additionals = env->GetIntArrayElements(
|
|
|
|
jmax_bytes_for_level_multiplier_additional, nullptr);
|
|
|
|
if (additionals == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opt->max_bytes_for_level_multiplier_additional.clear();
|
|
|
|
for (jsize i = 0; i < len; i++) {
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->max_bytes_for_level_multiplier_additional.push_back(
|
|
|
|
static_cast<int32_t>(additionals[i]));
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
2017-02-28 01:26:12 +01:00
|
|
|
|
|
|
|
env->ReleaseIntArrayElements(jmax_bytes_for_level_multiplier_additional,
|
2018-04-13 02:55:14 +02:00
|
|
|
additionals, JNI_ABORT);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: paranoidFileChecks
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_paranoidFileChecks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::Options*>(jhandle)->paranoid_file_checks;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setParanoidFileChecks
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setParanoidFileChecks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jparanoid_file_checks) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::Options*>(jhandle)->paranoid_file_checks =
|
|
|
|
static_cast<bool>(jparanoid_file_checks);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionPriority
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompactionPriority(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_priority_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opts->compaction_pri =
|
2018-04-13 02:55:14 +02:00
|
|
|
rocksdb::CompactionPriorityJni::toCppCompactionPriority(
|
|
|
|
jcompaction_priority_value);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
2014-04-02 22:14:55 +02:00
|
|
|
|
|
|
|
/*
|
2017-03-30 21:04:09 +02:00
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: compactionPriority
|
|
|
|
* Signature: (J)B
|
2014-04-02 22:14:55 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_Options_compactionPriority(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return rocksdb::CompactionPriorityJni::toJavaCompactionPriority(
|
|
|
|
opts->compaction_pri);
|
2014-04-02 22:14:55 +02:00
|
|
|
}
|
|
|
|
|
2014-11-16 22:35:54 +01:00
|
|
|
/*
|
2017-03-30 21:04:09 +02:00
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setReportBgIoStats
|
|
|
|
* Signature: (JZ)V
|
2014-11-16 22:35:54 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_Options_setReportBgIoStats(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jreport_bg_io_stats) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opts->report_bg_io_stats = static_cast<bool>(jreport_bg_io_stats);
|
|
|
|
}
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: reportBgIoStats
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_reportBgIoStats(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<bool>(opts->report_bg_io_stats);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setTtl
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setTtl(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jttl) {
|
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opts->ttl = static_cast<uint64_t>(jttl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: ttl
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_Options_ttl(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<jlong>(opts->ttl);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionOptionsUniversal
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompactionOptionsUniversal(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jlong jcompaction_options_universal_handle) {
|
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* opts_uni = reinterpret_cast<rocksdb::CompactionOptionsUniversal*>(
|
|
|
|
jcompaction_options_universal_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opts->compaction_options_universal = *opts_uni;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setCompactionOptionsFIFO
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setCompactionOptionsFIFO(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jcompaction_options_fifo_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* opts_fifo = reinterpret_cast<rocksdb::CompactionOptionsFIFO*>(
|
|
|
|
jcompaction_options_fifo_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opts->compaction_options_fifo = *opts_fifo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: setForceConsistencyChecks
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_Options_setForceConsistencyChecks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jforce_consistency_checks) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
opts->force_consistency_checks = static_cast<bool>(jforce_consistency_checks);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Options
|
|
|
|
* Method: forceConsistencyChecks
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_Options_forceConsistencyChecks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opts = reinterpret_cast<rocksdb::Options*>(jhandle);
|
|
|
|
return static_cast<bool>(opts->force_consistency_checks);
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// rocksdb::ColumnFamilyOptions
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: newColumnFamilyOptions
|
|
|
|
* Signature: ()J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jclass) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* op = new rocksdb::ColumnFamilyOptions();
|
|
|
|
return reinterpret_cast<jlong>(op);
|
|
|
|
}
|
|
|
|
|
2018-02-02 19:46:41 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: copyColumnFamilyOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_copyColumnFamilyOptions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jclass, jlong jhandle) {
|
2018-02-02 19:46:41 +01:00
|
|
|
auto new_opt = new rocksdb::ColumnFamilyOptions(
|
|
|
|
*(reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)));
|
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: newColumnFamilyOptionsFromOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_newColumnFamilyOptionsFromOptions(
|
|
|
|
JNIEnv*, jclass, jlong joptions_handle) {
|
|
|
|
auto new_opt = new rocksdb::ColumnFamilyOptions(
|
|
|
|
*reinterpret_cast<rocksdb::Options*>(joptions_handle));
|
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: getColumnFamilyOptionsFromProps
|
|
|
|
* Signature: (Ljava/util/String;)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_getColumnFamilyOptionsFromProps(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jclass, jstring jopt_string) {
|
2017-03-30 21:04:09 +02:00
|
|
|
const char* opt_string = env->GetStringUTFChars(jopt_string, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (opt_string == nullptr) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* cf_options = new rocksdb::ColumnFamilyOptions();
|
2014-12-22 22:18:57 +01:00
|
|
|
rocksdb::Status status = rocksdb::GetColumnFamilyOptionsFromString(
|
2014-11-16 22:35:54 +01:00
|
|
|
rocksdb::ColumnFamilyOptions(), opt_string, cf_options);
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2014-11-16 22:35:54 +01:00
|
|
|
env->ReleaseStringUTFChars(jopt_string, opt_string);
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2014-11-16 22:35:54 +01:00
|
|
|
// Check if ColumnFamilyOptions creation was possible.
|
2017-02-28 01:26:12 +01:00
|
|
|
jlong ret_value = 0;
|
2014-12-22 22:18:57 +01:00
|
|
|
if (status.ok()) {
|
2014-11-16 22:35:54 +01:00
|
|
|
ret_value = reinterpret_cast<jlong>(cf_options);
|
|
|
|
} else {
|
|
|
|
// if operation failed the ColumnFamilyOptions need to be deleted
|
|
|
|
// again to prevent a memory leak.
|
|
|
|
delete cf_options;
|
|
|
|
}
|
|
|
|
return ret_value;
|
|
|
|
}
|
|
|
|
|
2014-04-02 22:14:55 +02:00
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
[Java] Generalize dis-own native handle and refine dispose framework.
Summary:
1. Move disOwnNativeHandle() function from RocksDB to RocksObject
to allow other RocksObject to use disOwnNativeHandle() when its
ownership of native handle has been transferred.
2. RocksObject now has an abstract implementation of dispose(),
which does the following two things. First, it checks whether
both isOwningNativeHandle() and isInitialized() return true.
If so, it will call the protected abstract function dispose0(),
which all the subclasses of RocksObject should implement. Second,
it sets nativeHandle_ = 0. This redesign ensure all subclasses
of RocksObject have the same dispose behavior.
3. All subclasses of RocksObject now should implement dispose0()
instead of dispose(), and dispose0() will be called only when
isInitialized() returns true.
Test Plan:
make rocksdbjava
make jtest
Reviewers: dhruba, sdong, ankgup87, rsumbaly, swapnilghike, zzbennett, haobo
Reviewed By: haobo
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D18801
2014-05-29 03:16:29 +02:00
|
|
|
* Method: disposeInternal
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (J)V
|
2014-04-02 22:14:55 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong handle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* cfo = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(handle);
|
|
|
|
assert(cfo != nullptr);
|
|
|
|
delete cfo;
|
2014-04-02 22:14:55 +02:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: optimizeForSmallDb
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_optimizeForSmallDb(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->OptimizeForSmallDb();
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
2014-04-02 22:14:55 +02:00
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: optimizeForPointLookup
|
|
|
|
* Signature: (JJ)V
|
2014-04-02 22:14:55 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_optimizeForPointLookup(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong block_cache_size_mb) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->OptimizeForPointLookup(block_cache_size_mb);
|
2014-04-02 22:14:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: optimizeLevelStyleCompaction
|
|
|
|
* Signature: (JJ)V
|
2014-04-02 22:14:55 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_optimizeLevelStyleCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->OptimizeLevelStyleCompaction(memtable_memory_budget);
|
2014-04-02 22:14:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: optimizeUniversalStyleCompaction
|
|
|
|
* Signature: (JJ)V
|
2014-04-02 22:14:55 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_optimizeUniversalStyleCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong memtable_memory_budget) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->OptimizeUniversalStyleCompaction(memtable_memory_budget);
|
2014-04-02 22:14:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setComparatorHandle
|
|
|
|
* Signature: (JI)V
|
2014-04-02 22:14:55 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JI(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint builtinComparator) {
|
2014-10-28 22:38:08 +01:00
|
|
|
switch (builtinComparator) {
|
|
|
|
case 1:
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->comparator =
|
|
|
|
rocksdb::ReverseBytewiseComparator();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->comparator =
|
|
|
|
rocksdb::BytewiseComparator();
|
|
|
|
break;
|
|
|
|
}
|
2014-04-02 22:14:55 +02:00
|
|
|
}
|
2014-04-22 00:52:59 +02:00
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setComparatorHandle
|
2018-03-08 20:16:46 +01:00
|
|
|
* Signature: (JJB)V
|
2017-10-12 20:06:51 +02:00
|
|
|
*/
|
2018-03-08 20:16:46 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setComparatorHandle__JJB(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jopt_handle, jlong jcomparator_handle,
|
|
|
|
jbyte jcomparator_type) {
|
2018-04-13 02:55:14 +02:00
|
|
|
rocksdb::Comparator* comparator = nullptr;
|
|
|
|
switch (jcomparator_type) {
|
|
|
|
// JAVA_COMPARATOR
|
|
|
|
case 0x0:
|
|
|
|
comparator =
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallback*>(jcomparator_handle);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// JAVA_NATIVE_COMPARATOR_WRAPPER
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
case 0x1:
|
2018-04-13 02:55:14 +02:00
|
|
|
comparator = reinterpret_cast<rocksdb::Comparator*>(jcomparator_handle);
|
|
|
|
break;
|
2017-10-12 20:06:51 +02:00
|
|
|
}
|
2018-03-08 20:16:46 +01:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jopt_handle);
|
|
|
|
opt->comparator = comparator;
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMergeOperatorName
|
|
|
|
* Signature: (JJjava/lang/String)V
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperatorName(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jstring jop_name) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
const char* op_name = env->GetStringUTFChars(jop_name, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (op_name == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
options->merge_operator =
|
|
|
|
rocksdb::MergeOperators::CreateFromStringId(op_name);
|
2014-11-15 12:37:51 +01:00
|
|
|
env->ReleaseStringUTFChars(jop_name, op_name);
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMergeOperator
|
|
|
|
* Signature: (JJjava/lang/String)V
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMergeOperator(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong mergeOperatorHandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->merge_operator =
|
2018-04-13 02:55:14 +02:00
|
|
|
*(reinterpret_cast<std::shared_ptr<rocksdb::MergeOperator>*>(
|
|
|
|
mergeOperatorHandle));
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
2015-07-14 18:44:51 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompactionFilterHandle
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2016-06-03 19:24:03 +02:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterHandle(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jopt_handle, jlong jcompactionfilter_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jopt_handle)
|
|
|
|
->compaction_filter =
|
|
|
|
reinterpret_cast<rocksdb::CompactionFilter*>(jcompactionfilter_handle);
|
2015-07-14 18:44:51 +02:00
|
|
|
}
|
|
|
|
|
2017-10-12 20:06:51 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompactionFilterFactoryHandle
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterFactoryHandle(
|
|
|
|
JNIEnv*, jobject, jlong jopt_handle,
|
2017-10-12 20:06:51 +02:00
|
|
|
jlong jcompactionfilterfactory_handle) {
|
|
|
|
auto* cff_factory =
|
2018-06-18 05:54:22 +02:00
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::CompactionFilterFactoryJniCallback>*>(
|
2017-10-12 20:06:51 +02:00
|
|
|
jcompactionfilterfactory_handle);
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jopt_handle)
|
|
|
|
->compaction_filter_factory = *cff_factory;
|
2017-10-12 20:06:51 +02:00
|
|
|
}
|
|
|
|
|
2014-04-22 00:52:59 +02:00
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setWriteBufferSize
|
|
|
|
* Signature: (JJ)I
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setWriteBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jwrite_buffer_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jwrite_buffer_size);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->write_buffer_size = jwrite_buffer_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: writeBufferSize
|
|
|
|
* Signature: (J)J
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_writeBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->write_buffer_size;
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxWriteBufferNumber
|
|
|
|
* Signature: (JI)V
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumber(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmax_write_buffer_number) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_write_buffer_number = jmax_write_buffer_number;
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxWriteBufferNumber
|
|
|
|
* Signature: (J)I
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumber(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_write_buffer_number;
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-10-28 22:38:08 +01:00
|
|
|
* Method: setMemTableFactory
|
|
|
|
* Signature: (JJ)V
|
2014-04-22 00:52:59 +02:00
|
|
|
*/
|
2014-10-28 22:38:08 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMemTableFactory(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->memtable_factory.reset(
|
|
|
|
reinterpret_cast<rocksdb::MemTableRepFactory*>(jfactory_handle));
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: memTableFactoryName
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
|
|
|
jstring Java_org_rocksdb_ColumnFamilyOptions_memTableFactoryName(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2014-10-28 22:38:08 +01:00
|
|
|
rocksdb::MemTableRepFactory* tf = opt->memtable_factory.get();
|
|
|
|
|
|
|
|
// Should never be nullptr.
|
|
|
|
// Default memtable factory is SkipListFactory
|
|
|
|
assert(tf);
|
|
|
|
|
|
|
|
// temporarly fix for the historical typo
|
|
|
|
if (strcmp(tf->Name(), "HashLinkListRepFactory") == 0) {
|
|
|
|
return env->NewStringUTF("HashLinkedListRepFactory");
|
|
|
|
}
|
|
|
|
|
|
|
|
return env->NewStringUTF(tf->Name());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Method: useFixedLengthPrefixExtractor
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_useFixedLengthPrefixExtractor(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jprefix_length) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->prefix_extractor.reset(
|
|
|
|
rocksdb::NewFixedPrefixTransform(static_cast<int>(jprefix_length)));
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2015-08-05 02:01:08 +02:00
|
|
|
/*
|
|
|
|
* Method: useCappedPrefixExtractor
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_useCappedPrefixExtractor(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jprefix_length) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->prefix_extractor.reset(
|
|
|
|
rocksdb::NewCappedPrefixTransform(static_cast<int>(jprefix_length)));
|
2015-08-05 02:01:08 +02:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Method: setTableFactory
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setTableFactory(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jfactory_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->table_factory.reset(
|
|
|
|
reinterpret_cast<rocksdb::TableFactory*>(jfactory_handle));
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Method: tableFactoryName
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_ColumnFamilyOptions_tableFactoryName(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2014-10-28 22:38:08 +01:00
|
|
|
rocksdb::TableFactory* tf = opt->table_factory.get();
|
|
|
|
|
|
|
|
// Should never be nullptr.
|
|
|
|
// Default memtable factory is SkipListFactory
|
|
|
|
assert(tf);
|
|
|
|
|
|
|
|
return env->NewStringUTF(tf->Name());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: minWriteBufferNumberToMerge
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_minWriteBufferNumberToMerge(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->min_write_buffer_number_to_merge;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMinWriteBufferNumberToMerge
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMinWriteBufferNumberToMerge(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmin_write_buffer_number_to_merge) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->min_write_buffer_number_to_merge =
|
|
|
|
static_cast<int>(jmin_write_buffer_number_to_merge);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxWriteBufferNumberToMaintain
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_maxWriteBufferNumberToMaintain(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_write_buffer_number_to_maintain;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxWriteBufferNumberToMaintain
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxWriteBufferNumberToMaintain(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
jint jmax_write_buffer_number_to_maintain) {
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_write_buffer_number_to_maintain =
|
|
|
|
static_cast<int>(jmax_write_buffer_number_to_maintain);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompressionType
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompressionType(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_opts->compression = rocksdb::CompressionTypeJni::toCppCompressionType(
|
|
|
|
jcompression_type_value);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: compressionType
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_ColumnFamilyOptions_compressionType(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return rocksdb::CompressionTypeJni::toJavaCompressionType(
|
|
|
|
cf_opts->compression);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2015-03-19 23:50:45 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompressionPerLevel
|
2016-02-03 18:47:38 +01:00
|
|
|
* Signature: (J[B)V
|
2015-03-19 23:50:45 +01:00
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompressionPerLevel(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jbyteArray jcompressionLevels) {
|
2015-03-19 23:50:45 +01:00
|
|
|
auto* options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2017-02-28 01:26:12 +01:00
|
|
|
auto uptr_compression_levels =
|
2015-03-19 23:50:45 +01:00
|
|
|
rocksdb_compression_vector_helper(env, jcompressionLevels);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (!uptr_compression_levels) {
|
|
|
|
// exception occurred
|
|
|
|
return;
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
|
|
|
options->compression_per_level = *(uptr_compression_levels.get());
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: compressionPerLevel
|
2016-02-03 18:47:38 +01:00
|
|
|
* Signature: (J)[B
|
2015-03-19 23:50:45 +01:00
|
|
|
*/
|
2016-02-03 18:47:38 +01:00
|
|
|
jbyteArray Java_org_rocksdb_ColumnFamilyOptions_compressionPerLevel(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2015-03-19 23:50:45 +01:00
|
|
|
return rocksdb_compression_list_helper(env,
|
2018-04-13 02:55:14 +02:00
|
|
|
cf_options->compression_per_level);
|
2015-03-19 23:50:45 +01:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setBottommostCompressionType
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setBottommostCompressionType(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompression_type_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_options->bottommost_compression =
|
|
|
|
rocksdb::CompressionTypeJni::toCppCompressionType(
|
|
|
|
jcompression_type_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: bottommostCompressionType
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
|
|
|
jbyte Java_org_rocksdb_ColumnFamilyOptions_bottommostCompressionType(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return rocksdb::CompressionTypeJni::toJavaCompressionType(
|
|
|
|
cf_options->bottommost_compression);
|
|
|
|
}
|
2018-06-28 02:34:07 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setBottommostCompressionOptions
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setBottommostCompressionOptions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-06-28 02:34:07 +02:00
|
|
|
jlong jbottommost_compression_options_handle) {
|
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
auto* bottommost_compression_options =
|
|
|
|
reinterpret_cast<rocksdb::CompressionOptions*>(
|
|
|
|
jbottommost_compression_options_handle);
|
|
|
|
cf_options->bottommost_compression_opts = *bottommost_compression_options;
|
|
|
|
}
|
2017-03-30 21:04:09 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompressionOptions
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompressionOptions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jcompression_options_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* compression_options = reinterpret_cast<rocksdb::CompressionOptions*>(
|
|
|
|
jcompression_options_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
cf_options->compression_opts = *compression_options;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompactionStyle
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompactionStyle(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_style) {
|
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_options->compaction_style =
|
|
|
|
rocksdb::CompactionStyleJni::toCppCompactionStyle(jcompaction_style);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: compactionStyle
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionStyle(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* cf_options = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return rocksdb::CompactionStyleJni::toJavaCompactionStyle(
|
|
|
|
cf_options->compaction_style);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2015-06-20 10:23:22 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxTableFilesSizeFIFO
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxTableFilesSizeFIFO(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_table_files_size) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->compaction_options_fifo.max_table_files_size =
|
|
|
|
static_cast<uint64_t>(jmax_table_files_size);
|
2015-06-20 10:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxTableFilesSizeFIFO
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_maxTableFilesSizeFIFO(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->compaction_options_fifo.max_table_files_size;
|
2015-06-20 10:23:22 +02:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: numLevels
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_numLevels(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->num_levels;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setNumLevels
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setNumLevels(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jnum_levels) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->num_levels =
|
|
|
|
static_cast<int>(jnum_levels);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: levelZeroFileNumCompactionTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroFileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevelZeroFileNumCompactionTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroFileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2014-10-28 22:38:08 +01:00
|
|
|
jint jlevel0_file_num_compaction_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger =
|
|
|
|
static_cast<int>(jlevel0_file_num_compaction_trigger);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: levelZeroSlowdownWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroSlowdownWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_slowdown_writes_trigger;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevelSlowdownWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroSlowdownWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_slowdown_writes_trigger =
|
|
|
|
static_cast<int>(jlevel0_slowdown_writes_trigger);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: levelZeroStopWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_levelZeroStopWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_stop_writes_trigger;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevelStopWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevelZeroStopWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_stop_writes_trigger =
|
|
|
|
static_cast<int>(jlevel0_stop_writes_trigger);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: targetFileSizeBase
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeBase(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->target_file_size_base;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setTargetFileSizeBase
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeBase(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jtarget_file_size_base) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->target_file_size_base = static_cast<uint64_t>(jtarget_file_size_base);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: targetFileSizeMultiplier
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_targetFileSizeMultiplier(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->target_file_size_multiplier;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setTargetFileSizeMultiplier
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setTargetFileSizeMultiplier(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jtarget_file_size_multiplier) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->target_file_size_multiplier =
|
|
|
|
static_cast<int>(jtarget_file_size_multiplier);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxBytesForLevelBase
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelBase(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_bytes_for_level_base;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxBytesForLevelBase
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelBase(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_bytes_for_level_base) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_bytes_for_level_base =
|
|
|
|
static_cast<int64_t>(jmax_bytes_for_level_base);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2015-03-11 21:50:10 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: levelCompactionDynamicLevelBytes
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_levelCompactionDynamicLevelBytes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level_compaction_dynamic_level_bytes;
|
2015-03-11 21:50:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevelCompactionDynamicLevelBytes
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevelCompactionDynamicLevelBytes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jenable_dynamic_level_bytes) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level_compaction_dynamic_level_bytes = (jenable_dynamic_level_bytes);
|
2015-03-11 21:50:10 +01:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxBytesForLevelMultiplier
|
2016-11-02 05:05:32 +01:00
|
|
|
* Signature: (J)D
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
2016-11-02 05:05:32 +01:00
|
|
|
jdouble Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplier(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_bytes_for_level_multiplier;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxBytesForLevelMultiplier
|
2016-11-02 05:05:32 +01:00
|
|
|
* Signature: (JD)V
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplier(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jdouble jmax_bytes_for_level_multiplier) {
|
2016-11-02 05:05:32 +01:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_bytes_for_level_multiplier =
|
|
|
|
static_cast<double>(jmax_bytes_for_level_multiplier);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
2016-06-17 01:02:52 +02:00
|
|
|
* Method: maxCompactionBytes
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_maxCompactionBytes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-06-17 01:02:52 +02:00
|
|
|
return static_cast<jlong>(
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_compaction_bytes);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
2016-06-17 01:02:52 +02:00
|
|
|
* Method: setMaxCompactionBytes
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2016-06-17 01:02:52 +02:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxCompactionBytes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_compaction_bytes) {
|
2016-06-17 01:02:52 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_compaction_bytes = static_cast<uint64_t>(jmax_compaction_bytes);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: arenaBlockSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_arenaBlockSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->arena_block_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setArenaBlockSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setArenaBlockSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jarena_block_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(jarena_block_size);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->arena_block_size =
|
|
|
|
jarena_block_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: disableAutoCompactions
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_disableAutoCompactions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->disable_auto_compactions;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setDisableAutoCompactions
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setDisableAutoCompactions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jdisable_auto_compactions) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->disable_auto_compactions = static_cast<bool>(jdisable_auto_compactions);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxSequentialSkipInIterations
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_maxSequentialSkipInIterations(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_sequential_skip_in_iterations;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxSequentialSkipInIterations
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxSequentialSkipInIterations(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2014-10-28 22:38:08 +01:00
|
|
|
jlong jmax_sequential_skip_in_iterations) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_sequential_skip_in_iterations =
|
|
|
|
static_cast<int64_t>(jmax_sequential_skip_in_iterations);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: inplaceUpdateSupport
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_inplaceUpdateSupport(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->inplace_update_support;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setInplaceUpdateSupport
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateSupport(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jinplace_update_support) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->inplace_update_support = static_cast<bool>(jinplace_update_support);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: inplaceUpdateNumLocks
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_inplaceUpdateNumLocks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->inplace_update_num_locks;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setInplaceUpdateNumLocks
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateNumLocks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jinplace_update_num_locks) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jinplace_update_num_locks);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->inplace_update_num_locks = jinplace_update_num_locks;
|
2014-10-28 22:38:08 +01:00
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
2016-06-04 02:02:10 +02:00
|
|
|
* Method: memtablePrefixBloomSizeRatio
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2016-06-04 02:02:10 +02:00
|
|
|
jdouble Java_org_rocksdb_ColumnFamilyOptions_memtablePrefixBloomSizeRatio(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-06-04 02:02:10 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->memtable_prefix_bloom_size_ratio;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
2016-06-04 02:02:10 +02:00
|
|
|
* Method: setMemtablePrefixBloomSizeRatio
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2016-06-04 02:02:10 +02:00
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMemtablePrefixBloomSizeRatio(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2016-06-04 02:02:10 +02:00
|
|
|
jdouble jmemtable_prefix_bloom_size_ratio) {
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->memtable_prefix_bloom_size_ratio =
|
|
|
|
static_cast<double>(jmemtable_prefix_bloom_size_ratio);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: bloomLocality
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_bloomLocality(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->bloom_locality;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setBloomLocality
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setBloomLocality(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jbloom_locality) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->bloom_locality =
|
|
|
|
static_cast<int32_t>(jbloom_locality);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxSuccessiveMerges
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_maxSuccessiveMerges(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_successive_merges;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxSuccessiveMerges
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxSuccessiveMerges(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jmax_successive_merges) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jmax_successive_merges);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_successive_merges = jmax_successive_merges;
|
2014-10-28 22:38:08 +01:00
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-28 22:38:58 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: optimizeFiltersForHits
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_optimizeFiltersForHits(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->optimize_filters_for_hits;
|
2015-02-28 22:38:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setOptimizeFiltersForHits
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setOptimizeFiltersForHits(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean joptimize_filters_for_hits) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->optimize_filters_for_hits =
|
|
|
|
static_cast<bool>(joptimize_filters_for_hits);
|
2015-02-28 22:38:58 +01:00
|
|
|
}
|
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: memtableHugePageSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_memtableHugePageSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->memtable_huge_page_size;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMemtableHugePageSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMemtableHugePageSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong jmemtable_huge_page_size) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(jmemtable_huge_page_size);
|
2016-08-06 21:03:47 +02:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->memtable_huge_page_size = jmemtable_huge_page_size;
|
2016-08-06 21:03:47 +02:00
|
|
|
} else {
|
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: softPendingCompactionBytesLimit
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_softPendingCompactionBytesLimit(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->soft_pending_compaction_bytes_limit;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setSoftPendingCompactionBytesLimit
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setSoftPendingCompactionBytesLimit(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jlong jsoft_pending_compaction_bytes_limit) {
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->soft_pending_compaction_bytes_limit =
|
|
|
|
static_cast<int64_t>(jsoft_pending_compaction_bytes_limit);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: softHardCompactionBytesLimit
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ColumnFamilyOptions_hardPendingCompactionBytesLimit(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->hard_pending_compaction_bytes_limit;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setHardPendingCompactionBytesLimit
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setHardPendingCompactionBytesLimit(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2018-04-13 02:55:14 +02:00
|
|
|
jlong jhard_pending_compaction_bytes_limit) {
|
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->hard_pending_compaction_bytes_limit =
|
|
|
|
static_cast<int64_t>(jhard_pending_compaction_bytes_limit);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: level0FileNumCompactionTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_level0FileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevel0FileNumCompactionTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevel0FileNumCompactionTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2016-08-06 21:03:47 +02:00
|
|
|
jint jlevel0_file_num_compaction_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_file_num_compaction_trigger =
|
|
|
|
static_cast<int32_t>(jlevel0_file_num_compaction_trigger);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: level0SlowdownWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_level0SlowdownWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_slowdown_writes_trigger;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevel0SlowdownWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevel0SlowdownWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_slowdown_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_slowdown_writes_trigger =
|
|
|
|
static_cast<int32_t>(jlevel0_slowdown_writes_trigger);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: level0StopWritesTrigger
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ColumnFamilyOptions_level0StopWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_stop_writes_trigger;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setLevel0StopWritesTrigger
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setLevel0StopWritesTrigger(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jlevel0_stop_writes_trigger) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->level0_stop_writes_trigger =
|
|
|
|
static_cast<int32_t>(jlevel0_stop_writes_trigger);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: maxBytesForLevelMultiplierAdditional
|
|
|
|
* Signature: (J)[I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jintArray Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplierAdditional(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
auto mbflma = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->max_bytes_for_level_multiplier_additional;
|
2016-08-06 21:03:47 +02:00
|
|
|
|
|
|
|
const size_t size = mbflma.size();
|
|
|
|
|
2016-08-25 19:16:26 +02:00
|
|
|
jint* additionals = new jint[size];
|
2016-08-06 21:03:47 +02:00
|
|
|
for (size_t i = 0; i < size; i++) {
|
2016-11-01 17:55:29 +01:00
|
|
|
additionals[i] = static_cast<jint>(mbflma[i]);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jsize jlen = static_cast<jsize>(size);
|
2017-02-28 01:26:12 +01:00
|
|
|
jintArray result = env->NewIntArray(jlen);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (result == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
2018-04-13 02:55:14 +02:00
|
|
|
delete[] additionals;
|
2017-02-28 01:26:12 +01:00
|
|
|
return nullptr;
|
|
|
|
}
|
2016-08-06 21:03:47 +02:00
|
|
|
env->SetIntArrayRegion(result, 0, jlen, additionals);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (env->ExceptionCheck()) {
|
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
|
|
|
env->DeleteLocalRef(result);
|
|
|
|
delete[] additionals;
|
|
|
|
return nullptr;
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
2016-08-25 19:16:26 +02:00
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
delete[] additionals;
|
2016-08-25 19:16:26 +02:00
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setMaxBytesForLevelMultiplierAdditional
|
|
|
|
* Signature: (J[I)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setMaxBytesForLevelMultiplierAdditional(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle,
|
2016-08-06 21:03:47 +02:00
|
|
|
jintArray jmax_bytes_for_level_multiplier_additional) {
|
|
|
|
jsize len = env->GetArrayLength(jmax_bytes_for_level_multiplier_additional);
|
2018-04-13 02:55:14 +02:00
|
|
|
jint* additionals =
|
2016-08-06 21:03:47 +02:00
|
|
|
env->GetIntArrayElements(jmax_bytes_for_level_multiplier_additional, 0);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (additionals == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-08-06 21:03:47 +02:00
|
|
|
auto* cf_opt = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_opt->max_bytes_for_level_multiplier_additional.clear();
|
|
|
|
for (jsize i = 0; i < len; i++) {
|
2018-04-13 02:55:14 +02:00
|
|
|
cf_opt->max_bytes_for_level_multiplier_additional.push_back(
|
|
|
|
static_cast<int32_t>(additionals[i]));
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
2017-02-28 01:26:12 +01:00
|
|
|
|
|
|
|
env->ReleaseIntArrayElements(jmax_bytes_for_level_multiplier_additional,
|
2018-04-13 02:55:14 +02:00
|
|
|
additionals, JNI_ABORT);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: paranoidFileChecks
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_paranoidFileChecks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->paranoid_file_checks;
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setParanoidFileChecks
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setParanoidFileChecks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jparanoid_file_checks) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)
|
|
|
|
->paranoid_file_checks = static_cast<bool>(jparanoid_file_checks);
|
2016-08-06 21:03:47 +02:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompactionPriority
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompactionPriority(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jcompaction_priority_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_opts->compaction_pri =
|
2018-04-13 02:55:14 +02:00
|
|
|
rocksdb::CompactionPriorityJni::toCppCompactionPriority(
|
|
|
|
jcompaction_priority_value);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: compactionPriority
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionPriority(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return rocksdb::CompactionPriorityJni::toJavaCompactionPriority(
|
|
|
|
cf_opts->compaction_pri);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setReportBgIoStats
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setReportBgIoStats(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jreport_bg_io_stats) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_opts->report_bg_io_stats = static_cast<bool>(jreport_bg_io_stats);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: reportBgIoStats
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_reportBgIoStats(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return static_cast<bool>(cf_opts->report_bg_io_stats);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setTtl
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setTtl(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jttl) {
|
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
cf_opts->ttl = static_cast<uint64_t>(jttl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: ttl
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
JNIEXPORT jlong JNICALL Java_org_rocksdb_ColumnFamilyOptions_ttl(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(cf_opts->ttl);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompactionOptionsUniversal
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompactionOptionsUniversal(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jlong jcompaction_options_universal_handle) {
|
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* opts_uni = reinterpret_cast<rocksdb::CompactionOptionsUniversal*>(
|
|
|
|
jcompaction_options_universal_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
cf_opts->compaction_options_universal = *opts_uni;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setCompactionOptionsFIFO
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setCompactionOptionsFIFO(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jcompaction_options_fifo_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* opts_fifo = reinterpret_cast<rocksdb::CompactionOptionsFIFO*>(
|
|
|
|
jcompaction_options_fifo_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
cf_opts->compaction_options_fifo = *opts_fifo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: setForceConsistencyChecks
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ColumnFamilyOptions_setForceConsistencyChecks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jforce_consistency_checks) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
cf_opts->force_consistency_checks =
|
|
|
|
static_cast<bool>(jforce_consistency_checks);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ColumnFamilyOptions
|
|
|
|
* Method: forceConsistencyChecks
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ColumnFamilyOptions_forceConsistencyChecks(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* cf_opts = reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle);
|
|
|
|
return static_cast<bool>(cf_opts->force_consistency_checks);
|
|
|
|
}
|
2016-08-06 21:03:47 +02:00
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// rocksdb::DBOptions
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: newDBOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: ()J
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_newDBOptions(
|
|
|
|
JNIEnv*, jclass) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* dbop = new rocksdb::DBOptions();
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(dbop);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2018-02-02 19:46:41 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: copyDBOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_copyDBOptions(
|
|
|
|
JNIEnv*, jclass, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
auto new_opt =
|
|
|
|
new rocksdb::DBOptions(*(reinterpret_cast<rocksdb::DBOptions*>(jhandle)));
|
2018-02-02 19:46:41 +01:00
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: newDBOptionsFromOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_DBOptions_newDBOptionsFromOptions(
|
|
|
|
JNIEnv*, jclass, jlong joptions_handle) {
|
|
|
|
auto new_opt =
|
|
|
|
new rocksdb::DBOptions(*reinterpret_cast<rocksdb::Options*>(joptions_handle));
|
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
|
|
|
}
|
|
|
|
|
2014-11-16 22:35:54 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: getDBOptionsFromProps
|
|
|
|
* Signature: (Ljava/util/String;)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_getDBOptionsFromProps(
|
|
|
|
JNIEnv* env, jclass, jstring jopt_string) {
|
2017-02-28 01:26:12 +01:00
|
|
|
const char* opt_string = env->GetStringUTFChars(jopt_string, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (opt_string == nullptr) {
|
2017-02-28 01:26:12 +01:00
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* db_options = new rocksdb::DBOptions();
|
2014-12-22 22:18:57 +01:00
|
|
|
rocksdb::Status status = rocksdb::GetDBOptionsFromString(
|
2014-11-16 22:35:54 +01:00
|
|
|
rocksdb::DBOptions(), opt_string, db_options);
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2014-11-16 22:35:54 +01:00
|
|
|
env->ReleaseStringUTFChars(jopt_string, opt_string);
|
2017-02-28 01:26:12 +01:00
|
|
|
|
2014-11-16 22:35:54 +01:00
|
|
|
// Check if DBOptions creation was possible.
|
2017-02-28 01:26:12 +01:00
|
|
|
jlong ret_value = 0;
|
2014-12-22 22:18:57 +01:00
|
|
|
if (status.ok()) {
|
2014-11-16 22:35:54 +01:00
|
|
|
ret_value = reinterpret_cast<jlong>(db_options);
|
|
|
|
} else {
|
|
|
|
// if operation failed the DBOptions need to be deleted
|
|
|
|
// again to prevent a memory leak.
|
|
|
|
delete db_options;
|
|
|
|
}
|
|
|
|
return ret_value;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong handle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* dbo = reinterpret_cast<rocksdb::DBOptions*>(handle);
|
|
|
|
assert(dbo != nullptr);
|
|
|
|
delete dbo;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: optimizeForSmallDb
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_optimizeForSmallDb(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->OptimizeForSmallDb();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setEnv
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setEnv(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jenv_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->env =
|
|
|
|
reinterpret_cast<rocksdb::Env*>(jenv_handle);
|
|
|
|
}
|
|
|
|
|
2014-12-05 14:41:39 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setIncreaseParallelism
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setIncreaseParallelism(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint totalThreads) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->IncreaseParallelism(
|
|
|
|
static_cast<int>(totalThreads));
|
2014-12-05 14:41:39 +01:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setCreateIfMissing
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setCreateIfMissing(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean flag) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->create_if_missing = flag;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: createIfMissing
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_createIfMissing(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->create_if_missing;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setCreateMissingColumnFamilies
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setCreateMissingColumnFamilies(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean flag) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->create_missing_column_families = flag;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: createMissingColumnFamilies
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_createMissingColumnFamilies(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->create_missing_column_families;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setErrorIfExists
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setErrorIfExists(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean error_if_exists) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->error_if_exists =
|
|
|
|
static_cast<bool>(error_if_exists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: errorIfExists
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_errorIfExists(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->error_if_exists;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setParanoidChecks
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setParanoidChecks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean paranoid_checks) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->paranoid_checks =
|
|
|
|
static_cast<bool>(paranoid_checks);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: paranoidChecks
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_paranoidChecks(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->paranoid_checks;
|
|
|
|
}
|
|
|
|
|
2016-10-07 21:32:21 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setRateLimiter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setRateLimiter(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jrate_limiter_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
std::shared_ptr<rocksdb::RateLimiter>* pRateLimiter =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::RateLimiter>*>(
|
2016-10-07 21:32:21 +02:00
|
|
|
jrate_limiter_handle);
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->rate_limiter = *pRateLimiter;
|
|
|
|
}
|
|
|
|
|
2018-04-07 06:22:37 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setSstFileManager
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setSstFileManager(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jsst_file_manager_handle) {
|
2018-04-07 06:22:37 +02:00
|
|
|
auto* sptr_sst_file_manager =
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::SstFileManager>*>(
|
|
|
|
jsst_file_manager_handle);
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->sst_file_manager =
|
|
|
|
*sptr_sst_file_manager;
|
2018-04-07 06:22:37 +02:00
|
|
|
}
|
|
|
|
|
2015-02-10 21:59:40 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setLogger
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setLogger(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jlogger_handle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
std::shared_ptr<rocksdb::LoggerJniCallback>* pLogger =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::LoggerJniCallback>*>(
|
2015-02-10 21:59:40 +01:00
|
|
|
jlogger_handle);
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->info_log = *pLogger;
|
|
|
|
}
|
|
|
|
|
2014-11-14 23:40:20 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setInfoLogLevel
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setInfoLogLevel(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jlog_level) {
|
2014-11-14 23:40:20 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->info_log_level =
|
2018-04-13 02:55:14 +02:00
|
|
|
static_cast<rocksdb::InfoLogLevel>(jlog_level);
|
2014-11-14 23:40:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: infoLogLevel
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_DBOptions_infoLogLevel(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-11-14 23:40:20 +01:00
|
|
|
return static_cast<jbyte>(
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->info_log_level);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxTotalWalSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setMaxTotalWalSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_total_wal_size) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_total_wal_size =
|
|
|
|
static_cast<jlong>(jmax_total_wal_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxTotalWalSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_maxTotalWalSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_total_wal_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxOpenFiles
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setMaxOpenFiles(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max_open_files) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_open_files =
|
|
|
|
static_cast<int>(max_open_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxOpenFiles
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_maxOpenFiles(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_open_files;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxFileOpeningThreads
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setMaxFileOpeningThreads(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmax_file_opening_threads) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_file_opening_threads =
|
|
|
|
static_cast<int>(jmax_file_opening_threads);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxFileOpeningThreads
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_maxFileOpeningThreads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<int>(opt->max_file_opening_threads);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2017-07-12 08:19:53 +02:00
|
|
|
* Method: setStatistics
|
|
|
|
* Signature: (JJ)V
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setStatistics(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jstatistics_handle) {
|
2017-07-12 08:19:53 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* pSptr = reinterpret_cast<std::shared_ptr<rocksdb::StatisticsJni>*>(
|
|
|
|
jstatistics_handle);
|
2017-07-12 08:19:53 +02:00
|
|
|
opt->statistics = *pSptr;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2017-07-12 08:19:53 +02:00
|
|
|
* Method: statistics
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_statistics(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-07-12 08:19:53 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
std::shared_ptr<rocksdb::Statistics> sptr = opt->statistics;
|
|
|
|
if (sptr == nullptr) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
std::shared_ptr<rocksdb::Statistics>* pSptr =
|
|
|
|
new std::shared_ptr<rocksdb::Statistics>(sptr);
|
|
|
|
return reinterpret_cast<jlong>(pSptr);
|
|
|
|
}
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setUseFsync
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setUseFsync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean use_fsync) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->use_fsync =
|
|
|
|
static_cast<bool>(use_fsync);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: useFsync
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_useFsync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->use_fsync;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setDbPaths
|
|
|
|
* Signature: (J[Ljava/lang/String;[J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setDbPaths(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths,
|
|
|
|
jlongArray jtarget_sizes) {
|
2017-03-30 21:04:09 +02:00
|
|
|
std::vector<rocksdb::DbPath> db_paths;
|
|
|
|
jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (ptr_jtarget_size == nullptr) {
|
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jboolean has_exception = JNI_FALSE;
|
|
|
|
const jsize len = env->GetArrayLength(jpaths);
|
2018-04-13 02:55:14 +02:00
|
|
|
for (jsize i = 0; i < len; i++) {
|
|
|
|
jobject jpath =
|
|
|
|
reinterpret_cast<jstring>(env->GetObjectArrayElement(jpaths, i));
|
|
|
|
if (env->ExceptionCheck()) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
2018-04-13 02:55:14 +02:00
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
2017-03-30 21:04:09 +02:00
|
|
|
return;
|
|
|
|
}
|
2017-10-12 20:06:51 +02:00
|
|
|
std::string path = rocksdb::JniUtil::copyStdString(
|
2017-03-30 21:04:09 +02:00
|
|
|
env, static_cast<jstring>(jpath), &has_exception);
|
|
|
|
env->DeleteLocalRef(jpath);
|
|
|
|
|
2018-04-13 02:55:14 +02:00
|
|
|
if (has_exception == JNI_TRUE) {
|
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
|
|
|
return;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
jlong jtarget_size = ptr_jtarget_size[i];
|
|
|
|
|
|
|
|
db_paths.push_back(
|
|
|
|
rocksdb::DbPath(path, static_cast<uint64_t>(jtarget_size)));
|
|
|
|
}
|
|
|
|
|
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
|
|
|
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->db_paths = db_paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: dbPathsLen
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_dbPathsLen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->db_paths.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: dbPaths
|
|
|
|
* Signature: (J[Ljava/lang/String;[J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_dbPaths(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jobjectArray jpaths,
|
|
|
|
jlongArray jtarget_sizes) {
|
2017-03-30 21:04:09 +02:00
|
|
|
jlong* ptr_jtarget_size = env->GetLongArrayElements(jtarget_sizes, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (ptr_jtarget_size == nullptr) {
|
|
|
|
// exception thrown: OutOfMemoryError
|
|
|
|
return;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
const jsize len = env->GetArrayLength(jpaths);
|
2018-04-13 02:55:14 +02:00
|
|
|
for (jsize i = 0; i < len; i++) {
|
2017-03-30 21:04:09 +02:00
|
|
|
rocksdb::DbPath db_path = opt->db_paths[i];
|
|
|
|
|
|
|
|
jstring jpath = env->NewStringUTF(db_path.path.c_str());
|
2018-04-13 02:55:14 +02:00
|
|
|
if (jpath == nullptr) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: OutOfMemoryError
|
2018-04-13 02:55:14 +02:00
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
2017-03-30 21:04:09 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
env->SetObjectArrayElement(jpaths, i, jpath);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (env->ExceptionCheck()) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: ArrayIndexOutOfBoundsException
|
|
|
|
env->DeleteLocalRef(jpath);
|
2018-04-13 02:55:14 +02:00
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_ABORT);
|
2017-03-30 21:04:09 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr_jtarget_size[i] = static_cast<jint>(db_path.target_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
env->ReleaseLongArrayElements(jtarget_sizes, ptr_jtarget_size, JNI_COMMIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setDbLogDir
|
|
|
|
* Signature: (JLjava/lang/String)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setDbLogDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jstring jdb_log_dir) {
|
2017-03-30 21:04:09 +02:00
|
|
|
const char* log_dir = env->GetStringUTFChars(jdb_log_dir, nullptr);
|
2018-04-13 02:55:14 +02:00
|
|
|
if (log_dir == nullptr) {
|
2017-03-30 21:04:09 +02:00
|
|
|
// exception thrown: OutOfMemoryError
|
2017-02-28 01:26:12 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->db_log_dir.assign(log_dir);
|
|
|
|
env->ReleaseStringUTFChars(jdb_log_dir, log_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: dbLogDir
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_DBOptions_dbLogDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return env->NewStringUTF(
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->db_log_dir.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWalDir
|
|
|
|
* Signature: (JLjava/lang/String)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWalDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jstring jwal_dir) {
|
2014-10-28 22:38:08 +01:00
|
|
|
const char* wal_dir = env->GetStringUTFChars(jwal_dir, 0);
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->wal_dir.assign(wal_dir);
|
|
|
|
env->ReleaseStringUTFChars(jwal_dir, wal_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: walDir
|
|
|
|
* Signature: (J)Ljava/lang/String
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jstring Java_org_rocksdb_DBOptions_walDir(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return env->NewStringUTF(
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->wal_dir.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setDeleteObsoleteFilesPeriodMicros
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setDeleteObsoleteFilesPeriodMicros(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong micros) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
2018-04-13 02:55:14 +02:00
|
|
|
->delete_obsolete_files_period_micros = static_cast<int64_t>(micros);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: deleteObsoleteFilesPeriodMicros
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_DBOptions_deleteObsoleteFilesPeriodMicros(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->delete_obsolete_files_period_micros;
|
|
|
|
}
|
|
|
|
|
2016-06-14 17:51:56 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setBaseBackgroundCompactions
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setBaseBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->base_background_compactions =
|
|
|
|
static_cast<int>(max);
|
2016-06-14 17:51:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: baseBackgroundCompactions
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_baseBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-06-14 17:51:56 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->base_background_compactions;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxBackgroundCompactions
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setMaxBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_background_compactions =
|
|
|
|
static_cast<int>(max);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxBackgroundCompactions
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_maxBackgroundCompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->max_background_compactions;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2016-06-14 17:51:56 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxSubcompactions
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setMaxSubcompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_subcompactions =
|
|
|
|
static_cast<int32_t>(max);
|
2016-06-14 17:51:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxSubcompactions
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_maxSubcompactions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_subcompactions;
|
2016-06-14 17:51:56 +02:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxBackgroundFlushes
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setMaxBackgroundFlushes(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max_background_flushes) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_background_flushes =
|
|
|
|
static_cast<int>(max_background_flushes);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxBackgroundFlushes
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_maxBackgroundFlushes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_background_flushes;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2017-09-20 19:23:51 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxBackgroundJobs
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setMaxBackgroundJobs(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint max_background_jobs) {
|
2017-09-20 19:23:51 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_background_jobs =
|
|
|
|
static_cast<int>(max_background_jobs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxBackgroundJobs
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_maxBackgroundJobs(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-09-20 19:23:51 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_background_jobs;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxLogFileSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setMaxLogFileSize(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong max_log_file_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(max_log_file_size);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_log_file_size =
|
|
|
|
max_log_file_size;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxLogFileSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_maxLogFileSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_log_file_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setLogFileTimeToRoll
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setLogFileTimeToRoll(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong log_file_time_to_roll) {
|
|
|
|
auto s =
|
|
|
|
rocksdb::JniUtil::check_if_jlong_fits_size_t(log_file_time_to_roll);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->log_file_time_to_roll =
|
|
|
|
log_file_time_to_roll;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: logFileTimeToRoll
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_logFileTimeToRoll(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->log_file_time_to_roll;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setKeepLogFileNum
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setKeepLogFileNum(
|
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong keep_log_file_num) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(keep_log_file_num);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->keep_log_file_num =
|
|
|
|
keep_log_file_num;
|
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: keepLogFileNum
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_keepLogFileNum(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->keep_log_file_num;
|
|
|
|
}
|
|
|
|
|
2015-10-08 03:06:28 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: setRecycleLogFileNum
|
2015-10-08 03:06:28 +02:00
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setRecycleLogFileNum(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong recycle_log_file_num) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(recycle_log_file_num);
|
2015-10-08 03:06:28 +02:00
|
|
|
if (s.ok()) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->recycle_log_file_num =
|
|
|
|
recycle_log_file_num;
|
|
|
|
} else {
|
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2017-03-30 21:04:09 +02:00
|
|
|
* Method: recycleLogFileNum
|
2015-10-08 03:06:28 +02:00
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_recycleLogFileNum(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2015-10-08 03:06:28 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->recycle_log_file_num;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setMaxManifestFileSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setMaxManifestFileSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong max_manifest_file_size) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_manifest_file_size =
|
|
|
|
static_cast<int64_t>(max_manifest_file_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: maxManifestFileSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_maxManifestFileSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_manifest_file_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setTableCacheNumshardbits
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setTableCacheNumshardbits(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint table_cache_numshardbits) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->table_cache_numshardbits =
|
|
|
|
static_cast<int>(table_cache_numshardbits);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: tableCacheNumshardbits
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_tableCacheNumshardbits(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->table_cache_numshardbits;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWalTtlSeconds
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWalTtlSeconds(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong WAL_ttl_seconds) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->WAL_ttl_seconds =
|
|
|
|
static_cast<int64_t>(WAL_ttl_seconds);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: walTtlSeconds
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_walTtlSeconds(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->WAL_ttl_seconds;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWalSizeLimitMB
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWalSizeLimitMB(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong WAL_size_limit_MB) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->WAL_size_limit_MB =
|
|
|
|
static_cast<int64_t>(WAL_size_limit_MB);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: walTtlSeconds
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_walSizeLimitMB(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->WAL_size_limit_MB;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setManifestPreallocationSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setManifestPreallocationSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv* env, jobject, jlong jhandle, jlong preallocation_size) {
|
|
|
|
auto s = rocksdb::JniUtil::check_if_jlong_fits_size_t(preallocation_size);
|
2014-10-28 22:38:08 +01:00
|
|
|
if (s.ok()) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->manifest_preallocation_size = preallocation_size;
|
2014-10-28 22:38:08 +01:00
|
|
|
} else {
|
2015-03-12 22:25:57 +01:00
|
|
|
rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: manifestPreallocationSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_manifestPreallocationSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->manifest_preallocation_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2016-12-22 21:51:29 +01:00
|
|
|
* Method: useDirectReads
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_useDirectReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-12-22 21:51:29 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->use_direct_reads;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setUseDirectReads
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setUseDirectReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean use_direct_reads) {
|
2016-12-22 21:51:29 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->use_direct_reads =
|
|
|
|
static_cast<bool>(use_direct_reads);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2017-04-13 22:07:33 +02:00
|
|
|
* Method: useDirectIoForFlushAndCompaction
|
2014-10-28 22:38:08 +01:00
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2017-04-13 22:07:33 +02:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_useDirectIoForFlushAndCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-04-13 22:07:33 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->use_direct_io_for_flush_and_compaction;
|
2016-12-22 21:51:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setUseDirectReads
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2017-04-13 22:07:33 +02:00
|
|
|
void Java_org_rocksdb_DBOptions_setUseDirectIoForFlushAndCompaction(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-04-13 22:07:33 +02:00
|
|
|
jboolean use_direct_io_for_flush_and_compaction) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->use_direct_io_for_flush_and_compaction =
|
|
|
|
static_cast<bool>(use_direct_io_for_flush_and_compaction);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAllowFAllocate
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setAllowFAllocate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_fallocate) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->allow_fallocate =
|
|
|
|
static_cast<bool>(jallow_fallocate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: allowFAllocate
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_allowFAllocate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->allow_fallocate);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAllowMmapReads
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setAllowMmapReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_reads) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->allow_mmap_reads =
|
|
|
|
static_cast<bool>(allow_mmap_reads);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: allowMmapReads
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_allowMmapReads(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->allow_mmap_reads;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAllowMmapWrites
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setAllowMmapWrites(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean allow_mmap_writes) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->allow_mmap_writes =
|
|
|
|
static_cast<bool>(allow_mmap_writes);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: allowMmapWrites
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_allowMmapWrites(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->allow_mmap_writes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setIsFdCloseOnExec
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setIsFdCloseOnExec(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean is_fd_close_on_exec) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->is_fd_close_on_exec =
|
|
|
|
static_cast<bool>(is_fd_close_on_exec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: isFdCloseOnExec
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_isFdCloseOnExec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->is_fd_close_on_exec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setStatsDumpPeriodSec
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setStatsDumpPeriodSec(
|
2019-12-12 20:58:26 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jstats_dump_period_sec) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->stats_dump_period_sec =
|
2019-12-12 20:58:26 +01:00
|
|
|
static_cast<unsigned int>(jstats_dump_period_sec);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: statsDumpPeriodSec
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jint Java_org_rocksdb_DBOptions_statsDumpPeriodSec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->stats_dump_period_sec;
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:58:26 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setStatsPersistPeriodSec
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setStatsPersistPeriodSec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jstats_persist_period_sec) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->stats_persist_period_sec =
|
|
|
|
static_cast<unsigned int>(jstats_persist_period_sec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: statsPersistPeriodSec
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_DBOptions_statsPersistPeriodSec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->stats_persist_period_sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setStatsHistoryBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setStatsHistoryBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jstats_history_buffer_size) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->stats_history_buffer_size =
|
|
|
|
static_cast<size_t>(jstats_history_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: statsHistoryBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_DBOptions_statsHistoryBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->stats_history_buffer_size;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAdviseRandomOnOpen
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAdviseRandomOnOpen(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean advise_random_on_open) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->advise_random_on_open =
|
|
|
|
static_cast<bool>(advise_random_on_open);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: adviseRandomOnOpen
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_adviseRandomOnOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->advise_random_on_open;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setDbWriteBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setDbWriteBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jdb_write_buffer_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->db_write_buffer_size = static_cast<size_t>(jdb_write_buffer_size);
|
|
|
|
}
|
|
|
|
|
2018-10-24 21:39:07 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWriteBufferManager
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWriteBufferManager(
|
|
|
|
JNIEnv*, jobject, jlong jdb_options_handle,
|
|
|
|
jlong jwrite_buffer_manager_handle) {
|
2018-10-24 21:39:07 +02:00
|
|
|
auto* write_buffer_manager =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::WriteBufferManager> *>(jwrite_buffer_manager_handle);
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jdb_options_handle)->write_buffer_manager =
|
|
|
|
*write_buffer_manager;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: dbWriteBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_dbWriteBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->db_write_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAccessHintOnCompactionStart
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAccessHintOnCompactionStart(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jaccess_hint_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->access_hint_on_compaction_start =
|
|
|
|
rocksdb::AccessHintJni::toCppAccessHint(jaccess_hint_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: accessHintOnCompactionStart
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_DBOptions_accessHintOnCompactionStart(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return rocksdb::AccessHintJni::toJavaAccessHint(
|
|
|
|
opt->access_hint_on_compaction_start);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setNewTableReaderForCompactionInputs
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setNewTableReaderForCompactionInputs(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jboolean jnew_table_reader_for_compaction_inputs) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->new_table_reader_for_compaction_inputs =
|
|
|
|
static_cast<bool>(jnew_table_reader_for_compaction_inputs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: newTableReaderForCompactionInputs
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_newTableReaderForCompactionInputs(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<bool>(opt->new_table_reader_for_compaction_inputs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setCompactionReadaheadSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setCompactionReadaheadSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jcompaction_readahead_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->compaction_readahead_size =
|
|
|
|
static_cast<size_t>(jcompaction_readahead_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: compactionReadaheadSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_compactionReadaheadSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->compaction_readahead_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setRandomAccessMaxBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setRandomAccessMaxBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jrandom_access_max_buffer_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->random_access_max_buffer_size =
|
|
|
|
static_cast<size_t>(jrandom_access_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: randomAccessMaxBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_randomAccessMaxBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->random_access_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWritableFileMaxBufferSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setWritableFileMaxBufferSize(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jwritable_file_max_buffer_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->writable_file_max_buffer_size =
|
|
|
|
static_cast<size_t>(jwritable_file_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: writableFileMaxBufferSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_writableFileMaxBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->writable_file_max_buffer_size);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setUseAdaptiveMutex
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setUseAdaptiveMutex(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean use_adaptive_mutex) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->use_adaptive_mutex =
|
|
|
|
static_cast<bool>(use_adaptive_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: useAdaptiveMutex
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_useAdaptiveMutex(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->use_adaptive_mutex;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setBytesPerSync
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong bytes_per_sync) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->bytes_per_sync =
|
|
|
|
static_cast<int64_t>(bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: bytesPerSync
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_bytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->bytes_per_sync;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWalBytesPerSync
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWalBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jwal_bytes_per_sync) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->wal_bytes_per_sync =
|
|
|
|
static_cast<int64_t>(jwal_bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: walBytesPerSync
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_walBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->wal_bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:58:26 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setStrictBytesPerSync
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setStrictBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jstrict_bytes_per_sync) {
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->strict_bytes_per_sync =
|
|
|
|
jstrict_bytes_per_sync == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: strictBytesPerSync
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_strictBytesPerSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return static_cast<jboolean>(
|
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->strict_bytes_per_sync);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2019-02-22 23:36:38 +01:00
|
|
|
* Method: setDelayedWriteRate
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setDelayedWriteRate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jdelayed_write_rate) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->delayed_write_rate = static_cast<uint64_t>(jdelayed_write_rate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: delayedWriteRate
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_DBOptions_delayedWriteRate(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->delayed_write_rate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setEnablePipelinedWrite
|
2017-03-30 21:04:09 +02:00
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setEnablePipelinedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jenable_pipelined_write) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2019-02-22 23:36:38 +01:00
|
|
|
opt->enable_pipelined_write = jenable_pipelined_write == JNI_TRUE;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2019-02-22 23:36:38 +01:00
|
|
|
* Method: enablePipelinedWrite
|
2017-03-30 21:04:09 +02:00
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_enablePipelinedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2019-02-22 23:36:38 +01:00
|
|
|
return static_cast<jboolean>(opt->enable_pipelined_write);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
2019-09-27 19:18:18 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setUnorderedWrite
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setUnorderedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean junordered_write) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->unordered_write = junordered_write == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: unorderedWrite
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_unorderedWrite(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->unordered_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2019-02-22 23:36:38 +01:00
|
|
|
* Method: setEnableThreadTracking
|
|
|
|
* Signature: (JZ)V
|
2017-03-30 21:04:09 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setEnableThreadTracking(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jenable_thread_tracking) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2019-02-22 23:36:38 +01:00
|
|
|
opt->enable_thread_tracking = jenable_thread_tracking == JNI_TRUE;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
2019-02-22 23:36:38 +01:00
|
|
|
* Method: enableThreadTracking
|
|
|
|
* Signature: (J)Z
|
2017-03-30 21:04:09 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_enableThreadTracking(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2019-02-22 23:36:38 +01:00
|
|
|
return static_cast<jboolean>(opt->enable_thread_tracking);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
2016-06-14 17:52:25 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAllowConcurrentMemtableWrite
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAllowConcurrentMemtableWrite(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean allow) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->allow_concurrent_memtable_write = static_cast<bool>(allow);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: allowConcurrentMemtableWrite
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_allowConcurrentMemtableWrite(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->allow_concurrent_memtable_write;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setEnableWriteThreadAdaptiveYield
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setEnableWriteThreadAdaptiveYield(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean yield) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->enable_write_thread_adaptive_yield = static_cast<bool>(yield);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: enableWriteThreadAdaptiveYield
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_enableWriteThreadAdaptiveYield(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->enable_write_thread_adaptive_yield;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWriteThreadMaxYieldUsec
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWriteThreadMaxYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong max) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->write_thread_max_yield_usec =
|
|
|
|
static_cast<int64_t>(max);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: writeThreadMaxYieldUsec
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_writeThreadMaxYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->write_thread_max_yield_usec;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWriteThreadSlowYieldUsec
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setWriteThreadSlowYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong slow) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->write_thread_slow_yield_usec =
|
|
|
|
static_cast<int64_t>(slow);
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: writeThreadSlowYieldUsec
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_DBOptions_writeThreadSlowYieldUsec(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)
|
|
|
|
->write_thread_slow_yield_usec;
|
2016-06-14 17:52:25 +02:00
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setSkipStatsUpdateOnDbOpen
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setSkipStatsUpdateOnDbOpen(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jskip_stats_update_on_db_open) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->skip_stats_update_on_db_open =
|
|
|
|
static_cast<bool>(jskip_stats_update_on_db_open);
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
2016-09-14 19:17:34 +02:00
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: skipStatsUpdateOnDbOpen
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_skipStatsUpdateOnDbOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->skip_stats_update_on_db_open);
|
|
|
|
}
|
|
|
|
|
Add an option to prevent DB::Open() from querying sizes of all sst files (#6353)
Summary:
When paranoid_checks is on, DBImpl::CheckConsistency() iterates over all sst files and calls Env::GetFileSize() for each of them. As far as I could understand, this is pretty arbitrary and doesn't affect correctness - if filesystem doesn't corrupt fsynced files, the file sizes will always match; if it does, it may as well corrupt contents as well as sizes, and rocksdb doesn't check contents on open.
If there are thousands of sst files, getting all their sizes takes a while. If, on top of that, Env is overridden to use some remote storage instead of local filesystem, it can be *really* slow and overload the remote storage service. This PR adds an option to not do GetFileSize(); instead it does GetChildren() for parent directory to check that all the expected sst files are at least present, but doesn't check their sizes.
We can't just disable paranoid_checks instead because paranoid_checks do a few other important things: make the DB read-only on write errors, print error messages on read errors, etc.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6353
Test Plan: ran the added sanity check unit test. Will try it out in a LogDevice test cluster where the GetFileSize() calls are causing a lot of trouble.
Differential Revision: D19656425
Pulled By: al13n321
fbshipit-source-id: c2c421b367633033760d1f56747bad206d1fbf82
2020-02-04 10:24:29 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setSkipCheckingSstFileSizesOnDbOpen
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setSkipCheckingSstFileSizesOnDbOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
|
|
|
jboolean jskip_checking_sst_file_sizes_on_db_open) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->skip_checking_sst_file_sizes_on_db_open =
|
|
|
|
static_cast<bool>(jskip_checking_sst_file_sizes_on_db_open);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: skipCheckingSstFileSizesOnDbOpen
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_skipCheckingSstFileSizesOnDbOpen(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->skip_checking_sst_file_sizes_on_db_open);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWalRecoveryMode
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setWalRecoveryMode(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jwal_recovery_mode_value) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->wal_recovery_mode = rocksdb::WALRecoveryModeJni::toCppWALRecoveryMode(
|
|
|
|
jwal_recovery_mode_value);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: walRecoveryMode
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_DBOptions_walRecoveryMode(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return rocksdb::WALRecoveryModeJni::toJavaWALRecoveryMode(
|
|
|
|
opt->wal_recovery_mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAllow2pc
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setAllow2pc(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_2pc) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->allow_2pc = static_cast<bool>(jallow_2pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: allow2pc
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_allow2pc(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->allow_2pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setRowCache
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_DBOptions_setRowCache(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jrow_cache_handle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
auto* row_cache =
|
|
|
|
reinterpret_cast<std::shared_ptr<rocksdb::Cache>*>(jrow_cache_handle);
|
2017-03-30 21:04:09 +02:00
|
|
|
opt->row_cache = *row_cache;
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setWalFilter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setWalFilter(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jwal_filter_handle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
auto* wal_filter =
|
|
|
|
reinterpret_cast<rocksdb::WalFilterJniCallback*>(jwal_filter_handle);
|
|
|
|
opt->wal_filter = wal_filter;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setFailIfOptionsFileError
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setFailIfOptionsFileError(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jfail_if_options_file_error) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->fail_if_options_file_error =
|
|
|
|
static_cast<bool>(jfail_if_options_file_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: failIfOptionsFileError
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_failIfOptionsFileError(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->fail_if_options_file_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setDumpMallocStats
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setDumpMallocStats(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jdump_malloc_stats) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->dump_malloc_stats = static_cast<bool>(jdump_malloc_stats);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: dumpMallocStats
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_dumpMallocStats(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->dump_malloc_stats);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAvoidFlushDuringRecovery
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAvoidFlushDuringRecovery(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_recovery) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->avoid_flush_during_recovery =
|
|
|
|
static_cast<bool>(javoid_flush_during_recovery);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: avoidFlushDuringRecovery
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringRecovery(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->avoid_flush_during_recovery);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAllowIngestBehind
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAllowIngestBehind(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_ingest_behind) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->allow_ingest_behind = jallow_ingest_behind == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: allowIngestBehind
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_allowIngestBehind(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->allow_ingest_behind);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setPreserveDeletes
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setPreserveDeletes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jpreserve_deletes) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->preserve_deletes = jpreserve_deletes == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: preserveDeletes
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_preserveDeletes(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->preserve_deletes);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setTwoWriteQueues
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setTwoWriteQueues(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jtwo_write_queues) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->two_write_queues = jtwo_write_queues == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: twoWriteQueues
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_twoWriteQueues(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->two_write_queues);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setManualWalFlush
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setManualWalFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jmanual_wal_flush) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->manual_wal_flush = jmanual_wal_flush == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: manualWalFlush
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_manualWalFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->manual_wal_flush);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAtomicFlush
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAtomicFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jatomic_flush) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
opt->atomic_flush = jatomic_flush == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: atomicFlush
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_DBOptions_atomicFlush(
|
|
|
|
JNIEnv *, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->atomic_flush);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: setAvoidFlushDuringShutdown
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_DBOptions_setAvoidFlushDuringShutdown(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean javoid_flush_during_shutdown) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
2018-04-13 02:55:14 +02:00
|
|
|
opt->avoid_flush_during_shutdown =
|
|
|
|
static_cast<bool>(javoid_flush_during_shutdown);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_DBOptions
|
|
|
|
* Method: avoidFlushDuringShutdown
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_DBOptions_avoidFlushDuringShutdown(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::DBOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->avoid_flush_during_shutdown);
|
2017-02-28 01:26:12 +01:00
|
|
|
}
|
2016-09-14 19:17:34 +02:00
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// rocksdb::WriteOptions
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: newWriteOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: ()J
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_WriteOptions_newWriteOptions(
|
|
|
|
JNIEnv*, jclass) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* op = new rocksdb::WriteOptions();
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(op);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2018-02-02 19:46:41 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: copyWriteOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_WriteOptions_copyWriteOptions(
|
|
|
|
JNIEnv*, jclass, jlong jhandle) {
|
2018-02-02 19:46:41 +01:00
|
|
|
auto new_opt = new rocksdb::WriteOptions(
|
|
|
|
*(reinterpret_cast<rocksdb::WriteOptions*>(jhandle)));
|
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_WriteOptions_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* write_options = reinterpret_cast<rocksdb::WriteOptions*>(jhandle);
|
|
|
|
assert(write_options != nullptr);
|
2014-10-28 22:38:08 +01:00
|
|
|
delete write_options;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: setSync
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_WriteOptions_setSync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jflag) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->sync = jflag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: sync
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_WriteOptions_sync(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->sync;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: setDisableWAL
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_WriteOptions_setDisableWAL(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jflag) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->disableWAL = jflag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: disableWAL
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_WriteOptions_disableWAL(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->disableWAL;
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: setIgnoreMissingColumnFamilies
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_WriteOptions_setIgnoreMissingColumnFamilies(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jboolean jignore_missing_column_families) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::WriteOptions*>(jhandle)
|
|
|
|
->ignore_missing_column_families =
|
|
|
|
static_cast<bool>(jignore_missing_column_families);
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: ignoreMissingColumnFamilies
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_WriteOptions_ignoreMissingColumnFamilies(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::WriteOptions*>(jhandle)
|
|
|
|
->ignore_missing_column_families;
|
2017-03-30 21:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: setNoSlowdown
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_WriteOptions_setNoSlowdown(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jno_slowdown) {
|
2017-03-30 21:04:09 +02:00
|
|
|
reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->no_slowdown =
|
|
|
|
static_cast<bool>(jno_slowdown);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: noSlowdown
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_WriteOptions_noSlowdown(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
return reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->no_slowdown;
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: setLowPri
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_WriteOptions_setLowPri(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jlow_pri) {
|
|
|
|
reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->low_pri =
|
|
|
|
static_cast<bool>(jlow_pri);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_WriteOptions
|
|
|
|
* Method: lowPri
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_WriteOptions_lowPri(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return reinterpret_cast<rocksdb::WriteOptions*>(jhandle)->low_pri;
|
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// rocksdb::ReadOptions
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: newReadOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: ()J
|
2014-10-28 22:38:08 +01:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ReadOptions_newReadOptions__(
|
|
|
|
JNIEnv*, jclass) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* read_options = new rocksdb::ReadOptions();
|
|
|
|
return reinterpret_cast<jlong>(read_options);
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: newReadOptions
|
|
|
|
* Signature: (ZZ)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ReadOptions_newReadOptions__ZZ(
|
|
|
|
JNIEnv*, jclass, jboolean jverify_checksums, jboolean jfill_cache) {
|
|
|
|
auto* read_options =
|
|
|
|
new rocksdb::ReadOptions(static_cast<bool>(jverify_checksums),
|
|
|
|
static_cast<bool>(jfill_cache));
|
|
|
|
return reinterpret_cast<jlong>(read_options);
|
|
|
|
}
|
|
|
|
|
2017-09-15 03:18:49 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: copyReadOptions
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ReadOptions_copyReadOptions(
|
|
|
|
JNIEnv*, jclass, jlong jhandle) {
|
2018-02-02 19:46:41 +01:00
|
|
|
auto new_opt = new rocksdb::ReadOptions(
|
|
|
|
*(reinterpret_cast<rocksdb::ReadOptions*>(jhandle)));
|
|
|
|
return reinterpret_cast<jlong>(new_opt);
|
2017-09-15 03:18:49 +02:00
|
|
|
}
|
|
|
|
|
2014-10-28 22:38:08 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* read_options = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
assert(read_options != nullptr);
|
|
|
|
delete read_options;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setVerifyChecksums
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setVerifyChecksums(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jverify_checksums) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->verify_checksums =
|
|
|
|
static_cast<bool>(jverify_checksums);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: verifyChecksums
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_verifyChecksums(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->verify_checksums;
|
2014-10-28 22:38:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setFillCache
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setFillCache(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jfill_cache) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->fill_cache =
|
|
|
|
static_cast<bool>(jfill_cache);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: fillCache
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_fillCache(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->fill_cache;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setTailing
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setTailing(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jtailing) {
|
2014-10-28 22:38:08 +01:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->tailing =
|
|
|
|
static_cast<bool>(jtailing);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: tailing
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_tailing(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2014-10-28 22:38:08 +01:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->tailing;
|
2014-04-22 00:52:59 +02:00
|
|
|
}
|
2014-08-15 14:34:10 +02:00
|
|
|
|
2016-07-29 21:12:03 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: managed
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_managed(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-07-29 21:12:03 +02:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->managed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setManaged
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setManaged(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jmanaged) {
|
2016-07-29 21:12:03 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->managed =
|
|
|
|
static_cast<bool>(jmanaged);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: totalOrderSeek
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_totalOrderSeek(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-07-29 21:12:03 +02:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->total_order_seek;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setTotalOrderSeek
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setTotalOrderSeek(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jtotal_order_seek) {
|
2016-07-29 21:12:03 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->total_order_seek =
|
|
|
|
static_cast<bool>(jtotal_order_seek);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: prefixSameAsStart
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_prefixSameAsStart(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-07-29 21:12:03 +02:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->prefix_same_as_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setPrefixSameAsStart
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setPrefixSameAsStart(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jprefix_same_as_start) {
|
2016-07-29 21:12:03 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->prefix_same_as_start =
|
|
|
|
static_cast<bool>(jprefix_same_as_start);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: pinData
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_pinData(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-07-29 21:12:03 +02:00
|
|
|
return reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->pin_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setPinData
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setPinData(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jpin_data) {
|
2016-07-29 21:12:03 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->pin_data =
|
|
|
|
static_cast<bool>(jpin_data);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: backgroundPurgeOnIteratorCleanup
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_ReadOptions_backgroundPurgeOnIteratorCleanup(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->background_purge_on_iterator_cleanup);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setBackgroundPurgeOnIteratorCleanup
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setBackgroundPurgeOnIteratorCleanup(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle,
|
2017-03-30 21:04:09 +02:00
|
|
|
jboolean jbackground_purge_on_iterator_cleanup) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
opt->background_purge_on_iterator_cleanup =
|
|
|
|
static_cast<bool>(jbackground_purge_on_iterator_cleanup);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: readaheadSize
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ReadOptions_readaheadSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->readahead_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setReadaheadSize
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setReadaheadSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jreadahead_size) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
opt->readahead_size = static_cast<size_t>(jreadahead_size);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: maxSkippableInternalKeys
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ReadOptions_maxSkippableInternalKeys(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->max_skippable_internal_keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setMaxSkippableInternalKeys
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setMaxSkippableInternalKeys(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jmax_skippable_internal_keys) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
opt->max_skippable_internal_keys =
|
|
|
|
static_cast<uint64_t>(jmax_skippable_internal_keys);
|
|
|
|
}
|
|
|
|
|
2017-03-30 21:04:09 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: ignoreRangeDeletions
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_ReadOptions_ignoreRangeDeletions(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(opt->ignore_range_deletions);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setIgnoreRangeDeletions
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setIgnoreRangeDeletions(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jignore_range_deletions) {
|
2017-03-30 21:04:09 +02:00
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
opt->ignore_range_deletions = static_cast<bool>(jignore_range_deletions);
|
|
|
|
}
|
|
|
|
|
2014-11-09 20:09:39 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setSnapshot
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setSnapshot(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jsnapshot) {
|
2014-11-09 20:09:39 +01:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->snapshot =
|
|
|
|
reinterpret_cast<rocksdb::Snapshot*>(jsnapshot);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: snapshot
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ReadOptions_snapshot(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
auto& snapshot = reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->snapshot;
|
2014-11-09 20:09:39 +01:00
|
|
|
return reinterpret_cast<jlong>(snapshot);
|
|
|
|
}
|
|
|
|
|
2016-07-29 21:12:03 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: readTier
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jbyte Java_org_rocksdb_ReadOptions_readTier(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2016-07-29 21:12:03 +02:00
|
|
|
return static_cast<jbyte>(
|
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->read_tier);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setReadTier
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ReadOptions_setReadTier(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jread_tier) {
|
2016-07-29 21:12:03 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->read_tier =
|
|
|
|
static_cast<rocksdb::ReadTier>(jread_tier);
|
|
|
|
}
|
|
|
|
|
2017-09-15 03:18:49 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setIterateUpperBound
|
|
|
|
* Signature: (JJ)I
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setIterateUpperBound(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jupper_bound_slice_handle) {
|
2017-09-15 03:18:49 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->iterate_upper_bound =
|
|
|
|
reinterpret_cast<rocksdb::Slice*>(jupper_bound_slice_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: iterateUpperBound
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ReadOptions_iterateUpperBound(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-09-15 03:18:49 +02:00
|
|
|
auto& upper_bound_slice_handle =
|
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->iterate_upper_bound;
|
|
|
|
return reinterpret_cast<jlong>(upper_bound_slice_handle);
|
|
|
|
}
|
|
|
|
|
2018-10-10 02:11:53 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setIterateLowerBound
|
|
|
|
* Signature: (JJ)I
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setIterateLowerBound(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jlower_bound_slice_handle) {
|
2018-10-10 02:11:53 +02:00
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->iterate_lower_bound =
|
|
|
|
reinterpret_cast<rocksdb::Slice*>(jlower_bound_slice_handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: iterateLowerBound
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ReadOptions_iterateLowerBound(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-10-10 02:11:53 +02:00
|
|
|
auto& lower_bound_slice_handle =
|
|
|
|
reinterpret_cast<rocksdb::ReadOptions*>(jhandle)->iterate_lower_bound;
|
|
|
|
return reinterpret_cast<jlong>(lower_bound_slice_handle);
|
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setTableFilter
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setTableFilter(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jjni_table_filter_handle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
auto* jni_table_filter =
|
|
|
|
reinterpret_cast<rocksdb::TableFilterJniCallback*>(jjni_table_filter_handle);
|
|
|
|
opt->table_filter = jni_table_filter->GetTableFilterFunction();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: setIterStartSeqnum
|
|
|
|
* Signature: (JJ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ReadOptions_setIterStartSeqnum(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jlong jiter_start_seqnum) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
opt->iter_start_seqnum = static_cast<uint64_t>(jiter_start_seqnum);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ReadOptions
|
|
|
|
* Method: iterStartSeqnum
|
|
|
|
* Signature: (J)J
|
|
|
|
*/
|
|
|
|
jlong Java_org_rocksdb_ReadOptions_iterStartSeqnum(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* opt = reinterpret_cast<rocksdb::ReadOptions*>(jhandle);
|
|
|
|
return static_cast<jlong>(opt->iter_start_seqnum);
|
|
|
|
}
|
|
|
|
|
2014-11-09 20:09:39 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// rocksdb::ComparatorOptions
|
|
|
|
|
2014-08-15 14:34:10 +02:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
|
|
|
* Method: newComparatorOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: ()J
|
2014-08-15 14:34:10 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_ComparatorOptions_newComparatorOptions(
|
|
|
|
JNIEnv*, jclass) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* comparator_opt = new rocksdb::ComparatorJniCallbackOptions();
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(comparator_opt);
|
2014-08-15 14:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
* Method: reusedSynchronisationType
|
|
|
|
* Signature: (J)B
|
|
|
|
*/
|
|
|
|
jbyte Java_org_rocksdb_ComparatorOptions_reusedSynchronisationType(
|
|
|
|
JNIEnv *, jobject, jlong jhandle) {
|
|
|
|
auto* comparator_opt =
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle);
|
|
|
|
return rocksdb::ReusedSynchronisationTypeJni::toJavaReusedSynchronisationType(
|
|
|
|
comparator_opt->reused_synchronisation_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
|
|
|
* Method: setReusedSynchronisationType
|
|
|
|
* Signature: (JB)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ComparatorOptions_setReusedSynchronisationType(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jbyte jreused_synhcronisation_type) {
|
|
|
|
auto* comparator_opt =
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle);
|
|
|
|
comparator_opt->reused_synchronisation_type =
|
|
|
|
rocksdb::ReusedSynchronisationTypeJni::toCppReusedSynchronisationType(jreused_synhcronisation_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
|
|
|
* Method: useDirectBuffer
|
2014-08-15 14:34:10 +02:00
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
jboolean Java_org_rocksdb_ComparatorOptions_useDirectBuffer(
|
2019-02-22 23:36:38 +01:00
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
return static_cast<jboolean>(
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle)
|
|
|
|
->direct_buffer);
|
2014-08-15 14:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
* Method: setUseDirectBuffer
|
2014-08-15 14:34:10 +02:00
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
void Java_org_rocksdb_ComparatorOptions_setUseDirectBuffer(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jdirect_buffer) {
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle)
|
|
|
|
->direct_buffer = jdirect_buffer == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
|
|
|
* Method: maxReusedBufferSize
|
|
|
|
* Signature: (J)I
|
|
|
|
*/
|
|
|
|
jint Java_org_rocksdb_ComparatorOptions_maxReusedBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
return static_cast<jint>(
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle)
|
|
|
|
->max_reused_buffer_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
|
|
|
* Method: setMaxReusedBufferSize
|
|
|
|
* Signature: (JI)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_ComparatorOptions_setMaxReusedBufferSize(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jint jmax_reused_buffer_size) {
|
2014-08-21 22:55:51 +02:00
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle)
|
Improve RocksJava Comparator (#6252)
Summary:
This is a redesign of the API for RocksJava comparators with the aim of improving performance. It also simplifies the class hierarchy.
**NOTE**: This breaks backwards compatibility for existing 3rd party Comparators implemented in Java... so we need to consider carefully which release branches this goes into.
Previously when implementing a comparator in Java the developer had a choice of subclassing either `DirectComparator` or `Comparator` which would use direct and non-direct byte-buffers resepectively (via `DirectSlice` and `Slice`).
In this redesign there we have eliminated the overhead of using the Java Slice classes, and just use `ByteBuffer`s. The `ComparatorOptions` supplied when constructing a Comparator allow you to choose between direct and non-direct byte buffers by setting `useDirect`.
In addition, the `ComparatorOptions` now allow you to choose whether a ByteBuffer is reused over multiple comparator calls, by setting `maxReusedBufferSize > 0`. When buffers are reused, ComparatorOptions provides a choice of mutex type by setting `useAdaptiveMutex`.
---
[JMH benchmarks previously indicated](https://github.com/facebook/rocksdb/pull/6241#issue-356398306) that the difference between C++ and Java for implementing a comparator was ~7x slowdown in Java.
With these changes, when reusing buffers and guarding access to them via mutexes the slowdown is approximately the same. However, these changes offer a new facility to not reuse mutextes, which reduces the slowdown to ~5.5x in Java. We also offer a `thread_local` mechanism for reusing buffers, which reduces slowdown to ~5.2x in Java (closes https://github.com/facebook/rocksdb/pull/4425).
These changes also form a good base for further optimisation work such as further JNI lookup caching, and JNI critical.
---
These numbers were captured without jemalloc. With jemalloc, the performance improves for all tests, and the Java slowdown reduces to between 4.8x and 5.x.
```
ComparatorBenchmarks.put native_bytewise thrpt 25 124483.795 ± 2032.443 ops/s
ComparatorBenchmarks.put native_reverse_bytewise thrpt 25 114414.536 ± 3486.156 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 17228.250 ± 1288.546 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 16035.865 ± 1248.099 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_reused-64_thread-local thrpt 25 21571.500 ± 871.521 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_adaptive-mutex thrpt 25 23613.773 ± 8465.660 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 16768.172 ± 5618.489 ops/s
ComparatorBenchmarks.put java_bytewise_direct_reused-64_thread-local thrpt 25 23921.164 ± 8734.742 ops/s
ComparatorBenchmarks.put java_bytewise_non-direct_no-reuse thrpt 25 17899.684 ± 839.679 ops/s
ComparatorBenchmarks.put java_bytewise_direct_no-reuse thrpt 25 22148.316 ± 1215.527 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_adaptive-mutex thrpt 25 11311.126 ± 820.602 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_non-adaptive-mutex thrpt 25 11421.311 ± 807.210 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_reused-64_thread-local thrpt 25 11554.005 ± 960.556 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_adaptive-mutex thrpt 25 22960.523 ± 1673.421 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_non-adaptive-mutex thrpt 25 18293.317 ± 1434.601 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_reused-64_thread-local thrpt 25 24479.361 ± 2157.306 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_non-direct_no-reuse thrpt 25 7942.286 ± 626.170 ops/s
ComparatorBenchmarks.put java_reverse_bytewise_direct_no-reuse thrpt 25 11781.955 ± 1019.843 ops/s
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6252
Differential Revision: D19331064
Pulled By: pdillinger
fbshipit-source-id: 1f3b794e6a14162b2c3ffb943e8c0e64a0c03738
2020-02-03 21:28:25 +01:00
|
|
|
->max_reused_buffer_size
|
|
|
|
= static_cast<int32_t>(jmax_reused_buffer_size);
|
2014-08-15 14:34:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_ComparatorOptions
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_ComparatorOptions_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* comparator_opt =
|
|
|
|
reinterpret_cast<rocksdb::ComparatorJniCallbackOptions*>(jhandle);
|
|
|
|
assert(comparator_opt != nullptr);
|
|
|
|
delete comparator_opt;
|
2014-08-15 14:34:10 +02:00
|
|
|
}
|
2014-10-13 20:48:44 +02:00
|
|
|
|
2014-11-09 20:09:39 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// rocksdb::FlushOptions
|
|
|
|
|
2014-10-13 20:48:44 +02:00
|
|
|
/*
|
2014-11-09 20:09:39 +01:00
|
|
|
* Class: org_rocksdb_FlushOptions
|
|
|
|
* Method: newFlushOptions
|
2016-01-20 18:05:41 +01:00
|
|
|
* Signature: ()J
|
2014-10-13 20:48:44 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jlong Java_org_rocksdb_FlushOptions_newFlushOptions(
|
|
|
|
JNIEnv*, jclass) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* flush_opt = new rocksdb::FlushOptions();
|
2016-01-20 18:05:41 +01:00
|
|
|
return reinterpret_cast<jlong>(flush_opt);
|
2014-10-13 20:48:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-11-09 20:09:39 +01:00
|
|
|
* Class: org_rocksdb_FlushOptions
|
|
|
|
* Method: setWaitForFlush
|
|
|
|
* Signature: (JZ)V
|
2014-10-13 20:48:44 +02:00
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_FlushOptions_setWaitForFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jwait) {
|
2018-04-13 02:55:14 +02:00
|
|
|
reinterpret_cast<rocksdb::FlushOptions*>(jhandle)->wait =
|
|
|
|
static_cast<bool>(jwait);
|
2014-11-09 20:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_FlushOptions
|
|
|
|
* Method: waitForFlush
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
jboolean Java_org_rocksdb_FlushOptions_waitForFlush(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2018-04-13 02:55:14 +02:00
|
|
|
return reinterpret_cast<rocksdb::FlushOptions*>(jhandle)->wait;
|
2014-11-09 20:09:39 +01:00
|
|
|
}
|
|
|
|
|
2019-02-22 23:36:38 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_FlushOptions
|
|
|
|
* Method: setAllowWriteStall
|
|
|
|
* Signature: (JZ)V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_FlushOptions_setAllowWriteStall(
|
|
|
|
JNIEnv*, jobject, jlong jhandle, jboolean jallow_write_stall) {
|
|
|
|
auto* flush_options = reinterpret_cast<rocksdb::FlushOptions*>(jhandle);
|
|
|
|
flush_options->allow_write_stall = jallow_write_stall == JNI_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_FlushOptions
|
|
|
|
* Method: allowWriteStall
|
|
|
|
* Signature: (J)Z
|
|
|
|
*/
|
|
|
|
jboolean Java_org_rocksdb_FlushOptions_allowWriteStall(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
|
|
|
auto* flush_options = reinterpret_cast<rocksdb::FlushOptions*>(jhandle);
|
|
|
|
return static_cast<jboolean>(flush_options->allow_write_stall);
|
|
|
|
}
|
|
|
|
|
2014-11-09 20:09:39 +01:00
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_FlushOptions
|
|
|
|
* Method: disposeInternal
|
|
|
|
* Signature: (J)V
|
|
|
|
*/
|
2019-02-22 23:36:38 +01:00
|
|
|
void Java_org_rocksdb_FlushOptions_disposeInternal(
|
|
|
|
JNIEnv*, jobject, jlong jhandle) {
|
2017-02-28 01:26:12 +01:00
|
|
|
auto* flush_opt = reinterpret_cast<rocksdb::FlushOptions*>(jhandle);
|
|
|
|
assert(flush_opt != nullptr);
|
|
|
|
delete flush_opt;
|
2014-10-13 20:48:44 +02:00
|
|
|
}
|