Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange committed Mar 12, 2024
1 parent ffa36eb commit df0ea30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/db_slice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,11 @@ void DbSlice::PostUpdate(DbIndex db_ind, PrimeIterator it, std::string_view key,
}

DbSlice::ItAndExp DbSlice::ExpireIfNeeded(const Context& cntx, PrimeIterator it) {
DCHECK(it->second.HasExpire());
if (!it->second.HasExpire()) {
LOG(ERROR) << "Invalid call to ExpireIfNeeded";
return {it, ExpireIterator{}};
}

auto& db = db_arr_[cntx.db_index];

auto expire_it = db->expire.Find(it->first);
Expand Down
4 changes: 4 additions & 0 deletions src/server/debugcmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ void DebugCmd::Replica(CmdArgList args) {
}

void DebugCmd::Load(string_view filename) {
if (!ServerState::tlocal()->is_master) {
return cntx_->SendError("Replica cannot load data");
}

auto new_state = sf_.service().SwitchState(GlobalState::ACTIVE, GlobalState::LOADING);
if (new_state.first != GlobalState::LOADING) {
LOG(WARNING) << GlobalStateName(new_state.first) << " in progress, ignored";
Expand Down

0 comments on commit df0ea30

Please sign in to comment.