summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-10-30 14:06:41 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-10-30 14:06:41 +0000
commita0e0deb766b9265af206e6865dbf648d53827251 (patch)
tree07e9535d138fa50fd2a51352083f079d703126aa /searchcore
parent621520610face5ad70122a4ddecb61e2222798d8 (diff)
Test that a document that refuses to move is not moved.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp16
-rw-r--r--searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp2
3 files changed, 19 insertions, 6 deletions
diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp
index e4335740343..984af9870a6 100644
--- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp
@@ -56,6 +56,22 @@ TEST_F(JobTest, job_returns_false_when_multiple_move_operations_or_compaction_ar
assertJobContext(4, 7, 3, 7, 1);
}
+TEST_F(JobTest, job_document_is_not_moved_if_meta_has_changed)
+{
+ setupThreeDocumentsToCompact();
+ EXPECT_FALSE(run());
+ assertJobContext(2, 9, 1, 0, 0);
+ auto orig_ts = _handler->_docs[8].first.timestamp;
+ _handler->_docs[8].first.timestamp = 0;
+ EXPECT_FALSE(run());
+ assertJobContext(2, 9, 1, 0, 0);
+ _handler->_docs[8].first.timestamp = orig_ts;
+ EXPECT_FALSE(run());
+ assertJobContext(3, 7, 2, 0, 0);
+ endScan().compact();
+ assertJobContext(3, 7, 2, 8, 1);
+}
+
TEST_F(JobTest, job_can_restart_documents_scan_if_lid_bloat_is_still_to_large)
{
init(ALLOWED_LID_BLOAT, ALLOWED_LID_BLOAT_FACTOR);
diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp
index a3e1fad46aa..d4d2a6dc377 100644
--- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp
+++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp
@@ -122,11 +122,8 @@ JobTestBase::notifyNodeRetired(bool nodeRetired) {
}
void
-JobTestBase::assertJobContext(uint32_t moveToLid,
- uint32_t moveFromLid,
- uint32_t handleMoveCnt,
- uint32_t wantedLidLimit,
- uint32_t compactStoreCnt) const
+JobTestBase::assertJobContext(uint32_t moveToLid, uint32_t moveFromLid, uint32_t handleMoveCnt,
+ uint32_t wantedLidLimit, uint32_t compactStoreCnt) const
{
sync();
EXPECT_EQ(moveToLid, _handler->_moveToLid);
diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp
index 7345a07cd27..de583c0b36d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp
@@ -233,7 +233,7 @@ CompactionJob::run()
if (shouldRestartScanDocuments(stats)) {
_scanItr = _handler->getIterator();
} else {
- _scanItr = IDocumentScanIterator::UP();
+ _scanItr.reset();
_shouldCompactLidSpace = true;
return false;
}