]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: update metadata log list to match data log list
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 24 Oct 2013 15:34:24 +0000 (08:34 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 24 Oct 2013 15:56:48 +0000 (08:56 -0700)
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>
src/rgw/rgw_admin.cc
src/rgw/rgw_metadata.cc
src/rgw/rgw_metadata.h
src/rgw/rgw_rest_log.cc
src/rgw/rgw_rest_log.h

index b23bf3ba5d4bfba03e1c612e68c70cf39abb4e29..e19ed206c262076c89a3d320f618da7d7397a83b 100644 (file)
@@ -1980,7 +1980,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;
index 23f73e26531d4067db56cd908055522eb7ce069d..1dd6107dc90502339fef14cd8a1932b45870cd71 100644 (file)
@@ -109,9 +109,10 @@ void RGWMetadataLog::complete_list_entries(void *handle) {
 }
 
 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) {
@@ -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;
 
index df4d3f73afa7b7bdf917a98a3890730b646a0c75..0145208dc28ff2e331ac763423bbefcd8a5e60c0 100644 (file)
@@ -150,7 +150,9 @@ public:
   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);
index 18f0697b0b266b3a3ce0e2c0c3c387beeae693d0..2de424fb6e598ed32a1196777d87e3cb11ee0d27 100644 (file)
@@ -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<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();
index 404db84aa7bf3f49086b126b360cf144cc0dc936..ff1bf3466d378558aab620613a97d3a6f903dc68 100644 (file)
@@ -74,9 +74,11 @@ public:
 
 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) {