Send the last marker whether the log is truncated in the same format
as data log list, so clients don't have more needless complexity
handling the difference. Keep bucket index logs the same, since they
contain the marker already, and are not used in exactly the same way
metadata and data logs are.
Backport: dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit
e0e8fb1b2b4a308b2a9317e10c6fd53ad48dbfaf)
bool truncated;
do {
- int ret = meta_log->list_entries(handle, 1000, entries, &truncated);
+ int ret = meta_log->list_entries(handle, 1000, entries, NULL, &truncated);
if (ret < 0) {
cerr << "ERROR: meta_log->list_entries(): " << cpp_strerror(-ret) << std::endl;
return -ret;
}
int RGWMetadataLog::list_entries(void *handle,
- int max_entries,
- list<cls_log_entry>& entries,
- bool *truncated) {
+ int max_entries,
+ list<cls_log_entry>& entries,
+ string *last_marker,
+ bool *truncated) {
LogListCtx *ctx = static_cast<LogListCtx *>(handle);
if (!max_entries) {
}
int ret = store->time_log_list(ctx->cur_oid, ctx->from_time, ctx->end_time,
- max_entries, entries, ctx->marker, truncated);
+ max_entries, entries, ctx->marker,
+ last_marker, truncated);
if ((ret < 0) && (ret != -ENOENT))
return ret;
void complete_list_entries(void *handle);
int list_entries(void *handle,
int max_entries,
- list<cls_log_entry>& entries, bool *truncated);
+ list<cls_log_entry>& entries,
+ string *out_marker,
+ bool *truncated);
int trim(int shard_id, const utime_t& from_time, const utime_t& end_time, const string& start_marker, const string& end_marker);
int get_info(int shard_id, RGWMetadataLogInfo *info);
meta_log->init_list_entries(shard_id, ut_st, ut_et, marker, &handle);
- bool truncated;
do {
- http_ret = meta_log->list_entries(handle, max_entries, entries, &truncated);
+ http_ret = meta_log->list_entries(handle, max_entries, entries,
+ &last_marker, &truncated);
if (http_ret < 0)
break;
if (http_ret < 0)
return;
- s->formatter->open_array_section("entries");
- for (list<cls_log_entry>::iterator iter = entries.begin();
- iter != entries.end(); ++iter) {
- cls_log_entry& entry = *iter;
- store->meta_mgr->dump_log_entry(entry, s->formatter);
- flusher.flush();
+ s->formatter->open_object_section("log_entries");
+ s->formatter->dump_string("marker", last_marker);
+ s->formatter->dump_bool("truncated", truncated);
+ {
+ s->formatter->open_array_section("entries");
+ for (list<cls_log_entry>::iterator iter = entries.begin();
+ iter != entries.end(); ++iter) {
+ cls_log_entry& entry = *iter;
+ store->meta_mgr->dump_log_entry(entry, s->formatter);
+ flusher.flush();
+ }
+ s->formatter->close_section();
}
s->formatter->close_section();
flusher.flush();
class RGWOp_MDLog_List : public RGWRESTOp {
list<cls_log_entry> entries;
+ string last_marker;
+ bool truncated;
int http_ret;
public:
- RGWOp_MDLog_List() : http_ret(0) {}
+ RGWOp_MDLog_List() : truncated(false), http_ret(0) {}
~RGWOp_MDLog_List() {}
int check_caps(RGWUserCaps& caps) {