aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/index/index_writer.cpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp b/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp
index 8f5d998b77a..d92ac0dcdc2 100644
--- a/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp
+++ b/searchcore/src/tests/proton/index/index_writer/index_writer_test.cpp
@@ -124,6 +124,14 @@ TEST_F("require that compactLidSpace is forwarded to index manager", Fixture)
EXPECT_EQUAL(4u, f.mim.compactSerial);
}
+TEST_F("require that old compactLidSpace is not forwarded to index manager", Fixture)
+{
+ f.mim.flushed = 10;
+ f.iw.compactLidSpace(4, 2);
+ EXPECT_EQUAL(0u, f.mim.wantedLidLimit);
+ EXPECT_EQUAL(0u, f.mim.compactSerial);
+}
+
TEST_MAIN()
{
TEST_RUN_ALL();
diff --git a/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp b/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp
index ea7fcd99a3b..557e751b5a6 100644
--- a/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/index/index_writer.cpp
@@ -70,6 +70,9 @@ IndexWriter::heartBeat(search::SerialNum serialNum)
void
IndexWriter::compactLidSpace(search::SerialNum serialNum, const search::DocumentIdT lid)
{
+ if (serialNum <= _mgr->getFlushedSerialNum()) {
+ return;
+ }
_mgr->compactLidSpace(lid, serialNum);
}