Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce rdb_snapshot_unique_ptr & make rdb_get_rocksdb_db return reference #1509

Draft
wants to merge 1 commit into
base: fb-mysql-8.0.32
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions storage/rocksdb/clone/donor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ donor::donor(const myrocks::clone::locator &l, const uchar *&loc,

donor::~donor() {
if (m_rdb_file_deletes_disabled) {
auto *const rdb = myrocks::rdb_get_rocksdb_db();
const auto result = rdb->EnableFileDeletions();
auto &rdb = myrocks::rdb_get_rocksdb_db();
const auto result = rdb.EnableFileDeletions();
if (!result.ok()) {
myrocks::rdb_log_status_error(result,
"RocksDB file deletion re-enable failed");
Expand Down Expand Up @@ -700,9 +700,9 @@ int donor::next_checkpoint_locked(bool final, std::size_t &total_new_size) {
auto err = m_checkpoint.cleanup();
if (err != 0) return save_and_return_error(err, "RocksDB checkpoint error");

auto *const rdb = final ? myrocks::rdb_get_rocksdb_db() : nullptr;
if (rdb != nullptr) {
const auto dfd_result = rdb->DisableFileDeletions();
if (final) {
const auto dfd_result =
myrocks::rdb_get_rocksdb_db().DisableFileDeletions();
m_rdb_file_deletes_disabled = dfd_result.ok();
if (!m_rdb_file_deletes_disabled) {
myrocks::rdb_log_status_error(dfd_result,
Expand All @@ -714,7 +714,7 @@ int donor::next_checkpoint_locked(bool final, std::size_t &total_new_size) {

err = m_checkpoint.init();
if (err != 0) {
if (rdb) rdb->EnableFileDeletions();
if (final) myrocks::rdb_get_rocksdb_db().EnableFileDeletions();
return save_and_return_error(err, "RocksDB checkpoint error");
}

Expand All @@ -726,7 +726,7 @@ int donor::next_checkpoint_locked(bool final, std::size_t &total_new_size) {
if (err != 0) {
// Ignore the return value because we are already returning an error
(void)m_checkpoint.cleanup();
if (rdb) rdb->EnableFileDeletions();
if (final) myrocks::rdb_get_rocksdb_db().EnableFileDeletions();
return err;
}

Expand Down
Loading