Skip to content

Commit

Permalink
*: Fix max snapshot lifetime is not shown on Grafana (#8102) (#8103)
Browse files Browse the repository at this point in the history
close #7713
  • Loading branch information
ti-chi-bot authored Sep 21, 2023
1 parent d21cded commit 99b6297
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions dbms/src/Interpreters/AsynchronousMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,50 @@ void AsynchronousMetrics::update()
{
if (auto store = dt_storage->getStoreIfInited(); store)
{
auto stat = store->getStoreStats();
calculateMax(max_dt_stable_oldest_snapshot_lifetime, stat.storage_stable_oldest_snapshot_lifetime);
calculateMax(max_dt_delta_oldest_snapshot_lifetime, stat.storage_delta_oldest_snapshot_lifetime);
calculateMax(max_dt_meta_oldest_snapshot_lifetime, stat.storage_meta_oldest_snapshot_lifetime);
const auto stat = store->getStoreStats();
if (context.getPageStorageRunMode() == PageStorageRunMode::ONLY_V2)
{
calculateMax(
max_dt_stable_oldest_snapshot_lifetime,
stat.storage_stable_oldest_snapshot_lifetime);
calculateMax(
max_dt_delta_oldest_snapshot_lifetime,
stat.storage_delta_oldest_snapshot_lifetime);
calculateMax(
max_dt_meta_oldest_snapshot_lifetime,
stat.storage_meta_oldest_snapshot_lifetime);
}
calculateMax(max_dt_background_tasks_length, stat.background_tasks_length);
}
}
}
}

set("MaxDTStableOldestSnapshotLifetime", max_dt_stable_oldest_snapshot_lifetime);
set("MaxDTDeltaOldestSnapshotLifetime", max_dt_delta_oldest_snapshot_lifetime);
set("MaxDTMetaOldestSnapshotLifetime", max_dt_meta_oldest_snapshot_lifetime);
switch (context.getPageStorageRunMode())
{
case PageStorageRunMode::ONLY_V2:
{
set("MaxDTStableOldestSnapshotLifetime", max_dt_stable_oldest_snapshot_lifetime);
set("MaxDTDeltaOldestSnapshotLifetime", max_dt_delta_oldest_snapshot_lifetime);
set("MaxDTMetaOldestSnapshotLifetime", max_dt_meta_oldest_snapshot_lifetime);
break;
}
case PageStorageRunMode::ONLY_V3:
case PageStorageRunMode::MIX_MODE:
{
if (auto global_storage_pool = context.getGlobalStoragePool(); global_storage_pool)
{
const auto log_snap_stat = global_storage_pool->log_storage->getSnapshotsStat();
const auto meta_snap_stat = global_storage_pool->meta_storage->getSnapshotsStat();
const auto data_snap_stat = global_storage_pool->data_storage->getSnapshotsStat();
set("MaxDTDeltaOldestSnapshotLifetime", log_snap_stat.longest_living_seconds);
set("MaxDTMetaOldestSnapshotLifetime", meta_snap_stat.longest_living_seconds);
set("MaxDTStableOldestSnapshotLifetime", data_snap_stat.longest_living_seconds);
}
break;
}
}

set("MaxDTBackgroundTasksLength", max_dt_background_tasks_length);
}

Expand Down

0 comments on commit 99b6297

Please sign in to comment.