Skip to content

Commit

Permalink
Merge pull request #5361 from ceph/wip-11786.hammer
Browse files Browse the repository at this point in the history
mon: MonitorDBStore: get_next_key() only if prefix matches

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
Loic Dachary committed Nov 17, 2015
1 parent 9764da5 commit a433686
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/mon/MonitorDBStore.h
Expand Up @@ -448,11 +448,15 @@ class MonitorDBStore

virtual pair<string,string> get_next_key() {
assert(iter->valid());
pair<string,string> r = iter->raw_key();
do {
iter->next();
} while (iter->valid() && sync_prefixes.count(iter->raw_key().first) == 0);
return r;

for (; iter->valid(); iter->next()) {
pair<string,string> r = iter->raw_key();
if (sync_prefixes.count(r.first) > 0) {
iter->next();
return r;
}
}
return pair<string,string>();
}

virtual bool _is_valid() {
Expand Down

0 comments on commit a433686

Please sign in to comment.