From d29ed882c082ec958f225f90d416179cdf41232e Mon Sep 17 00:00:00 2001 From: Huang-Ming Huang Date: Mon, 12 Apr 2021 13:17:30 -0500 Subject: [PATCH] Change the max-retained-history-files default value --- plugins/state_history_plugin/state_history_plugin.cpp | 2 +- unittests/state_history_tests.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/state_history_plugin/state_history_plugin.cpp b/plugins/state_history_plugin/state_history_plugin.cpp index a510e9da94a..76abdcdb0d9 100644 --- a/plugins/state_history_plugin/state_history_plugin.cpp +++ b/plugins/state_history_plugin/state_history_plugin.cpp @@ -414,7 +414,7 @@ void state_history_plugin::set_program_options(options_description& cli, options "When the stride is reached, the current history log and index will be renamed '*-history--.log/index'\n" "and a new current history log and index will be created with the most recent blocks. All files following\n" "this format will be used to construct an extended history log."); - options("max-retained-history-files", bpo::value()->default_value(10), + options("max-retained-history-files", bpo::value()->default_value(UINT32_MAX), "the maximum number of history file groups to retain so that the blocks in those files can be queried.\n" "When the number is reached, the oldest history file would be moved to archive dir or deleted if the archive dir is empty.\n" "The retained history log files should not be manipulated by users." ); diff --git a/unittests/state_history_tests.cpp b/unittests/state_history_tests.cpp index 9ab4a9e2d7b..ce08d7be61b 100644 --- a/unittests/state_history_tests.cpp +++ b/unittests/state_history_tests.cpp @@ -335,6 +335,8 @@ BOOST_AUTO_TEST_CASE(test_splitted_log) { BOOST_CHECK(bfs::exists( retained_dir / "trace_history-121-140.log" )); BOOST_CHECK(bfs::exists( retained_dir / "trace_history-121-140.index" )); + BOOST_CHECK_EQUAL(chain.traces_log.begin_block(), 41); + BOOST_CHECK(bfs::exists( retained_dir / "chain_state_history-41-60.log" )); BOOST_CHECK(bfs::exists( retained_dir / "chain_state_history-41-60.index" )); BOOST_CHECK(bfs::exists( retained_dir / "chain_state_history-61-80.log" )); @@ -346,6 +348,8 @@ BOOST_AUTO_TEST_CASE(test_splitted_log) { BOOST_CHECK(bfs::exists( retained_dir / "chain_state_history-121-140.log" )); BOOST_CHECK(bfs::exists( retained_dir / "chain_state_history-121-140.index" )); + BOOST_CHECK_EQUAL(chain.chain_state_log.begin_block(), 41); + BOOST_CHECK(get_traces(chain.traces_log, 10).empty()); BOOST_CHECK(get_traces(chain.traces_log, 100).size()); BOOST_CHECK(get_traces(chain.traces_log, 140).size());