]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: configurable window size to RGWOmapAppend
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 13 May 2016 18:20:49 +0000 (11:20 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 13 May 2016 18:20:49 +0000 (11:20 -0700)
We want to be able to disable buffering for certain operations.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rados.cc
src/rgw/rgw_cr_rados.h

index 1f926fa925e551cb184b32ed59b13c6a5f352887..acc4653411e7c17a8d2222cd238d12c694d4e308 100644 (file)
@@ -141,9 +141,10 @@ RGWAsyncPutSystemObjAttrs::RGWAsyncPutSystemObjAttrs(RGWCoroutine *caller, RGWAi
 }
 
 
-RGWOmapAppend::RGWOmapAppend(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, rgw_bucket& _pool, const string& _oid)
+RGWOmapAppend::RGWOmapAppend(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, rgw_bucket& _pool, const string& _oid,
+                             uint64_t _window_size)
                       : RGWConsumerCR<string>(_store->ctx()), async_rados(_async_rados),
-                        store(_store), pool(_pool), oid(_oid), going_down(false), num_pending_entries(0), total_entries(0)
+                        store(_store), pool(_pool), oid(_oid), going_down(false), num_pending_entries(0), window_size(_window_size), total_entries(0)
 {
 }
 
@@ -399,7 +400,6 @@ int RGWSimpleRadosUnlockCR::request_complete()
 }
 
 
-#define OMAP_APPEND_MAX_ENTRIES 100
 int RGWOmapAppend::operate() {
   reenter(this) {
     for (;;) {
@@ -414,11 +414,11 @@ int RGWOmapAppend::operate() {
         while (consume(&entry)) {
           set_status() << "adding entry: " << entry;
           entries[entry] = bufferlist();
-          if (entries.size() >= OMAP_APPEND_MAX_ENTRIES) {
+          if (entries.size() >= window_size) {
             break;
           }
         }
-        if (entries.size() >= OMAP_APPEND_MAX_ENTRIES || going_down) {
+        if (entries.size() >= window_size || going_down) {
           set_status() << "flushing to omap";
           call(new RGWRadosSetOmapKeysCR(store, pool, oid, entries));
           entries.clear();
@@ -446,7 +446,7 @@ bool RGWOmapAppend::append(const string& s) {
   }
   ++total_entries;
   pending_entries.push_back(s);
-  if (++num_pending_entries >= OMAP_APPEND_MAX_ENTRIES) {
+  if (++num_pending_entries >= (int)window_size) {
     flush_pending();
   }
   return true;
index 8d28b081ebfce96fbf012d75da2db44913f782f5..70d9b7bcdc554b78bd0af75e62e102ef8811d5c2 100644 (file)
@@ -510,6 +510,8 @@ public:
   int request_complete();
 };
 
+#define OMAP_APPEND_MAX_ENTRIES_DEFAULT 100
+
 class RGWOmapAppend : public RGWConsumerCR<string> {
   RGWAsyncRadosProcessor *async_rados;
   RGWRados *store;
@@ -524,9 +526,11 @@ class RGWOmapAppend : public RGWConsumerCR<string> {
 
   map<string, bufferlist> entries;
 
+  uint64_t window_size;
   uint64_t total_entries;
 public:
-  RGWOmapAppend(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, rgw_bucket& _pool, const string& _oid);
+  RGWOmapAppend(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, rgw_bucket& _pool, const string& _oid,
+                uint64_t _window_size = OMAP_APPEND_MAX_ENTRIES_DEFAULT);
   int operate();
   void flush_pending();
   bool append(const string& s);
@@ -535,6 +539,14 @@ public:
   uint64_t get_total_entries() {
     return total_entries;
   }
+
+  const rgw_bucket& get_pool() {
+    return pool;
+  }
+
+  const string& get_oid() {
+    return oid;
+  }
 };
 
 class RGWAsyncWait : public RGWAsyncRadosRequest {