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 1212#include < functional>
1313#include < memory>
1414
15- #include " ep_bucket.h"
16- #include " ep_engine.h"
15+ #include " configuration.h"
1716#include " flusher.h"
1817#include " kvshard.h"
1918#include " kvstore/kvstore.h"
19+ #include " vbucket.h"
2020
2121/* [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)
2325 : // Size vBuckets to have sufficient slots for the maximum number of
2426 // vBuckets each shard is responsible for. To ensure correct behaviour
2527 // when vbuckets isn't a multiple of num_shards, apply ceil() to the
2628 // 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)),
2930 highPriorityCount(0 ) {
30- const auto numShards = engine.getWorkLoadPolicy ().getNumShards ();
31- auto & config = engine.getConfiguration ();
3231 const std::string backend = config.getBackend ();
3332
3433#ifdef EP_USE_MAGMA
Original file line number Diff line number Diff line change 5959 */
6060class Configuration ;
6161class CookieIface ;
62- class EPBucket ;
63- class EventuallyPersistentEngine ;
6462class KVStoreIface ;
6563
6664class KVShard {
6765public:
6866 // Identifier for a KVShard
6967 using id_type = uint16_t ;
70- KVShard (EventuallyPersistentEngine& engine, KVShard:: id_type id);
68+ KVShard (Configuration& config, id_type numShards, id_type id);
7169 ~KVShard ();
7270
7371 KVStoreIface* getRWUnderlying () {
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ VBucketMap::VBucketMap(KVBucket& bucket)
2323 const auto numShards = engine.getWorkLoadPolicy ().getNumShards ();
2424 shards.resize (numShards);
2525 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);
2728 }
2829
2930 auto & config = engine.getConfiguration ();
@@ -184,4 +185,4 @@ size_t VBucketMap::getNumAliveVBuckets() const {
184185 res += getVBStateCount (state);
185186 }
186187 return res;
187- }
188+ }
Original file line number Diff line number Diff line change @@ -49,7 +49,9 @@ TEST_P(EPVBucketTest, GetBGFetchItemsPerformance) {
4949 // bgFetcher
5050 auto mockEPBucket =
5151 engine->public_makeMockBucket (engine->getConfiguration ());
52- KVShard kvShard (*engine.get (), 0 );
52+ KVShard kvShard (engine->getConfiguration (),
53+ engine->getConfiguration ().getMaxNumShards (),
54+ 0 );
5355 BgFetcher bgFetcher (*mockEPBucket.get ());
5456
5557 for (unsigned int ii = 0 ; ii < 100000 ; ii++) {
You can’t perform that action at this time.
0 commit comments