diff --git a/.github/workflows/build_dependencies.yml b/.github/workflows/build_dependencies.yml index 0ba266bf0..4c92419ec 100644 --- a/.github/workflows/build_dependencies.yml +++ b/.github/workflows/build_dependencies.yml @@ -85,6 +85,14 @@ jobs: runs-on: ${{ inputs.platform }} timeout-minutes: 1440 steps: + - name: Recover space + run: | + df -h + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + sudo docker builder prune -a + df -h + - name: Retrieve Code uses: actions/checkout@main with: @@ -147,7 +155,6 @@ jobs: run: | du -sh ~/.conan2/p | awk '{printf("size=%d\n", $1)}' > $GITHUB_OUTPUT conan install \ - -u \ -o "sisl/*:prerelease=${{ inputs.prerelease }}" \ -o "sisl/*:malloc_impl=${{ inputs.malloc-impl }}" \ -c tools.build:skip_test=True \ @@ -159,17 +166,27 @@ jobs: id : remove-prior-deps run: | conan remove -c -p "build_type=${{ inputs.build-type }}" '*:*#!latest' - du -sh ~/.conan2/p | awk '{printf("size=%d\n", $1)}' > $GITHUB_OUTPUT - rm -rf ~/.conan2/p/*/b ~/.conan2/p/*/s rm -rf ~/.conan2/p/b/*/b + rm -rf ~/.conan2/p/*/b ~/.conan2/p/*/s + du -sh ~/.conan2/p | awk '{printf("size=%d\n", $1)}' > $GITHUB_OUTPUT + df -h - - name: Save Cache + - name: Delete Previous Cache + continue-on-error: true + run: | + gh extension install actions/gh-actions-cache + gh actions-cache delete "HomestoreDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }}" --confirm + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: ${{ github.event_name != 'pull_request' && steps.build-deps.outputs.size != steps.remove-prior-deps.outputs.size }} + + - name: Save Dependency Cache uses: actions/cache/save@v4 with: path: | ~/.conan2/p key: HomestoreDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }} - if: ${{ steps.build-deps.outputs.size != steps.remove-prior-deps.outputs.size }} + if: ${{ github.event_name != 'pull_request' && steps.build-deps.outputs.size != steps.remove-prior-deps.outputs.size }} - name: Setup tmate session uses: mxschmitt/action-tmate@v3 @@ -194,8 +211,6 @@ jobs: - name: Code Coverage Run run: | - du -sh ~/.conan2/p/* - df -h conan build \ -o "sisl/*:prerelease=${{ inputs.prerelease }}" \ -o "sisl/*:malloc_impl=${{ inputs.malloc-impl }}" \ diff --git a/conanfile.py b/conanfile.py index bb8b0e9ee..445bd4e0a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class HomestoreConan(ConanFile): name = "homestore" - version = "5.2.1" + version = "5.2.2" homepage = "https://github.com/eBay/Homestore" description = "HomeStore Storage Engine" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c702fee6..c032ed95d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,9 +64,15 @@ set(HOMESTORE_OBJECTS lib/crc.cpp ) #target_link_libraries(homestore_objs ${COMMON_DEPS}) +if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") + add_library(homestore STATIC + ${HOMESTORE_OBJECTS} + ) +else() + add_library(homestore STATIC + ${HOMESTORE_OBJECTS} + ) +endif() -add_library(homestore STATIC - ${HOMESTORE_OBJECTS} -) target_compile_definitions (homestore PRIVATE LOG_MODS_V2_SUPPORT) -target_link_libraries(homestore ${COMMON_DEPS}) +target_link_libraries(homestore PRIVATE ${COMMON_DEPS}) diff --git a/src/include/homestore/btree/btree_base.hpp b/src/include/homestore/btree/btree_base.hpp index 95b0ee043..937a5ed46 100644 --- a/src/include/homestore/btree/btree_base.hpp +++ b/src/include/homestore/btree/btree_base.hpp @@ -27,7 +27,7 @@ class UnderlyingBtree { // Btree based implementations superblock area struct BtreeSuperBlock { static constexpr size_t underlying_btree_sb_size = - IndexSuperBlock::index_impl_sb_size - sizeof(bnodeid_t) - sizeof(uint32_t); + IndexSuperBlock::index_impl_sb_size - sizeof(bnodeid_t) - sizeof(uint64_t) - sizeof(uint32_t); bnodeid_t root_node_id{empty_bnodeid}; // Btree Root Node ID uint64_t root_link_version{0}; diff --git a/src/include/homestore/btree/detail/btree_node.hpp b/src/include/homestore/btree/detail/btree_node.hpp index 23714a340..b58174dc3 100644 --- a/src/include/homestore/btree/detail/btree_node.hpp +++ b/src/include/homestore/btree/detail/btree_node.hpp @@ -93,7 +93,10 @@ class BtreeNode : public sisl::ObjLifeCounter< BtreeNode > { Allocator() : alloc_btree_node{[](uint32_t size) -> uint8_t* { return new uint8_t[size]; }}, - free_btree_node{[](BtreeNode* node) { delete[] uintptr_cast(node); }}, + free_btree_node{[](BtreeNode* node) { + node->~BtreeNode(); + delete[] uintptr_cast(node); + }}, alloc_node_buf{[](uint32_t size) { return new uint8_t[size]; }}, free_node_buf{[](uint8_t* buf) { delete[] buf; }} {} @@ -166,7 +169,6 @@ class BtreeNode : public sisl::ObjLifeCounter< BtreeNode > { DEBUG_ASSERT_EQ(m_phys_buf_share_count.load(), 0, "We are being asked to destruct node while its buffer is still shared"); Allocator::get(m_token).free_node_buf(m_phys_node_buf); - if (Allocator::get(m_token).free_btree_node) { Allocator::get(m_token).free_btree_node(this); } } // Identify if a node is a leaf node or not, from raw buffer, by just reading PersistentHeader @@ -668,8 +670,11 @@ class BtreeNode : public sisl::ObjLifeCounter< BtreeNode > { if (node->m_refcount.decrement_testz(1)) { // Do not delete it here, since node is generally an offset inside actual allocation and delete will fail // here (with asan). So let the on_node_freed from the underlying store delete the allocation. - node->~BtreeNode(); - // delete node; + if (Allocator::get(node->m_token).free_btree_node) { + Allocator::get(node->m_token).free_btree_node(node); + } else { + delete node; + } } } }; diff --git a/src/lib/checkpoint/cp_mgr.cpp b/src/lib/checkpoint/cp_mgr.cpp index c763cd694..33d22090a 100644 --- a/src/lib/checkpoint/cp_mgr.cpp +++ b/src/lib/checkpoint/cp_mgr.cpp @@ -270,6 +270,7 @@ void CPManager::on_cp_flush_done(CP* cp) { // checking if shutdown has been initiated or not. auto promise = std::move(cp->m_comp_promise); m_wd_cp->reset_cp(); + bool is_shutdown_cp = cp->m_is_on_shutdown; delete cp; bool trigger_back_2_back_cp{false}; @@ -281,7 +282,7 @@ void CPManager::on_cp_flush_done(CP* cp) { } promise.setValue(true); - if (!cp->m_is_on_shutdown) { // No need of back_2_back cp etc on shutdown. + if (!is_shutdown_cp) { // No need of back_2_back cp etc on shutdown. // Dont access any cp state after this, in case trigger_back_2_back_cp is false, because its false on // cp_shutdown_initated and setting this promise could destruct the CPManager itself. if (trigger_back_2_back_cp) { diff --git a/src/lib/index/cow_btree/cow_btree_store.cpp b/src/lib/index/cow_btree/cow_btree_store.cpp index 3f7cbc972..e1369df8b 100644 --- a/src/lib/index/cow_btree/cow_btree_store.cpp +++ b/src/lib/index/cow_btree/cow_btree_store.cpp @@ -55,9 +55,12 @@ COWBtreeStore::COWBtreeStore(shared< VirtualDev > vdev, std::vector< superblk< I return (hnode.m_value->m_refcount.test_le(1)); })} { m_bufalloc_token = BtreeNode::Allocator::add(BtreeNode::Allocator{ - [](uint32_t size) { return new uint8_t[size]; }, // alloc_btree_node - [](BtreeNode* node) { delete[] uintptr_cast(node); }, // free_btree_node - [this](uint32_t node_size) -> uint8_t* { // alloc_node_buf + [](uint32_t size) { return new uint8_t[size]; }, // alloc_btree_node + [](BtreeNode* node) { + node->~BtreeNode(); + delete[] uintptr_cast(node); + }, // free_btree_node + [this](uint32_t node_size) -> uint8_t* { // alloc_node_buf return hs_utils::iobuf_alloc(node_size, sisl::buftag::btree_node, m_vdev->align_size()); }, [](uint8_t* buf) { hs_utils::iobuf_free(buf, sisl::buftag::btree_node); }});