Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

huangminghuang/ship-max-retained-files #10241

Merged
merged 1 commit into from
Apr 14, 2021
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
2 changes: 1 addition & 1 deletion plugins/state_history_plugin/state_history_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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-<start num>-<end num>.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<uint32_t>()->default_value(10),
options("max-retained-history-files", bpo::value<uint32_t>()->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." );
Expand Down
4 changes: 4 additions & 0 deletions unittests/state_history_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ));
Expand All @@ -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());
Expand Down