aboutsummaryrefslogtreecommitdiffstats
path: root/searchcorespi
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 /searchcorespi
parent013c93f1e8808403f22b19e0ad97882ba643772f (diff)
Use vector of lids in IMemoryIndex api.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/imemoryindex.h8
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp2
2 files changed, 8 insertions, 2 deletions
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