int cls_rgw_gc_list_decode(const bufferlist& out,
std::list<cls_rgw_gc_obj_info>& entries,
- bool *truncated, std::string& next_marker)
+ bool& truncated, std::string& next_marker)
{
cls_rgw_gc_list_ret ret;
try {
entries.swap(ret.entries);
- if (truncated)
- *truncated = ret.truncated;
+ truncated = ret.truncated;
next_marker = std::move(ret.next_marker);
return 0;
}
uint32_t max, bool expired_only, bufferlist& bl);
int cls_rgw_gc_list_decode(const bufferlist& bl,
std::list<cls_rgw_gc_obj_info>& entries,
- bool *truncated, std::string& next_marker);
+ bool& truncated, std::string& next_marker);
/* lifecycle */
void cls_rgw_lc_get_head(librados::ObjectReadOperation& op, bufferlist& bl);
}
int cls_rgw_gc_queue_list_entries(IoCtx& io_ctx, const string& oid, const string& marker, uint32_t max, bool expired_only,
- list<cls_rgw_gc_obj_info>& entries, bool *truncated, string& next_marker)
+ list<cls_rgw_gc_obj_info>& entries, bool& truncated, string& next_marker)
{
bufferlist in, out;
cls_rgw_gc_list_op op;
entries.swap(ret.entries);
- *truncated = ret.truncated;
+ truncated = ret.truncated;
next_marker = std::move(ret.next_marker);
int cls_rgw_gc_queue_get_capacity(librados::IoCtx& io_ctx, const std::string& oid, uint64_t& size);
void cls_rgw_gc_queue_enqueue(librados::ObjectWriteOperation& op, uint32_t expiration_secs, const cls_rgw_gc_obj_info& info);
int cls_rgw_gc_queue_list_entries(librados::IoCtx& io_ctx, const std::string& oid, const std::string& marker, uint32_t max, bool expired_only,
- std::list<cls_rgw_gc_obj_info>& entries, bool *truncated, std::string& next_marker);
+ std::list<cls_rgw_gc_obj_info>& entries, bool& truncated, std::string& next_marker);
void cls_rgw_gc_queue_remove_entries(librados::ObjectWriteOperation& op, uint32_t num_entries);
void cls_rgw_gc_queue_defer_entry(librados::ObjectWriteOperation& op, uint32_t expiration_secs, const cls_rgw_gc_obj_info& info);
static int gc_list(const DoutPrefixProvider* dpp, optional_yield y, librados::IoCtx& io_ctx,
std::string& oid, std::string& marker, uint32_t max, bool expired_only,
- std::list<cls_rgw_gc_obj_info>& entries, bool *truncated, std::string& next_marker)
+ std::list<cls_rgw_gc_obj_info>& entries, bool& truncated, std::string& next_marker)
{
librados::ObjectReadOperation op;
bufferlist bl;
return cls_rgw_gc_list_decode(bl, entries, truncated, next_marker);
}
-int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue, std::optional<int> shard_id)
+int RGWGC::list(int& index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool& truncated, bool& processing_queue, std::optional<int> shard_id)
{
result.clear();
string next_marker;
int max_index = shard_id.has_value() ? (shard_id.value() + 1) : max_objs;
if (shard_id.has_value()) {
- *index = shard_id.value();
+ index = shard_id.value();
}
- for (; *index < max_index && result.size() < max; (*index)++, marker.clear(), check_queue = false) {
+ for (; index < max_index && result.size() < max; index++, marker.clear(), check_queue = false) {
std::list<cls_rgw_gc_obj_info> entries, queue_entries;
int ret = 0;
//processing_queue is set to true from previous iteration if the queue was under process and probably has more elements in it.
- if (! transitioned_objects_cache[*index] && ! check_queue && ! processing_queue) {
- ret = gc_list(this, null_yield, store->gc_pool_ctx, obj_names[*index], marker, max - result.size(), expired_only, entries, truncated, next_marker);
+ if (! transitioned_objects_cache[index] && ! check_queue && ! processing_queue) {
+ ret = gc_list(this, null_yield, store->gc_pool_ctx, obj_names[index], marker, max - result.size(), expired_only, entries, truncated, next_marker);
if (ret != -ENOENT && ret < 0) {
return ret;
}
obj_version objv;
- cls_version_read(store->gc_pool_ctx, obj_names[*index], &objv);
+ cls_version_read(store->gc_pool_ctx, obj_names[index], &objv);
if (ret == -ENOENT || entries.size() == 0) {
if (objv.ver == 0) {
continue;
} else {
if (! expired_only) {
- transitioned_objects_cache[*index] = true;
+ transitioned_objects_cache[index] = true;
marker.clear();
} else {
std::list<cls_rgw_gc_obj_info> non_expired_entries;
- ret = gc_list(this, null_yield, store->gc_pool_ctx, obj_names[*index], marker, 1, false, non_expired_entries, truncated, next_marker);
+ ret = gc_list(this, null_yield, store->gc_pool_ctx, obj_names[index], marker, 1, false, non_expired_entries, truncated, next_marker);
if (non_expired_entries.size() == 0) {
- transitioned_objects_cache[*index] = true;
+ transitioned_objects_cache[index] = true;
marker.clear();
}
}
marker.clear();
}
}
- if (transitioned_objects_cache[*index] || check_queue || processing_queue) {
+ if (transitioned_objects_cache[index] || check_queue || processing_queue) {
processing_queue = false;
- ret = cls_rgw_gc_queue_list_entries(store->gc_pool_ctx, obj_names[*index], marker, (max - result.size()) - entries.size(), expired_only, queue_entries, truncated, next_marker);
+ ret = cls_rgw_gc_queue_list_entries(store->gc_pool_ctx, obj_names[index], marker, (max - result.size()) - entries.size(), expired_only, queue_entries, truncated, next_marker);
if (ret < 0) {
return ret;
}
marker = next_marker;
- if (*index == max_index - 1) {
- if (queue_entries.size() > 0 && *truncated) {
+ if (index == max_index - 1) {
+ if (queue_entries.size() > 0 && truncated) {
processing_queue = true;
} else {
processing_queue = false;
}
if (result.size() == max) {
- if (queue_entries.size() > 0 && *truncated) {
+ if (queue_entries.size() > 0 && truncated) {
processing_queue = true;
} else {
processing_queue = false;
- *index += 1; //move to next gc object
+ index += 1; //move to next gc object
}
/* close approximation, it might be that the next of the objects don't hold
* anything, in this case truncated should have been false, but we can find
* that out on the next iteration
*/
- *truncated = true;
+ truncated = true;
return 0;
}
}
- *truncated = false;
+ truncated = false;
processing_queue = false;
return 0;
int ret = 0;
if (! transitioned_objects_cache[index]) {
- ret = gc_list(this, y, store->gc_pool_ctx, obj_names[index], marker, max, expired_only, entries, &truncated, next_marker);
+ ret = gc_list(this, y, store->gc_pool_ctx, obj_names[index], marker, max, expired_only, entries, truncated, next_marker);
ldpp_dout(this, 20) <<
"RGWGC::process cls_rgw_gc_list returned with returned:" << ret <<
", entries.size=" << entries.size() << ", truncated=" << truncated <<
cls_version_read(store->gc_pool_ctx, obj_names[index], &objv);
if ((objv.ver == 1) && entries.size() == 0) {
std::list<cls_rgw_gc_obj_info> non_expired_entries;
- ret = gc_list(this, y, store->gc_pool_ctx, obj_names[index], marker, 1, false, non_expired_entries, &truncated, next_marker);
+ ret = gc_list(this, y, store->gc_pool_ctx, obj_names[index], marker, 1, false, non_expired_entries, truncated, next_marker);
if (non_expired_entries.size() == 0) {
transitioned_objects_cache[index] = true;
marker.clear();
}
if (transitioned_objects_cache[index]) {
- ret = cls_rgw_gc_queue_list_entries(store->gc_pool_ctx, obj_names[index], marker, max, expired_only, entries, &truncated, next_marker);
+ ret = cls_rgw_gc_queue_list_entries(store->gc_pool_ctx, obj_names[index], marker, max, expired_only, entries, truncated, next_marker);
ldpp_dout(this, 20) <<
"RGWGC::process cls_rgw_gc_queue_list_entries returned with return value:" << ret <<
", entries.size=" << entries.size() << ", truncated=" << truncated <<
void initialize(CephContext *_cct, RGWRados *_store, optional_yield y);
void finalize();
- int list(int *index, std::string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue, std::optional<int> shard_id = std::nullopt);
+ int list(int& index, std::string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool& truncated, bool& processing_queue, std::optional<int> shard_id = std::nullopt);
int process(int index, int process_max_secs, bool expired_only,
RGWGCIOManager& io_manager, optional_yield y);
int process(bool expired_only, optional_yield y, std::optional<int> shard_id = std::nullopt);
return rgw_rados_operate(dpp, gc_pool_ctx, oid, std::move(op), pbl, y);
}
-int RGWRados::list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue, std::optional<int> shard_id)
+int RGWRados::list_gc_objs(int& index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool& truncated, bool& processing_queue, std::optional<int> shard_id)
{
return gc->list(index, marker, max, expired_only, result, truncated, processing_queue, shard_id);
}
librados::ObjectWriteOperation *op);
int gc_operate(const DoutPrefixProvider *dpp, std::string& oid, librados::ObjectReadOperation&& op, bufferlist *pbl, optional_yield y);
- int list_gc_objs(int *index, std::string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue, std::optional<int> shard_id = std::nullopt);
+ int list_gc_objs(int& index, std::string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool& truncated, bool& processing_queue, std::optional<int> shard_id = std::nullopt);
int process_gc(bool expired_only, optional_yield y, std::optional<int> shard_id = std::nullopt);
bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y);
do {
list<cls_rgw_gc_obj_info> result;
- int ret = static_cast<rgw::sal::RadosStore*>(driver)->getRados()->list_gc_objs(&index, marker, 1000, !include_all, result, &truncated, processing_queue, gc_shard_id);
+ int ret = static_cast<rgw::sal::RadosStore*>(driver)->getRados()->list_gc_objs(index, marker, 1000, !include_all, result, truncated, processing_queue, gc_shard_id);
if (ret < 0) {
cerr << "ERROR: failed to list objs: " << cpp_strerror(-ret) << std::endl;
return 1;
}
static int gc_list(librados::IoCtx& io_ctx, std::string& oid, std::string& marker, uint32_t max, bool expired_only,
- std::list<cls_rgw_gc_obj_info>& entries, bool *truncated, std::string& next_marker)
+ std::list<cls_rgw_gc_obj_info>& entries, bool& truncated, std::string& next_marker)
{
librados::ObjectReadOperation op;
bufferlist bl;
string next_marker;
/* list chains, verify truncated */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 8, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 8, true, entries, truncated, next_marker));
ASSERT_EQ(8, (int)entries.size());
ASSERT_EQ(1, truncated);
next_marker.clear();
/* list all chains, verify not truncated */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 10, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 10, true, entries, truncated, next_marker));
ASSERT_EQ(10, (int)entries.size());
ASSERT_EQ(0, truncated);
string next_marker;
/* list chains, verify truncated */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 8, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 8, true, entries, truncated, next_marker));
ASSERT_EQ(8, (int)entries.size());
ASSERT_EQ(1, truncated);
marker = next_marker;
next_marker.clear();
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 8, true, entries2, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 8, true, entries2, truncated, next_marker));
ASSERT_EQ(2, (int)entries2.size());
ASSERT_EQ(0, truncated);
string next_marker;
/* list chains, verify num entries as expected */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, truncated, next_marker));
ASSERT_EQ(1, (int)entries.size());
ASSERT_EQ(0, truncated);
next_marker.clear();
/* verify list doesn't show deferred entry (this may fail if cluster is thrashing) */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, truncated, next_marker));
ASSERT_EQ(0, (int)entries.size());
ASSERT_EQ(0, truncated);
next_marker.clear();
/* verify list shows deferred entry */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, truncated, next_marker));
ASSERT_EQ(1, (int)entries.size());
ASSERT_EQ(0, truncated);
next_marker.clear();
/* verify entry was removed */
- ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, &truncated, next_marker));
+ ASSERT_EQ(0, gc_list(ioctx, oid, marker, 1, true, entries, truncated, next_marker));
ASSERT_EQ(0, (int)entries.size());
ASSERT_EQ(0, truncated);
string marker, next_marker;
uint64_t max = 1;
bool expired_only = false, truncated;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, truncated, next_marker);
ASSERT_EQ(1, list_info1.size());
for (auto it : list_info1) {
string marker1, next_marker1;
uint64_t max1 = 2;
bool expired_only1 = false, truncated1;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker1, max1, expired_only1, list_info, &truncated1, next_marker1);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker1, max1, expired_only1, list_info, truncated1, next_marker1);
ASSERT_EQ(0, list_info.size());
//Test enqueue
string marker, next_marker;
uint64_t max = 2;
bool expired_only = false, truncated;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, truncated, next_marker);
ASSERT_EQ(2, list_info1.size());
int i = 0;
max = 1;
truncated = false;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info2, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info2, truncated, next_marker);
auto it = list_info2.front();
ASSERT_EQ(1, list_info2.size());
ASSERT_EQ(true, truncated);
std::cerr << "[ ] next_marker is: = " << next_marker << std::endl;
marker = next_marker;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info3, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info3, truncated, next_marker);
it = list_info3.front();
ASSERT_EQ(1, list_info3.size());
ASSERT_EQ(false, truncated);
string marker, next_marker, marker1;
uint64_t max = 10;
bool expired_only = true, truncated;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, truncated, next_marker);
ASSERT_EQ(2, list_info1.size());
int i = 0;
//Test list queue again for all entries
expired_only = false;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info2, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info2, truncated, next_marker);
ASSERT_EQ(1, list_info2.size());
}
string marker, next_marker;
uint64_t max = 2;
bool expired_only = false, truncated;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, truncated, next_marker);
ASSERT_EQ(2, list_info1.size());
int i = 1;
string marker, next_marker;
uint64_t max = 2;
bool expired_only = false, truncated;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, truncated, next_marker);
ASSERT_EQ(2, list_info1.size());
int i = 1;
string marker, next_marker;
uint64_t max = 2;
bool expired_only = false, truncated;
- cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, &truncated, next_marker);
+ cls_rgw_gc_queue_list_entries(ioctx, queue_name, marker, max, expired_only, list_info1, truncated, next_marker);
ASSERT_EQ(2, list_info1.size());
int i = 1;