Skip to content

Commit

Permalink
change type into ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqizho committed May 13, 2022
1 parent 31f5d49 commit 976f144
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dbms/src/Storages/Page/V3/BlobStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1240,9 +1240,9 @@ BlobStatPtr BlobStore::BlobStats::createBigPageStatNotChecking(BlobFileId blob_f
BlobStatPtr stat = std::make_shared<BlobStat>(
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;
Expand Down
14 changes: 6 additions & 8 deletions dbms/src/Storages/Page/V3/BlobStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,15 @@ class BlobStore : private Allocator<false>
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<std::mutex> lock()
{
Expand All @@ -142,11 +145,6 @@ class BlobStore : private Allocator<false>
return type.load() == BlobStatType::BIG_BLOB;
}

void changeToBigBlob()
{
type.store(BlobStatType::BIG_BLOB);
}

BlobFileOffset getPosFromStat(size_t buf_size, const std::lock_guard<std::mutex> &);

bool removePosFromStat(BlobFileOffset offset, size_t buf_size, const std::lock_guard<std::mutex> &);
Expand Down

0 comments on commit 976f144

Please sign in to comment.