Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unique lock remap accessors on close(). #443

Merged
merged 3 commits into from
Apr 21, 2024
Merged
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
3 changes: 2 additions & 1 deletion include/bitcoin/database/tables/indexes/strong_tx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ struct strong_tx

inline bool operator==(const record& other) const NOEXCEPT
{
return header_fk == other.header_fk;
return header_fk == other.header_fk
&& positive == other.positive;
}

block::integer header_fk{};
Expand Down
2 changes: 1 addition & 1 deletion src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DEFINE_ERROR_T_MESSAGE_MAP(error)
{ load_failure, "disk full" },
{ flush_unloaded, "flushing unloaded file" },
{ flush_failure, "file failed to flush" },
{ unload_locked, "unloading unloaded file" },
{ unload_locked, "unloading locked file" },
{ unload_failure, "file failed to unload" },

// locks
Expand Down
1 change: 1 addition & 0 deletions src/memory/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ code map::open() NOEXCEPT

code map::close() NOEXCEPT
{
std::unique_lock map_lock(remap_mutex_);
std::unique_lock field_lock(field_mutex_);

if (loaded_)
Expand Down
2 changes: 1 addition & 1 deletion test/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE(error_t__code__unload_locked__true_exected_message)
const auto ec = code(value);
BOOST_REQUIRE(ec);
BOOST_REQUIRE(ec == value);
BOOST_REQUIRE_EQUAL(ec.message(), "unloading unloaded file");
BOOST_REQUIRE_EQUAL(ec.message(), "unloading locked file");
}

BOOST_AUTO_TEST_CASE(error_t__code__unload_failure__true_exected_message)
Expand Down