Skip to content

Commit

Permalink
mgr/MetadataUpdate: add daemon_state.notify_update to contructor
Browse files Browse the repository at this point in the history
Before updating metadata a call site should check if an update has
already been triggered. Adding the notify_update call to the constructor
makes sure the correct info for this check is present.

Signed-off-by: Jan Fajerski <[email protected]>
  • Loading branch information
Jan Fajerski committed Apr 10, 2018
1 parent ee03866 commit 3eaf151
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/mgr/Mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ void Mgr::handle_osd_map()
}

if (update_meta) {
daemon_state.notify_updating(k);
auto c = new MetadataUpdate(daemon_state, k);
std::ostringstream cmd;
cmd << "{\"prefix\": \"osd metadata\", \"id\": "
Expand Down Expand Up @@ -559,7 +558,6 @@ void Mgr::handle_fs_map(MFSMap* m)
}

if (update) {
daemon_state.notify_updating(k);
auto c = new MetadataUpdate(daemon_state, k);

// Older MDS daemons don't have addr in the metadata, so
Expand Down
5 changes: 4 additions & 1 deletion src/mgr/Mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ class MetadataUpdate : public Context
std::string outs;

MetadataUpdate(DaemonStateIndex &daemon_state_, const DaemonKey &key_)
: daemon_state(daemon_state_), key(key_) {}
: daemon_state(daemon_state_), key(key_)
{
daemon_state.notify_updating(key);
}

void set_default(const std::string &k, const std::string &v)
{
Expand Down

0 comments on commit 3eaf151

Please sign in to comment.