diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 33d42646f..59a927043 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -1247,9 +1247,51 @@ jint Java_org_rocksdb_Options_statsDumpPeriodSec( */ void Java_org_rocksdb_Options_setStatsDumpPeriodSec( JNIEnv*, jobject, jlong jhandle, - jint stats_dump_period_sec) { + jint jstats_dump_period_sec) { reinterpret_cast(jhandle)->stats_dump_period_sec = - static_cast(stats_dump_period_sec); + static_cast(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(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(jhandle)->stats_persist_period_sec = + static_cast(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(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(jhandle)->stats_history_buffer_size = + static_cast(jstats_history_buffer_size); } /* @@ -1481,6 +1523,28 @@ jlong Java_org_rocksdb_Options_walBytesPerSync( return static_cast(opt->wal_bytes_per_sync); } +/* + * 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(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(jhandle); + return static_cast(opt->strict_bytes_per_sync); +} + /* * Class: org_rocksdb_Options * Method: setEnableThreadTracking @@ -5441,9 +5505,9 @@ jboolean Java_org_rocksdb_DBOptions_isFdCloseOnExec( * Signature: (JI)V */ void Java_org_rocksdb_DBOptions_setStatsDumpPeriodSec( - JNIEnv*, jobject, jlong jhandle, jint stats_dump_period_sec) { + JNIEnv*, jobject, jlong jhandle, jint jstats_dump_period_sec) { reinterpret_cast(jhandle)->stats_dump_period_sec = - static_cast(stats_dump_period_sec); + static_cast(jstats_dump_period_sec); } /* @@ -5456,6 +5520,48 @@ jint Java_org_rocksdb_DBOptions_statsDumpPeriodSec( return reinterpret_cast(jhandle)->stats_dump_period_sec; } +/* + * 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(jhandle)->stats_persist_period_sec = + static_cast(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(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(jhandle)->stats_history_buffer_size = + static_cast(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(jhandle)->stats_history_buffer_size; +} + /* * Class: org_rocksdb_DBOptions * Method: setAdviseRandomOnOpen @@ -5694,6 +5800,28 @@ jlong Java_org_rocksdb_DBOptions_walBytesPerSync( return static_cast(opt->wal_bytes_per_sync); } +/* + * 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(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( + reinterpret_cast(jhandle)->strict_bytes_per_sync); +} + /* * Class: org_rocksdb_DBOptions * Method: setDelayedWriteRate diff --git a/java/src/main/java/org/rocksdb/DBOptions.java b/java/src/main/java/org/rocksdb/DBOptions.java index fc413c76a..b105230ad 100644 --- a/java/src/main/java/org/rocksdb/DBOptions.java +++ b/java/src/main/java/org/rocksdb/DBOptions.java @@ -660,6 +660,34 @@ public class DBOptions extends RocksObject return statsDumpPeriodSec(nativeHandle_); } + @Override + public DBOptions setStatsPersistPeriodSec( + final int statsPersistPeriodSec) { + assert(isOwningHandle()); + setStatsPersistPeriodSec(nativeHandle_, statsPersistPeriodSec); + return this; + } + + @Override + public int statsPersistPeriodSec() { + assert(isOwningHandle()); + return statsPersistPeriodSec(nativeHandle_); + } + + @Override + public DBOptions setStatsHistoryBufferSize( + final long statsHistoryBufferSize) { + assert(isOwningHandle()); + setStatsHistoryBufferSize(nativeHandle_, statsHistoryBufferSize); + return this; + } + + @Override + public long statsHistoryBufferSize() { + assert(isOwningHandle()); + return statsHistoryBufferSize(nativeHandle_); + } + @Override public DBOptions setAdviseRandomOnOpen( final boolean adviseRandomOnOpen) { @@ -807,6 +835,19 @@ public class DBOptions extends RocksObject return walBytesPerSync(nativeHandle_); } + @Override + public DBOptions setStrictBytesPerSync(final boolean strictBytesPerSync) { + assert(isOwningHandle()); + setStrictBytesPerSync(nativeHandle_, strictBytesPerSync); + return this; + } + + @Override + public boolean strictBytesPerSync() { + assert(isOwningHandle()); + return strictBytesPerSync(nativeHandle_); + } + //TODO(AR) NOW // @Override // public DBOptions setListeners(final List listeners) { @@ -1239,6 +1280,14 @@ public class DBOptions extends RocksObject private native void setStatsDumpPeriodSec( long handle, int statsDumpPeriodSec); private native int statsDumpPeriodSec(long handle); + private native void setStatsPersistPeriodSec( + final long handle, final int statsPersistPeriodSec); + private native int statsPersistPeriodSec( + final long handle); + private native void setStatsHistoryBufferSize( + final long handle, final long statsHistoryBufferSize); + private native long statsHistoryBufferSize( + final long handle); private native void setAdviseRandomOnOpen( long handle, boolean adviseRandomOnOpen); private native boolean adviseRandomOnOpen(long handle); @@ -1270,6 +1319,10 @@ public class DBOptions extends RocksObject private native long bytesPerSync(long handle); private native void setWalBytesPerSync(long handle, long walBytesPerSync); private native long walBytesPerSync(long handle); + private native void setStrictBytesPerSync( + final long handle, final boolean strictBytesPerSync); + private native boolean strictBytesPerSync( + final long handle); private native void setEnableThreadTracking(long handle, boolean enableThreadTracking); private native boolean enableThreadTracking(long handle); diff --git a/java/src/main/java/org/rocksdb/MutableDBOptions.java b/java/src/main/java/org/rocksdb/MutableDBOptions.java index 328f7f979..2de658d8f 100644 --- a/java/src/main/java/org/rocksdb/MutableDBOptions.java +++ b/java/src/main/java/org/rocksdb/MutableDBOptions.java @@ -89,9 +89,12 @@ public class MutableDBOptions extends AbstractMutableOptions { max_total_wal_size(ValueType.LONG), delete_obsolete_files_period_micros(ValueType.LONG), stats_dump_period_sec(ValueType.INT), + stats_persist_period_sec(ValueType.INT), + stats_history_buffer_size(ValueType.LONG), max_open_files(ValueType.INT), bytes_per_sync(ValueType.LONG), wal_bytes_per_sync(ValueType.LONG), + strict_bytes_per_sync(ValueType.BOOLEAN), compaction_readahead_size(ValueType.LONG); private final ValueType valueType; @@ -240,6 +243,28 @@ public class MutableDBOptions extends AbstractMutableOptions { return getInt(DBOption.stats_dump_period_sec); } + @Override + public MutableDBOptionsBuilder setStatsPersistPeriodSec( + final int statsPersistPeriodSec) { + return setInt(DBOption.stats_persist_period_sec, statsPersistPeriodSec); + } + + @Override + public int statsPersistPeriodSec() { + return getInt(DBOption.stats_persist_period_sec); + } + + @Override + public MutableDBOptionsBuilder setStatsHistoryBufferSize( + final long statsHistoryBufferSize) { + return setLong(DBOption.stats_history_buffer_size, statsHistoryBufferSize); + } + + @Override + public long statsHistoryBufferSize() { + return getLong(DBOption.stats_history_buffer_size); + } + @Override public MutableDBOptionsBuilder setMaxOpenFiles(final int maxOpenFiles) { return setInt(DBOption.max_open_files, maxOpenFiles); @@ -271,6 +296,17 @@ public class MutableDBOptions extends AbstractMutableOptions { return getLong(DBOption.wal_bytes_per_sync); } + @Override + public MutableDBOptionsBuilder setStrictBytesPerSync( + final boolean strictBytesPerSync) { + return setBoolean(DBOption.strict_bytes_per_sync, strictBytesPerSync); + } + + @Override + public boolean strictBytesPerSync() { + return getBoolean(DBOption.strict_bytes_per_sync); + } + @Override public MutableDBOptionsBuilder setCompactionReadaheadSize( final long compactionReadaheadSize) { diff --git a/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java b/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java index 50347d38d..182e18d5e 100644 --- a/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java +++ b/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java @@ -237,6 +237,44 @@ public interface MutableDBOptionsInterface