diff --git a/include/chainbase/chainbase.hpp b/include/chainbase/chainbase.hpp index 053eac4..6f66d27 100644 --- a/include/chainbase/chainbase.hpp +++ b/include/chainbase/chainbase.hpp @@ -520,10 +520,6 @@ namespace chainbase { _read_only_mode = false; } - void revert_to_private_mode() { - _db_file.revert_to_private_mode(); - } - size_t check_memory_and_flush_if_needed() { return _db_file.check_memory_and_flush_if_needed(); } diff --git a/include/chainbase/pinnable_mapped_file.hpp b/include/chainbase/pinnable_mapped_file.hpp index 921c32c..800b93f 100644 --- a/include/chainbase/pinnable_mapped_file.hpp +++ b/include/chainbase/pinnable_mapped_file.hpp @@ -58,7 +58,6 @@ class pinnable_mapped_file { ~pinnable_mapped_file(); segment_manager* get_segment_manager() const { return _segment_manager;} - void revert_to_private_mode(); size_t check_memory_and_flush_if_needed(); diff --git a/src/pinnable_mapped_file.cpp b/src/pinnable_mapped_file.cpp index d33a051..3875da2 100644 --- a/src/pinnable_mapped_file.cpp +++ b/src/pinnable_mapped_file.cpp @@ -244,26 +244,6 @@ void pinnable_mapped_file::setup_copy_on_write_mapping() { } } -// this is called after loading a snapshot, when database-map-mode was switched from `mapped_private` to -// `mapped` to avoid running out of memory (because loading a snapshot causes all state pages to be modified). -// This provides an opportunity to revert back to the `mapped_private` mode with it friendlier disk -// usage characteristics. -void pinnable_mapped_file::revert_to_private_mode() { - if (!_sharable) - return; - - // do synchronous flush of all modified pages of our mapping - if(_file_mapped_region.flush(0, 0, false) == false) - std::cerr << "CHAINBASE: ERROR: syncing buffers failed" << '\n'; - else { - // disk db file is up to date (with dirty bit set to true) - // we can kill the RW (`shared`) mapping and recreate a `copy_on_write` one. - _file_mapped_region = bip::mapped_region(); - setup_copy_on_write_mapping(); - _sharable = false; - } -} - // returns the number of pages flushed to disk size_t pinnable_mapped_file::check_memory_and_flush_if_needed() { size_t written_pages {0};