Skip to content

Commit

Permalink
Disagg: show the num of tables on Grafana (#8075)
Browse files Browse the repository at this point in the history
ref #6882
  • Loading branch information
JaySon-Huang authored Sep 12, 2023
1 parent f1d2d46 commit c15eaea
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 33 deletions.
1 change: 1 addition & 0 deletions dbms/src/Common/CurrentMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
M(StoragePoolV2Only) \
M(StoragePoolV3Only) \
M(StoragePoolMixMode) \
M(StoragePoolUniPS) \
M(RegionPersisterRunMode) \
M(S3Requests) \
M(GlobalStorageRunMode) \
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ void MockRaftCommand::dbgFuncRegionSnapshotPreHandleDTFiles(
}

// set block size so that we can test for schema-sync while decoding dt files
FailPointHelper::enableFailPoint(FailPoints::force_set_sst_to_dtfile_block_size);
FailPointHelper::enableFailPoint(FailPoints::force_set_sst_to_dtfile_block_size, static_cast<size_t>(3));
FailPointHelper::enableFailPoint(FailPoints::force_set_safepoint_when_decode_block);

auto ingest_ids = kvstore->preHandleSnapshotToFiles(
Expand Down Expand Up @@ -876,7 +876,7 @@ void MockRaftCommand::dbgFuncRegionSnapshotPreHandleDTFilesWithHandles(
}

// set block size so that we can test for schema-sync while decoding dt files
FailPointHelper::enableFailPoint(FailPoints::force_set_sst_to_dtfile_block_size);
FailPointHelper::enableFailPoint(FailPoints::force_set_sst_to_dtfile_block_size, static_cast<size_t>(3));
FailPointHelper::enableFailPoint(FailPoints::force_set_safepoint_when_decode_block);

auto ingest_ids = kvstore->preHandleSnapshotToFiles(
Expand Down
17 changes: 7 additions & 10 deletions dbms/src/Storages/DeltaMerge/StoragePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace CurrentMetrics
extern const Metric StoragePoolV2Only;
extern const Metric StoragePoolV3Only;
extern const Metric StoragePoolMixMode;
extern const Metric StoragePoolUniPS;
} // namespace CurrentMetrics

namespace DB
Expand Down Expand Up @@ -787,12 +788,12 @@ PageStorageRunMode StoragePool::restore()
max_log_page_id = uni_ps->getMaxIdAfterRestart();
max_data_page_id = uni_ps->getMaxIdAfterRestart();
max_meta_page_id = uni_ps->getMaxIdAfterRestart();

storage_pool_metrics = CurrentMetrics::Increment{CurrentMetrics::StoragePoolUniPS};
break;
}
default:
throw Exception(
fmt::format("Unknown PageStorageRunMode {}", static_cast<UInt8>(run_mode)),
ErrorCodes::LOGICAL_ERROR);
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown PageStorageRunMode {}", static_cast<UInt8>(run_mode));
}
LOG_TRACE(
logger,
Expand Down Expand Up @@ -851,9 +852,7 @@ void StoragePool::startup(ExternalPageCallbacks && callbacks)
break;
}
default:
throw Exception(
fmt::format("Unknown PageStorageRunMode {}", static_cast<UInt8>(run_mode)),
ErrorCodes::LOGICAL_ERROR);
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown PageStorageRunMode {}", static_cast<UInt8>(run_mode));
}
}

Expand Down Expand Up @@ -898,13 +897,11 @@ void StoragePool::shutdown()
break;
}
default:
throw Exception(
fmt::format("Unknown PageStorageRunMode {}", static_cast<UInt8>(run_mode)),
ErrorCodes::LOGICAL_ERROR);
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown PageStorageRunMode {}", static_cast<UInt8>(run_mode));
}
}

bool StoragePool::doV2Gc(const Settings & settings)
bool StoragePool::doV2Gc(const Settings & settings) const
{
bool done_anything = false;
auto write_limiter = global_context.getWriteLimiter();
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Storages/DeltaMerge/StoragePool.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class StoragePool : private boost::noncopyable
#ifndef DBMS_PUBLIC_GTEST
private:
#endif
bool doV2Gc(const Settings & settings);
bool doV2Gc(const Settings & settings) const;

void forceTransformMetaV2toV3();
void forceTransformDataV2toV3();
Expand Down
16 changes: 5 additions & 11 deletions dbms/src/Storages/Page/V3/PageStorageImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,12 @@

#include <mutex>

namespace DB
{
namespace ErrorCodes
namespace DB::ErrorCodes
{
extern const int NOT_IMPLEMENTED;
} // namespace ErrorCodes
namespace FailPoints
{
extern const char force_ps_wal_compact[];
}
namespace PS::V3
} // namespace DB::ErrorCodes

namespace DB::PS::V3
{
PageStorageImpl::PageStorageImpl(
String name,
Expand Down Expand Up @@ -326,5 +321,4 @@ void PageStorageImpl::unregisterExternalPagesCallbacks(NamespaceID ns_id)
page_directory->unregisterNamespace(ns_id);
}

} // namespace PS::V3
} // namespace DB
} // namespace DB::PS::V3
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
#include <limits>
using namespace DB::S3::tests;

namespace DB::FailPoints
{
extern const char force_ps_wal_compact[];
} // namespace DB::FailPoints

namespace DB::PS::universal::tests
{

Expand Down
5 changes: 4 additions & 1 deletion dbms/src/Storages/Transaction/ApplySnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ std::vector<DM::ExternalDTFileInfo> KVStore::preHandleSSTsToDTFiles(
size_t expected_block_size = DEFAULT_MERGE_BLOCK_SIZE;

// Use failpoint to change the expected_block_size for some test cases
fiu_do_on(FailPoints::force_set_sst_to_dtfile_block_size, { expected_block_size = 3; });
fiu_do_on(FailPoints::force_set_sst_to_dtfile_block_size, {
if (auto v = FailPointHelper::getFailPointVal(FailPoints::force_set_sst_to_dtfile_block_size); v)
expected_block_size = std::any_cast<size_t>(v.value());
});

Stopwatch watch;
SCOPE_EXIT({
Expand Down
15 changes: 12 additions & 3 deletions metrics/grafana/tiflash_summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"gnetId": null,
"graphTooltip": 1,
"id": null,
"iteration": 1694151861724,
"iteration": 1694430080744,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -9492,6 +9492,7 @@
"alignAsTable": true,
"avg": false,
"current": true,
"hideZero": true,
"max": false,
"min": false,
"rightSide": true,
Expand Down Expand Up @@ -9525,7 +9526,7 @@
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{instance}}-OnlyV2",
"legendFormat": "{{instance}}-V2",
"refId": "A",
"step": 10
},
Expand All @@ -9534,7 +9535,7 @@
"expr": "sum(tiflash_system_current_metric_StoragePoolV3Only{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}) by (instance)",
"hide": false,
"interval": "",
"legendFormat": "{{instance}}-OnlyV3",
"legendFormat": "{{instance}}-V3",
"refId": "B"
},
{
Expand All @@ -9544,6 +9545,14 @@
"interval": "",
"legendFormat": "{{instance}}-MixMode",
"refId": "C"
},
{
"exemplar": true,
"expr": "sum(tiflash_system_current_metric_StoragePoolUniPS{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}) by (instance)",
"hide": false,
"interval": "",
"legendFormat": "{{instance}}-UniPS",
"refId": "D"
}
],
"thresholds": [],
Expand Down

0 comments on commit c15eaea

Please sign in to comment.