diff --git a/category/async/storage_pool.cpp b/category/async/storage_pool.cpp index 3422fa6f8..6a3d72009 100644 --- a/category/async/storage_pool.cpp +++ b/category/async/storage_pool.cpp @@ -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)); diff --git a/category/execution/ethereum/db/util.cpp b/category/execution/ethereum/db/util.cpp index 00beb7f5d..0f0737ee2 100644 --- a/category/execution/ethereum/db/util.cpp +++ b/category/execution/ethereum/db/util.cpp @@ -632,7 +632,7 @@ std::unique_ptr 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 || ((depth <= prefix_len() + CACHE_DEPTH_IN_TABLE) && (table == TableType::State || table == TableType::Code || table == TableType::TxHash || table == TableType::BlockHash)); diff --git a/category/mpt/trie.cpp b/category/mpt/trie.cpp index b861dbb90..a03343c25 100644 --- a/category/mpt/trie.cpp +++ b/category/mpt/trie.cpp @@ -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;