]> git-server-git.apps.pok.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>
Fri, 1 Nov 2013 23:17:30 +0000 (16:17 -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>
(cherry picked from commit e0e8fb1b2b4a308b2a9317e10c6fd53ad48dbfaf)

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 2b8a716115b2ead886a0a83389f6a8ad0924eaf5..2d6b6e8504f2a00da1e8eb429740916b624deec8 100644 (file)
@@ -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;
index 6da1ff5ab24b8f273d7463b7cdccd826e90a3df3..5a300540b759d5dc4247c69a69b251cd5ee938b3 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 50649b6f9010046bf48f63c4f5c4e089742d4ca7..37765a9af5956416e7a634faee2cb787c4496095 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) {