-
Notifications
You must be signed in to change notification settings - Fork 81
Separate ledgerdb tables #1729
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
Merged
Merged
Separate ledgerdb tables #1729
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
910526a
Init separate ledger tables
ercecan 2e180d9
Merge branch 'nightly' of https://github.com/chainwayxyz/citrea into …
ercecan 1e49ada
Merge branch 'nightly' of https://github.com/chainwayxyz/citrea into …
ercecan d1d3aaa
Add migrations for separate ledger tables
ercecan 8bad1ee
Refactor
ercecan 4c2031c
Remove unused import
ercecan 51a13f0
Add missing full node replacement tables to sequencer tables
ercecan 8027072
Add missing light client prover table
ercecan d93ccce
Merge branch 'nightly' of https://github.com/chainwayxyz/citrea into …
ercecan fc15138
Revert simple change for new pr
ercecan ac81c8f
Merge branch 'nightly' into erce/sparate-ledgerdb-tables
jfldde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
crates/batch-prover/src/db_migrations/remove_unused_common_tables.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::sync::Arc; | ||
|
||
use sov_db::ledger_db::migrations::{LedgerMigration, MigrationName, MigrationVersion}; | ||
use sov_db::ledger_db::LedgerDB; | ||
use sov_db::schema::tables::{BATCH_PROVER_LEDGER_TABLES, LEDGER_TABLES}; | ||
|
||
/// Table removal migration | ||
/// tables BatchByNumber and SlotByNumber are removed | ||
pub(crate) struct RemoveUnusedTables {} | ||
|
||
impl LedgerMigration for RemoveUnusedTables { | ||
fn identifier(&self) -> (MigrationName, MigrationVersion) { | ||
("RemoveUnusedTables".to_owned(), 3) | ||
} | ||
|
||
fn execute( | ||
&self, | ||
ledger_db: Arc<LedgerDB>, | ||
tables_to_drop: &mut Vec<String>, | ||
) -> anyhow::Result<()> { | ||
// Get difference of LEDGER_TABLES and SEQUENCER_LEDGER_TABLES and drop them | ||
let mut diff = LEDGER_TABLES.to_vec(); | ||
diff.retain(|x| !BATCH_PROVER_LEDGER_TABLES.contains(x)); | ||
let diff_tables = diff.iter().map(|x| x.to_string()).collect::<Vec<_>>(); | ||
for table in diff_tables { | ||
// Check if table exists in the database | ||
if let Ok(_cf_handle) = ledger_db.get_cf_handle(&table) { | ||
tables_to_drop.push(table); | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
crates/fullnode/src/db_migrations/remove_unused_common_tables.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::sync::Arc; | ||
|
||
use sov_db::ledger_db::migrations::{LedgerMigration, MigrationName, MigrationVersion}; | ||
use sov_db::ledger_db::LedgerDB; | ||
use sov_db::schema::tables::{FULL_NODE_LEDGER_TABLES, LEDGER_TABLES}; | ||
|
||
/// Table removal migration | ||
/// tables BatchByNumber and SlotByNumber are removed | ||
pub(crate) struct RemoveUnusedTables {} | ||
|
||
impl LedgerMigration for RemoveUnusedTables { | ||
fn identifier(&self) -> (MigrationName, MigrationVersion) { | ||
("RemoveUnusedTables".to_owned(), 3) | ||
} | ||
|
||
fn execute( | ||
&self, | ||
ledger_db: Arc<LedgerDB>, | ||
tables_to_drop: &mut Vec<String>, | ||
) -> anyhow::Result<()> { | ||
// Get difference of LEDGER_TABLES and SEQUENCER_LEDGER_TABLES and drop them | ||
let mut diff = LEDGER_TABLES.to_vec(); | ||
diff.retain(|x| !FULL_NODE_LEDGER_TABLES.contains(x)); | ||
let diff_tables = diff.iter().map(|x| x.to_string()).collect::<Vec<_>>(); | ||
for table in diff_tables { | ||
// Check if table exists in the database | ||
if let Ok(_cf_handle) = ledger_db.get_cf_handle(&table) { | ||
tables_to_drop.push(table); | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
crates/light-client-prover/src/db_migrations/remove_unused_common_tables.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::sync::Arc; | ||
|
||
use sov_db::ledger_db::migrations::{LedgerMigration, MigrationName, MigrationVersion}; | ||
use sov_db::ledger_db::LedgerDB; | ||
use sov_db::schema::tables::{LEDGER_TABLES, LIGHT_CLIENT_PROVER_LEDGER_TABLES}; | ||
|
||
/// Table removal migration | ||
/// tables BatchByNumber and SlotByNumber are removed | ||
pub(crate) struct RemoveUnusedTables {} | ||
|
||
impl LedgerMigration for RemoveUnusedTables { | ||
fn identifier(&self) -> (MigrationName, MigrationVersion) { | ||
("RemoveUnusedTables".to_owned(), 3) | ||
} | ||
|
||
fn execute( | ||
&self, | ||
ledger_db: Arc<LedgerDB>, | ||
tables_to_drop: &mut Vec<String>, | ||
) -> anyhow::Result<()> { | ||
// Get difference of LEDGER_TABLES and SEQUENCER_LEDGER_TABLES and drop them | ||
let mut diff = LEDGER_TABLES.to_vec(); | ||
diff.retain(|x| !LIGHT_CLIENT_PROVER_LEDGER_TABLES.contains(x)); | ||
let diff_tables = diff.iter().map(|x| x.to_string()).collect::<Vec<_>>(); | ||
for table in diff_tables { | ||
// Check if table exists in the database | ||
if let Ok(_cf_handle) = ledger_db.get_cf_handle(&table) { | ||
tables_to_drop.push(table); | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
crates/sequencer/src/db_migrations/remove_unused_common_tables.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::sync::Arc; | ||
|
||
use sov_db::ledger_db::migrations::{LedgerMigration, MigrationName, MigrationVersion}; | ||
use sov_db::ledger_db::LedgerDB; | ||
use sov_db::schema::tables::{LEDGER_TABLES, SEQUENCER_LEDGER_TABLES}; | ||
|
||
/// Table removal migration | ||
/// tables BatchByNumber and SlotByNumber are removed | ||
pub(crate) struct RemoveUnusedTables {} | ||
|
||
impl LedgerMigration for RemoveUnusedTables { | ||
fn identifier(&self) -> (MigrationName, MigrationVersion) { | ||
("RemoveUnusedTables".to_owned(), 3) | ||
} | ||
|
||
fn execute( | ||
&self, | ||
ledger_db: Arc<LedgerDB>, | ||
tables_to_drop: &mut Vec<String>, | ||
) -> anyhow::Result<()> { | ||
// Get difference of LEDGER_TABLES and SEQUENCER_LEDGER_TABLES and drop them | ||
let mut diff = LEDGER_TABLES.to_vec(); | ||
diff.retain(|x| !SEQUENCER_LEDGER_TABLES.contains(x)); | ||
let diff_tables = diff.iter().map(|x| x.to_string()).collect::<Vec<_>>(); | ||
for table in diff_tables { | ||
// Check if table exists in the database | ||
if let Ok(_cf_handle) = ledger_db.get_cf_handle(&table) { | ||
tables_to_drop.push(table); | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.