]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/queue: Populating marker correctly in queue_list_entries, 35241/head
authorPritha Srivastava <prsrivas@redhat.com>
Tue, 28 Apr 2020 16:51:46 +0000 (22:21 +0530)
committerNathan Cutler <ncutler@suse.com>
Tue, 26 May 2020 09:50:18 +0000 (11:50 +0200)
when data is split between two chunks.

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
(cherry picked from commit 864ff430f38ea630cbc7ae84695aa2b6cfb47772)

Conflicts:
src/cls/queue/cls_queue_src.cc
491be9ab38dc3a428755010d733fb207aa4be613 is not being backported to
  octopus

src/cls/queue/cls_queue_src.cc

index b48dcd19f8517188d6fda54c39b1ef8ed5682143..6c332548fe3948966aefa7f3f005012b62836688 100644 (file)
@@ -266,6 +266,7 @@ int queue_list_entries(cls_method_context_t hctx, const cls_queue_list_op& op, c
   uint64_t data_size = 0, num_ops = 0;
   uint16_t entry_start = 0;
   bufferlist bl;
+  string last_marker;
   do
   {
     CLS_LOG(10, "INFO: queue_list_entries(): start_offset is %lu\n", start_offset);
@@ -306,6 +307,10 @@ int queue_list_entries(cls_method_context_t hctx, const cls_queue_list_op& op, c
       CLS_LOG(10, "INFO: queue_list_entries(): index: %u, size_to_process: %lu\n", index, size_to_process);
       cls_queue_entry entry;
       ceph_assert(it.get_off() == index);
+      //Use the last marker saved in previous iteration as the marker for this entry
+      if (offset_populated) {
+        entry.marker = last_marker;
+      }
       //Populate offset if not done in previous iteration
       if (! offset_populated) {
         cls_queue_marker marker = {entry_start_offset + index, gen};
@@ -339,6 +344,7 @@ int queue_list_entries(cls_method_context_t hctx, const cls_queue_list_op& op, c
           // Copy unprocessed data to bl
           bl_chunk.splice(index, size_to_process, &bl);
           offset_populated = true;
+          last_marker = entry.marker;
           CLS_LOG(10, "INFO: queue_list_entries: not enough data to read entry start and data size, breaking out!\n");
           break;
         }
@@ -355,6 +361,7 @@ int queue_list_entries(cls_method_context_t hctx, const cls_queue_list_op& op, c
         it.copy(size_to_process, bl);
         offset_populated = true;
         entry_start_processed = true;
+        last_marker = entry.marker;
         CLS_LOG(10, "INFO: queue_list_entries(): not enough data to read data, breaking out!\n");
         break;
       }
@@ -365,6 +372,7 @@ int queue_list_entries(cls_method_context_t hctx, const cls_queue_list_op& op, c
       data_size = 0;
       entry_start = 0;
       num_ops++;
+      last_marker.clear();
       if (num_ops == op.max) {
         CLS_LOG(10, "INFO: queue_list_entries(): num_ops is same as op.max, hence breaking out from inner loop!\n");
         break;