summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-01-24 13:27:31 +0100
committerGitHub <noreply@github.com>2017-01-24 13:27:31 +0100
commit5e7be56b9f51deecc510a5136397235338a96cc2 (patch)
tree8ef3a7a2b1e1f663206e3ab5c71be69e26f9f816 /searchcore
parent0935ce05d877d763e8a87c82f40c5441172a5ef6 (diff)
parentf3822fe06683633e1f19b7a61b4f76dd34496df7 (diff)
Merge pull request #1571 from yahoo/balder/add-onAddDocs-interface
Balder/add on add docs interface
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp5
2 files changed, 4 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp
index 5abde5ce266..c6c1720c27b 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp
@@ -145,10 +145,8 @@ DocumentMetaStore::peekFreeLid()
void
DocumentMetaStore::ensureSpace(DocId lid)
{
- _metaDataStore.reserve(lid+1);
- while (lid >= _metaDataStore.size()) {
- _metaDataStore.push_back(RawDocumentMetaData());
- }
+ _metaDataStore.ensure_size(lid+1, RawDocumentMetaData());
+
setNumDocs(_metaDataStore.size());
unsigned int newSize = _metaDataStore.size();
unsigned int newCapacity = _metaDataStore.capacity();
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
index 72f79b6c67e..0abec2b44ca 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
@@ -83,9 +83,8 @@ LidAllocator::ensureSpace(DocId lid,
uint32_t newCapacity)
{
ensureSpace(newSize, newCapacity);
- while(lid >= _activeLids.getNumDocs()) {
- DocId activeLid;
- _activeLids.addDoc(activeLid);
+ if (lid >= _activeLids.getNumDocs()) {
+ _activeLids.addDocs((lid - _activeLids.getNumDocs()) + 1);
}
_activeLids.commit();
}