Skip to content

Commit

Permalink
Merge branch 'master' into solo_repl
Browse files Browse the repository at this point in the history
  • Loading branch information
hkadayam authored Sep 19, 2023
2 parents 3753206 + edf8932 commit 2faa946
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/include/homestore/checkpoint/cp_mgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class CPGuard {
CPGuard(const CPGuard& other);
CPGuard operator=(const CPGuard& other);

CPContext* context(cp_consumer_t consumer);
CP& operator*();
CP* operator->();
CP* get();
Expand Down
9 changes: 4 additions & 5 deletions src/include/homestore/index/index_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include <homestore/superblk_handler.hpp>
#include <homestore/index_service.hpp>
#include <homestore/checkpoint/cp_mgr.hpp>
#include "checkpoint/cp.hpp"
#include "index/wb_cache.hpp"
#include <homestore/index/wb_cache_base.hpp>

SISL_LOGGING_DECL(wbcache)

Expand Down Expand Up @@ -56,7 +55,7 @@ class IndexTable : public IndexTableBase, public Btree< K, V > {

btree_status_t init() {
auto cp = hs()->cp_mgr().cp_guard();
auto ret = Btree< K, V >::init((void*)cp->context(cp_consumer_t::INDEX_SVC));
auto ret = Btree< K, V >::init((void*)cp.context(cp_consumer_t::INDEX_SVC));
update_new_root_info(Btree< K, V >::root_node_id(), Btree< K, V >::root_link_version());
return ret;
}
Expand All @@ -77,14 +76,14 @@ class IndexTable : public IndexTableBase, public Btree< K, V > {
template < typename ReqT >
btree_status_t put(ReqT& put_req) {
auto cpg = hs()->cp_mgr().cp_guard();
put_req.m_op_context = (void*)cpg->context(cp_consumer_t::INDEX_SVC);
put_req.m_op_context = (void*)cpg.context(cp_consumer_t::INDEX_SVC);
return Btree< K, V >::put(put_req);
}

template < typename ReqT >
btree_status_t remove(ReqT& remove_req) {
auto cpg = hs()->cp_mgr().cp_guard();
remove_req.m_op_context = (void*)cpg->context(cp_consumer_t::INDEX_SVC);
remove_req.m_op_context = (void*)cpg.context(cp_consumer_t::INDEX_SVC);
return Btree< K, V >::remove(remove_req);
}

Expand Down
8 changes: 4 additions & 4 deletions src/include/homestore/index_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace homestore {

class IndexWBCache;
class IndexWBCacheBase;
class IndexTableBase;
class VirtualDev;

Expand All @@ -41,7 +41,7 @@ class IndexServiceCallbacks {
class IndexService {
private:
std::unique_ptr< IndexServiceCallbacks > m_svc_cbs;
std::unique_ptr< IndexWBCache > m_wb_cache;
std::unique_ptr< IndexWBCacheBase > m_wb_cache;
std::shared_ptr< VirtualDev > m_vdev;

mutable std::mutex m_index_map_mtx;
Expand All @@ -66,13 +66,13 @@ class IndexService {
uint64_t used_size() const;
uint32_t node_size() const;

IndexWBCache& wb_cache() { return *m_wb_cache; }
IndexWBCacheBase& wb_cache() { return *m_wb_cache; }

private:
void meta_blk_found(const sisl::byte_view& buf, void* meta_cookie);
};

extern IndexService& index_service();
extern IndexWBCache& wb_cache();
extern IndexWBCacheBase& wb_cache();

} // namespace homestore
1 change: 1 addition & 0 deletions src/include/homestore/vchunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class VChunk {
const uint8_t* get_user_private() const;
blk_num_t available_blks() const;
uint32_t get_pdev_id() const;
uint16_t get_chunk_id() const;
cshared< Chunk > get_internal_chunk() const;

private:
Expand Down
1 change: 1 addition & 0 deletions src/lib/checkpoint/cp_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ CPGuard CPGuard::operator=(const CPGuard& other) {

CP& CPGuard::operator*() { return *get(); }
CP* CPGuard::operator->() { return get(); }
CPContext* CPGuard::context(cp_consumer_t consumer) { return get()->context(consumer); }

CP* CPGuard::get() {
HS_DBG_ASSERT_NE((void*)m_cp, (void*)nullptr, "CPGuard get on empty CP pointer");
Expand Down
2 changes: 2 additions & 0 deletions src/lib/device/vchunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ blk_num_t VChunk::available_blks() const { return m_internal_chunk->blk_allocato

uint32_t VChunk::get_pdev_id() const { return m_internal_chunk->physical_dev()->pdev_id(); }

uint16_t VChunk::get_chunk_id() const { return m_internal_chunk->chunk_id(); }

cshared< Chunk > VChunk::get_internal_chunk() const { return m_internal_chunk; }
} // namespace homestore
2 changes: 1 addition & 1 deletion src/lib/index/wb_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SISL_LOGGING_DECL(wbcache)

namespace homestore {

IndexWBCache& wb_cache() { return index_service().wb_cache(); }
IndexWBCacheBase& wb_cache() { return index_service().wb_cache(); }

IndexWBCache::IndexWBCache(const std::shared_ptr< VirtualDev >& vdev, const std::shared_ptr< sisl::Evictor >& evictor,
uint32_t node_size) :
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_index_btree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ struct BtreeTest : public testing::Test {

void destroy_btree() {
auto cpg = hs()->cp_mgr().cp_guard();
auto op_context = (void*)cpg->context(cp_consumer_t::INDEX_SVC);
auto op_context = (void*)cpg.context(cp_consumer_t::INDEX_SVC);
const auto [ret, free_node_cnt] = m_bt->destroy_btree(op_context);
ASSERT_EQ(ret, btree_status_t::success) << "btree destroy failed";
m_bt.reset();
Expand Down

0 comments on commit 2faa946

Please sign in to comment.