Merge pull request #536 from fyrz/RocksJava-32-Bit-adjustment

[RocksJava] 32-Bit adjustments
main
Adam Retter 10 years ago
commit 51da3aab4a
  1. 8
      java/rocksjni/memtablejni.cc
  2. 32
      java/rocksjni/options.cc
  3. 60
      java/rocksjni/portal.h
  4. 3
      java/samples/src/main/java/RocksDBSample.java
  5. 24
      java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
  6. 35
      java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java
  7. 16
      java/src/main/java/org/rocksdb/DBOptions.java
  8. 28
      java/src/main/java/org/rocksdb/DBOptionsInterface.java
  9. 5
      java/src/main/java/org/rocksdb/HashLinkedListMemTableConfig.java
  10. 5
      java/src/main/java/org/rocksdb/HashSkipListMemTableConfig.java
  11. 6
      java/src/main/java/org/rocksdb/MemTableConfig.java
  12. 44
      java/src/main/java/org/rocksdb/Options.java
  13. 3
      java/src/main/java/org/rocksdb/SkipListMemTableConfig.java
  14. 3
      java/src/main/java/org/rocksdb/VectorMemTableConfig.java

@ -27,7 +27,7 @@ jlong Java_org_rocksdb_HashSkipListMemTableConfig_newMemTableFactoryHandle(
static_cast<int32_t>(jheight), static_cast<int32_t>(jheight),
static_cast<int32_t>(jbranching_factor))); static_cast<int32_t>(jbranching_factor)));
} }
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
return 0; return 0;
} }
@ -52,7 +52,7 @@ jlong Java_org_rocksdb_HashLinkedListMemTableConfig_newMemTableFactoryHandle(
static_cast<bool>(jif_log_bucket_dist_when_flash), static_cast<bool>(jif_log_bucket_dist_when_flash),
static_cast<int32_t>(jthreshold_use_skiplist))); static_cast<int32_t>(jthreshold_use_skiplist)));
} }
rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::IllegalArgumentExceptionJni::ThrowNew(env,
!statusBucketCount.ok()?statusBucketCount:statusHugePageTlb); !statusBucketCount.ok()?statusBucketCount:statusHugePageTlb);
return 0; return 0;
} }
@ -69,7 +69,7 @@ jlong Java_org_rocksdb_VectorMemTableConfig_newMemTableFactoryHandle(
return reinterpret_cast<jlong>(new rocksdb::VectorRepFactory( return reinterpret_cast<jlong>(new rocksdb::VectorRepFactory(
static_cast<size_t>(jreserved_size))); static_cast<size_t>(jreserved_size)));
} }
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
return 0; return 0;
} }
@ -85,6 +85,6 @@ jlong Java_org_rocksdb_SkipListMemTableConfig_newMemTableFactoryHandle0(
return reinterpret_cast<jlong>(new rocksdb::SkipListFactory( return reinterpret_cast<jlong>(new rocksdb::SkipListFactory(
static_cast<size_t>(jlookahead))); static_cast<size_t>(jlookahead)));
} }
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
return 0; return 0;
} }

@ -189,7 +189,7 @@ void Java_org_rocksdb_Options_setWriteBufferSize(
reinterpret_cast<rocksdb::Options*>(jhandle)->write_buffer_size = reinterpret_cast<rocksdb::Options*>(jhandle)->write_buffer_size =
jwrite_buffer_size; jwrite_buffer_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -519,7 +519,7 @@ void Java_org_rocksdb_Options_setMaxLogFileSize(
reinterpret_cast<rocksdb::Options*>(jhandle)->max_log_file_size = reinterpret_cast<rocksdb::Options*>(jhandle)->max_log_file_size =
max_log_file_size; max_log_file_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -546,7 +546,7 @@ void Java_org_rocksdb_Options_setLogFileTimeToRoll(
reinterpret_cast<rocksdb::Options*>(jhandle)->log_file_time_to_roll = reinterpret_cast<rocksdb::Options*>(jhandle)->log_file_time_to_roll =
log_file_time_to_roll; log_file_time_to_roll;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -572,7 +572,7 @@ void Java_org_rocksdb_Options_setKeepLogFileNum(
reinterpret_cast<rocksdb::Options*>(jhandle)->keep_log_file_num = reinterpret_cast<rocksdb::Options*>(jhandle)->keep_log_file_num =
keep_log_file_num; keep_log_file_num;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -792,7 +792,7 @@ void Java_org_rocksdb_Options_setManifestPreallocationSize(
reinterpret_cast<rocksdb::Options*>(jhandle)->manifest_preallocation_size = reinterpret_cast<rocksdb::Options*>(jhandle)->manifest_preallocation_size =
preallocation_size; preallocation_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -1472,7 +1472,7 @@ void Java_org_rocksdb_Options_setArenaBlockSize(
reinterpret_cast<rocksdb::Options*>(jhandle)->arena_block_size = reinterpret_cast<rocksdb::Options*>(jhandle)->arena_block_size =
jarena_block_size; jarena_block_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -1642,7 +1642,7 @@ void Java_org_rocksdb_Options_setInplaceUpdateNumLocks(
reinterpret_cast<rocksdb::Options*>(jhandle)->inplace_update_num_locks = reinterpret_cast<rocksdb::Options*>(jhandle)->inplace_update_num_locks =
jinplace_update_num_locks; jinplace_update_num_locks;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -1739,7 +1739,7 @@ void Java_org_rocksdb_Options_setMaxSuccessiveMerges(
reinterpret_cast<rocksdb::Options*>(jhandle)->max_successive_merges = reinterpret_cast<rocksdb::Options*>(jhandle)->max_successive_merges =
jmax_successive_merges; jmax_successive_merges;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -1989,7 +1989,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setWriteBufferSize(
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)-> reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->
write_buffer_size = jwrite_buffer_size; write_buffer_size = jwrite_buffer_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -2564,7 +2564,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setArenaBlockSize(
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)-> reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->
arena_block_size = jarena_block_size; arena_block_size = jarena_block_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -2735,7 +2735,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setInplaceUpdateNumLocks(
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)-> reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->
inplace_update_num_locks = jinplace_update_num_locks; inplace_update_num_locks = jinplace_update_num_locks;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -2834,7 +2834,7 @@ void Java_org_rocksdb_ColumnFamilyOptions_setMaxSuccessiveMerges(
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)-> reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->
max_successive_merges = jmax_successive_merges; max_successive_merges = jmax_successive_merges;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -3312,7 +3312,7 @@ void Java_org_rocksdb_DBOptions_setMaxLogFileSize(
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_log_file_size = reinterpret_cast<rocksdb::DBOptions*>(jhandle)->max_log_file_size =
max_log_file_size; max_log_file_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -3339,7 +3339,7 @@ void Java_org_rocksdb_DBOptions_setLogFileTimeToRoll(
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->log_file_time_to_roll = reinterpret_cast<rocksdb::DBOptions*>(jhandle)->log_file_time_to_roll =
log_file_time_to_roll; log_file_time_to_roll;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -3365,7 +3365,7 @@ void Java_org_rocksdb_DBOptions_setKeepLogFileNum(
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->keep_log_file_num = reinterpret_cast<rocksdb::DBOptions*>(jhandle)->keep_log_file_num =
keep_log_file_num; keep_log_file_num;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }
@ -3498,7 +3498,7 @@ void Java_org_rocksdb_DBOptions_setManifestPreallocationSize(
reinterpret_cast<rocksdb::DBOptions*>(jhandle)-> reinterpret_cast<rocksdb::DBOptions*>(jhandle)->
manifest_preallocation_size = preallocation_size; manifest_preallocation_size = preallocation_size;
} else { } else {
rocksdb::RocksDBExceptionJni::ThrowNew(env, s); rocksdb::IllegalArgumentExceptionJni::ThrowNew(env, s);
} }
} }

@ -26,7 +26,7 @@
namespace rocksdb { namespace rocksdb {
// detect if jlong overflows size_t // Detect if jlong overflows size_t
inline Status check_if_jlong_fits_size_t(const jlong& jvalue) { inline Status check_if_jlong_fits_size_t(const jlong& jvalue) {
Status s = Status::OK(); Status s = Status::OK();
if (static_cast<uint64_t>(jvalue) > std::numeric_limits<size_t>::max()) { if (static_cast<uint64_t>(jvalue) > std::numeric_limits<size_t>::max()) {
@ -68,27 +68,18 @@ template<class PTR, class DERIVED> class RocksDBNativeClass {
} }
}; };
// The portal class for org.rocksdb.RocksDB // Java Exception template
class RocksDBJni : public RocksDBNativeClass<rocksdb::DB*, RocksDBJni> { template<class DERIVED> class RocksDBJavaException {
public:
// Get the java class id of org.rocksdb.RocksDB.
static jclass getJClass(JNIEnv* env) {
return RocksDBNativeClass::getJClass(env, "org/rocksdb/RocksDB");
}
};
// The portal class for org.rocksdb.RocksDBException
class RocksDBExceptionJni {
public: public:
// Get the jclass of org.rocksdb.RocksDBException // Get the java class id
static jclass getJClass(JNIEnv* env) { static jclass getJClass(JNIEnv* env, const char* jclazz_name) {
jclass jclazz = env->FindClass("org/rocksdb/RocksDBException"); jclass jclazz = env->FindClass(jclazz_name);
assert(jclazz != nullptr); assert(jclazz != nullptr);
return jclazz; return jclazz;
} }
// Create and throw a java exception by converting the input // Create and throw a java exception by converting the input
// Status to an RocksDBException. // Status.
// //
// In case s.ok() is true, then this function will not throw any // In case s.ok() is true, then this function will not throw any
// exception. // exception.
@ -99,13 +90,46 @@ class RocksDBExceptionJni {
jstring msg = env->NewStringUTF(s.ToString().c_str()); jstring msg = env->NewStringUTF(s.ToString().c_str());
// get the constructor id of org.rocksdb.RocksDBException // get the constructor id of org.rocksdb.RocksDBException
static jmethodID mid = env->GetMethodID( static jmethodID mid = env->GetMethodID(
getJClass(env), "<init>", "(Ljava/lang/String;)V"); DERIVED::getJClass(env), "<init>", "(Ljava/lang/String;)V");
assert(mid != nullptr); assert(mid != nullptr);
env->Throw((jthrowable)env->NewObject(getJClass(env), mid, msg)); env->Throw((jthrowable)env->NewObject(DERIVED::getJClass(env),
mid, msg));
} }
}; };
// The portal class for org.rocksdb.RocksDB
class RocksDBJni : public RocksDBNativeClass<rocksdb::DB*, RocksDBJni> {
public:
// Get the java class id of org.rocksdb.RocksDB.
static jclass getJClass(JNIEnv* env) {
return RocksDBNativeClass::getJClass(env, "org/rocksdb/RocksDB");
}
};
// The portal class for org.rocksdb.RocksDBException
class RocksDBExceptionJni :
public RocksDBJavaException<RocksDBExceptionJni> {
public:
// Get the java class id of java.lang.IllegalArgumentException
static jclass getJClass(JNIEnv* env) {
return RocksDBJavaException::getJClass(env,
"org/rocksdb/RocksDBException");
}
};
// The portal class for java.lang.IllegalArgumentException
class IllegalArgumentExceptionJni :
public RocksDBJavaException<IllegalArgumentExceptionJni> {
public:
// Get the java class id of java.lang.IllegalArgumentException
static jclass getJClass(JNIEnv* env) {
return RocksDBJavaException::getJClass(env,
"java/lang/IllegalArgumentException");
}
};
// The portal class for org.rocksdb.Options // The portal class for org.rocksdb.Options
class OptionsJni : public RocksDBNativeClass< class OptionsJni : public RocksDBNativeClass<
rocksdb::Options*, OptionsJni> { rocksdb::Options*, OptionsJni> {

@ -3,6 +3,7 @@
// LICENSE file in the root directory of this source tree. An additional grant // LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory. // of patent rights can be found in the PATENTS file in the same directory.
import java.lang.IllegalArgumentException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -43,7 +44,7 @@ public class RocksDBSample {
.setMaxBackgroundCompactions(10) .setMaxBackgroundCompactions(10)
.setCompressionType(CompressionType.SNAPPY_COMPRESSION) .setCompressionType(CompressionType.SNAPPY_COMPRESSION)
.setCompactionStyle(CompactionStyle.UNIVERSAL); .setCompactionStyle(CompactionStyle.UNIVERSAL);
} catch (RocksDBException e) { } catch (IllegalArgumentException e) {
assert(false); assert(false);
} }

@ -144,8 +144,7 @@ public class ColumnFamilyOptions extends RocksObject
} }
@Override @Override
public ColumnFamilyOptions setWriteBufferSize(final long writeBufferSize) public ColumnFamilyOptions setWriteBufferSize(final long writeBufferSize) {
throws RocksDBException {
assert(isInitialized()); assert(isInitialized());
setWriteBufferSize(nativeHandle_, writeBufferSize); setWriteBufferSize(nativeHandle_, writeBufferSize);
return this; return this;
@ -396,8 +395,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override @Override
public ColumnFamilyOptions setArenaBlockSize( public ColumnFamilyOptions setArenaBlockSize(
final long arenaBlockSize) final long arenaBlockSize) {
throws RocksDBException {
setArenaBlockSize(nativeHandle_, arenaBlockSize); setArenaBlockSize(nativeHandle_, arenaBlockSize);
return this; return this;
} }
@ -483,7 +481,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override @Override
public ColumnFamilyOptions setMemTableConfig( public ColumnFamilyOptions setMemTableConfig(
final MemTableConfig config) throws RocksDBException { final MemTableConfig config) {
memTableConfig_ = config; memTableConfig_ = config;
setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle()); setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle());
return this; return this;
@ -523,8 +521,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override @Override
public ColumnFamilyOptions setInplaceUpdateNumLocks( public ColumnFamilyOptions setInplaceUpdateNumLocks(
final long inplaceUpdateNumLocks) final long inplaceUpdateNumLocks) {
throws RocksDBException {
setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks); setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks);
return this; return this;
} }
@ -571,7 +568,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override @Override
public ColumnFamilyOptions setMaxSuccessiveMerges( public ColumnFamilyOptions setMaxSuccessiveMerges(
final long maxSuccessiveMerges) throws RocksDBException { final long maxSuccessiveMerges) {
setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges); setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges);
return this; return this;
} }
@ -644,7 +641,7 @@ public class ColumnFamilyOptions extends RocksObject
private native void setMergeOperator( private native void setMergeOperator(
long handle, long mergeOperatorHandle); long handle, long mergeOperatorHandle);
private native void setWriteBufferSize(long handle, long writeBufferSize) private native void setWriteBufferSize(long handle, long writeBufferSize)
throws RocksDBException; throws IllegalArgumentException;
private native long writeBufferSize(long handle); private native long writeBufferSize(long handle);
private native void setMaxWriteBufferNumber( private native void setMaxWriteBufferNumber(
long handle, int maxWriteBufferNumber); long handle, int maxWriteBufferNumber);
@ -706,7 +703,8 @@ public class ColumnFamilyOptions extends RocksObject
long handle, int rateLimitDelayMaxMilliseconds); long handle, int rateLimitDelayMaxMilliseconds);
private native int rateLimitDelayMaxMilliseconds(long handle); private native int rateLimitDelayMaxMilliseconds(long handle);
private native void setArenaBlockSize( private native void setArenaBlockSize(
long handle, long arenaBlockSize) throws RocksDBException; long handle, long arenaBlockSize)
throws IllegalArgumentException;
private native long arenaBlockSize(long handle); private native long arenaBlockSize(long handle);
private native void setDisableAutoCompactions( private native void setDisableAutoCompactions(
long handle, boolean disableAutoCompactions); long handle, boolean disableAutoCompactions);
@ -733,7 +731,8 @@ public class ColumnFamilyOptions extends RocksObject
long handle, boolean inplaceUpdateSupport); long handle, boolean inplaceUpdateSupport);
private native boolean inplaceUpdateSupport(long handle); private native boolean inplaceUpdateSupport(long handle);
private native void setInplaceUpdateNumLocks( private native void setInplaceUpdateNumLocks(
long handle, long inplaceUpdateNumLocks) throws RocksDBException; long handle, long inplaceUpdateNumLocks)
throws IllegalArgumentException;
private native long inplaceUpdateNumLocks(long handle); private native long inplaceUpdateNumLocks(long handle);
private native void setMemtablePrefixBloomBits( private native void setMemtablePrefixBloomBits(
long handle, int memtablePrefixBloomBits); long handle, int memtablePrefixBloomBits);
@ -745,7 +744,8 @@ public class ColumnFamilyOptions extends RocksObject
long handle, int bloomLocality); long handle, int bloomLocality);
private native int bloomLocality(long handle); private native int bloomLocality(long handle);
private native void setMaxSuccessiveMerges( private native void setMaxSuccessiveMerges(
long handle, long maxSuccessiveMerges) throws RocksDBException; long handle, long maxSuccessiveMerges)
throws IllegalArgumentException;
private native long maxSuccessiveMerges(long handle); private native long maxSuccessiveMerges(long handle);
private native void setMinPartialMergeOperands( private native void setMinPartialMergeOperands(
long handle, int minPartialMergeOperands); long handle, int minPartialMergeOperands);

@ -152,11 +152,10 @@ public interface ColumnFamilyOptionsInterface {
* Default: 4MB * Default: 4MB
* @param writeBufferSize the size of write buffer. * @param writeBufferSize the size of write buffer.
* @return the instance of the current Object. * @return the instance of the current Object.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setWriteBufferSize(long writeBufferSize) Object setWriteBufferSize(long writeBufferSize);
throws RocksDBException;
/** /**
* Return size of write buffer size. * Return size of write buffer size.
@ -701,11 +700,10 @@ public interface ColumnFamilyOptionsInterface {
* *
* @param arenaBlockSize the size of an arena block * @param arenaBlockSize the size of an arena block
* @return the reference to the current option. * @return the reference to the current option.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setArenaBlockSize(long arenaBlockSize) Object setArenaBlockSize(long arenaBlockSize);
throws RocksDBException;
/** /**
* The size of one block in arena memory allocation. * The size of one block in arena memory allocation.
@ -850,11 +848,10 @@ public interface ColumnFamilyOptionsInterface {
* *
* @param config the mem-table config. * @param config the mem-table config.
* @return the instance of the current Object. * @return the instance of the current Object.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setMemTableConfig(MemTableConfig config) Object setMemTableConfig(MemTableConfig config);
throws RocksDBException;
/** /**
* Returns the name of the current mem table representation. * Returns the name of the current mem table representation.
@ -915,11 +912,10 @@ public interface ColumnFamilyOptionsInterface {
* @param inplaceUpdateNumLocks the number of locks used for * @param inplaceUpdateNumLocks the number of locks used for
* inplace updates. * inplace updates.
* @return the reference to the current option. * @return the reference to the current option.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setInplaceUpdateNumLocks(long inplaceUpdateNumLocks) Object setInplaceUpdateNumLocks(long inplaceUpdateNumLocks);
throws RocksDBException;
/** /**
* Number of locks used for inplace update * Number of locks used for inplace update
@ -1010,11 +1006,10 @@ public interface ColumnFamilyOptionsInterface {
* *
* @param maxSuccessiveMerges the maximum number of successive merges. * @param maxSuccessiveMerges the maximum number of successive merges.
* @return the reference to the current option. * @return the reference to the current option.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setMaxSuccessiveMerges(long maxSuccessiveMerges) Object setMaxSuccessiveMerges(long maxSuccessiveMerges);
throws RocksDBException;
/** /**
* Maximum number of successive merge operations on a key in the memtable. * Maximum number of successive merge operations on a key in the memtable.

@ -314,7 +314,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
@Override @Override
public DBOptions setMaxLogFileSize( public DBOptions setMaxLogFileSize(
final long maxLogFileSize) throws RocksDBException { final long maxLogFileSize) {
assert(isInitialized()); assert(isInitialized());
setMaxLogFileSize(nativeHandle_, maxLogFileSize); setMaxLogFileSize(nativeHandle_, maxLogFileSize);
return this; return this;
@ -328,7 +328,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
@Override @Override
public DBOptions setLogFileTimeToRoll( public DBOptions setLogFileTimeToRoll(
final long logFileTimeToRoll) throws RocksDBException{ final long logFileTimeToRoll) {
assert(isInitialized()); assert(isInitialized());
setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll); setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll);
return this; return this;
@ -342,7 +342,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
@Override @Override
public DBOptions setKeepLogFileNum( public DBOptions setKeepLogFileNum(
final long keepLogFileNum) throws RocksDBException{ final long keepLogFileNum) {
assert(isInitialized()); assert(isInitialized());
setKeepLogFileNum(nativeHandle_, keepLogFileNum); setKeepLogFileNum(nativeHandle_, keepLogFileNum);
return this; return this;
@ -426,7 +426,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
@Override @Override
public DBOptions setManifestPreallocationSize( public DBOptions setManifestPreallocationSize(
final long size) throws RocksDBException { final long size) {
assert(isInitialized()); assert(isInitialized());
setManifestPreallocationSize(nativeHandle_, size); setManifestPreallocationSize(nativeHandle_, size);
return this; return this;
@ -634,13 +634,13 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
long handle, int maxBackgroundFlushes); long handle, int maxBackgroundFlushes);
private native int maxBackgroundFlushes(long handle); private native int maxBackgroundFlushes(long handle);
private native void setMaxLogFileSize(long handle, long maxLogFileSize) private native void setMaxLogFileSize(long handle, long maxLogFileSize)
throws RocksDBException; throws IllegalArgumentException;
private native long maxLogFileSize(long handle); private native long maxLogFileSize(long handle);
private native void setLogFileTimeToRoll( private native void setLogFileTimeToRoll(
long handle, long logFileTimeToRoll) throws RocksDBException; long handle, long logFileTimeToRoll) throws IllegalArgumentException;
private native long logFileTimeToRoll(long handle); private native long logFileTimeToRoll(long handle);
private native void setKeepLogFileNum(long handle, long keepLogFileNum) private native void setKeepLogFileNum(long handle, long keepLogFileNum)
throws RocksDBException; throws IllegalArgumentException;
private native long keepLogFileNum(long handle); private native long keepLogFileNum(long handle);
private native void setMaxManifestFileSize( private native void setMaxManifestFileSize(
long handle, long maxManifestFileSize); long handle, long maxManifestFileSize);
@ -656,7 +656,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
private native void setWalSizeLimitMB(long handle, long sizeLimitMB); private native void setWalSizeLimitMB(long handle, long sizeLimitMB);
private native long walSizeLimitMB(long handle); private native long walSizeLimitMB(long handle);
private native void setManifestPreallocationSize( private native void setManifestPreallocationSize(
long handle, long size) throws RocksDBException; long handle, long size) throws IllegalArgumentException;
private native long manifestPreallocationSize(long handle); private native long manifestPreallocationSize(long handle);
private native void setAllowOsBuffer( private native void setAllowOsBuffer(
long handle, boolean allowOsBuffer); long handle, boolean allowOsBuffer);

@ -415,11 +415,10 @@ public interface DBOptionsInterface {
* *
* @param maxLogFileSize the maximum size of a info log file. * @param maxLogFileSize the maximum size of a info log file.
* @return the instance of the current Object. * @return the instance of the current Object.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setMaxLogFileSize(long maxLogFileSize) Object setMaxLogFileSize(long maxLogFileSize);
throws RocksDBException;
/** /**
* Returns the maximum size of a info log file. If the current log file * Returns the maximum size of a info log file. If the current log file
@ -438,11 +437,10 @@ public interface DBOptionsInterface {
* *
* @param logFileTimeToRoll the time interval in seconds. * @param logFileTimeToRoll the time interval in seconds.
* @return the instance of the current Object. * @return the instance of the current Object.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setLogFileTimeToRoll(long logFileTimeToRoll) Object setLogFileTimeToRoll(long logFileTimeToRoll);
throws RocksDBException;
/** /**
* Returns the time interval for the info log file to roll (in seconds). * Returns the time interval for the info log file to roll (in seconds).
@ -460,11 +458,10 @@ public interface DBOptionsInterface {
* *
* @param keepLogFileNum the maximum number of info log files to be kept. * @param keepLogFileNum the maximum number of info log files to be kept.
* @return the instance of the current Object. * @return the instance of the current Object.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setKeepLogFileNum(long keepLogFileNum) Object setKeepLogFileNum(long keepLogFileNum);
throws RocksDBException;
/** /**
* Returns the maximum number of info log files to be kept. * Returns the maximum number of info log files to be kept.
@ -638,11 +635,10 @@ public interface DBOptionsInterface {
* *
* @param size the size in byte * @param size the size in byte
* @return the instance of the current Object. * @return the instance of the current Object.
* @throws org.rocksdb.RocksDBException thrown on 32-Bit platforms while * @throws java.lang.IllegalArgumentException thrown on 32-Bit platforms
* overflowing the underlying platform specific value. * while overflowing the underlying platform specific value.
*/ */
Object setManifestPreallocationSize(long size) Object setManifestPreallocationSize(long size);
throws RocksDBException;
/** /**
* Number of bytes to preallocate (via fallocate) the manifest * Number of bytes to preallocate (via fallocate) the manifest

@ -154,8 +154,7 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
return thresholdUseSkiplist_; return thresholdUseSkiplist_;
} }
@Override protected long newMemTableFactoryHandle() @Override protected long newMemTableFactoryHandle() {
throws RocksDBException {
return newMemTableFactoryHandle(bucketCount_, hugePageTlbSize_, return newMemTableFactoryHandle(bucketCount_, hugePageTlbSize_,
bucketEntriesLoggingThreshold_, ifLogBucketDistWhenFlush_, bucketEntriesLoggingThreshold_, ifLogBucketDistWhenFlush_,
thresholdUseSkiplist_); thresholdUseSkiplist_);
@ -164,7 +163,7 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
private native long newMemTableFactoryHandle(long bucketCount, private native long newMemTableFactoryHandle(long bucketCount,
long hugePageTlbSize, int bucketEntriesLoggingThreshold, long hugePageTlbSize, int bucketEntriesLoggingThreshold,
boolean ifLogBucketDistWhenFlush, int thresholdUseSkiplist) boolean ifLogBucketDistWhenFlush, int thresholdUseSkiplist)
throws RocksDBException; throws IllegalArgumentException;
private long bucketCount_; private long bucketCount_;
private long hugePageTlbSize_; private long hugePageTlbSize_;

@ -90,15 +90,14 @@ public class HashSkipListMemTableConfig extends MemTableConfig {
return branchingFactor_; return branchingFactor_;
} }
@Override protected long newMemTableFactoryHandle() @Override protected long newMemTableFactoryHandle() {
throws RocksDBException {
return newMemTableFactoryHandle( return newMemTableFactoryHandle(
bucketCount_, height_, branchingFactor_); bucketCount_, height_, branchingFactor_);
} }
private native long newMemTableFactoryHandle( private native long newMemTableFactoryHandle(
long bucketCount, int height, int branchingFactor) long bucketCount, int height, int branchingFactor)
throws RocksDBException; throws IllegalArgumentException;
private long bucketCount_; private long bucketCount_;
private int branchingFactor_; private int branchingFactor_;

@ -24,10 +24,6 @@ public abstract class MemTableConfig {
* @see Options#setMemTableConfig(MemTableConfig) * @see Options#setMemTableConfig(MemTableConfig)
* *
* @return native handle address to native memory table instance. * @return native handle address to native memory table instance.
*
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/ */
abstract protected long newMemTableFactoryHandle() abstract protected long newMemTableFactoryHandle();
throws RocksDBException;
} }

@ -190,8 +190,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setWriteBufferSize(final long writeBufferSize) public Options setWriteBufferSize(final long writeBufferSize) {
throws RocksDBException {
assert(isInitialized()); assert(isInitialized());
setWriteBufferSize(nativeHandle_, writeBufferSize); setWriteBufferSize(nativeHandle_, writeBufferSize);
return this; return this;
@ -389,8 +388,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setMaxLogFileSize(final long maxLogFileSize) public Options setMaxLogFileSize(final long maxLogFileSize) {
throws RocksDBException {
assert(isInitialized()); assert(isInitialized());
setMaxLogFileSize(nativeHandle_, maxLogFileSize); setMaxLogFileSize(nativeHandle_, maxLogFileSize);
return this; return this;
@ -403,8 +401,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setLogFileTimeToRoll(final long logFileTimeToRoll) public Options setLogFileTimeToRoll(final long logFileTimeToRoll) {
throws RocksDBException{
assert(isInitialized()); assert(isInitialized());
setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll); setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll);
return this; return this;
@ -417,8 +414,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setKeepLogFileNum(final long keepLogFileNum) public Options setKeepLogFileNum(final long keepLogFileNum) {
throws RocksDBException{
assert(isInitialized()); assert(isInitialized());
setKeepLogFileNum(nativeHandle_, keepLogFileNum); setKeepLogFileNum(nativeHandle_, keepLogFileNum);
return this; return this;
@ -499,8 +495,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setManifestPreallocationSize(final long size) public Options setManifestPreallocationSize(final long size) {
throws RocksDBException {
assert(isInitialized()); assert(isInitialized());
setManifestPreallocationSize(nativeHandle_, size); setManifestPreallocationSize(nativeHandle_, size);
return this; return this;
@ -624,8 +619,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setMemTableConfig(final MemTableConfig config) public Options setMemTableConfig(final MemTableConfig config) {
throws RocksDBException {
memTableConfig_ = config; memTableConfig_ = config;
setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle()); setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle());
return this; return this;
@ -901,8 +895,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setArenaBlockSize(final long arenaBlockSize) public Options setArenaBlockSize(final long arenaBlockSize) {
throws RocksDBException {
setArenaBlockSize(nativeHandle_, arenaBlockSize); setArenaBlockSize(nativeHandle_, arenaBlockSize);
return this; return this;
} }
@ -988,7 +981,7 @@ public class Options extends RocksObject
@Override @Override
public Options setInplaceUpdateNumLocks( public Options setInplaceUpdateNumLocks(
final long inplaceUpdateNumLocks) throws RocksDBException { final long inplaceUpdateNumLocks) {
setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks); setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks);
return this; return this;
} }
@ -1034,8 +1027,7 @@ public class Options extends RocksObject
} }
@Override @Override
public Options setMaxSuccessiveMerges(long maxSuccessiveMerges) public Options setMaxSuccessiveMerges(long maxSuccessiveMerges) {
throws RocksDBException {
setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges); setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges);
return this; return this;
} }
@ -1135,13 +1127,13 @@ public class Options extends RocksObject
long handle, int maxBackgroundFlushes); long handle, int maxBackgroundFlushes);
private native int maxBackgroundFlushes(long handle); private native int maxBackgroundFlushes(long handle);
private native void setMaxLogFileSize(long handle, long maxLogFileSize) private native void setMaxLogFileSize(long handle, long maxLogFileSize)
throws RocksDBException; throws IllegalArgumentException;
private native long maxLogFileSize(long handle); private native long maxLogFileSize(long handle);
private native void setLogFileTimeToRoll( private native void setLogFileTimeToRoll(
long handle, long logFileTimeToRoll) throws RocksDBException; long handle, long logFileTimeToRoll) throws IllegalArgumentException;
private native long logFileTimeToRoll(long handle); private native long logFileTimeToRoll(long handle);
private native void setKeepLogFileNum(long handle, long keepLogFileNum) private native void setKeepLogFileNum(long handle, long keepLogFileNum)
throws RocksDBException; throws IllegalArgumentException;
private native long keepLogFileNum(long handle); private native long keepLogFileNum(long handle);
private native void setMaxManifestFileSize( private native void setMaxManifestFileSize(
long handle, long maxManifestFileSize); long handle, long maxManifestFileSize);
@ -1157,7 +1149,7 @@ public class Options extends RocksObject
private native void setWalSizeLimitMB(long handle, long sizeLimitMB); private native void setWalSizeLimitMB(long handle, long sizeLimitMB);
private native long walSizeLimitMB(long handle); private native long walSizeLimitMB(long handle);
private native void setManifestPreallocationSize( private native void setManifestPreallocationSize(
long handle, long size) throws RocksDBException; long handle, long size) throws IllegalArgumentException;
private native long manifestPreallocationSize(long handle); private native long manifestPreallocationSize(long handle);
private native void setAllowOsBuffer( private native void setAllowOsBuffer(
long handle, boolean allowOsBuffer); long handle, boolean allowOsBuffer);
@ -1200,7 +1192,7 @@ public class Options extends RocksObject
private native void setMergeOperator( private native void setMergeOperator(
long handle, long mergeOperatorHandle); long handle, long mergeOperatorHandle);
private native void setWriteBufferSize(long handle, long writeBufferSize) private native void setWriteBufferSize(long handle, long writeBufferSize)
throws RocksDBException; throws IllegalArgumentException;
private native long writeBufferSize(long handle); private native long writeBufferSize(long handle);
private native void setMaxWriteBufferNumber( private native void setMaxWriteBufferNumber(
long handle, int maxWriteBufferNumber); long handle, int maxWriteBufferNumber);
@ -1262,7 +1254,7 @@ public class Options extends RocksObject
long handle, int rateLimitDelayMaxMilliseconds); long handle, int rateLimitDelayMaxMilliseconds);
private native int rateLimitDelayMaxMilliseconds(long handle); private native int rateLimitDelayMaxMilliseconds(long handle);
private native void setArenaBlockSize( private native void setArenaBlockSize(
long handle, long arenaBlockSize) throws RocksDBException; long handle, long arenaBlockSize) throws IllegalArgumentException;
private native long arenaBlockSize(long handle); private native long arenaBlockSize(long handle);
private native void setDisableAutoCompactions( private native void setDisableAutoCompactions(
long handle, boolean disableAutoCompactions); long handle, boolean disableAutoCompactions);
@ -1289,7 +1281,8 @@ public class Options extends RocksObject
long handle, boolean inplaceUpdateSupport); long handle, boolean inplaceUpdateSupport);
private native boolean inplaceUpdateSupport(long handle); private native boolean inplaceUpdateSupport(long handle);
private native void setInplaceUpdateNumLocks( private native void setInplaceUpdateNumLocks(
long handle, long inplaceUpdateNumLocks) throws RocksDBException; long handle, long inplaceUpdateNumLocks)
throws IllegalArgumentException;
private native long inplaceUpdateNumLocks(long handle); private native long inplaceUpdateNumLocks(long handle);
private native void setMemtablePrefixBloomBits( private native void setMemtablePrefixBloomBits(
long handle, int memtablePrefixBloomBits); long handle, int memtablePrefixBloomBits);
@ -1301,7 +1294,8 @@ public class Options extends RocksObject
long handle, int bloomLocality); long handle, int bloomLocality);
private native int bloomLocality(long handle); private native int bloomLocality(long handle);
private native void setMaxSuccessiveMerges( private native void setMaxSuccessiveMerges(
long handle, long maxSuccessiveMerges) throws RocksDBException; long handle, long maxSuccessiveMerges)
throws IllegalArgumentException;
private native long maxSuccessiveMerges(long handle); private native long maxSuccessiveMerges(long handle);
private native void setMinPartialMergeOperands( private native void setMinPartialMergeOperands(
long handle, int minPartialMergeOperands); long handle, int minPartialMergeOperands);

@ -43,7 +43,8 @@ public class SkipListMemTableConfig extends MemTableConfig {
return newMemTableFactoryHandle0(lookahead_); return newMemTableFactoryHandle0(lookahead_);
} }
private native long newMemTableFactoryHandle0(long lookahead); private native long newMemTableFactoryHandle0(long lookahead)
throws IllegalArgumentException;
private long lookahead_; private long lookahead_;
} }

@ -39,6 +39,7 @@ public class VectorMemTableConfig extends MemTableConfig {
return newMemTableFactoryHandle(reservedSize_); return newMemTableFactoryHandle(reservedSize_);
} }
private native long newMemTableFactoryHandle(long reservedSize); private native long newMemTableFactoryHandle(long reservedSize)
throws IllegalArgumentException;
private int reservedSize_; private int reservedSize_;
} }

Loading…
Cancel
Save