Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 7 additions & 54 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,77 +164,29 @@ jobs:
conan export --user oss --channel main import/nuraft_mesg
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Build Cache
- name: Create and Test Package
run: |
sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False")
pre=$([[ "${{ inputs.build-type }}" != "Debug" ]] && echo "-o iomgr/*:prerelease=${{ inputs.prerelease }}" || echo "")
conan install \
-c tools.build:skip_test=True \
conan build \
${pre} \
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o iomgr/*:testing=off \
-o homestore/*:testing=off \
-o homestore/*:sanitize=${sanitize} \
-s:h build_type=${{ inputs.build-type }} \
-c tools.build:skip_test=True \
-s:h compiler.cppstd=23 \
--format=json \
--build missing \
. > ~/build.json
conan list --graph ~/build.json --graph-binaries=build --format=json > ~/pkglist.json
if: ${{ steps.restore-cache.outputs.cache-hit != 'true' }}
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}

- name: Save Conan Cache
uses: eBay/sisl/.github/actions/store_conan2@master
with:
key_prefix: HomestoreDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }}
if: ${{ github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Reload Sisl Cache
uses: eBay/sisl/.github/actions/load_conan2@master
with:
load_any: 'True'
key_prefix: SislDeps13-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Reload IOMgr Cache
uses: eBay/sisl/.github/actions/load_conan2@master
with:
testing: 'False'
path: import/iomgr
key_prefix: IOMgrDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Reload NuraftMesg Cache
uses: eBay/sisl/.github/actions/load_conan2@master
with:
testing: 'False'
path: import/nuraft_mesg
key_prefix: NuMesgDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}

- uses: actions/checkout@main
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
connect-timeout-seconds: 60
if: ${{ inputs.testing == 'True' }}

- name: Create and Test Package
run: |
sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False")
pre=$([[ "${{ inputs.build-type }}" != "Debug" ]] && echo "-o iomgr/*:prerelease=${{ inputs.prerelease }}" || echo "")
conan create \
${pre} \
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o iomgr/*:testing=off \
-o homestore/*:sanitize=${sanitize} \
-s:h build_type=${{ inputs.build-type }} \
--build missing \
.
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}

- name: Code Coverage Run
run: |
pre=$([[ "${{ inputs.build-type }}" != "Debug" ]] && echo "-o iomgr/*:prerelease=${{ inputs.prerelease }}" || echo "")
Expand All @@ -244,6 +196,7 @@ jobs:
-o iomgr/*:testing=off \
-o homestore/*:coverage=True \
-s:h build_type=${{ inputs.build-type }} \
-s:h compiler.cppstd=23 \
--build missing \
.
if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }}
Expand Down
8 changes: 4 additions & 4 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ pipeline {
steps {
sh "hostname ; \
echo $NODE_NAME ; \
conan create ${BUILD_MISSING} -s:h build_type=Debug -o ${PROJECT}/*:sanitize=True ${CONAN_FLAGS} . ; \
conan create ${BUILD_MISSING} -s:h build_type=Debug ${CONAN_FLAGS} . ; \
conan create ${BUILD_MISSING} -s:h build_type=RelWithDebInfo -o sisl/*:malloc_impl=tcmalloc ${CONAN_FLAGS} . ; \
conan create ${BUILD_MISSING} -s:h build_type=RelWithDebInfo -o sisl/*:prerelease=True -o sisl/*:malloc_impl=tcmalloc ${CONAN_FLAGS} . ; \
conan build -s:h compiler.cppstd=23 ${BUILD_MISSING} -s:h build_type=Debug -o ${PROJECT}/*:sanitize=True ${CONAN_FLAGS} . ; \
conan create ${BUILD_MISSING} -s:h compiler.cppstd=23 -s:h build_type=Debug ${CONAN_FLAGS} . ; \
conan create ${BUILD_MISSING} -s:h compiler.cppstd=23 -s:h build_type=RelWithDebInfo -o sisl/*:malloc_impl=tcmalloc ${CONAN_FLAGS} . ; \
conan create ${BUILD_MISSING} -s:h compiler.cppstd=23 -s:h build_type=RelWithDebInfo -o sisl/*:prerelease=True -o sisl/*:malloc_impl=tcmalloc ${CONAN_FLAGS} . ; \
"
}
post {
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # turn on folder hierarchies

include (cmake/Flags.cmake)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
enable_testing()

include (cmake/test_mode.cmake)
Expand Down
10 changes: 7 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from conan.tools.files import copy
from os.path import join

required_conan_version = ">=1.60.0"
required_conan_version = ">=2.0"

class HomestoreConan(ConanFile):
name = "homestore"
version = "7.0.0"
version = "7.0.1"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down Expand Up @@ -47,14 +47,18 @@ def configure(self):
if self.options.coverage or self.options.sanitize:
raise ConanInvalidConfiguration("Coverage/Sanitizer requires Testing!")

def validate(self):
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, 23)

def build_requirements(self):
self.test_requires("benchmark/1.9.4")
self.test_requires("gtest/1.17.0")

def requirements(self):
self.requires("iomgr/[^12]@oss/master", transitive_headers=True)
self.requires("sisl/[^13]@oss/master", transitive_headers=True)
self.requires("nuraft_mesg/[^4]@oss/main", transitive_headers=True)
self.requires("nuraft_mesg/[^5]@oss/main", transitive_headers=True)

self.requires("farmhash/cci.20190513@", transitive_headers=True)
if self.settings.arch in ['x86', 'x86_64']:
Expand Down
5 changes: 3 additions & 2 deletions src/include/homestore/replication/repl_decls.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <expected>
#include <iostream>
#include <string>

Expand Down Expand Up @@ -56,15 +57,15 @@ VENUM(ReplaceMemberStatus, int32_t,
// clang-format on

template < typename V, typename E >
using Result = folly::Expected< V, E >;
using Result = std::expected< V, E >;

template < class V >
using ReplResult = Result< V, ReplServiceError >;

template < class V, class E >
using AsyncResult = folly::SemiFuture< Result< V, E > >;

template < class V = folly::Unit >
template < class V = void >
using AsyncReplResult = AsyncResult< V, ReplServiceError >;

using blkid_list_t = folly::small_vector< BlkId, 4 >;
Expand Down
5 changes: 3 additions & 2 deletions src/lib/common/resource_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ bool ResourceMgr::check_journal_vdev_size(const uint64_t used_size, const uint64
const uint32_t used_pct = (100 * used_size / total_size);
if (used_pct >= get_journal_vdev_size_limit()) {
m_journal_vdev_exceed_cb(used_size, used_pct >= get_journal_vdev_size_critical_limit() /* is_critical */);
HS_LOG_EVERY_N(WARN, base, unmove(50), "high watermark hit, used percentage: {}, high watermark percentage: {}",
used_pct, get_journal_vdev_size_limit());
HS_LOG_EVERY_N(WARN, base, unmove(50),
"high watermark hit, used percentage: {}, high watermark percentage: {}", used_pct,
get_journal_vdev_size_limit());
return true;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/lib/device/device_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void DeviceManager::format_devices() {
// Get common iomgr_attributes
for (auto& dinfo : m_dev_infos) {
format_single_device(dinfo);
}
}

// Verify the first blocks to see if the devs are unique
HS_REL_ASSERT(verify_unique_devs(), "Found duplicate physical devices in the system");
Expand Down Expand Up @@ -163,7 +163,9 @@ bool DeviceManager::verify_unique_devs() const {
for (auto& pdev : m_all_pdevs) {
if (!pdev) { continue; }
auto buf = hs_utils::iobuf_alloc(hs_super_blk::first_block_size(), sisl::buftag::superblk, 512);
if (auto err = pdev->read_super_block(buf, hs_super_blk::first_block_size(), hs_super_blk::first_block_offset()); err) {
if (auto err =
pdev->read_super_block(buf, hs_super_blk::first_block_size(), hs_super_blk::first_block_offset());
err) {
LOGERROR("Failed to read first block from device={}, error={}", pdev->get_devname(), err.message());
ret = false;
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/replication/repl_dev/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ReplServiceError repl_req_ctx::alloc_local_blks(cshared< ReplDevListener >& list
DEBUG_ASSERT(has_linked_data(), "Trying to allocate a block for non-inlined block");

auto const hints_result = listener->get_blk_alloc_hints(m_header, data_size, repl_req_ptr_t(this));
if (hints_result.hasError()) { return hints_result.error(); }
if (!hints_result.has_value()) { return hints_result.error(); }

if (hints_result.value().committed_blk_id.has_value()) {
// if the committed_blk_id is already present, use it and skip allocation and commitment
Expand Down
8 changes: 4 additions & 4 deletions src/lib/replication/repl_dev/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ struct repl_dev_superblk {

#pragma pack()

template < class V = folly::Unit >
template < class V = void >
auto make_async_error(ReplServiceError err) {
return folly::makeSemiFuture< ReplResult< V > >(folly::makeUnexpected(err));
return folly::makeSemiFuture< ReplResult< V > >(std::unexpected(err));
}

template < class V >
auto make_async_success(V v) {
return folly::makeSemiFuture< ReplResult< V > >(std::move(v));
}

template < class V = folly::Unit >
template < class V = void >
auto make_async_success() {
return folly::makeSemiFuture< ReplResult< folly::Unit > >(folly::Unit{});
return folly::makeSemiFuture< ReplResult< void > >(ReplResult< void >());
}

inline uint64_t generateRandomTraceId() {
Expand Down
34 changes: 16 additions & 18 deletions src/lib/replication/repl_dev/raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ AsyncReplResult<> RaftReplDev::start_replace_member(std::string& task_id, const
RD_LOGE(trace_id, "Step1. Replace member invalid parameter, out member is not found, task_id={}", task_id);
return make_async_error<>(ReplServiceError::SERVER_NOT_FOUND);
}
if (m_my_repl_id != get_leader_id()) {
return make_async_error<>(ReplServiceError::NOT_LEADER);
}
if (m_my_repl_id != get_leader_id()) { return make_async_error<>(ReplServiceError::NOT_LEADER); }
// Check if leader itself is requested to move out.
if (m_my_repl_id == member_out.id) {
// immediate=false successor=-1, nuraft will choose an alive peer with highest priority as successor, and wait
Expand Down Expand Up @@ -405,9 +403,7 @@ ReplaceMemberStatus RaftReplDev::get_replace_member_status(std::string& task_id,
}
init_req_counter counter(pending_request_num);

if (!m_repl_svc_ctx || !is_leader()) {
return ReplaceMemberStatus::NOT_LEADER;
}
if (!m_repl_svc_ctx || !is_leader()) { return ReplaceMemberStatus::NOT_LEADER; }

auto peers = get_replication_status();
peer_info out_peer_info;
Expand Down Expand Up @@ -480,7 +476,7 @@ ReplServiceError RaftReplDev::do_add_member(const replica_member_info& member, u
auto add_ret = m_msg_mgr.add_member(m_group_id, srv_config)
.via(&folly::InlineExecutor::instance())
.thenValue([this, member, trace_id](auto&& e) -> nuraft::cmd_result_code {
return e.hasError() ? e.error() : nuraft::cmd_result_code::OK;
return (!e.has_value()) ? e.error() : nuraft::cmd_result_code::OK;
});
return add_ret.value();
},
Expand Down Expand Up @@ -517,7 +513,7 @@ ReplServiceError RaftReplDev::do_remove_member(const replica_member_info& member
auto rem_ret = m_msg_mgr.rem_member(m_group_id, member.id)
.via(&folly::InlineExecutor::instance())
.thenValue([this, member, trace_id](auto&& e) -> nuraft::cmd_result_code {
return e.hasError() ? e.error() : nuraft::cmd_result_code::OK;
return (!e.has_value()) ? e.error() : nuraft::cmd_result_code::OK;
});
return rem_ret.value();
},
Expand Down Expand Up @@ -706,7 +702,7 @@ void RaftReplDev::on_create_snapshot(nuraft::snapshot& s, nuraft::async_result<
auto snp_ctx = std::make_shared< nuraft_snapshot_context >(s);
auto result = m_listener->create_snapshot(snp_ctx).get();
auto null_except = std::shared_ptr< std::exception >();
HS_REL_ASSERT(result.hasError() == false, "Not expecting creating snapshot to return false. ");
HS_REL_ASSERT((!result.has_value()) == false, "Not expecting creating snapshot to return false. ");

// propose truncate boundary on leader if needed
if (is_leader()) { propose_truncate_boundary(); }
Expand Down Expand Up @@ -890,7 +886,7 @@ void RaftReplDev::push_data_to_all_followers(repl_req_ptr_t rreq, sisl::sg_list
for (auto const& res : v_res) {
if (sisl_likely(res.value())) {
auto r = res.value();
if (r.hasError()) {
if (!r.has_value()) {
// Just logging PushData error, no action is needed as follower can try by fetchData.
RD_LOGI(rreq->traceID(), "Data Channel: Error in pushing data to all followers: rreq=[{}] error={}",
rreq->to_string(), r.error());
Expand Down Expand Up @@ -1692,13 +1688,15 @@ AsyncReplResult<> RaftReplDev::become_leader() {
}
init_req_counter counter(pending_request_num);

return m_msg_mgr.become_leader(m_group_id).via(&folly::InlineExecutor::instance()).thenValue([this, counter = std::move(counter)](auto&& e) {
if (e.hasError()) {
RD_LOGE(NO_TRACE_ID, "Error in becoming leader: {}", e.error());
return make_async_error<>(RaftReplService::to_repl_error(e.error()));
}
return make_async_success<>();
});
return m_msg_mgr.become_leader(m_group_id)
.via(&folly::InlineExecutor::instance())
.thenValue([this, counter = std::move(counter)](auto&& e) {
if (!e.has_value()) {
RD_LOGE(NO_TRACE_ID, "Error in becoming leader: {}", e.error());
return make_async_error<>(RaftReplService::to_repl_error(e.error()));
}
return make_async_success<>();
});
}

bool RaftReplDev::is_leader() const { return m_repl_svc_ctx && m_repl_svc_ctx->is_raft_leader(); }
Expand Down Expand Up @@ -2159,7 +2157,7 @@ void RaftReplDev::monitor_replace_member_replication_status() {
replica_member_info out{replica_out, ""};
replica_member_info in{replica_in, ""};
auto ret = complete_replace_member(task_id, out, in, 0, trace_id).get();
if (ret.hasError()) {
if (!ret.has_value()) {
RD_LOGE(trace_id, "Failed to complete replace member, next time will retry it, task_id={}, error={}", task_id,
ret.error());
return;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/replication/repl_dev/raft_repl_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ class RaftReplDev : public ReplDev,

void become_leader_cb();

void become_follower_cb() {
void become_follower_cb() {
m_traffic_ready_lsn.store(0);
RD_LOGD(NO_TRACE_ID, "become_follower_cb called!");
RD_LOGD(NO_TRACE_ID, "become_follower_cb called!");
}

/// @brief This method is called when the data journal is compacted
Expand Down
4 changes: 2 additions & 2 deletions src/lib/replication/service/generic_repl_svc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GenericReplService::~GenericReplService() {
ReplResult< shared< ReplDev > > GenericReplService::get_repl_dev(group_id_t group_id) const {
std::shared_lock lg(m_rd_map_mtx);
if (auto it = m_rd_map.find(group_id); it != m_rd_map.end()) { return it->second; }
return folly::makeUnexpected(ReplServiceError::SERVER_NOT_FOUND);
return std::unexpected(ReplServiceError::SERVER_NOT_FOUND);
}

void GenericReplService::iterate_repl_devs(std::function< void(cshared< ReplDev >&) > const& cb) {
Expand Down Expand Up @@ -147,7 +147,7 @@ AsyncReplResult< shared< ReplDev > > SoloReplService::create_repl_dev(group_id_t
folly::SemiFuture< ReplServiceError > SoloReplService::remove_repl_dev(group_id_t group_id) {
// RD_LOGI("Removing repl dev for group_id={}", boost::uuids::to_string(group_id));
auto rdev = get_repl_dev(group_id);
if (rdev.hasError()) { return folly::makeSemiFuture(rdev.error()); }
if (!rdev.has_value()) { return folly::makeSemiFuture(rdev.error()); }

auto rdev_ptr = rdev.value();

Expand Down
4 changes: 2 additions & 2 deletions src/lib/replication/service/raft_repl_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ AsyncReplResult<> RaftReplService::replace_member(group_id_t group_id, std::stri
->start_replace_member(task_id, member_out, member_in, commit_quorum, trace_id)
.via(&folly::InlineExecutor::instance())
.thenValue([this](auto&& e) mutable {
if (e.hasError()) {
if (!e.has_value()) {
decr_pending_request_num();
return make_async_error<>(e.error());
}
Expand All @@ -550,7 +550,7 @@ AsyncReplResult<> RaftReplService::flip_learner_flag(group_id_t group_id, const
->flip_learner_flag(member, target, commit_quorum, wait_and_verify, trace_id)
.via(&folly::InlineExecutor::instance())
.thenValue([this](auto&& e) mutable {
if (e.hasError()) {
if (!e.has_value()) {
decr_pending_request_num();
return make_async_error<>(e.error());
}
Expand Down
1 change: 0 additions & 1 deletion src/lib/replication/service/raft_repl_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <string>
#include <shared_mutex>

#include <folly/Expected.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_common/hs_repl_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class HSReplTestHelper : public HSTestHelper {
}

auto v = hs()->repl_service().create_repl_dev(repl_group_id, members).get();
ASSERT_EQ(v.hasValue(), true)
ASSERT_EQ(v.has_value(), true)
<< "Error in creating repl dev for group_id=" << boost::uuids::to_string(repl_group_id).c_str()
<< ", err=" << v.error();
auto& raftService = dynamic_cast< RaftReplService& >(hs()->repl_service());
Expand Down
Loading
Loading