diff --git a/dbms/src/Storages/Page/V3/BlobStore.cpp b/dbms/src/Storages/Page/V3/BlobStore.cpp index 19614f4975b..3ed1d1a69b1 100644 --- a/dbms/src/Storages/Page/V3/BlobStore.cpp +++ b/dbms/src/Storages/Page/V3/BlobStore.cpp @@ -1240,9 +1240,9 @@ BlobStatPtr BlobStore::BlobStats::createBigPageStatNotChecking(BlobFileId blob_f BlobStatPtr stat = std::make_shared( blob_file_id, SpaceMap::SpaceMapType::SMAP64_BIG, - config.file_limit_size); + config.file_limit_size, + BlobStatType::BIG_BLOB); - stat->changeToBigBlob(); PageFileIdAndLevel id_lvl{blob_file_id, 0}; stats_map[delegator->choosePath(id_lvl)].emplace_back(stat); return stat; diff --git a/dbms/src/Storages/Page/V3/BlobStore.h b/dbms/src/Storages/Page/V3/BlobStore.h index 499a1f6c038..b5cf5a677f1 100644 --- a/dbms/src/Storages/Page/V3/BlobStore.h +++ b/dbms/src/Storages/Page/V3/BlobStore.h @@ -110,12 +110,15 @@ class BlobStore : private Allocator double sm_valid_rate = 1.0; public: - BlobStat(BlobFileId id_, SpaceMap::SpaceMapType sm_type, UInt64 sm_max_caps_) + BlobStat(BlobFileId id_, SpaceMap::SpaceMapType sm_type, UInt64 sm_max_caps_, BlobStatType type_ = BlobStatType::NORMAL) : id(id_) - , type(BlobStatType::NORMAL) + , type(type_) , smap(SpaceMap::createSpaceMap(sm_type, 0, sm_max_caps_)) , sm_max_caps(sm_max_caps_) - {} + { + // Won't create read-only blob by default. + assert(type != BlobStatType::READ_ONLY); + } [[nodiscard]] std::lock_guard lock() { @@ -142,11 +145,6 @@ class BlobStore : private Allocator return type.load() == BlobStatType::BIG_BLOB; } - void changeToBigBlob() - { - type.store(BlobStatType::BIG_BLOB); - } - BlobFileOffset getPosFromStat(size_t buf_size, const std::lock_guard &); bool removePosFromStat(BlobFileOffset offset, size_t buf_size, const std::lock_guard &);