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

Storage: remove get_range #359

Merged
merged 6 commits into from
Dec 19, 2024
Merged

Storage: remove get_range #359

merged 6 commits into from
Dec 19, 2024

Conversation

Boog900
Copy link
Member

@Boog900 Boog900 commented Dec 18, 2024

@github-actions github-actions bot added the A-storage Related to storage. label Dec 18, 2024
Comment on lines 617 to 620
let (block_ids, block_weights) = (first_known_height..last_height_in_chain_entry)
.into_iter()
.map(|height| {
let block_info = table_block_infos.get(&height)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a temporary fix right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be, yes

@Boog900 Boog900 marked this pull request as ready for review December 18, 2024 22:15
@github-actions github-actions bot added A-dependency Related to dependencies, or changes to a Cargo.{toml,lock} file. A-workspace Changes to a root workspace file or general repo file. labels Dec 18, 2024
@Boog900
Copy link
Member Author

Boog900 commented Dec 18, 2024

@hinto-janai I spent way too much time trying to get this to work without success, for now I think this is the best option. If you have an idea, feel free, although I don't think it's worth spending much time on when it's not used much.

@Boog900 Boog900 requested a review from hinto-janai December 18, 2024 22:35
Comment on lines 2709 to +2712
name = "redb"
version = "2.2.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84b1de48a7cf7ba193e81e078d17ee2b786236eed1d3f7c60f8a09545efc4925"
checksum = "a7c2a94325f9c5826b17c42af11067230f503747f870117a28180e85696e21ba"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#212 can be closed when this is merged.

Comment on lines +36 to +37
/*
FIXME: <https://github.com/Cuprate/cuprate/issues/348>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth leaving this as-is then where used in cuprate_blockchain it branches on the backend? E.g.:

let tx_blobs = if cfg!(feature = "heed") {
    (first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))
        .map(|idx| {
            let tx_blob = tables.tx_blobs().get(&idx)?.0;

            Ok(Bytes::from(tx_blob))
        })
        .collect::<Result<_, RuntimeError>>()?
} else {
    tables
        .tx_blobs_iter()
        .get_range(first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))?
        .map(|tx_blob| Ok(Bytes::from(tx_blob?.0)))
        .collect::<Result<_, RuntimeError>>()?
};

Or is it not that important for now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or actually, the DatabaseIter::get_range impl for heed would just use get internally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or actually, the DatabaseIter::get_range impl for heed would just use get internally.

I tried to do this but it's harder than it sounds. In get_range we don't know how much of the range we actually have, i.e if we ask for 0..100 but we only have the key 50 stored we still need to check the other 99 keys, not impossible but defiantly a footgun IMO.

Would it be worth leaving this as-is then where used in cuprate_blockchain it branches on the backend?

I don't think the complexity is worth it. This is only used for other nodes syncing from us, which from some initial tests, is still significantly faster than monerod

@Boog900 Boog900 merged commit 80369b8 into main Dec 19, 2024
6 checks passed
@Boog900 Boog900 deleted the get-range-fix branch December 19, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependency Related to dependencies, or changes to a Cargo.{toml,lock} file. A-storage Related to storage. A-workspace Changes to a root workspace file or general repo file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants