Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
replication: fix cold backup bug & config loading (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuangWei authored and qinzuoyan committed Jul 10, 2019
1 parent 886edf7 commit e726a81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/core/tools/common/native_aio_provider.linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ void native_linux_aio_provider::get_event()
struct iocb *io = events[0].obj;
complete_aio(io, static_cast<int>(events[0].res), static_cast<int>(events[0].res2));
} else {
// on error it returns a negated error number (the negative of one of the values listed
// in ERRORS
dwarn("io_getevents returns %d, you probably want to try on another machine:-(", ret);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/common/replication_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void replication_options::initialize()
duplication_disabled = dsn_config_get_value_bool(
"replication", "duplication_disabled", false, "is duplication disabled");
if (allow_non_idempotent_write && !duplication_disabled) {
dfatal("duplication and idempotent write cannot be enabled together");
dassert(false, "duplication and non-idempotent write cannot be enabled together");
}

prepare_timeout_ms_for_secondaries = (int)dsn_config_get_value_uint64(
Expand Down
14 changes: 9 additions & 5 deletions src/dist/replication/meta_server/server_state_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ void server_state::sync_app_from_backup_media(
const configuration_restore_request &request,
std::function<void(error_code, const blob &)> &&callback)
{
dsn::ref_ptr<dsn::future_task<dsn::error_code, dsn::blob>> callback_tsk(
new dsn::future_task<dsn::error_code, dsn::blob>(
LPC_RESTORE_BACKGROUND, std::move(callback), 0));

block_filesystem *blk_fs =
_meta_svc->get_block_service_manager().get_block_filesystem(request.backup_provider_name);
dassert(blk_fs != nullptr, "acquire block_filesyetem failed");
if (blk_fs == nullptr) {
derror("acquire block_filesystem(%s) failed", request.backup_provider_name.c_str());
callback_tsk->enqueue_with(ERR_INVALID_PARAMETERS, dsn::blob());
return;
}

std::string app_metadata = cold_backup::get_app_metadata_file(request.cluster_name,
request.policy_name,
Expand All @@ -65,10 +73,6 @@ void server_state::sync_app_from_backup_media(
->wait();
ddebug("after create app_metadata file(%s)", app_metadata.c_str());

dsn::ref_ptr<dsn::future_task<dsn::error_code, dsn::blob>> callback_tsk(
new dsn::future_task<dsn::error_code, dsn::blob>(
LPC_RESTORE_BACKGROUND, std::move(callback), 0));

if (err != ERR_OK) {
derror("create file failed for meta entry(%s)", app_metadata.c_str());
callback_tsk->enqueue_with(err, dsn::blob());
Expand Down

0 comments on commit e726a81

Please sign in to comment.