]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Modified code to have the max urgent data size fixed.
authorPritha Srivastava <prsrivas@redhat.com>
Mon, 29 Jul 2019 07:31:25 +0000 (13:01 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 15 Oct 2019 17:34:20 +0000 (23:04 +0530)
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
src/cls/queue/cls_queue.cc
src/cls/queue/cls_queue_client.cc
src/cls/queue/cls_queue_ops.h
src/cls/queue/cls_queue_src.cc
src/cls/queue/cls_queue_types.h
src/cls/rgw_gc/cls_rgw_gc.cc
src/common/legacy_config_opts.h
src/common/options.cc

index c939b847b7f85f621bed74e62cbee59be61960a1..7b72c7bdfa0484a0a0a2c99ac40343c72b27e989 100644 (file)
@@ -18,7 +18,6 @@ static int cls_queue_init(cls_method_context_t hctx, bufferlist *in, bufferlist
 {
   auto in_iter = in->cbegin();
   cls_queue_init_op op;
-  op.has_urgent_data = false;
   try {
     decode(op, in_iter);
   } catch (buffer::error& err) {
index bfa6e0a252bb041f46602bf871c0ebfe275e4b8c..97f67d3d74ee8d881cb6ab162f83b627fd10186c 100644 (file)
@@ -12,8 +12,8 @@ void cls_queue_init(ObjectWriteOperation& op, const string& queue_name, uint64_t
 {
   bufferlist in;
   cls_queue_init_op call;
-  call.has_urgent_data = false;
-  call.head.queue_size = size;
+  call.max_urgent_data_size = 0;
+  call.queue_size = size;
   encode(call, in);
   op.exec(QUEUE_CLASS, QUEUE_INIT, in);
 }
index 9c5a78ea2fb6da9251b57f230ed7ffe33d43e277..e48b03dd20fcfc08f12855539e86efa84443095e 100644 (file)
@@ -4,25 +4,25 @@
 #include "cls/queue/cls_queue_types.h"
 
 struct cls_queue_init_op {
-  cls_queue_head head;
-  uint64_t head_size{0};
-  bool has_urgent_data{false};
+  uint64_t queue_size{0};
+  uint64_t max_urgent_data_size{0};
+  bufferlist bl_urgent_data;
 
   cls_queue_init_op() {}
 
   void encode(bufferlist& bl) const {
     ENCODE_START(1, 1, bl);
-    encode(head, bl);
-    encode(head_size, bl);
-    encode(has_urgent_data, bl);
+    encode(queue_size, bl);
+    encode(max_urgent_data_size, bl);
+    encode(bl_urgent_data, bl);
     ENCODE_FINISH(bl);
   }
 
   void decode(bufferlist::const_iterator& bl) {
     DECODE_START(1, bl);
-    decode(head, bl);
-    decode(head_size, bl);
-    decode(has_urgent_data, bl);
+    decode(queue_size, bl);
+    decode(max_urgent_data_size, bl);
+    decode(bl_urgent_data, bl);
     DECODE_FINISH(bl);
   }
 
index 22a88a07eb32666f2bf48272b4df9245987877cb..77b0a560d76d46cfddd096433323b243bf7ec612 100644 (file)
@@ -105,30 +105,15 @@ int queue_init(cls_method_context_t hctx, const cls_queue_init_op& op)
     return ret;
   }
 
-  head = std::move(op.head);
-
-  if (op.has_urgent_data) {
-    if (op.head_size == 0) {
-      head.max_head_size = QUEUE_HEAD_SIZE_4K;
-      head.tail.offset = head.front.offset = QUEUE_START_OFFSET_4K;
-    } else {
-      head.max_head_size = op.head_size;
-      head.tail.offset = head.front.offset = head.max_head_size;
-    }
-    bufferlist bl_non_urgent;
-    uint16_t queue_start = QUEUE_HEAD_START;
-    uint64_t queue_encoded_len = 0;//dummy value for calculating max size of urgent data
-    encode(queue_start, bl_non_urgent);
-    encode(queue_encoded_len, bl_non_urgent);
-    encode(head, bl_non_urgent);
-    head.max_urgent_data_size = head.max_head_size - (bl_non_urgent.length() - head.bl_urgent_data.length());
-  } else {
-    head.max_head_size = QUEUE_HEAD_SIZE_1K;
-    head.tail.offset = head.front.offset = QUEUE_START_OFFSET_1K;
-    head.max_urgent_data_size = 0;
+  if (op.bl_urgent_data.length() > 0) {
+    head.bl_urgent_data = op.bl_urgent_data;
   }
+
+  head.max_head_size = QUEUE_HEAD_SIZE_1K + op.max_urgent_data_size;
+  head.queue_size = op.queue_size + head.max_head_size;
+  head.max_urgent_data_size = op.max_urgent_data_size;
   head.tail.gen = head.front.gen = 0;
-  head.queue_size += head.max_head_size;
+  head.tail.offset = head.front.offset = head.max_head_size;
   
   CLS_LOG(20, "INFO: init_queue_op queue actual size %lu", head.queue_size);
   CLS_LOG(20, "INFO: init_queue_op head size %lu", head.max_head_size);
index e00b7c2f5f777d43b0282d8c4d04198e59cfb766..cf50cb163f45815241caefa0d23e8e90947d44eb 100644 (file)
@@ -4,13 +4,10 @@
 #include <errno.h>
 #include "include/types.h"
 
+//Size of head leaving out urgent data
 #define QUEUE_HEAD_SIZE_1K 1024
-//Actual start offset of queue data
-#define QUEUE_START_OFFSET_1K QUEUE_HEAD_SIZE_1K
 
-#define QUEUE_HEAD_SIZE_4K (4 * 1024)
-//Actual start offset of queue data
-#define QUEUE_START_OFFSET_4K QUEUE_HEAD_SIZE_4K
+#define QUEUE_START_OFFSET_1K QUEUE_HEAD_SIZE_1K
 
 constexpr unsigned int QUEUE_HEAD_START = 0xDEAD;
 constexpr unsigned int QUEUE_ENTRY_START = 0xBEEF;
index e8ddfd12053c09afa6eed8b382e21f98bbcfe53f..1d485753c1ff1195e3a3a2a0501ced3844ee7e1d 100644 (file)
@@ -43,10 +43,10 @@ static int cls_rgw_gc_queue_init(cls_method_context_t hctx, bufferlist *in, buff
   cls_queue_init_op init_op;
 
   CLS_LOG(10, "INFO: cls_rgw_gc_queue_init: queue size is %lu\n", op.size);
-  init_op.head.queue_size = op.size;
-  init_op.head_size = g_ceph_context->_conf->rgw_gc_queue_head_size;
-  init_op.has_urgent_data = true;
-  encode(urgent_data, init_op.head.bl_urgent_data);
+
+  init_op.queue_size = op.size;
+  init_op.max_urgent_data_size = g_ceph_context->_conf->rgw_gc_max_urgent_data_size;
+  encode(urgent_data, init_op.bl_urgent_data);
 
   return queue_init(hctx, init_op);
 }
index 6f9414bc1b66332d417dc41b4df46e2ef6009c25..76a4d62fe63f8f61008019494ed90a727b9e0bc1 100644 (file)
@@ -1564,4 +1564,4 @@ OPTION(rgw_sts_token_introspection_url, OPT_STR)  // url for introspecting web t
 OPTION(rgw_sts_client_id, OPT_STR) // Client Id
 OPTION(rgw_sts_client_secret, OPT_STR) // Client Secret
 OPTION(debug_allow_any_pool_priority, OPT_BOOL)
-OPTION(rgw_gc_queue_head_size, OPT_U32) // GC queue head size
+OPTION(rgw_gc_max_urgent_data_size, OPT_U64) // GC urgent data size
index d2068d5a490f5642f69f53f4027e006ad047f7b6..988050e87baa755acd3f658da637f01c84ece56d 100644 (file)
@@ -6462,9 +6462,9 @@ std::vector<Option> get_rgw_options() {
     .set_description("Max number of keys to remove from garbage collector log in a single operation")
     .add_see_also({"rgw_gc_max_objs", "rgw_gc_obj_min_wait", "rgw_gc_processor_max_time", "rgw_gc_max_concurrent_io"}),
 
-    Option("rgw_gc_queue_head_size", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
-    .set_default(4096)
-    .set_description("size of queue head for gc"),
+    Option("rgw_gc_max_urgent_data_size", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(3072)
+    .set_description("maximum allowed size of urgent data in queue head for gc"),
 
     Option("rgw_s3_success_create_obj_status", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(0)