diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-06-22 17:37:55 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-06-22 17:37:55 +0200 |
commit | 05cd9253d80f7e595e49a204a1af30eafd649157 (patch) | |
tree | ebd4b404d75f09d8695bd77ea887db8b9e8183e2 /searchcore | |
parent | a9b8feea98127cb58dc001fd1f4136e2ff62f8f0 (diff) |
Honour consistency also on zcurve attributes.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp index faa7348ac59..96ad9fce5b5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp @@ -75,14 +75,22 @@ FieldValue::UP positionFromZcurve(int64_t zcurve) { return value; } -void fillInPositionFields(Document &doc, DocumentIdT lid, const DocumentRetriever::PositionFields & possiblePositionFields, const IAttributeManager & attr_manager) +void fillInPositionFields(Document &doc, DocumentIdT lid, const DocumentRetriever::PositionFields & possiblePositionFields, + const IAttributeManager & attr_manager, IDocumentRetriever::ReadConsistency consistency) { for (const auto & it : possiblePositionFields) { if (doc.hasValue(*it.first)) { - AttributeGuard::UP attr = attr_manager.getAttribute(it.second); - if (attr.get() && attr->valid()) { - int64_t zcurve = (*attr)->getInt(lid); - doc.setValue(*it.first, *positionFromZcurve(zcurve)); + AttributeGuard::UP attrGuard = attr_manager.getAttribute(it.second); + if (attrGuard.get() && attrGuard->valid()) { + const search::attribute::IAttributeVector & attr = **attrGuard; + if (lid < attr.getNumDocs()) { + if (consistency != ReadConsistency::STRONG) { + // Lock must be retaken to ensure as non-strong consitency allows lids to arrive later on. + attrGuard = _attr_manager.getAttribute(field.getName()); + } + int64_t zcurve = attr.getInt(lid); + doc.setValue(*it.first, *positionFromZcurve(zcurve)); + } } } } @@ -143,7 +151,7 @@ void DocumentRetriever::populate(DocumentIdT lid, Document & doc, ReadConsistenc } } } - fillInPositionFields(doc, lid, _possiblePositionFields, _attr_manager); + fillInPositionFields(doc, lid, _possiblePositionFields, _attr_manager, consistency); } const Schema & |