summaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2018-10-31 20:48:43 +0100
committerTor Egge <tegge@oath.com>2019-01-08 18:30:29 +0000
commitd04167de8b9cba666c2f03a5e53f5d167c8b4b50 (patch)
tree28c1601c4fa5212beafe30bcd8ba296525603e77 /searchcorespi
parent21809401b2244eaf1caeae54e501d97990abe43d (diff)
Compact lid space on source selector.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/tests/plugin/plugin.cpp1
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/iindexmanager.h8
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp10
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h1
4 files changed, 20 insertions, 0 deletions
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
@@ -108,6 +108,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;