Remove obsolete backupable_db.h, utility_db.h (#9438)
Summary: This also removes the obsolete names BackupableDBOptions and UtilityDB. API users must now use BackupEngineOptions and DBWithTTL::Open. In C API, `rocksdb_backupable_db_*` is replaced `rocksdb_backup_engine_*`. Similar renaming in Java API. In reference to https://github.com/facebook/rocksdb/issues/9389 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9438 Test Plan: CI Reviewed By: mrambacher Differential Revision: D33780269 Pulled By: pdillinger fbshipit-source-id: 4a6cfc5c1b4c78bcad790b9d3dd13c5fdf4a1fac
This commit is contained in:
parent
ea89c77f27
commit
78aee6fedc
@ -6,6 +6,8 @@
|
|||||||
### Public API changes
|
### Public API changes
|
||||||
* Remove HDFS support from main repo.
|
* Remove HDFS support from main repo.
|
||||||
* Remove librados support from main repo.
|
* Remove librados support from main repo.
|
||||||
|
* Remove obsolete backupable_db.h and type alias `BackupableDBOptions`. Use backup_engine.h and `BackupEngineOptions`. Similar renamings are in the C and Java APIs.
|
||||||
|
* Removed obsolete utility_db.h and `UtilityDB::OpenTtlDB`. Use db_ttl.h and `DBWithTTL::Open`.
|
||||||
* Remove deprecated API DB::AddFile from main repo.
|
* Remove deprecated API DB::AddFile from main repo.
|
||||||
* Remove deprecated API ObjectLibrary::Register() and the (now obsolete) Regex public API. Use ObjectLibrary::AddFactory() with PatternEntry instead.
|
* Remove deprecated API ObjectLibrary::Register() and the (now obsolete) Regex public API. Use ObjectLibrary::AddFactory() with PatternEntry instead.
|
||||||
* Remove deprecated option DBOption::table_cache_remove_scan_count_limit.
|
* Remove deprecated option DBOption::table_cache_remove_scan_count_limit.
|
||||||
|
121
db/c.cc
121
db/c.cc
@ -35,7 +35,7 @@
|
|||||||
#include "rocksdb/status.h"
|
#include "rocksdb/status.h"
|
||||||
#include "rocksdb/table.h"
|
#include "rocksdb/table.h"
|
||||||
#include "rocksdb/universal_compaction.h"
|
#include "rocksdb/universal_compaction.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksdb/utilities/checkpoint.h"
|
#include "rocksdb/utilities/checkpoint.h"
|
||||||
#include "rocksdb/utilities/db_ttl.h"
|
#include "rocksdb/utilities/db_ttl.h"
|
||||||
#include "rocksdb/utilities/memory_util.h"
|
#include "rocksdb/utilities/memory_util.h"
|
||||||
@ -47,8 +47,8 @@
|
|||||||
#include "rocksdb/write_batch.h"
|
#include "rocksdb/write_batch.h"
|
||||||
#include "utilities/merge_operators.h"
|
#include "utilities/merge_operators.h"
|
||||||
|
|
||||||
using ROCKSDB_NAMESPACE::BackupableDBOptions;
|
|
||||||
using ROCKSDB_NAMESPACE::BackupEngine;
|
using ROCKSDB_NAMESPACE::BackupEngine;
|
||||||
|
using ROCKSDB_NAMESPACE::BackupEngineOptions;
|
||||||
using ROCKSDB_NAMESPACE::BackupID;
|
using ROCKSDB_NAMESPACE::BackupID;
|
||||||
using ROCKSDB_NAMESPACE::BackupInfo;
|
using ROCKSDB_NAMESPACE::BackupInfo;
|
||||||
using ROCKSDB_NAMESPACE::BatchResult;
|
using ROCKSDB_NAMESPACE::BatchResult;
|
||||||
@ -189,8 +189,8 @@ struct rocksdb_transaction_options_t {
|
|||||||
struct rocksdb_transaction_t {
|
struct rocksdb_transaction_t {
|
||||||
Transaction* rep;
|
Transaction* rep;
|
||||||
};
|
};
|
||||||
struct rocksdb_backupable_db_options_t {
|
struct rocksdb_backup_engine_options_t {
|
||||||
BackupableDBOptions rep;
|
BackupEngineOptions rep;
|
||||||
};
|
};
|
||||||
struct rocksdb_checkpoint_t {
|
struct rocksdb_checkpoint_t {
|
||||||
Checkpoint* rep;
|
Checkpoint* rep;
|
||||||
@ -547,12 +547,11 @@ rocksdb_t* rocksdb_open_as_secondary(const rocksdb_options_t* options,
|
|||||||
rocksdb_backup_engine_t* rocksdb_backup_engine_open(
|
rocksdb_backup_engine_t* rocksdb_backup_engine_open(
|
||||||
const rocksdb_options_t* options, const char* path, char** errptr) {
|
const rocksdb_options_t* options, const char* path, char** errptr) {
|
||||||
BackupEngine* be;
|
BackupEngine* be;
|
||||||
if (SaveError(errptr, BackupEngine::Open(options->rep.env,
|
if (SaveError(errptr, BackupEngine::Open(
|
||||||
BackupableDBOptions(path,
|
options->rep.env,
|
||||||
nullptr,
|
BackupEngineOptions(path, nullptr, true,
|
||||||
true,
|
options->rep.info_log.get()),
|
||||||
options->rep.info_log.get()),
|
&be))) {
|
||||||
&be))) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
rocksdb_backup_engine_t* result = new rocksdb_backup_engine_t;
|
rocksdb_backup_engine_t* result = new rocksdb_backup_engine_t;
|
||||||
@ -561,7 +560,7 @@ rocksdb_backup_engine_t* rocksdb_backup_engine_open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
rocksdb_backup_engine_t* rocksdb_backup_engine_open_opts(
|
rocksdb_backup_engine_t* rocksdb_backup_engine_open_opts(
|
||||||
const rocksdb_backupable_db_options_t* options, rocksdb_env_t* env,
|
const rocksdb_backup_engine_options_t* options, rocksdb_env_t* env,
|
||||||
char** errptr) {
|
char** errptr) {
|
||||||
BackupEngine* be;
|
BackupEngine* be;
|
||||||
if (SaveError(errptr, BackupEngine::Open(options->rep, env->rep, &be))) {
|
if (SaveError(errptr, BackupEngine::Open(options->rep, env->rep, &be))) {
|
||||||
@ -668,125 +667,125 @@ void rocksdb_backup_engine_close(rocksdb_backup_engine_t* be) {
|
|||||||
delete be;
|
delete be;
|
||||||
}
|
}
|
||||||
|
|
||||||
rocksdb_backupable_db_options_t* rocksdb_backupable_db_options_create(
|
rocksdb_backup_engine_options_t* rocksdb_backup_engine_options_create(
|
||||||
const char* backup_dir) {
|
const char* backup_dir) {
|
||||||
return new rocksdb_backupable_db_options_t{
|
return new rocksdb_backup_engine_options_t{
|
||||||
BackupableDBOptions(std::string(backup_dir))};
|
BackupEngineOptions(std::string(backup_dir))};
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_backup_dir(
|
void rocksdb_backup_engine_options_set_backup_dir(
|
||||||
rocksdb_backupable_db_options_t* options, const char* backup_dir) {
|
rocksdb_backup_engine_options_t* options, const char* backup_dir) {
|
||||||
options->rep.backup_dir = std::string(backup_dir);
|
options->rep.backup_dir = std::string(backup_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_env(
|
void rocksdb_backup_engine_options_set_env(
|
||||||
rocksdb_backupable_db_options_t* options, rocksdb_env_t* env) {
|
rocksdb_backup_engine_options_t* options, rocksdb_env_t* env) {
|
||||||
options->rep.backup_env = (env ? env->rep : nullptr);
|
options->rep.backup_env = (env ? env->rep : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_share_table_files(
|
void rocksdb_backup_engine_options_set_share_table_files(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val) {
|
rocksdb_backup_engine_options_t* options, unsigned char val) {
|
||||||
options->rep.share_table_files = val;
|
options->rep.share_table_files = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rocksdb_backupable_db_options_get_share_table_files(
|
unsigned char rocksdb_backup_engine_options_get_share_table_files(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.share_table_files;
|
return options->rep.share_table_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_sync(
|
void rocksdb_backup_engine_options_set_sync(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val) {
|
rocksdb_backup_engine_options_t* options, unsigned char val) {
|
||||||
options->rep.sync = val;
|
options->rep.sync = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rocksdb_backupable_db_options_get_sync(
|
unsigned char rocksdb_backup_engine_options_get_sync(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.sync;
|
return options->rep.sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_destroy_old_data(
|
void rocksdb_backup_engine_options_set_destroy_old_data(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val) {
|
rocksdb_backup_engine_options_t* options, unsigned char val) {
|
||||||
options->rep.destroy_old_data = val;
|
options->rep.destroy_old_data = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rocksdb_backupable_db_options_get_destroy_old_data(
|
unsigned char rocksdb_backup_engine_options_get_destroy_old_data(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.destroy_old_data;
|
return options->rep.destroy_old_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_backup_log_files(
|
void rocksdb_backup_engine_options_set_backup_log_files(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val) {
|
rocksdb_backup_engine_options_t* options, unsigned char val) {
|
||||||
options->rep.backup_log_files = val;
|
options->rep.backup_log_files = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rocksdb_backupable_db_options_get_backup_log_files(
|
unsigned char rocksdb_backup_engine_options_get_backup_log_files(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.backup_log_files;
|
return options->rep.backup_log_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_backup_rate_limit(
|
void rocksdb_backup_engine_options_set_backup_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options, uint64_t limit) {
|
rocksdb_backup_engine_options_t* options, uint64_t limit) {
|
||||||
options->rep.backup_rate_limit = limit;
|
options->rep.backup_rate_limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t rocksdb_backupable_db_options_get_backup_rate_limit(
|
uint64_t rocksdb_backup_engine_options_get_backup_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.backup_rate_limit;
|
return options->rep.backup_rate_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_restore_rate_limit(
|
void rocksdb_backup_engine_options_set_restore_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options, uint64_t limit) {
|
rocksdb_backup_engine_options_t* options, uint64_t limit) {
|
||||||
options->rep.restore_rate_limit = limit;
|
options->rep.restore_rate_limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t rocksdb_backupable_db_options_get_restore_rate_limit(
|
uint64_t rocksdb_backup_engine_options_get_restore_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.restore_rate_limit;
|
return options->rep.restore_rate_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_max_background_operations(
|
void rocksdb_backup_engine_options_set_max_background_operations(
|
||||||
rocksdb_backupable_db_options_t* options, int val) {
|
rocksdb_backup_engine_options_t* options, int val) {
|
||||||
options->rep.max_background_operations = val;
|
options->rep.max_background_operations = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rocksdb_backupable_db_options_get_max_background_operations(
|
int rocksdb_backup_engine_options_get_max_background_operations(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.max_background_operations;
|
return options->rep.max_background_operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_callback_trigger_interval_size(
|
void rocksdb_backup_engine_options_set_callback_trigger_interval_size(
|
||||||
rocksdb_backupable_db_options_t* options, uint64_t size) {
|
rocksdb_backup_engine_options_t* options, uint64_t size) {
|
||||||
options->rep.callback_trigger_interval_size = size;
|
options->rep.callback_trigger_interval_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t rocksdb_backupable_db_options_get_callback_trigger_interval_size(
|
uint64_t rocksdb_backup_engine_options_get_callback_trigger_interval_size(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.callback_trigger_interval_size;
|
return options->rep.callback_trigger_interval_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_max_valid_backups_to_open(
|
void rocksdb_backup_engine_options_set_max_valid_backups_to_open(
|
||||||
rocksdb_backupable_db_options_t* options, int val) {
|
rocksdb_backup_engine_options_t* options, int val) {
|
||||||
options->rep.max_valid_backups_to_open = val;
|
options->rep.max_valid_backups_to_open = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rocksdb_backupable_db_options_get_max_valid_backups_to_open(
|
int rocksdb_backup_engine_options_get_max_valid_backups_to_open(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return options->rep.max_valid_backups_to_open;
|
return options->rep.max_valid_backups_to_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_set_share_files_with_checksum_naming(
|
void rocksdb_backup_engine_options_set_share_files_with_checksum_naming(
|
||||||
rocksdb_backupable_db_options_t* options, int val) {
|
rocksdb_backup_engine_options_t* options, int val) {
|
||||||
options->rep.share_files_with_checksum_naming =
|
options->rep.share_files_with_checksum_naming =
|
||||||
static_cast<BackupableDBOptions::ShareFilesNaming>(val);
|
static_cast<BackupEngineOptions::ShareFilesNaming>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rocksdb_backupable_db_options_get_share_files_with_checksum_naming(
|
int rocksdb_backup_engine_options_get_share_files_with_checksum_naming(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
return static_cast<int>(options->rep.share_files_with_checksum_naming);
|
return static_cast<int>(options->rep.share_files_with_checksum_naming);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rocksdb_backupable_db_options_destroy(
|
void rocksdb_backup_engine_options_destroy(
|
||||||
rocksdb_backupable_db_options_t* options) {
|
rocksdb_backup_engine_options_t* options) {
|
||||||
delete options;
|
delete options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
46
db/c_test.c
46
db/c_test.c
@ -2495,51 +2495,51 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
StartPhase("backupable_db_option");
|
StartPhase("backupable_db_option");
|
||||||
{
|
{
|
||||||
rocksdb_backupable_db_options_t* bdo;
|
rocksdb_backup_engine_options_t* bdo;
|
||||||
bdo = rocksdb_backupable_db_options_create("path");
|
bdo = rocksdb_backup_engine_options_create("path");
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_share_table_files(bdo, 1);
|
rocksdb_backup_engine_options_set_share_table_files(bdo, 1);
|
||||||
CheckCondition(1 ==
|
CheckCondition(1 ==
|
||||||
rocksdb_backupable_db_options_get_share_table_files(bdo));
|
rocksdb_backup_engine_options_get_share_table_files(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_sync(bdo, 1);
|
rocksdb_backup_engine_options_set_sync(bdo, 1);
|
||||||
CheckCondition(1 == rocksdb_backupable_db_options_get_sync(bdo));
|
CheckCondition(1 == rocksdb_backup_engine_options_get_sync(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_destroy_old_data(bdo, 1);
|
rocksdb_backup_engine_options_set_destroy_old_data(bdo, 1);
|
||||||
CheckCondition(1 ==
|
CheckCondition(1 ==
|
||||||
rocksdb_backupable_db_options_get_destroy_old_data(bdo));
|
rocksdb_backup_engine_options_get_destroy_old_data(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_backup_log_files(bdo, 1);
|
rocksdb_backup_engine_options_set_backup_log_files(bdo, 1);
|
||||||
CheckCondition(1 ==
|
CheckCondition(1 ==
|
||||||
rocksdb_backupable_db_options_get_backup_log_files(bdo));
|
rocksdb_backup_engine_options_get_backup_log_files(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_backup_rate_limit(bdo, 123);
|
rocksdb_backup_engine_options_set_backup_rate_limit(bdo, 123);
|
||||||
CheckCondition(123 ==
|
CheckCondition(123 ==
|
||||||
rocksdb_backupable_db_options_get_backup_rate_limit(bdo));
|
rocksdb_backup_engine_options_get_backup_rate_limit(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_restore_rate_limit(bdo, 37);
|
rocksdb_backup_engine_options_set_restore_rate_limit(bdo, 37);
|
||||||
CheckCondition(37 ==
|
CheckCondition(37 ==
|
||||||
rocksdb_backupable_db_options_get_restore_rate_limit(bdo));
|
rocksdb_backup_engine_options_get_restore_rate_limit(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_max_background_operations(bdo, 20);
|
rocksdb_backup_engine_options_set_max_background_operations(bdo, 20);
|
||||||
CheckCondition(
|
CheckCondition(
|
||||||
20 == rocksdb_backupable_db_options_get_max_background_operations(bdo));
|
20 == rocksdb_backup_engine_options_get_max_background_operations(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_callback_trigger_interval_size(bdo, 9000);
|
rocksdb_backup_engine_options_set_callback_trigger_interval_size(bdo, 9000);
|
||||||
CheckCondition(
|
CheckCondition(
|
||||||
9000 ==
|
9000 ==
|
||||||
rocksdb_backupable_db_options_get_callback_trigger_interval_size(bdo));
|
rocksdb_backup_engine_options_get_callback_trigger_interval_size(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_max_valid_backups_to_open(bdo, 40);
|
rocksdb_backup_engine_options_set_max_valid_backups_to_open(bdo, 40);
|
||||||
CheckCondition(
|
CheckCondition(
|
||||||
40 == rocksdb_backupable_db_options_get_max_valid_backups_to_open(bdo));
|
40 == rocksdb_backup_engine_options_get_max_valid_backups_to_open(bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_set_share_files_with_checksum_naming(bdo, 2);
|
rocksdb_backup_engine_options_set_share_files_with_checksum_naming(bdo, 2);
|
||||||
CheckCondition(
|
CheckCondition(
|
||||||
2 == rocksdb_backupable_db_options_get_share_files_with_checksum_naming(
|
2 == rocksdb_backup_engine_options_get_share_files_with_checksum_naming(
|
||||||
bdo));
|
bdo));
|
||||||
|
|
||||||
rocksdb_backupable_db_options_destroy(bdo);
|
rocksdb_backup_engine_options_destroy(bdo);
|
||||||
}
|
}
|
||||||
|
|
||||||
StartPhase("compression_options");
|
StartPhase("compression_options");
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#include "rocksdb/slice.h"
|
#include "rocksdb/slice.h"
|
||||||
#include "rocksdb/slice_transform.h"
|
#include "rocksdb/slice_transform.h"
|
||||||
#include "rocksdb/statistics.h"
|
#include "rocksdb/statistics.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksdb/utilities/checkpoint.h"
|
#include "rocksdb/utilities/checkpoint.h"
|
||||||
#include "rocksdb/utilities/db_ttl.h"
|
#include "rocksdb/utilities/db_ttl.h"
|
||||||
#include "rocksdb/utilities/debug.h"
|
#include "rocksdb/utilities/debug.h"
|
||||||
|
@ -1404,7 +1404,7 @@ Status StressTest::TestBackupRestore(
|
|||||||
const std::vector<int64_t>& rand_keys) {
|
const std::vector<int64_t>& rand_keys) {
|
||||||
std::string backup_dir = FLAGS_db + "/.backup" + ToString(thread->tid);
|
std::string backup_dir = FLAGS_db + "/.backup" + ToString(thread->tid);
|
||||||
std::string restore_dir = FLAGS_db + "/.restore" + ToString(thread->tid);
|
std::string restore_dir = FLAGS_db + "/.restore" + ToString(thread->tid);
|
||||||
BackupableDBOptions backup_opts(backup_dir);
|
BackupEngineOptions backup_opts(backup_dir);
|
||||||
// For debugging, get info_log from live options
|
// For debugging, get info_log from live options
|
||||||
backup_opts.info_log = db_->GetDBOptions().info_log.get();
|
backup_opts.info_log = db_->GetDBOptions().info_log.get();
|
||||||
if (thread->rand.OneIn(10)) {
|
if (thread->rand.OneIn(10)) {
|
||||||
@ -1418,16 +1418,16 @@ Status StressTest::TestBackupRestore(
|
|||||||
if (thread->rand.OneIn(2)) {
|
if (thread->rand.OneIn(2)) {
|
||||||
// old
|
// old
|
||||||
backup_opts.share_files_with_checksum_naming =
|
backup_opts.share_files_with_checksum_naming =
|
||||||
BackupableDBOptions::kLegacyCrc32cAndFileSize;
|
BackupEngineOptions::kLegacyCrc32cAndFileSize;
|
||||||
} else {
|
} else {
|
||||||
// new
|
// new
|
||||||
backup_opts.share_files_with_checksum_naming =
|
backup_opts.share_files_with_checksum_naming =
|
||||||
BackupableDBOptions::kUseDbSessionId;
|
BackupEngineOptions::kUseDbSessionId;
|
||||||
}
|
}
|
||||||
if (thread->rand.OneIn(2)) {
|
if (thread->rand.OneIn(2)) {
|
||||||
backup_opts.share_files_with_checksum_naming =
|
backup_opts.share_files_with_checksum_naming =
|
||||||
backup_opts.share_files_with_checksum_naming |
|
backup_opts.share_files_with_checksum_naming |
|
||||||
BackupableDBOptions::kFlagIncludeFileSize;
|
BackupEngineOptions::kFlagIncludeFileSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ extern "C" {
|
|||||||
typedef struct rocksdb_t rocksdb_t;
|
typedef struct rocksdb_t rocksdb_t;
|
||||||
typedef struct rocksdb_backup_engine_t rocksdb_backup_engine_t;
|
typedef struct rocksdb_backup_engine_t rocksdb_backup_engine_t;
|
||||||
typedef struct rocksdb_backup_engine_info_t rocksdb_backup_engine_info_t;
|
typedef struct rocksdb_backup_engine_info_t rocksdb_backup_engine_info_t;
|
||||||
typedef struct rocksdb_backupable_db_options_t rocksdb_backupable_db_options_t;
|
typedef struct rocksdb_backup_engine_options_t rocksdb_backup_engine_options_t;
|
||||||
typedef struct rocksdb_restore_options_t rocksdb_restore_options_t;
|
typedef struct rocksdb_restore_options_t rocksdb_restore_options_t;
|
||||||
typedef struct rocksdb_memory_allocator_t rocksdb_memory_allocator_t;
|
typedef struct rocksdb_memory_allocator_t rocksdb_memory_allocator_t;
|
||||||
typedef struct rocksdb_lru_cache_options_t rocksdb_lru_cache_options_t;
|
typedef struct rocksdb_lru_cache_options_t rocksdb_lru_cache_options_t;
|
||||||
@ -149,7 +149,7 @@ extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_t* rocksdb_backup_engine_open(
|
|||||||
const rocksdb_options_t* options, const char* path, char** errptr);
|
const rocksdb_options_t* options, const char* path, char** errptr);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_t*
|
extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_t*
|
||||||
rocksdb_backup_engine_open_opts(const rocksdb_backupable_db_options_t* options,
|
rocksdb_backup_engine_open_opts(const rocksdb_backup_engine_options_t* options,
|
||||||
rocksdb_env_t* env, char** errptr);
|
rocksdb_env_t* env, char** errptr);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_create_new_backup(
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_create_new_backup(
|
||||||
@ -210,97 +210,97 @@ extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_info_destroy(
|
|||||||
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_close(
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_close(
|
||||||
rocksdb_backup_engine_t* be);
|
rocksdb_backup_engine_t* be);
|
||||||
|
|
||||||
/* BackupableDBOptions */
|
/* BackupEngineOptions */
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API rocksdb_backupable_db_options_t*
|
extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_options_t*
|
||||||
rocksdb_backupable_db_options_create(const char* backup_dir);
|
rocksdb_backup_engine_options_create(const char* backup_dir);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_set_backup_dir(
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_set_backup_dir(
|
||||||
rocksdb_backupable_db_options_t* options, const char* backup_dir);
|
rocksdb_backup_engine_options_t* options, const char* backup_dir);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_set_env(
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_set_env(
|
||||||
rocksdb_backupable_db_options_t* options, rocksdb_env_t* env);
|
rocksdb_backup_engine_options_t* options, rocksdb_env_t* env);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_share_table_files(
|
rocksdb_backup_engine_options_set_share_table_files(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val);
|
rocksdb_backup_engine_options_t* options, unsigned char val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API unsigned char
|
extern ROCKSDB_LIBRARY_API unsigned char
|
||||||
rocksdb_backupable_db_options_get_share_table_files(
|
rocksdb_backup_engine_options_get_share_table_files(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_set_sync(
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_set_sync(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val);
|
rocksdb_backup_engine_options_t* options, unsigned char val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_backupable_db_options_get_sync(
|
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_backup_engine_options_get_sync(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_destroy_old_data(
|
rocksdb_backup_engine_options_set_destroy_old_data(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val);
|
rocksdb_backup_engine_options_t* options, unsigned char val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API unsigned char
|
extern ROCKSDB_LIBRARY_API unsigned char
|
||||||
rocksdb_backupable_db_options_get_destroy_old_data(
|
rocksdb_backup_engine_options_get_destroy_old_data(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_backup_log_files(
|
rocksdb_backup_engine_options_set_backup_log_files(
|
||||||
rocksdb_backupable_db_options_t* options, unsigned char val);
|
rocksdb_backup_engine_options_t* options, unsigned char val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API unsigned char
|
extern ROCKSDB_LIBRARY_API unsigned char
|
||||||
rocksdb_backupable_db_options_get_backup_log_files(
|
rocksdb_backup_engine_options_get_backup_log_files(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_backup_rate_limit(
|
rocksdb_backup_engine_options_set_backup_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options, uint64_t limit);
|
rocksdb_backup_engine_options_t* options, uint64_t limit);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API uint64_t
|
extern ROCKSDB_LIBRARY_API uint64_t
|
||||||
rocksdb_backupable_db_options_get_backup_rate_limit(
|
rocksdb_backup_engine_options_get_backup_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_restore_rate_limit(
|
rocksdb_backup_engine_options_set_restore_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options, uint64_t limit);
|
rocksdb_backup_engine_options_t* options, uint64_t limit);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API uint64_t
|
extern ROCKSDB_LIBRARY_API uint64_t
|
||||||
rocksdb_backupable_db_options_get_restore_rate_limit(
|
rocksdb_backup_engine_options_get_restore_rate_limit(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_max_background_operations(
|
rocksdb_backup_engine_options_set_max_background_operations(
|
||||||
rocksdb_backupable_db_options_t* options, int val);
|
rocksdb_backup_engine_options_t* options, int val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API int
|
extern ROCKSDB_LIBRARY_API int
|
||||||
rocksdb_backupable_db_options_get_max_background_operations(
|
rocksdb_backup_engine_options_get_max_background_operations(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_callback_trigger_interval_size(
|
rocksdb_backup_engine_options_set_callback_trigger_interval_size(
|
||||||
rocksdb_backupable_db_options_t* options, uint64_t size);
|
rocksdb_backup_engine_options_t* options, uint64_t size);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API uint64_t
|
extern ROCKSDB_LIBRARY_API uint64_t
|
||||||
rocksdb_backupable_db_options_get_callback_trigger_interval_size(
|
rocksdb_backup_engine_options_get_callback_trigger_interval_size(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_max_valid_backups_to_open(
|
rocksdb_backup_engine_options_set_max_valid_backups_to_open(
|
||||||
rocksdb_backupable_db_options_t* options, int val);
|
rocksdb_backup_engine_options_t* options, int val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API int
|
extern ROCKSDB_LIBRARY_API int
|
||||||
rocksdb_backupable_db_options_get_max_valid_backups_to_open(
|
rocksdb_backup_engine_options_get_max_valid_backups_to_open(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void
|
extern ROCKSDB_LIBRARY_API void
|
||||||
rocksdb_backupable_db_options_set_share_files_with_checksum_naming(
|
rocksdb_backup_engine_options_set_share_files_with_checksum_naming(
|
||||||
rocksdb_backupable_db_options_t* options, int val);
|
rocksdb_backup_engine_options_t* options, int val);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API int
|
extern ROCKSDB_LIBRARY_API int
|
||||||
rocksdb_backupable_db_options_get_share_files_with_checksum_naming(
|
rocksdb_backup_engine_options_get_share_files_with_checksum_naming(
|
||||||
rocksdb_backupable_db_options_t* options);
|
rocksdb_backup_engine_options_t* options);
|
||||||
|
|
||||||
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_destroy(
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_destroy(
|
||||||
rocksdb_backupable_db_options_t*);
|
rocksdb_backup_engine_options_t*);
|
||||||
|
|
||||||
/* Checkpoint */
|
/* Checkpoint */
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
// Copyright (c) Facebook, Inc. and its affiliates. 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).
|
|
||||||
|
|
||||||
// This is a DEPRECATED header for API backward compatibility. Please
|
|
||||||
// use backup_engine.h.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#ifndef ROCKSDB_LITE
|
|
||||||
|
|
||||||
// A legacy unnecessary include
|
|
||||||
#include <cinttypes>
|
|
||||||
|
|
||||||
#include "rocksdb/utilities/backup_engine.h"
|
|
||||||
|
|
||||||
// A legacy unnecessary include
|
|
||||||
#include "rocksdb/utilities/stackable_db.h"
|
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
|
||||||
|
|
||||||
using BackupableDBOptions = BackupEngineOptions;
|
|
||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
|
||||||
|
|
||||||
#endif // ROCKSDB_LITE
|
|
@ -1,34 +0,0 @@
|
|||||||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
||||||
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#ifndef ROCKSDB_LITE
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "rocksdb/db.h"
|
|
||||||
#include "rocksdb/utilities/db_ttl.h"
|
|
||||||
#include "rocksdb/utilities/stackable_db.h"
|
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
|
||||||
|
|
||||||
// Please don't use this class. It's deprecated
|
|
||||||
class UtilityDB {
|
|
||||||
public:
|
|
||||||
// This function is here only for backwards compatibility. Please use the
|
|
||||||
// functions defined in DBWithTTl (rocksdb/utilities/db_ttl.h)
|
|
||||||
// (deprecated)
|
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
|
||||||
__attribute__((deprecated))
|
|
||||||
#elif _WIN32
|
|
||||||
__declspec(deprecated)
|
|
||||||
#endif
|
|
||||||
static Status
|
|
||||||
OpenTtlDB(const Options& options, const std::string& name,
|
|
||||||
StackableDB** dbptr, int32_t ttl = 0, bool read_only = false);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ROCKSDB_NAMESPACE
|
|
||||||
#endif // ROCKSDB_LITE
|
|
@ -106,7 +106,7 @@ set(JAVA_MAIN_CLASSES
|
|||||||
src/main/java/org/rocksdb/AdvancedColumnFamilyOptionsInterface.java
|
src/main/java/org/rocksdb/AdvancedColumnFamilyOptionsInterface.java
|
||||||
src/main/java/org/rocksdb/AdvancedMutableColumnFamilyOptionsInterface.java
|
src/main/java/org/rocksdb/AdvancedMutableColumnFamilyOptionsInterface.java
|
||||||
src/main/java/org/rocksdb/BackgroundErrorReason.java
|
src/main/java/org/rocksdb/BackgroundErrorReason.java
|
||||||
src/main/java/org/rocksdb/BackupableDBOptions.java
|
src/main/java/org/rocksdb/BackupEngineOptions.java
|
||||||
src/main/java/org/rocksdb/BackupEngine.java
|
src/main/java/org/rocksdb/BackupEngine.java
|
||||||
src/main/java/org/rocksdb/BackupInfo.java
|
src/main/java/org/rocksdb/BackupInfo.java
|
||||||
src/main/java/org/rocksdb/BlockBasedTableConfig.java
|
src/main/java/org/rocksdb/BlockBasedTableConfig.java
|
||||||
@ -421,7 +421,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.4" OR (${Java_VERSION_MINOR} STREQUAL "7"
|
|||||||
org.rocksdb.AbstractTraceWriter
|
org.rocksdb.AbstractTraceWriter
|
||||||
org.rocksdb.AbstractTransactionNotifier
|
org.rocksdb.AbstractTransactionNotifier
|
||||||
org.rocksdb.AbstractWalFilter
|
org.rocksdb.AbstractWalFilter
|
||||||
org.rocksdb.BackupableDBOptions
|
org.rocksdb.BackupEngineOptions
|
||||||
org.rocksdb.BackupEngine
|
org.rocksdb.BackupEngine
|
||||||
org.rocksdb.BlockBasedTableConfig
|
org.rocksdb.BlockBasedTableConfig
|
||||||
org.rocksdb.BloomFilter
|
org.rocksdb.BloomFilter
|
||||||
|
@ -9,7 +9,7 @@ NATIVE_JAVA_CLASSES = \
|
|||||||
org.rocksdb.AbstractTransactionNotifier\
|
org.rocksdb.AbstractTransactionNotifier\
|
||||||
org.rocksdb.AbstractWalFilter\
|
org.rocksdb.AbstractWalFilter\
|
||||||
org.rocksdb.BackupEngine\
|
org.rocksdb.BackupEngine\
|
||||||
org.rocksdb.BackupableDBOptions\
|
org.rocksdb.BackupEngineOptions\
|
||||||
org.rocksdb.BlockBasedTableConfig\
|
org.rocksdb.BlockBasedTableConfig\
|
||||||
org.rocksdb.BloomFilter\
|
org.rocksdb.BloomFilter\
|
||||||
org.rocksdb.Checkpoint\
|
org.rocksdb.Checkpoint\
|
||||||
@ -105,7 +105,7 @@ ARCH := $(shell getconf LONG_BIT)
|
|||||||
SHA256_CMD ?= sha256sum
|
SHA256_CMD ?= sha256sum
|
||||||
|
|
||||||
JAVA_TESTS = \
|
JAVA_TESTS = \
|
||||||
org.rocksdb.BackupableDBOptionsTest\
|
org.rocksdb.BackupEngineOptionsTest\
|
||||||
org.rocksdb.BackupEngineTest\
|
org.rocksdb.BackupEngineTest\
|
||||||
org.rocksdb.BlobOptionsTest\
|
org.rocksdb.BlobOptionsTest\
|
||||||
org.rocksdb.BlockBasedTableConfigTest\
|
org.rocksdb.BlockBasedTableConfigTest\
|
||||||
|
@ -5,103 +5,104 @@
|
|||||||
//
|
//
|
||||||
// This file implements the "bridge" between Java and C++ and enables
|
// This file implements the "bridge" between Java and C++ and enables
|
||||||
// calling c++ ROCKSDB_NAMESPACE::BackupEnginge and
|
// calling c++ ROCKSDB_NAMESPACE::BackupEnginge and
|
||||||
// ROCKSDB_NAMESPACE::BackupableDBOptions methods from Java side.
|
// ROCKSDB_NAMESPACE::BackupEngineOptions methods from Java side.
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "include/org_rocksdb_BackupableDBOptions.h"
|
#include "include/org_rocksdb_BackupEngineOptions.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksjni/portal.h"
|
#include "rocksjni/portal.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// BackupDBOptions
|
// BackupDBOptions
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: newBackupableDBOptions
|
* Method: newBackupEngineOptions
|
||||||
* Signature: (Ljava/lang/String;)J
|
* Signature: (Ljava/lang/String;)J
|
||||||
*/
|
*/
|
||||||
jlong Java_org_rocksdb_BackupableDBOptions_newBackupableDBOptions(
|
jlong Java_org_rocksdb_BackupEngineOptions_newBackupEngineOptions(
|
||||||
JNIEnv* env, jclass /*jcls*/, jstring jpath) {
|
JNIEnv* env, jclass /*jcls*/, jstring jpath) {
|
||||||
const char* cpath = env->GetStringUTFChars(jpath, nullptr);
|
const char* cpath = env->GetStringUTFChars(jpath, nullptr);
|
||||||
if (cpath == nullptr) {
|
if (cpath == nullptr) {
|
||||||
// exception thrown: OutOfMemoryError
|
// exception thrown: OutOfMemoryError
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
auto* bopt = new ROCKSDB_NAMESPACE::BackupableDBOptions(cpath);
|
auto* bopt = new ROCKSDB_NAMESPACE::BackupEngineOptions(cpath);
|
||||||
env->ReleaseStringUTFChars(jpath, cpath);
|
env->ReleaseStringUTFChars(jpath, cpath);
|
||||||
return reinterpret_cast<jlong>(bopt);
|
return reinterpret_cast<jlong>(bopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: backupDir
|
* Method: backupDir
|
||||||
* Signature: (J)Ljava/lang/String;
|
* Signature: (J)Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
jstring Java_org_rocksdb_BackupableDBOptions_backupDir(JNIEnv* env,
|
jstring Java_org_rocksdb_BackupEngineOptions_backupDir(JNIEnv* env,
|
||||||
jobject /*jopt*/,
|
jobject /*jopt*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return env->NewStringUTF(bopt->backup_dir.c_str());
|
return env->NewStringUTF(bopt->backup_dir.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setBackupEnv
|
* Method: setBackupEnv
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setBackupEnv(
|
void Java_org_rocksdb_BackupEngineOptions_setBackupEnv(
|
||||||
JNIEnv* /*env*/, jobject /*jopt*/, jlong jhandle, jlong jrocks_env_handle) {
|
JNIEnv* /*env*/, jobject /*jopt*/, jlong jhandle, jlong jrocks_env_handle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
auto* rocks_env =
|
auto* rocks_env =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(jrocks_env_handle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(jrocks_env_handle);
|
||||||
bopt->backup_env = rocks_env;
|
bopt->backup_env = rocks_env;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setShareTableFiles
|
* Method: setShareTableFiles
|
||||||
* Signature: (JZ)V
|
* Signature: (JZ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setShareTableFiles(JNIEnv* /*env*/,
|
void Java_org_rocksdb_BackupEngineOptions_setShareTableFiles(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle,
|
jlong jhandle,
|
||||||
jboolean flag) {
|
jboolean flag) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->share_table_files = flag;
|
bopt->share_table_files = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: shareTableFiles
|
* Method: shareTableFiles
|
||||||
* Signature: (J)Z
|
* Signature: (J)Z
|
||||||
*/
|
*/
|
||||||
jboolean Java_org_rocksdb_BackupableDBOptions_shareTableFiles(JNIEnv* /*env*/,
|
jboolean Java_org_rocksdb_BackupEngineOptions_shareTableFiles(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->share_table_files;
|
return bopt->share_table_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setInfoLog
|
* Method: setInfoLog
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setInfoLog(JNIEnv* /*env*/,
|
void Java_org_rocksdb_BackupEngineOptions_setInfoLog(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle,
|
jlong jhandle,
|
||||||
jlong /*jlogger_handle*/) {
|
jlong /*jlogger_handle*/) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
auto* sptr_logger =
|
auto* sptr_logger =
|
||||||
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::LoggerJniCallback>*>(
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::LoggerJniCallback>*>(
|
||||||
jhandle);
|
jhandle);
|
||||||
@ -109,122 +110,122 @@ void Java_org_rocksdb_BackupableDBOptions_setInfoLog(JNIEnv* /*env*/,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setSync
|
* Method: setSync
|
||||||
* Signature: (JZ)V
|
* Signature: (JZ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setSync(JNIEnv* /*env*/,
|
void Java_org_rocksdb_BackupEngineOptions_setSync(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle,
|
jlong jhandle,
|
||||||
jboolean flag) {
|
jboolean flag) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->sync = flag;
|
bopt->sync = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: sync
|
* Method: sync
|
||||||
* Signature: (J)Z
|
* Signature: (J)Z
|
||||||
*/
|
*/
|
||||||
jboolean Java_org_rocksdb_BackupableDBOptions_sync(JNIEnv* /*env*/,
|
jboolean Java_org_rocksdb_BackupEngineOptions_sync(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->sync;
|
return bopt->sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setDestroyOldData
|
* Method: setDestroyOldData
|
||||||
* Signature: (JZ)V
|
* Signature: (JZ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setDestroyOldData(JNIEnv* /*env*/,
|
void Java_org_rocksdb_BackupEngineOptions_setDestroyOldData(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle,
|
jlong jhandle,
|
||||||
jboolean flag) {
|
jboolean flag) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->destroy_old_data = flag;
|
bopt->destroy_old_data = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: destroyOldData
|
* Method: destroyOldData
|
||||||
* Signature: (J)Z
|
* Signature: (J)Z
|
||||||
*/
|
*/
|
||||||
jboolean Java_org_rocksdb_BackupableDBOptions_destroyOldData(JNIEnv* /*env*/,
|
jboolean Java_org_rocksdb_BackupEngineOptions_destroyOldData(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->destroy_old_data;
|
return bopt->destroy_old_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setBackupLogFiles
|
* Method: setBackupLogFiles
|
||||||
* Signature: (JZ)V
|
* Signature: (JZ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setBackupLogFiles(JNIEnv* /*env*/,
|
void Java_org_rocksdb_BackupEngineOptions_setBackupLogFiles(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle,
|
jlong jhandle,
|
||||||
jboolean flag) {
|
jboolean flag) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->backup_log_files = flag;
|
bopt->backup_log_files = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: backupLogFiles
|
* Method: backupLogFiles
|
||||||
* Signature: (J)Z
|
* Signature: (J)Z
|
||||||
*/
|
*/
|
||||||
jboolean Java_org_rocksdb_BackupableDBOptions_backupLogFiles(JNIEnv* /*env*/,
|
jboolean Java_org_rocksdb_BackupEngineOptions_backupLogFiles(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->backup_log_files;
|
return bopt->backup_log_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setBackupRateLimit
|
* Method: setBackupRateLimit
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimit(
|
void Java_org_rocksdb_BackupEngineOptions_setBackupRateLimit(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
||||||
jlong jbackup_rate_limit) {
|
jlong jbackup_rate_limit) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->backup_rate_limit = jbackup_rate_limit;
|
bopt->backup_rate_limit = jbackup_rate_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: backupRateLimit
|
* Method: backupRateLimit
|
||||||
* Signature: (J)J
|
* Signature: (J)J
|
||||||
*/
|
*/
|
||||||
jlong Java_org_rocksdb_BackupableDBOptions_backupRateLimit(JNIEnv* /*env*/,
|
jlong Java_org_rocksdb_BackupEngineOptions_backupRateLimit(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->backup_rate_limit;
|
return bopt->backup_rate_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setBackupRateLimiter
|
* Method: setBackupRateLimiter
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimiter(
|
void Java_org_rocksdb_BackupEngineOptions_setBackupRateLimiter(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
||||||
jlong jrate_limiter_handle) {
|
jlong jrate_limiter_handle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
auto* sptr_rate_limiter =
|
auto* sptr_rate_limiter =
|
||||||
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
|
||||||
jrate_limiter_handle);
|
jrate_limiter_handle);
|
||||||
@ -232,41 +233,41 @@ void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimiter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setRestoreRateLimit
|
* Method: setRestoreRateLimit
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimit(
|
void Java_org_rocksdb_BackupEngineOptions_setRestoreRateLimit(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
||||||
jlong jrestore_rate_limit) {
|
jlong jrestore_rate_limit) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->restore_rate_limit = jrestore_rate_limit;
|
bopt->restore_rate_limit = jrestore_rate_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: restoreRateLimit
|
* Method: restoreRateLimit
|
||||||
* Signature: (J)J
|
* Signature: (J)J
|
||||||
*/
|
*/
|
||||||
jlong Java_org_rocksdb_BackupableDBOptions_restoreRateLimit(JNIEnv* /*env*/,
|
jlong Java_org_rocksdb_BackupEngineOptions_restoreRateLimit(JNIEnv* /*env*/,
|
||||||
jobject /*jobj*/,
|
jobject /*jobj*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->restore_rate_limit;
|
return bopt->restore_rate_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setRestoreRateLimiter
|
* Method: setRestoreRateLimiter
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimiter(
|
void Java_org_rocksdb_BackupEngineOptions_setRestoreRateLimiter(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
||||||
jlong jrate_limiter_handle) {
|
jlong jrate_limiter_handle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
auto* sptr_rate_limiter =
|
auto* sptr_rate_limiter =
|
||||||
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
|
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
|
||||||
jrate_limiter_handle);
|
jrate_limiter_handle);
|
||||||
@ -274,90 +275,90 @@ void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimiter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setShareFilesWithChecksum
|
* Method: setShareFilesWithChecksum
|
||||||
* Signature: (JZ)V
|
* Signature: (JZ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setShareFilesWithChecksum(
|
void Java_org_rocksdb_BackupEngineOptions_setShareFilesWithChecksum(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) {
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->share_files_with_checksum = flag;
|
bopt->share_files_with_checksum = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: shareFilesWithChecksum
|
* Method: shareFilesWithChecksum
|
||||||
* Signature: (J)Z
|
* Signature: (J)Z
|
||||||
*/
|
*/
|
||||||
jboolean Java_org_rocksdb_BackupableDBOptions_shareFilesWithChecksum(
|
jboolean Java_org_rocksdb_BackupEngineOptions_shareFilesWithChecksum(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return bopt->share_files_with_checksum;
|
return bopt->share_files_with_checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setMaxBackgroundOperations
|
* Method: setMaxBackgroundOperations
|
||||||
* Signature: (JI)V
|
* Signature: (JI)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setMaxBackgroundOperations(
|
void Java_org_rocksdb_BackupEngineOptions_setMaxBackgroundOperations(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
||||||
jint max_background_operations) {
|
jint max_background_operations) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->max_background_operations = static_cast<int>(max_background_operations);
|
bopt->max_background_operations = static_cast<int>(max_background_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: maxBackgroundOperations
|
* Method: maxBackgroundOperations
|
||||||
* Signature: (J)I
|
* Signature: (J)I
|
||||||
*/
|
*/
|
||||||
jint Java_org_rocksdb_BackupableDBOptions_maxBackgroundOperations(
|
jint Java_org_rocksdb_BackupEngineOptions_maxBackgroundOperations(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return static_cast<jint>(bopt->max_background_operations);
|
return static_cast<jint>(bopt->max_background_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: setCallbackTriggerIntervalSize
|
* Method: setCallbackTriggerIntervalSize
|
||||||
* Signature: (JJ)V
|
* Signature: (JJ)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_setCallbackTriggerIntervalSize(
|
void Java_org_rocksdb_BackupEngineOptions_setCallbackTriggerIntervalSize(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
|
||||||
jlong jcallback_trigger_interval_size) {
|
jlong jcallback_trigger_interval_size) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
bopt->callback_trigger_interval_size =
|
bopt->callback_trigger_interval_size =
|
||||||
static_cast<uint64_t>(jcallback_trigger_interval_size);
|
static_cast<uint64_t>(jcallback_trigger_interval_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: callbackTriggerIntervalSize
|
* Method: callbackTriggerIntervalSize
|
||||||
* Signature: (J)J
|
* Signature: (J)J
|
||||||
*/
|
*/
|
||||||
jlong Java_org_rocksdb_BackupableDBOptions_callbackTriggerIntervalSize(
|
jlong Java_org_rocksdb_BackupEngineOptions_callbackTriggerIntervalSize(
|
||||||
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
return static_cast<jlong>(bopt->callback_trigger_interval_size);
|
return static_cast<jlong>(bopt->callback_trigger_interval_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_BackupableDBOptions
|
* Class: org_rocksdb_BackupEngineOptions
|
||||||
* Method: disposeInternal
|
* Method: disposeInternal
|
||||||
* Signature: (J)V
|
* Signature: (J)V
|
||||||
*/
|
*/
|
||||||
void Java_org_rocksdb_BackupableDBOptions_disposeInternal(JNIEnv* /*env*/,
|
void Java_org_rocksdb_BackupEngineOptions_disposeInternal(JNIEnv* /*env*/,
|
||||||
jobject /*jopt*/,
|
jobject /*jopt*/,
|
||||||
jlong jhandle) {
|
jlong jhandle) {
|
||||||
auto* bopt =
|
auto* bopt =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
|
||||||
assert(bopt != nullptr);
|
assert(bopt != nullptr);
|
||||||
delete bopt;
|
delete bopt;
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,11 @@
|
|||||||
// calling C++ ROCKSDB_NAMESPACE::BackupEngine methods from the Java side.
|
// calling C++ ROCKSDB_NAMESPACE::BackupEngine methods from the Java side.
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "include/org_rocksdb_BackupEngine.h"
|
#include "include/org_rocksdb_BackupEngine.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksjni/portal.h"
|
#include "rocksjni/portal.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -20,14 +21,14 @@
|
|||||||
*/
|
*/
|
||||||
jlong Java_org_rocksdb_BackupEngine_open(JNIEnv* env, jclass /*jcls*/,
|
jlong Java_org_rocksdb_BackupEngine_open(JNIEnv* env, jclass /*jcls*/,
|
||||||
jlong env_handle,
|
jlong env_handle,
|
||||||
jlong backupable_db_options_handle) {
|
jlong backup_engine_options_handle) {
|
||||||
auto* rocks_env = reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(env_handle);
|
auto* rocks_env = reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(env_handle);
|
||||||
auto* backupable_db_options =
|
auto* backup_engine_options =
|
||||||
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(
|
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(
|
||||||
backupable_db_options_handle);
|
backup_engine_options_handle);
|
||||||
ROCKSDB_NAMESPACE::BackupEngine* backup_engine;
|
ROCKSDB_NAMESPACE::BackupEngine* backup_engine;
|
||||||
auto status = ROCKSDB_NAMESPACE::BackupEngine::Open(
|
auto status = ROCKSDB_NAMESPACE::BackupEngine::Open(
|
||||||
rocks_env, *backupable_db_options, &backup_engine);
|
rocks_env, *backup_engine_options, &backup_engine);
|
||||||
|
|
||||||
if (status.ok()) {
|
if (status.ok()) {
|
||||||
return reinterpret_cast<jlong>(backup_engine);
|
return reinterpret_cast<jlong>(backup_engine);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "rocksdb/rate_limiter.h"
|
#include "rocksdb/rate_limiter.h"
|
||||||
#include "rocksdb/status.h"
|
#include "rocksdb/status.h"
|
||||||
#include "rocksdb/table.h"
|
#include "rocksdb/table.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksdb/utilities/memory_util.h"
|
#include "rocksdb/utilities/memory_util.h"
|
||||||
#include "rocksdb/utilities/transaction_db.h"
|
#include "rocksdb/utilities/transaction_db.h"
|
||||||
#include "rocksdb/utilities/write_batch_with_index.h"
|
#include "rocksdb/utilities/write_batch_with_index.h"
|
||||||
@ -3409,13 +3409,13 @@ class HistogramDataJni : public JavaClass {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// The portal class for org.rocksdb.BackupableDBOptions
|
// The portal class for org.rocksdb.BackupEngineOptions
|
||||||
class BackupableDBOptionsJni
|
class BackupEngineOptionsJni
|
||||||
: public RocksDBNativeClass<ROCKSDB_NAMESPACE::BackupableDBOptions*,
|
: public RocksDBNativeClass<ROCKSDB_NAMESPACE::BackupEngineOptions*,
|
||||||
BackupableDBOptionsJni> {
|
BackupEngineOptionsJni> {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Get the Java Class org.rocksdb.BackupableDBOptions
|
* Get the Java Class org.rocksdb.BackupEngineOptions
|
||||||
*
|
*
|
||||||
* @param env A pointer to the Java environment
|
* @param env A pointer to the Java environment
|
||||||
*
|
*
|
||||||
@ -3425,7 +3425,7 @@ class BackupableDBOptionsJni
|
|||||||
*/
|
*/
|
||||||
static jclass getJClass(JNIEnv* env) {
|
static jclass getJClass(JNIEnv* env) {
|
||||||
return RocksDBNativeClass::getJClass(env,
|
return RocksDBNativeClass::getJClass(env,
|
||||||
"org/rocksdb/BackupableDBOptions");
|
"org/rocksdb/BackupEngineOptions");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,10 +10,11 @@
|
|||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "include/org_rocksdb_RestoreOptions.h"
|
#include "include/org_rocksdb_RestoreOptions.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksjni/portal.h"
|
#include "rocksjni/portal.h"
|
||||||
/*
|
/*
|
||||||
* Class: org_rocksdb_RestoreOptions
|
* Class: org_rocksdb_RestoreOptions
|
||||||
|
@ -32,8 +32,8 @@ public class BackupEngine extends RocksObject implements AutoCloseable {
|
|||||||
* @return A new BackupEngine instance
|
* @return A new BackupEngine instance
|
||||||
* @throws RocksDBException thrown if the backup engine could not be opened
|
* @throws RocksDBException thrown if the backup engine could not be opened
|
||||||
*/
|
*/
|
||||||
public static BackupEngine open(final Env env,
|
public static BackupEngine open(final Env env, final BackupEngineOptions options)
|
||||||
final BackupableDBOptions options) throws RocksDBException {
|
throws RocksDBException {
|
||||||
return new BackupEngine(open(env.nativeHandle_, options.nativeHandle_));
|
return new BackupEngine(open(env.nativeHandle_, options.nativeHandle_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ package org.rocksdb;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>BackupableDBOptions to control the behavior of a backupable database.
|
* <p>BackupEngineOptions to control the behavior of a backupable database.
|
||||||
* It will be used during the creation of a {@link org.rocksdb.BackupEngine}.
|
* It will be used during the creation of a {@link org.rocksdb.BackupEngine}.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>Note that dispose() must be called before an Options instance
|
* <p>Note that dispose() must be called before an Options instance
|
||||||
@ -16,22 +16,21 @@ import java.io.File;
|
|||||||
*
|
*
|
||||||
* @see org.rocksdb.BackupEngine
|
* @see org.rocksdb.BackupEngine
|
||||||
*/
|
*/
|
||||||
public class BackupableDBOptions extends RocksObject {
|
public class BackupEngineOptions extends RocksObject {
|
||||||
|
|
||||||
private Env backupEnv = null;
|
private Env backupEnv = null;
|
||||||
private Logger infoLog = null;
|
private Logger infoLog = null;
|
||||||
private RateLimiter backupRateLimiter = null;
|
private RateLimiter backupRateLimiter = null;
|
||||||
private RateLimiter restoreRateLimiter = null;
|
private RateLimiter restoreRateLimiter = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>BackupableDBOptions constructor.</p>
|
* <p>BackupEngineOptions constructor.</p>
|
||||||
*
|
*
|
||||||
* @param path Where to keep the backup files. Has to be different than db
|
* @param path Where to keep the backup files. Has to be different than db
|
||||||
* name. Best to set this to {@code db name_ + "/backups"}
|
* name. Best to set this to {@code db name_ + "/backups"}
|
||||||
* @throws java.lang.IllegalArgumentException if illegal path is used.
|
* @throws java.lang.IllegalArgumentException if illegal path is used.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions(final String path) {
|
public BackupEngineOptions(final String path) {
|
||||||
super(newBackupableDBOptions(ensureWritableFile(path)));
|
super(newBackupEngineOptions(ensureWritableFile(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String ensureWritableFile(final String path) {
|
private static String ensureWritableFile(final String path) {
|
||||||
@ -45,9 +44,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Returns the path to the BackupableDB directory.</p>
|
* <p>Returns the path to the BackupEngine directory.</p>
|
||||||
*
|
*
|
||||||
* @return the path to the BackupableDB directory.
|
* @return the path to the BackupEngine directory.
|
||||||
*/
|
*/
|
||||||
public String backupDir() {
|
public String backupDir() {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
@ -62,9 +61,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
* Default: null
|
* Default: null
|
||||||
*
|
*
|
||||||
* @param env The environment to use
|
* @param env The environment to use
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setBackupEnv(final Env env) {
|
public BackupEngineOptions setBackupEnv(final Env env) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setBackupEnv(nativeHandle_, env.nativeHandle_);
|
setBackupEnv(nativeHandle_, env.nativeHandle_);
|
||||||
this.backupEnv = env;
|
this.backupEnv = env;
|
||||||
@ -95,9 +94,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: true</p>
|
* <p>Default: true</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setShareTableFiles(final boolean shareTableFiles) {
|
public BackupEngineOptions setShareTableFiles(final boolean shareTableFiles) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setShareTableFiles(nativeHandle_, shareTableFiles);
|
setShareTableFiles(nativeHandle_, shareTableFiles);
|
||||||
return this;
|
return this;
|
||||||
@ -118,9 +117,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
* Set the logger to use for Backup info and error messages
|
* Set the logger to use for Backup info and error messages
|
||||||
*
|
*
|
||||||
* @param logger The logger to use for the backup
|
* @param logger The logger to use for the backup
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setInfoLog(final Logger logger) {
|
public BackupEngineOptions setInfoLog(final Logger logger) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setInfoLog(nativeHandle_, logger.nativeHandle_);
|
setInfoLog(nativeHandle_, logger.nativeHandle_);
|
||||||
this.infoLog = logger;
|
this.infoLog = logger;
|
||||||
@ -148,9 +147,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: true</p>
|
* <p>Default: true</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setSync(final boolean sync) {
|
public BackupEngineOptions setSync(final boolean sync) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setSync(nativeHandle_, sync);
|
setSync(nativeHandle_, sync);
|
||||||
return this;
|
return this;
|
||||||
@ -174,9 +173,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: false</p>
|
* <p>Default: false</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setDestroyOldData(final boolean destroyOldData) {
|
public BackupEngineOptions setDestroyOldData(final boolean destroyOldData) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setDestroyOldData(nativeHandle_, destroyOldData);
|
setDestroyOldData(nativeHandle_, destroyOldData);
|
||||||
return this;
|
return this;
|
||||||
@ -201,9 +200,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: true</p>
|
* <p>Default: true</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setBackupLogFiles(final boolean backupLogFiles) {
|
public BackupEngineOptions setBackupLogFiles(final boolean backupLogFiles) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setBackupLogFiles(nativeHandle_, backupLogFiles);
|
setBackupLogFiles(nativeHandle_, backupLogFiles);
|
||||||
return this;
|
return this;
|
||||||
@ -227,9 +226,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: 0</p>
|
* <p>Default: 0</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setBackupRateLimit(long backupRateLimit) {
|
public BackupEngineOptions setBackupRateLimit(long backupRateLimit) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
backupRateLimit = (backupRateLimit <= 0) ? 0 : backupRateLimit;
|
backupRateLimit = (backupRateLimit <= 0) ? 0 : backupRateLimit;
|
||||||
setBackupRateLimit(nativeHandle_, backupRateLimit);
|
setBackupRateLimit(nativeHandle_, backupRateLimit);
|
||||||
@ -255,9 +254,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
* Default: null
|
* Default: null
|
||||||
*
|
*
|
||||||
* @param backupRateLimiter The rate limiter to use for the backup
|
* @param backupRateLimiter The rate limiter to use for the backup
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setBackupRateLimiter(final RateLimiter backupRateLimiter) {
|
public BackupEngineOptions setBackupRateLimiter(final RateLimiter backupRateLimiter) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setBackupRateLimiter(nativeHandle_, backupRateLimiter.nativeHandle_);
|
setBackupRateLimiter(nativeHandle_, backupRateLimiter.nativeHandle_);
|
||||||
this.backupRateLimiter = backupRateLimiter;
|
this.backupRateLimiter = backupRateLimiter;
|
||||||
@ -285,9 +284,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: 0</p>
|
* <p>Default: 0</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setRestoreRateLimit(long restoreRateLimit) {
|
public BackupEngineOptions setRestoreRateLimit(long restoreRateLimit) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
restoreRateLimit = (restoreRateLimit <= 0) ? 0 : restoreRateLimit;
|
restoreRateLimit = (restoreRateLimit <= 0) ? 0 : restoreRateLimit;
|
||||||
setRestoreRateLimit(nativeHandle_, restoreRateLimit);
|
setRestoreRateLimit(nativeHandle_, restoreRateLimit);
|
||||||
@ -313,9 +312,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
* Default: null
|
* Default: null
|
||||||
*
|
*
|
||||||
* @param restoreRateLimiter The rate limiter to use during restore
|
* @param restoreRateLimiter The rate limiter to use during restore
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setRestoreRateLimiter(final RateLimiter restoreRateLimiter) {
|
public BackupEngineOptions setRestoreRateLimiter(final RateLimiter restoreRateLimiter) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setRestoreRateLimiter(nativeHandle_, restoreRateLimiter.nativeHandle_);
|
setRestoreRateLimiter(nativeHandle_, restoreRateLimiter.nativeHandle_);
|
||||||
this.restoreRateLimiter = restoreRateLimiter;
|
this.restoreRateLimiter = restoreRateLimiter;
|
||||||
@ -349,10 +348,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* <p>Default: false</p>
|
* <p>Default: false</p>
|
||||||
*
|
*
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setShareFilesWithChecksum(
|
public BackupEngineOptions setShareFilesWithChecksum(final boolean shareFilesWithChecksum) {
|
||||||
final boolean shareFilesWithChecksum) {
|
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setShareFilesWithChecksum(nativeHandle_, shareFilesWithChecksum);
|
setShareFilesWithChecksum(nativeHandle_, shareFilesWithChecksum);
|
||||||
return this;
|
return this;
|
||||||
@ -377,10 +375,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
* Default: 1
|
* Default: 1
|
||||||
*
|
*
|
||||||
* @param maxBackgroundOperations The maximum number of background threads
|
* @param maxBackgroundOperations The maximum number of background threads
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setMaxBackgroundOperations(
|
public BackupEngineOptions setMaxBackgroundOperations(final int maxBackgroundOperations) {
|
||||||
final int maxBackgroundOperations) {
|
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setMaxBackgroundOperations(nativeHandle_, maxBackgroundOperations);
|
setMaxBackgroundOperations(nativeHandle_, maxBackgroundOperations);
|
||||||
return this;
|
return this;
|
||||||
@ -408,9 +405,9 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
*
|
*
|
||||||
* @param callbackTriggerIntervalSize The interval size for the
|
* @param callbackTriggerIntervalSize The interval size for the
|
||||||
* callback trigger
|
* callback trigger
|
||||||
* @return instance of current BackupableDBOptions.
|
* @return instance of current BackupEngineOptions.
|
||||||
*/
|
*/
|
||||||
public BackupableDBOptions setCallbackTriggerIntervalSize(
|
public BackupEngineOptions setCallbackTriggerIntervalSize(
|
||||||
final long callbackTriggerIntervalSize) {
|
final long callbackTriggerIntervalSize) {
|
||||||
assert(isOwningHandle());
|
assert(isOwningHandle());
|
||||||
setCallbackTriggerIntervalSize(nativeHandle_, callbackTriggerIntervalSize);
|
setCallbackTriggerIntervalSize(nativeHandle_, callbackTriggerIntervalSize);
|
||||||
@ -430,7 +427,7 @@ public class BackupableDBOptions extends RocksObject {
|
|||||||
return callbackTriggerIntervalSize(nativeHandle_);
|
return callbackTriggerIntervalSize(nativeHandle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static long newBackupableDBOptions(final String path);
|
private native static long newBackupEngineOptions(final String path);
|
||||||
private native String backupDir(long handle);
|
private native String backupDir(long handle);
|
||||||
private native void setBackupEnv(final long handle, final long envHandle);
|
private native void setBackupEnv(final long handle, final long envHandle);
|
||||||
private native void setShareTableFiles(long handle, boolean flag);
|
private native void setShareTableFiles(long handle, boolean flag);
|
@ -19,7 +19,7 @@ public class RestoreOptions extends RocksObject {
|
|||||||
* @param keepLogFiles If true, restore won't overwrite the existing log files
|
* @param keepLogFiles If true, restore won't overwrite the existing log files
|
||||||
* in wal_dir. It will also move all log files from archive directory to
|
* in wal_dir. It will also move all log files from archive directory to
|
||||||
* wal_dir. Use this option in combination with
|
* wal_dir. Use this option in combination with
|
||||||
* BackupableDBOptions::backup_log_files = false for persisting in-memory
|
* BackupEngineOptions::backup_log_files = false for persisting in-memory
|
||||||
* databases.
|
* databases.
|
||||||
* Default: false
|
* Default: false
|
||||||
*/
|
*/
|
||||||
|
@ -14,8 +14,7 @@ import org.junit.Rule;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
public class BackupableDBOptionsTest {
|
public class BackupEngineOptionsTest {
|
||||||
|
|
||||||
private final static String ARBITRARY_PATH =
|
private final static String ARBITRARY_PATH =
|
||||||
System.getProperty("java.io.tmpdir");
|
System.getProperty("java.io.tmpdir");
|
||||||
|
|
||||||
@ -31,8 +30,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backupDir() {
|
public void backupDir() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
assertThat(backupableDBOptions.backupDir()).
|
assertThat(backupableDBOptions.backupDir()).
|
||||||
isEqualTo(ARBITRARY_PATH);
|
isEqualTo(ARBITRARY_PATH);
|
||||||
}
|
}
|
||||||
@ -40,8 +38,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void env() {
|
public void env() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
assertThat(backupableDBOptions.backupEnv()).
|
assertThat(backupableDBOptions.backupEnv()).
|
||||||
isNull();
|
isNull();
|
||||||
|
|
||||||
@ -55,8 +52,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shareTableFiles() {
|
public void shareTableFiles() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final boolean value = rand.nextBoolean();
|
final boolean value = rand.nextBoolean();
|
||||||
backupableDBOptions.setShareTableFiles(value);
|
backupableDBOptions.setShareTableFiles(value);
|
||||||
assertThat(backupableDBOptions.shareTableFiles()).
|
assertThat(backupableDBOptions.shareTableFiles()).
|
||||||
@ -66,8 +62,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void infoLog() {
|
public void infoLog() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
assertThat(backupableDBOptions.infoLog()).
|
assertThat(backupableDBOptions.infoLog()).
|
||||||
isNull();
|
isNull();
|
||||||
|
|
||||||
@ -87,8 +82,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sync() {
|
public void sync() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final boolean value = rand.nextBoolean();
|
final boolean value = rand.nextBoolean();
|
||||||
backupableDBOptions.setSync(value);
|
backupableDBOptions.setSync(value);
|
||||||
assertThat(backupableDBOptions.sync()).isEqualTo(value);
|
assertThat(backupableDBOptions.sync()).isEqualTo(value);
|
||||||
@ -97,8 +91,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void destroyOldData() {
|
public void destroyOldData() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH);) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH);) {
|
|
||||||
final boolean value = rand.nextBoolean();
|
final boolean value = rand.nextBoolean();
|
||||||
backupableDBOptions.setDestroyOldData(value);
|
backupableDBOptions.setDestroyOldData(value);
|
||||||
assertThat(backupableDBOptions.destroyOldData()).
|
assertThat(backupableDBOptions.destroyOldData()).
|
||||||
@ -108,8 +101,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backupLogFiles() {
|
public void backupLogFiles() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final boolean value = rand.nextBoolean();
|
final boolean value = rand.nextBoolean();
|
||||||
backupableDBOptions.setBackupLogFiles(value);
|
backupableDBOptions.setBackupLogFiles(value);
|
||||||
assertThat(backupableDBOptions.backupLogFiles()).
|
assertThat(backupableDBOptions.backupLogFiles()).
|
||||||
@ -119,8 +111,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backupRateLimit() {
|
public void backupRateLimit() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final long value = Math.abs(rand.nextLong());
|
final long value = Math.abs(rand.nextLong());
|
||||||
backupableDBOptions.setBackupRateLimit(value);
|
backupableDBOptions.setBackupRateLimit(value);
|
||||||
assertThat(backupableDBOptions.backupRateLimit()).
|
assertThat(backupableDBOptions.backupRateLimit()).
|
||||||
@ -134,8 +125,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backupRateLimiter() {
|
public void backupRateLimiter() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
assertThat(backupableDBOptions.backupEnv()).
|
assertThat(backupableDBOptions.backupEnv()).
|
||||||
isNull();
|
isNull();
|
||||||
|
|
||||||
@ -150,8 +140,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void restoreRateLimit() {
|
public void restoreRateLimit() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final long value = Math.abs(rand.nextLong());
|
final long value = Math.abs(rand.nextLong());
|
||||||
backupableDBOptions.setRestoreRateLimit(value);
|
backupableDBOptions.setRestoreRateLimit(value);
|
||||||
assertThat(backupableDBOptions.restoreRateLimit()).
|
assertThat(backupableDBOptions.restoreRateLimit()).
|
||||||
@ -165,8 +154,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void restoreRateLimiter() {
|
public void restoreRateLimiter() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
assertThat(backupableDBOptions.backupEnv()).
|
assertThat(backupableDBOptions.backupEnv()).
|
||||||
isNull();
|
isNull();
|
||||||
|
|
||||||
@ -181,8 +169,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shareFilesWithChecksum() {
|
public void shareFilesWithChecksum() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
boolean value = rand.nextBoolean();
|
boolean value = rand.nextBoolean();
|
||||||
backupableDBOptions.setShareFilesWithChecksum(value);
|
backupableDBOptions.setShareFilesWithChecksum(value);
|
||||||
assertThat(backupableDBOptions.shareFilesWithChecksum()).
|
assertThat(backupableDBOptions.shareFilesWithChecksum()).
|
||||||
@ -192,8 +179,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void maxBackgroundOperations() {
|
public void maxBackgroundOperations() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final int value = rand.nextInt();
|
final int value = rand.nextInt();
|
||||||
backupableDBOptions.setMaxBackgroundOperations(value);
|
backupableDBOptions.setMaxBackgroundOperations(value);
|
||||||
assertThat(backupableDBOptions.maxBackgroundOperations()).
|
assertThat(backupableDBOptions.maxBackgroundOperations()).
|
||||||
@ -203,8 +189,7 @@ public class BackupableDBOptionsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void callbackTriggerIntervalSize() {
|
public void callbackTriggerIntervalSize() {
|
||||||
try (final BackupableDBOptions backupableDBOptions =
|
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
|
||||||
new BackupableDBOptions(ARBITRARY_PATH)) {
|
|
||||||
final long value = rand.nextLong();
|
final long value = rand.nextLong();
|
||||||
backupableDBOptions.setCallbackTriggerIntervalSize(value);
|
backupableDBOptions.setCallbackTriggerIntervalSize(value);
|
||||||
assertThat(backupableDBOptions.callbackTriggerIntervalSize()).
|
assertThat(backupableDBOptions.callbackTriggerIntervalSize()).
|
||||||
@ -215,135 +200,118 @@ public class BackupableDBOptionsTest {
|
|||||||
@Test
|
@Test
|
||||||
public void failBackupDirIsNull() {
|
public void failBackupDirIsNull() {
|
||||||
exception.expect(IllegalArgumentException.class);
|
exception.expect(IllegalArgumentException.class);
|
||||||
try (final BackupableDBOptions opts = new BackupableDBOptions(null)) {
|
try (final BackupEngineOptions opts = new BackupEngineOptions(null)) {
|
||||||
//no-op
|
//no-op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failBackupDirIfDisposed() {
|
public void failBackupDirIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.backupDir();
|
options.backupDir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetShareTableFilesIfDisposed() {
|
public void failSetShareTableFilesIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setShareTableFiles(true);
|
options.setShareTableFiles(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failShareTableFilesIfDisposed() {
|
public void failShareTableFilesIfDisposed() {
|
||||||
try (BackupableDBOptions options =
|
try (BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.shareTableFiles();
|
options.shareTableFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetSyncIfDisposed() {
|
public void failSetSyncIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setSync(true);
|
options.setSync(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSyncIfDisposed() {
|
public void failSyncIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.sync();
|
options.sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetDestroyOldDataIfDisposed() {
|
public void failSetDestroyOldDataIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setDestroyOldData(true);
|
options.setDestroyOldData(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failDestroyOldDataIfDisposed() {
|
public void failDestroyOldDataIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.destroyOldData();
|
options.destroyOldData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetBackupLogFilesIfDisposed() {
|
public void failSetBackupLogFilesIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setBackupLogFiles(true);
|
options.setBackupLogFiles(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failBackupLogFilesIfDisposed() {
|
public void failBackupLogFilesIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.backupLogFiles();
|
options.backupLogFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetBackupRateLimitIfDisposed() {
|
public void failSetBackupRateLimitIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setBackupRateLimit(1);
|
options.setBackupRateLimit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failBackupRateLimitIfDisposed() {
|
public void failBackupRateLimitIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.backupRateLimit();
|
options.backupRateLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetRestoreRateLimitIfDisposed() {
|
public void failSetRestoreRateLimitIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setRestoreRateLimit(1);
|
options.setRestoreRateLimit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failRestoreRateLimitIfDisposed() {
|
public void failRestoreRateLimitIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.restoreRateLimit();
|
options.restoreRateLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failSetShareFilesWithChecksumIfDisposed() {
|
public void failSetShareFilesWithChecksumIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.setShareFilesWithChecksum(true);
|
options.setShareFilesWithChecksum(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void failShareFilesWithChecksumIfDisposed() {
|
public void failShareFilesWithChecksumIfDisposed() {
|
||||||
try (final BackupableDBOptions options =
|
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
|
||||||
setupUninitializedBackupableDBOptions(exception)) {
|
|
||||||
options.shareFilesWithChecksum();
|
options.shareFilesWithChecksum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BackupableDBOptions setupUninitializedBackupableDBOptions(
|
private BackupEngineOptions setupUninitializedBackupEngineOptions(ExpectedException exception) {
|
||||||
ExpectedException exception) {
|
final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH);
|
||||||
final BackupableDBOptions backupableDBOptions =
|
|
||||||
new BackupableDBOptions(ARBITRARY_PATH);
|
|
||||||
backupableDBOptions.close();
|
backupableDBOptions.close();
|
||||||
exception.expect(AssertionError.class);
|
exception.expect(AssertionError.class);
|
||||||
return backupableDBOptions;
|
return backupableDBOptions;
|
@ -38,9 +38,9 @@ public class BackupEngineTest {
|
|||||||
prepareDatabase(db);
|
prepareDatabase(db);
|
||||||
|
|
||||||
// Create two backups
|
// Create two backups
|
||||||
try(final BackupableDBOptions bopt = new BackupableDBOptions(
|
try (final BackupEngineOptions bopt =
|
||||||
backupFolder.getRoot().getAbsolutePath());
|
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
|
||||||
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
||||||
be.createNewBackup(db, false);
|
be.createNewBackup(db, false);
|
||||||
be.createNewBackup(db, true);
|
be.createNewBackup(db, true);
|
||||||
verifyNumberOfValidBackups(be, 2);
|
verifyNumberOfValidBackups(be, 2);
|
||||||
@ -57,9 +57,9 @@ public class BackupEngineTest {
|
|||||||
// Fill database with some test values
|
// Fill database with some test values
|
||||||
prepareDatabase(db);
|
prepareDatabase(db);
|
||||||
// Create two backups
|
// Create two backups
|
||||||
try(final BackupableDBOptions bopt = new BackupableDBOptions(
|
try (final BackupEngineOptions bopt =
|
||||||
backupFolder.getRoot().getAbsolutePath());
|
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
|
||||||
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
||||||
be.createNewBackup(db, false);
|
be.createNewBackup(db, false);
|
||||||
be.createNewBackup(db, true);
|
be.createNewBackup(db, true);
|
||||||
final List<BackupInfo> backupInfo =
|
final List<BackupInfo> backupInfo =
|
||||||
@ -85,9 +85,9 @@ public class BackupEngineTest {
|
|||||||
// Fill database with some test values
|
// Fill database with some test values
|
||||||
prepareDatabase(db);
|
prepareDatabase(db);
|
||||||
// Create four backups
|
// Create four backups
|
||||||
try(final BackupableDBOptions bopt = new BackupableDBOptions(
|
try (final BackupEngineOptions bopt =
|
||||||
backupFolder.getRoot().getAbsolutePath());
|
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
|
||||||
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
||||||
be.createNewBackup(db, false);
|
be.createNewBackup(db, false);
|
||||||
be.createNewBackup(db, true);
|
be.createNewBackup(db, true);
|
||||||
be.createNewBackup(db, true);
|
be.createNewBackup(db, true);
|
||||||
@ -116,8 +116,8 @@ public class BackupEngineTest {
|
|||||||
// Fill database with some test values
|
// Fill database with some test values
|
||||||
prepareDatabase(db);
|
prepareDatabase(db);
|
||||||
|
|
||||||
try (final BackupableDBOptions bopt = new BackupableDBOptions(
|
try (final BackupEngineOptions bopt =
|
||||||
backupFolder.getRoot().getAbsolutePath());
|
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
|
||||||
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
||||||
be.createNewBackup(db, true);
|
be.createNewBackup(db, true);
|
||||||
verifyNumberOfValidBackups(be, 1);
|
verifyNumberOfValidBackups(be, 1);
|
||||||
@ -166,8 +166,8 @@ public class BackupEngineTest {
|
|||||||
dbFolder.getRoot().getAbsolutePath());
|
dbFolder.getRoot().getAbsolutePath());
|
||||||
// Fill database with some test values
|
// Fill database with some test values
|
||||||
prepareDatabase(db);
|
prepareDatabase(db);
|
||||||
try (final BackupableDBOptions bopt = new BackupableDBOptions(
|
try (final BackupEngineOptions bopt =
|
||||||
backupFolder.getRoot().getAbsolutePath());
|
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
|
||||||
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
||||||
be.createNewBackup(db, true);
|
be.createNewBackup(db, true);
|
||||||
verifyNumberOfValidBackups(be, 1);
|
verifyNumberOfValidBackups(be, 1);
|
||||||
@ -215,8 +215,8 @@ public class BackupEngineTest {
|
|||||||
prepareDatabase(db);
|
prepareDatabase(db);
|
||||||
|
|
||||||
// Create two backups
|
// Create two backups
|
||||||
try (final BackupableDBOptions bopt =
|
try (final BackupEngineOptions bopt =
|
||||||
new BackupableDBOptions(backupFolder.getRoot().getAbsolutePath());
|
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
|
||||||
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
|
||||||
final String metadata = String.valueOf(ThreadLocalRandom.current().nextInt());
|
final String metadata = String.valueOf(ThreadLocalRandom.current().nextInt());
|
||||||
be.createNewBackupWithMetadata(db, metadata, true);
|
be.createNewBackupWithMetadata(db, metadata, true);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "rocksdb/file_checksum.h"
|
#include "rocksdb/file_checksum.h"
|
||||||
#include "rocksdb/filter_policy.h"
|
#include "rocksdb/filter_policy.h"
|
||||||
#include "rocksdb/table_properties.h"
|
#include "rocksdb/table_properties.h"
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksdb/utilities/checkpoint.h"
|
#include "rocksdb/utilities/checkpoint.h"
|
||||||
#include "rocksdb/utilities/debug.h"
|
#include "rocksdb/utilities/debug.h"
|
||||||
#include "rocksdb/utilities/options_util.h"
|
#include "rocksdb/utilities/options_util.h"
|
||||||
@ -3225,8 +3225,8 @@ void BackupCommand::DoCommand() {
|
|||||||
}
|
}
|
||||||
assert(custom_env != nullptr);
|
assert(custom_env != nullptr);
|
||||||
|
|
||||||
BackupableDBOptions backup_options =
|
BackupEngineOptions backup_options =
|
||||||
BackupableDBOptions(backup_dir_, custom_env);
|
BackupEngineOptions(backup_dir_, custom_env);
|
||||||
backup_options.info_log = logger_.get();
|
backup_options.info_log = logger_.get();
|
||||||
backup_options.max_background_operations = num_threads_;
|
backup_options.max_background_operations = num_threads_;
|
||||||
status = BackupEngine::Open(options_.env, backup_options, &backup_engine);
|
status = BackupEngine::Open(options_.env, backup_options, &backup_engine);
|
||||||
@ -3273,7 +3273,7 @@ void RestoreCommand::DoCommand() {
|
|||||||
std::unique_ptr<BackupEngineReadOnly> restore_engine;
|
std::unique_ptr<BackupEngineReadOnly> restore_engine;
|
||||||
Status status;
|
Status status;
|
||||||
{
|
{
|
||||||
BackupableDBOptions opts(backup_dir_, custom_env);
|
BackupEngineOptions opts(backup_dir_, custom_env);
|
||||||
opts.info_log = logger_.get();
|
opts.info_log = logger_.get();
|
||||||
opts.max_background_operations = num_threads_;
|
opts.max_background_operations = num_threads_;
|
||||||
BackupEngineReadOnly* raw_restore_engine_ptr;
|
BackupEngineReadOnly* raw_restore_engine_ptr;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef ROCKSDB_LITE
|
#ifndef ROCKSDB_LITE
|
||||||
|
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
namespace ROCKSDB_NAMESPACE {
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
#if !defined(ROCKSDB_LITE) && !defined(OS_WIN)
|
#if !defined(ROCKSDB_LITE) && !defined(OS_WIN)
|
||||||
|
|
||||||
#include "rocksdb/utilities/backupable_db.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@ -34,7 +32,9 @@
|
|||||||
#include "rocksdb/statistics.h"
|
#include "rocksdb/statistics.h"
|
||||||
#include "rocksdb/transaction_log.h"
|
#include "rocksdb/transaction_log.h"
|
||||||
#include "rocksdb/types.h"
|
#include "rocksdb/types.h"
|
||||||
|
#include "rocksdb/utilities/backup_engine.h"
|
||||||
#include "rocksdb/utilities/options_util.h"
|
#include "rocksdb/utilities/options_util.h"
|
||||||
|
#include "rocksdb/utilities/stackable_db.h"
|
||||||
#include "test_util/sync_point.h"
|
#include "test_util/sync_point.h"
|
||||||
#include "test_util/testharness.h"
|
#include "test_util/testharness.h"
|
||||||
#include "test_util/testutil.h"
|
#include "test_util/testutil.h"
|
||||||
@ -49,11 +49,11 @@
|
|||||||
namespace ROCKSDB_NAMESPACE {
|
namespace ROCKSDB_NAMESPACE {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using ShareFilesNaming = BackupableDBOptions::ShareFilesNaming;
|
using ShareFilesNaming = BackupEngineOptions::ShareFilesNaming;
|
||||||
const auto kLegacyCrc32cAndFileSize =
|
const auto kLegacyCrc32cAndFileSize =
|
||||||
BackupableDBOptions::kLegacyCrc32cAndFileSize;
|
BackupEngineOptions::kLegacyCrc32cAndFileSize;
|
||||||
const auto kUseDbSessionId = BackupableDBOptions::kUseDbSessionId;
|
const auto kUseDbSessionId = BackupEngineOptions::kUseDbSessionId;
|
||||||
const auto kFlagIncludeFileSize = BackupableDBOptions::kFlagIncludeFileSize;
|
const auto kFlagIncludeFileSize = BackupEngineOptions::kFlagIncludeFileSize;
|
||||||
const auto kNamingDefault = kUseDbSessionId | kFlagIncludeFileSize;
|
const auto kNamingDefault = kUseDbSessionId | kFlagIncludeFileSize;
|
||||||
|
|
||||||
class DummyDB : public StackableDB {
|
class DummyDB : public StackableDB {
|
||||||
@ -671,7 +671,7 @@ class BackupEngineTest : public testing::Test {
|
|||||||
#endif // ROCKSDB_MODIFY_NPHASH
|
#endif // ROCKSDB_MODIFY_NPHASH
|
||||||
|
|
||||||
// set up backup db options
|
// set up backup db options
|
||||||
backupable_options_.reset(new BackupableDBOptions(
|
backupable_options_.reset(new BackupEngineOptions(
|
||||||
backupdir_, test_backup_env_.get(), /*share_table_files*/ true,
|
backupdir_, test_backup_env_.get(), /*share_table_files*/ true,
|
||||||
logger_.get(), kUseSync));
|
logger_.get(), kUseSync));
|
||||||
|
|
||||||
@ -987,7 +987,7 @@ class BackupEngineTest : public testing::Test {
|
|||||||
Options options_;
|
Options options_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<BackupableDBOptions> backupable_options_;
|
std::unique_ptr<BackupEngineOptions> backupable_options_;
|
||||||
}; // BackupEngineTest
|
}; // BackupEngineTest
|
||||||
|
|
||||||
void AppendPath(const std::string& path, std::vector<std::string>& v) {
|
void AppendPath(const std::string& path, std::vector<std::string>& v) {
|
||||||
@ -3465,7 +3465,7 @@ TEST_F(BackupEngineTest, Concurrency) {
|
|||||||
Options db_opts = options_;
|
Options db_opts = options_;
|
||||||
db_opts.wal_dir = "";
|
db_opts.wal_dir = "";
|
||||||
db_opts.create_if_missing = false;
|
db_opts.create_if_missing = false;
|
||||||
BackupableDBOptions be_opts = *backupable_options_;
|
BackupEngineOptions be_opts = *backupable_options_;
|
||||||
be_opts.destroy_old_data = false;
|
be_opts.destroy_old_data = false;
|
||||||
|
|
||||||
std::mt19937 rng{std::random_device()()};
|
std::mt19937 rng{std::random_device()()};
|
||||||
|
@ -327,18 +327,6 @@ Status DBWithTTLImpl::Close() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status UtilityDB::OpenTtlDB(const Options& options, const std::string& dbname,
|
|
||||||
StackableDB** dbptr, int32_t ttl, bool read_only) {
|
|
||||||
DBWithTTL* db;
|
|
||||||
Status s = DBWithTTL::Open(options, dbname, &db, ttl, read_only);
|
|
||||||
if (s.ok()) {
|
|
||||||
*dbptr = db;
|
|
||||||
} else {
|
|
||||||
*dbptr = nullptr;
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBWithTTLImpl::RegisterTtlClasses() {
|
void DBWithTTLImpl::RegisterTtlClasses() {
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&]() {
|
std::call_once(once, [&]() {
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "rocksdb/merge_operator.h"
|
#include "rocksdb/merge_operator.h"
|
||||||
#include "rocksdb/system_clock.h"
|
#include "rocksdb/system_clock.h"
|
||||||
#include "rocksdb/utilities/db_ttl.h"
|
#include "rocksdb/utilities/db_ttl.h"
|
||||||
#include "rocksdb/utilities/utility_db.h"
|
|
||||||
#include "utilities/compaction_filters/layered_compaction_filter_base.h"
|
#include "utilities/compaction_filters/layered_compaction_filter_base.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
Loading…
Reference in New Issue
Block a user