Skip to content

Commit

Permalink
Make IMergeTreeDataPart::getState() inlinable (ClickHouse#56461)
Browse files Browse the repository at this point in the history
  • Loading branch information
davenger authored Nov 8, 2023
1 parent ba87360 commit 517a184
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/Storages/MergeTree/IMergeTreeDataPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,6 @@ void IMergeTreeDataPart::setState(MergeTreeDataPartState new_state) const
incrementStateMetric(state);
}

MergeTreeDataPartState IMergeTreeDataPart::getState() const
{
return state;
}


std::pair<DayNum, DayNum> IMergeTreeDataPart::getMinMaxDate() const
{
Expand Down
6 changes: 3 additions & 3 deletions src/Storages/MergeTree/IMergeTreeDataPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ class IMergeTreeDataPart : public std::enable_shared_from_this<IMergeTreeDataPar

private:
String mutable_name;
mutable MergeTreeDataPartState state{MergeTreeDataPartState::Temporary};

public:
const String & name; // const ref to private mutable_name
MergeTreePartInfo info;
Expand Down Expand Up @@ -274,7 +276,7 @@ class IMergeTreeDataPart : public std::enable_shared_from_this<IMergeTreeDataPar

/// Current state of the part. If the part is in working set already, it should be accessed via data_parts mutex
void setState(MergeTreeDataPartState new_state) const;
MergeTreeDataPartState getState() const;
ALWAYS_INLINE MergeTreeDataPartState getState() const { return state; }

static constexpr std::string_view stateString(MergeTreeDataPartState state) { return magic_enum::enum_name(state); }
constexpr std::string_view stateString() const { return stateString(state); }
Expand Down Expand Up @@ -676,8 +678,6 @@ class IMergeTreeDataPart : public std::enable_shared_from_this<IMergeTreeDataPar
void incrementStateMetric(MergeTreeDataPartState state) const;
void decrementStateMetric(MergeTreeDataPartState state) const;

mutable MergeTreeDataPartState state{MergeTreeDataPartState::Temporary};

/// This ugly flag is needed for debug assertions only
mutable bool part_is_probably_removed_from_disk = false;
};
Expand Down

0 comments on commit 517a184

Please sign in to comment.