Treat negative values as no limit
This commit is contained in:
parent
5a1b41cee1
commit
d271cc5b4e
@ -29,14 +29,17 @@ package org.rocksdb;
|
|||||||
* useful for backing up in-memory databases where log file are persisted,
|
* useful for backing up in-memory databases where log file are persisted,
|
||||||
* but table files are in memory. Default: true
|
* but table files are in memory. Default: true
|
||||||
* @param backupRateLimit Max bytes that can be transferred in a second during
|
* @param backupRateLimit Max bytes that can be transferred in a second during
|
||||||
* backup. If 0, go as fast as you can. Default: 0
|
* backup. If 0 or negative, then go as fast as you can. Default: 0
|
||||||
* @param restoreRateLimit Max bytes that can be transferred in a second during
|
* @param restoreRateLimit Max bytes that can be transferred in a second during
|
||||||
* restore. If 0, go as fast as you can. Default: 0
|
* restore. If 0 or negative, then go as fast as you can. Default: 0
|
||||||
*/
|
*/
|
||||||
public class BackupableDBOptions extends RocksObject {
|
public class BackupableDBOptions extends RocksObject {
|
||||||
public BackupableDBOptions(String path, boolean shareTableFiles, boolean sync,
|
public BackupableDBOptions(String path, boolean shareTableFiles, boolean sync,
|
||||||
boolean destroyOldData, boolean backupLogFiles, long backupRateLimit,
|
boolean destroyOldData, boolean backupLogFiles, long backupRateLimit,
|
||||||
long restoreRateLimit) {
|
long restoreRateLimit) {
|
||||||
|
backupRateLimit = (backupRateLimit <= 0) ? 0 : backupRateLimit;
|
||||||
|
restoreRateLimit = (restoreRateLimit <= 0) ? 0 : restoreRateLimit;
|
||||||
|
|
||||||
super();
|
super();
|
||||||
newBackupableDBOptions(path, shareTableFiles, sync, destroyOldData,
|
newBackupableDBOptions(path, shareTableFiles, sync, destroyOldData,
|
||||||
backupLogFiles, backupRateLimit, restoreRateLimit);
|
backupLogFiles, backupRateLimit, restoreRateLimit);
|
||||||
|
@ -55,6 +55,9 @@ void Java_org_rocksdb_BackupableDBOptions_newBackupableDBOptions(
|
|||||||
JNIEnv* env, jobject jobj, jstring jpath, jboolean jshare_table_files,
|
JNIEnv* env, jobject jobj, jstring jpath, jboolean jshare_table_files,
|
||||||
jboolean jsync, jboolean jdestroy_old_data, jboolean jbackup_log_files,
|
jboolean jsync, jboolean jdestroy_old_data, jboolean jbackup_log_files,
|
||||||
jlong jbackup_rate_limit, jlong jrestore_rate_limit) {
|
jlong jbackup_rate_limit, jlong jrestore_rate_limit) {
|
||||||
|
jbackup_rate_limit = (jbackup_rate_limit <= 0) ? 0 : jbackup_rate_limit;
|
||||||
|
jrestore_rate_limit = (jrestore_rate_limit <= 0) ? 0 : jrestore_rate_limit;
|
||||||
|
|
||||||
const char* cpath = env->GetStringUTFChars(jpath, 0);
|
const char* cpath = env->GetStringUTFChars(jpath, 0);
|
||||||
|
|
||||||
auto bopt = new rocksdb::BackupableDBOptions(cpath, nullptr,
|
auto bopt = new rocksdb::BackupableDBOptions(cpath, nullptr,
|
||||||
|
Loading…
Reference in New Issue
Block a user