Skip to content

Commit

Permalink
rgw: orphan: flush bucket index entries only after map is full
Browse files Browse the repository at this point in the history
We otherwise may flush more regularly while we don't have enough entries in the
map

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
  • Loading branch information
theanalyst committed Feb 18, 2019
1 parent 6e483e6 commit ede7ddf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/rgw/rgw_orphan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,10 @@ int RGWOrphanSearch::init(const string& job_name, RGWOrphanSearchInfo *info) {
return r;
}

constexpr auto MAX_LIST_OBJS_ENTRIES = 100;
constexpr int64_t MAX_LIST_OBJS_ENTRIES=100;

max_list_bucket_entries = std::max(store->ctx()->_conf->rgw_list_bucket_min_readahead,
MAX_LIST_OBJS_ENTRIES)
MAX_LIST_OBJS_ENTRIES);

RGWOrphanSearchState state;
r = orphan_store.read_job(job_name, state);
Expand Down Expand Up @@ -502,8 +503,6 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_

deque<RGWRados::Object::Stat> stat_ops;

int count = 0;

do {
vector<rgw_bucket_dir_entry> result;

Expand Down Expand Up @@ -544,13 +543,12 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_
}
}
}
if (++count >= COUNT_BEFORE_FLUSH) {
if (oids.size() >= COUNT_BEFORE_FLUSH) {
ret = log_oids(linked_objs_index, oids);
if (ret < 0) {
cerr << __func__ << ": ERROR: log_oids() returned ret=" << ret << std::endl;
return ret;
}
count = 0;
oids.clear();
}
}
Expand Down

0 comments on commit ede7ddf

Please sign in to comment.