diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-10-14 13:43:08 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-10-16 09:58:46 +0000 |
commit | 08e49539165ac2893002102c84395166e70dd727 (patch) | |
tree | 3dd32b258c1ca8ee475ce1b2bd6a41f658a6a15f /persistence | |
parent | adac8d147c27cc80315dd8447a5a3280ab804049 (diff) |
Greatly simplify bucket DB persistence provider bootstrap procedure
The legacy bucket DB initialization logic was designed for the case
where bucket information was spread across potentially millions of
files residing on spinning rust drives. It was therefore async and
running in parallel with client operations, adding much complexity
in order to deal with a myriad of concurrency edge cases.
Replace this with a very simple, synchronous init method that expects the
provider to have the required information readily and cheaply available.
This effectively removes the concept of a node's "initializing" state,
moving directly from reported state Down to Up.
Even though a node still technically starts up in Initializing state,
we never end up reporting this to the Cluster Controller as the DB init
completes before the RPC server stack is set up.
Legacy bucket DB initializer code will be removed in a separate pass.
Also simplify bucket DB interface contract for mutating iteration,
indicating that it is done in an unspecified order.
Diffstat (limited to 'persistence')
-rw-r--r-- | persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp | 15 | ||||
-rw-r--r-- | persistence/src/vespa/persistence/dummyimpl/dummypersistence.h | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp index b7acde31c4f..a58adec5011 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp @@ -359,6 +359,21 @@ DummyPersistence::setModifiedBuckets(const BucketIdListResult::List& buckets) _modifiedBuckets = buckets; } +void DummyPersistence::set_fake_bucket_set(const std::vector<std::pair<Bucket, BucketInfo>>& fake_info) { + std::lock_guard lock(_monitor); + _content.clear(); + for (auto& info : fake_info) { + const auto& bucket = info.first; + // DummyPersistence currently only supports default bucket space + assert(bucket.getBucketSpace() == FixedBucketSpaces::default_space()); + auto bucket_content = std::make_shared<BucketContent>(); + bucket_content->getMutableBucketInfo() = info.second; + // Must tag as up to date, or bucket info will be recomputed implicitly from zero state in getBucketInfo + bucket_content->setOutdatedInfo(false); + _content[bucket] = std::move(bucket_content); + } +} + BucketIdListResult DummyPersistence::getModifiedBuckets(BucketSpace bucketSpace) const { diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h index 5d49127a937..a7827b2c218 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h @@ -144,6 +144,10 @@ public: void setModifiedBuckets(const BucketIdListResult::List& result); + // Important: any subsequent mutations to the bucket set in fake_info will reset + // the bucket info due to implicit recalculation of bucket info. + void set_fake_bucket_set(const std::vector<std::pair<Bucket, BucketInfo>>& fake_info); + /** * Returns the list set by setModifiedBuckets(), then clears * the list. |