Permalink
Browse files

CBQE-1198: cleanup cache miss queues between runs

Change-Id: I2df1f6b0e799e1442923024496f6eb2b60e03688
Reviewed-on: http://review.couchbase.org/25522
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Tommie McAfee <tommie@couchbase.com>
  • Loading branch information...
1 parent ae4561e commit e03ff80326c91aee5689bb119e9464449fa54ebd Tommie McAfeee committed with Tommie McAfee Apr 5, 2013
Showing with 20 additions and 3 deletions.
  1. +1 −1 pysystests/app/init.py
  2. +9 −1 pysystests/app/workload_manager.py
  3. +10 −1 pysystests/cache.py
View
@@ -46,7 +46,7 @@
os.system("cd .. && ./testrunner -i " + cfg.CLUSTER['ini'] + " -t cluster_setup.SETUP." + function + " && cd pysystests")
# delete queues (note using --purge will remove cc_queues)
-queues = CacheHelper.task_queues()
+queues = CacheHelper.task_queues() + CacheHelper.miss_queues()
# when --purge set delete cc_queue's as well
# as seriesly db
@@ -834,7 +834,6 @@ def updateIndexKeys(self, key):
def __setattr__(self, name, value):
super(Workload, self).__setattr__(name, value)
-
# auto cache workload when certain attributes change
# if object has been fully setup
if name in Workload.AUTOCACHEKEYS and self.initialized:
@@ -859,11 +858,18 @@ def requeueNonDeletedKeys(self):
# put back on to consume_queue
msg = json.dumps(keys[0][0])
rabbitHelper.putMsg(self.consume_queue, msg)
+
try:
+ # delete task queue
rabbitHelper.delete(self.task_queue)
+
+ # delete consume queue if it was a miss_queue
+ if self.miss_queue is not None and self.consume_queue is not None:
+ rabbitHelper.delete(self.consume_queue)
except:
pass
+
@staticmethod
def from_cache(id_):
return ObjCacher().instance(CacheHelper.WORKLOADCACHEKEY, id_)
@@ -906,6 +912,8 @@ def latestWorkload(self, bucket):
if len(self.history) > 0 and bucket in self.history:
taskId, workload = self.history[bucket]["tasks"][-1]
+ # retrieve latest workload in case it has changed since last cached
+ workload = Workload.from_cache(workload.id)
return workload
def mode(self, bucket):
View
@@ -160,6 +160,14 @@ def consume_queues():
return queues
@staticmethod
+ def miss_queues():
+ queues = []
+ for workload in CacheHelper.workloads():
+ if workload.miss_queue is not None and workload.consume_queue is not None:
+ queues.append(workload.consume_queue)
+ return queues
+
+ @staticmethod
def task_queues():
kv = [workload.task_queue for workload in CacheHelper.workloads()]
query = [workload.task_queue for workload in CacheHelper.queries()]
@@ -169,7 +177,8 @@ def task_queues():
def queues():
return CacheHelper.task_queues() +\
CacheHelper.cc_queues() +\
- CacheHelper.consume_queues()
+ CacheHelper.consume_queues() +\
+ CacheHelper.miss_queues()
@staticmethod
def cacheClean():

0 comments on commit e03ff80

Please sign in to comment.