Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Bloom upgrade in beta #2609

Merged
merged 5 commits into from
Oct 14, 2016
Merged

Bloom upgrade in beta #2609

merged 5 commits into from
Oct 14, 2016

Conversation

NikVolf
Copy link
Contributor

@NikVolf NikVolf commented Oct 13, 2016

No description provided.

@NikVolf NikVolf added A0-pleasereview 🤓 Pull request needs code review. B0-patch M4-core ⛓ Core client code / Rust. labels Oct 13, 2016
Copy link
Contributor

@rphmeier rphmeier left a comment

Choose a reason for hiding this comment

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

A progress indicator should also be added while the journal is being built, a lot of folks complained about it in the first migration.


fn check_bloom_exists(db: &Database) -> bool {

fn check_bloom_exists(db: &Arc<Database>) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Justification for double pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as below

Copy link
Contributor

Choose a reason for hiding this comment

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

i don't understand. you only need an &Database for get, no cloning required

let hash_count_entry = db.get(DB_COL_ACCOUNT_BLOOM, ACCOUNT_BLOOM_HASHCOUNT_KEY)
.expect("Low-level database error");

hash_count_entry.is_some()
}

fn check_space_match(db: &Arc<Database>) -> Result<(), usize> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Justification for double pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to avoid cloning

Copy link
Contributor Author

@NikVolf NikVolf Oct 13, 2016

Choose a reason for hiding this comment

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

ah right, no need there, updated

let db_space = db.get(DB_COL_ACCOUNT_BLOOM, ACCOUNT_BLOOM_SPACE_KEY)
.expect("Low-level database error")
.map(|val| LittleEndian::read_u64(&val[..]) as usize)
.unwrap_or(1048576);
Copy link
Contributor

Choose a reason for hiding this comment

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

magic number should be extracted to constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is one-time magic number, it will never change

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, at least a comment would be helpful. I'm assuming this was the initial size of the bloom, but not 100% sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

k, added

}

println!("Adding accounts bloom (one-time upgrade)");
let db = ::std::sync::Arc::new(source);
println!("Adding/expanding accounts bloom (one-time upgrade)");
Copy link
Contributor

Choose a reason for hiding this comment

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

mix of printing and logging in this function. logging should be favored over printing wherever possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all migration messages are printed

Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be no println!. Please use info!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be fixed for other migration messages

@NikVolf
Copy link
Contributor Author

NikVolf commented Oct 13, 2016

users worried about migration that included full database copy, this one should be rather fast, no need for progress

about 1 second for 500k accounts, might be several seconds for current amount

@rphmeier
Copy link
Contributor

@NikVolf is that on an HDD or SSD? The database might be up to 10M accounts by now.

@NikVolf
Copy link
Contributor Author

NikVolf commented Oct 13, 2016

@rphmeier SSD

@rphmeier
Copy link
Contributor

rphmeier commented Oct 13, 2016

@NikVolf, adding a progress would be a two-line change, let mut progress = ::util::migration::Progress::default() and then progress.tick() for every account written. Just in case it takes 10 minutes on some slow HDDs, users would appreciate it. I find that iterating the trie in archive mode is very slow, even on an SSD.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 87.351% when pulling b2931cb on bloom-upgrade into 3c2c356 on beta.

@NikVolf
Copy link
Contributor Author

NikVolf commented Oct 13, 2016

@rphmeier added progress

@rphmeier rphmeier added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 13, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 87.327% when pulling f5df88b on bloom-upgrade into 3c2c356 on beta.

@arkpar arkpar added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A8-looksgood 🦄 Pull request is reviewed well. labels Oct 13, 2016
@arkpar
Copy link
Collaborator

arkpar commented Oct 13, 2016

It took a few minutes on my machine for the first progress dot to appear

@arkpar
Copy link
Collaborator

arkpar commented Oct 13, 2016

does it make the database incompatible with current master or previous beta release?

@@ -138,13 +139,11 @@ impl StateDB {
}

pub fn check_account_bloom(&self, address: &Address) -> bool {
trace!(target: "account_bloom", "Check account bloom: {:?}", address);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why remove these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i wanted to rename to different target so that this messages don't mess with the bloom diag messages
is there any use of it? it is just endless spam if it is on

@NikVolf
Copy link
Contributor Author

NikVolf commented Oct 13, 2016

@arkpar
yeah beta db won't be compatible with master

@arkpar arkpar added A7-looksgoodcantmerge 🙄 Pull request is reviewed well, but cannot be merged due to conflicts. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Oct 14, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 87.342% when pulling eb61649 on bloom-upgrade into 3c2c356 on beta.

LittleEndian::write_u64(&mut key, idx);
try!(batch.put(DB_COL_ACCOUNT_BLOOM, &key, &[0u8; 8]));

if idx % 10000 == 1 { progress.tick(); };
Copy link
Contributor

Choose a reason for hiding this comment

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

tick already only prints something once every 100,000 times.

@arkpar arkpar removed the B0-patch label Oct 14, 2016
@arkpar arkpar added A8-looksgood 🦄 Pull request is reviewed well. and removed A7-looksgoodcantmerge 🙄 Pull request is reviewed well, but cannot be merged due to conflicts. labels Oct 14, 2016
@arkpar arkpar merged commit d66bd3c into beta Oct 14, 2016
@gavofyork gavofyork deleted the bloom-upgrade branch November 3, 2016 11:51
nicolasochem pushed a commit to nicolasochem/parity that referenced this pull request Nov 1, 2017
Done so far:

* created the dir crate in util
* moved code from `ethstore/src/dir/paths.rs` to dir crate
* rename `dir` module in ethstore to `accounts_dir` to distinguish it
  from the dir crate

Is there a need to mutualize some code in the newly created
`util/dir/src/lib.rs` ? If so, I would need some guidance as of which
functions are to be mutualized.
nicolasochem pushed a commit to nicolasochem/parity that referenced this pull request Nov 1, 2017
Done so far:

* created the dir crate in util
* moved code from `ethstore/src/dir/paths.rs` to dir crate
* rename `dir` module in ethstore to `accounts_dir` to distinguish it
  from the dir crate

Is there a need to mutualize some code in the newly created
`util/dir/src/lib.rs` ? If so, I would need some guidance as of which
functions are to be mutualized.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants