Remove unused frontiers table (#4425)
This commit is contained in:
		
					parent
					
						
							
								277339ed7e
							
						
					
				
			
			
				commit
				
					
						43dae2f543
					
				
			
		
					 20 changed files with 87 additions and 278 deletions
				
			
		| 
						 | 
				
			
			@ -1397,6 +1397,42 @@ TEST (mdb_block_store, upgrade_v21_v22)
 | 
			
		|||
	// Testing the upgrade code worked
 | 
			
		||||
	check_correct_state ();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST (mdb_block_store, upgrade_v23_v24)
 | 
			
		||||
{
 | 
			
		||||
	if (nano::rocksdb_config::using_rocksdb_in_tests ())
 | 
			
		||||
	{
 | 
			
		||||
		// Direct lmdb operations are used to simulate the old ledger format so this test will not work on RocksDB
 | 
			
		||||
		GTEST_SKIP ();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	auto path (nano::unique_path () / "data.ldb");
 | 
			
		||||
	nano::logger logger;
 | 
			
		||||
	nano::stats stats;
 | 
			
		||||
	auto const check_correct_state = [&] () {
 | 
			
		||||
		nano::store::lmdb::component store (logger, path, nano::dev::constants);
 | 
			
		||||
		auto transaction (store.tx_begin_write ());
 | 
			
		||||
		ASSERT_EQ (store.version.get (transaction), store.version_current);
 | 
			
		||||
		MDB_dbi frontiers_handle{ 0 };
 | 
			
		||||
		ASSERT_EQ (MDB_NOTFOUND, mdb_dbi_open (store.env.tx (transaction), "frontiers", 0, &frontiers_handle));
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// Testing current version doesn't contain the frontiers table
 | 
			
		||||
	check_correct_state ();
 | 
			
		||||
 | 
			
		||||
	// Setting the database to its 23st version state
 | 
			
		||||
	{
 | 
			
		||||
		nano::store::lmdb::component store (logger, path, nano::dev::constants);
 | 
			
		||||
		auto transaction (store.tx_begin_write ());
 | 
			
		||||
		store.version.put (transaction, 23);
 | 
			
		||||
		MDB_dbi frontiers_handle{ 0 };
 | 
			
		||||
		ASSERT_FALSE (mdb_dbi_open (store.env.tx (transaction), "frontiers", MDB_CREATE, &frontiers_handle));
 | 
			
		||||
		ASSERT_EQ (store.version.get (transaction), 23);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Testing the upgrade code worked
 | 
			
		||||
	check_correct_state ();
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace nano::store::rocksdb
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5502,7 +5502,6 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
 | 
			
		|||
		store.confirmation_height.put (transaction, nano::dev::genesis_key.pub, { 2, send->hash () });
 | 
			
		||||
 | 
			
		||||
		store.online_weight.put (transaction, 100, nano::amount (2));
 | 
			
		||||
		store.frontier.put (transaction, nano::block_hash (2), nano::account (5));
 | 
			
		||||
		store.peer.put (transaction, endpoint_key);
 | 
			
		||||
 | 
			
		||||
		store.pending.put (transaction, nano::pending_key (nano::dev::genesis_key.pub, send->hash ()), nano::pending_info (nano::dev::genesis_key.pub, 100, nano::epoch::epoch_0));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -284,7 +284,7 @@ auto nano::block_processor::process_batch (nano::unique_lock<nano::mutex> & lock
 | 
			
		|||
	processed_batch_t processed;
 | 
			
		||||
 | 
			
		||||
	auto scoped_write_guard = write_database_queue.wait (nano::writer::process_batch);
 | 
			
		||||
	auto transaction (node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::frontiers, tables::pending, tables::rep_weights }));
 | 
			
		||||
	auto transaction (node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::pending, tables::rep_weights }));
 | 
			
		||||
	nano::timer<std::chrono::milliseconds> timer_l;
 | 
			
		||||
 | 
			
		||||
	lock_a.lock ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -385,7 +385,7 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
 | 
			
		|||
 | 
			
		||||
		if (!is_initialized && !flags.read_only)
 | 
			
		||||
		{
 | 
			
		||||
			auto const transaction (store.tx_begin_write ({ tables::accounts, tables::blocks, tables::confirmation_height, tables::frontiers, tables::rep_weights }));
 | 
			
		||||
			auto const transaction (store.tx_begin_write ({ tables::accounts, tables::blocks, tables::confirmation_height, tables::rep_weights }));
 | 
			
		||||
			// Store was empty meaning we just created it, add the genesis block
 | 
			
		||||
			store.initialize (transaction, ledger.cache, ledger.constants);
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -596,7 +596,7 @@ void nano::node::process_active (std::shared_ptr<nano::block> const & incoming)
 | 
			
		|||
 | 
			
		||||
nano::block_status nano::node::process (std::shared_ptr<nano::block> block)
 | 
			
		||||
{
 | 
			
		||||
	auto const transaction = store.tx_begin_write ({ tables::accounts, tables::blocks, tables::frontiers, tables::pending, tables::rep_weights });
 | 
			
		||||
	auto const transaction = store.tx_begin_write ({ tables::accounts, tables::blocks, tables::pending, tables::rep_weights });
 | 
			
		||||
	return process (transaction, block);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,6 @@
 | 
			
		|||
#include <nano/store/component.hpp>
 | 
			
		||||
#include <nano/store/confirmation_height.hpp>
 | 
			
		||||
#include <nano/store/final.hpp>
 | 
			
		||||
#include <nano/store/frontier.hpp>
 | 
			
		||||
#include <nano/store/online_weight.hpp>
 | 
			
		||||
#include <nano/store/peer.hpp>
 | 
			
		||||
#include <nano/store/pending.hpp>
 | 
			
		||||
| 
						 | 
				
			
			@ -59,8 +58,6 @@ public:
 | 
			
		|||
			nano::account_info new_info (block_a.hashables.previous, info->representative, info->open_block, ledger.balance (transaction, block_a.hashables.previous).value (), nano::seconds_since_epoch (), info->block_count - 1, nano::epoch::epoch_0);
 | 
			
		||||
			ledger.update_account (transaction, pending.value ().source, *info, new_info);
 | 
			
		||||
			ledger.store.block.del (transaction, hash);
 | 
			
		||||
			ledger.store.frontier.del (transaction, hash);
 | 
			
		||||
			ledger.store.frontier.put (transaction, block_a.hashables.previous, pending.value ().source);
 | 
			
		||||
			ledger.store.block.successor_clear (transaction, block_a.hashables.previous);
 | 
			
		||||
			ledger.stats.inc (nano::stat::type::rollback, nano::stat::detail::send);
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -79,8 +76,6 @@ public:
 | 
			
		|||
		ledger.update_account (transaction, destination_account, *info, new_info);
 | 
			
		||||
		ledger.store.block.del (transaction, hash);
 | 
			
		||||
		ledger.store.pending.put (transaction, nano::pending_key (destination_account, block_a.hashables.source), { source_account.value_or (0), amount, nano::epoch::epoch_0 });
 | 
			
		||||
		ledger.store.frontier.del (transaction, hash);
 | 
			
		||||
		ledger.store.frontier.put (transaction, block_a.hashables.previous, destination_account);
 | 
			
		||||
		ledger.store.block.successor_clear (transaction, block_a.hashables.previous);
 | 
			
		||||
		ledger.stats.inc (nano::stat::type::rollback, nano::stat::detail::receive);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +90,6 @@ public:
 | 
			
		|||
		ledger.update_account (transaction, destination_account, new_info, new_info);
 | 
			
		||||
		ledger.store.block.del (transaction, hash);
 | 
			
		||||
		ledger.store.pending.put (transaction, nano::pending_key (destination_account, block_a.hashables.source), { source_account.value_or (0), amount, nano::epoch::epoch_0 });
 | 
			
		||||
		ledger.store.frontier.del (transaction, hash);
 | 
			
		||||
		ledger.stats.inc (nano::stat::type::rollback, nano::stat::detail::open);
 | 
			
		||||
	}
 | 
			
		||||
	void change_block (nano::change_block const & block_a) override
 | 
			
		||||
| 
						 | 
				
			
			@ -113,8 +107,6 @@ public:
 | 
			
		|||
		ledger.store.block.del (transaction, hash);
 | 
			
		||||
		nano::account_info new_info (block_a.hashables.previous, representative, info->open_block, info->balance, nano::seconds_since_epoch (), info->block_count - 1, nano::epoch::epoch_0);
 | 
			
		||||
		ledger.update_account (transaction, account, *info, new_info);
 | 
			
		||||
		ledger.store.frontier.del (transaction, hash);
 | 
			
		||||
		ledger.store.frontier.put (transaction, block_a.hashables.previous, account);
 | 
			
		||||
		ledger.store.block.successor_clear (transaction, block_a.hashables.previous);
 | 
			
		||||
		ledger.stats.inc (nano::stat::type::rollback, nano::stat::detail::change);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -174,10 +166,6 @@ public:
 | 
			
		|||
		if (previous != nullptr)
 | 
			
		||||
		{
 | 
			
		||||
			ledger.store.block.successor_clear (transaction, block_a.hashables.previous);
 | 
			
		||||
			if (previous->type () < nano::block_type::state)
 | 
			
		||||
			{
 | 
			
		||||
				ledger.store.frontier.put (transaction, block_a.hashables.previous, block_a.hashables.account);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -371,10 +359,6 @@ void ledger_processor::state_block_impl (nano::state_block & block_a)
 | 
			
		|||
 | 
			
		||||
						nano::account_info new_info (hash, block_a.hashables.representative, info.open_block.is_zero () ? hash : info.open_block, block_a.hashables.balance, nano::seconds_since_epoch (), info.block_count + 1, epoch);
 | 
			
		||||
						ledger.update_account (transaction, block_a.hashables.account, info, new_info);
 | 
			
		||||
						if (!ledger.store.frontier.get (transaction, info.head).is_zero ())
 | 
			
		||||
						{
 | 
			
		||||
							ledger.store.frontier.del (transaction, info.head);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -441,10 +425,6 @@ void ledger_processor::epoch_block_impl (nano::state_block & block_a)
 | 
			
		|||
								ledger.store.block.put (transaction, hash, block_a);
 | 
			
		||||
								nano::account_info new_info (hash, block_a.hashables.representative, info.open_block.is_zero () ? hash : info.open_block, info.balance, nano::seconds_since_epoch (), info.block_count + 1, epoch);
 | 
			
		||||
								ledger.update_account (transaction, block_a.hashables.account, info, new_info);
 | 
			
		||||
								if (!ledger.store.frontier.get (transaction, info.head).is_zero ())
 | 
			
		||||
								{
 | 
			
		||||
									ledger.store.frontier.del (transaction, info.head);
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			@ -489,8 +469,6 @@ void ledger_processor::change_block (nano::change_block & block_a)
 | 
			
		|||
							ledger.cache.rep_weights.representation_add_dual (transaction, block_a.hashables.representative, balance.number (), info->representative, 0 - balance.number ());
 | 
			
		||||
							nano::account_info new_info (hash, block_a.hashables.representative, info->open_block, info->balance, nano::seconds_since_epoch (), info->block_count + 1, nano::epoch::epoch_0);
 | 
			
		||||
							ledger.update_account (transaction, account, *info, new_info);
 | 
			
		||||
							ledger.store.frontier.del (transaction, block_a.hashables.previous);
 | 
			
		||||
							ledger.store.frontier.put (transaction, hash, account);
 | 
			
		||||
							ledger.stats.inc (nano::stat::type::ledger, nano::stat::detail::change);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			@ -539,8 +517,6 @@ void ledger_processor::send_block (nano::send_block & block_a)
 | 
			
		|||
								nano::account_info new_info (hash, info->representative, info->open_block, block_a.hashables.balance, nano::seconds_since_epoch (), info->block_count + 1, nano::epoch::epoch_0);
 | 
			
		||||
								ledger.update_account (transaction, account, *info, new_info);
 | 
			
		||||
								ledger.store.pending.put (transaction, nano::pending_key (block_a.hashables.destination, hash), { account, amount, nano::epoch::epoch_0 });
 | 
			
		||||
								ledger.store.frontier.del (transaction, block_a.hashables.previous);
 | 
			
		||||
								ledger.store.frontier.put (transaction, hash, account);
 | 
			
		||||
								ledger.stats.inc (nano::stat::type::ledger, nano::stat::detail::send);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
| 
						 | 
				
			
			@ -607,8 +583,6 @@ void ledger_processor::receive_block (nano::receive_block & block_a)
 | 
			
		|||
											nano::account_info new_info (hash, info->representative, info->open_block, new_balance, nano::seconds_since_epoch (), info->block_count + 1, nano::epoch::epoch_0);
 | 
			
		||||
											ledger.update_account (transaction, account, *info, new_info);
 | 
			
		||||
											ledger.cache.rep_weights.representation_add (transaction, info->representative, pending.value ().amount.number ());
 | 
			
		||||
											ledger.store.frontier.del (transaction, block_a.hashables.previous);
 | 
			
		||||
											ledger.store.frontier.put (transaction, hash, account);
 | 
			
		||||
											ledger.stats.inc (nano::stat::type::ledger, nano::stat::detail::receive);
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
| 
						 | 
				
			
			@ -669,7 +643,6 @@ void ledger_processor::open_block (nano::open_block & block_a)
 | 
			
		|||
									nano::account_info new_info (hash, block_a.representative_field ().value (), hash, pending.value ().amount.number (), nano::seconds_since_epoch (), 1, nano::epoch::epoch_0);
 | 
			
		||||
									ledger.update_account (transaction, block_a.hashables.account, info, new_info);
 | 
			
		||||
									ledger.cache.rep_weights.representation_add (transaction, block_a.representative_field ().value (), pending.value ().amount.number ());
 | 
			
		||||
									ledger.store.frontier.put (transaction, hash, block_a.hashables.account);
 | 
			
		||||
									ledger.stats.inc (nano::stat::type::ledger, nano::stat::detail::open);
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
| 
						 | 
				
			
			@ -1498,15 +1471,6 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
 | 
			
		|||
			}
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		store.frontier.for_each_par (
 | 
			
		||||
		[&rocksdb_store] (store::read_transaction const & /*unused*/, auto i, auto n) {
 | 
			
		||||
			for (; i != n; ++i)
 | 
			
		||||
			{
 | 
			
		||||
				auto rocksdb_transaction (rocksdb_store->tx_begin_write ({}, { nano::tables::frontiers }));
 | 
			
		||||
				rocksdb_store->frontier.put (rocksdb_transaction, i->first, i->second);
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		store.pruned.for_each_par (
 | 
			
		||||
		[&rocksdb_store] (store::read_transaction const & /*unused*/, auto i, auto n) {
 | 
			
		||||
			for (; i != n; ++i)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,13 +9,11 @@ add_library(
 | 
			
		|||
  iterator.hpp
 | 
			
		||||
  iterator_impl.hpp
 | 
			
		||||
  final.hpp
 | 
			
		||||
  frontier.hpp
 | 
			
		||||
  lmdb/account.hpp
 | 
			
		||||
  lmdb/block.hpp
 | 
			
		||||
  lmdb/confirmation_height.hpp
 | 
			
		||||
  lmdb/db_val.hpp
 | 
			
		||||
  lmdb/final_vote.hpp
 | 
			
		||||
  lmdb/frontier.hpp
 | 
			
		||||
  lmdb/iterator.hpp
 | 
			
		||||
  lmdb/lmdb.hpp
 | 
			
		||||
  lmdb/lmdb_env.hpp
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +36,6 @@ add_library(
 | 
			
		|||
  rocksdb/confirmation_height.hpp
 | 
			
		||||
  rocksdb/db_val.hpp
 | 
			
		||||
  rocksdb/final_vote.hpp
 | 
			
		||||
  rocksdb/frontier.hpp
 | 
			
		||||
  rocksdb/iterator.hpp
 | 
			
		||||
  rocksdb/online_weight.hpp
 | 
			
		||||
  rocksdb/peer.hpp
 | 
			
		||||
| 
						 | 
				
			
			@ -61,13 +58,11 @@ add_library(
 | 
			
		|||
  iterator.cpp
 | 
			
		||||
  iterator_impl.cpp
 | 
			
		||||
  final.cpp
 | 
			
		||||
  frontier.cpp
 | 
			
		||||
  lmdb/account.cpp
 | 
			
		||||
  lmdb/block.cpp
 | 
			
		||||
  lmdb/confirmation_height.cpp
 | 
			
		||||
  lmdb/db_val.cpp
 | 
			
		||||
  lmdb/final_vote.cpp
 | 
			
		||||
  lmdb/frontier.cpp
 | 
			
		||||
  lmdb/lmdb.cpp
 | 
			
		||||
  lmdb/lmdb_env.cpp
 | 
			
		||||
  lmdb/transaction.cpp
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +82,6 @@ add_library(
 | 
			
		|||
  rocksdb/confirmation_height.cpp
 | 
			
		||||
  rocksdb/db_val.cpp
 | 
			
		||||
  rocksdb/final_vote.cpp
 | 
			
		||||
  rocksdb/frontier.cpp
 | 
			
		||||
  rocksdb/online_weight.cpp
 | 
			
		||||
  rocksdb/peer.cpp
 | 
			
		||||
  rocksdb/pending.cpp
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,12 +5,10 @@
 | 
			
		|||
#include <nano/store/block.hpp>
 | 
			
		||||
#include <nano/store/component.hpp>
 | 
			
		||||
#include <nano/store/confirmation_height.hpp>
 | 
			
		||||
#include <nano/store/frontier.hpp>
 | 
			
		||||
#include <nano/store/rep_weight.hpp>
 | 
			
		||||
 | 
			
		||||
nano::store::component::component (nano::store::block & block_store_a, nano::store::frontier & frontier_store_a, nano::store::account & account_store_a, nano::store::pending & pending_store_a, nano::store::online_weight & online_weight_store_a, nano::store::pruned & pruned_store_a, nano::store::peer & peer_store_a, nano::store::confirmation_height & confirmation_height_store_a, nano::store::final_vote & final_vote_store_a, nano::store::version & version_store_a, nano::store::rep_weight & rep_weight_a) :
 | 
			
		||||
nano::store::component::component (nano::store::block & block_store_a, nano::store::account & account_store_a, nano::store::pending & pending_store_a, nano::store::online_weight & online_weight_store_a, nano::store::pruned & pruned_store_a, nano::store::peer & peer_store_a, nano::store::confirmation_height & confirmation_height_store_a, nano::store::final_vote & final_vote_store_a, nano::store::version & version_store_a, nano::store::rep_weight & rep_weight_a) :
 | 
			
		||||
	block (block_store_a),
 | 
			
		||||
	frontier (frontier_store_a),
 | 
			
		||||
	account (account_store_a),
 | 
			
		||||
	pending (pending_store_a),
 | 
			
		||||
	online_weight (online_weight_store_a),
 | 
			
		||||
| 
						 | 
				
			
			@ -40,5 +38,4 @@ void nano::store::component::initialize (store::write_transaction const & transa
 | 
			
		|||
	++ledger_cache_a.account_count;
 | 
			
		||||
	rep_weight.put (transaction_a, constants.genesis->account (), std::numeric_limits<nano::uint128_t>::max ());
 | 
			
		||||
	ledger_cache_a.rep_weights.representation_put (constants.genesis->account (), std::numeric_limits<nano::uint128_t>::max ());
 | 
			
		||||
	frontier.put (transaction_a, hash_l, constants.genesis->account ());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,6 @@ namespace store
 | 
			
		|||
	class block;
 | 
			
		||||
	class confirmation_height;
 | 
			
		||||
	class final_vote;
 | 
			
		||||
	class frontier;
 | 
			
		||||
	class online_weight;
 | 
			
		||||
	class peer;
 | 
			
		||||
	class pending;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +44,6 @@ namespace store
 | 
			
		|||
		// clang-format off
 | 
			
		||||
	explicit component (
 | 
			
		||||
		nano::store::block &,
 | 
			
		||||
		nano::store::frontier &,
 | 
			
		||||
		nano::store::account &,
 | 
			
		||||
		nano::store::pending &,
 | 
			
		||||
		nano::store::online_weight&,
 | 
			
		||||
| 
						 | 
				
			
			@ -67,12 +65,11 @@ namespace store
 | 
			
		|||
		virtual std::string error_string (int status) const = 0;
 | 
			
		||||
 | 
			
		||||
		store::block & block;
 | 
			
		||||
		store::frontier & frontier;
 | 
			
		||||
		store::account & account;
 | 
			
		||||
		store::pending & pending;
 | 
			
		||||
		store::rep_weight & rep_weight;
 | 
			
		||||
		static int constexpr version_minimum{ 21 };
 | 
			
		||||
		static int constexpr version_current{ 23 };
 | 
			
		||||
		static int constexpr version_current{ 24 };
 | 
			
		||||
 | 
			
		||||
	public:
 | 
			
		||||
		store::online_weight & online_weight;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
#include <nano/store/frontier.hpp>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,29 +0,0 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <nano/lib/numbers.hpp>
 | 
			
		||||
#include <nano/store/component.hpp>
 | 
			
		||||
#include <nano/store/iterator.hpp>
 | 
			
		||||
 | 
			
		||||
#include <functional>
 | 
			
		||||
 | 
			
		||||
namespace nano
 | 
			
		||||
{
 | 
			
		||||
class block_hash;
 | 
			
		||||
}
 | 
			
		||||
namespace nano::store
 | 
			
		||||
{
 | 
			
		||||
/**
 | 
			
		||||
 * Manages frontier storage and iteration
 | 
			
		||||
 */
 | 
			
		||||
class frontier
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	virtual void put (store::write_transaction const &, nano::block_hash const &, nano::account const &) = 0;
 | 
			
		||||
	virtual nano::account get (store::transaction const &, nano::block_hash const &) const = 0;
 | 
			
		||||
	virtual void del (store::write_transaction const &, nano::block_hash const &) = 0;
 | 
			
		||||
	virtual iterator<nano::block_hash, nano::account> begin (store::transaction const &) const = 0;
 | 
			
		||||
	virtual iterator<nano::block_hash, nano::account> begin (store::transaction const &, nano::block_hash const &) const = 0;
 | 
			
		||||
	virtual iterator<nano::block_hash, nano::account> end () const = 0;
 | 
			
		||||
	virtual void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, nano::account>, store::iterator<nano::block_hash, nano::account>)> const & action_a) const = 0;
 | 
			
		||||
};
 | 
			
		||||
} // namespace nano::store
 | 
			
		||||
| 
						 | 
				
			
			@ -1,57 +0,0 @@
 | 
			
		|||
#include <nano/secure/parallel_traversal.hpp>
 | 
			
		||||
#include <nano/store/lmdb/frontier.hpp>
 | 
			
		||||
#include <nano/store/lmdb/lmdb.hpp>
 | 
			
		||||
 | 
			
		||||
nano::store::lmdb::frontier::frontier (nano::store::lmdb::component & store) :
 | 
			
		||||
	store{ store }
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::lmdb::frontier::put (store::write_transaction const & transaction, nano::block_hash const & hash, nano::account const & account)
 | 
			
		||||
{
 | 
			
		||||
	auto status = store.put (transaction, tables::frontiers, hash, account);
 | 
			
		||||
	store.release_assert_success (status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::account nano::store::lmdb::frontier::get (store::transaction const & transaction, nano::block_hash const & hash) const
 | 
			
		||||
{
 | 
			
		||||
	store::db_val<MDB_val> value;
 | 
			
		||||
	auto status = store.get (transaction, tables::frontiers, hash, value);
 | 
			
		||||
	release_assert (store.success (status) || store.not_found (status));
 | 
			
		||||
	nano::account result{};
 | 
			
		||||
	if (store.success (status))
 | 
			
		||||
	{
 | 
			
		||||
		result = static_cast<nano::account> (value);
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::lmdb::frontier::del (store::write_transaction const & transaction, nano::block_hash const & hash)
 | 
			
		||||
{
 | 
			
		||||
	auto status = store.del (transaction, tables::frontiers, hash);
 | 
			
		||||
	store.release_assert_success (status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::store::iterator<nano::block_hash, nano::account> nano::store::lmdb::frontier::begin (store::transaction const & transaction) const
 | 
			
		||||
{
 | 
			
		||||
	return store.make_iterator<nano::block_hash, nano::account> (transaction, tables::frontiers);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::store::iterator<nano::block_hash, nano::account> nano::store::lmdb::frontier::begin (store::transaction const & transaction, nano::block_hash const & hash) const
 | 
			
		||||
{
 | 
			
		||||
	return store.make_iterator<nano::block_hash, nano::account> (transaction, tables::frontiers, store::db_val<MDB_val> (hash));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::store::iterator<nano::block_hash, nano::account> nano::store::lmdb::frontier::end () const
 | 
			
		||||
{
 | 
			
		||||
	return store::iterator<nano::block_hash, nano::account> (nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::lmdb::frontier::for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, nano::account>, store::iterator<nano::block_hash, nano::account>)> const & action_a) const
 | 
			
		||||
{
 | 
			
		||||
	parallel_traversal<nano::uint256_t> (
 | 
			
		||||
	[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
 | 
			
		||||
		auto transaction (this->store.tx_begin_read ());
 | 
			
		||||
		action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,34 +0,0 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <nano/store/frontier.hpp>
 | 
			
		||||
 | 
			
		||||
#include <lmdb/libraries/liblmdb/lmdb.h>
 | 
			
		||||
 | 
			
		||||
namespace nano::store::lmdb
 | 
			
		||||
{
 | 
			
		||||
class component;
 | 
			
		||||
}
 | 
			
		||||
namespace nano::store::lmdb
 | 
			
		||||
{
 | 
			
		||||
class frontier : public nano::store::frontier
 | 
			
		||||
{
 | 
			
		||||
private:
 | 
			
		||||
	nano::store::lmdb::component & store;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	frontier (nano::store::lmdb::component & store);
 | 
			
		||||
	void put (store::write_transaction const &, nano::block_hash const &, nano::account const &) override;
 | 
			
		||||
	nano::account get (store::transaction const &, nano::block_hash const &) const override;
 | 
			
		||||
	void del (store::write_transaction const &, nano::block_hash const &) override;
 | 
			
		||||
	store::iterator<nano::block_hash, nano::account> begin (store::transaction const &) const override;
 | 
			
		||||
	store::iterator<nano::block_hash, nano::account> begin (store::transaction const &, nano::block_hash const &) const override;
 | 
			
		||||
	store::iterator<nano::block_hash, nano::account> end () const override;
 | 
			
		||||
	void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, nano::account>, store::iterator<nano::block_hash, nano::account>)> const & action_a) const override;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Maps head block to owning account
 | 
			
		||||
	 * nano::block_hash -> nano::account
 | 
			
		||||
	 */
 | 
			
		||||
	MDB_dbi frontiers_handle{ 0 };
 | 
			
		||||
};
 | 
			
		||||
} // namespace nano::store::lmdb
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,6 @@ nano::store::lmdb::component::component (nano::logger & logger_a, std::filesyste
 | 
			
		|||
	// clang-format off
 | 
			
		||||
	nano::store::component{
 | 
			
		||||
		block_store,
 | 
			
		||||
		frontier_store,
 | 
			
		||||
		account_store,
 | 
			
		||||
		pending_store,
 | 
			
		||||
		online_weight_store,
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +30,6 @@ nano::store::lmdb::component::component (nano::logger & logger_a, std::filesyste
 | 
			
		|||
	},
 | 
			
		||||
	// clang-format on
 | 
			
		||||
	block_store{ *this },
 | 
			
		||||
	frontier_store{ *this },
 | 
			
		||||
	account_store{ *this },
 | 
			
		||||
	pending_store{ *this },
 | 
			
		||||
	online_weight_store{ *this },
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +194,6 @@ nano::store::lmdb::txn_callbacks nano::store::lmdb::component::create_txn_callba
 | 
			
		|||
 | 
			
		||||
void nano::store::lmdb::component::open_databases (bool & error_a, store::transaction const & transaction_a, unsigned flags)
 | 
			
		||||
{
 | 
			
		||||
	error_a |= mdb_dbi_open (env.tx (transaction_a), "frontiers", flags, &frontier_store.frontiers_handle) != 0;
 | 
			
		||||
	error_a |= mdb_dbi_open (env.tx (transaction_a), "online_weight", flags, &online_weight_store.online_weight_handle) != 0;
 | 
			
		||||
	error_a |= mdb_dbi_open (env.tx (transaction_a), "meta", flags, &version_store.meta_handle) != 0;
 | 
			
		||||
	error_a |= mdb_dbi_open (env.tx (transaction_a), "peers", flags, &peer_store.peers_handle) != 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -229,6 +226,9 @@ bool nano::store::lmdb::component::do_upgrades (store::write_transaction & trans
 | 
			
		|||
			upgrade_v22_to_v23 (transaction_a);
 | 
			
		||||
			[[fallthrough]];
 | 
			
		||||
		case 23:
 | 
			
		||||
			upgrade_v23_to_v24 (transaction_a);
 | 
			
		||||
			[[fallthrough]];
 | 
			
		||||
		case 24:
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			logger.critical (nano::log::type::lmdb, "The version of the ledger ({}) is too high for this node", version_l);
 | 
			
		||||
| 
						 | 
				
			
			@ -283,6 +283,17 @@ void nano::store::lmdb::component::upgrade_v22_to_v23 (store::write_transaction
 | 
			
		|||
	logger.info (nano::log::type::lmdb, "Upgrading database from v22 to v23 completed");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::lmdb::component::upgrade_v23_to_v24 (store::write_transaction const & transaction_a)
 | 
			
		||||
{
 | 
			
		||||
	logger.info (nano::log::type::lmdb, "Upgrading database from v23 to v24...");
 | 
			
		||||
 | 
			
		||||
	MDB_dbi frontiers_handle{ 0 };
 | 
			
		||||
	release_assert (!mdb_dbi_open (env.tx (transaction_a), "frontiers", MDB_CREATE, &frontiers_handle));
 | 
			
		||||
	release_assert (!mdb_drop (env.tx (transaction_a), frontiers_handle, 1)); // del = 1, to delete it from the environment and close the DB handle.
 | 
			
		||||
	version.put (transaction_a, 24);
 | 
			
		||||
	logger.info (nano::log::type::lmdb, "Upgrading database from v23 to v24 completed");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Takes a filepath, appends '_backup_<timestamp>' to the end (but before any extension) and saves that file in the same directory */
 | 
			
		||||
void nano::store::lmdb::component::create_backup_file (nano::store::lmdb::env & env_a, std::filesystem::path const & filepath_a, nano::logger & logger)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -360,8 +371,6 @@ MDB_dbi nano::store::lmdb::component::table_to_dbi (tables table_a) const
 | 
			
		|||
{
 | 
			
		||||
	switch (table_a)
 | 
			
		||||
	{
 | 
			
		||||
		case tables::frontiers:
 | 
			
		||||
			return frontier_store.frontiers_handle;
 | 
			
		||||
		case tables::accounts:
 | 
			
		||||
			return account_store.accounts_handle;
 | 
			
		||||
		case tables::blocks:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,6 @@
 | 
			
		|||
#include <nano/store/lmdb/confirmation_height.hpp>
 | 
			
		||||
#include <nano/store/lmdb/db_val.hpp>
 | 
			
		||||
#include <nano/store/lmdb/final_vote.hpp>
 | 
			
		||||
#include <nano/store/lmdb/frontier.hpp>
 | 
			
		||||
#include <nano/store/lmdb/iterator.hpp>
 | 
			
		||||
#include <nano/store/lmdb/lmdb_env.hpp>
 | 
			
		||||
#include <nano/store/lmdb/online_weight.hpp>
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +44,6 @@ private:
 | 
			
		|||
	nano::store::lmdb::block block_store;
 | 
			
		||||
	nano::store::lmdb::confirmation_height confirmation_height_store;
 | 
			
		||||
	nano::store::lmdb::final_vote final_vote_store;
 | 
			
		||||
	nano::store::lmdb::frontier frontier_store;
 | 
			
		||||
	nano::store::lmdb::online_weight online_weight_store;
 | 
			
		||||
	nano::store::lmdb::peer peer_store;
 | 
			
		||||
	nano::store::lmdb::pending pending_store;
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +55,6 @@ private:
 | 
			
		|||
	friend class nano::store::lmdb::block;
 | 
			
		||||
	friend class nano::store::lmdb::confirmation_height;
 | 
			
		||||
	friend class nano::store::lmdb::final_vote;
 | 
			
		||||
	friend class nano::store::lmdb::frontier;
 | 
			
		||||
	friend class nano::store::lmdb::online_weight;
 | 
			
		||||
	friend class nano::store::lmdb::peer;
 | 
			
		||||
	friend class nano::store::lmdb::pending;
 | 
			
		||||
| 
						 | 
				
			
			@ -117,6 +114,7 @@ private:
 | 
			
		|||
	bool do_upgrades (store::write_transaction &, nano::ledger_constants & constants, bool &);
 | 
			
		||||
	void upgrade_v21_to_v22 (store::write_transaction const &);
 | 
			
		||||
	void upgrade_v22_to_v23 (store::write_transaction const &);
 | 
			
		||||
	void upgrade_v23_to_v24 (store::write_transaction const &);
 | 
			
		||||
 | 
			
		||||
	void open_databases (bool &, store::transaction const &, unsigned);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,57 +0,0 @@
 | 
			
		|||
#include <nano/secure/parallel_traversal.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/frontier.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/rocksdb.hpp>
 | 
			
		||||
 | 
			
		||||
nano::store::rocksdb::frontier::frontier (nano::store::rocksdb::component & store) :
 | 
			
		||||
	store{ store }
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::rocksdb::frontier::put (store::write_transaction const & transaction, nano::block_hash const & block, nano::account const & account)
 | 
			
		||||
{
 | 
			
		||||
	auto status = store.put (transaction, tables::frontiers, block, account);
 | 
			
		||||
	store.release_assert_success (status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::account nano::store::rocksdb::frontier::get (store::transaction const & transaction, nano::block_hash const & hash) const
 | 
			
		||||
{
 | 
			
		||||
	db_val value;
 | 
			
		||||
	auto status = store.get (transaction, tables::frontiers, hash, value);
 | 
			
		||||
	release_assert (store.success (status) || store.not_found (status));
 | 
			
		||||
	nano::account result{};
 | 
			
		||||
	if (store.success (status))
 | 
			
		||||
	{
 | 
			
		||||
		result = static_cast<nano::account> (value);
 | 
			
		||||
	}
 | 
			
		||||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::rocksdb::frontier::del (store::write_transaction const & transaction, nano::block_hash const & hash)
 | 
			
		||||
{
 | 
			
		||||
	auto status = store.del (transaction, tables::frontiers, hash);
 | 
			
		||||
	store.release_assert_success (status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::store::iterator<nano::block_hash, nano::account> nano::store::rocksdb::frontier::begin (store::transaction const & transaction) const
 | 
			
		||||
{
 | 
			
		||||
	return store.make_iterator<nano::block_hash, nano::account> (transaction, tables::frontiers);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::store::iterator<nano::block_hash, nano::account> nano::store::rocksdb::frontier::begin (store::transaction const & transaction, nano::block_hash const & hash) const
 | 
			
		||||
{
 | 
			
		||||
	return store.make_iterator<nano::block_hash, nano::account> (transaction, tables::frontiers, hash);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nano::store::iterator<nano::block_hash, nano::account> nano::store::rocksdb::frontier::end () const
 | 
			
		||||
{
 | 
			
		||||
	return nano::store::iterator<nano::block_hash, nano::account> (nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::rocksdb::frontier::for_each_par (std::function<void (store::read_transaction const &, nano::store::iterator<nano::block_hash, nano::account>, nano::store::iterator<nano::block_hash, nano::account>)> const & action_a) const
 | 
			
		||||
{
 | 
			
		||||
	parallel_traversal<nano::uint256_t> (
 | 
			
		||||
	[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
 | 
			
		||||
		auto transaction (this->store.tx_begin_read ());
 | 
			
		||||
		action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <nano/store/frontier.hpp>
 | 
			
		||||
#include <nano/store/iterator.hpp>
 | 
			
		||||
 | 
			
		||||
namespace nano::store::rocksdb
 | 
			
		||||
{
 | 
			
		||||
class component;
 | 
			
		||||
}
 | 
			
		||||
namespace nano::store::rocksdb
 | 
			
		||||
{
 | 
			
		||||
class frontier : public nano::store::frontier
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	frontier (nano::store::rocksdb::component & store);
 | 
			
		||||
	void put (store::write_transaction const &, nano::block_hash const &, nano::account const &) override;
 | 
			
		||||
	nano::account get (store::transaction const &, nano::block_hash const &) const override;
 | 
			
		||||
	void del (store::write_transaction const &, nano::block_hash const &) override;
 | 
			
		||||
	store::iterator<nano::block_hash, nano::account> begin (store::transaction const &) const override;
 | 
			
		||||
	store::iterator<nano::block_hash, nano::account> begin (store::transaction const &, nano::block_hash const &) const override;
 | 
			
		||||
	store::iterator<nano::block_hash, nano::account> end () const override;
 | 
			
		||||
	void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, nano::account>, store::iterator<nano::block_hash, nano::account>)> const & action_a) const override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	nano::store::rocksdb::component & store;
 | 
			
		||||
};
 | 
			
		||||
} // namespace nano::store::rocksdb
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,6 @@ nano::store::rocksdb::component::component (nano::logger & logger_a, std::filesy
 | 
			
		|||
	// clang-format off
 | 
			
		||||
	nano::store::component{
 | 
			
		||||
		block_store,
 | 
			
		||||
		frontier_store,
 | 
			
		||||
		account_store,
 | 
			
		||||
		pending_store,
 | 
			
		||||
		online_weight_store,
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +51,6 @@ nano::store::rocksdb::component::component (nano::logger & logger_a, std::filesy
 | 
			
		|||
	},
 | 
			
		||||
	// clang-format on
 | 
			
		||||
	block_store{ *this },
 | 
			
		||||
	frontier_store{ *this },
 | 
			
		||||
	account_store{ *this },
 | 
			
		||||
	pending_store{ *this },
 | 
			
		||||
	online_weight_store{ *this },
 | 
			
		||||
| 
						 | 
				
			
			@ -164,7 +162,6 @@ nano::store::rocksdb::component::component (nano::logger & logger_a, std::filesy
 | 
			
		|||
std::unordered_map<char const *, nano::tables> nano::store::rocksdb::component::create_cf_name_table_map () const
 | 
			
		||||
{
 | 
			
		||||
	std::unordered_map<char const *, nano::tables> map{ { ::rocksdb::kDefaultColumnFamilyName.c_str (), tables::default_unused },
 | 
			
		||||
		{ "frontiers", tables::frontiers },
 | 
			
		||||
		{ "accounts", tables::accounts },
 | 
			
		||||
		{ "blocks", tables::blocks },
 | 
			
		||||
		{ "pending", tables::pending },
 | 
			
		||||
| 
						 | 
				
			
			@ -248,6 +245,9 @@ bool nano::store::rocksdb::component::do_upgrades (store::write_transaction cons
 | 
			
		|||
			upgrade_v22_to_v23 (transaction_a);
 | 
			
		||||
			[[fallthrough]];
 | 
			
		||||
		case 23:
 | 
			
		||||
			upgrade_v23_to_v24 (transaction_a);
 | 
			
		||||
			[[fallthrough]];
 | 
			
		||||
		case 24:
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			logger.critical (nano::log::type::rocksdb, "The version of the ledger ({}) is too high for this node", version_l);
 | 
			
		||||
| 
						 | 
				
			
			@ -316,6 +316,31 @@ void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transacti
 | 
			
		|||
	logger.info (nano::log::type::rocksdb, "Upgrading database from v22 to v23 completed");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::rocksdb::component::upgrade_v23_to_v24 (store::write_transaction const & transaction_a)
 | 
			
		||||
{
 | 
			
		||||
	logger.info (nano::log::type::rocksdb, "Upgrading database from v23 to v24...");
 | 
			
		||||
 | 
			
		||||
	if (column_family_exists ("frontiers"))
 | 
			
		||||
	{
 | 
			
		||||
		auto const unchecked_handle = get_column_family ("frontiers");
 | 
			
		||||
		db->DropColumnFamily (unchecked_handle);
 | 
			
		||||
		db->DestroyColumnFamilyHandle (unchecked_handle);
 | 
			
		||||
		std::erase_if (handles, [unchecked_handle] (auto & handle) {
 | 
			
		||||
			if (handle.get () == unchecked_handle)
 | 
			
		||||
			{
 | 
			
		||||
				// The handle resource is deleted by RocksDB.
 | 
			
		||||
				[[maybe_unused]] auto ptr = handle.release ();
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
			return false;
 | 
			
		||||
		});
 | 
			
		||||
		logger.debug (nano::log::type::rocksdb, "Finished removing frontiers table");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	version.put (transaction_a, 24);
 | 
			
		||||
	logger.info (nano::log::type::rocksdb, "Upgrading database from v23 to v24 completed");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void nano::store::rocksdb::component::generate_tombstone_map ()
 | 
			
		||||
{
 | 
			
		||||
	tombstone_map.emplace (std::piecewise_construct, std::forward_as_tuple (nano::tables::blocks), std::forward_as_tuple (0, 25000));
 | 
			
		||||
| 
						 | 
				
			
			@ -531,8 +556,6 @@ rocksdb::ColumnFamilyHandle * nano::store::rocksdb::component::table_to_column_f
 | 
			
		|||
{
 | 
			
		||||
	switch (table_a)
 | 
			
		||||
	{
 | 
			
		||||
		case tables::frontiers:
 | 
			
		||||
			return get_column_family ("frontiers");
 | 
			
		||||
		case tables::accounts:
 | 
			
		||||
			return get_column_family ("accounts");
 | 
			
		||||
		case tables::blocks:
 | 
			
		||||
| 
						 | 
				
			
			@ -904,7 +927,7 @@ void nano::store::rocksdb::component::on_flush (::rocksdb::FlushJobInfo const &
 | 
			
		|||
 | 
			
		||||
std::vector<nano::tables> nano::store::rocksdb::component::all_tables () const
 | 
			
		||||
{
 | 
			
		||||
	return std::vector<nano::tables>{ tables::accounts, tables::blocks, tables::confirmation_height, tables::final_votes, tables::frontiers, tables::meta, tables::online_weight, tables::peers, tables::pending, tables::pruned, tables::vote, tables::rep_weights };
 | 
			
		||||
	return std::vector<nano::tables>{ tables::accounts, tables::blocks, tables::confirmation_height, tables::final_votes, tables::meta, tables::online_weight, tables::peers, tables::pending, tables::pruned, tables::vote, tables::rep_weights };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool nano::store::rocksdb::component::copy_db (std::filesystem::path const & destination_path)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,6 @@
 | 
			
		|||
#include <nano/store/rocksdb/block.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/confirmation_height.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/final_vote.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/frontier.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/iterator.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/online_weight.hpp>
 | 
			
		||||
#include <nano/store/rocksdb/peer.hpp>
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +45,6 @@ private:
 | 
			
		|||
	nano::store::rocksdb::block block_store;
 | 
			
		||||
	nano::store::rocksdb::confirmation_height confirmation_height_store;
 | 
			
		||||
	nano::store::rocksdb::final_vote final_vote_store;
 | 
			
		||||
	nano::store::rocksdb::frontier frontier_store;
 | 
			
		||||
	nano::store::rocksdb::online_weight online_weight_store;
 | 
			
		||||
	nano::store::rocksdb::peer peer_store;
 | 
			
		||||
	nano::store::rocksdb::pending pending_store;
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +57,6 @@ public:
 | 
			
		|||
	friend class nano::store::rocksdb::block;
 | 
			
		||||
	friend class nano::store::rocksdb::confirmation_height;
 | 
			
		||||
	friend class nano::store::rocksdb::final_vote;
 | 
			
		||||
	friend class nano::store::rocksdb::frontier;
 | 
			
		||||
	friend class nano::store::rocksdb::online_weight;
 | 
			
		||||
	friend class nano::store::rocksdb::peer;
 | 
			
		||||
	friend class nano::store::rocksdb::pending;
 | 
			
		||||
| 
						 | 
				
			
			@ -155,6 +152,7 @@ private:
 | 
			
		|||
	bool do_upgrades (store::write_transaction const &);
 | 
			
		||||
	void upgrade_v21_to_v22 (store::write_transaction const &);
 | 
			
		||||
	void upgrade_v22_to_v23 (store::write_transaction const &);
 | 
			
		||||
	void upgrade_v23_to_v24 (store::write_transaction const &);
 | 
			
		||||
 | 
			
		||||
	void construct_column_family_mutexes ();
 | 
			
		||||
	::rocksdb::Options get_db_options ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,6 @@ enum class tables
 | 
			
		|||
	confirmation_height,
 | 
			
		||||
	default_unused, // RocksDB only
 | 
			
		||||
	final_votes,
 | 
			
		||||
	frontiers,
 | 
			
		||||
	meta,
 | 
			
		||||
	online_weight,
 | 
			
		||||
	peers,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ nano::account nano::test::random_account ()
 | 
			
		|||
 | 
			
		||||
bool nano::test::process (nano::node & node, std::vector<std::shared_ptr<nano::block>> blocks)
 | 
			
		||||
{
 | 
			
		||||
	auto const transaction = node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::frontiers, tables::pending, tables::rep_weights });
 | 
			
		||||
	auto const transaction = node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::pending, tables::rep_weights });
 | 
			
		||||
	for (auto & block : blocks)
 | 
			
		||||
	{
 | 
			
		||||
		auto result = node.process (transaction, block);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue