diff --git a/dbms/src/Common/FailPoint.cpp b/dbms/src/Common/FailPoint.cpp index 602a86642fb..2712ba0238b 100644 --- a/dbms/src/Common/FailPoint.cpp +++ b/dbms/src/Common/FailPoint.cpp @@ -65,7 +65,8 @@ std::unordered_map> FailPointHelper::f M(exception_when_read_from_log) \ M(exception_mpp_hash_build) \ M(exception_before_drop_segment) \ - M(exception_after_drop_segment) + M(exception_after_drop_segment) \ + M(force_change_all_blobs_to_read_only_once) #define APPLY_FOR_FAILPOINTS(M) \ M(force_set_page_file_write_errno) \ diff --git a/dbms/src/Storages/Page/V3/BlobStore.cpp b/dbms/src/Storages/Page/V3/BlobStore.cpp index 3ed1d1a69b1..ef370b7bd26 100644 --- a/dbms/src/Storages/Page/V3/BlobStore.cpp +++ b/dbms/src/Storages/Page/V3/BlobStore.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,11 @@ extern const int LOGICAL_ERROR; extern const int CHECKSUM_DOESNT_MATCH; } // namespace ErrorCodes +namespace FailPoints +{ +extern const char force_change_all_blobs_to_read_only_once[]; +} // namespace FailPoints + namespace PS::V3 { static constexpr bool BLOBSTORE_CHECKSUM_ON_READ = true; @@ -870,6 +876,19 @@ std::vector BlobStore::getGCStats() std::vector blob_need_gc; BlobStoreGCInfo blobstore_gc_info; + fiu_do_on(FailPoints::force_change_all_blobs_to_read_only_once, + { + for (const auto & [path, stats] : stats_list) + { + (void)path; + for (const auto & stat : stats) + { + stat->changeToReadOnly(); + } + } + LOG_FMT_WARNING(log, "enabled force_change_all_blobs_to_read_only_once. All of BlobStat turn to READ-ONLY"); + }); + for (const auto & [path, stats] : stats_list) { (void)path;