MB-23719: Add ephemeral_metadata_purge_age setting 07/76407/6
authorDave Rigby <daver@couchbase.com>
Thu, 6 Apr 2017 16:39:51 +0000 (17:39 +0100)
committerDave Rigby <daver@couchbase.com>
Mon, 10 Apr 2017 07:02:47 +0000 (07:02 +0000)
Add the new config option "ephemeral_metadata_purge_age" to
ep-engine's configuration, along with listeners so changes in it's value
are propogated to the bucket.

Note the default value of 60s, and -1 for disabled exists mostly for
component testing - don't expect that to be exposed to
users. Similarly the unit of seconds is used to aid in testing - I'm
aware the UI is limited to a minimum of 1 hour.

This setting will be dynamic - i.e. can be changed via SET_PARAM
without restarting the bucket.

As per the name, this option is only applicable to Ephemeral buckets -
it will be ignored by Persistent Buckets.

  Implementation Note: The actual Tombstone Purger Tasks do not yet
  exist, so there's currenlty placeholder code for enable/disabling
  the task.

Change-Id: I78726a1bce8c870c70c916cae6f174ea86ef97bb
Reviewed-on: http://review.couchbase.org/76407
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Manu Dhundi <manu@couchbase.com>
configuration.json
src/ephemeral_bucket.cc
src/ephemeral_bucket.h
tests/ep_testsuite.cc

index 005b895..ce6cbbb 100644 (file)
                 ]
             }
         },
+        "ephemeral_metadata_purge_age": {
+            "default": "60",
+            "descr": "Age in seconds after which Ephemeral metadata is purged entirely from memory. Purging disabled if set to -1.",
+            "type": "ssize_t"
+        },
         "exp_pager_enabled": {
             "default": "true",
             "descr": "True if expiry pager task is enabled",
index b23d040..cd45cbc 100644 (file)
@@ -56,6 +56,22 @@ public:
         }
     }
 
+    void ssizeValueChanged(const std::string& key, ssize_t value) override {
+        if (key == "ephemeral_metadata_purge_age") {
+            if (value == -1) {
+                bucket.disableTombstonePurgerTask();
+            }
+            // Any non-negative value will be picked up by the Task the
+            // next time it runs.
+        } else {
+            LOG(EXTENSION_LOG_WARNING,
+                "EphemeralValueChangedListener: Failed to change value for "
+                "unknown key '%s'",
+                key.c_str());
+        }
+
+    }
+
 private:
     EphemeralBucket& bucket;
 };
@@ -137,6 +153,14 @@ RollbackResult EphemeralBucket::doRollback(uint16_t vbid,
                           /* snapEndSeqno */ 0);
 }
 
+void EphemeralBucket::enableTombstonePurgerTask() {
+    // TODO
+}
+
+void EphemeralBucket::disableTombstonePurgerTask() {
+    // TODO
+}
+
 void EphemeralBucket::reconfigureForEphemeral(Configuration& config) {
     // Disable access scanner - we never create it anyway, but set to
     // disabled as to not mislead the user via stats.
index 9461ac1..e1e9d35 100644 (file)
@@ -96,6 +96,17 @@ public:
     void notifyNewSeqno(const uint16_t vbid,
                         const VBNotifyCtx& notifyCtx) override;
 
+    /**
+     * Enables the Ephemeral Tombstone purger task (if not already enabled).
+     * This runs periodically, and based on memory pressure.
+     */
+    void enableTombstonePurgerTask();
+
+    /**
+     * Disables the Ephemeral Tombstone purger task (if enabled).
+     */
+    void disableTombstonePurgerTask();
+
     // Static methods /////////////////////////////////////////////////////////
 
     /** Apply necessary modifications to the Configuration for an Ephemeral
index 83f72e8..fc70ed5 100644 (file)
@@ -6402,6 +6402,7 @@ static enum test_result test_mb19687_fixed(ENGINE_HANDLE* h,
                 "ep_defragmenter_interval",
                 "ep_enable_chk_merge",
                 "ep_ephemeral_full_policy",
+                "ep_ephemeral_metadata_purge_age",
                 "ep_exp_pager_enabled",
                 "ep_exp_pager_initial_run_time",
                 "ep_exp_pager_stime",
@@ -6599,6 +6600,7 @@ static enum test_result test_mb19687_fixed(ENGINE_HANDLE* h,
                 "ep_diskqueue_pending",
                 "ep_enable_chk_merge",
                 "ep_ephemeral_full_policy",
+                "ep_ephemeral_metadata_purge_age",
                 "ep_exp_pager_enabled",
                 "ep_exp_pager_initial_run_time",
                 "ep_exp_pager_stime",