diff options
author | Geir Storli <geirst@verizonmedia.com> | 2021-08-30 13:32:31 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2021-08-30 13:37:00 +0000 |
commit | e3f5f72d785b5f037855a82d6f0ba97d732dd646 (patch) | |
tree | d9b31ce8cf5bad84034c994e2c48fcd4d8a76328 | |
parent | beea81233a2b9334aac10ed32d14ad9ad8f73d9a (diff) |
Migrate config propagation tests to DistributorStripeTest.
-rw-r--r-- | storage/src/tests/distributor/distributor_stripe_test.cpp | 132 | ||||
-rw-r--r-- | storage/src/tests/distributor/legacy_distributor_test.cpp | 8 |
2 files changed, 140 insertions, 0 deletions
diff --git a/storage/src/tests/distributor/distributor_stripe_test.cpp b/storage/src/tests/distributor/distributor_stripe_test.cpp index 22d4192fffd..6eb4c0c8d84 100644 --- a/storage/src/tests/distributor/distributor_stripe_test.cpp +++ b/storage/src/tests/distributor/distributor_stripe_test.cpp @@ -136,6 +136,48 @@ struct DistributorStripeTest : Test, DistributorStripeTestUtil { return _stripe->handleMessage(msg); } + void configure_stale_reads_enabled(bool enabled) { + ConfigBuilder builder; + builder.allowStaleReadsDuringClusterStateTransitions = enabled; + configure_stripe(builder); + } + + void configure_update_fast_path_restart_enabled(bool enabled) { + ConfigBuilder builder; + builder.restartWithFastUpdatePathIfAllGetTimestampsAreConsistent = enabled; + configure_stripe(builder); + } + + void configure_merge_operations_disabled(bool disabled) { + ConfigBuilder builder; + builder.mergeOperationsDisabled = disabled; + configure_stripe(builder); + } + + void configure_use_weak_internal_read_consistency(bool use_weak) { + ConfigBuilder builder; + builder.useWeakInternalReadConsistencyForClientGets = use_weak; + configure_stripe(builder); + } + + void configure_metadata_update_phase_enabled(bool enabled) { + ConfigBuilder builder; + builder.enableMetadataOnlyFetchPhaseForInconsistentUpdates = enabled; + configure_stripe(builder); + } + + void configure_prioritize_global_bucket_merges(bool enabled) { + ConfigBuilder builder; + builder.prioritizeGlobalBucketMerges = enabled; + configure_stripe(builder); + } + + void configure_max_activation_inhibited_out_of_sync_groups(uint32_t n_groups) { + ConfigBuilder builder; + builder.maxActivationInhibitedOutOfSyncGroups = n_groups; + configure_stripe(builder); + } + void configureMaxClusterClockSkew(int seconds); void configure_mutation_sequencing(bool enabled); void configure_merge_busy_inhibit_duration(int seconds); @@ -694,4 +736,94 @@ TEST_F(DistributorStripeTest, entering_recovery_mode_resets_bucket_space_stats) assert_invalid_stats_for_all_spaces(stats, 2); } +TEST_F(DistributorStripeTest, stale_reads_config_is_propagated_to_external_operation_handler) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_stale_reads_enabled(true); + EXPECT_TRUE(getExternalOperationHandler().concurrent_gets_enabled()); + + configure_stale_reads_enabled(false); + EXPECT_FALSE(getExternalOperationHandler().concurrent_gets_enabled()); +} + +TEST_F(DistributorStripeTest, fast_path_on_consistent_gets_config_is_propagated_to_internal_config) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_update_fast_path_restart_enabled(true); + EXPECT_TRUE(getConfig().update_fast_path_restart_enabled()); + + configure_update_fast_path_restart_enabled(false); + EXPECT_FALSE(getConfig().update_fast_path_restart_enabled()); +} + +TEST_F(DistributorStripeTest, merge_disabling_config_is_propagated_to_internal_config) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_merge_operations_disabled(true); + EXPECT_TRUE(getConfig().merge_operations_disabled()); + + configure_merge_operations_disabled(false); + EXPECT_FALSE(getConfig().merge_operations_disabled()); +} + +TEST_F(DistributorStripeTest, metadata_update_phase_config_is_propagated_to_internal_config) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_metadata_update_phase_enabled(true); + EXPECT_TRUE(getConfig().enable_metadata_only_fetch_phase_for_inconsistent_updates()); + + configure_metadata_update_phase_enabled(false); + EXPECT_FALSE(getConfig().enable_metadata_only_fetch_phase_for_inconsistent_updates()); +} + +TEST_F(DistributorStripeTest, weak_internal_read_consistency_config_is_propagated_to_internal_configs) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_use_weak_internal_read_consistency(true); + EXPECT_TRUE(getConfig().use_weak_internal_read_consistency_for_client_gets()); + EXPECT_TRUE(getExternalOperationHandler().use_weak_internal_read_consistency_for_gets()); + + configure_use_weak_internal_read_consistency(false); + EXPECT_FALSE(getConfig().use_weak_internal_read_consistency_for_client_gets()); + EXPECT_FALSE(getExternalOperationHandler().use_weak_internal_read_consistency_for_gets()); +} + +TEST_F(DistributorStripeTest, prioritize_global_bucket_merges_config_is_propagated_to_internal_config) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_prioritize_global_bucket_merges(true); + EXPECT_TRUE(getConfig().prioritize_global_bucket_merges()); + + configure_prioritize_global_bucket_merges(false); + EXPECT_FALSE(getConfig().prioritize_global_bucket_merges()); +} + +TEST_F(DistributorStripeTest, max_activation_inhibited_out_of_sync_groups_config_is_propagated_to_internal_config) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + configure_max_activation_inhibited_out_of_sync_groups(3); + EXPECT_EQ(getConfig().max_activation_inhibited_out_of_sync_groups(), 3); + + configure_max_activation_inhibited_out_of_sync_groups(0); + EXPECT_EQ(getConfig().max_activation_inhibited_out_of_sync_groups(), 0); +} + +TEST_F(DistributorStripeTest, wanted_split_bit_count_is_lower_bounded) +{ + setup_stripe(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); + + ConfigBuilder builder; + builder.minsplitcount = 7; + configure_stripe(builder); + + EXPECT_EQ(getConfig().getMinimalBucketSplit(), 8); +} + } diff --git a/storage/src/tests/distributor/legacy_distributor_test.cpp b/storage/src/tests/distributor/legacy_distributor_test.cpp index 4ed2cf6b2d9..e25ecae5a65 100644 --- a/storage/src/tests/distributor/legacy_distributor_test.cpp +++ b/storage/src/tests/distributor/legacy_distributor_test.cpp @@ -1115,6 +1115,7 @@ TEST_F(LegacyDistributorTest, pending_to_no_pending_global_merges_edge_immediate do_test_pending_merge_getnodestate_reply_edge(FixedBucketSpaces::global_space()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, stale_reads_config_is_propagated_to_external_operation_handler) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1126,6 +1127,7 @@ TEST_F(LegacyDistributorTest, stale_reads_config_is_propagated_to_external_opera EXPECT_FALSE(getExternalOperationHandler().concurrent_gets_enabled()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, fast_path_on_consistent_gets_config_is_propagated_to_internal_config) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1137,6 +1139,7 @@ TEST_F(LegacyDistributorTest, fast_path_on_consistent_gets_config_is_propagated_ EXPECT_FALSE(getConfig().update_fast_path_restart_enabled()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, merge_disabling_config_is_propagated_to_internal_config) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1148,6 +1151,7 @@ TEST_F(LegacyDistributorTest, merge_disabling_config_is_propagated_to_internal_c EXPECT_FALSE(getConfig().merge_operations_disabled()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, metadata_update_phase_config_is_propagated_to_internal_config) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1159,6 +1163,7 @@ TEST_F(LegacyDistributorTest, metadata_update_phase_config_is_propagated_to_inte EXPECT_FALSE(getConfig().enable_metadata_only_fetch_phase_for_inconsistent_updates()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, weak_internal_read_consistency_config_is_propagated_to_internal_configs) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1218,6 +1223,7 @@ TEST_F(LegacyDistributorTest, closing_aborts_gets_started_outside_main_distribut EXPECT_EQ(api::ReturnCode::ABORTED, _sender.reply(0)->getResult().getResult()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, prioritize_global_bucket_merges_config_is_propagated_to_internal_config) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1229,6 +1235,7 @@ TEST_F(LegacyDistributorTest, prioritize_global_bucket_merges_config_is_propagat EXPECT_FALSE(getConfig().prioritize_global_bucket_merges()); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, max_activation_inhibited_out_of_sync_groups_config_is_propagated_to_internal_config) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); @@ -1240,6 +1247,7 @@ TEST_F(LegacyDistributorTest, max_activation_inhibited_out_of_sync_groups_config EXPECT_EQ(getConfig().max_activation_inhibited_out_of_sync_groups(), 0); } +// Migrated to DistributorStripeTest TEST_F(LegacyDistributorTest, wanted_split_bit_count_is_lower_bounded) { createLinks(); setupDistributor(Redundancy(1), NodeCount(1), "distributor:1 storage:1"); |