Skip to content

Commit 6ec74a5

Browse files
committed
rgw/reshard: use cls_rgw_bi_put_entries() when replaying the reshard log
use cls_rgw_bi_put_entries() in BucketReshardShard::flush() to avoid blocking on the extra call to bi_get_vals() Signed-off-by: Casey Bodley <[email protected]>
1 parent e11480a commit 6ec74a5

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

src/rgw/driver/rados/rgw_reshard.cc

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -244,35 +244,11 @@ class BucketReshardShard {
244244

245245
librados::ObjectWriteOperation op;
246246
if (process_log) {
247-
map<RGWObjCategory, rgw_bucket_category_stats> dec_stats;
248-
list<rgw_cls_bi_entry> dec_entries;
249-
set<string> dec_entry_names_wanted;
250-
for (auto& entry : entries) {
251-
store->getRados()->bi_put(op, bs, entry, null_yield);
252-
dec_entry_names_wanted.emplace(entry.idx);
253-
}
254-
255-
// getting the index entry in target shard
256-
int ret = store->getRados()->bi_get_vals(bs, dec_entry_names_wanted, &dec_entries, null_yield);
257-
if(ret < 0) {
258-
derr << "ERROR: bi_get_vals(): " << cpp_strerror(-ret) << dendl;
259-
return ret;
260-
}
261-
262-
for (auto& dec_entry : dec_entries) {
263-
cls_rgw_obj_key cls_key;
264-
RGWObjCategory category;
265-
rgw_bucket_category_stats accounted_stats;
266-
bool account = dec_entry.get_info(&cls_key, &category, &accounted_stats);
267-
if (account) {
268-
auto& dest = dec_stats[category];
269-
dest.total_size += accounted_stats.total_size;
270-
dest.total_size_rounded += accounted_stats.total_size_rounded;
271-
dest.num_entries += accounted_stats.num_entries;
272-
dest.actual_size += accounted_stats.actual_size;
273-
}
274-
}
275-
cls_rgw_bucket_update_stats(op, false, stats, &dec_stats);
247+
// write the entries in bulk and update the stats. since we may have
248+
// already written some of these entries during the InLogrecord stage,
249+
// check for existing entries and decrement their stats first
250+
const bool check_existing = true;
251+
cls_rgw_bi_put_entries(op, std::move(entries), check_existing);
276252
} else {
277253
for (auto& entry : entries) {
278254
store->getRados()->bi_put(op, bs, entry, null_yield);

0 commit comments

Comments
 (0)