Skip to content

Commit

Permalink
Merge pull request #457 from yuwmao/metrics
Browse files Browse the repository at this point in the history
Remove AppendBlkAllocMetrics
  • Loading branch information
yuwmao authored Jun 28, 2024
2 parents c31b892 + 3ab1895 commit 372f04a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.4.22"
version = "6.4.23"
homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
topics = ("ebay", "nublox")
Expand Down
8 changes: 4 additions & 4 deletions src/lib/blkalloc/append_blk_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace homestore {

AppendBlkAllocator::AppendBlkAllocator(const BlkAllocConfig& cfg, bool need_format, allocator_id_t id) :
BlkAllocator{cfg, id}, m_metrics{get_name().c_str()} {
BlkAllocator{cfg, id} {
// TODO: try to make all append_blk_allocator instances use same client type to reduce metablk's cache footprint;
meta_service().register_handler(
get_name(),
Expand Down Expand Up @@ -68,20 +68,20 @@ BlkAllocStatus AppendBlkAllocator::alloc_contiguous(BlkId& bid) { return alloc(1
//
BlkAllocStatus AppendBlkAllocator::alloc(blk_count_t nblks, const blk_alloc_hints& hint, BlkId& out_bid) {
if (available_blks() < nblks) {
COUNTER_INCREMENT(m_metrics, num_alloc_failure, 1);
//COUNTER_INCREMENT(m_metrics, num_alloc_failure, 1);
LOGERROR("No space left to serve request nblks: {}, available_blks: {}", nblks, available_blks());
return BlkAllocStatus::SPACE_FULL;
} else if (nblks > max_blks_per_blkid()) {
// consumer(vdev) already handles this case.
COUNTER_INCREMENT(m_metrics, num_alloc_failure, 1);
//COUNTER_INCREMENT(m_metrics, num_alloc_failure, 1);
LOGERROR("Can't serve request nblks: {} larger than max_blks_in_op: {}", nblks, max_blks_per_blkid());
return BlkAllocStatus::FAILED;
}

// Push 1 blk to the vector which has all the requested nblks;
out_bid = BlkId{m_last_append_offset.fetch_add(nblks), nblks, m_chunk_id};

COUNTER_INCREMENT(m_metrics, num_alloc, 1);
//COUNTER_INCREMENT(m_metrics, num_alloc, 1);

return BlkAllocStatus::SUCCESS;
}
Expand Down
32 changes: 16 additions & 16 deletions src/lib/blkalloc/append_blk_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ struct append_blk_sb_t {
};
#pragma pack()

class AppendBlkAllocMetrics : public sisl::MetricsGroup {
public:
explicit AppendBlkAllocMetrics(const char* inst_name) : sisl::MetricsGroup("AppendBlkAlloc", inst_name) {
REGISTER_COUNTER(num_alloc, "Number of blks alloc attempts");
REGISTER_COUNTER(num_alloc_failure, "Number of blk alloc failures");

register_me_to_farm();
}

AppendBlkAllocMetrics(const AppendBlkAllocMetrics&) = delete;
AppendBlkAllocMetrics(AppendBlkAllocMetrics&&) noexcept = delete;
AppendBlkAllocMetrics& operator=(const AppendBlkAllocMetrics&) = delete;
AppendBlkAllocMetrics& operator=(AppendBlkAllocMetrics&&) noexcept = delete;
~AppendBlkAllocMetrics() { deregister_me_from_farm(); }
};
//class AppendBlkAllocMetrics : public sisl::MetricsGroup {
//public:
// explicit AppendBlkAllocMetrics(const char* inst_name) : sisl::MetricsGroup("AppendBlkAlloc", inst_name) {
// REGISTER_COUNTER(num_alloc, "Number of blks alloc attempts");
// REGISTER_COUNTER(num_alloc_failure, "Number of blk alloc failures");
//
// register_me_to_farm();
// }
//
// AppendBlkAllocMetrics(const AppendBlkAllocMetrics&) = delete;
// AppendBlkAllocMetrics(AppendBlkAllocMetrics&&) noexcept = delete;
// AppendBlkAllocMetrics& operator=(const AppendBlkAllocMetrics&) = delete;
// AppendBlkAllocMetrics& operator=(AppendBlkAllocMetrics&&) noexcept = delete;
// ~AppendBlkAllocMetrics() { deregister_me_from_farm(); }
//};

//
// The assumption for AppendBlkAllocator:
Expand Down Expand Up @@ -121,7 +121,7 @@ class AppendBlkAllocator : public BlkAllocator {
std::atomic< blk_num_t > m_freeable_nblks{0}; // count of blks fragmentedly freed (both on-disk and in-memory)
std::atomic< blk_num_t > m_commit_offset{0}; // offset in on-disk version
std::atomic< bool > m_is_dirty{false};
AppendBlkAllocMetrics m_metrics;
//AppendBlkAllocMetrics m_metrics;
superblk< append_blk_sb_t > m_sb; // only cp will be writing to this disk
};

Expand Down

0 comments on commit 372f04a

Please sign in to comment.