Skip to content
Open

O_DSYNC #1837

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
2 changes: 1 addition & 1 deletion category/async/storage_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ storage_pool::device storage_pool::make_device_(
path.c_str(),
((flags.open_read_only || flags.open_read_only_allow_dirty)
? O_RDONLY
: O_RDWR) |
: (O_RDWR | O_DSYNC)) |
O_CLOEXEC);
MONAD_ASSERT_PRINTF(
readwritefd != -1, "open failed due to %s", std::strerror(errno));
Expand Down
2 changes: 1 addition & 1 deletion category/execution/ethereum/db/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ std::unique_ptr<StateMachine> InMemoryMachine::clone() const
bool OnDiskMachine::cache() const
{
constexpr uint64_t CACHE_DEPTH_IN_TABLE = 5;
return table == TableType::Prefix ||
return table == TableType::Prefix || depth <= prefix_len() + 1 ||
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition depth <= prefix_len() + 1 overlaps with the subsequent condition depth <= prefix_len() + CACHE_DEPTH_IN_TABLE when CACHE_DEPTH_IN_TABLE is 5. This creates redundant logic since any depth satisfying depth <= prefix_len() + 1 will also satisfy depth <= prefix_len() + 5. Consider removing the overlapping portion or adding a comment explaining why the explicit depth <= prefix_len() + 1 check is necessary despite the overlap.

Suggested change
return table == TableType::Prefix || depth <= prefix_len() + 1 ||
return table == TableType::Prefix ||

Copilot uses AI. Check for mistakes.
((depth <= prefix_len() + CACHE_DEPTH_IN_TABLE) &&
(table == TableType::State || table == TableType::Code ||
table == TableType::TxHash || table == TableType::BlockHash));
Expand Down
5 changes: 1 addition & 4 deletions category/mpt/trie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ Node::SharedPtr upsert(
auto root = entry.ptr;
if (aux.is_on_disk() && root) {
if (write_root) {
write_new_root_node(aux, *root, version);
}
else {
flush_buffered_writes(aux);
write_new_root_node(aux, *root, version); // this flushes writes
}
}
return root;
Expand Down
Loading