diff --git a/dbms/src/Common/CurrentMetrics.cpp b/dbms/src/Common/CurrentMetrics.cpp index eeb97fd1944..7b57e0a56f0 100644 --- a/dbms/src/Common/CurrentMetrics.cpp +++ b/dbms/src/Common/CurrentMetrics.cpp @@ -67,6 +67,7 @@ M(StoragePoolV2Only) \ M(StoragePoolV3Only) \ M(StoragePoolMixMode) \ + M(StoragePoolUniPS) \ M(RegionPersisterRunMode) \ M(S3Requests) \ M(GlobalStorageRunMode) \ diff --git a/dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp b/dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp index 5b73480daf7..f5f575ec0a5 100644 --- a/dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp +++ b/dbms/src/Debug/dbgFuncMockRaftSnapshot.cpp @@ -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(3)); FailPointHelper::enableFailPoint(FailPoints::force_set_safepoint_when_decode_block); auto ingest_ids = kvstore->preHandleSnapshotToFiles( @@ -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(3)); FailPointHelper::enableFailPoint(FailPoints::force_set_safepoint_when_decode_block); auto ingest_ids = kvstore->preHandleSnapshotToFiles( diff --git a/dbms/src/Storages/DeltaMerge/StoragePool.cpp b/dbms/src/Storages/DeltaMerge/StoragePool.cpp index eab926afb73..7dfdb68fd59 100644 --- a/dbms/src/Storages/DeltaMerge/StoragePool.cpp +++ b/dbms/src/Storages/DeltaMerge/StoragePool.cpp @@ -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 @@ -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(run_mode)), - ErrorCodes::LOGICAL_ERROR); + throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown PageStorageRunMode {}", static_cast(run_mode)); } LOG_TRACE( logger, @@ -851,9 +852,7 @@ void StoragePool::startup(ExternalPageCallbacks && callbacks) break; } default: - throw Exception( - fmt::format("Unknown PageStorageRunMode {}", static_cast(run_mode)), - ErrorCodes::LOGICAL_ERROR); + throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown PageStorageRunMode {}", static_cast(run_mode)); } } @@ -898,13 +897,11 @@ void StoragePool::shutdown() break; } default: - throw Exception( - fmt::format("Unknown PageStorageRunMode {}", static_cast(run_mode)), - ErrorCodes::LOGICAL_ERROR); + throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown PageStorageRunMode {}", static_cast(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(); diff --git a/dbms/src/Storages/DeltaMerge/StoragePool.h b/dbms/src/Storages/DeltaMerge/StoragePool.h index 4c3f6b79188..00d25568fe9 100644 --- a/dbms/src/Storages/DeltaMerge/StoragePool.h +++ b/dbms/src/Storages/DeltaMerge/StoragePool.h @@ -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(); diff --git a/dbms/src/Storages/Page/V3/PageStorageImpl.cpp b/dbms/src/Storages/Page/V3/PageStorageImpl.cpp index 3149060f771..87f267b64a0 100644 --- a/dbms/src/Storages/Page/V3/PageStorageImpl.cpp +++ b/dbms/src/Storages/Page/V3/PageStorageImpl.cpp @@ -32,17 +32,12 @@ #include -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, @@ -326,5 +321,4 @@ void PageStorageImpl::unregisterExternalPagesCallbacks(NamespaceID ns_id) page_directory->unregisterNamespace(ns_id); } -} // namespace PS::V3 -} // namespace DB +} // namespace DB::PS::V3 diff --git a/dbms/src/Storages/Page/V3/Universal/tests/gtest_checkpoint.cpp b/dbms/src/Storages/Page/V3/Universal/tests/gtest_checkpoint.cpp index c771c6ba9b9..497d87a5d17 100644 --- a/dbms/src/Storages/Page/V3/Universal/tests/gtest_checkpoint.cpp +++ b/dbms/src/Storages/Page/V3/Universal/tests/gtest_checkpoint.cpp @@ -39,11 +39,6 @@ #include using namespace DB::S3::tests; -namespace DB::FailPoints -{ -extern const char force_ps_wal_compact[]; -} // namespace DB::FailPoints - namespace DB::PS::universal::tests { diff --git a/dbms/src/Storages/Transaction/ApplySnapshot.cpp b/dbms/src/Storages/Transaction/ApplySnapshot.cpp index cd88b25c717..a1de97dabf3 100644 --- a/dbms/src/Storages/Transaction/ApplySnapshot.cpp +++ b/dbms/src/Storages/Transaction/ApplySnapshot.cpp @@ -349,7 +349,10 @@ std::vector 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(v.value()); + }); Stopwatch watch; SCOPE_EXIT({ diff --git a/metrics/grafana/tiflash_summary.json b/metrics/grafana/tiflash_summary.json index 9cf08047c1a..73af072423a 100644 --- a/metrics/grafana/tiflash_summary.json +++ b/metrics/grafana/tiflash_summary.json @@ -52,7 +52,7 @@ "gnetId": null, "graphTooltip": 1, "id": null, - "iteration": 1694151861724, + "iteration": 1694430080744, "links": [], "panels": [ { @@ -9492,6 +9492,7 @@ "alignAsTable": true, "avg": false, "current": true, + "hideZero": true, "max": false, "min": false, "rightSide": true, @@ -9525,7 +9526,7 @@ "format": "time_series", "interval": "", "intervalFactor": 2, - "legendFormat": "{{instance}}-OnlyV2", + "legendFormat": "{{instance}}-V2", "refId": "A", "step": 10 }, @@ -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" }, { @@ -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": [],