mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
comments
This commit is contained in:
parent
0adaf119bf
commit
7ff2a81aa3
2 changed files with 11 additions and 15 deletions
|
@ -1740,14 +1740,12 @@ GenericError ServerFamily::DoSaveCheckAndStart(const SaveCmdOptions& save_cmd_op
|
||||||
last_save_info_.SetLastSaveError(*res);
|
last_save_info_.SetLastSaveError(*res);
|
||||||
save_controller_.reset();
|
save_controller_.reset();
|
||||||
if (bg_save) {
|
if (bg_save) {
|
||||||
last_bgsave_status_ = false;
|
last_save_info_.last_bgsave_status = false;
|
||||||
}
|
}
|
||||||
return res->error;
|
return res->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bg_save) {
|
last_save_info_.bgsave_in_progress = bg_save;
|
||||||
bgsave_in_progress_ = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1762,8 +1760,8 @@ GenericError ServerFamily::WaitUntilSaveFinished(Transaction* trans, bool ignore
|
||||||
save_info = save_controller_->Finalize();
|
save_info = save_controller_->Finalize();
|
||||||
|
|
||||||
if (save_controller_->IsBgSave()) {
|
if (save_controller_->IsBgSave()) {
|
||||||
bgsave_in_progress_ = false;
|
last_save_info_.bgsave_in_progress = false;
|
||||||
last_bgsave_status_ = save_info.error ? false : true;
|
last_save_info_.last_bgsave_status = !save_info.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_info.error) {
|
if (save_info.error) {
|
||||||
|
@ -2636,12 +2634,10 @@ string ServerFamily::FormatInfoMetrics(const Metrics& m, std::string_view sectio
|
||||||
}
|
}
|
||||||
append("rdb_changes_since_last_success_save", m.events.update);
|
append("rdb_changes_since_last_success_save", m.events.update);
|
||||||
|
|
||||||
{
|
auto save = GetLastSaveInfo();
|
||||||
util::fb2::LockGuard lk{save_mu_};
|
append("rdb_bgsave_in_progress", static_cast<int>(save.bgsave_in_progress));
|
||||||
append("rdb_bgsave_in_progress", bgsave_in_progress_ == true ? 1 : 0);
|
std::string val = save.last_bgsave_status ? "ok" : "err";
|
||||||
std::string val = last_bgsave_status_ == true ? "ok" : "err";
|
append("rdb_last_bgsave_status", val);
|
||||||
append("rdb_last_bgsave_status", val);
|
|
||||||
}
|
|
||||||
|
|
||||||
// when last failed save
|
// when last failed save
|
||||||
append("last_failed_save", save_info.last_error_time);
|
append("last_failed_save", save_info.last_error_time);
|
||||||
|
|
|
@ -146,6 +146,9 @@ struct LastSaveInfo {
|
||||||
GenericError last_error;
|
GenericError last_error;
|
||||||
time_t last_error_time = 0; // epoch time in seconds.
|
time_t last_error_time = 0; // epoch time in seconds.
|
||||||
time_t failed_duration_sec = 0; // epoch time in seconds.
|
time_t failed_duration_sec = 0; // epoch time in seconds.
|
||||||
|
// false if last attempt failed
|
||||||
|
bool last_bgsave_status = true;
|
||||||
|
bool bgsave_in_progress = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SnapshotSpec {
|
struct SnapshotSpec {
|
||||||
|
@ -396,9 +399,6 @@ class ServerFamily {
|
||||||
|
|
||||||
// protected by save_mu_
|
// protected by save_mu_
|
||||||
util::fb2::Fiber bg_save_fb_;
|
util::fb2::Fiber bg_save_fb_;
|
||||||
// false if last attempt failed
|
|
||||||
bool last_bgsave_status_ = true;
|
|
||||||
bool bgsave_in_progress_ = false;
|
|
||||||
|
|
||||||
mutable util::fb2::Mutex peak_stats_mu_;
|
mutable util::fb2::Mutex peak_stats_mu_;
|
||||||
mutable PeakStats peak_stats_;
|
mutable PeakStats peak_stats_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue