From 80ce0cea721f2fd56abdb050de64ef1f6e3a13a0 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Wed, 31 Oct 2018 20:48:43 +0100 Subject: Compact lid space on source selector. --- searchcorespi/src/tests/plugin/plugin.cpp | 1 + searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h | 8 ++++++++ .../src/vespa/searchcorespi/index/indexmaintainer.cpp | 10 ++++++++++ searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h | 1 + 4 files changed, 20 insertions(+) (limited to 'searchcorespi') diff --git a/searchcorespi/src/tests/plugin/plugin.cpp b/searchcorespi/src/tests/plugin/plugin.cpp index 5614ea1da3a..d32b02f45fd 100644 --- a/searchcorespi/src/tests/plugin/plugin.cpp +++ b/searchcorespi/src/tests/plugin/plugin.cpp @@ -20,6 +20,7 @@ public: virtual void removeDocument(uint32_t, SerialNum) override { } virtual void commit(SerialNum, OnWriteDoneType) override { } virtual void heartBeat(SerialNum ) override {} + void compactLidSpace(uint32_t, SerialNum) override {} virtual SerialNum getCurrentSerialNum() const override { return 0; } virtual SerialNum getFlushedSerialNum() const override { return 0; } virtual IndexSearchable::SP getSearchable() const override { diff --git a/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h b/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h index be439d499dd..cc07a940ef1 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h +++ b/searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h @@ -107,6 +107,14 @@ public: */ virtual void heartBeat(SerialNum serialNum) = 0; + /** + * This method is called when lid space is compacted. + * + * @param lidLimit The new lid limit. + * @param serialNum The serial number of the lid space compaction operation. + */ + virtual void compactLidSpace(uint32_t lidLimit, SerialNum serialNum) = 0; + /** * Returns the current serial number of the index. * This should also reflect any heart beats. diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp index 1e63741084d..6a7f4a14f2a 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -1173,6 +1173,16 @@ IndexMaintainer::heartBeat(SerialNum serialNum) _current_serial_num = serialNum; } +void +IndexMaintainer::compactLidSpace(uint32_t lidLimit, SerialNum serialNum) +{ + assert(_ctx.getThreadingService().index().isCurrentThread()); + LOG(info, "compactLidSpace(%u, %lu)", lidLimit, serialNum); + LockGuard lock(_index_update_lock); + _current_serial_num = serialNum; + _selector->compactLidSpace(lidLimit); +} + IFlushTarget::List IndexMaintainer::getFlushTargets(void) { diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index fb0bc2e5e78..06f02c5b9ef 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -357,6 +357,7 @@ public: void removeDocument(uint32_t lid, SerialNum serialNum) override; void commit(SerialNum serialNum, OnWriteDoneType onWriteDone) override; void heartBeat(search::SerialNum serialNum) override; + void compactLidSpace(uint32_t lidLimit, SerialNum serialNum) override; SerialNum getCurrentSerialNum() const override { return _current_serial_num; -- cgit v1.2.3