File tree Expand file tree Collapse file tree 4 files changed +13
-13
lines changed Expand file tree Collapse file tree 4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 12
12
#include < functional>
13
13
#include < memory>
14
14
15
- #include " ep_bucket.h"
16
- #include " ep_engine.h"
15
+ #include " configuration.h"
17
16
#include " flusher.h"
18
17
#include " kvshard.h"
19
18
#include " kvstore/kvstore.h"
19
+ #include " vbucket.h"
20
20
21
21
/* [EPHE TODO]: Consider not using KVShard for ephemeral bucket */
22
- KVShard::KVShard (EventuallyPersistentEngine& engine, id_type id)
22
+ KVShard::KVShard (Configuration& config,
23
+ id_type numShards,
24
+ id_type id)
23
25
: // Size vBuckets to have sufficient slots for the maximum number of
24
26
// vBuckets each shard is responsible for. To ensure correct behaviour
25
27
// when vbuckets isn't a multiple of num_shards, apply ceil() to the
26
28
// division so we round up where necessary.
27
- vbuckets(std::ceil(float (engine.getConfiguration().getMaxVbuckets()) /
28
- engine.getWorkLoadPolicy().getNumShards())),
29
+ vbuckets(std::ceil(float (config.getMaxVbuckets()) / numShards)),
29
30
highPriorityCount(0 ) {
30
- const auto numShards = engine.getWorkLoadPolicy ().getNumShards ();
31
- auto & config = engine.getConfiguration ();
32
31
const std::string backend = config.getBackend ();
33
32
34
33
#ifdef EP_USE_MAGMA
Original file line number Diff line number Diff line change 59
59
*/
60
60
class Configuration ;
61
61
class CookieIface ;
62
- class EPBucket ;
63
- class EventuallyPersistentEngine ;
64
62
class KVStoreIface ;
65
63
66
64
class KVShard {
67
65
public:
68
66
// Identifier for a KVShard
69
67
using id_type = uint16_t ;
70
- KVShard (EventuallyPersistentEngine& engine, KVShard:: id_type id);
68
+ KVShard (Configuration& config, id_type numShards, id_type id);
71
69
~KVShard ();
72
70
73
71
KVStoreIface* getRWUnderlying () {
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ VBucketMap::VBucketMap(KVBucket& bucket)
23
23
const auto numShards = engine.getWorkLoadPolicy ().getNumShards ();
24
24
shards.resize (numShards);
25
25
for (size_t shardId = 0 ; shardId < numShards; shardId++) {
26
- shards[shardId] = std::make_unique<KVShard>(engine, shardId);
26
+ shards[shardId] = std::make_unique<KVShard>(
27
+ bucket.getEPEngine ().getConfiguration (), numShards, shardId);
27
28
}
28
29
29
30
auto & config = engine.getConfiguration ();
@@ -184,4 +185,4 @@ size_t VBucketMap::getNumAliveVBuckets() const {
184
185
res += getVBStateCount (state);
185
186
}
186
187
return res;
187
- }
188
+ }
Original file line number Diff line number Diff line change @@ -49,7 +49,9 @@ TEST_P(EPVBucketTest, GetBGFetchItemsPerformance) {
49
49
// bgFetcher
50
50
auto mockEPBucket =
51
51
engine->public_makeMockBucket (engine->getConfiguration ());
52
- KVShard kvShard (*engine.get (), 0 );
52
+ KVShard kvShard (engine->getConfiguration (),
53
+ engine->getConfiguration ().getMaxNumShards (),
54
+ 0 );
53
55
BgFetcher bgFetcher (*mockEPBucket.get ());
54
56
55
57
for (unsigned int ii = 0 ; ii < 100000 ; ii++) {
You can’t perform that action at this time.
0 commit comments