MB-20312: Initialise snapshot task priority 83/66283/3
authorJim Walker <jim@couchbase.com>
Thu, 28 Jul 2016 10:36:53 +0000 (11:36 +0100)
committerJim Walker <jim@couchbase.com>
Thu, 28 Jul 2016 18:26:29 +0000 (18:26 +0000)
The internal priority of VBSnapshotTask is not
intitialised, it is likely tasks requested to run at
low may actually become high (or vice versa).

Note this is not the GlobalTask priority, just an internal
one to this particular task.

Change-Id: Iabf91a8fe6fee0a8cf8bce99e72e4b22dd57040b
Reviewed-on: http://review.couchbase.org/66283
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Will Gardner <will.gardner@couchbase.com>
Well-Formed: buildbot <build@couchbase.com>

src/tasks.h

index b961248..07e6098 100644 (file)
@@ -258,11 +258,13 @@ protected:
                    uint16_t sID = 0,
                    bool completeBeforeShutdown = true)
         : GlobalTask(e, id, 0, completeBeforeShutdown),
+          priority(Priority::LOW),
           shardID(sID) {}
 
+    Priority priority;
+
 private:
     uint16_t shardID;
-    Priority priority;
 };
 
 class VBSnapshotTaskHigh : public VBSnapshotTask {
@@ -271,7 +273,9 @@ public:
                        uint16_t sID = 0,
                        bool completeBeforeShutdown = true)
         : VBSnapshotTask(e, TaskId::VBSnapshotTaskHigh,
-                         sID, completeBeforeShutdown){}
+                         sID, completeBeforeShutdown) {
+            priority = Priority::HIGH;
+        }
 };
 
 class VBSnapshotTaskLow : public VBSnapshotTask {
@@ -280,7 +284,9 @@ public:
                       uint16_t sID = 0,
                       bool completeBeforeShutdown = true)
         : VBSnapshotTask(e, TaskId::VBSnapshotTaskLow,
-                         sID, completeBeforeShutdown){}
+                         sID, completeBeforeShutdown) {
+            priority = Priority::LOW;
+        }
 };
 
 /**