diff --git a/src/lib/index/wb_cache.cpp b/src/lib/index/wb_cache.cpp index 5012a7d02..013eb0da5 100644 --- a/src/lib/index/wb_cache.cpp +++ b/src/lib/index/wb_cache.cpp @@ -34,12 +34,6 @@ SISL_LOGGING_DECL(wbcache) namespace homestore { -void usage_log(const IndexBufferPtr& buf, const std::string& msg) { - /*LOGINFO("{}: Buf={} state={} create/dirty_cp={}/{} down_wait#={} use_count={}", msg, - voidptr_cast(const_cast< IndexBuffer* >(buf.get())), int_cast(buf->state()), buf->m_created_cp_id, - buf->m_dirtied_cp_id, buf->m_wait_for_down_buffers.get(), buf.use_count());*/ -} - IndexWBCacheBase& wb_cache() { return index_service().wb_cache(); } IndexWBCache::IndexWBCache(const std::shared_ptr< VirtualDev >& vdev, std::pair< meta_blk*, sisl::byte_view > sb, @@ -112,8 +106,6 @@ BtreeNodePtr IndexWBCache::alloc_buf(node_initializer_t&& node_initializer) { bool done = m_cache.insert(node); HS_REL_ASSERT_EQ(done, true, "Unable to add alloc'd node to cache, low memory or duplicate inserts?"); - usage_log(idx_buf, "After init"); - // The entire index is updated in the commit path, so we alloc the blk and commit them right away auto alloc_status = m_vdev->commit_blk(blkid); // if any error happens when committing the blk to index service, we should assert and crash @@ -123,12 +115,8 @@ BtreeNodePtr IndexWBCache::alloc_buf(node_initializer_t&& node_initializer) { void IndexWBCache::write_buf(const BtreeNodePtr& node, const IndexBufferPtr& buf, CPContext* cp_ctx) { // TODO upsert always returns false even if it succeeds. - if (node != nullptr) { - m_cache.upsert(node); - usage_log(buf, "After inserting to cache"); - } + if (node != nullptr) { m_cache.upsert(node); } r_cast< IndexCPContext* >(cp_ctx)->add_to_dirty_list(buf); - usage_log(buf, "After adding to dirty list"); resource_mgr().inc_dirty_buf_size(m_node_size); } @@ -137,10 +125,7 @@ void IndexWBCache::read_buf(bnodeid_t id, BtreeNodePtr& node, node_initializer_t retry: // Check if the blkid is already in cache, if not load and put it into the cache - if (m_cache.get(blkid, node)) { - usage_log(static_cast< IndexBtreeNode* >(node.get())->m_idx_buf, "After read cache hit"); - return; - } + if (m_cache.get(blkid, node)) { return; } // Read the buffer from virtual device auto idx_buf = std::make_shared< IndexBuffer >(blkid, m_node_size, m_vdev->align_size()); @@ -155,7 +140,6 @@ void IndexWBCache::read_buf(bnodeid_t id, BtreeNodePtr& node, node_initializer_t // There is a race between 2 concurrent reads from vdev and other party won the race. Re-read from cache goto retry; } - usage_log(idx_buf, "After read cache miss and insert to cache"); } bool IndexWBCache::get_writable_buf(const BtreeNodePtr& node, CPContext* context) { @@ -178,9 +162,6 @@ bool IndexWBCache::get_writable_buf(const BtreeNodePtr& node, CPContext* context new_buf->m_created_cp_id = idx_buf->m_created_cp_id; std::memcpy(new_buf->raw_buffer(), idx_buf->raw_buffer(), m_node_size); - usage_log(idx_buf, "Forced copy - Current Dirty buf"); - usage_log(new_buf, "Forced copy - New clean buf"); - node->update_phys_buf(new_buf->raw_buffer()); LOGTRACEMOD(wbcache, "cp={} cur_buf={} for node={} is dirtied by cp={} copying new_buf={}", icp_ctx->id(), static_cast< void* >(idx_buf.get()), node->node_id(), idx_buf->m_dirtied_cp_id, @@ -361,16 +342,12 @@ void IndexWBCache::link_buf(IndexBufferPtr const& up_buf, IndexBufferPtr const& #ifndef NDEBUG real_up_buf->m_down_buffers.emplace_back(down_buf); #endif - - usage_log(real_up_buf, "After link buf - Up buf"); - usage_log(down_buf, "After link buf - Down buf"); } void IndexWBCache::free_buf(const IndexBufferPtr& buf, CPContext* cp_ctx) { BtreeNodePtr node; bool done = m_cache.remove(buf->m_blkid, node); HS_REL_ASSERT_EQ(done, true, "Race on cache removal of btree blkid?"); - usage_log(buf, "After free buf - remove from cache"); resource_mgr().inc_free_blk(m_node_size); m_vdev->free_blk(buf->m_blkid, s_cast< VDevCPContext* >(cp_ctx)); @@ -565,7 +542,6 @@ std::pair< IndexBufferPtr, bool > IndexWBCache::on_buf_flush_done_internal(Index #endif buf->set_state(index_buf_state_t::CLEAN); - usage_log(buf, "After finishing flush"); if (cp_ctx->m_dirty_buf_count.decrement_testz()) { return std::make_pair(nullptr, false); } else {