Skip to content

Commit

Permalink
rgw: move shard marker helper into BucketIndexShardsManager
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Bodley <[email protected]>
  • Loading branch information
cbodley committed Nov 10, 2017
1 parent fa8a071 commit 4be7039
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
9 changes: 9 additions & 0 deletions src/cls/rgw/cls_rgw_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ class BucketIndexShardsManager {
}
return 0;
}

// trim the '<shard-id>#' prefix from a single shard marker if present
static std::string get_shard_marker(const std::string& marker) {
auto p = marker.find(KEY_VALUE_SEPARATOR);
if (p == marker.npos) {
return marker;
}
return marker.substr(p + 1);
}
};

/* bucket index */
Expand Down
15 changes: 2 additions & 13 deletions src/rgw/rgw_cr_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,25 +492,14 @@ int RGWAsyncGetBucketInstanceInfo::_send_request()
return 0;
}

static std::string normalize_shard_marker(const std::string& marker)
{
// markers may be formatted with '<shard-id>#' at the beginning.
// CLSRGWIssueBILogTrim would fix this for us, but it's synchronous
auto p = marker.find(BucketIndexShardsManager::KEY_VALUE_SEPARATOR);
if (p == marker.npos) {
return marker;
}
return marker.substr(p + 1);
}

RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(RGWRados *store,
const RGWBucketInfo& bucket_info,
int shard_id,
const std::string& start_marker,
const std::string& end_marker)
: RGWSimpleCoroutine(store->ctx()), bs(store),
start_marker(normalize_shard_marker(start_marker)),
end_marker(normalize_shard_marker(end_marker))
start_marker(BucketIndexShardsManager::get_shard_marker(start_marker)),
end_marker(BucketIndexShardsManager::get_shard_marker(end_marker))
{
bs.init(bucket_info, shard_id);
}
Expand Down

0 comments on commit 4be7039

Please sign in to comment.