From: Josh Durgin Date: Thu, 24 Oct 2013 15:34:24 +0000 (-0700) Subject: rgw: update metadata log list to match data log list X-Git-Tag: v0.67.5~20^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=91997fca6ec6c06beecd63c3e2ae521319fca7c2;p=ceph.git rgw: update metadata log list to match data log list 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 (cherry picked from commit e0e8fb1b2b4a308b2a9317e10c6fd53ad48dbfaf) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 2b8a716115b..2d6b6e8504f 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1888,7 +1888,7 @@ next: 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; diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index 6da1ff5ab24..5a300540b75 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -109,9 +109,10 @@ void RGWMetadataLog::complete_list_entries(void *handle) { } int RGWMetadataLog::list_entries(void *handle, - int max_entries, - list& entries, - bool *truncated) { + int max_entries, + list& entries, + string *last_marker, + bool *truncated) { LogListCtx *ctx = static_cast(handle); if (!max_entries) { @@ -120,7 +121,8 @@ int RGWMetadataLog::list_entries(void *handle, } 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; diff --git a/src/rgw/rgw_metadata.h b/src/rgw/rgw_metadata.h index 50649b6f901..37765a9af59 100644 --- a/src/rgw/rgw_metadata.h +++ b/src/rgw/rgw_metadata.h @@ -150,7 +150,9 @@ public: void complete_list_entries(void *handle); int list_entries(void *handle, int max_entries, - list& entries, bool *truncated); + list& 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); diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index 18f0697b0b2..2de424fb6e5 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -79,9 +79,9 @@ void RGWOp_MDLog_List::execute() { 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; @@ -100,12 +100,18 @@ void RGWOp_MDLog_List::send_response() { if (http_ret < 0) return; - s->formatter->open_array_section("entries"); - for (list::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::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(); diff --git a/src/rgw/rgw_rest_log.h b/src/rgw/rgw_rest_log.h index 404db84aa7b..ff1bf3466d3 100644 --- a/src/rgw/rgw_rest_log.h +++ b/src/rgw/rgw_rest_log.h @@ -74,9 +74,11 @@ public: class RGWOp_MDLog_List : public RGWRESTOp { list 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) {