Skip to content

Commit 478722c

Browse files
committed
MB-67265: Replace check for fusionLogstoreURI with ...
... isFusionSupportEnabled We have recently allowed initialising MagmaKVStore before the logstore URI is set. Therefore, it is possible that fusionStats are updated before the URI is set. This patch replaces the check for fusionLogstoreURI with isFusionSupportIsEnabled(). Along with this change, we can remove the fusion stat test from testapp_fusion.cc and add it to ep_testsuite.cc, such that all stats are in a single place. Change-Id: I2e65d82e53c903e081a4dc8ef843ccbb44b21fed Reviewed-on: https://review.couchbase.org/c/kv_engine/+/235270 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 8583876 commit 478722c

File tree

3 files changed

+37
-78
lines changed

3 files changed

+37
-78
lines changed

engines/ep/src/ep_engine.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3320,7 +3320,7 @@ cb::engine_errc EventuallyPersistentEngine::doEngineStatsLowCardinality(
33203320
doEngineStatsCouchDB(collector, epstats);
33213321
} else if (configuration.getBackendString() == "magma") {
33223322
doEngineStatsMagma(collector);
3323-
if (!configuration.getMagmaFusionLogstoreUri().empty()) {
3323+
if (isFusionSupportEnabled()) {
33243324
doEngineStatsFusion(collector);
33253325
}
33263326
} else if (configuration.getBackendString() == "nexus") {

engines/ep/tests/ep_testsuite.cc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <programs/engine_testapp/mock_cookie.h>
3737
#include <programs/engine_testapp/mock_engine.h>
3838
#include <programs/engine_testapp/mock_server.h>
39+
#include <utilities/fusion_support.h>
3940
#include <utilities/string_utilities.h>
4041
#include <xattr/blob.h>
4142
#include <chrono>
@@ -7194,6 +7195,41 @@ static enum test_result test_mb19687_fixed(EngineIface* h) {
71947195
}
71957196
}
71967197

7198+
if (isMagmaBucket(h) && isFusionSupportEnabled()) {
7199+
auto& eng_stats = statsKeys.at("");
7200+
eng_stats.insert(eng_stats.end(),
7201+
{"ep_fusion_namespace",
7202+
"ep_fusion_syncs",
7203+
"ep_fusion_bytes_synced",
7204+
"ep_fusion_logs_migrated",
7205+
"ep_fusion_bytes_migrated",
7206+
"ep_fusion_log_store_data_size",
7207+
"ep_fusion_log_store_garbage_size",
7208+
"ep_fusion_logs_cleaned",
7209+
"ep_fusion_log_clean_bytes_read",
7210+
"ep_fusion_extent_merger_reads",
7211+
"ep_fusion_extent_merger_bytes_read",
7212+
"ep_fusion_log_clean_reads",
7213+
"ep_fusion_log_store_remote_puts",
7214+
"ep_fusion_log_store_reads",
7215+
"ep_fusion_log_store_remote_gets",
7216+
"ep_fusion_log_store_remote_lists",
7217+
"ep_fusion_log_store_remote_deletes",
7218+
"ep_fusion_file_map_mem_used",
7219+
"ep_fusion_sync_failures",
7220+
"ep_fusion_migration_failures",
7221+
"ep_fusion_num_logs_mounted",
7222+
"ep_fusion_num_log_segments",
7223+
"ep_fusion_num_file_extents",
7224+
"ep_fusion_num_files",
7225+
"ep_fusion_total_file_size",
7226+
"ep_fusion_sync_session_total_bytes",
7227+
"ep_fusion_sync_session_completed_bytes",
7228+
"ep_fusion_migration_total_bytes",
7229+
"ep_fusion_migration_completed_bytes",
7230+
"ep_fusion_log_store_pending_delete_size"});
7231+
}
7232+
71977233
if (isPersistentBucket(h)) {
71987234
auto& vb_details = statsKeys.at("vbucket-details 0");
71997235
vb_details.insert(vb_details.end(),

tests/testapp/testapp_fusion.cc

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -928,83 +928,6 @@ TEST_P(FusionTest, Stat_UploaderState_KVStoreInvalid) {
928928
}
929929
}
930930

931-
TEST_P(FusionTest, GetPrometheusFusionStats) {
932-
if (!isFusionSupportedInBucket()) {
933-
GTEST_SKIP() << "Fusion is not supported in this bucket";
934-
}
935-
std::array<std::string_view, 30> statKeysExpected = {
936-
"ep_fusion_namespace",
937-
"ep_fusion_syncs",
938-
"ep_fusion_bytes_synced",
939-
"ep_fusion_logs_migrated",
940-
"ep_fusion_bytes_migrated",
941-
"ep_fusion_log_store_data_size",
942-
"ep_fusion_log_store_garbage_size",
943-
"ep_fusion_logs_cleaned",
944-
"ep_fusion_log_clean_bytes_read",
945-
"ep_fusion_extent_merger_reads",
946-
"ep_fusion_extent_merger_bytes_read",
947-
"ep_fusion_log_clean_reads",
948-
"ep_fusion_log_store_remote_puts",
949-
"ep_fusion_log_store_reads",
950-
"ep_fusion_log_store_remote_gets",
951-
"ep_fusion_log_store_remote_lists",
952-
"ep_fusion_log_store_remote_deletes",
953-
"ep_fusion_file_map_mem_used",
954-
"ep_fusion_sync_failures",
955-
"ep_fusion_migration_failures",
956-
"ep_fusion_num_logs_mounted",
957-
"ep_fusion_num_log_segments",
958-
"ep_fusion_num_file_extents",
959-
"ep_fusion_num_files",
960-
"ep_fusion_total_file_size",
961-
"ep_fusion_sync_session_total_bytes",
962-
"ep_fusion_sync_session_completed_bytes",
963-
"ep_fusion_migration_total_bytes",
964-
"ep_fusion_migration_completed_bytes",
965-
"ep_fusion_log_store_pending_delete_size",
966-
};
967-
std::vector<std::string> actualKeys;
968-
connection->stats(
969-
[&actualKeys](auto& k, auto& v) {
970-
if (k.starts_with("ep_fusion")) {
971-
actualKeys.emplace_back(k);
972-
}
973-
},
974-
""); // we convert empty to null to get engine stats
975-
976-
// Sort both collections
977-
std::ranges::sort(actualKeys);
978-
std::ranges::sort(statKeysExpected);
979-
980-
// Find missing keys that are expected but not found in actual
981-
std::vector<std::string_view> missingKeys;
982-
std::ranges::set_difference(
983-
statKeysExpected,
984-
actualKeys,
985-
std::inserter(missingKeys, missingKeys.begin()));
986-
987-
bool error = false;
988-
for (const auto& key : missingKeys) {
989-
error = true;
990-
fmt::println(stderr, "Expected {} but not found in actual", key);
991-
}
992-
993-
// Find any extra fusion stats - those that are found in actual but not
994-
// expected
995-
std::vector<std::string_view> extraKeys;
996-
std::ranges::set_difference(actualKeys,
997-
statKeysExpected,
998-
std::inserter(extraKeys, extraKeys.begin()));
999-
1000-
for (const auto& key : extraKeys) {
1001-
error = true;
1002-
fmt::println(stderr, "Found stat {} but was not expected", key);
1003-
}
1004-
1005-
EXPECT_EQ(false, error) << "Missing stats found";
1006-
}
1007-
1008931
TEST_P(FusionTest, DeleteInvalidFusionNamespace) {
1009932
auto cmd = BinprotGenericCommand{
1010933
cb::mcbp::ClientOpcode::DeleteFusionNamespace};

0 commit comments

Comments
 (0)