aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <tegge@oath.com>2019-01-04 11:00:01 +0000
committerTor Egge <tegge@oath.com>2019-01-04 14:24:18 +0000
commit0fb6c8f4efd731e57c867246802aae12905a0763 (patch)
treec4fa1d06f43082d16162bdad21b8984cde980586 /searchcore
parent9c5f70ab933455d94a23cd58bc3f394206186be8 (diff)
Don't apply old lid space compaction operation to newer index.
Diffstat (limited to 'searchcore')
-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);
}