mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix: forbid parallel save operations (#2172)
* fix: forbid parallel save operations * feat: add SAVE option to takeover command
This commit is contained in:
parent
c10dac4db2
commit
e6f3522d59
18 changed files with 165 additions and 83 deletions
|
@ -2290,17 +2290,17 @@ VarzValue::Map Service::GetVarzStats() {
|
|||
return res;
|
||||
}
|
||||
|
||||
GlobalState Service::SwitchState(GlobalState from, GlobalState to) {
|
||||
std::pair<GlobalState, bool> Service::SwitchState(GlobalState from, GlobalState to) {
|
||||
lock_guard lk(mu_);
|
||||
if (global_state_ != from)
|
||||
return global_state_;
|
||||
return {global_state_, false};
|
||||
|
||||
VLOG(1) << "Switching state from " << GlobalStateName(from) << " to " << GlobalStateName(to);
|
||||
|
||||
global_state_ = to;
|
||||
|
||||
pp_.Await([&](ProactorBase*) { ServerState::tlocal()->set_gstate(to); });
|
||||
return to;
|
||||
return {to, true};
|
||||
}
|
||||
|
||||
GlobalState Service::GetGlobalState() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue