summaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/documentdb/lid_space_compaction
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-05-03 12:34:45 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-05-03 12:55:20 +0000
commita6d1d5d762265e159fdf738c709b8296af29f4ce (patch)
treee6d784079735c65a2908bafdafd3f0bd538712d4 /searchcore/src/tests/proton/documentdb/lid_space_compaction
parent54164220f1d224808aa86bf5777eaef837d61034 (diff)
- GC legacy lidspace compaction job and bucket move job.
- GC duplicate tests. They are tested more thoroughly in the bucket mover tests.
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/lid_space_compaction')
-rw-r--r--searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp80
-rw-r--r--searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.cpp23
-rw-r--r--searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.h4
3 files changed, 36 insertions, 71 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 688dd963f61..f1353a30887 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
@@ -4,12 +4,12 @@
using BlockedReason = IBlockableMaintenanceJob::BlockedReason;
-TEST_P(JobTest, handler_name_is_used_as_part_of_job_name)
+TEST_F(JobTest, handler_name_is_used_as_part_of_job_name)
{
EXPECT_EQ("lid_space_compaction.myhandler", _job->getName());
}
-TEST_P(JobTest, no_move_operation_is_created_if_lid_bloat_factor_is_below_limit)
+TEST_F(JobTest, no_move_operation_is_created_if_lid_bloat_factor_is_below_limit)
{
// 20% bloat < 30% allowed bloat
addStats(10, {1,3,4,5,6,7,9}, {{9,2}});
@@ -17,7 +17,7 @@ TEST_P(JobTest, no_move_operation_is_created_if_lid_bloat_factor_is_below_limit)
assertNoWorkDone();
}
-TEST_P(JobTest, no_move_operation_is_created_if_lid_bloat_is_below_limit)
+TEST_F(JobTest, no_move_operation_is_created_if_lid_bloat_is_below_limit)
{
init(3, 0.1);
// 20% bloat >= 10% allowed bloat BUT lid bloat (2) < allowed lid bloat (3)
@@ -26,7 +26,7 @@ TEST_P(JobTest, no_move_operation_is_created_if_lid_bloat_is_below_limit)
assertNoWorkDone();
}
-TEST_P(JobTest, no_move_operation_is_created_and_compaction_is_initiated)
+TEST_F(JobTest, no_move_operation_is_created_and_compaction_is_initiated)
{
// no documents to move: lowestFreeLid(7) > highestUsedLid(6)
addStats(10, {1,2,3,4,5,6}, {{6,7}});
@@ -36,14 +36,14 @@ TEST_P(JobTest, no_move_operation_is_created_and_compaction_is_initiated)
assertJobContext(0, 0, 0, 7, 1);
}
-TEST_P(JobTest, one_move_operation_is_created_and_compaction_is_initiated)
+TEST_F(JobTest, one_move_operation_is_created_and_compaction_is_initiated)
{
setupOneDocumentToCompact();
EXPECT_FALSE(run()); // scan
assertOneDocumentCompacted();
}
-TEST_P(JobTest, job_returns_false_when_multiple_move_operations_or_compaction_are_needed)
+TEST_F(JobTest, job_returns_false_when_multiple_move_operations_or_compaction_are_needed)
{
setupThreeDocumentsToCompact();
EXPECT_FALSE(run());
@@ -56,29 +56,7 @@ TEST_P(JobTest, job_returns_false_when_multiple_move_operations_or_compaction_ar
assertJobContext(4, 7, 3, 7, 1);
}
-TEST_P(JobTest, job_is_blocked_if_trying_to_move_document_for_frozen_bucket)
-{
- //TODO Remove test once we no longer use the frozen concept.
- if ( ! useBucketDB() ) {
- _frozenHandler._bucket = BUCKET_ID_1;
- EXPECT_FALSE(_job->isBlocked());
- addStats(10, {1, 3, 4, 5, 6, 9}, {{9, 2}}); // 30% bloat: try to move 9 -> 2
- addStats(0, 0, 0, 0);
-
- EXPECT_TRUE(run()); // bucket frozen
- assertNoWorkDone();
- EXPECT_TRUE(_job->isBlocked());
-
- _frozenHandler._bucket = BUCKET_ID_2;
- _job->unBlock(BlockedReason::FROZEN_BUCKET);
-
- EXPECT_FALSE(run()); // unblocked
- assertJobContext(2, 9, 1, 0, 0);
- EXPECT_FALSE(_job->isBlocked());
- }
-}
-
-TEST_P(JobTest, job_can_restart_documents_scan_if_lid_bloat_is_still_to_large)
+TEST_F(JobTest, job_can_restart_documents_scan_if_lid_bloat_is_still_to_large)
{
init(ALLOWED_LID_BLOAT, ALLOWED_LID_BLOAT_FACTOR);
addMultiStats(10, {{1,3,4,5,6,9},{1,2,4,5,6,8}},
@@ -98,7 +76,7 @@ TEST_P(JobTest, job_can_restart_documents_scan_if_lid_bloat_is_still_to_large)
assertJobContext(3, 8, 2, 7, 1);
}
-TEST_P(JobTest, held_lid_is_not_considered_free_and_blocks_job)
+TEST_F(JobTest, held_lid_is_not_considered_free_and_blocks_job)
{
// Lid 1 on hold or pendingHold, i.e. neither free nor used.
addMultiStats(3, {{2}}, {{2, 3}});
@@ -106,7 +84,7 @@ TEST_P(JobTest, held_lid_is_not_considered_free_and_blocks_job)
assertNoWorkDone();
}
-TEST_P(JobTest, held_lid_is_not_considered_free_with_only_compact)
+TEST_F(JobTest, held_lid_is_not_considered_free_with_only_compact)
{
// Lid 1 on hold or pendingHold, i.e. neither free nor used.
addMultiStats(10, {{2}}, {{2, 3}});
@@ -116,7 +94,7 @@ TEST_P(JobTest, held_lid_is_not_considered_free_with_only_compact)
assertJobContext(0, 0, 0, 3, 1);
}
-TEST_P(JobTest, held_lids_are_not_considered_free_with_one_move)
+TEST_F(JobTest, held_lids_are_not_considered_free_with_one_move)
{
// Lids 1,2,3 on hold or pendingHold, i.e. neither free nor used.
addMultiStats(10, {{5}}, {{5, 4}, {4, 5}});
@@ -126,7 +104,7 @@ TEST_P(JobTest, held_lids_are_not_considered_free_with_one_move)
assertJobContext(4, 5, 1, 5, 1);
}
-TEST_P(JobTest, resource_starvation_blocks_lid_space_compaction)
+TEST_F(JobTest, resource_starvation_blocks_lid_space_compaction)
{
setupOneDocumentToCompact();
_diskMemUsageNotifier.notify({{100, 0}, {100, 101}});
@@ -134,7 +112,7 @@ TEST_P(JobTest, resource_starvation_blocks_lid_space_compaction)
assertNoWorkDone();
}
-TEST_P(JobTest, ending_resource_starvation_resumes_lid_space_compaction)
+TEST_F(JobTest, ending_resource_starvation_resumes_lid_space_compaction)
{
setupOneDocumentToCompact();
_diskMemUsageNotifier.notify({{100, 0}, {100, 101}});
@@ -144,7 +122,7 @@ TEST_P(JobTest, ending_resource_starvation_resumes_lid_space_compaction)
assertOneDocumentCompacted();
}
-TEST_P(JobTest, resource_limit_factor_adjusts_limit)
+TEST_F(JobTest, resource_limit_factor_adjusts_limit)
{
init(ALLOWED_LID_BLOAT, ALLOWED_LID_BLOAT_FACTOR, 1.05);
setupOneDocumentToCompact();
@@ -153,21 +131,21 @@ TEST_P(JobTest, resource_limit_factor_adjusts_limit)
assertOneDocumentCompacted();
}
-TEST_P(JobTest, delay_is_set_based_on_interval_and_is_max_300_secs)
+TEST_F(JobTest, delay_is_set_based_on_interval_and_is_max_300_secs)
{
init_with_interval(301s);
EXPECT_EQ(300s, _job->getDelay());
EXPECT_EQ(301s, _job->getInterval());
}
-TEST_P(JobTest, delay_is_set_based_on_interval_and_can_be_less_than_300_secs)
+TEST_F(JobTest, delay_is_set_based_on_interval_and_can_be_less_than_300_secs)
{
init_with_interval(299s);
EXPECT_EQ(299s, _job->getDelay());
EXPECT_EQ(299s, _job->getInterval());
}
-TEST_P(JobTest, job_is_disabled_when_node_is_retired)
+TEST_F(JobTest, job_is_disabled_when_node_is_retired)
{
init_with_node_retired(true);
setupOneDocumentToCompact();
@@ -175,7 +153,7 @@ TEST_P(JobTest, job_is_disabled_when_node_is_retired)
assertNoWorkDone();
}
-TEST_P(JobTest, job_is_disabled_when_node_becomes_retired)
+TEST_F(JobTest, job_is_disabled_when_node_becomes_retired)
{
init_with_node_retired(false);
setupOneDocumentToCompact();
@@ -184,7 +162,7 @@ TEST_P(JobTest, job_is_disabled_when_node_becomes_retired)
assertNoWorkDone();
}
-TEST_P(JobTest, job_is_re_enabled_when_node_is_no_longer_retired)
+TEST_F(JobTest, job_is_re_enabled_when_node_is_no_longer_retired)
{
init_with_node_retired(true);
setupOneDocumentToCompact();
@@ -194,7 +172,7 @@ TEST_P(JobTest, job_is_re_enabled_when_node_is_no_longer_retired)
assertOneDocumentCompacted();
}
-TEST_P(JobDisabledByRemoveOpsTest, config_is_propagated_to_remove_operations_rate_tracker)
+TEST_F(JobDisabledByRemoveOpsTest, config_is_propagated_to_remove_operations_rate_tracker)
{
auto& remove_batch_tracker = _handler->_rm_listener->get_remove_batch_tracker();
EXPECT_EQ(vespalib::from_s(21.0), remove_batch_tracker.get_time_budget_per_op());
@@ -205,38 +183,38 @@ TEST_P(JobDisabledByRemoveOpsTest, config_is_propagated_to_remove_operations_rat
EXPECT_EQ(vespalib::from_s(20.0), remove_tracker.get_time_budget_window());
}
-TEST_P(JobDisabledByRemoveOpsTest, job_is_disabled_while_remove_batch_is_ongoing)
+TEST_F(JobDisabledByRemoveOpsTest, job_is_disabled_while_remove_batch_is_ongoing)
{
job_is_disabled_while_remove_ops_are_ongoing(true);
}
-TEST_P(JobDisabledByRemoveOpsTest, job_becomes_disabled_if_remove_batch_starts)
+TEST_F(JobDisabledByRemoveOpsTest, job_becomes_disabled_if_remove_batch_starts)
{
job_becomes_disabled_if_remove_ops_starts(true);
}
-TEST_P(JobDisabledByRemoveOpsTest, job_is_re_enabled_when_remove_batch_is_no_longer_ongoing)
+TEST_F(JobDisabledByRemoveOpsTest, job_is_re_enabled_when_remove_batch_is_no_longer_ongoing)
{
job_is_re_enabled_when_remove_ops_are_no_longer_ongoing(true);
}
-TEST_P(JobDisabledByRemoveOpsTest, job_is_disabled_while_removes_are_ongoing)
+TEST_F(JobDisabledByRemoveOpsTest, job_is_disabled_while_removes_are_ongoing)
{
job_is_disabled_while_remove_ops_are_ongoing(false);
}
-TEST_P(JobDisabledByRemoveOpsTest, job_becomes_disabled_if_removes_start)
+TEST_F(JobDisabledByRemoveOpsTest, job_becomes_disabled_if_removes_start)
{
job_becomes_disabled_if_remove_ops_starts(false);
}
-TEST_P(JobDisabledByRemoveOpsTest, job_is_re_enabled_when_removes_are_no_longer_ongoing)
+TEST_F(JobDisabledByRemoveOpsTest, job_is_re_enabled_when_removes_are_no_longer_ongoing)
{
job_is_re_enabled_when_remove_ops_are_no_longer_ongoing(false);
}
-TEST_P(MaxOutstandingJobTest, job_is_blocked_if_it_has_too_many_outstanding_move_operations_with_max_1)
+TEST_F(MaxOutstandingJobTest, job_is_blocked_if_it_has_too_many_outstanding_move_operations_with_max_1)
{
init(1);
setupThreeDocumentsToCompact();
@@ -259,7 +237,7 @@ TEST_P(MaxOutstandingJobTest, job_is_blocked_if_it_has_too_many_outstanding_move
assertJobContext(4, 7, 3, 7, 1);
}
-TEST_P(MaxOutstandingJobTest, job_is_blocked_if_it_has_too_many_outstanding_move_operations_with_max_2)
+TEST_F(MaxOutstandingJobTest, job_is_blocked_if_it_has_too_many_outstanding_move_operations_with_max_2)
{
init(2);
setupThreeDocumentsToCompact();
@@ -277,8 +255,4 @@ TEST_P(MaxOutstandingJobTest, job_is_blocked_if_it_has_too_many_outstanding_move
sync();
}
-VESPA_GTEST_INSTANTIATE_TEST_SUITE_P(bool, JobTest, ::testing::Values(false, true));
-VESPA_GTEST_INSTANTIATE_TEST_SUITE_P(bool, JobDisabledByRemoveOpsTest, ::testing::Values(false, true));
-VESPA_GTEST_INSTANTIATE_TEST_SUITE_P(bool, MaxOutstandingJobTest, ::testing::Values(false, true));
-
GTEST_MAIN_RUN_ALL_TESTS()
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 d394769c0ee..73cd6a8e6be 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
@@ -1,7 +1,6 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "lid_space_jobtest.h"
-#include <vespa/searchcore/proton/server/lid_space_compaction_job.h>
#include <vespa/searchcore/proton/server/lid_space_compaction_job_take2.h>
#include <vespa/searchcore/proton/server/executorthreadingservice.h>
#include <vespa/persistence/dummyimpl/dummy_bucket_executor.h>
@@ -33,7 +32,6 @@ JobTestBase::JobTestBase()
_diskMemUsageNotifier(),
_handler(),
_storer(),
- _frozenHandler(),
_job()
{
init(ALLOWED_LID_BLOAT, ALLOWED_LID_BLOAT_FACTOR, RESOURCE_LIMIT_FACTOR, JOB_DELAY, false, MAX_OUTSTANDING_MOVE_OPS);
@@ -47,23 +45,18 @@ JobTestBase::init(uint32_t allowedLidBloat,
bool nodeRetired,
uint32_t maxOutstandingMoveOps)
{
- _handler = std::make_shared<MyHandler>(maxOutstandingMoveOps != MAX_OUTSTANDING_MOVE_OPS, useBucketDB());
+ _handler = std::make_shared<MyHandler>(maxOutstandingMoveOps != MAX_OUTSTANDING_MOVE_OPS, true);
DocumentDBLidSpaceCompactionConfig compactCfg(interval, allowedLidBloat, allowedLidBloatFactor,
- REMOVE_BATCH_BLOCK_RATE, REMOVE_BLOCK_RATE, false, useBucketDB());
+ REMOVE_BATCH_BLOCK_RATE, REMOVE_BLOCK_RATE, false, true);
BlockableMaintenanceJobConfig blockableCfg(resourceLimitFactor, maxOutstandingMoveOps);
_job.reset();
- if (useBucketDB()) {
- _singleExecutor = std::make_unique<vespalib::ThreadStackExecutor>(1, 0x10000);
- _master = std::make_unique<proton::ExecutorThreadService> (*_singleExecutor);
- _bucketExecutor = std::make_unique<storage::spi::dummy::DummyBucketExecutor>(4);
- _job = lidspace::CompactionJob::create(compactCfg, RetainGuard(_refCount), _handler, _storer, *_master, *_bucketExecutor,
- _diskMemUsageNotifier, blockableCfg, _clusterStateHandler, nodeRetired,
- document::BucketSpace::placeHolder());
- } else {
- _job = std::make_shared<LidSpaceCompactionJob>(compactCfg, _handler, _storer, _frozenHandler, _diskMemUsageNotifier,
- blockableCfg, _clusterStateHandler, nodeRetired);
- }
+ _singleExecutor = std::make_unique<vespalib::ThreadStackExecutor>(1, 0x10000);
+ _master = std::make_unique<proton::ExecutorThreadService> (*_singleExecutor);
+ _bucketExecutor = std::make_unique<storage::spi::dummy::DummyBucketExecutor>(4);
+ _job = lidspace::CompactionJob::create(compactCfg, RetainGuard(_refCount), _handler, _storer, *_master, *_bucketExecutor,
+ _diskMemUsageNotifier, blockableCfg, _clusterStateHandler, nodeRetired,
+ document::BucketSpace::placeHolder());
}
void
diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.h b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.h
index dde48a0a620..747e5c9faca 100644
--- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.h
+++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_jobtest.h
@@ -8,7 +8,7 @@
#include <vespa/vespalib/gtest/gtest.h>
namespace storage::spi::dummy { class DummyBucketExecutor; }
-struct JobTestBase : public ::testing::TestWithParam<bool> {
+struct JobTestBase : public ::testing::Test {
MonitoredRefCount _refCount;
test::ClusterStateHandler _clusterStateHandler;
test::DiskMemUsageNotifier _diskMemUsageNotifier;
@@ -17,7 +17,6 @@ struct JobTestBase : public ::testing::TestWithParam<bool> {
std::unique_ptr<searchcorespi::index::IThreadService> _master;
std::shared_ptr<MyHandler> _handler;
MyStorer _storer;
- MyFrozenBucketHandler _frozenHandler;
std::shared_ptr<BlockableMaintenanceJob> _job;
JobTestBase();
~JobTestBase() override;
@@ -51,7 +50,6 @@ struct JobTestBase : public ::testing::TestWithParam<bool> {
void assertOneDocumentCompacted();
JobTestBase &setupThreeDocumentsToCompact();
void sync() const;
- bool useBucketDB() const { return GetParam(); }
};
struct JobTest : public JobTestBase {