diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-02-07 16:03:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-07 16:03:06 +0100 |
commit | 260788dbcc76f4b7b0855bfa48e23495a1561e91 (patch) | |
tree | 801c3b04edadaf93f3c05958031202f9adb39668 /searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp | |
parent | c71bc7f0582f0c29476310dec2c1c12762bcbb8d (diff) | |
parent | 1fb56a093caf4369189e0d00ff3e406d674ec420 (diff) |
Merge pull request #25919 from vespa-engine/toregge/pass-optional-serial-num-to-prepare-reconfigv8.121.38
Pass optional serial num to prepare reconfig
Diffstat (limited to 'searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index e27fae65de3..dd6cc1bdb85 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -325,16 +325,24 @@ AttributeManager::addAttribute(AttributeSpec && spec, uint64_t serialNum) } void -AttributeManager::addInitializedAttributes(const std::vector<AttributeInitializerResult> &attributes, std::optional<uint32_t> docid_limit, std::optional<SerialNum> serial_num) +AttributeManager::addInitializedAttributes(const std::vector<AttributeInitializerResult> &attributes, uint32_t docid_limit, SerialNum serial_num) { + /* + * Called (indirectly) by + * DocumentSubDBCollection::complete_prepare_reconfig to complete + * setup of new attribute manager. + */ for (const auto &result : attributes) { assert(result); auto attr = result.getAttribute(); - if (docid_limit.has_value()) { - AttributeManager::padAttribute(*attr, docid_limit.value()); - } - if (serial_num.has_value()) { - attr->setCreateSerialNum(serial_num.value()); + if (attr->getCreateSerialNum() == 0) { + /* + * The attribute vector is empty (not loaded from disk) + * and has been added as part of live reconfig. Make it + * ready for use by setting size and create serial num. + */ + AttributeManager::padAttribute(*attr, docid_limit); + attr->setCreateSerialNum(serial_num); } attr->setInterlock(_interlock); auto shrinker = allocShrinker(attr, _attributeFieldWriter, *_diskLayout); @@ -503,8 +511,10 @@ proton::IAttributeManager::SP AttributeManager::create(Spec&& spec) const { assert(spec.getCurrentSerialNum().has_value()); + auto docid_limit = spec.getDocIdLimit(); + auto serial_num = spec.getCurrentSerialNum().value(); auto prepared_result = prepare_create(std::move(spec)); - return prepared_result->create(std::nullopt, std::nullopt); + return prepared_result->create(docid_limit, serial_num); } std::vector<IFlushTarget::SP> |