Skip to content

Commit

Permalink
Fix compile issue of RegionDataMemDiff in macOS (#9834)
Browse files Browse the repository at this point in the history
close #9833

Signed-off-by: CalvinNeo <[email protected]>
Signed-off-by: JaySon-Huang <[email protected]>

Co-authored-by: JaySon-Huang <[email protected]>
  • Loading branch information
CalvinNeo and JaySon-Huang authored Jan 26, 2025
1 parent d27d7c0 commit 57122fa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <Storages/KVStore/Types.h>
#include <common/types.h>

#include <mutex>
#include <unordered_map>

namespace DB
Expand Down
5 changes: 1 addition & 4 deletions dbms/src/Storages/KVStore/MultiRaft/RegionCFDataBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ struct RegionDataMemDiff
: payload(payload_)
, decoded(decoded_)
{}
RegionDataMemDiff(UInt64 payload_, UInt64 decoded_)
: payload(static_cast<Type>(payload_))
, decoded(static_cast<Type>(decoded_))
{}

RegionDataMemDiff()
: payload(0)
, decoded(0)
Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/KVStore/MultiRaft/RegionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ size_t RegionData::totalSize() const

void RegionData::assignRegionData(RegionData && rhs)
{
recordMemChange(RegionDataMemDiff{-cf_data_size, -decoded_data_size});
recordMemChange(RegionDataMemDiff{-cf_data_size.load(), -decoded_data_size.load()});
resetMemoryUsage();

default_cf = std::move(rhs.default_cf);
write_cf = std::move(rhs.write_cf);
lock_cf = std::move(rhs.lock_cf);
orphan_keys_info = std::move(rhs.orphan_keys_info);

updateMemoryUsage(RegionDataMemDiff{rhs.cf_data_size, rhs.decoded_data_size});
updateMemoryUsage(RegionDataMemDiff{rhs.cf_data_size.load(), rhs.decoded_data_size.load()});
rhs.resetMemoryUsage();
}

Expand Down
4 changes: 2 additions & 2 deletions dbms/src/Storages/KVStore/MultiRaft/RegionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ class RegionData
OrphanKeysInfo orphan_keys_info;

// Size of 3 cfs, reflects size of real payload flows to KVStore.
std::atomic<size_t> cf_data_size = 0;
std::atomic<Int64> cf_data_size = 0;
// Size of decoded structures for convenient access, considered as amplification in memory.
std::atomic<size_t> decoded_data_size = 0;
std::atomic<Int64> decoded_data_size = 0;
};

} // namespace DB
3 changes: 2 additions & 1 deletion libs/libcommon/include/common/demangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include <cstdlib>
#include <memory>
#include <string>

Expand All @@ -37,7 +38,7 @@ struct FreeingDeleter
template <typename PointerType>
void operator()(PointerType ptr)
{
std::free(ptr);
std::free(ptr); // NOLINT(cppcoreguidelines-no-malloc)
}
};

Expand Down

0 comments on commit 57122fa

Please sign in to comment.