forked from membase/ep-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtresizer.cc
More file actions
32 lines (23 loc) · 716 Bytes
/
htresizer.cc
File metadata and controls
32 lines (23 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include "config.h"
#include "htresizer.hh"
#include "ep.hh"
#include "stored-value.hh"
static const double FREQUENCY(60.0);
/**
* Look at all the hash tables and make sure they're sized appropriately.
*/
class ResizingVisitor : public VBucketVisitor {
public:
ResizingVisitor() { }
bool visitBucket(RCPtr<VBucket> &vb) {
vb->ht.resize();
return false;
}
};
bool HashtableResizer::callback(Dispatcher &d, TaskId t) {
shared_ptr<ResizingVisitor> pv(new ResizingVisitor);
store->visit(pv, "Hashtable resizer", &d, Priority::ItemPagerPriority);
d.snooze(t, FREQUENCY);
return true;
}