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:
Peter Dillinger 2022-01-27 15:44:23 -08:00 committed by Facebook GitHub Bot
parent ea89c77f27
commit 78aee6fedc
24 changed files with 340 additions and 444 deletions

View File

@ -6,6 +6,8 @@
### Public API changes
* Remove HDFS 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 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.

121
db/c.cc
View File

@ -35,7 +35,7 @@
#include "rocksdb/status.h"
#include "rocksdb/table.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/db_ttl.h"
#include "rocksdb/utilities/memory_util.h"
@ -47,8 +47,8 @@
#include "rocksdb/write_batch.h"
#include "utilities/merge_operators.h"
using ROCKSDB_NAMESPACE::BackupableDBOptions;
using ROCKSDB_NAMESPACE::BackupEngine;
using ROCKSDB_NAMESPACE::BackupEngineOptions;
using ROCKSDB_NAMESPACE::BackupID;
using ROCKSDB_NAMESPACE::BackupInfo;
using ROCKSDB_NAMESPACE::BatchResult;
@ -189,8 +189,8 @@ struct rocksdb_transaction_options_t {
struct rocksdb_transaction_t {
Transaction* rep;
};
struct rocksdb_backupable_db_options_t {
BackupableDBOptions rep;
struct rocksdb_backup_engine_options_t {
BackupEngineOptions rep;
};
struct rocksdb_checkpoint_t {
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(
const rocksdb_options_t* options, const char* path, char** errptr) {
BackupEngine* be;
if (SaveError(errptr, BackupEngine::Open(options->rep.env,
BackupableDBOptions(path,
nullptr,
true,
options->rep.info_log.get()),
&be))) {
if (SaveError(errptr, BackupEngine::Open(
options->rep.env,
BackupEngineOptions(path, nullptr, true,
options->rep.info_log.get()),
&be))) {
return nullptr;
}
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(
const rocksdb_backupable_db_options_t* options, rocksdb_env_t* env,
const rocksdb_backup_engine_options_t* options, rocksdb_env_t* env,
char** errptr) {
BackupEngine* 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;
}
rocksdb_backupable_db_options_t* rocksdb_backupable_db_options_create(
rocksdb_backup_engine_options_t* rocksdb_backup_engine_options_create(
const char* backup_dir) {
return new rocksdb_backupable_db_options_t{
BackupableDBOptions(std::string(backup_dir))};
return new rocksdb_backup_engine_options_t{
BackupEngineOptions(std::string(backup_dir))};
}
void rocksdb_backupable_db_options_set_backup_dir(
rocksdb_backupable_db_options_t* options, const char* backup_dir) {
void rocksdb_backup_engine_options_set_backup_dir(
rocksdb_backup_engine_options_t* options, const char* backup_dir) {
options->rep.backup_dir = std::string(backup_dir);
}
void rocksdb_backupable_db_options_set_env(
rocksdb_backupable_db_options_t* options, rocksdb_env_t* env) {
void rocksdb_backup_engine_options_set_env(
rocksdb_backup_engine_options_t* options, rocksdb_env_t* env) {
options->rep.backup_env = (env ? env->rep : nullptr);
}
void rocksdb_backupable_db_options_set_share_table_files(
rocksdb_backupable_db_options_t* options, unsigned char val) {
void rocksdb_backup_engine_options_set_share_table_files(
rocksdb_backup_engine_options_t* options, unsigned char val) {
options->rep.share_table_files = val;
}
unsigned char rocksdb_backupable_db_options_get_share_table_files(
rocksdb_backupable_db_options_t* options) {
unsigned char rocksdb_backup_engine_options_get_share_table_files(
rocksdb_backup_engine_options_t* options) {
return options->rep.share_table_files;
}
void rocksdb_backupable_db_options_set_sync(
rocksdb_backupable_db_options_t* options, unsigned char val) {
void rocksdb_backup_engine_options_set_sync(
rocksdb_backup_engine_options_t* options, unsigned char val) {
options->rep.sync = val;
}
unsigned char rocksdb_backupable_db_options_get_sync(
rocksdb_backupable_db_options_t* options) {
unsigned char rocksdb_backup_engine_options_get_sync(
rocksdb_backup_engine_options_t* options) {
return options->rep.sync;
}
void rocksdb_backupable_db_options_set_destroy_old_data(
rocksdb_backupable_db_options_t* options, unsigned char val) {
void rocksdb_backup_engine_options_set_destroy_old_data(
rocksdb_backup_engine_options_t* options, unsigned char val) {
options->rep.destroy_old_data = val;
}
unsigned char rocksdb_backupable_db_options_get_destroy_old_data(
rocksdb_backupable_db_options_t* options) {
unsigned char rocksdb_backup_engine_options_get_destroy_old_data(
rocksdb_backup_engine_options_t* options) {
return options->rep.destroy_old_data;
}
void rocksdb_backupable_db_options_set_backup_log_files(
rocksdb_backupable_db_options_t* options, unsigned char val) {
void rocksdb_backup_engine_options_set_backup_log_files(
rocksdb_backup_engine_options_t* options, unsigned char val) {
options->rep.backup_log_files = val;
}
unsigned char rocksdb_backupable_db_options_get_backup_log_files(
rocksdb_backupable_db_options_t* options) {
unsigned char rocksdb_backup_engine_options_get_backup_log_files(
rocksdb_backup_engine_options_t* options) {
return options->rep.backup_log_files;
}
void rocksdb_backupable_db_options_set_backup_rate_limit(
rocksdb_backupable_db_options_t* options, uint64_t limit) {
void rocksdb_backup_engine_options_set_backup_rate_limit(
rocksdb_backup_engine_options_t* options, uint64_t limit) {
options->rep.backup_rate_limit = limit;
}
uint64_t rocksdb_backupable_db_options_get_backup_rate_limit(
rocksdb_backupable_db_options_t* options) {
uint64_t rocksdb_backup_engine_options_get_backup_rate_limit(
rocksdb_backup_engine_options_t* options) {
return options->rep.backup_rate_limit;
}
void rocksdb_backupable_db_options_set_restore_rate_limit(
rocksdb_backupable_db_options_t* options, uint64_t limit) {
void rocksdb_backup_engine_options_set_restore_rate_limit(
rocksdb_backup_engine_options_t* options, uint64_t limit) {
options->rep.restore_rate_limit = limit;
}
uint64_t rocksdb_backupable_db_options_get_restore_rate_limit(
rocksdb_backupable_db_options_t* options) {
uint64_t rocksdb_backup_engine_options_get_restore_rate_limit(
rocksdb_backup_engine_options_t* options) {
return options->rep.restore_rate_limit;
}
void rocksdb_backupable_db_options_set_max_background_operations(
rocksdb_backupable_db_options_t* options, int val) {
void rocksdb_backup_engine_options_set_max_background_operations(
rocksdb_backup_engine_options_t* options, int val) {
options->rep.max_background_operations = val;
}
int rocksdb_backupable_db_options_get_max_background_operations(
rocksdb_backupable_db_options_t* options) {
int rocksdb_backup_engine_options_get_max_background_operations(
rocksdb_backup_engine_options_t* options) {
return options->rep.max_background_operations;
}
void rocksdb_backupable_db_options_set_callback_trigger_interval_size(
rocksdb_backupable_db_options_t* options, uint64_t size) {
void rocksdb_backup_engine_options_set_callback_trigger_interval_size(
rocksdb_backup_engine_options_t* options, uint64_t size) {
options->rep.callback_trigger_interval_size = size;
}
uint64_t rocksdb_backupable_db_options_get_callback_trigger_interval_size(
rocksdb_backupable_db_options_t* options) {
uint64_t rocksdb_backup_engine_options_get_callback_trigger_interval_size(
rocksdb_backup_engine_options_t* options) {
return options->rep.callback_trigger_interval_size;
}
void rocksdb_backupable_db_options_set_max_valid_backups_to_open(
rocksdb_backupable_db_options_t* options, int val) {
void rocksdb_backup_engine_options_set_max_valid_backups_to_open(
rocksdb_backup_engine_options_t* options, int val) {
options->rep.max_valid_backups_to_open = val;
}
int rocksdb_backupable_db_options_get_max_valid_backups_to_open(
rocksdb_backupable_db_options_t* options) {
int rocksdb_backup_engine_options_get_max_valid_backups_to_open(
rocksdb_backup_engine_options_t* options) {
return options->rep.max_valid_backups_to_open;
}
void rocksdb_backupable_db_options_set_share_files_with_checksum_naming(
rocksdb_backupable_db_options_t* options, int val) {
void rocksdb_backup_engine_options_set_share_files_with_checksum_naming(
rocksdb_backup_engine_options_t* options, int val) {
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(
rocksdb_backupable_db_options_t* options) {
int rocksdb_backup_engine_options_get_share_files_with_checksum_naming(
rocksdb_backup_engine_options_t* options) {
return static_cast<int>(options->rep.share_files_with_checksum_naming);
}
void rocksdb_backupable_db_options_destroy(
rocksdb_backupable_db_options_t* options) {
void rocksdb_backup_engine_options_destroy(
rocksdb_backup_engine_options_t* options) {
delete options;
}

View File

@ -2495,51 +2495,51 @@ int main(int argc, char** argv) {
StartPhase("backupable_db_option");
{
rocksdb_backupable_db_options_t* bdo;
bdo = rocksdb_backupable_db_options_create("path");
rocksdb_backup_engine_options_t* bdo;
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 ==
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);
CheckCondition(1 == rocksdb_backupable_db_options_get_sync(bdo));
rocksdb_backup_engine_options_set_sync(bdo, 1);
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 ==
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 ==
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 ==
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 ==
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(
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(
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(
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(
2 == rocksdb_backupable_db_options_get_share_files_with_checksum_naming(
2 == rocksdb_backup_engine_options_get_share_files_with_checksum_naming(
bdo));
rocksdb_backupable_db_options_destroy(bdo);
rocksdb_backup_engine_options_destroy(bdo);
}
StartPhase("compression_options");

View File

@ -50,7 +50,7 @@
#include "rocksdb/slice.h"
#include "rocksdb/slice_transform.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/db_ttl.h"
#include "rocksdb/utilities/debug.h"

View File

@ -1404,7 +1404,7 @@ Status StressTest::TestBackupRestore(
const std::vector<int64_t>& rand_keys) {
std::string backup_dir = FLAGS_db + "/.backup" + 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
backup_opts.info_log = db_->GetDBOptions().info_log.get();
if (thread->rand.OneIn(10)) {
@ -1418,16 +1418,16 @@ Status StressTest::TestBackupRestore(
if (thread->rand.OneIn(2)) {
// old
backup_opts.share_files_with_checksum_naming =
BackupableDBOptions::kLegacyCrc32cAndFileSize;
BackupEngineOptions::kLegacyCrc32cAndFileSize;
} else {
// new
backup_opts.share_files_with_checksum_naming =
BackupableDBOptions::kUseDbSessionId;
BackupEngineOptions::kUseDbSessionId;
}
if (thread->rand.OneIn(2)) {
backup_opts.share_files_with_checksum_naming =
backup_opts.share_files_with_checksum_naming |
BackupableDBOptions::kFlagIncludeFileSize;
BackupEngineOptions::kFlagIncludeFileSize;
}
}
}

View File

@ -71,7 +71,7 @@ extern "C" {
typedef struct rocksdb_t rocksdb_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_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_memory_allocator_t rocksdb_memory_allocator_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);
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);
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(
rocksdb_backup_engine_t* be);
/* BackupableDBOptions */
/* BackupEngineOptions */
extern ROCKSDB_LIBRARY_API rocksdb_backupable_db_options_t*
rocksdb_backupable_db_options_create(const char* backup_dir);
extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_options_t*
rocksdb_backup_engine_options_create(const char* backup_dir);
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_set_backup_dir(
rocksdb_backupable_db_options_t* options, const char* backup_dir);
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_set_backup_dir(
rocksdb_backup_engine_options_t* options, const char* backup_dir);
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_set_env(
rocksdb_backupable_db_options_t* options, rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_set_env(
rocksdb_backup_engine_options_t* options, rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_share_table_files(
rocksdb_backupable_db_options_t* options, unsigned char val);
rocksdb_backup_engine_options_set_share_table_files(
rocksdb_backup_engine_options_t* options, unsigned char val);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_backupable_db_options_get_share_table_files(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_share_table_files(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_set_sync(
rocksdb_backupable_db_options_t* options, unsigned char val);
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_set_sync(
rocksdb_backup_engine_options_t* options, unsigned char val);
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_backupable_db_options_get_sync(
rocksdb_backupable_db_options_t* options);
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_backup_engine_options_get_sync(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_destroy_old_data(
rocksdb_backupable_db_options_t* options, unsigned char val);
rocksdb_backup_engine_options_set_destroy_old_data(
rocksdb_backup_engine_options_t* options, unsigned char val);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_backupable_db_options_get_destroy_old_data(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_destroy_old_data(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_backup_log_files(
rocksdb_backupable_db_options_t* options, unsigned char val);
rocksdb_backup_engine_options_set_backup_log_files(
rocksdb_backup_engine_options_t* options, unsigned char val);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_backupable_db_options_get_backup_log_files(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_backup_log_files(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_backup_rate_limit(
rocksdb_backupable_db_options_t* options, uint64_t limit);
rocksdb_backup_engine_options_set_backup_rate_limit(
rocksdb_backup_engine_options_t* options, uint64_t limit);
extern ROCKSDB_LIBRARY_API uint64_t
rocksdb_backupable_db_options_get_backup_rate_limit(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_backup_rate_limit(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_restore_rate_limit(
rocksdb_backupable_db_options_t* options, uint64_t limit);
rocksdb_backup_engine_options_set_restore_rate_limit(
rocksdb_backup_engine_options_t* options, uint64_t limit);
extern ROCKSDB_LIBRARY_API uint64_t
rocksdb_backupable_db_options_get_restore_rate_limit(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_restore_rate_limit(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_max_background_operations(
rocksdb_backupable_db_options_t* options, int val);
rocksdb_backup_engine_options_set_max_background_operations(
rocksdb_backup_engine_options_t* options, int val);
extern ROCKSDB_LIBRARY_API int
rocksdb_backupable_db_options_get_max_background_operations(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_max_background_operations(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_callback_trigger_interval_size(
rocksdb_backupable_db_options_t* options, uint64_t size);
rocksdb_backup_engine_options_set_callback_trigger_interval_size(
rocksdb_backup_engine_options_t* options, uint64_t size);
extern ROCKSDB_LIBRARY_API uint64_t
rocksdb_backupable_db_options_get_callback_trigger_interval_size(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_callback_trigger_interval_size(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_max_valid_backups_to_open(
rocksdb_backupable_db_options_t* options, int val);
rocksdb_backup_engine_options_set_max_valid_backups_to_open(
rocksdb_backup_engine_options_t* options, int val);
extern ROCKSDB_LIBRARY_API int
rocksdb_backupable_db_options_get_max_valid_backups_to_open(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_max_valid_backups_to_open(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void
rocksdb_backupable_db_options_set_share_files_with_checksum_naming(
rocksdb_backupable_db_options_t* options, int val);
rocksdb_backup_engine_options_set_share_files_with_checksum_naming(
rocksdb_backup_engine_options_t* options, int val);
extern ROCKSDB_LIBRARY_API int
rocksdb_backupable_db_options_get_share_files_with_checksum_naming(
rocksdb_backupable_db_options_t* options);
rocksdb_backup_engine_options_get_share_files_with_checksum_naming(
rocksdb_backup_engine_options_t* options);
extern ROCKSDB_LIBRARY_API void rocksdb_backupable_db_options_destroy(
rocksdb_backupable_db_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_options_destroy(
rocksdb_backup_engine_options_t*);
/* Checkpoint */

View File

@ -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

View File

@ -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

View File

@ -106,7 +106,7 @@ set(JAVA_MAIN_CLASSES
src/main/java/org/rocksdb/AdvancedColumnFamilyOptionsInterface.java
src/main/java/org/rocksdb/AdvancedMutableColumnFamilyOptionsInterface.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/BackupInfo.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.AbstractTransactionNotifier
org.rocksdb.AbstractWalFilter
org.rocksdb.BackupableDBOptions
org.rocksdb.BackupEngineOptions
org.rocksdb.BackupEngine
org.rocksdb.BlockBasedTableConfig
org.rocksdb.BloomFilter

View File

@ -9,7 +9,7 @@ NATIVE_JAVA_CLASSES = \
org.rocksdb.AbstractTransactionNotifier\
org.rocksdb.AbstractWalFilter\
org.rocksdb.BackupEngine\
org.rocksdb.BackupableDBOptions\
org.rocksdb.BackupEngineOptions\
org.rocksdb.BlockBasedTableConfig\
org.rocksdb.BloomFilter\
org.rocksdb.Checkpoint\
@ -105,7 +105,7 @@ ARCH := $(shell getconf LONG_BIT)
SHA256_CMD ?= sha256sum
JAVA_TESTS = \
org.rocksdb.BackupableDBOptionsTest\
org.rocksdb.BackupEngineOptionsTest\
org.rocksdb.BackupEngineTest\
org.rocksdb.BlobOptionsTest\
org.rocksdb.BlockBasedTableConfigTest\

View File

@ -5,103 +5,104 @@
//
// This file implements the "bridge" between Java and C++ and enables
// calling c++ ROCKSDB_NAMESPACE::BackupEnginge and
// ROCKSDB_NAMESPACE::BackupableDBOptions methods from Java side.
// ROCKSDB_NAMESPACE::BackupEngineOptions methods from Java side.
#include <jni.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include "include/org_rocksdb_BackupableDBOptions.h"
#include "rocksdb/utilities/backupable_db.h"
#include "include/org_rocksdb_BackupEngineOptions.h"
#include "rocksdb/utilities/backup_engine.h"
#include "rocksjni/portal.h"
///////////////////////////////////////////////////////////////////////////
// BackupDBOptions
/*
* Class: org_rocksdb_BackupableDBOptions
* Method: newBackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: newBackupEngineOptions
* Signature: (Ljava/lang/String;)J
*/
jlong Java_org_rocksdb_BackupableDBOptions_newBackupableDBOptions(
jlong Java_org_rocksdb_BackupEngineOptions_newBackupEngineOptions(
JNIEnv* env, jclass /*jcls*/, jstring jpath) {
const char* cpath = env->GetStringUTFChars(jpath, nullptr);
if (cpath == nullptr) {
// exception thrown: OutOfMemoryError
return 0;
}
auto* bopt = new ROCKSDB_NAMESPACE::BackupableDBOptions(cpath);
auto* bopt = new ROCKSDB_NAMESPACE::BackupEngineOptions(cpath);
env->ReleaseStringUTFChars(jpath, cpath);
return reinterpret_cast<jlong>(bopt);
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: backupDir
* Signature: (J)Ljava/lang/String;
*/
jstring Java_org_rocksdb_BackupableDBOptions_backupDir(JNIEnv* env,
jstring Java_org_rocksdb_BackupEngineOptions_backupDir(JNIEnv* env,
jobject /*jopt*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return env->NewStringUTF(bopt->backup_dir.c_str());
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setBackupEnv
* 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) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
auto* rocks_env =
reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(jrocks_env_handle);
bopt->backup_env = rocks_env;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setShareTableFiles
* Signature: (JZ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setShareTableFiles(JNIEnv* /*env*/,
void Java_org_rocksdb_BackupEngineOptions_setShareTableFiles(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle,
jboolean flag) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->share_table_files = flag;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: shareTableFiles
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_BackupableDBOptions_shareTableFiles(JNIEnv* /*env*/,
jboolean Java_org_rocksdb_BackupEngineOptions_shareTableFiles(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->share_table_files;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setInfoLog
* Signature: (JJ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setInfoLog(JNIEnv* /*env*/,
void Java_org_rocksdb_BackupEngineOptions_setInfoLog(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle,
jlong /*jlogger_handle*/) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
auto* sptr_logger =
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::LoggerJniCallback>*>(
jhandle);
@ -109,122 +110,122 @@ void Java_org_rocksdb_BackupableDBOptions_setInfoLog(JNIEnv* /*env*/,
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setSync
* Signature: (JZ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setSync(JNIEnv* /*env*/,
void Java_org_rocksdb_BackupEngineOptions_setSync(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle,
jboolean flag) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->sync = flag;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: sync
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_BackupableDBOptions_sync(JNIEnv* /*env*/,
jboolean Java_org_rocksdb_BackupEngineOptions_sync(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->sync;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setDestroyOldData
* Signature: (JZ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setDestroyOldData(JNIEnv* /*env*/,
void Java_org_rocksdb_BackupEngineOptions_setDestroyOldData(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle,
jboolean flag) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->destroy_old_data = flag;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: destroyOldData
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_BackupableDBOptions_destroyOldData(JNIEnv* /*env*/,
jboolean Java_org_rocksdb_BackupEngineOptions_destroyOldData(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->destroy_old_data;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setBackupLogFiles
* Signature: (JZ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setBackupLogFiles(JNIEnv* /*env*/,
void Java_org_rocksdb_BackupEngineOptions_setBackupLogFiles(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle,
jboolean flag) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->backup_log_files = flag;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: backupLogFiles
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_BackupableDBOptions_backupLogFiles(JNIEnv* /*env*/,
jboolean Java_org_rocksdb_BackupEngineOptions_backupLogFiles(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->backup_log_files;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setBackupRateLimit
* Signature: (JJ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimit(
void Java_org_rocksdb_BackupEngineOptions_setBackupRateLimit(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
jlong jbackup_rate_limit) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->backup_rate_limit = jbackup_rate_limit;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: backupRateLimit
* Signature: (J)J
*/
jlong Java_org_rocksdb_BackupableDBOptions_backupRateLimit(JNIEnv* /*env*/,
jlong Java_org_rocksdb_BackupEngineOptions_backupRateLimit(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->backup_rate_limit;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setBackupRateLimiter
* Signature: (JJ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimiter(
void Java_org_rocksdb_BackupEngineOptions_setBackupRateLimiter(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
jlong jrate_limiter_handle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
auto* sptr_rate_limiter =
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
jrate_limiter_handle);
@ -232,41 +233,41 @@ void Java_org_rocksdb_BackupableDBOptions_setBackupRateLimiter(
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setRestoreRateLimit
* Signature: (JJ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimit(
void Java_org_rocksdb_BackupEngineOptions_setRestoreRateLimit(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
jlong jrestore_rate_limit) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->restore_rate_limit = jrestore_rate_limit;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: restoreRateLimit
* Signature: (J)J
*/
jlong Java_org_rocksdb_BackupableDBOptions_restoreRateLimit(JNIEnv* /*env*/,
jlong Java_org_rocksdb_BackupEngineOptions_restoreRateLimit(JNIEnv* /*env*/,
jobject /*jobj*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->restore_rate_limit;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setRestoreRateLimiter
* Signature: (JJ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimiter(
void Java_org_rocksdb_BackupEngineOptions_setRestoreRateLimiter(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
jlong jrate_limiter_handle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
auto* sptr_rate_limiter =
reinterpret_cast<std::shared_ptr<ROCKSDB_NAMESPACE::RateLimiter>*>(
jrate_limiter_handle);
@ -274,90 +275,90 @@ void Java_org_rocksdb_BackupableDBOptions_setRestoreRateLimiter(
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setShareFilesWithChecksum
* Signature: (JZ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setShareFilesWithChecksum(
void Java_org_rocksdb_BackupEngineOptions_setShareFilesWithChecksum(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle, jboolean flag) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->share_files_with_checksum = flag;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: shareFilesWithChecksum
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_BackupableDBOptions_shareFilesWithChecksum(
jboolean Java_org_rocksdb_BackupEngineOptions_shareFilesWithChecksum(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return bopt->share_files_with_checksum;
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setMaxBackgroundOperations
* Signature: (JI)V
*/
void Java_org_rocksdb_BackupableDBOptions_setMaxBackgroundOperations(
void Java_org_rocksdb_BackupEngineOptions_setMaxBackgroundOperations(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
jint max_background_operations) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->max_background_operations = static_cast<int>(max_background_operations);
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: maxBackgroundOperations
* Signature: (J)I
*/
jint Java_org_rocksdb_BackupableDBOptions_maxBackgroundOperations(
jint Java_org_rocksdb_BackupEngineOptions_maxBackgroundOperations(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return static_cast<jint>(bopt->max_background_operations);
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: setCallbackTriggerIntervalSize
* Signature: (JJ)V
*/
void Java_org_rocksdb_BackupableDBOptions_setCallbackTriggerIntervalSize(
void Java_org_rocksdb_BackupEngineOptions_setCallbackTriggerIntervalSize(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle,
jlong jcallback_trigger_interval_size) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
bopt->callback_trigger_interval_size =
static_cast<uint64_t>(jcallback_trigger_interval_size);
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: callbackTriggerIntervalSize
* Signature: (J)J
*/
jlong Java_org_rocksdb_BackupableDBOptions_callbackTriggerIntervalSize(
jlong Java_org_rocksdb_BackupEngineOptions_callbackTriggerIntervalSize(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
return static_cast<jlong>(bopt->callback_trigger_interval_size);
}
/*
* Class: org_rocksdb_BackupableDBOptions
* Class: org_rocksdb_BackupEngineOptions
* Method: disposeInternal
* Signature: (J)V
*/
void Java_org_rocksdb_BackupableDBOptions_disposeInternal(JNIEnv* /*env*/,
void Java_org_rocksdb_BackupEngineOptions_disposeInternal(JNIEnv* /*env*/,
jobject /*jopt*/,
jlong jhandle) {
auto* bopt =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(jhandle);
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(jhandle);
assert(bopt != nullptr);
delete bopt;
}

View File

@ -7,10 +7,11 @@
// calling C++ ROCKSDB_NAMESPACE::BackupEngine methods from the Java side.
#include <jni.h>
#include <vector>
#include "include/org_rocksdb_BackupEngine.h"
#include "rocksdb/utilities/backupable_db.h"
#include "rocksdb/utilities/backup_engine.h"
#include "rocksjni/portal.h"
/*
@ -20,14 +21,14 @@
*/
jlong Java_org_rocksdb_BackupEngine_open(JNIEnv* env, jclass /*jcls*/,
jlong env_handle,
jlong backupable_db_options_handle) {
jlong backup_engine_options_handle) {
auto* rocks_env = reinterpret_cast<ROCKSDB_NAMESPACE::Env*>(env_handle);
auto* backupable_db_options =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupableDBOptions*>(
backupable_db_options_handle);
auto* backup_engine_options =
reinterpret_cast<ROCKSDB_NAMESPACE::BackupEngineOptions*>(
backup_engine_options_handle);
ROCKSDB_NAMESPACE::BackupEngine* backup_engine;
auto status = ROCKSDB_NAMESPACE::BackupEngine::Open(
rocks_env, *backupable_db_options, &backup_engine);
rocks_env, *backup_engine_options, &backup_engine);
if (status.ok()) {
return reinterpret_cast<jlong>(backup_engine);

View File

@ -30,7 +30,7 @@
#include "rocksdb/rate_limiter.h"
#include "rocksdb/status.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/transaction_db.h"
#include "rocksdb/utilities/write_batch_with_index.h"
@ -3409,13 +3409,13 @@ class HistogramDataJni : public JavaClass {
}
};
// The portal class for org.rocksdb.BackupableDBOptions
class BackupableDBOptionsJni
: public RocksDBNativeClass<ROCKSDB_NAMESPACE::BackupableDBOptions*,
BackupableDBOptionsJni> {
// The portal class for org.rocksdb.BackupEngineOptions
class BackupEngineOptionsJni
: public RocksDBNativeClass<ROCKSDB_NAMESPACE::BackupEngineOptions*,
BackupEngineOptionsJni> {
public:
/**
* Get the Java Class org.rocksdb.BackupableDBOptions
* Get the Java Class org.rocksdb.BackupEngineOptions
*
* @param env A pointer to the Java environment
*
@ -3425,7 +3425,7 @@ class BackupableDBOptionsJni
*/
static jclass getJClass(JNIEnv* env) {
return RocksDBNativeClass::getJClass(env,
"org/rocksdb/BackupableDBOptions");
"org/rocksdb/BackupEngineOptions");
}
};

View File

@ -10,10 +10,11 @@
#include <jni.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "include/org_rocksdb_RestoreOptions.h"
#include "rocksdb/utilities/backupable_db.h"
#include "rocksdb/utilities/backup_engine.h"
#include "rocksjni/portal.h"
/*
* Class: org_rocksdb_RestoreOptions

View File

@ -32,8 +32,8 @@ public class BackupEngine extends RocksObject implements AutoCloseable {
* @return A new BackupEngine instance
* @throws RocksDBException thrown if the backup engine could not be opened
*/
public static BackupEngine open(final Env env,
final BackupableDBOptions options) throws RocksDBException {
public static BackupEngine open(final Env env, final BackupEngineOptions options)
throws RocksDBException {
return new BackupEngine(open(env.nativeHandle_, options.nativeHandle_));
}

View File

@ -8,7 +8,7 @@ package org.rocksdb;
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}.
* </p>
* <p>Note that dispose() must be called before an Options instance
@ -16,22 +16,21 @@ import java.io.File;
*
* @see org.rocksdb.BackupEngine
*/
public class BackupableDBOptions extends RocksObject {
public class BackupEngineOptions extends RocksObject {
private Env backupEnv = null;
private Logger infoLog = null;
private RateLimiter backupRateLimiter = 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
* name. Best to set this to {@code db name_ + "/backups"}
* @throws java.lang.IllegalArgumentException if illegal path is used.
*/
public BackupableDBOptions(final String path) {
super(newBackupableDBOptions(ensureWritableFile(path)));
public BackupEngineOptions(final String path) {
super(newBackupEngineOptions(ensureWritableFile(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() {
assert(isOwningHandle());
@ -62,9 +61,9 @@ public class BackupableDBOptions extends RocksObject {
* Default: null
*
* @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());
setBackupEnv(nativeHandle_, env.nativeHandle_);
this.backupEnv = env;
@ -95,9 +94,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <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());
setShareTableFiles(nativeHandle_, shareTableFiles);
return this;
@ -118,9 +117,9 @@ public class BackupableDBOptions extends RocksObject {
* Set the logger to use for Backup info and error messages
*
* @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());
setInfoLog(nativeHandle_, logger.nativeHandle_);
this.infoLog = logger;
@ -148,9 +147,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <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());
setSync(nativeHandle_, sync);
return this;
@ -174,9 +173,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <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());
setDestroyOldData(nativeHandle_, destroyOldData);
return this;
@ -201,9 +200,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <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());
setBackupLogFiles(nativeHandle_, backupLogFiles);
return this;
@ -227,9 +226,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <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());
backupRateLimit = (backupRateLimit <= 0) ? 0 : backupRateLimit;
setBackupRateLimit(nativeHandle_, backupRateLimit);
@ -255,9 +254,9 @@ public class BackupableDBOptions extends RocksObject {
* Default: null
*
* @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());
setBackupRateLimiter(nativeHandle_, backupRateLimiter.nativeHandle_);
this.backupRateLimiter = backupRateLimiter;
@ -285,9 +284,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <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());
restoreRateLimit = (restoreRateLimit <= 0) ? 0 : restoreRateLimit;
setRestoreRateLimit(nativeHandle_, restoreRateLimit);
@ -313,9 +312,9 @@ public class BackupableDBOptions extends RocksObject {
* Default: null
*
* @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());
setRestoreRateLimiter(nativeHandle_, restoreRateLimiter.nativeHandle_);
this.restoreRateLimiter = restoreRateLimiter;
@ -349,10 +348,9 @@ public class BackupableDBOptions extends RocksObject {
*
* <p>Default: false</p>
*
* @return instance of current BackupableDBOptions.
* @return instance of current BackupEngineOptions.
*/
public BackupableDBOptions setShareFilesWithChecksum(
final boolean shareFilesWithChecksum) {
public BackupEngineOptions setShareFilesWithChecksum(final boolean shareFilesWithChecksum) {
assert(isOwningHandle());
setShareFilesWithChecksum(nativeHandle_, shareFilesWithChecksum);
return this;
@ -377,10 +375,9 @@ public class BackupableDBOptions extends RocksObject {
* Default: 1
*
* @param maxBackgroundOperations The maximum number of background threads
* @return instance of current BackupableDBOptions.
* @return instance of current BackupEngineOptions.
*/
public BackupableDBOptions setMaxBackgroundOperations(
final int maxBackgroundOperations) {
public BackupEngineOptions setMaxBackgroundOperations(final int maxBackgroundOperations) {
assert(isOwningHandle());
setMaxBackgroundOperations(nativeHandle_, maxBackgroundOperations);
return this;
@ -408,9 +405,9 @@ public class BackupableDBOptions extends RocksObject {
*
* @param callbackTriggerIntervalSize The interval size for the
* callback trigger
* @return instance of current BackupableDBOptions.
* @return instance of current BackupEngineOptions.
*/
public BackupableDBOptions setCallbackTriggerIntervalSize(
public BackupEngineOptions setCallbackTriggerIntervalSize(
final long callbackTriggerIntervalSize) {
assert(isOwningHandle());
setCallbackTriggerIntervalSize(nativeHandle_, callbackTriggerIntervalSize);
@ -430,7 +427,7 @@ public class BackupableDBOptions extends RocksObject {
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 void setBackupEnv(final long handle, final long envHandle);
private native void setShareTableFiles(long handle, boolean flag);

View File

@ -19,7 +19,7 @@ public class RestoreOptions extends RocksObject {
* @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
* 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.
* Default: false
*/

View File

@ -14,8 +14,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class BackupableDBOptionsTest {
public class BackupEngineOptionsTest {
private final static String ARBITRARY_PATH =
System.getProperty("java.io.tmpdir");
@ -31,8 +30,7 @@ public class BackupableDBOptionsTest {
@Test
public void backupDir() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
assertThat(backupableDBOptions.backupDir()).
isEqualTo(ARBITRARY_PATH);
}
@ -40,8 +38,7 @@ public class BackupableDBOptionsTest {
@Test
public void env() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
assertThat(backupableDBOptions.backupEnv()).
isNull();
@ -55,8 +52,7 @@ public class BackupableDBOptionsTest {
@Test
public void shareTableFiles() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final boolean value = rand.nextBoolean();
backupableDBOptions.setShareTableFiles(value);
assertThat(backupableDBOptions.shareTableFiles()).
@ -66,8 +62,7 @@ public class BackupableDBOptionsTest {
@Test
public void infoLog() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
assertThat(backupableDBOptions.infoLog()).
isNull();
@ -87,8 +82,7 @@ public class BackupableDBOptionsTest {
@Test
public void sync() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final boolean value = rand.nextBoolean();
backupableDBOptions.setSync(value);
assertThat(backupableDBOptions.sync()).isEqualTo(value);
@ -97,8 +91,7 @@ public class BackupableDBOptionsTest {
@Test
public void destroyOldData() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH);) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH);) {
final boolean value = rand.nextBoolean();
backupableDBOptions.setDestroyOldData(value);
assertThat(backupableDBOptions.destroyOldData()).
@ -108,8 +101,7 @@ public class BackupableDBOptionsTest {
@Test
public void backupLogFiles() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final boolean value = rand.nextBoolean();
backupableDBOptions.setBackupLogFiles(value);
assertThat(backupableDBOptions.backupLogFiles()).
@ -119,8 +111,7 @@ public class BackupableDBOptionsTest {
@Test
public void backupRateLimit() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final long value = Math.abs(rand.nextLong());
backupableDBOptions.setBackupRateLimit(value);
assertThat(backupableDBOptions.backupRateLimit()).
@ -134,8 +125,7 @@ public class BackupableDBOptionsTest {
@Test
public void backupRateLimiter() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
assertThat(backupableDBOptions.backupEnv()).
isNull();
@ -150,8 +140,7 @@ public class BackupableDBOptionsTest {
@Test
public void restoreRateLimit() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final long value = Math.abs(rand.nextLong());
backupableDBOptions.setRestoreRateLimit(value);
assertThat(backupableDBOptions.restoreRateLimit()).
@ -165,8 +154,7 @@ public class BackupableDBOptionsTest {
@Test
public void restoreRateLimiter() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
assertThat(backupableDBOptions.backupEnv()).
isNull();
@ -181,8 +169,7 @@ public class BackupableDBOptionsTest {
@Test
public void shareFilesWithChecksum() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
boolean value = rand.nextBoolean();
backupableDBOptions.setShareFilesWithChecksum(value);
assertThat(backupableDBOptions.shareFilesWithChecksum()).
@ -192,8 +179,7 @@ public class BackupableDBOptionsTest {
@Test
public void maxBackgroundOperations() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final int value = rand.nextInt();
backupableDBOptions.setMaxBackgroundOperations(value);
assertThat(backupableDBOptions.maxBackgroundOperations()).
@ -203,8 +189,7 @@ public class BackupableDBOptionsTest {
@Test
public void callbackTriggerIntervalSize() {
try (final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH)) {
try (final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH)) {
final long value = rand.nextLong();
backupableDBOptions.setCallbackTriggerIntervalSize(value);
assertThat(backupableDBOptions.callbackTriggerIntervalSize()).
@ -215,135 +200,118 @@ public class BackupableDBOptionsTest {
@Test
public void failBackupDirIsNull() {
exception.expect(IllegalArgumentException.class);
try (final BackupableDBOptions opts = new BackupableDBOptions(null)) {
try (final BackupEngineOptions opts = new BackupEngineOptions(null)) {
//no-op
}
}
@Test
public void failBackupDirIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.backupDir();
}
}
@Test
public void failSetShareTableFilesIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setShareTableFiles(true);
}
}
@Test
public void failShareTableFilesIfDisposed() {
try (BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.shareTableFiles();
}
}
@Test
public void failSetSyncIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setSync(true);
}
}
@Test
public void failSyncIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.sync();
}
}
@Test
public void failSetDestroyOldDataIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setDestroyOldData(true);
}
}
@Test
public void failDestroyOldDataIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.destroyOldData();
}
}
@Test
public void failSetBackupLogFilesIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setBackupLogFiles(true);
}
}
@Test
public void failBackupLogFilesIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.backupLogFiles();
}
}
@Test
public void failSetBackupRateLimitIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setBackupRateLimit(1);
}
}
@Test
public void failBackupRateLimitIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.backupRateLimit();
}
}
@Test
public void failSetRestoreRateLimitIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setRestoreRateLimit(1);
}
}
@Test
public void failRestoreRateLimitIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.restoreRateLimit();
}
}
@Test
public void failSetShareFilesWithChecksumIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.setShareFilesWithChecksum(true);
}
}
@Test
public void failShareFilesWithChecksumIfDisposed() {
try (final BackupableDBOptions options =
setupUninitializedBackupableDBOptions(exception)) {
try (final BackupEngineOptions options = setupUninitializedBackupEngineOptions(exception)) {
options.shareFilesWithChecksum();
}
}
private BackupableDBOptions setupUninitializedBackupableDBOptions(
ExpectedException exception) {
final BackupableDBOptions backupableDBOptions =
new BackupableDBOptions(ARBITRARY_PATH);
private BackupEngineOptions setupUninitializedBackupEngineOptions(ExpectedException exception) {
final BackupEngineOptions backupableDBOptions = new BackupEngineOptions(ARBITRARY_PATH);
backupableDBOptions.close();
exception.expect(AssertionError.class);
return backupableDBOptions;

View File

@ -38,9 +38,9 @@ public class BackupEngineTest {
prepareDatabase(db);
// Create two backups
try(final BackupableDBOptions bopt = new BackupableDBOptions(
backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
try (final BackupEngineOptions bopt =
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
be.createNewBackup(db, false);
be.createNewBackup(db, true);
verifyNumberOfValidBackups(be, 2);
@ -57,9 +57,9 @@ public class BackupEngineTest {
// Fill database with some test values
prepareDatabase(db);
// Create two backups
try(final BackupableDBOptions bopt = new BackupableDBOptions(
backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
try (final BackupEngineOptions bopt =
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
be.createNewBackup(db, false);
be.createNewBackup(db, true);
final List<BackupInfo> backupInfo =
@ -85,9 +85,9 @@ public class BackupEngineTest {
// Fill database with some test values
prepareDatabase(db);
// Create four backups
try(final BackupableDBOptions bopt = new BackupableDBOptions(
backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
try (final BackupEngineOptions bopt =
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
be.createNewBackup(db, false);
be.createNewBackup(db, true);
be.createNewBackup(db, true);
@ -116,8 +116,8 @@ public class BackupEngineTest {
// Fill database with some test values
prepareDatabase(db);
try (final BackupableDBOptions bopt = new BackupableDBOptions(
backupFolder.getRoot().getAbsolutePath());
try (final BackupEngineOptions bopt =
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
be.createNewBackup(db, true);
verifyNumberOfValidBackups(be, 1);
@ -166,8 +166,8 @@ public class BackupEngineTest {
dbFolder.getRoot().getAbsolutePath());
// Fill database with some test values
prepareDatabase(db);
try (final BackupableDBOptions bopt = new BackupableDBOptions(
backupFolder.getRoot().getAbsolutePath());
try (final BackupEngineOptions bopt =
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
be.createNewBackup(db, true);
verifyNumberOfValidBackups(be, 1);
@ -215,8 +215,8 @@ public class BackupEngineTest {
prepareDatabase(db);
// Create two backups
try (final BackupableDBOptions bopt =
new BackupableDBOptions(backupFolder.getRoot().getAbsolutePath());
try (final BackupEngineOptions bopt =
new BackupEngineOptions(backupFolder.getRoot().getAbsolutePath());
final BackupEngine be = BackupEngine.open(opt.getEnv(), bopt)) {
final String metadata = String.valueOf(ThreadLocalRandom.current().nextInt());
be.createNewBackupWithMetadata(db, metadata, true);

View File

@ -27,7 +27,7 @@
#include "rocksdb/file_checksum.h"
#include "rocksdb/filter_policy.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/debug.h"
#include "rocksdb/utilities/options_util.h"
@ -3225,8 +3225,8 @@ void BackupCommand::DoCommand() {
}
assert(custom_env != nullptr);
BackupableDBOptions backup_options =
BackupableDBOptions(backup_dir_, custom_env);
BackupEngineOptions backup_options =
BackupEngineOptions(backup_dir_, custom_env);
backup_options.info_log = logger_.get();
backup_options.max_background_operations = num_threads_;
status = BackupEngine::Open(options_.env, backup_options, &backup_engine);
@ -3273,7 +3273,7 @@ void RestoreCommand::DoCommand() {
std::unique_ptr<BackupEngineReadOnly> restore_engine;
Status status;
{
BackupableDBOptions opts(backup_dir_, custom_env);
BackupEngineOptions opts(backup_dir_, custom_env);
opts.info_log = logger_.get();
opts.max_background_operations = num_threads_;
BackupEngineReadOnly* raw_restore_engine_ptr;

View File

@ -6,7 +6,7 @@
#pragma once
#ifndef ROCKSDB_LITE
#include "rocksdb/utilities/backupable_db.h"
#include "rocksdb/utilities/backup_engine.h"
namespace ROCKSDB_NAMESPACE {

View File

@ -9,8 +9,6 @@
#if !defined(ROCKSDB_LITE) && !defined(OS_WIN)
#include "rocksdb/utilities/backupable_db.h"
#include <algorithm>
#include <array>
#include <atomic>
@ -34,7 +32,9 @@
#include "rocksdb/statistics.h"
#include "rocksdb/transaction_log.h"
#include "rocksdb/types.h"
#include "rocksdb/utilities/backup_engine.h"
#include "rocksdb/utilities/options_util.h"
#include "rocksdb/utilities/stackable_db.h"
#include "test_util/sync_point.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
@ -49,11 +49,11 @@
namespace ROCKSDB_NAMESPACE {
namespace {
using ShareFilesNaming = BackupableDBOptions::ShareFilesNaming;
using ShareFilesNaming = BackupEngineOptions::ShareFilesNaming;
const auto kLegacyCrc32cAndFileSize =
BackupableDBOptions::kLegacyCrc32cAndFileSize;
const auto kUseDbSessionId = BackupableDBOptions::kUseDbSessionId;
const auto kFlagIncludeFileSize = BackupableDBOptions::kFlagIncludeFileSize;
BackupEngineOptions::kLegacyCrc32cAndFileSize;
const auto kUseDbSessionId = BackupEngineOptions::kUseDbSessionId;
const auto kFlagIncludeFileSize = BackupEngineOptions::kFlagIncludeFileSize;
const auto kNamingDefault = kUseDbSessionId | kFlagIncludeFileSize;
class DummyDB : public StackableDB {
@ -671,7 +671,7 @@ class BackupEngineTest : public testing::Test {
#endif // ROCKSDB_MODIFY_NPHASH
// set up backup db options
backupable_options_.reset(new BackupableDBOptions(
backupable_options_.reset(new BackupEngineOptions(
backupdir_, test_backup_env_.get(), /*share_table_files*/ true,
logger_.get(), kUseSync));
@ -987,7 +987,7 @@ class BackupEngineTest : public testing::Test {
Options options_;
protected:
std::unique_ptr<BackupableDBOptions> backupable_options_;
std::unique_ptr<BackupEngineOptions> backupable_options_;
}; // BackupEngineTest
void AppendPath(const std::string& path, std::vector<std::string>& v) {
@ -3465,7 +3465,7 @@ TEST_F(BackupEngineTest, Concurrency) {
Options db_opts = options_;
db_opts.wal_dir = "";
db_opts.create_if_missing = false;
BackupableDBOptions be_opts = *backupable_options_;
BackupEngineOptions be_opts = *backupable_options_;
be_opts.destroy_old_data = false;
std::mt19937 rng{std::random_device()()};

View File

@ -327,18 +327,6 @@ Status DBWithTTLImpl::Close() {
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() {
static std::once_flag once;
std::call_once(once, [&]() {

View File

@ -16,7 +16,6 @@
#include "rocksdb/merge_operator.h"
#include "rocksdb/system_clock.h"
#include "rocksdb/utilities/db_ttl.h"
#include "rocksdb/utilities/utility_db.h"
#include "utilities/compaction_filters/layered_compaction_filter_base.h"
#ifdef _WIN32