aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-10-29 15:09:16 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-10-29 15:09:16 +0000
commit67fbf9ae253d0cd77d7f3e25b39c7a168e509839 (patch)
tree1a4043ea9485fa6a1239befa1ef700aedd1d999f
parent013c93f1e8808403f22b19e0ad97882ba643772f (diff)
Use vector of lids in IMemoryIndex api.
-rw-r--r--searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h6
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h8
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp2
3 files changed, 12 insertions, 4 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h
index 11898d1a630..ddbc0ffa882 100644
--- a/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h
+++ b/searchcore/src/vespa/searchcore/proton/index/memoryindexwrapper.h
@@ -79,8 +79,10 @@ public:
void insertDocument(uint32_t lid, const document::Document &doc) override {
_index.insertDocument(lid, doc);
}
- void removeDocument(uint32_t lid) override {
- _index.removeDocument(lid);
+ void removeDocuments(LidVector lids) override {
+ for (uint32_t lid : lids) {
+ _index.removeDocument(lid);
+ }
}
uint64_t getStaticMemoryFootprint() const override {
return _index.getStaticMemoryFootprint();
diff --git a/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h b/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h
index 735beb620f6..bff929206a0 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h
@@ -16,6 +16,7 @@ namespace searchcorespi::index {
* Interface for a memory index as seen from an index maintainer.
*/
struct IMemoryIndex : public searchcorespi::IndexSearchable {
+ using LidVector = std::vector<uint32_t>;
using SP = std::shared_ptr<IMemoryIndex>;
using OnWriteDoneType = const std::shared_ptr<vespalib::IDestructorCallback> &;
virtual ~IMemoryIndex() {}
@@ -49,7 +50,12 @@ struct IMemoryIndex : public searchcorespi::IndexSearchable {
*
* @param lid the local document id.
*/
- virtual void removeDocument(uint32_t lid) = 0;
+ void removeDocument(uint32_t lid) {
+ LidVector lids;
+ lids.push_back(lid);
+ removeDocuments(std::move(lids));
+ }
+ virtual void removeDocuments(LidVector lids) = 0;
/**
* Commits the inserts and removes since the last commit, making them searchable.
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index 07676b4b330..74848e93411 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -1188,12 +1188,12 @@ IndexMaintainer::removeDocuments(LidVector lids, SerialNum serialNum)
assert(_ctx.getThreadingService().index().isCurrentThread());
LockGuard lock(_index_update_lock);
for (uint32_t lid : lids) {
- _current_index->removeDocument(lid);
_selector->setSource(lid, _current_index_id);
_source_list->setSource(lid);
}
_source_selector_changes += lids.size();
_current_serial_num = serialNum;
+ _current_index->removeDocuments(std::move(lids));
}
void