Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrambacher committed Nov 9, 2023
1 parent 5a7fbff commit 35bc78b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Speedb Change Log

## Unreleased
* Enabled speedb features in C and Java (#722)

### New Features
* Added ConfigOptions::compare_to. When set, this value causes only values that have been changed to be part of the serialized output (#648).
Expand All @@ -25,7 +26,6 @@ Based on RocksDB 8.1.1
* Static Pinning: Report pinning policy name and parameters to the log (#691).
* LOG Reporting: add reporting capabilities to the WriteController and the WriteBufferManager by saving the Loggers of the dbs which are using them internally and issuing WARN msgs to these Loggers whenever the state of the WC and WBM changes in regards to delaying (#556).
* Enable speedb features: Use Scoped Pinning Policy in Enable speedb feature (#459).
* Enabled speedb features in C and Java (#722)
* sst_dump: display metaindex_handle and the index_handle's offset and size in footer information (#404).
* Static Pinning: Set the default for mid-percent capacity threshold in scoped pinning policy to 70 (#689).
* db_bench: Add support for individual scoped pinning policy parameters (#687).
Expand Down
16 changes: 11 additions & 5 deletions db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2796,8 +2796,8 @@ void rocksdb_options_optimize_universal_style_compaction(
opt->rep.OptimizeUniversalStyleCompaction(memtable_memory_budget);
}

void rocksdb_options_enable_speedb(rocksdb_options_t* opt,
rocksdb_shared_options_t* shared) {
void rocksdb_options_enable_speedb_features(rocksdb_options_t* opt,
rocksdb_shared_options_t* shared) {
opt->rep.EnableSpeedbFeatures(shared->rep);
}

Expand Down Expand Up @@ -3897,9 +3897,10 @@ rocksdb_shared_options_t* rocksdb_shared_options_create(
}
rocksdb_shared_options_t* rocksdb_shared_options_create_from(
size_t total_ram_size_bytes, size_t total_threads,
size_t delayed_write_rate, int use_merge) {
return new rocksdb_shared_options_t{SharedOptions(
total_ram_size_bytes, total_threads, delayed_write_rate, use_merge)};
size_t delayed_write_rate, size_t bucket_size, int use_merge) {
return new rocksdb_shared_options_t{
SharedOptions(total_ram_size_bytes, total_threads, delayed_write_rate,
bucket_size, use_merge)};
}

void rocksdb_shared_options_destroy(rocksdb_shared_options_t* opt) {
Expand Down Expand Up @@ -3929,6 +3930,11 @@ size_t rocksdb_shared_options_get_bucket_size(rocksdb_shared_options_t* opt) {
return opt->rep.GetBucketSize();
}

unsigned char rocksdb_shared_options_is_merge_memtable_supported(
rocksdb_shared_options_t* opt) {
return opt->rep.IsMergeMemtableSupported();
}

rocksdb_ratelimiter_t* rocksdb_ratelimiter_create(int64_t rate_bytes_per_sec,
int64_t refill_period_us,
int32_t fairness) {
Expand Down
8 changes: 6 additions & 2 deletions include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_for_point_lookup(
rocksdb_options_t* opt, uint64_t block_cache_size_mb);
extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_level_style_compaction(
rocksdb_options_t* opt, uint64_t memtable_memory_budget);
extern ROCKSDB_LIBRARY_API void rocksdb_options_enable_speedb(
extern ROCKSDB_LIBRARY_API void rocksdb_options_enable_speedb_features(
rocksdb_options_t* opt, rocksdb_shared_options_t* shared);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_optimize_universal_style_compaction(
Expand Down Expand Up @@ -1652,7 +1652,8 @@ rocksdb_shared_options_create(size_t total_ram_size_bytes,
extern ROCKSDB_LIBRARY_API rocksdb_shared_options_t*
rocksdb_shared_options_create_from(size_t total_ram_size_bytes,
size_t total_threads,
size_t delayed_write_rate, int use_merge);
size_t delayed_write_rate,
size_t bucket_size, int use_merge);
extern ROCKSDB_LIBRARY_API void rocksdb_shared_options_destroy(
rocksdb_shared_options_t* options);
extern ROCKSDB_LIBRARY_API size_t
Expand All @@ -1666,6 +1667,9 @@ extern ROCKSDB_LIBRARY_API size_t
rocksdb_shared_options_get_delayed_write_rate(rocksdb_shared_options_t* opt);
extern ROCKSDB_LIBRARY_API size_t
rocksdb_shared_options_get_bucket_size(rocksdb_shared_options_t* options);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_shared_options_is_merge_memtable_supported(
rocksdb_shared_options_t* options);

/* RateLimiter */
extern ROCKSDB_LIBRARY_API rocksdb_ratelimiter_t* rocksdb_ratelimiter_create(
Expand Down
14 changes: 6 additions & 8 deletions java/rocksjni/options.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright (C) 2023 Speedb Ltd. All rights reserved.

//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,7 +13,6 @@
// limitations under the License.
//
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
//
// 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).
Expand Down Expand Up @@ -8758,20 +8756,20 @@ void Java_org_rocksdb_FlushOptions_disposeInternal(JNIEnv*, jobject,
/*
* Class: org_rocksdb_SharedOptions
* Method: newSharedOptions
* Signature: (JJJ)J
* Signature: (JJJJZ)J
*/
JNIEXPORT jlong JNICALL Java_org_rocksdb_SharedOptions_newSharedOptions__JJJZ(
JNIEXPORT jlong JNICALL Java_org_rocksdb_SharedOptions_newSharedOptions__JJJJZ(
JNIEnv*, jclass, jlong capacity, jlong total_threads,
jlong delayed_write_rate, jboolean use_merge) {
jlong delayed_write_rate, jlong bucket_size, jboolean use_merge) {
auto opts = new ROCKSDB_NAMESPACE::SharedOptions(
capacity, total_threads, delayed_write_rate, use_merge);
capacity, total_threads, delayed_write_rate, bucket_size, use_merge);
return GET_CPLUSPLUS_POINTER(opts);
}

/*
* Class: org_rocksdb_SharedOptions
* Method: newSharedOptions
* Signature: (JJJ)J
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_rocksdb_SharedOptions_newSharedOptions__JJ(
JNIEnv*, jclass, jlong capacity, jlong total_threads) {
Expand Down Expand Up @@ -8846,7 +8844,7 @@ Java_org_rocksdb_SharedOptions_getMaxWriteBufferManagerSize(JNIEnv*, jclass,
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_org_rocksdb_SharedOptions_getBucketize(JNIEnv*, jclass, jlong jhandle) {
Java_org_rocksdb_SharedOptions_getBucketSize(JNIEnv*, jclass, jlong jhandle) {
auto* opts = reinterpret_cast<ROCKSDB_NAMESPACE::SharedOptions*>(jhandle);
assert(opts != nullptr);
return opts->GetBucketSize();
Expand Down
2 changes: 0 additions & 2 deletions java/src/main/java/org/rocksdb/RocksDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public static void loadLibrary(final List<String> paths) {
UnsatisfiedLinkError err = null;
for (final String path : paths) {
try {
System.err.println("**MJR: JNI file=[" + path + "/"
+ Environment.getJniLibraryFileName("speedbjni") + "]");
System.load(path + "/" + Environment.getJniLibraryFileName("speedbjni"));
success = true;
break;
Expand Down
6 changes: 3 additions & 3 deletions java/src/main/java/org/rocksdb/SharedOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public SharedOptions(final long capacity, final long total_threads) {
}

public SharedOptions(final long capacity, final long total_threads, final long delayed_write_rate,
final boolean use_merge) {
super(newSharedOptions(capacity, total_threads, delayed_write_rate, use_merge));
final long bucket_size, final boolean use_merge) {
super(newSharedOptions(capacity, total_threads, delayed_write_rate, bucket_size, use_merge));
}

public long getTotalThreads() {
Expand Down Expand Up @@ -57,7 +57,7 @@ public long isMergeMemtableSupported() {
}

private native static long newSharedOptions(final long capacity, final long total_threads,
final long delayed_write_rate, final boolean use_merge);
final long delayed_write_rate, final long bucket_size, final boolean use_merge);
private native static long newSharedOptions(final long capacity, final long total_threads);
@Override protected final native void disposeInternal(final long handle);
private native static long getTotalThreads(final long handle);
Expand Down

0 comments on commit 35bc78b

Please sign in to comment.