Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy upgrade code from lmdb store. #4293

Merged
merged 1 commit into from
Sep 25, 2023
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
42 changes: 0 additions & 42 deletions nano/store/lmdb/block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,48 +36,6 @@ class block : public nano::store::block
store::iterator<nano::block_hash, nano::store::block_w_sideband> end () const override;
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, block_w_sideband>, store::iterator<nano::block_hash, block_w_sideband>)> const & action_a) const override;

/**
* Maps block hash to send block. (Removed)
* nano::block_hash -> nano::send_block
*/
MDB_dbi send_blocks_handle{ 0 };

/**
* Maps block hash to receive block. (Removed)
* nano::block_hash -> nano::receive_block
*/
MDB_dbi receive_blocks_handle{ 0 };

/**
* Maps block hash to open block. (Removed)
* nano::block_hash -> nano::open_block
*/
MDB_dbi open_blocks_handle{ 0 };

/**
* Maps block hash to change block. (Removed)
* nano::block_hash -> nano::change_block
*/
MDB_dbi change_blocks_handle{ 0 };

/**
* Maps block hash to v0 state block. (Removed)
* nano::block_hash -> nano::state_block
*/
MDB_dbi state_blocks_v0_handle{ 0 };

/**
* Maps block hash to v1 state block. (Removed)
* nano::block_hash -> nano::state_block
*/
MDB_dbi state_blocks_v1_handle{ 0 };

/**
* Maps block hash to state block. (Removed)
* nano::block_hash -> nano::state_block
*/
MDB_dbi state_blocks_handle{ 0 };

/**
* Contains block_sideband and block for all block types (legacy send/change/open/receive & state blocks)
* nano::block_hash -> nano::block_sideband, nano::block
Expand Down
36 changes: 1 addition & 35 deletions nano/store/lmdb/lmdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,41 +194,7 @@ void nano::store::lmdb::component::open_databases (bool & error_a, store::transa
error_a |= mdb_dbi_open (env.tx (transaction_a), "pending", flags, &pending_store.pending_v0_handle) != 0;
pending_store.pending_handle = pending_store.pending_v0_handle;
error_a |= mdb_dbi_open (env.tx (transaction_a), "final_votes", flags, &final_vote_store.final_votes_handle) != 0;

auto version_l = version.get (transaction_a);
if (version_l < 19)
{
// These legacy (and state) block databases are no longer used, but need opening so they can be deleted during an upgrade
error_a |= mdb_dbi_open (env.tx (transaction_a), "send", flags, &block_store.send_blocks_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "receive", flags, &block_store.receive_blocks_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "open", flags, &block_store.open_blocks_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "change", flags, &block_store.change_blocks_handle) != 0;
if (version_l >= 15)
{
error_a |= mdb_dbi_open (env.tx (transaction_a), "state_blocks", flags, &block_store.state_blocks_handle) != 0;
block_store.state_blocks_v0_handle = block_store.state_blocks_handle;
}
}
else
{
error_a |= mdb_dbi_open (env.tx (transaction_a), "blocks", MDB_CREATE, &block_store.blocks_handle) != 0;
}

if (version_l < 16)
{
// The representation database is no longer used, but needs opening so that it can be deleted during an upgrade
error_a |= mdb_dbi_open (env.tx (transaction_a), "representation", flags, &account_store.representation_handle) != 0;
}

if (version_l < 15)
{
// These databases are no longer used, but need opening so they can be deleted during an upgrade
error_a |= mdb_dbi_open (env.tx (transaction_a), "state", flags, &block_store.state_blocks_v0_handle) != 0;
block_store.state_blocks_handle = block_store.state_blocks_v0_handle;
error_a |= mdb_dbi_open (env.tx (transaction_a), "accounts_v1", flags, &account_store.accounts_v1_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "pending_v1", flags, &pending_store.pending_v1_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "state_v1", flags, &block_store.state_blocks_v1_handle) != 0;
}
error_a |= mdb_dbi_open (env.tx (transaction_a), "blocks", MDB_CREATE, &block_store.blocks_handle) != 0;
}

bool nano::store::lmdb::component::do_upgrades (store::write_transaction & transaction_a, nano::ledger_constants & constants, bool & needs_vacuuming)
Expand Down
Loading