Rename nano::store::write_database_queue to nano::store::write_queue
This commit is contained in:
		
					parent
					
						
							
								1fda9d2976
							
						
					
				
			
			
				commit
				
					
						24a55d8f6b
					
				
			
		
					 14 changed files with 45 additions and 45 deletions
				
			
		|  | @ -18,14 +18,14 @@ using namespace std::chrono_literals; | ||||||
| TEST (confirming_set, construction) | TEST (confirming_set, construction) | ||||||
| { | { | ||||||
| 	auto ctx = nano::test::context::ledger_empty (); | 	auto ctx = nano::test::context::ledger_empty (); | ||||||
| 	nano::store::write_database_queue write_queue{ false }; | 	nano::store::write_queue write_queue{ false }; | ||||||
| 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TEST (confirming_set, add_exists) | TEST (confirming_set, add_exists) | ||||||
| { | { | ||||||
| 	auto ctx = nano::test::context::ledger_send_receive (); | 	auto ctx = nano::test::context::ledger_send_receive (); | ||||||
| 	nano::store::write_database_queue write_queue{ false }; | 	nano::store::write_queue write_queue{ false }; | ||||||
| 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | ||||||
| 	auto send = ctx.blocks ()[0]; | 	auto send = ctx.blocks ()[0]; | ||||||
| 	confirming_set.add (send->hash ()); | 	confirming_set.add (send->hash ()); | ||||||
|  | @ -35,7 +35,7 @@ TEST (confirming_set, add_exists) | ||||||
| TEST (confirming_set, process_one) | TEST (confirming_set, process_one) | ||||||
| { | { | ||||||
| 	auto ctx = nano::test::context::ledger_send_receive (); | 	auto ctx = nano::test::context::ledger_send_receive (); | ||||||
| 	nano::store::write_database_queue write_queue{ false }; | 	nano::store::write_queue write_queue{ false }; | ||||||
| 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | ||||||
| 	std::atomic<int> count = 0; | 	std::atomic<int> count = 0; | ||||||
| 	std::mutex mutex; | 	std::mutex mutex; | ||||||
|  | @ -52,7 +52,7 @@ TEST (confirming_set, process_one) | ||||||
| TEST (confirming_set, process_multiple) | TEST (confirming_set, process_multiple) | ||||||
| { | { | ||||||
| 	auto ctx = nano::test::context::ledger_send_receive (); | 	auto ctx = nano::test::context::ledger_send_receive (); | ||||||
| 	nano::store::write_database_queue write_queue{ false }; | 	nano::store::write_queue write_queue{ false }; | ||||||
| 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | 	nano::confirming_set confirming_set (ctx.ledger (), write_queue); | ||||||
| 	std::atomic<int> count = 0; | 	std::atomic<int> count = 0; | ||||||
| 	std::mutex mutex; | 	std::mutex mutex; | ||||||
|  | @ -118,7 +118,7 @@ TEST (confirmation_callback, confirmed_history) | ||||||
| { | { | ||||||
| 	nano::test::system system; | 	nano::test::system system; | ||||||
| 	nano::node_flags node_flags; | 	nano::node_flags node_flags; | ||||||
| 	node_flags.force_use_write_database_queue = true; | 	node_flags.force_use_write_queue = true; | ||||||
| 	node_flags.disable_ascending_bootstrap = true; | 	node_flags.disable_ascending_bootstrap = true; | ||||||
| 	nano::node_config node_config = system.default_config (); | 	nano::node_config node_config = system.default_config (); | ||||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||||
|  | @ -155,7 +155,7 @@ TEST (confirmation_callback, confirmed_history) | ||||||
| 	ASSERT_TIMELY (5s, election = nano::test::start_election (system, *node, send1->hash ())); | 	ASSERT_TIMELY (5s, election = nano::test::start_election (system, *node, send1->hash ())); | ||||||
| 	{ | 	{ | ||||||
| 		// The write guard prevents the confirmation height processor doing any writes
 | 		// The write guard prevents the confirmation height processor doing any writes
 | ||||||
| 		auto write_guard = node->write_database_queue.wait (nano::store::writer::testing); | 		auto write_guard = node->write_queue.wait (nano::store::writer::testing); | ||||||
| 
 | 
 | ||||||
| 		// Confirm send1
 | 		// Confirm send1
 | ||||||
| 		election->force_confirm (); | 		election->force_confirm (); | ||||||
|  | @ -166,13 +166,13 @@ TEST (confirmation_callback, confirmed_history) | ||||||
| 		auto transaction = node->store.tx_begin_read (); | 		auto transaction = node->store.tx_begin_read (); | ||||||
| 		ASSERT_FALSE (node->ledger.block_confirmed (transaction, send->hash ())); | 		ASSERT_FALSE (node->ledger.block_confirmed (transaction, send->hash ())); | ||||||
| 
 | 
 | ||||||
| 		ASSERT_TIMELY (10s, node->write_database_queue.contains (nano::store::writer::confirmation_height)); | 		ASSERT_TIMELY (10s, node->write_queue.contains (nano::store::writer::confirmation_height)); | ||||||
| 
 | 
 | ||||||
| 		// Confirm that no inactive callbacks have been called when the confirmation height processor has already iterated over it, waiting to write
 | 		// Confirm that no inactive callbacks have been called when the confirmation height processor has already iterated over it, waiting to write
 | ||||||
| 		ASSERT_EQ (0, node->stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::inactive_conf_height, nano::stat::dir::out)); | 		ASSERT_EQ (0, node->stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::inactive_conf_height, nano::stat::dir::out)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	ASSERT_TIMELY (10s, !node->write_database_queue.contains (nano::store::writer::confirmation_height)); | 	ASSERT_TIMELY (10s, !node->write_queue.contains (nano::store::writer::confirmation_height)); | ||||||
| 
 | 
 | ||||||
| 	auto transaction = node->store.tx_begin_read (); | 	auto transaction = node->store.tx_begin_read (); | ||||||
| 	ASSERT_TRUE (node->ledger.block_confirmed (transaction, send->hash ())); | 	ASSERT_TRUE (node->ledger.block_confirmed (transaction, send->hash ())); | ||||||
|  | @ -196,7 +196,7 @@ TEST (confirmation_callback, dependent_election) | ||||||
| { | { | ||||||
| 	nano::test::system system; | 	nano::test::system system; | ||||||
| 	nano::node_flags node_flags; | 	nano::node_flags node_flags; | ||||||
| 	node_flags.force_use_write_database_queue = true; | 	node_flags.force_use_write_queue = true; | ||||||
| 	nano::node_config node_config = system.default_config (); | 	nano::node_config node_config = system.default_config (); | ||||||
| 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | 	node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; | ||||||
| 	auto node = system.add_node (node_config, node_flags); | 	auto node = system.add_node (node_config, node_flags); | ||||||
|  |  | ||||||
|  | @ -784,7 +784,7 @@ TEST (ledger_confirm, pruned_source) | ||||||
| 	nano::stats stats; | 	nano::stats stats; | ||||||
| 	nano::ledger ledger (*store, stats, nano::dev::constants); | 	nano::ledger ledger (*store, stats, nano::dev::constants); | ||||||
| 	ledger.pruning = true; | 	ledger.pruning = true; | ||||||
| 	nano::store::write_database_queue write_database_queue (false); | 	nano::store::write_queue write_queue (false); | ||||||
| 	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | 	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | ||||||
| 	nano::keypair key1, key2; | 	nano::keypair key1, key2; | ||||||
| 	nano::block_builder builder; | 	nano::block_builder builder; | ||||||
|  | @ -868,7 +868,7 @@ TEST (ledger_confirmDeathTest, rollback_added_block) | ||||||
| 		ASSERT_TRUE (!store->init_error ()); | 		ASSERT_TRUE (!store->init_error ()); | ||||||
| 		nano::stats stats; | 		nano::stats stats; | ||||||
| 		nano::ledger ledger (*store, stats, nano::dev::constants); | 		nano::ledger ledger (*store, stats, nano::dev::constants); | ||||||
| 		nano::store::write_database_queue write_database_queue (false); | 		nano::store::write_queue write_queue (false); | ||||||
| 		nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | 		nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | ||||||
| 		nano::keypair key1; | 		nano::keypair key1; | ||||||
| 		nano::block_builder builder; | 		nano::block_builder builder; | ||||||
|  |  | ||||||
|  | @ -2663,7 +2663,7 @@ TEST (node, block_processor_full) | ||||||
| { | { | ||||||
| 	nano::test::system system; | 	nano::test::system system; | ||||||
| 	nano::node_flags node_flags; | 	nano::node_flags node_flags; | ||||||
| 	node_flags.force_use_write_database_queue = true; | 	node_flags.force_use_write_queue = true; | ||||||
| 	node_flags.block_processor_full_size = 3; | 	node_flags.block_processor_full_size = 3; | ||||||
| 	auto & node = *system.add_node (nano::node_config (system.get_available_port ()), node_flags); | 	auto & node = *system.add_node (nano::node_config (system.get_available_port ()), node_flags); | ||||||
| 	nano::state_block_builder builder; | 	nano::state_block_builder builder; | ||||||
|  | @ -2709,7 +2709,7 @@ TEST (node, block_processor_half_full) | ||||||
| 	nano::test::system system; | 	nano::test::system system; | ||||||
| 	nano::node_flags node_flags; | 	nano::node_flags node_flags; | ||||||
| 	node_flags.block_processor_full_size = 6; | 	node_flags.block_processor_full_size = 6; | ||||||
| 	node_flags.force_use_write_database_queue = true; | 	node_flags.force_use_write_queue = true; | ||||||
| 	auto & node = *system.add_node (nano::node_config (system.get_available_port ()), node_flags); | 	auto & node = *system.add_node (nano::node_config (system.get_available_port ()), node_flags); | ||||||
| 	nano::state_block_builder builder; | 	nano::state_block_builder builder; | ||||||
| 	auto send1 = builder.make_block () | 	auto send1 = builder.make_block () | ||||||
|  | @ -2740,7 +2740,7 @@ TEST (node, block_processor_half_full) | ||||||
| 				 .work (*node.work_generate_blocking (send2->hash ())) | 				 .work (*node.work_generate_blocking (send2->hash ())) | ||||||
| 				 .build (); | 				 .build (); | ||||||
| 	// The write guard prevents block processor doing any writes
 | 	// The write guard prevents block processor doing any writes
 | ||||||
| 	auto write_guard = node.write_database_queue.wait (nano::store::writer::testing); | 	auto write_guard = node.write_queue.wait (nano::store::writer::testing); | ||||||
| 	node.block_processor.add (send1); | 	node.block_processor.add (send1); | ||||||
| 	ASSERT_FALSE (node.block_processor.half_full ()); | 	ASSERT_FALSE (node.block_processor.half_full ()); | ||||||
| 	node.block_processor.add (send2); | 	node.block_processor.add (send2); | ||||||
|  | @ -3097,7 +3097,7 @@ TEST (node, rollback_vote_self) | ||||||
| 
 | 
 | ||||||
| 	{ | 	{ | ||||||
| 		// The write guard prevents the block processor from performing the rollback
 | 		// The write guard prevents the block processor from performing the rollback
 | ||||||
| 		auto write_guard = node.write_database_queue.wait (nano::store::writer::testing); | 		auto write_guard = node.write_queue.wait (nano::store::writer::testing); | ||||||
| 
 | 
 | ||||||
| 		ASSERT_EQ (0, election->votes_with_weight ().size ()); | 		ASSERT_EQ (0, election->votes_with_weight ().size ()); | ||||||
| 		// Vote with key to switch the winner
 | 		// Vote with key to switch the winner
 | ||||||
|  |  | ||||||
|  | @ -37,10 +37,10 @@ void nano::block_processor::context::set_result (result_t const & result) | ||||||
|  * block_processor |  * block_processor | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| nano::block_processor::block_processor (nano::node & node_a, nano::store::write_database_queue & write_database_queue_a) : | nano::block_processor::block_processor (nano::node & node_a, nano::store::write_queue & write_queue_a) : | ||||||
| 	config{ node_a.config.block_processor }, | 	config{ node_a.config.block_processor }, | ||||||
| 	node (node_a), | 	node (node_a), | ||||||
| 	write_database_queue (write_database_queue_a), | 	write_queue (write_queue_a), | ||||||
| 	next_log (std::chrono::steady_clock::now ()) | 	next_log (std::chrono::steady_clock::now ()) | ||||||
| { | { | ||||||
| 	batch_processed.add ([this] (auto const & items) { | 	batch_processed.add ([this] (auto const & items) { | ||||||
|  | @ -300,7 +300,7 @@ auto nano::block_processor::process_batch (nano::unique_lock<nano::mutex> & lock | ||||||
| { | { | ||||||
| 	processed_batch_t processed; | 	processed_batch_t processed; | ||||||
| 
 | 
 | ||||||
| 	auto scoped_write_guard = write_database_queue.wait (nano::store::writer::process_batch); | 	auto scoped_write_guard = write_queue.wait (nano::store::writer::process_batch); | ||||||
| 	auto transaction (node.store.tx_begin_write ({ tables::accounts, tables::blocks, 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; | 	nano::timer<std::chrono::milliseconds> timer_l; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ class node; | ||||||
| namespace nano::store | namespace nano::store | ||||||
| { | { | ||||||
| class write_transaction; | class write_transaction; | ||||||
| class write_database_queue; | class write_queue; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| namespace nano | namespace nano | ||||||
|  | @ -86,7 +86,7 @@ public: // Context | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
| 	block_processor (nano::node &, nano::store::write_database_queue &); | 	block_processor (nano::node &, nano::store::write_queue &); | ||||||
| 	~block_processor (); | 	~block_processor (); | ||||||
| 
 | 
 | ||||||
| 	void start (); | 	void start (); | ||||||
|  | @ -127,7 +127,7 @@ private: | ||||||
| private: // Dependencies
 | private: // Dependencies
 | ||||||
| 	block_processor_config const & config; | 	block_processor_config const & config; | ||||||
| 	nano::node & node; | 	nano::node & node; | ||||||
| 	nano::store::write_database_queue & write_database_queue; | 	nano::store::write_queue & write_queue; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| 	nano::fair_queue<context, block_source> queue; | 	nano::fair_queue<context, block_source> queue; | ||||||
|  |  | ||||||
|  | @ -2,9 +2,9 @@ | ||||||
| #include <nano/node/confirming_set.hpp> | #include <nano/node/confirming_set.hpp> | ||||||
| #include <nano/secure/ledger.hpp> | #include <nano/secure/ledger.hpp> | ||||||
| #include <nano/store/component.hpp> | #include <nano/store/component.hpp> | ||||||
| #include <nano/store/write_database_queue.hpp> | #include <nano/store/write_queue.hpp> | ||||||
| 
 | 
 | ||||||
| nano::confirming_set::confirming_set (nano::ledger & ledger, nano::store::write_database_queue & write_queue, std::chrono::milliseconds batch_time) : | nano::confirming_set::confirming_set (nano::ledger & ledger, nano::store::write_queue & write_queue, std::chrono::milliseconds batch_time) : | ||||||
| 	ledger{ ledger }, | 	ledger{ ledger }, | ||||||
| 	write_queue{ write_queue }, | 	write_queue{ write_queue }, | ||||||
| 	batch_time{ batch_time } | 	batch_time{ batch_time } | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ class ledger; | ||||||
| } | } | ||||||
| namespace nano::store | namespace nano::store | ||||||
| { | { | ||||||
| class write_database_queue; | class write_queue; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| namespace nano | namespace nano | ||||||
|  | @ -30,7 +30,7 @@ class confirming_set final | ||||||
| 	friend class confirmation_height_pruned_source_Test; | 	friend class confirmation_height_pruned_source_Test; | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
| 	confirming_set (nano::ledger & ledger, nano::store::write_database_queue & write_queue, std::chrono::milliseconds batch_time = std::chrono::milliseconds{ 500 }); | 	confirming_set (nano::ledger & ledger, nano::store::write_queue & write_queue, std::chrono::milliseconds batch_time = std::chrono::milliseconds{ 500 }); | ||||||
| 	~confirming_set (); | 	~confirming_set (); | ||||||
| 	// Adds a block to the set of blocks to be confirmed
 | 	// Adds a block to the set of blocks to be confirmed
 | ||||||
| 	void add (nano::block_hash const & hash); | 	void add (nano::block_hash const & hash); | ||||||
|  | @ -48,7 +48,7 @@ public: | ||||||
| private: | private: | ||||||
| 	void run (); | 	void run (); | ||||||
| 	nano::ledger & ledger; | 	nano::ledger & ledger; | ||||||
| 	nano::store::write_database_queue & write_queue; | 	nano::store::write_queue & write_queue; | ||||||
| 	std::chrono::milliseconds batch_time; | 	std::chrono::milliseconds batch_time; | ||||||
| 	std::unordered_set<nano::block_hash> set; | 	std::unordered_set<nano::block_hash> set; | ||||||
| 	std::unordered_set<nano::block_hash> processing; | 	std::unordered_set<nano::block_hash> processing; | ||||||
|  |  | ||||||
|  | @ -135,7 +135,7 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy | ||||||
| 	io_ctx_shared{ io_ctx_a }, | 	io_ctx_shared{ io_ctx_a }, | ||||||
| 	io_ctx{ *io_ctx_shared }, | 	io_ctx{ *io_ctx_shared }, | ||||||
| 	node_id{ load_or_create_node_id (application_path_a) }, | 	node_id{ load_or_create_node_id (application_path_a) }, | ||||||
| 	write_database_queue (!flags_a.force_use_write_database_queue && (config_a.rocksdb_config.enable)), | 	write_queue (!flags_a.force_use_write_queue && (config_a.rocksdb_config.enable)), | ||||||
| 	node_initialized_latch (1), | 	node_initialized_latch (1), | ||||||
| 	config (config_a), | 	config (config_a), | ||||||
| 	network_params{ config.network_params }, | 	network_params{ config.network_params }, | ||||||
|  | @ -171,8 +171,8 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy | ||||||
| 	tcp_listener{ std::make_shared<nano::transport::tcp_listener> (network.port, *this, config.tcp_incoming_connections_max) }, | 	tcp_listener{ std::make_shared<nano::transport::tcp_listener> (network.port, *this, config.tcp_incoming_connections_max) }, | ||||||
| 	application_path (application_path_a), | 	application_path (application_path_a), | ||||||
| 	port_mapping (*this), | 	port_mapping (*this), | ||||||
| 	block_processor (*this, write_database_queue), | 	block_processor (*this, write_queue), | ||||||
| 	confirming_set_impl{ std::make_unique<nano::confirming_set> (ledger, write_database_queue, config.confirming_set_batch_time) }, | 	confirming_set_impl{ std::make_unique<nano::confirming_set> (ledger, write_queue, config.confirming_set_batch_time) }, | ||||||
| 	confirming_set{ *confirming_set_impl }, | 	confirming_set{ *confirming_set_impl }, | ||||||
| 	active_impl{ std::make_unique<nano::active_transactions> (*this, confirming_set, block_processor) }, | 	active_impl{ std::make_unique<nano::active_transactions> (*this, confirming_set, block_processor) }, | ||||||
| 	active{ *active_impl }, | 	active{ *active_impl }, | ||||||
|  | @ -1005,7 +1005,7 @@ void nano::node::ledger_pruning (uint64_t const batch_size_a, bool bootstrap_wei | ||||||
| 		transaction_write_count = 0; | 		transaction_write_count = 0; | ||||||
| 		if (!pruning_targets.empty () && !stopped) | 		if (!pruning_targets.empty () && !stopped) | ||||||
| 		{ | 		{ | ||||||
| 			auto scoped_write_guard = write_database_queue.wait (nano::store::writer::pruning); | 			auto scoped_write_guard = write_queue.wait (nano::store::writer::pruning); | ||||||
| 			auto write_transaction (store.tx_begin_write ({ tables::blocks, tables::pruned })); | 			auto write_transaction (store.tx_begin_write ({ tables::blocks, tables::pruned })); | ||||||
| 			while (!pruning_targets.empty () && transaction_write_count < batch_size_a && !stopped) | 			while (!pruning_targets.empty () && transaction_write_count < batch_size_a && !stopped) | ||||||
| 			{ | 			{ | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ | ||||||
| #include <nano/node/wallet.hpp> | #include <nano/node/wallet.hpp> | ||||||
| #include <nano/node/websocket.hpp> | #include <nano/node/websocket.hpp> | ||||||
| #include <nano/secure/utility.hpp> | #include <nano/secure/utility.hpp> | ||||||
| #include <nano/store/write_database_queue.hpp> | #include <nano/store/write_queue.hpp> | ||||||
| 
 | 
 | ||||||
| #include <boost/program_options.hpp> | #include <boost/program_options.hpp> | ||||||
| #include <boost/thread/latch.hpp> | #include <boost/thread/latch.hpp> | ||||||
|  | @ -138,7 +138,7 @@ public: | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
| 	const nano::keypair node_id; | 	const nano::keypair node_id; | ||||||
| 	nano::store::write_database_queue write_database_queue; | 	nano::store::write_queue write_queue; | ||||||
| 	std::shared_ptr<boost::asio::io_context> io_ctx_shared; | 	std::shared_ptr<boost::asio::io_context> io_ctx_shared; | ||||||
| 	boost::asio::io_context & io_ctx; | 	boost::asio::io_context & io_ctx; | ||||||
| 	boost::latch node_initialized_latch; | 	boost::latch node_initialized_latch; | ||||||
|  |  | ||||||
|  | @ -171,7 +171,7 @@ public: | ||||||
| 	bool allow_bootstrap_peers_duplicates{ false }; | 	bool allow_bootstrap_peers_duplicates{ false }; | ||||||
| 	bool disable_max_peers_per_ip{ false }; // For testing only
 | 	bool disable_max_peers_per_ip{ false }; // For testing only
 | ||||||
| 	bool disable_max_peers_per_subnetwork{ false }; // For testing only
 | 	bool disable_max_peers_per_subnetwork{ false }; // For testing only
 | ||||||
| 	bool force_use_write_database_queue{ false }; // For testing only. RocksDB does not use the database queue, but some tests rely on it being used.
 | 	bool force_use_write_queue{ false }; // For testing only. RocksDB does not use the database queue, but some tests rely on it being used.
 | ||||||
| 	bool disable_search_pending{ false }; // For testing only
 | 	bool disable_search_pending{ false }; // For testing only
 | ||||||
| 	bool enable_pruning{ false }; | 	bool enable_pruning{ false }; | ||||||
| 	bool fast_bootstrap{ false }; | 	bool fast_bootstrap{ false }; | ||||||
|  |  | ||||||
|  | @ -1136,13 +1136,13 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections) | ||||||
| 	ASSERT_TRUE (!store->init_error ()); | 	ASSERT_TRUE (!store->init_error ()); | ||||||
| 	nano::stats stats; | 	nano::stats stats; | ||||||
| 	nano::ledger ledger (*store, stats, nano::dev::constants); | 	nano::ledger ledger (*store, stats, nano::dev::constants); | ||||||
| 	nano::store::write_database_queue write_database_queue (false); | 	nano::store::write_queue write_database_queue (false); | ||||||
| 	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | 	nano::work_pool pool{ nano::dev::network_params.network, std::numeric_limits<unsigned>::max () }; | ||||||
| 	std::atomic<bool> stopped{ false }; | 	std::atomic<bool> stopped{ false }; | ||||||
| 	boost::latch initialized_latch{ 0 }; | 	boost::latch initialized_latch{ 0 }; | ||||||
| 
 | 
 | ||||||
| 	nano::block_hash block_hash_being_processed{ 0 }; | 	nano::block_hash block_hash_being_processed{ 0 }; | ||||||
| 	nano::store::write_database_queue write_queue{ false }; | 	nano::store::write_queue write_queue{ false }; | ||||||
| 	nano::confirming_set confirming_set{ ledger, write_queue }; | 	nano::confirming_set confirming_set{ ledger, write_queue }; | ||||||
| 
 | 
 | ||||||
| 	auto const num_accounts = 100000; | 	auto const num_accounts = 100000; | ||||||
|  |  | ||||||
|  | @ -93,8 +93,8 @@ add_library( | ||||||
|   transaction.cpp |   transaction.cpp | ||||||
|   version.cpp |   version.cpp | ||||||
|   versioning.cpp |   versioning.cpp | ||||||
|   write_database_queue.hpp |   write_queue.hpp | ||||||
|   write_database_queue.cpp) |   write_queue.cpp) | ||||||
| 
 | 
 | ||||||
| target_link_libraries( | target_link_libraries( | ||||||
|   nano_store |   nano_store | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include <nano/lib/config.hpp> | #include <nano/lib/config.hpp> | ||||||
| #include <nano/lib/utility.hpp> | #include <nano/lib/utility.hpp> | ||||||
| #include <nano/store/write_database_queue.hpp> | #include <nano/store/write_queue.hpp> | ||||||
| 
 | 
 | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| 
 | 
 | ||||||
|  | @ -50,7 +50,7 @@ void nano::store::write_guard::release () | ||||||
| 	owns = false; | 	owns = false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nano::store::write_database_queue::write_database_queue (bool use_noops_a) : | nano::store::write_queue::write_queue (bool use_noops_a) : | ||||||
| 	guard_finish_callback ([use_noops_a, &queue = queue, &mutex = mutex, &cv = cv] () { | 	guard_finish_callback ([use_noops_a, &queue = queue, &mutex = mutex, &cv = cv] () { | ||||||
| 		if (!use_noops_a) | 		if (!use_noops_a) | ||||||
| 		{ | 		{ | ||||||
|  | @ -65,7 +65,7 @@ nano::store::write_database_queue::write_database_queue (bool use_noops_a) : | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nano::store::write_guard nano::store::write_database_queue::wait (writer writer) | nano::store::write_guard nano::store::write_queue::wait (writer writer) | ||||||
| { | { | ||||||
| 	if (use_noops) | 	if (use_noops) | ||||||
| 	{ | 	{ | ||||||
|  | @ -88,14 +88,14 @@ nano::store::write_guard nano::store::write_database_queue::wait (writer writer) | ||||||
| 	return write_guard (guard_finish_callback); | 	return write_guard (guard_finish_callback); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nano::store::write_database_queue::contains (writer writer) | bool nano::store::write_queue::contains (writer writer) | ||||||
| { | { | ||||||
| 	debug_assert (!use_noops); | 	debug_assert (!use_noops); | ||||||
| 	nano::lock_guard<nano::mutex> guard (mutex); | 	nano::lock_guard<nano::mutex> guard (mutex); | ||||||
| 	return std::find (queue.cbegin (), queue.cend (), writer) != queue.cend (); | 	return std::find (queue.cbegin (), queue.cend (), writer) != queue.cend (); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nano::store::write_database_queue::process (writer writer) | bool nano::store::write_queue::process (writer writer) | ||||||
| { | { | ||||||
| 	if (use_noops) | 	if (use_noops) | ||||||
| 	{ | 	{ | ||||||
|  | @ -123,7 +123,7 @@ bool nano::store::write_database_queue::process (writer writer) | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nano::store::write_guard nano::store::write_database_queue::pop () | nano::store::write_guard nano::store::write_queue::pop () | ||||||
| { | { | ||||||
| 	return write_guard (guard_finish_callback); | 	return write_guard (guard_finish_callback); | ||||||
| } | } | ||||||
|  | @ -38,10 +38,10 @@ private: | ||||||
|  * Allocates database write access in a fair maner rather than directly waiting for mutex aquisition |  * Allocates database write access in a fair maner rather than directly waiting for mutex aquisition | ||||||
|  * Users should wait() for access to database write transaction and hold the write_guard until complete |  * Users should wait() for access to database write transaction and hold the write_guard until complete | ||||||
|  */ |  */ | ||||||
| class write_database_queue final | class write_queue final | ||||||
| { | { | ||||||
| public: | public: | ||||||
| 	write_database_queue (bool use_noops_a); | 	write_queue (bool use_noops_a); | ||||||
| 	/** Blocks until we are at the head of the queue and blocks other waiters until write_guard goes out of scope */ | 	/** Blocks until we are at the head of the queue and blocks other waiters until write_guard goes out of scope */ | ||||||
| 	[[nodiscard ("write_guard blocks other waiters")]] write_guard wait (writer writer); | 	[[nodiscard ("write_guard blocks other waiters")]] write_guard wait (writer writer); | ||||||
| 
 | 
 | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Colin LeMahieu
				Colin LeMahieu